Block-Structured AMR Software Framework
amrex::SundialsIntegrator< T > Class Template Reference

#include <AMReX_SundialsIntegrator.H>

Inheritance diagram for amrex::SundialsIntegrator< T >:
amrex::IntegratorBase< T >

Public Member Functions

 SundialsIntegrator ()
 
 SundialsIntegrator (const T &S_data, const amrex::Real time=0.0)
 
void initialize (const T &S_data, const amrex::Real time=0.0)
 
virtual ~SundialsIntegrator ()
 
amrex::Real advance (T &S_old, T &S_new, amrex::Real time, const amrex::Real dt) override
 Take a single time step from (time, S_old) to (time + dt, S_new) with the given step size. More...
 
void evolve (T &S_out, const amrex::Real time_out) override
 Evolve the current (internal) integrator state to time_out. More...
 
void time_interpolate (const T &, const T &, amrex::Real, T &) override
 
void map_data (std::function< void(T &)>) override
 
- Public Member Functions inherited from amrex::IntegratorBase< T >
 IntegratorBase ()=default
 
 IntegratorBase (const T &)
 
virtual ~IntegratorBase ()=default
 
void set_rhs (std::function< void(T &, T &, const amrex::Real)> F)
 
void set_imex_rhs (std::function< void(T &, T &, const amrex::Real)> Fi, std::function< void(T &, T &, const amrex::Real)> Fe)
 
void set_fast_rhs (std::function< void(T &, T &, const amrex::Real)> F)
 
void set_post_stage_action (std::function< void(T &, amrex::Real)> A)
 
void set_post_step_action (std::function< void(T &, amrex::Real)> A)
 
void set_post_fast_stage_action (std::function< void(T &, amrex::Real)> A)
 
void set_post_fast_step_action (std::function< void(T &, amrex::Real)> A)
 
amrex::Real get_time_step ()
 
void set_time_step (amrex::Real dt)
 
void set_adaptive_step ()
 
void set_fast_time_step (amrex::Real dt)
 
void set_adaptive_fast_step ()
 
void set_max_steps (int steps)
 
void set_tolerances (amrex::Real rtol, amrex::Real atol)
 
void set_fast_tolerances (amrex::Real rtol, amrex::Real atol)
 

Private Types

using BaseT = IntegratorBase< T >
 

Private Member Functions

void initialize_parameters ()
 
void SetupRK (amrex::Real time, N_Vector y_data)
 
void SetupMRI (amrex::Real time, N_Vector y_data)
 
void unpack_vector (N_Vector y_data, amrex::Vector< amrex::MultiFab > &S_data)
 
N_Vector wrap_data (amrex::Vector< amrex::MultiFab > &S_data)
 
N_Vector copy_data (const amrex::Vector< amrex::MultiFab > &S_data)
 
void unpack_vector (N_Vector y_data, amrex::MultiFab &S_data)
 
N_Vector wrap_data (amrex::MultiFab &S_data)
 
N_Vector copy_data (const amrex::MultiFab &S_data)
 

Private Attributes

std::string type = "ERK"
 
std::string method = "DEFAULT"
 
std::string method_e = "DEFAULT"
 
std::string method_i = "DEFAULT"
 
std::string fast_type = "ERK"
 
std::string fast_method = "DEFAULT"
 
bool use_ark = false
 
bool use_mri = false
 
SundialsUserData udata
 
::sundials::Context sunctx
 
void * arkode_mem = nullptr
 
SUNLinearSolver LS = nullptr
 
void * arkode_fast_mem = nullptr
 
MRIStepInnerStepper fast_stepper = nullptr
 
SUNLinearSolver fast_LS = nullptr
 

Additional Inherited Members

- Protected Attributes inherited from amrex::IntegratorBase< T >
std::function< void(T &rhs, T &state, const amrex::Real time)> Rhs
 Rhs is the right-hand-side function the integrator will use. More...
 
