TimeStepperSUNDIALS_IDA_impl< VectorType, SparseMatrixType, dim, LinearSolver > Class Template Reference#

DiFfRG: TimeStepperSUNDIALS_IDA_impl< VectorType, SparseMatrixType, dim, LinearSolver > Class Template Reference
DiFfRG
Discretization Framework for functional Renormalization Group flows
TimeStepperSUNDIALS_IDA_impl< VectorType, SparseMatrixType, dim, LinearSolver > Class Template Reference

Implicit, adaptive time stepping with SUNDIALS IDA (variable-order BDF, order 1 to 5). More...

#include <sundials_ida.hh>

Inheritance diagram for TimeStepperSUNDIALS_IDA_impl< VectorType, SparseMatrixType, dim, LinearSolver >:

Public Types

using NumberType = typename Base::NumberType
 
using BlockVectorType = typename Base::BlockVectorType
 
using IDAErrorDofCallback = std::function<void(const IDAErrorDofDiagnostics &)>
 

Public Member Functions

 TimeStepperSUNDIALS_IDA_impl (const ConfigTree &config, AbstractAssembler< VectorType, SparseMatrixType, dim > &assembler, OutputSession_impl< dim, VectorType > &data_out)
 Construct without mesh adaptation; see AbstractTimestepper.
 
 TimeStepperSUNDIALS_IDA_impl (const ConfigTree &config, AbstractAssembler< VectorType, SparseMatrixType, dim > &assembler, OutputSession_impl< dim, VectorType > &data_out, AbstractAdaptor< VectorType > &adaptor)
 Construct with a mesh adaptor; see AbstractTimestepper.
 
virtual void run_segment (AbstractFlowingVariables< NumberType, VectorType > &initial_condition, const double t_start, const double t_stop) override
 Any derived class must implement this method to run the timestepping algorithm.
 
void set_ida_error_dof_callback (IDAErrorDofCallback callback)
 Called with every report of /timestepping/implicit/ida_error_dof_diagnostics, in addition to the log.
 
- Public Member Functions inherited from AbstractTimestepper< VectorType, SparseMatrixType, dim >
 AbstractTimestepper (const ConfigTree &config, AbstractAssembler< VectorType, SparseMatrixType, dim > &assembler, OutputSession_impl< dim, VectorType > &data_out, const bool implicit_stepper, const bool explicit_stepper)
 Construct without mesh adaptation.
 
 AbstractTimestepper (const ConfigTree &config, AbstractAssembler< VectorType, SparseMatrixType, dim > &assembler, OutputSession_impl< dim, VectorType > &data_out, AbstractAdaptor< VectorType > &adaptor, const bool implicit_stepper, const bool explicit_stepper)
 Construct with a mesh adaptor, which is called between steps (where the stepper supports it, see abstract_timestepper.hh).
 
void run (AbstractFlowingVariables< NumberType, VectorType > &initial_condition, double t_start, const double t_stop)
 Evolve initial_condition from t_start to t_stop.
 
bool is_implicit () const
 Whether this stepper reads /timestepping/implicit.
 
bool is_explicit () const
 Whether this stepper reads /timestepping/explicit.
 

Additional Inherited Members

- Protected Types inherited from AbstractTimestepper< VectorType, SparseMatrixType, dim >
using VectorType
 
using NumberType
 
using SparseMatrixType
 
using BlockVectorType
 
- Protected Member Functions inherited from AbstractTimestepper< VectorType, SparseMatrixType, dim >
void drain_output ()
 
void finalize_output_after_failure (EmitFinalFrame &&emit_final_frame)
 Best-effort output cleanup while a timestepping failure is being reported.
 
void require_no_adaptor (const std::string &stepper) const
 Throw unless the mesh adaptor is NoAdaptivity; for steppers that cannot adapt the mesh.
 
void require_no_variables (const AbstractFlowingVariables< NumberType, VectorType > &state, const std::string &stepper) const
 Throw if the flow has variables; for steppers that integrate only the FE/FV unknowns.
 
- Protected Attributes inherited from AbstractTimestepper< VectorType, SparseMatrixType, dim >
const ConfigTree config
 
NoAdaptivity< VectorType > adaptor_default
 
AbstractAssembler< VectorType, SparseMatrixType, dim > & assembler
 
OutputSession_impl< dim, VectorType > & data_out
 
AbstractAdaptor< VectorType > & adaptor
 
ReportPort log
 
const bool m_is_implicit
 
const bool m_is_explicit
 
double output_dt
 
struct DiFfRG::AbstractTimestepper::ImplicitParameters impl
 
struct DiFfRG::AbstractTimestepper::ExplicitParameters expl
 
std::size_t next_jacobian_build_id
 
TimestepperJacobianDiagnosticsState jacobian_diagnostics_state
 
- Static Protected Attributes inherited from AbstractTimestepper< VectorType, SparseMatrixType, dim >
static constexpr uint dim
 

