Description
Base class for implicit integrators.
Such integrators require solution of a nonlinear problem, solved using an iterative Newton process which requires the solution of a linear system at each iteration. A full Newton method uses a current matrix (based on the system Jacobian), updated and factorized at each iteration. Modified Newton methods use possibly out-of-date Jacobian information; the Jacobian can be evaluated at the beginning of the step only, kept constant for the duration of the entire simulation, or a Jacobian re-evaluation can be triggered automatically and adaptively, as necessary.
#include <ChTimestepperImplicit.h>


Public Types | |
| enum | JacobianUpdate { JacobianUpdate::EVERY_ITERATION, JacobianUpdate::EVERY_STEP, JacobianUpdate::NEVER, JacobianUpdate::AUTOMATIC } |
| Newton Jacobian update strategies. More... | |
Public Types inherited from chrono::ChTimestepper | |
| enum | Type { EULER_EXPLICIT_I, EULER_EXPLICIT_II, EULER_SEMI_IMPLICIT, RUNGE_KUTTA, HEUN, LEAPFROG, EULER_IMPLICIT, EULER_IMPLICIT_LINEARIZED, EULER_IMPLICIT_PROJECTED, TRAPEZOIDAL, TRAPEZOIDAL_LINEARIZED, NEWMARK, HHT, CUSTOM } |
| Methods for time integration. | |
Public Member Functions | |
| void | SetMaxIters (int iters) |
| Set the max number of Newton iterations. | |
| void | SetRelTolerance (double rel_tol) |
| Set the relative tolerance. More... | |
| void | SetAbsTolerances (double abs_tolS, double abs_tolL) |
| Set the absolute tolerances for states and Lagrange multipliers. More... | |
| void | SetAbsTolerances (double abs_tol) |
| Set the same absolute tolerance for states and Lagrange multipliers. More... | |
| void | SetJacobianUpdateMethod (JacobianUpdate method) |
| Set the strategy for Jacobian update (default: EVERY_STEP). | |
| double | GetMaxIters () const |
| Get the max number of iterations using the Newton Raphson procedure. | |
| JacobianUpdate | GetJacobianUpdateMethod () const |
| Get the current Jacobian update strategy. | |
| unsigned int | GetNumStepIterations () const |
| Return the number of Newton iterations over the last step. | |
| unsigned int | GetNumStepSetupCalls () const |
| Return the number of calls to the solver's Setup function made during the last step. | |
| unsigned int | GetNumStepSolveCalls () const |
| Return the number of calls to the solver's Solve function made over the last step. | |
| double | GetEstimatedConvergenceRate () const |
| Get the last estimated convergence rate for the internal Newton solver. More... | |
| unsigned int | GetNumIterations () const |
| Return the cumulative number of Newton iterations. | |
| unsigned int | GetNumSetupCalls () const |
| Return the cumulative number of calls to the solver's Setup function. | |
| unsigned int | GetNumSolveCalls () const |
| Return the cumulative number of calls to the solver's Solve function. | |
| void | AcceptTerminatedStep (bool accept) |
| Accept step after a non-converged Newton solve (default: true). More... | |
| unsigned int | GetNumTerminated () const |
| Return the number of terminated Newton solves. More... | |
| void | SetStepControl (bool enable) |
| Turn on/off the internal step size control. More... | |
| void | SetMinStepSize (double step) |
| Set the minimum step size. More... | |
| void | SetMaxItersSuccess (int iters) |
| Set the maximum allowable number of iterations for counting a step towards a stepsize increase. More... | |
| void | SetRequiredSuccessfulSteps (int num_steps) |
| Set the minimum number of (internal) steps that use at most maxiters_success before considering a stepsize increase. More... | |
| void | SetStepIncreaseFactor (double factor) |
| Set the multiplicative factor for a stepsize increase (must be larger than 1). More... | |
| void | SetStepDecreaseFactor (double factor) |
| Set the multiplicative factor for a stepsize decrease (must be smaller than 1). More... | |
| virtual void | Advance (double dt) override final |
| Perform an integration step. More... | |
| virtual void | SaveInternalState (ChCheckpointWriter &writer) const override |
| Save the step size control state (internal step size and number of successive successful steps). | |
| virtual void | LoadInternalState (ChCheckpointReader &reader) override |
| Load the step size control state. | |
| virtual void | ArchiveOut (ChArchiveOut &archive) override |
| Method to allow serialization of transient data to archives. | |
| virtual void | ArchiveIn (ChArchiveIn &archive) override |
| Method to allow de-serialization of transient data from archives. | |
Public Member Functions inherited from chrono::ChTimestepper | |
| virtual Type | GetType () const =0 |
| Return type of the integration method. | |
| virtual ChIntegrable * | GetIntegrable () const =0 |
| Return the associated integrable object. | |
| virtual ChVectorDynamic & | GetLagrangeMultipliers () |
| Access the Lagrange multipliers, if any. | |
| virtual double | GetTime () const |
| Get the current time. | |
| virtual void | SetTime (double mt) |
| Set the current time. | |
| void | SetVerbose (bool verb) |
| Turn on/off logging of messages. | |
| std::string | GetTypeAsString () const |
| Return this integrator's type as a string. | |
Static Public Member Functions | |
| static std::string | GetJacobianUpdateMethodAsString (JacobianUpdate jacobian_update) |
| Return Jacobian update method as a string. | |
Static Public Member Functions inherited from chrono::ChTimestepper | |
| static std::string | GetTypeAsString (Type type) |
| Return the provided integrator type as a string. | |
Protected Member Functions | |
| virtual void | OnAdvance (double dt) |
| Implementation of integrator-specific time advance. More... | |
| virtual void | InitializeStep () |
| Initialize integrator at beginning of a new step. More... | |
| virtual void | PrepareStep () |
| Prepare integrator for attempting a new step. More... | |
| virtual void | Increment () |
| Calculate new state increment for a Newton iteration. More... | |
| virtual void | ResetStep () |
| Reset step data for re-attempting step (with new Jacobian or reduced step size). More... | |
| virtual void | AcceptStep () |
| Accept attempted step (if Newton converged or was terminated). More... | |
| virtual void | FinalizeStep () |
| Finalize step and update solution at end of step. More... | |
| bool | CheckConvergence (int iteration) |
| Check convergence of Newton process. More... | |
| std::string | GetConvergenceReport () const |
| Return a description of the last convergence check (norms, tolerances, and failed tests). | |
| std::string | GetResidualTestReport () const |
| Return a description of the residual test at the last convergence check. | |
| void | ProcessTerminatedSolve (const std::string &report) |
| Handle a Newton solve that did not converge within the maximum number of iterations. More... | |
| void | CalcErrorWeights (const ChVectorDynamic<> &x, double rtol, double atol, ChVectorDynamic<> &ewt) |
| Calculate error weights based on the given state and tolerances. | |
Protected Member Functions inherited from chrono::ChTimestepper | |
| ChTimestepper (ChIntegrable *intgr=nullptr) | |
Protected Attributes | |
| JacobianUpdate | jacobian_update_method |
| Jacobian update strategy. | |
| bool | call_setup |
| should the solver's Setup function be called? | |
| bool | call_analyze |
| should the solver's Setup analyze phase be called? | |
| bool | jacobian_is_current |
| was the Jacobian evaluated at current Newton iteration? | |
| unsigned int | max_iters |
| maximum number of iterations | |
| double | reltol |
| relative tolerance | |
| double | abstolS |
| absolute tolerance (states) | |
| double | abstolL |
| absolute tolerance (Lagrange multipliers) | |
| unsigned int | num_step_iters |
| number of iterations during last step | |
| unsigned int | num_step_setups |
| number of calls to the solver Setup() function during last step | |
| unsigned int | num_step_solves |
| number of calls to the solver Solve() function during last step | |
| unsigned int | num_iters |
| current cumulative number of Newton iterations | |
| unsigned int | num_setups |
| current cumulative number of Setup() calls | |
| unsigned int | num_solves |
| current cumulative number of Solve() calls | |
| unsigned int | num_terminated |
| number of terminated NEwton iterations | |
| double | convergence_rate |
| estimated Newton rate of convergence | |
| ChStateDelta | Ds |
| state update | |
| ChVectorDynamic | Dl |
| Lagrange multiplier update. | |
| ChVectorDynamic | R |
| residual of nonlinear system (dynamics portion) | |
| ChVectorDynamic | Qc |
| residual of nonlinear system (constraints portion) | |
| double | Qc_scale |
| factor converting the constraint residual Qc to a position-level constraint violation | |
| double | R_nrm |
| norm of the dynamics residual at the last convergence check | |
| double | C_nrm |
| norm of the position-level constraint violation at the last convergence check | |
| double | Ds_nrm |
| WRMS norm of the state update at the last convergence check. | |
| double | Dl_nrm |
| WRMS norm of the Lagrange multiplier update at the last convergence check. | |
| std::array< double, 3 > | Ds_nrm_hist |
| last 3 update norms | |
| std::array< double, 3 > | Dl_nrm_hist |
| last 3 update norms | |
| ChVectorDynamic | ewtS |
| vector of error weights (states) | |
| ChVectorDynamic | ewtL |
| vector of error weights (Lagrange multipliers) | |
| bool | accept_terminated |
| accept or reject steps after a non-converged Newton solve | |
| bool | step_control |
| step size control enabled? | |
| unsigned int | maxiters_success |
| maximum number of NR iterations to declare a step successful | |
| unsigned int | req_successful_steps |
| required number of successive successful steps for a stepsize increase | |
| double | step_increase_factor |
| factor used in increasing stepsize (>1) | |
| double | step_decrease_factor |
| factor used in decreasing stepsize (<1) | |
| double | h_min |
| minimum allowable stepsize | |
| double | h |
| internal stepsize | |
| unsigned int | num_successful_steps |
| number of successful steps | |
Protected Attributes inherited from chrono::ChTimestepper | |
| bool | verbose |
| double | T |
| ChVectorDynamic | L |
| bool | Qc_do_clamp |
| double | Qc_clamping |
Member Enumeration Documentation
◆ JacobianUpdate
|
strong |
Member Function Documentation
◆ AcceptStep()
|
inlineprotectedvirtual |
Accept attempted step (if Newton converged or was terminated).
Used only if no override of OnAdvance is provided.
◆ AcceptTerminatedStep()
|
inline |
Accept step after a non-converged Newton solve (default: true).
If 'true', the solution at the end of a step is accepted as-is, even if the Newton nonlinear solve did not converge (even with an up-to-date Jacobian). If 'false', an exception is thrown if the Newton iterations do not converge after the allowed maximum number of iterations.
◆ Advance()
|
finaloverridevirtual |
Perform an integration step.
This base class manages the Newton iteration counters and defers the integrator implementation to OnAdvance.
Implements chrono::ChTimestepper.
◆ CheckConvergence()
|
protected |
Check convergence of Newton process.
Used only if no override of OnAdvance is provided.
◆ FinalizeStep()
|
inlineprotectedvirtual |
Finalize step and update solution at end of step.
Used only if no override of OnAdvance is provided.
◆ GetEstimatedConvergenceRate()
|
inline |
Get the last estimated convergence rate for the internal Newton solver.
Note that an estimate can only be calculated after the 3rd iteration. For the first 2 iterations, the convergence rate estimate is set to 1.
◆ GetNumTerminated()
|
inline |
Return the number of terminated Newton solves.
These are Newton solves that were terminated after the maximum number of iterations, without achieving convergence. The Jacobian is either up-to-date or cannot be re-evaluated (because the Jacobian update strategy is set to JacobianUpdate::NEVER) and step size cannot be reduced (because step-size control is disabled). The nonlinear system solution is accepted as-is.
◆ Increment()
|
inlineprotectedvirtual |
Calculate new state increment for a Newton iteration.
Used only if no override of OnAdvance is provided.
◆ InitializeStep()
|
inlineprotectedvirtual |
Initialize integrator at beginning of a new step.
Used only if no override of OnAdvance is provided.
◆ OnAdvance()
|
protectedvirtual |
Implementation of integrator-specific time advance.
This base class implementation provides support for an adaptive time-step, error-controlled integrator. A derived class using these features, must implement the functions . Otherwise, it must override OnAdvance.
Reimplemented in chrono::ChTimestepperNewmark, chrono::ChTimestepperTrapezoidalLinearized, chrono::ChTimestepperTrapezoidal, chrono::ChTimestepperEulerImplicitProjected, chrono::ChTimestepperEulerImplicitLinearized, and chrono::ChTimestepperEulerImplicit.
◆ PrepareStep()
|
inlineprotectedvirtual |
Prepare integrator for attempting a new step.
Used only if no override of OnAdvance is provided.
◆ ProcessTerminatedSolve()
|
protected |
Handle a Newton solve that did not converge within the maximum number of iterations.
Throws an exception with the given report if terminated steps are not accepted; otherwise, counts the terminated solve and prints the report in verbose mode.
◆ ResetStep()
|
inlineprotectedvirtual |
Reset step data for re-attempting step (with new Jacobian or reduced step size).
Used only if no override of OnAdvance is provided.
◆ SetAbsTolerances() [1/2]
|
inline |
Set the same absolute tolerance for states and Lagrange multipliers.
◆ SetAbsTolerances() [2/2]
|
inline |
Set the absolute tolerances for states and Lagrange multipliers.
These tolerances are used in the Newton convergence test. See the documentation of each derived integrator class for the quantities they are applied to.
◆ SetMaxItersSuccess()
|
inline |
Set the maximum allowable number of iterations for counting a step towards a stepsize increase.
Default: 3.
◆ SetMinStepSize()
|
inline |
Set the minimum step size.
An exception is thrown if the internal step size decreases below this limit. Default: 1e-10.
◆ SetRelTolerance()
|
inline |
Set the relative tolerance.
This tolerance is used in the Newton convergence test. See the documentation of each derived integrator class for the quantities it is applied to.
◆ SetRequiredSuccessfulSteps()
|
inline |
Set the minimum number of (internal) steps that use at most maxiters_success before considering a stepsize increase.
Default: 5.
◆ SetStepControl()
|
inline |
Turn on/off the internal step size control.
Default: true.
◆ SetStepDecreaseFactor()
|
inline |
Set the multiplicative factor for a stepsize decrease (must be smaller than 1).
Default: 0.5.
◆ SetStepIncreaseFactor()
|
inline |
Set the multiplicative factor for a stepsize increase (must be larger than 1).
Default: 2.
The documentation for this class was generated from the following files:
- /builds/uwsbel/chrono/src/chrono/timestepper/ChTimestepperImplicit.h
- /builds/uwsbel/chrono/src/chrono/timestepper/ChTimestepperImplicit.cpp
Public Types inherited from