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 variable
x – pointer to state variables
model – 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 step
delta – 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
-
inline const std::vector<int> &getNumLinSteps() const
Accessor for numlinsteps.
- Returns
numlinsteps
-
virtual 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
-
virtual 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
-
virtual 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
-
virtual ~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
-
static std::unique_ptr<NewtonSolver> getSolver(realtype *t, AmiVector *x, Solver &simulationSolver, Model *model)
Factory method to create a NewtonSolver based on linsolType.
- Parameters
t – pointer to time variable
x – pointer to state variables
simulationSolver – solver with settings
model – pointer to the model object
- Returns
solver NewtonSolver according to the specified linsolType
Protected Attributes
-
std::vector<int> num_lin_steps_
history of number of linear steps
-
NewtonSolver(realtype *t, AmiVector *x, Model *model)