PFASST++
pfasst::encap::IMEXSweeper< time > Class Template Reference

Semi-implicit IMEX sweeper. More...

#include <imex_sweeper.hpp>

+ Inheritance diagram for pfasst::encap::IMEXSweeper< time >:
+ Collaboration diagram for pfasst::encap::IMEXSweeper< time >:

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...
 
- Public Member Functions inherited from pfasst::encap::EncapSweeper< time >
 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
 
- Public Member Functions inherited from pfasst::ISweeper< time >
 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...
 
- Protected Attributes inherited from pfasst::encap::EncapSweeper< time >
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...
 
- Protected Attributes inherited from pfasst::ISweeper< time >
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 ()
 

Detailed Description

template<typename time = time_precision>
class pfasst::encap::IMEXSweeper< time >

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} \).

Template Parameters
timeprecision type of the time dimension

Definition at line 34 of file imex_sweeper.hpp.

Constructor & Destructor Documentation

template<typename time = time_precision>
pfasst::encap::IMEXSweeper< time >::IMEXSweeper ( )
default
template<typename time = time_precision>
virtual pfasst::encap::IMEXSweeper< time >::~IMEXSweeper ( )
virtualdefault

Member Function Documentation

template<typename time >
void pfasst::encap::IMEXSweeper< time >::advance ( )
overridevirtual

Advance the end solution to start solution.

Reimplemented from pfasst::encap::EncapSweeper< time >.

Definition at line 87 of file imex_sweeper_impl.hpp.

template<typename time >
void pfasst::encap::IMEXSweeper< time >::f_expl_eval ( shared_ptr< Encapsulation< time >>  f_expl_encap,
shared_ptr< Encapsulation< time >>  u_encap,
time  t 
)
virtual

Evaluate the explicit part of the ODE.

Parameters
[in,out]f_expl_encapEncapsulation to store the explicit function evaluation.
[in]u_encapEncapsulation that stores the solution state at which to evaluate the explicit part of the ODE.
[in]tTime point of the evaluation.
Note
This method must be implemented in derived sweepers.

Reimplemented in pfasst::examples::advection_diffusion::AdvectionDiffusionSweeper< time >.

Definition at line 146 of file imex_sweeper_impl.hpp.

References UNUSED.

template<typename time >
void pfasst::encap::IMEXSweeper< time >::f_impl_eval ( shared_ptr< Encapsulation< time >>  f_impl_encap,
shared_ptr< Encapsulation< time >>  u_encap,
time  t 
)
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.

Parameters
[in,out]f_impl_encapEncapsulation to store the implicit function evaluation.
[in]u_encapEncapsulation storing the solution state at which to evaluate the implicit part of the ODE.
[in]tTime point of the evaluation.
Note
This method must be implemented in derived sweepers.

Reimplemented in pfasst::examples::advection_diffusion::AdvectionDiffusionSweeper< time >.

Definition at line 155 of file imex_sweeper_impl.hpp.

References UNUSED.

template<typename time >
void pfasst::encap::IMEXSweeper< time >::impl_solve ( shared_ptr< Encapsulation< time >>  f_encap,
shared_ptr< Encapsulation< time >>  u_encap,
time  t,
time  dt,
shared_ptr< Encapsulation< time >>  rhs_encap 
)
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) \).

Parameters
[in,out]f_encapEncapsulation to store the evaluated implicit piece.
[in,out]u_encapEncapsulation to store the solution of the backward-Euler sub-step.
[in]ttime point (of \( RHS \)).
[in]dtsub-step size to the previous time point (\( \Delta t \)).
[in]rhs_encapEncapsulation that stores \( RHS \).
Note
This method must be implemented in derived sweepers.

Reimplemented in pfasst::examples::advection_diffusion::AdvectionDiffusionSweeper< time >.

Definition at line 164 of file imex_sweeper_impl.hpp.

References UNUSED.

template<typename time >
void pfasst::encap::IMEXSweeper< time >::integrate ( time  dt,
vector< shared_ptr< Encapsulation< time >>>  dst 
) const
overridevirtual

Integrates values of right hand side at all time nodes \( t \in [0,M-1] \) simultaneously.

Parameters
[in]dtwidth of time interval to integrate over
[in,out]dstintegrated values; will get zeroed out beforehand

Reimplemented from pfasst::encap::EncapSweeper< time >.

Definition at line 119 of file imex_sweeper_impl.hpp.

template<typename time >
void pfasst::encap::IMEXSweeper< time >::integrate_end_state ( time  dt)
protectedvirtual

Set end state to \( U_0 + \int F_{expl} + F_{expl} \).

Definition at line 16 of file imex_sweeper_impl.hpp.

template<typename time >
void pfasst::encap::IMEXSweeper< time >::predict ( bool  initial)
overridevirtual

Compute low-order provisional solution.

This performs forward/backward Euler steps across the nodes to compute a low-order provisional solution.

Parameters
[in]initialif 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.

template<typename time >
void pfasst::encap::IMEXSweeper< time >::predict_with_left ( bool  initial)
privatevirtual

Definition at line 174 of file imex_sweeper_impl.hpp.

References plot::dt, ML_CVLOG, pfasst::encap::solution, and plot::t.

template<typename time >
void pfasst::encap::IMEXSweeper< time >::predict_without_left ( bool  initial)
privatevirtual

Definition at line 203 of file imex_sweeper_impl.hpp.

References plot::dt, ML_CVLOG, pfasst::encap::solution, plot::t, and UNUSED.

template<typename time >
void pfasst::encap::IMEXSweeper< time >::reevaluate ( bool  initial_only)
overridevirtual

Re-evaluate function values.

Reimplemented from pfasst::encap::EncapSweeper< time >.

Definition at line 98 of file imex_sweeper_impl.hpp.

References plot::dt, and plot::t.

template<typename time >
void pfasst::encap::IMEXSweeper< time >::residual ( time  dt,
vector< shared_ptr< Encapsulation< time >>>  dst 
) const
overridevirtual

Compute residual at each SDC node (including FAS corrections).

Parameters
[in]dtwidth of time interval to integrate over
[in,out]dstresiduals

Reimplemented from pfasst::encap::EncapSweeper< time >.

Definition at line 127 of file imex_sweeper_impl.hpp.

template<typename time >
void pfasst::encap::IMEXSweeper< time >::setup ( bool  coarse)
overridevirtual

Setup (allocate etc) the sweeper.

Parameters
[in]coarsetrue 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.

+ Here is the call graph for this function:

template<typename time >
void pfasst::encap::IMEXSweeper< time >::sweep ( )
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.

template<typename time >
void pfasst::encap::IMEXSweeper< time >::sweep_with_left ( )
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.

+ Here is the call graph for this function:

template<typename time >
void pfasst::encap::IMEXSweeper< time >::sweep_without_left ( )
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.

+ Here is the call graph for this function:

Member Data Documentation

template<typename time = time_precision>
vector<shared_ptr<Encapsulation<time> > > pfasst::encap::IMEXSweeper< time >::fs_expl
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.

template<typename time = time_precision>
shared_ptr<Encapsulation<time> > pfasst::encap::IMEXSweeper< time >::fs_expl_start
protected

Definition at line 50 of file imex_sweeper.hpp.

template<typename time = time_precision>
vector<shared_ptr<Encapsulation<time> > > pfasst::encap::IMEXSweeper< time >::fs_impl
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.

template<typename time = time_precision>
vector<shared_ptr<Encapsulation<time> > > pfasst::encap::IMEXSweeper< time >::s_integrals
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.


The documentation for this class was generated from the following files: