Add a \(\phi\)-based time-integrator
📜 Additional time schemes can be added using the \(\phi\) formulation
to test other variants of \(Q_\Delta\)-coefficients free Spectral Deferred Correction.
For that, you can implement a new PhiSolver class in the qmat.solvers.generic.integrators module.
Add your class at the end of the qmat.solvers.generic.integrators.py module using the following template :
class Phidlidoo(PhiSolver):
r"""
Base description, in particular its definition :
.. math::
\phi(u_0, u_1, ..., u_{m}, u_{m+1}) =
...
And eventual parameters description ...
"""
def evalPhi(self, uVals, fEvals, out, t0=0):
m = len(uVals) - 1
assert m > 0
assert len(fEvals) in [m, m+1]
# TODO : integrators implementation
The first assertions are not mandatory, but ensure that the evalPhi is properly evaluated.
📣 New
PhiSolverclasses are not automatically tested, so you’ll have to write some dedicated test for your new class intests.test_solvers.test_integrators.py. Checkout those already implemented forForwardEulerandBackwardEuler.
As for the DiffOp class,
the PhiSolver implements a generic default
phiSolve method, that you can override by a more efficient specialized approach.
💡 Note that the model above inherits the
__init__constructor of thePhiSolverclass, so it can take anyDiffOpclass as parameter. If your time-integrator is specialized for some kind of differential operators (e.g a semi-Lagrangian scheme for an advective problem), then you probably need to override the__init__method in your class too.