Class NewtonSolver

Class Documentation

class NewtonSolver

The NewtonSolver class sets up the linear solver for the Newton method.

Public Functions

explicit NewtonSolver(Model const &model, LinearSolver linsol_type, SUNContext sunctx)

Initializes solver according to the dimensions in the provided model.

Parameters:
  • model – the model object

  • linsol_type – type of linear solver to use

  • sunctx – SUNDIALS context

NewtonSolver(NewtonSolver const&) = delete
NewtonSolver &operator=(NewtonSolver const &other) = delete
void getStep(AmiVector &delta, Model &model, SimulationState const &state)

Computes the solution of one Newton iteration.

Parameters:
  • delta – containing the RHS of the linear system, will be overwritten by solution to the linear system

  • model – the model instance

  • state – current simulation state

void computeNewtonSensis(AmiVectorArray &sx, Model &model, SimulationState const &state)

Computes steady state sensitivities.

Parameters:
  • sx – state variable sensitivities

  • model – the model instance

  • state – current simulation state

void prepareLinearSystem(Model &model, SimulationState const &state)

Writes the Jacobian for the Newton iteration and passes it to the linear solver.

Parameters:
  • model – the model instance

  • state – current simulation state

void prepareLinearSystemB(Model &model, SimulationState const &state)

Writes the Jacobian (JB) for the Newton iteration and passes it to the linear solver

Parameters:
  • model – the model instance

  • state – current simulation state

void solveLinearSystem(AmiVector &rhs)

Solves the linear system for the Newton step.

Parameters:

rhs – containing the RHS of the linear system, will be overwritten by solution to the linear system

void reinitialize()

Reinitialize the linear solver.

bool is_singular(Model &model, SimulationState const &state) const

Checks whether the linear system is singular.

Parameters:
  • model – the model instance

  • state – current simulation state

Returns:

boolean indicating whether the linear system is singular (condition number < 1/machine precision)