Class ArkExplicitIntegrator#

Inheritance Relationships#

Base Type#

Class Documentation#

class ArkExplicitIntegrator : public Karana::Integrators::SundialsIntegrator#

The multistep ArkODE explicit integrator from the SUNDIALS suite.

Public Functions

ArkExplicitIntegrator(const IntegratorType &integrator_type, size_t nstates, DerivativeFunction f, const ArkExplicitIntegrator::IntegratorOptions *options = nullptr)#

Constructor.

Struct with options for this integrator

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 const kc::ks_ptr<Integrator::IntegratorOptions> getOptions() const override#

Get the options associated with the integrator.

Returns:

The options associated with the integrator.

virtual km::Vec getErrorContributions() const override#

Get the error contribution for each state.

Returns:

A vector with the error contribution for each state.

void setFixedStepSize(double fixed_step_size)#

Set a fixed step size in fixed-step mode; must also disable adaptive steps via setAdaptiveStepping().

Parameters:

fixed_step_size – Target step size to take; a smaller step may be taken only to hit the target time.

void setAdaptiveStepping(bool use_adaptive_steps)#

Set whether adaptive timestepping should be used (defaults to true).

This converts all methods to fixed-step, regular variants. Prefer RK4Integrator unless you need a higher- or lower-order integration rule.

Parameters:

use_adaptive_steps – Whether to use adaptive steps (the default) or lock the step size.

bool getAdaptiveStepping()#

Check whether this integrator is using adaptive step sizes.

Returns:

A boolean corresponding to the adaptive status.

Public Members

const std::map<IntegratorType, ARKODE_ERKTableID> butcher_table_id{{IntegratorType::ARKEXPLICIT_HUEN_EULER, ARKODE_HEUN_EULER_2_1_2}, {IntegratorType::ARKEXPLICIT, ARKODE_ZONNEVELD_5_3_4}, {IntegratorType::ARKEXPLICIT_CASH, ARKODE_CASH_KARP_6_4_5}, {IntegratorType::ARKEXPLICIT_DOPRI, ARKODE_DORMAND_PRINCE_7_4_5}, {IntegratorType::ARKEXPLICIT_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

Public Static Functions

static kc::ks_ptr<ArkExplicitIntegrator> create(const IntegratorType &integrator_type, size_t nstates, DerivativeFunction deriv_fn, const ArkExplicitIntegrator::IntegratorOptions *options = nullptr)#

Factory method for creating CVodeIntegrator instances.

Parameters:
  • integrator_type – the type of integrator to create

  • nstates – the length of the states vector

  • deriv_fn – the derivative function

  • options – options for the integrator

Returns:

a new CVode Integrator instance

Protected Functions

virtual void _initialize() final#

Initialize the implementation-specific data structures.

virtual void _freeMemory() final#

Free all memory, both common and implementation-specific. Must call _freeCommonMemory() to clear shared data structures.

virtual void _applyTolerances() final#

Copy tolerances from internal options into implementation data structures.

virtual void _reInit() final#

Reinitialize internal implementation state for a soft reset.

virtual void _advanceTo(double t_end) final#

Advances implementation to a target time; called by parent class.

Parameters:

t_end

virtual Karana::Core::ks_ptr<Karana::Core::BaseVars> _getVars() const final#

Create the vars for this object.

Returns:

The vars for this object.

Protected Attributes

void *_arkode_mem#

The Arkode memory.

bool _fixed_steps = false#

Whether the integrator is taking fixed-size steps.

double _fixed_step_size#

The size of adaptive steps to take.

kc::ks_ptr<ArkExplicitIntegrator::IntegratorOptions> _opts#

Arkode-specific integrator options.