Class NewtonsMethod

Class Documentation

class NewtonsMethod

Implements Newton’s method for finding steady states.

See also: Lines et al. (2019), IFAC-PapersOnLine 52 (26): 32–37. https://doi.org/10.1016/j.ifacol.2019.12.232

Public Functions

NewtonsMethod(gsl::not_null<Model*> model, SUNContext sunctx, gsl::not_null<NewtonSolver*> solver, NewtonDampingFactorMode damping_factor_mode, realtype damping_factor_lower_bound, int max_steps, bool check_delta)

Constructor.

b

Parameters:
  • model – Number of solver states (nx_solver).

  • solverNewtonSolver instance to compute the Newton step. Expected to be correctly initialized.

  • sunctx – A SUNDIALS context for the NVector.

  • max_steps

  • damping_factor_mode

  • damping_factor_lower_bound

  • check_delta

void run(AmiVector &xdot, DEStateView const &state, WRMSComputer &wrms_computer)

Run the Newton solver iterations and checks for convergence to steady state.

Parameters:
  • xdot – Time derivative of the state vector state.x.

  • stateSimulationState instance containing the current state.

  • wrms_computerWRMSComputer instance to compute the WRMS norm.

void compute_step(AmiVector const &xdot, DEStateView const &state)

Compute the Newton step for the current state_.x and xdot and store it in delta_.

Parameters:
  • xdot – Time derivative of the state vector state.x.

  • stateSimulationState instance containing the current state.

inline AmiVector const &get_delta() const

Get the last Newton step.

Returns:

Newton step

inline int get_num_steps() const

Get the number of steps taken in the current iteration.

Returns:

Number of steps taken.

inline realtype get_wrms() const

Get the current WRMS norm.

Returns:

The current WRMS norm.