std::function< void(T &rhs, T &state, const amrex::Real time)> RhsIm
 RhsIm is the implicit right-hand-side function an ImEx integrator will use. More...
 
std::function< void(T &rhs, T &state, const amrex::Real time)> RhsEx
 RhsEx is the explicit right-hand-side function an ImEx integrator will use. More...
 
std::function< void(T &rhs, T &state, const amrex::Real time)> RhsFast
 RhsFast is the fast timescale right-hand-side function a multirate integrator will use. More...
 
std::function< void(T &, amrex::Real)> post_stage_action
 The post_stage_action function is called by the integrator on the computed stage just after it is computed. More...
 
std::function< void(T &, amrex::Real)> post_step_action
 The post_step_action function is called by the integrator on the computed state just after it is computed. More...
 
std::function< void(T &, amrex::Real)> post_fast_stage_action
 The post_stage_action function is called by the integrator on the computed stage just after it is computed. More...
 
std::function< void(T &, amrex::Real)> post_fast_step_action
 The post_step_action function is called by the integrator on the computed state just after it is computed. More...
 
bool use_adaptive_time_step = false
 Flag to enable/disable adaptive time stepping in single rate methods or at the slow time scale in multirate methods (bool) More...
 
amrex::Real time_step
 Current integrator time step size (Real) More...
 
amrex::Real previous_time_step
 Step size of the last completed step (Real) More...
 
bool use_adaptive_fast_time_step = false
 Flag to enable/disable adaptive time stepping at the fast time scale in multirate methods (bool) More...
 
amrex::Real fast_time_step
 Current integrator fast time scale time step size with multirate methods (Real) More...
 
amrex::Long num_steps = 0
 Number of integrator time steps (Long) More...
 
int max_steps = 500
 Max number of internal steps before an error is returned (Long) More...
 
amrex::Real rel_tol = 1.0e-4
 Relative tolerance for adaptive time stepping (Real) More...
 
amrex::Real abs_tol = 1.0e-9
 Absolute tolerance for adaptive time stepping (Real) More...
 
amrex::Real fast_rel_tol = 1.0e-4
 Relative tolerance for adaptive time stepping at the fast time scale (Real) More...
 
amrex::Real fast_abs_tol = 1.0e-9
 Absolute tolerance for adaptive time stepping at the fast time scale (Real) More...
 

Member Typedef Documentation

◆ BaseT

template<class T >
using amrex::SundialsIntegrator< T >::BaseT = IntegratorBase<T>
private

Constructor & Destructor Documentation

◆ SundialsIntegrator() [1/2]

template<class T >
amrex::SundialsIntegrator< T >::SundialsIntegrator ( )
inline

◆ SundialsIntegrator() [2/2]

template<class T >
amrex::SundialsIntegrator< T >::SundialsIntegrator ( const T &  S_data,
const amrex::Real  time = 0.0 
)
inline

◆ ~SundialsIntegrator()

template<class T >
virtual amrex::SundialsIntegrator< T >::~SundialsIntegrator ( )
inlinevirtual

Member Function Documentation

◆ advance()

template<class T >
amrex::Real amrex::SundialsIntegrator< T >::advance ( T &  S_old,
T &  S_new,
amrex::Real  time,
const amrex::Real  dt 
)
inlineoverridevirtual

Take a single time step from (time, S_old) to (time + dt, S_new) with the given step size.

Implements amrex::IntegratorBase< T >.

◆ copy_data() [1/2]

template<class T >
N_Vector amrex::SundialsIntegrator< T >::copy_data ( const amrex::MultiFab S_data)
inlineprivate

◆ copy_data() [2/2]

template<class T >
N_Vector amrex::SundialsIntegrator< T >::copy_data ( const amrex::Vector< amrex::MultiFab > &  S_data)
inlineprivate

◆ evolve()

