Class ArkExplicitIntegrator#
Defined in File Integrator.h
Nested Relationships#
Nested Types#
Inheritance Relationships#
Base Type#
public Karana::Math::Integrator(Class Integrator)
Class Documentation#
-
class ArkExplicitIntegrator : public Karana::Math::Integrator#
The multistep ArkODE explicit integrator from the SUNDIALS suite.
Public Types
Public Functions
-
ArkExplicitIntegrator(size_t nstates, DerivativeFunction f, const IntegratorType &integrator_type, const IntegratorOptions *options = nullptr)#
Constructor.
- Parameters:
nstates – The number of states to integrate.
f – The derivative function to calculate the derivative of the states.
integrator_type – The type of ark integrator to use.
options – The integrator options.
-
~ArkExplicitIntegrator()#
-
virtual std::string_view typeString() const override#
Return the integrator type as a string.
- Returns:
the integrator type
-
virtual std::unique_ptr<Integrator::IntegratorOptions> getOptions() override#
Get the options associated with the integrator.
- Returns:
The options associated with the integrator.
-
virtual IntegratorType getIntegratorType() const override#
Get the IntegratorType for this integrator.
- Returns:
The IntegratorType for this integrator.
-
virtual void hardReset(size_t nstates) override#
Reset the state size.
- Parameters:
nstates – the new state size
Public Members
-
const std::map<METHOD, ARKODE_ERKTableID> butcher_table_id{{METHOD::HUEN_EULER, ARKODE_HEUN_EULER_2_1_2}, {METHOD::ZONNEVELD, ARKODE_ZONNEVELD_5_3_4}, {METHOD::CASH_KARP, ARKODE_CASH_KARP_6_4_5}, {METHOD::DORMAND_PRINCE, ARKODE_DORMAND_PRINCE_7_4_5}, {METHOD::FEHLBERG78, ARKODE_FEHLBERG_13_7_8}}#
map with the Butcher table number (from arkode_butcher_erk.h) for the different integrator choices. The numbers are the integrator stages/embedding order/order
Protected Attributes
-
SUNContext _sunctx = nullptr#
The Sundials context object.
-
N_Vector _y = nullptr#
The current integrator state.
-
SUNMatrix _a_mat = nullptr#
Matrix used in the linear solver.
-
SUNLinearSolver _ls = nullptr#
Linear solver.
-
SUNNonlinearSolver _nls = nullptr#
Nonlinear solver.
-
void *_arkode_mem#
The Arkode memory.
Protected Static Functions
-
static int _arkode_f(realtype t, N_Vector y, N_Vector ydot, void *user_data)#
Calles the derivative function on the provided integrator state, and puts the derivative of the state into ydot.
- Parameters:
t – The time to use when calculating the derivative.
y – The current integrator state.
ydot – The vector that will get populated with the derivative of the state.
user_data – Extra data used by the deriative function.
- Returns:
An error code indicating if the call was successful or not.
-
struct IntegratorOptions : public Karana::Math::Integrator::IntegratorOptions#
Struct with options for this integrator
Public Functions
-
IntegratorOptions &operator=(const IntegratorOptions &p)#
Assignment operator.
- Parameters:
p – The IntegratorOptions to copy values from.
- Returns:
A reference to the newly assigned IntegratorOptions.
-
IntegratorOptions(const IntegratorOptions &p)#
Copy constructor.
- Parameters:
p – The IntegratorOptions to copy values from.
-
IntegratorOptions() = default#
Constructor.
-
virtual ~IntegratorOptions()#
Public Members
-
double rtol = 1e-4#
The desired relative tolerance used to control the integrator error.
-
double atol = 1e-8#
The desired absolute tolerance used to control the integrator error.
-
Vec atol_vec#
The desired absolute tolerance vector used to control the integrator error. This can be used rather than a scalar tolerance to set different values for different states.
-
long max_num_steps = 500#
Maximum number of steps the solver can take before erroring.
-
NLSOLVER nlsolver = NLSOLVER::FIXEDPOINT#
The Nonlinear solver type to use.
-
IntegratorOptions &operator=(const IntegratorOptions &p)#
-
ArkExplicitIntegrator(size_t nstates, DerivativeFunction f, const IntegratorType &integrator_type, const IntegratorOptions *options = nullptr)#