qmat.solvers.sdc

Functions to run SDC and evaluate its numerical error on simple problems.

Functions

solveDahlquistSDC(lam, u0, tEnd, nSteps, nSweeps, Q, ...)

Solve the Dahlquist problem with SDC.

errorDahlquistSDC(lam, u0, tEnd, nSteps, nSweeps, Q, ...)

Compute the time \(L_\infty\) error of SDC.

getOrderSDC(coll, nSweeps, qDelta, stepUpdate)

Give the expected order of SDC after a fixed number of iterations.

Module Contents

solveDahlquistSDC(lam, u0, tEnd, nSteps: int, nSweeps: int, Q: numpy.ndarray, QDelta: numpy.ndarray, weights=None, monitors=None)[source]

Solve the Dahlquist problem with SDC.

Parameters:
  • lam (complex or float) – The \(\lambda\) coefficient.

  • u0 (complex or float) – The initial solution \(u_0\).

  • tEnd (float) – Final time \(T\).

  • nSteps (int) – Number of time-step for the whole \([0,T]\) interval.

  • nSweeps (int) – Number of SDC sweeps.

  • Q (np.ndarray) – Quadrature matrix \(Q\) used for SDC.

  • QDelta (np.ndarray) – Approximate quadrature matrix \(Q_\Delta\) used for SDC. If three dimensional, use the first dimension for the sweep index.

  • weights (np.ndarray, optional) – Quadrature weights to use for the step update. If None, step update is not performed. The default is None.

Returns:

uNum – Array containing the nSteps+1 solutions \(\{u(0), ..., u(T)\}\).

Return type:

np.ndarray

errorDahlquistSDC(lam, u0, tEnd, nSteps, nSweeps, Q, QDelta, weights=None, uNum=None)[source]

Compute the time \(L_\infty\) error of SDC.

Parameters:
  • lam (complex or float) – The \(\lambda\) coefficient.

  • u0 (complex or float) – The initial solution \(u_0\).

  • tEnd (float) – Final time \(T\).

  • nSteps (int) – Number of time-step for the whole \([0,T]\) interval.

  • nSweeps (int) – Number of SDC sweeps.

  • Q (np.ndarray) – Quadrature matrix \(Q\) used for SDC.

  • QDelta (np.ndarray) – Approximate quadrature matrix \(Q_\Delta\) used for SDC.

  • weights (np.ndarray, optional) – Quadrature weights to use for the step update. If None, step update is not performed. The default is None.

  • uNum (np.ndarray, optional) – Numerical solution, if not provided use the solveDahlquist method to compute the solution. The default is None.

Returns:

The \(L_\infty\) norm.

Return type:

float

getOrderSDC(coll, nSweeps, qDelta, stepUpdate)[source]

Give the expected order of SDC after a fixed number of iterations.

Parameters:
  • coll (qmat.qcoeff.collocation.Collocation) – The underlying Collocation class.

  • nSweeps (int) – Number of sweeps for SDC.

  • qDelta (str) – Type of the \(Q_\Delta\) approximation used.

  • stepUpdate (bool) – Wether or not the stepUpdate is done at the end.

Returns:

order – Expected order of the SDC time-integration.

Return type:

int