template<class T >
void amrex::SundialsIntegrator< T >::evolve ( T &  S_out,
const amrex::Real  time_out 
)
inlineoverridevirtual

Evolve the current (internal) integrator state to time_out.

Implements amrex::IntegratorBase< T >.

◆ initialize()

template<class T >
void amrex::SundialsIntegrator< T >::initialize ( const T &  S_data,
const amrex::Real  time = 0.0 
)
inline

◆ initialize_parameters()

template<class T >
void amrex::SundialsIntegrator< T >::initialize_parameters ( )
inlineprivate

◆ map_data()

template<class T >
void amrex::SundialsIntegrator< T >::map_data ( std::function< void(T &)>  )
inlineoverridevirtual

◆ SetupMRI()

template<class T >
void amrex::SundialsIntegrator< T >::SetupMRI ( amrex::Real  time,
N_Vector  y_data 
)
inlineprivate

◆ SetupRK()

template<class T >
void amrex::SundialsIntegrator< T >::SetupRK ( amrex::Real  time,
N_Vector  y_data 
)
inlineprivate

◆ time_interpolate()

template<class T >
void amrex::SundialsIntegrator< T >::time_interpolate ( const T &  ,
const T &  ,
amrex::Real  ,
T &   
)
inlineoverridevirtual

◆ unpack_vector() [1/2]

template<class T >
void amrex::SundialsIntegrator< T >::unpack_vector ( N_Vector  y_data,
amrex::MultiFab S_data 
)
inlineprivate

◆ unpack_vector() [2/2]

template<class T >
void amrex::SundialsIntegrator< T >::unpack_vector ( N_Vector  y_data,
amrex::Vector< amrex::MultiFab > &  S_data 
)
inlineprivate

◆ wrap_data() [1/2]

template<class T >
N_Vector amrex::SundialsIntegrator< T >::wrap_data ( amrex::MultiFab S_data)
inlineprivate

◆ wrap_data() [2/2]

template<class T >
N_Vector amrex::SundialsIntegrator< T >::wrap_data ( amrex::Vector< amrex::MultiFab > &  S_data)
inlineprivate

Member Data Documentation

◆ arkode_fast_mem

template<class T >
void* amrex::SundialsIntegrator< T >::arkode_fast_mem = nullptr
private

◆ arkode_mem

template<class T >
void* amrex::SundialsIntegrator< T >::arkode_mem = nullptr
private

◆ fast_LS

template<class T >
SUNLinearSolver amrex::SundialsIntegrator< T >::fast_LS = nullptr
private

◆ fast_method

template<class T >
std::string amrex::SundialsIntegrator< T >::fast_method = "DEFAULT"
private

◆ fast_stepper

template<class T >
MRIStepInnerStepper amrex::SundialsIntegrator< T >::fast_stepper = nullptr
private

◆ fast_type

template<class T >
std::string amrex::SundialsIntegrator< T >::fast_type = "ERK"
private

◆ LS

template<class T >
SUNLinearSolver amrex::SundialsIntegrator< T >::LS = nullptr
private

◆ method

template<class T >
std::string amrex::SundialsIntegrator< T >::method = "DEFAULT"
private

◆ method_e

template<class T >
std::string amrex::SundialsIntegrator< T >::method_e = "DEFAULT"
private

◆ method_i

template<class T >
std::string amrex::SundialsIntegrator< T >::method_i = "DEFAULT"
private

◆ sunctx

template<class T >
::sundials::Context amrex::SundialsIntegrator< T >::sunctx
private

◆ type

template<class T >
std::string amrex::SundialsIntegrator< T >::type = "ERK"
private

◆ udata

template<class T >
SundialsUserData amrex::SundialsIntegrator< T >::udata
private

◆ use_ark

template<class T >
bool amrex::SundialsIntegrator< T >::use_ark = false
private

◆ use_mri

template<class T >
bool amrex::SundialsIntegrator< T >::use_mri = false
private

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