Semi-implicit IMEX sweeper. More...
#include <imex_sweeper.hpp>
Public Member Functions | |
IMEXSweeper ()=default | |
virtual | ~IMEXSweeper ()=default |
virtual void | setup (bool coarse) override |
Setup (allocate etc) the sweeper. More... | |
virtual void | predict (bool initial) override |
Compute low-order provisional solution. More... | |
virtual void | sweep () override |
Perform one SDC sweep/iteration. More... | |
virtual void | advance () override |
Advance the end solution to start solution. More... | |
virtual void | reevaluate (bool initial_only) override |
Re-evaluate function values. More... | |
virtual void | integrate (time dt, vector< shared_ptr< Encapsulation< time >>> dst) const override |
Integrates values of right hand side at all time nodes \( t \in [0,M-1] \) simultaneously. More... | |
virtual void | residual (time dt, vector< shared_ptr< Encapsulation< time >>> dst) const override |
Compute residual at each SDC node (including FAS corrections). More... | |
virtual void | f_expl_eval (shared_ptr< Encapsulation< time >> f_expl_encap, shared_ptr< Encapsulation< time >> u_encap, time t) |
Evaluate the explicit part of the ODE. More... | |
virtual void | f_impl_eval (shared_ptr< Encapsulation< time >> f_impl_encap, shared_ptr< Encapsulation< time >> u_encap, time t) |
Evaluate the implicit part of the ODE. More... | |
virtual void | impl_solve (shared_ptr< Encapsulation< time >> f_encap, shared_ptr< Encapsulation< time >> u_encap, time t, time dt, shared_ptr< Encapsulation< time >> rhs_encap) |
Solve \( U - \Delta t F_{\rm impl}(U) = RHS \) for \( U \). More... | |
![]() | |
EncapSweeper () | |
virtual shared_ptr< Encapsulation< time > > | get_state (size_t m) const |
Retrieve solution values of current iteration at time node index m . More... | |
virtual shared_ptr< Encapsulation< time > > | get_tau (size_t m) const |
Retrieve FAS correction of current iteration at time node index m . More... | |
virtual shared_ptr< Encapsulation< time > > | get_saved_state (size_t m) const |
Retrieve solution values of previous iteration at time node index m . More... | |
virtual void | set_options () override |
Set options from command line etc. More... | |
virtual void | spread () override |
Initialize solution values at all time nodes with meaningful values. More... | |
virtual void | save (bool initial_only) override |
Save states (and/or function values) at all nodes. More... | |
virtual void | set_quadrature (shared_ptr< IQuadrature< time >> quadrature) |
virtual shared_ptr< const IQuadrature< time > > | get_quadrature () const |
virtual const vector< time > | get_nodes () const |
virtual void | set_factory (shared_ptr< EncapFactory< time >> factory) |
virtual shared_ptr< EncapFactory< time > > | get_factory () const |
virtual shared_ptr< Encapsulation< time > > | get_start_state () const |
virtual shared_ptr< Encapsulation< time > > | get_end_state () |
void | set_residual_tolerances (time abs_residual_tol, time rel_residual_tol, int order=0) |
Set residual tolerances for convergence checking. More... | |
virtual bool | converged () override |
Return convergence status. More... | |
virtual void | post (ICommunicator *comm, int tag) override |
virtual void | send (ICommunicator *comm, int tag, bool blocking) override |
virtual void | recv (ICommunicator *comm, int tag, bool blocking) override |
virtual void | broadcast (ICommunicator *comm) override |
![]() | |
ISweeper () | |
virtual | ~ISweeper () |
virtual void | set_controller (Controller< time > *ctrl) |
Set the sweepers controller. More... | |
virtual Controller< time > * | get_controller () |
Accessor to the controller managing this sweeper. More... | |
virtual void | post_sweep () |
Hook automatically run after each completed sweep. More... | |
virtual void | post_predict () |
Hook automatically run after each completed predict. More... | |
virtual void | post_step () |
Hook automatically run after each completed time step. More... | |
Protected Member Functions | |
virtual void | integrate_end_state (time dt) |
Set end state to \( U_0 + \int F_{expl} + F_{expl} \). More... | |
Protected Attributes | |
vector< shared_ptr< Encapsulation< time > > > | s_integrals |
Node-to-node integrals of \( F(t,u) \) at all time nodes of the current iteration. More... | |
vector< shared_ptr< Encapsulation< time > > > | fs_expl |
Values of the explicit part of the right hand side \( F_{expl}(t,u) \) at all time nodes of the current iteration. More... | |
shared_ptr< Encapsulation< time > > | fs_expl_start |
vector< shared_ptr< Encapsulation< time > > > | fs_impl |
Values of the implicit part of the right hand side \( F_{impl}(t,u) \) at all time nodes of the current iteration. More... | |
![]() | |
string | FORMAT_STR |
shared_ptr< IQuadrature< time > > | quadrature |
shared_ptr< EncapFactory< time > > | factory |
Encapsulation data structure factory. More... | |
shared_ptr< Encapsulation< time > > | start_state |
Separate start state, i.e. initial condition for the sweeper's current time step. More... | |
shared_ptr< Encapsulation< time > > | end_state |
Current solution at \( T_{end} \). More... | |
vector< shared_ptr< Encapsulation< time > > > | residuals |
Place for the residuals at the different time nodes. More... | |
vector< shared_ptr< Encapsulation< time > > > | state |
Solution values \( U \) at all time nodes of the current iteration. More... | |
vector< shared_ptr< Encapsulation< time > > > | saved_state |
Solution values \( U \) at all time nodes of the previous iteration. More... | |
vector< shared_ptr< Encapsulation< time > > > | fas_corrections |
FAS corrections \( \tau \) at all time nodes of the current iteration. More... | |
int | residual_norm_order |
time | abs_residual_tol |
Tolerance for absolute residual. More... | |
time | rel_residual_tol |
Tolerance for relative residual. More... | |
![]() | |
Controller< time > * | controller |
Backreference to the controller managing the sweeper instance. More... | |
Private Member Functions | |
virtual void | predict_with_left (bool initial) |
virtual void | predict_without_left (bool initial) |
virtual void | sweep_with_left () |
virtual void | sweep_without_left () |
Semi-implicit IMEX sweeper.
This IMEX sweeper is for ODEs of the form \( \dot{U} = F_{\rm expl}(t,U) + F_{\rm impl}(t, U) \). To reduce complexity and computational effort the non-stiff part is treated explicitly and the stiff part implicitly.
This sweeper requires three interfaces to be implemented: two routines to evaluate the explicit \( F_{\rm expl} \) and implicit \( F_{\rm impl} \) pieces for a given state, and one routine that solves (perhaps with an external solver) the backward-Euler equation \( U^{n+1} - \Delta t F_{\rm impl}(U^{n+1}) = RHS \) for \( U^{n+1} \).
time | precision type of the time dimension |
Definition at line 34 of file imex_sweeper.hpp.
|
default |
|
virtualdefault |
|
overridevirtual |
Advance the end solution to start solution.
Reimplemented from pfasst::encap::EncapSweeper< time >.
Definition at line 87 of file imex_sweeper_impl.hpp.
|
virtual |
Evaluate the explicit part of the ODE.
[in,out] | f_expl_encap | Encapsulation to store the explicit function evaluation. |
[in] | u_encap | Encapsulation that stores the solution state at which to evaluate the explicit part of the ODE. |
[in] | t | Time point of the evaluation. |
Reimplemented in pfasst::examples::advection_diffusion::AdvectionDiffusionSweeper< time >.
Definition at line 146 of file imex_sweeper_impl.hpp.
References UNUSED.
|
virtual |
Evaluate the implicit part of the ODE.
This is typically called to compute the implicit part of the right hand side at the first collocation node, and on all nodes after restriction or interpolation.
[in,out] | f_impl_encap | Encapsulation to store the implicit function evaluation. |
[in] | u_encap | Encapsulation storing the solution state at which to evaluate the implicit part of the ODE. |
[in] | t | Time point of the evaluation. |
Reimplemented in pfasst::examples::advection_diffusion::AdvectionDiffusionSweeper< time >.
Definition at line 155 of file imex_sweeper_impl.hpp.
References UNUSED.
|
virtual |
Solve \( U - \Delta t F_{\rm impl}(U) = RHS \) for \( U \).
During an IMEX SDC sweep, the correction equation is evolved using a forward-Euler stepper for the explicit piece, and a backward-Euler stepper for the implicit piece. This routine (implemented by the user) performs the solve required to perform one backward-Euler sub-step, and also returns \( F_{\rm impl}(U) \).
[in,out] | f_encap | Encapsulation to store the evaluated implicit piece. |
[in,out] | u_encap | Encapsulation to store the solution of the backward-Euler sub-step. |
[in] | t | time point (of \( RHS \)). |
[in] | dt | sub-step size to the previous time point (\( \Delta t \)). |
[in] | rhs_encap | Encapsulation that stores \( RHS \). |
Reimplemented in pfasst::examples::advection_diffusion::AdvectionDiffusionSweeper< time >.
Definition at line 164 of file imex_sweeper_impl.hpp.
References UNUSED.
|
overridevirtual |
Integrates values of right hand side at all time nodes \( t \in [0,M-1] \) simultaneously.
[in] | dt | width of time interval to integrate over |
[in,out] | dst | integrated values; will get zeroed out beforehand |
Reimplemented from pfasst::encap::EncapSweeper< time >.
Definition at line 119 of file imex_sweeper_impl.hpp.
|
protectedvirtual |
Set end state to \( U_0 + \int F_{expl} + F_{expl} \).
Definition at line 16 of file imex_sweeper_impl.hpp.
|
overridevirtual |
Compute low-order provisional solution.
This performs forward/backward Euler steps across the nodes to compute a low-order provisional solution.
[in] | initial | if true the explicit and implicit part of the right hand side of the ODE get evaluated with the initial value |
Implements pfasst::ISweeper< time >.
Definition at line 55 of file imex_sweeper_impl.hpp.
|
privatevirtual |
Definition at line 174 of file imex_sweeper_impl.hpp.
References plot::dt, ML_CVLOG, pfasst::encap::solution, and plot::t.
|
privatevirtual |
Definition at line 203 of file imex_sweeper_impl.hpp.
References plot::dt, ML_CVLOG, pfasst::encap::solution, plot::t, and UNUSED.
|
overridevirtual |
Re-evaluate function values.
Reimplemented from pfasst::encap::EncapSweeper< time >.
Definition at line 98 of file imex_sweeper_impl.hpp.
|
overridevirtual |
Compute residual at each SDC node (including FAS corrections).
[in] | dt | width of time interval to integrate over |
[in,out] | dst | residuals |
Reimplemented from pfasst::encap::EncapSweeper< time >.
Definition at line 127 of file imex_sweeper_impl.hpp.
|
overridevirtual |
Setup (allocate etc) the sweeper.
[in] | coarse | true if this sweeper exists on a coarsened MLSDC or PFASST level. This implies that space for an FAS correction and "saved" solutions are necessary. |
Reimplemented from pfasst::encap::EncapSweeper< time >.
Definition at line 25 of file imex_sweeper_impl.hpp.
References pfasst::encap::function, pfasst::encap::EncapSweeper< time >::setup(), and pfasst::encap::solution.
|
overridevirtual |
Perform one SDC sweep/iteration.
This computes a high-order solution from the previous iteration's function values and corrects it using forward/backward Euler steps across the nodes.
Implements pfasst::ISweeper< time >.
Definition at line 71 of file imex_sweeper_impl.hpp.
|
privatevirtual |
Definition at line 236 of file imex_sweeper_impl.hpp.
References plot::dt, pfasst::encap::EncapSweeper< time >::get_nodes(), ML_CVLOG, pfasst::encap::solution, and plot::t.
|
privatevirtual |
Definition at line 275 of file imex_sweeper_impl.hpp.
References plot::dt, pfasst::encap::EncapSweeper< time >::get_nodes(), ML_CVLOG, pfasst::encap::solution, and plot::t.
|
protected |
Values of the explicit part of the right hand side \( F_{expl}(t,u) \) at all time nodes of the current iteration.
Definition at line 49 of file imex_sweeper.hpp.
|
protected |
Definition at line 50 of file imex_sweeper.hpp.
|
protected |
Values of the implicit part of the right hand side \( F_{impl}(t,u) \) at all time nodes of the current iteration.
Definition at line 56 of file imex_sweeper.hpp.
|
protected |
Node-to-node integrals of \( F(t,u) \) at all time nodes of the current iteration.
Definition at line 43 of file imex_sweeper.hpp.