Class IdaIntegrator#

Nested Relationships#

Nested Types#

Inheritance Relationships#

Base Type#

Class Documentation#

class IdaIntegrator : public Karana::Math::Integrator#

IDA DAE integrator from the SUNDIALS suite

Public Types

enum class NLSOLVER#

the nonlinear solver type to use

Values:

enumerator FIXEDPOINT#
enumerator NEWTON#
enum class METHOD#

the solver type to use

Values:

enumerator ADAMS#
enumerator BDF#

Public Functions

IdaIntegrator(size_t nstates, DerivativeFunction f, const IntegratorOptions *options = nullptr)#

Constructor

~IdaIntegrator()#
inline virtual const std::string &typeString() const override#

Return the integrator type as a string.

Returns:

the integrator type

virtual void hardReset(size_t nstates) override#

Reset the state size.

Parameters:

nstates – the new state size

virtual void softReset(const Ktime &new_t, const Vec &new_x) override#

Reset the cached time and state and to the new values going forward.

Parameters:
  • new_t – the new time

  • new_x – the new state

void nAlgebgraic(size_t sz)#
virtual Ktime advanceTo(const Ktime &t_end) override#

Method to advance the sytem state to a specified time.

Parameters:

to_t – the desired end time

Returns:

the actual end time

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.

Vec getErrorContributions() const#
inline Vec &residuals()#

Protected Attributes

SUNContext _sunctx = nullptr#
N_Vector _y = nullptr#

Buffers for the state and state derivative. The combine the continuous followed by the algebraic states.

N_Vector _ydot = nullptr#
N_Vector _y_id#

Buffer for the SetID. This sets which states are algebric vs differential.

Vec _residuals#

Buffer for residuals. This buffer is also used for initializing the setting the integrator’s “ydot” values when doing a soft reset. It is also used by the residuals callback to transfer the residual values to ida.

Vec _dx#
size_t _nalgebraic#

The number of algebraic states. nstates = sg.nQ() + sg.nU()

  • nalgebraic

SUNMatrix _A = nullptr#

Matrix used in the linear solver.

SUNLinearSolver _ls = nullptr#

Linear solver.

SUNNonlinearSolver _nls = nullptr#

nonLinear solver

void *_ida_mem#

Protected Static Functions

static int _ida_f(realtype t, N_Vector y, N_Vector yp, N_Vector ydot, void *user_data)#
struct IntegratorOptions : public Karana::Math::Integrator::IntegratorOptions#

Struct with options for this integrator

Public Functions

IntegratorOptions() = default#
inline IntegratorOptions(const IntegratorOptions &p)#
inline IntegratorOptions &operator=(const IntegratorOptions &p)#
inline virtual ~IntegratorOptions()#

Public Members

double rtol = 1e-4#
double atol = 1e-8#
Vec atol_vec#
long max_num_steps = 1e6#
unsigned int anderson_accel = 0#

Anderson acceleration used with the FixedPoint solver.

NLSOLVER nlsolver = NLSOLVER::FIXEDPOINT#
METHOD method = METHOD::ADAMS#