Class NewtonSolver¶
Defined in File newton_solver.h
Inheritance Relationships¶
Derived Types¶
public amici::NewtonSolverDense
(Class NewtonSolverDense)public amici::NewtonSolverIterative
(Class NewtonSolverIterative)public amici::NewtonSolverSparse
(Class NewtonSolverSparse)
Class Documentation¶
-
class
amici
::
NewtonSolver
¶ The NewtonSolver class sets up the linear solver for the Newton method.
Subclassed by amici::NewtonSolverDense, amici::NewtonSolverIterative, amici::NewtonSolverSparse
Public Functions
-
NewtonSolver
(realtype *t, AmiVector *x, Model *model)¶ Initializes all members with the provided objects.
- Parameters
t
: pointer to time variablex
: pointer to state variablesmodel
: pointer to the model object
-
void
getStep
(int ntry, int nnewt, AmiVector &delta)¶ Computes the solution of one Newton iteration.
- Parameters
ntry
: integer newton_try integer start number of Newton solver (1 or 2)nnewt
: integer number of current Newton stepdelta
: containing the RHS of the linear system, will be overwritten by solution to the linear system
-
void
computeNewtonSensis
(AmiVectorArray &sx)¶ Computes steady state sensitivities.
- Parameters
sx
: pointer to state variable sensitivities
-
const std::vector<int> &
getNumLinSteps
() const¶ Accessor for numlinsteps.
- Return
numlinsteps
-
void
prepareLinearSystem
(int ntry, int nnewt) = 0¶ Writes the Jacobian for the Newton iteration and passes it to the linear solver.
- Parameters
ntry
: integer newton_try integer start number of Newton solver (1 or 2)nnewt
: integer number of current Newton step
-
void
prepareLinearSystemB
(int ntry, int nnewt) = 0¶ Writes the Jacobian (JB) for the Newton iteration and passes it to the linear solver
- Parameters
ntry
: integer newton_try integer start number of Newton solver (1 or 2)nnewt
: integer number of current Newton step
-
void
solveLinearSystem
(AmiVector &rhs) = 0¶ 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
-
~NewtonSolver
() = default¶
Public Members
-
int
max_lin_steps_
= {0}¶ maximum number of allowed linear steps per Newton step for steady state computation
-
int
max_steps
= {0}¶ maximum number of allowed Newton steps for steady state computation
-
NewtonDampingFactorMode
damping_factor_mode_
= {NewtonDampingFactorMode::on}¶ damping factor flag
Public Static Functions
-
std::unique_ptr<NewtonSolver>
getSolver
(realtype *t, AmiVector *x, Solver &simulationSolver, Model *model)¶ Factory method to create a NewtonSolver based on linsolType.
- Return
solver NewtonSolver according to the specified linsolType
- Parameters
t
: pointer to time variablex
: pointer to state variablessimulationSolver
: solver with settingsmodel
: pointer to the model object
Protected Attributes
-
std::vector<int>
num_lin_steps_
¶ history of number of linear steps
-