implementations.controller_classes.controller_ParaDiag_nonMPI module

class controller_ParaDiag_nonMPI(num_procs, controller_params, description)[source]

Bases: ParaDiagController

ParaDiag controller, running serialized version.

This controller uses the increment formulation. That is to say, we setup the residual of the all at once problem, put it on the right hand side, invert the ParaDiag preconditioner on the left-hand side to compute the increment and then add the increment onto the solution. For this reason, we need to replace the solution values in the steps with the residual values before the solves and then put the solution plus increment back into the steps. This is a bit counter to what you expect when you access the u variable in the levels, but it is mathematically advantageous.

ParaDiag(local_MS_active)[source]

Main function for ParaDiag

For the workflow of this controller, see https://arxiv.org/abs/2103.12571

This method changes self.MS directly by accessing active steps through local_MS_active.

Parameters:

local_MS_active (list) – all active steps

Returns:

Whether all steps are done

Return type:

boot

apply_matrix(mat, quantity)[source]

Apply a matrix on the step level. Needs to be square. Puts the result back into the controller.

Parameters:

mat – square LxL matrix with L number of steps

compute_all_at_once_residual(local_MS_running)[source]

This requires to communicate the solutions at the end of the steps to be the initial conditions for the next steps. Afterwards, the residual can be computed locally on the steps.

Parameters:

local_MS_running (list) – list of currently running steps

it_ParaDiag(local_MS_running)[source]
Do a single ParaDiag iteration. Does the following steps
    1. Compute the residual of the all-at-once / composite collocation problem

    1. Compute an FFT in time to diagonalize the preconditioner

    1. Solve the collocation problems locally on the steps for the increment

    1. Compute iFFT in time to go back to the original base

    1. Update the solution by adding increment

Note that this is the only place where we compute the all-at-once residual because it requires communication and swaps the solution values for the residuals. So after the residual tolerance is reached, one more ParaDiag iteration will be done.

Parameters:

local_MS_running (list) – list of currently running steps

it_check(local_MS_running)[source]

Key routine to check for convergence/termination

Parameters:

local_MS_running (list) – list of currently running steps

prepare_Jacobians(local_MS_running)[source]
restart_block(active_slots, time, u0)[source]

Helper routine to reset/restart block of (active) steps

Parameters:
  • active_slots – list of active steps

  • time – list of new times

  • u0 – initial value to distribute across the steps

run(u0, t0, Tend)[source]

Main driver for running the serial version of ParaDiag

Parameters:
  • u0 – initial values

  • t0 – starting time

  • Tend – ending time

Returns:

end values on the last step stats object containing statistics for each step, each level and each iteration

spread(local_MS_running)[source]

Spreading phase

Parameters:

local_MS_running (list) – list of currently running steps

update_solution(local_MS_running)[source]

Since we solve for the increment, we need to update the solution between iterations by adding the increment.

Parameters:

local_MS_running (list) – list of currently running steps