Class NewtonSolver
Defined in File newton_solver.h
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 get_step(AmiVector &delta, Model &model, DEStateView 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 compute_newton_sensis(AmiVectorArray &sx, Model &model, DEStateView const &state)
Computes steady state sensitivities.
- Parameters:
sx – state variable sensitivities
model – the model instance
state – current simulation state
-
void prepare_linear_system(Model &model, DEStateView 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 prepare_linear_system_b(Model &model, DEStateView 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 solve_linear_system(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, DEStateView 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)
-
explicit NewtonSolver(Model const &model, LinearSolver linsol_type, SUNContext sunctx)