![]() |
deal.II version GIT relicensing-6960-g70e9c5b7be 2026-10-22 20:10:01+00:00
|
#include <deal.II/sundials/arkode_stepper.h>
Wrapper for the LSRKStep (Low-Storage Runge-Kutta) STS (Super Time-Stepping) family.
STS methods are designed for mildly stiff problems whose Jacobian eigenvalues lie on or near the negative real axis, such as the semidiscretization of parabolic PDEs. The stability region grows as \(O(s^2)\) with the number of stages \(s\), allowing much larger time steps than standard explicit Runge-Kutta methods for the same problem, alleviating to a degree the usual issue that one should not solve parabolic problems with explicit methods (see the discussion in step-26 for example).
LSRKStep also provides the SSP (Strong Stability Preserving) family of the Low-Storage Runge-Kutta methods, which are designed for hyperbolic problems such as advection-dominated fluid flow. These methods are available through LSRKStepperSSP.
Available methods (passed as method_name):
ARKODE_LSRK_RKC_2: Runge-Kutta-Chebyshev of order 2 (default).ARKODE_LSRK_RKL_2: Runge-Kutta-Legendre of order 2.Because the number of stages is chosen adaptively based on the spectral radius of the Jacobian, STS methods need an estimate of the dominant (largest-magnitude) eigenvalue of the Jacobian. This estimate can be provided in one of two ways:
The user has to provide the implementation of the following std::function:
Optionally, the user may also provide:
Any other custom settings of the LSRKStep object can be specified in
Definition at line 1444 of file arkode_stepper.h.
Classes | |
| class | AdditionalData |
Public Member Functions | |
| LSRKStepperSTS (const AdditionalData &data=AdditionalData()) | |
| void * | get_arkode_memory () const override |
Public Attributes | |
| std::function< void(const double t, const VectorType &y, VectorType &explicit_f)> | explicit_function |
| std::function< std::complex< double >(const double t, const VectorType &y, const VectorType &f)> | dominant_eigenvalue_function |
| std::function< void(void *arkode_mem)> | custom_setup |
Protected Member Functions | |
| internal::InvocationContext | invocation_context () const |
Private Types | |
| using | CallbackContext = typename ARKodeStepper< VectorType >::template CallbackContext< LSRKStepperSTS< VectorType > > |
| using | ARKodeMemoryPtr = typename ARKodeStepper< VectorType >::ARKodeMemoryPtr |
Private Member Functions | |
| void | reinit (double t0, const VectorType &y0) override |
| void | resize (double t0, const VectorType &y0, double hscale) override |
| void | attach_default_dom_eig_estimator (N_Vector y, SUNContext context) |
| void | attach (std::exception_ptr &pending_exception, const internal::SharedSUNContext &context) |
Private Attributes | |
| AdditionalData | data |
| std::unique_ptr< void, void(*)(void *)> | dom_eig_estimator |
| ARKodeMemoryPtr | arkode_mem |
| CallbackContext | callback_ctx |
| std::exception_ptr * | pending_exception_ptr = nullptr |
| internal::SharedSUNContext | sundials_context |
|
private |
Definition at line 1637 of file arkode_stepper.h.
|
private |
Definition at line 1640 of file arkode_stepper.h.
| SUNDIALS::LSRKStepperSTS< VectorType >::LSRKStepperSTS | ( | const AdditionalData & | data = AdditionalData() | ) |
Constructor, with class parameters set by the AdditionalData object.
| data | LSRKStepperSTS configuration data |
|
overridevirtual |
Provides user access to the internally used ARKODE memory.
This functionality is intended for users who wish to query additional information directly from the ARKODE integrator, refer to the ARKODE manual for the various ARKStepGet... functions. The ARKStepSet... functions should not be called since this might lead to conflicts with various settings that are performed by this ARKodeStepper object.
Implements SUNDIALS::ARKodeStepper< VectorType >.
|
overrideprivatevirtual |
Rebuild the stepper at a given time instance and for a given state vector. Required by the ARKodeStepper interface.
| t0 | Time instance that serves as starting time |
| y0 | Initial state vector whose layout is used for initialization of the internal ARKODE vectors |
Implements SUNDIALS::ARKodeStepper< VectorType >.
|
overrideprivatevirtual |
Resize the ARKODE memory in place via ARKodeResize() and, if the built-in dominant-eigenvalue estimator is used, rebuild it for the new vector size.
| t0 | Current time |
| y0 | Current state vector with the new size |
| hscale | Factor by which the upcoming step size is rescaled; values less or equal to zero are treated as one |
Implements SUNDIALS::ARKodeStepper< VectorType >.
|
private |
Create a SUNDIALS power-iteration dominant-eigenvalue estimator for the vector layout of y, attach it to the LSRKStep module, and take ownership of it in dom_eig_estimator (releasing the previous one).
|
inlineprivateinherited |
Bind the stepper to the ARKode object that drives it. This is called once by the constructor of ARKode. All objects the stepper creates for SUNDIALS use context, which the stepper keeps alive for as long as it lives, and callbacks store exceptions in pending_exception.
Definition at line 125 of file arkode_stepper.h.
|
inlineprotectedinherited |
The context that the ARKode object, to which this stepper is attached. It is used to create SUNDIALS objects and to propagate exceptions across C boundaries (see invocation_context.h).
Definition at line 193 of file arkode_stepper.h.
| std::function< void(const double t, const VectorType &y, VectorType &explicit_f)> SUNDIALS::LSRKStepperSTS< VectorType >::explicit_function |
A function object that users must supply and that is intended to compute the IVP right hand side. Sets \(explicit\_f = f(t, y)\).
Definition at line 1586 of file arkode_stepper.h.
| std::function<std::complex<double>(const double t, const VectorType &y, const VectorType &f)> SUNDIALS::LSRKStepperSTS< VectorType >::dominant_eigenvalue_function |
A function object that users may optionally supply and that is intended to return an estimate of the dominant (largest-magnitude) eigenvalue of the Jacobian. This information is used by SUNDIALS to determine the number of polynomial stages needed for stability.
If this callback is left unset, deal.II instead creates a SUNDIALS built-in power-iteration dominant-eigenvalue estimator (SUNDomEigEstimator) and attaches it automatically. The estimator derives the dominant eigenvalue internally from explicit_function() and requires no further input from the user. This automatic default is only available when deal.II is compiled against SUNDIALS 7.5.0 or newer; with older versions this callback must be provided.
The callback receives the current time t, the current state y, and the already-evaluated right-hand side f (i.e., \(f(t,y)\)), and returns the estimate of the dominant eigenvalue as std::complex<double>. For purely diffusive problems the imaginary part is typically zero.
Definition at line 1618 of file arkode_stepper.h.
| std::function<void(void *arkode_mem)> SUNDIALS::LSRKStepperSTS< VectorType >::custom_setup |
A function object that users may supply and which is intended to perform custom settings on the supplied arkode_mem object. Refer to the SUNDIALS documentation for valid options.
| arkode_mem | pointer to the ARKODE memory block which can be used for custom calls to LSRKStepSet... methods. |
Definition at line 1634 of file arkode_stepper.h.
|
private |
LSRKStepperSTS configuration data.
Definition at line 1679 of file arkode_stepper.h.
|
private |
SUNDIALS built-in dominant-eigenvalue estimator. This object is only created (and owned) when dominant_eigenvalue_function is not provided, in which case it is attached to the LSRKStep module to estimate the dominant eigenvalue automatically. Stored as an opaque pointer with a custom deleter that calls SUNDomEigEstimator_Destroy. Declared before arkode_mem so that it is destroyed after the ARKODE memory object.
Definition at line 1690 of file arkode_stepper.h.
|
private |
ARKODE memory object.
Definition at line 1696 of file arkode_stepper.h.
|
private |
LSRKStepperSTS callback context.
Definition at line 1701 of file arkode_stepper.h.
|
privateinherited |
Exception pointer of the ARKode object this stepper is attached to.
Definition at line 211 of file arkode_stepper.h.
|
privateinherited |
Base class members are destroyed after those of derived classes, so the context outlives the ARKODE memory and everything else a derived stepper created with it.
Definition at line 219 of file arkode_stepper.h.