Template Class Ida

Inheritance Relationships

Base Type

Class Documentation

template<class ScalarT, typename IdxT>
class Ida : public AnalysisManager::DynamicSolver<ScalarT, IdxT>

Public Functions

~Ida()

Destroy the Ida< Scalar T, Idx T>:: Ida object.

Note

if sysmodel is freed before this will fail. May want something agnostic to this

Template Parameters:
  • ScalarT

  • IdxT

int configureSimulation()

Configure the simulation.

Template Parameters:
  • ScalarT

  • IdxT

int configureLinearSolver()

Configure the linear solver.

Note

This currently uses pre-processor directives to set dense or sparse linear solvers

Template Parameters:
  • ScalarT

  • IdxT

int configureLinearSolverDense()

Configure a dense linear solver.

Template Parameters:
  • ScalarT

  • IdxT

int getDefaultInitialCondition()

Get default initial condition.

Template Parameters:
  • ScalarT

  • IdxT

int setIntegrationTime(RealT t_init, RealT t_final, int nout)

Set integration time.

Template Parameters:
  • ScalarT

  • IdxT

int initializeSimulation(RealT t0, bool findConsistent = false)

Initialize the simulation.

Template Parameters:
  • ScalarT

  • IdxT

int runSimulation(RealT tf, int nout = 1, std::optional<std::function<void(RealT)>> step_callback = {})

Run the IDA solver on the given model and produce a solution at the given final time.

Todo:

Consider adding initial time as the function argument, as well.

Note

The actual time of the final IDA solution should be somewhat close to tf, however due to rounding error the precise final time may be before or after tf.

Template Parameters:
  • ScalarT – Scalar data type

  • IdxT – Matrix and vector index data type

Parameters:
  • tf – The final simulation time.

  • nout – The number of integration segmentstimes.

  • step_callback – An optional callback which, if provided, will be called after each time the IDA solver has been invoked with the value of t that IDA has calculated the last step at. The provided model will be updated with the latest values of y and yp before the callback is invoked.

Returns:

int zero if successful, error code otherwise.

int deleteSimulation()

Delete the simulation.

Template Parameters:
  • ScalarT

  • IdxT

int configureQuadrature()

Configure quadrature.

Template Parameters:
  • ScalarT

  • IdxT

int initializeQuadrature()

Initialize quadrature.

Template Parameters:
  • ScalarT

  • IdxT

int runSimulationQuadrature(RealT tf, int nout = 1)

Run simulation with quadrature.

Template Parameters:
  • ScalarT

  • IdxT

int deleteQuadrature()

Delete quadrature.

Template Parameters:
  • ScalarT

  • IdxT

int configureAdjoint()

Configure adjoint.

Template Parameters:
  • ScalarT

  • IdxT

int configureLinearSolverBackward()

Configure linear solver for backward simulation.

Note

This only supports dense linear solvers at the moment

Template Parameters:
  • ScalarT

  • IdxT

int initializeAdjoint(IdxT steps = 100)

Initialize adjoint.

Template Parameters:
  • ScalarT

  • IdxT

int initializeBackwardSimulation(RealT tf)

Initialize backward simulation.

Template Parameters:
  • ScalarT

  • IdxT

int runForwardSimulation(RealT tf, int nout = 1)

Run forward simulation.

Template Parameters:
  • ScalarT

  • IdxT

int runBackwardSimulation(RealT t0)

Run backward simulation.

Template Parameters:
  • ScalarT

  • IdxT

int deleteAdjoint()

Delete adjoint.

Template Parameters:
  • ScalarT

  • IdxT

int deleteBackwardSimulation()

Delete backward simulation.

Template Parameters:
  • ScalarT

  • IdxT

void printOutput(RealT t)

Print output.

Template Parameters:
  • ScalarT

  • IdxT

void printSpecial(RealT t, N_Vector x)

Special print.

Template Parameters:
  • ScalarT

  • IdxT

void printFinalStats()

Print final stats.

Template Parameters:
  • ScalarT

  • IdxT

IdaStats getStats() const

Construct and return an IdaStats object containing the statistics of the current IDA workspace. Several statistics returned by IDA are ignored because they are about the current state of IDA, rather than about the simulation at large.