Detailed Description

template<typename VectorType, typename SparseMatrixType, uint dim, template< typename... > typename LinearSolver>
class DiFfRG::TimeStepperSUNDIALS_IDA_impl< VectorType, SparseMatrixType, dim, LinearSolver >

Implicit, adaptive time stepping with SUNDIALS IDA (variable-order BDF, order 1 to 5).

IDA solves the system in residual form, \(F(t, y, \dot y) = 0\), with \(y = (u, v)\) and

\[ F_u = m(u, \dot u) + R(u, v)\,, \qquad F_v = \dot v + D(v, u)\,, \]

see abstract_timestepper.hh for the notation. Each step solves \(F = 0\) by Newton's method with the matrix \(\partial F/\partial y + \alpha\, \partial F/\partial \dot y\), where \(\alpha\) is set by IDA from the step size and the BDF order. The \(u\)- and \(v\)-blocks of this matrix are built separately, i.e. the couplings \(\partial F_u/\partial v\) and \(\partial F_v/\partial u\) are left out; they slow Newton's convergence but do not change the solution.

Components of \(u\) whose mass term does not depend on \(\dot u\) are algebraic constraints; they are excluded from the error test. At the start and after every restart (e.g. after mesh adaptation), IDA computes the algebraic components and the \(\dot u\) of the others from \(F = 0\). Output is written at exactly \(t_\text{start} + n\, \mathrm{output\_dt}\), interpolated by IDA.

Handles FE problems with or without variables, and pure-variables systems (dim == 0). Distributed linear algebra is supported. A callback that fails (non-finite state or residual, an exception from the model, a failed factorization or linear solve) makes IDA retry with a smaller step; the run aborts after 200 consecutive failures or if the time stops advancing.

Reads /timestepping/implicit, see abstract_timestepper.hh.

Template Parameters
VectorTypevector type of the assembler.
SparseMatrixTypesparse matrix type of the assembler.
dimspatial dimension, 0 for a pure-variables system.
LinearSolversolver for the Newton systems; see DefaultLinearSolver.

Member Typedef Documentation

◆ BlockVectorType

template<typename VectorType , typename SparseMatrixType , uint dim, template< typename... > typename LinearSolver>
using BlockVectorType = typename Base::BlockVectorType

◆ IDAErrorDofCallback

template<typename VectorType , typename SparseMatrixType , uint dim, template< typename... > typename LinearSolver>
using IDAErrorDofCallback = std::function<void(const IDAErrorDofDiagnostics &)>

◆ NumberType

template<typename VectorType , typename SparseMatrixType , uint dim, template< typename... > typename LinearSolver>
using NumberType = typename Base::NumberType

Constructor & Destructor Documentation

◆ TimeStepperSUNDIALS_IDA_impl() [1/2]

template<typename VectorType , typename SparseMatrixType , uint dim, template< typename... > typename LinearSolver>
TimeStepperSUNDIALS_IDA_impl ( const ConfigTree & config,
AbstractAssembler< VectorType, SparseMatrixType, dim > & assembler,
OutputSession_impl< dim, VectorType > & data_out )
inline

Construct without mesh adaptation; see AbstractTimestepper.

◆ TimeStepperSUNDIALS_IDA_impl() [2/2]

template<typename VectorType , typename SparseMatrixType , uint dim, template< typename... > typename LinearSolver>
TimeStepperSUNDIALS_IDA_impl ( const ConfigTree & config,
AbstractAssembler< VectorType, SparseMatrixType, dim > & assembler,
OutputSession_impl< dim, VectorType > & data_out,
AbstractAdaptor< VectorType > & adaptor )
inline

Construct with a mesh adaptor; see AbstractTimestepper.

Member Function Documentation

◆ run_segment()

template<typename VectorType , typename SparseMatrixType , uint dim, template< typename... > typename LinearSolver>
virtual void run_segment ( AbstractFlowingVariables< NumberType, VectorType > & initial_condition,
const double t_start,
const double t_stop )
overridevirtual

Any derived class must implement this method to run the timestepping algorithm.

It must return the state at t_stop in initial_condition, because run() writes snapshots from it. Called once per segment, i.e. possibly several times per run() with consecutive intervals.

Parameters
initial_conditionThe flowing variables object that contains the initial condition.
t_startThe start time of the segment.
t_stopThe end time of the segment.

Implements AbstractTimestepper< VectorType, SparseMatrixType, dim >.

◆ set_ida_error_dof_callback()

template<typename VectorType , typename SparseMatrixType , uint dim, template< typename... > typename LinearSolver>
void set_ida_error_dof_callback ( IDAErrorDofCallback callback)
inline

Called with every report of /timestepping/implicit/ida_error_dof_diagnostics, in addition to the log.


The documentation for this class was generated from the following file:
  • /home/runner/work/DiFfRG/DiFfRG/DiFfRG/include/DiFfRG/timestepping/sundials_ida.hh