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 num_states, size_t num_q_states, DerivativeFunction f, const ArkExplicitIntegrator::IntegratorOptions *options = nullptr)#

Constructor.

Struct with options for this integrator

Parameters:
  • num_states – The number of states to integrate.

  • num_q_states – Number of leading Q states; zero means no partition is specified.

  • 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.

Call setAdaptiveStepping(false) to enable fixed stepping. ARKODE may take a smaller final step only to reach the requested target time exactly.

Parameters:

fixed_step_size – Positive fixed step size in seconds.

void setAdaptiveStepping(bool use_adaptive_steps)#

Select adaptive or fixed-step integration.

Parameters:

use_adaptive_steps – True for adaptive stepping; false for fixed stepping.

bool getAdaptiveStepping() const#

Report whether adaptive step-size control is enabled.

Returns:

True when ARKODE controls the step size adaptively.

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 num_states, size_t num_q_states, DerivativeFunction deriv_fn, const ArkExplicitIntegrator::IntegratorOptions *options = nullptr)#

Factory method for creating CVodeIntegrator instances.

Parameters:
  • integrator_type – the type of integrator to create

  • num_states – the length of the states vector

  • num_q_states – Number of leading Q states; zero means no partition is specified.

  • 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.

void _bindCounterGetters()#

Bind cached counters to explicit ARKODE optional-output getters.

virtual void _freeMemory() final#

Free implementation-specific SUNDIALS memory.

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 ARKODE error control selects the step size.

double _fixed_step_size = km::notReadyNaN#

Positive step size used in fixed mode, or notReadyNaN until configured.

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

Arkode-specific integrator options.