controller_ParaDiag_nonMPI#

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

Bases: ParaDiag, controller_nonMPI

ParaDiag controller with the time steps of a block emulated serially in one process.

This is controller_nonMPI with a different iteration: where PFASST sweeps and cascades through the levels, ParaDiag diagonalizes across the steps. Everything around the iteration – blocks, windowing, restarts, convergence – is the driver it inherits, which is why the dispatcher it uses is still called pfasst.

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.

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

  • quantity (str) – The quantity the matrix is applied to, ‘residual’ or ‘increment’

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

prepare_Jacobians(local_MS_running)[source]#

Average the solution over the steps of the block, node by node, for constructing average Jacobians.

Does nothing unless average_jacobian is set. Stores the list of averages as u_avg on the finest level of every running step, which all share the same list.

Parameters:

local_MS_running (list) – list of currently running steps

set_G_inv(alpha)[source]#

Give every step the G^-1 that belongs to where it sits in the block.

Parameters:

alpha (float) – the alpha this G^-1 is built from

update_G_inv(k=0)[source]#

Rebuild G^-1 on every step if alpha changed with the iteration.

Parameters:

k (int) – 0-based ParaDiag iteration index

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