Class SundialsSolverBundle#

Class Documentation#

class SundialsSolverBundle#

RAII memory wrapper for sundials solver memory to make cvode / implicit arkode easier.

Public Functions

SundialsSolverBundle() = default#
inline ~SundialsSolverBundle()#
SundialsSolverBundle(const SundialsSolverBundle&) = delete#
SundialsSolverBundle &operator=(const SundialsSolverBundle&) = delete#
inline SundialsSolverBundle(SundialsSolverBundle &&other) noexcept#

Move constructor.

Parameters:

other – Object to move into this one

inline SundialsSolverBundle &operator=(SundialsSolverBundle &&other) noexcept#

Move assignment operator.

Parameters:

other – Object to move into this one

Returns:

other Reference to a valid solver bundle

void reset()#

Reset all internal data structures.

void setMaxNlIters(int max_iters)#

Set the Anderson damping factor to use for nonlinear solves; must be in (0, 1] and smaller means stronger damping.

Parameters:

max_iters – Damping factor; pass a value of 1 for no damping.

void setAndersonDamping(double damping)#

Set the Anderson damping factor to use for nonlinear solves; must be in (0, 1] and smaller means stronger damping.

Parameters:

damping – Damping factor; pass a value of 1 for no damping.

inline SUNMatrix matrix() const#

Get the A matrix used to store jacobians for nonlinear solves.

Returns:

The A matrix.

inline SUNLinearSolver linearSolver() const#

Get the linear solver object.

Returns:

The linear solver.

inline SUNNonlinearSolver nonlinearSolver() const#

Get the nonlinear solver object.

Returns:

The nonlinear solver.

inline bool isFixedPoint() const#

Get the A matrix used to store jacobians for nonlinear solves.

Returns:

A matrix object.

Public Static Functions

static std::unique_ptr<SundialsSolverBundle> createNewton(N_Vector y, SUNContext ctx)#

Factory method to create a Newton solver + Linear solver.

Parameters:
  • y – State vector.

  • ctx – SUNDIALS context for memory management.

Returns:

Pointer to a new solver bundle.

static std::unique_ptr<SundialsSolverBundle> createFixedPoint(N_Vector y, int nstates, SUNContext ctx)#

Factory method to create a Newton solver + Linear solver.

Parameters:
  • y – State vector.

  • nstates – Number of states.

  • ctx – SUNDIALS context for memory management.

Returns:

Pointer to a new solver bundle.