Class ArkImplicitIntegrator#

Nested Relationships#

Nested Types#

Inheritance Relationships#

Base Type#

Class Documentation#

class ArkImplicitIntegrator : public Karana::Integrators::SundialsImplicitIntegrator#

The (implicit) Adaptive Runge-Kutta integrator from the SUNDIALS suite.

Public Types

enum class PredictorMethod : int#

Predictor used to initialize each implicit Runge-Kutta stage solve.

Values:

enumerator TRIVIAL#

Use the solution from the previous step.

enumerator MAXIMUM_ORDER#

Extrapolate with the highest available dense-output order.

enumerator VARIABLE_ORDER#

Reduce extrapolation order for more distant stages.

enumerator CUTOFF_ORDER#

Use maximum order nearby and first order for distant stages.

Public Functions

ArkImplicitIntegrator(const IntegratorType &integrator_type, size_t num_states, size_t num_q_states, DerivativeFunction f, const ArkImplicitIntegrator::IntegratorOptions *options = nullptr)#

Constructor for implicit arkode 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 cvode integrator to use.

  • options – The integrator options.

virtual ~ArkImplicitIntegrator()#
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.

virtual void setLinearSetupFrequency(long frequency) final#

Set the number of integration steps between linear-solver setups.

Parameters:

frequency – Setup frequency; zero selects the SUNDIALS default.

virtual void setJacobianEvalFrequency(long frequency) final#

Set the number of integration steps between Jacobian evaluations.

Parameters:

frequency – Evaluation frequency; zero selects the SUNDIALS default.

Public Members

const std::map<IntegratorType, ARKODE_DIRKTableID> butcher_table_id{{IntegratorType::ARKIMPLICIT_SDIRK12, ARKODE_SDIRK_2_1_2}, {IntegratorType::ARKIMPLICIT_DIRK23, ARKODE_ARK324L2SA_DIRK_4_2_3}, {IntegratorType::ARKIMPLICIT_SDIRK34, ARKODE_SDIRK_5_3_4}, {IntegratorType::ARKIMPLICIT, ARKODE_SDIRK_5_3_4}, {IntegratorType::ARKIMPLICIT_ESDIRK45, ARKODE_ARK548L2SA_DIRK_8_4_5}}#

   map with the Butcher table number (from arkode_butcher_ark.h)
for the different integrator choices. The numbers are the integrator stages/embedding order/order

Public Static Functions

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

Factory method for creating ArkImplicitIntegrator 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 Arkode Integrator instance

Protected Functions

virtual void _initialize() final#

Initialize the implementation-specific data structures.

void _bindCounterGetters()#

Bind cached counters to implicit 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 void _bindSolvers() final#

Bind internal nonlinear (and possibly linear) solvers to the implementation solver.

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#

Memory used by the arkode integrator.

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

Arkode-specific integrator options.

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.

struct IntegratorOptions : public Karana::Integrators::SundialsImplicitIntegrator::IntegratorOptions#

Options specific to the implicit ARKODE integrator.

Public Members

PredictorMethod predictor_method = PredictorMethod::VARIABLE_ORDER#

Predictor used for implicit stage solves; preserves kdFlex’s existing method 2.