implementations.sweeper_classes.ParaDiagSweepers module

These sweepers are made for use with ParaDiag. They can be used to some degree with SDC as well, but unless you know what you are doing, you probably want another sweeper.

class QDiagonalization(params, level)[source]

Bases: generic_implicit

Sweeper solving the collocation problem directly via diagonalization of Q. Mainly made for ParaDiag. Can be reconfigured for use with SDC.

Note that the initial conditions for the collocation problem are generally stored in node zero in pySDC. However, this sweeper is intended for ParaDiag, where a node-local residual is needed as a right hand side for this sweeper rather than a step local one. Therefore, this sweeper has an option ignore_ic. If true, the value in node zero will only be used in computing the step-local residual, but not in the solves. If false, the values on the nodes will be ignored in the solves and the node-zero value will be used as initial conditions. When using this as a time- parallel algorithm outside ParaDiag, you should set this parameter to false, which is not the default!

Similarly, in ParaDiag, the solution is in Fourier space right after the solve. It therefore makes little sense to evaluate the right hand side directly after. By default, this is not done! Set update_f_evals=True in the parameters if you want to use this sweeper in SDC.

static computeDiagonalization(A)[source]

Compute diagonalization of dense matrix A = S diag(w) S^-1

Parameters:

A (numpy.ndarray) – dense matrix to diagonalize

Returns:

Diagonal entries of the diagonalized matrix w numpy.ndarray: Matrix of eigenvectors S numpy.ndarray: Inverse of S

Return type:

numpy.array

compute_residual(*args, **kwargs)[source]

Computation of the residual using the collocation matrix Q

Parameters:

stage (str) – The current stage of the step the level belongs to

eval_f_at_all_nodes()[source]
get_residual()[source]

This function computes and returns the “spatially extended” residual, not the norm of the residual!

Returns:

Spatially extended residual

Return type:

pySDC.datatype

mat_vec(mat, vec)[source]

Compute matrix-vector multiplication. Vector can be list.

Parameters:
  • mat – Matrix

  • vec – Vector

Returns:

mat @ vec

Return type:

list

set_G_inv(G_inv)[source]

In ParaDiag, QG^{-1} is diagonalized. This function stores the G_inv matrix and computes and stores the diagonalization.

update_nodes()[source]

Update the u- and f-values at the collocation nodes -> corresponds to a single sweep over all nodes

Returns:

None

class QDiagonalizationIMEX(params, level)[source]

Bases: QDiagonalization

Use as sweeper class for ParaDiag with IMEX splitting. Note that it will not work with SDC.

integrate()

Integrates the right-hand side (here impl + expl)

Returns:

containing the integral as values

Return type:

list of dtype_u