File kernel/src/simulationTools/TimeStepping.hpp

Go to the source code of this file

Time-Stepping simulation.

Defines

SICONOS_TS_LINEAR

Event-capturing Time-Stepping simulation.

This class implements the basic algorithm for Event-capturing Time-Stepping simulations.

References :

V. Acary and B. Brogliato. Numerical Methods for Nonsmooth Dynamical Systems: Applications in Mechanics and Electronics, volume 35 of Lecture Notes in Applied and Computational Mechanics. Springer Verlag, 2008.

SICONOS_TS_LINEAR_IMPLICIT
SICONOS_TS_NONLINEAR

Typedefs

typedef void (*CheckSolverFPtr)(int, Simulation*)

type of function used to post-treat output info from solver.

class TimeStepping : public Simulation

Subclassed by TimeSteppingCombinedProjection, TimeSteppingDirectProjection

Public Functions

virtual void initOSNS() override

initialisation specific to TimeStepping for OneStepNSProblem.

TimeStepping(SP::NonSmoothDynamicalSystem nsds, SP::TimeDiscretisation td, SP::OneStepIntegrator osi, SP::OneStepNSProblem osnspb)

Standard constructor.

Parameters
  • nsdsNonSmoothDynamicalSystem to be simulated

  • td – pointer to a timeDiscretisation used in the integration

  • osi – one step integrator (default none)

  • osnspb – one step non smooth problem (default none)

TimeStepping(SP::NonSmoothDynamicalSystem nsds, SP::TimeDiscretisation td, int nb = 0)

Constructor with the time-discretisation.

Parameters
  • nsdsNonSmoothDynamicalSystem to be simulated

  • td – pointer to a timeDiscretisation used in the integration

  • nb – number of non smooth problem

virtual void insertIntegrator(SP::OneStepIntegrator osi) override

insert an Integrator into the simulation list of integrators

Parameters

osi – the OneStepIntegrator to add

virtual ~TimeStepping() noexcept = default

Destructor.

virtual void updateIndexSet(unsigned int i) override

update indexSets[i] of the topology, using current y and lambda values of Interactions

Parameters

i – the number of the set to be updated

virtual void nextStep()

increment model current time according to User TimeDiscretisation and call SaveInMemory.

void computeFreeState()

integrates all the DynamicalSystems taking not into account nslaw, reactions (ie non-smooth part) …

void resetLambdas()

Reset all lambdas of all interactions.

virtual void advanceToEvent() override

step from current event to next event of EventsManager

void computeOneStep()

run one time—step of the simulation

inline unsigned int getNewtonNbIterations()

To known the number of steps performed by the Newton algorithm.

Returns

the number of steps performed by the Newton algorithm

inline unsigned int getNewtonCumulativeNbIterations()

To known the number of steps performed by the Newton algorithm.

Returns

the cumulative number of steps performed by the Newton algorithm

void initializeNewtonLoop()

initialize the Newton It computes the initial residu and set the, if needed to Newton variable to start the newton algorithm.

void computeInitialNewtonState()
void prepareNewtonIteration()
bool newtonCheckConvergence(double criterion)

check the convergence of Newton algorithm according to criterion

Parameters

criterion – convergence criterion

Returns

bool = true if Newton method has converged

virtual void run() override

run the simulation, from t0 to T with default parameters if any setting has been done

void DefaultCheckSolverOutput(int info)

check returning value from computeOneStepNSProblem and process

Parameters

info – solver-specific error code return by the nonsmooth solver

void setCheckSolverFunction(CheckSolverFPtr newF)

Set CheckSolverOutput function.

Parameters

newF – pointer to function steering the behavior of simulation when nonsmooth solver failed

inline bool isNewtonConverge()
inline bool displayNewtonConvergence()
inline void setDisplayNewtonConvergence(bool newval)
inline void setWarnOnNonConvergence(bool newval)
inline bool warnOnNonConvergence()
void displayNewtonConvergenceAtTheEnd(int info, unsigned int maxStep)
void displayNewtonConvergenceInTheLoop()
inline void setResetAllLambda(bool newval)
inline void setSkipLastUpdateOutput(bool newval)
inline bool skipLastUpdateOutput()
inline void setSkipLastUpdateInput(bool newval)
inline bool skipLastUpdateInput()
inline void setSkipResetLambdas(bool newval)
inline bool skipResetLambdas()
inline void setComputeResiduY(bool v)

To specify if the output interaction residu must be computed.

Parameters

v – set to true when the output interaction residu must be computed

inline virtual bool computeResiduY() override

To know if the output interaction residu must be computed.

Returns

bool _computeResiduY

inline void setComputeResiduR(bool v)

To specify if the input interaction residu must be computed.

Parameters

v – set to true when the input interaction residu must be computed

inline virtual bool computeResiduR() override

To known if the input interaction residu must be computed.

Returns

bool _computeResiduR

inline void setNewtonTolerance(double tol)

set the Default Newton tolerance

Parameters

tol – Newton solver tolerance

inline double newtonTolerance()

get the Newton tolerance

Returns

default Newton solver tolerance

inline void setNewtonMaxIteration(unsigned int maxStep)

set the maximum number of Newton iteration

Parameters

maxStep – maximum number of Newton solver iterations

inline unsigned int newtonMaxIteration()

get the maximum number of Newton iteration

Returns

maximum number of Newton solver iterations

inline void setNewtonOptions(unsigned int v)

set the NewtonOptions

Parameters

v – Newton solver options

inline unsigned int newtonOptions()

get the NewtonOptions

Returns

Newton solver options - SICONOS_TS_LINEAR 1, SICONOS_TS_LINEAR_IMPLICIT 2, SICONOS_TS_NONLINEAR 3

inline double newtonResiduDSMax()

accessor to _newtonResiduDSMax

Returns

_newtonResiduDSMax

inline double newtonResiduYMax()

accessor to _newtonResiduYMax

Returns

_newtonResiduYMax

inline double newtonResiduRMax()

accessor to _newtonResiduRMax

Returns

_newtonResiduRMax

ACCEPT_STD_VISITORS()

Protected Functions

ACCEPT_SERIALIZATION(TimeStepping)
inline TimeStepping()

Default Constructor.

virtual void newtonSolve(double criterion, unsigned int maxStep)

newton algorithm

Parameters
  • criterion – convergence criterion

  • maxStep – maximum number of Newton steps

Protected Attributes

double _newtonTolerance

Default Newton tolerance used in call of run() of ComputeOneStep()

unsigned int _newtonMaxIteration

Default maximum number of Newton iteration.

unsigned int _newtonNbIterations

Number of steps performed in the Newton Loop.

unsigned int _newtonCumulativeNbIterations

Cumulative number of steps performed in the Newton Loops.

unsigned int _newtonOptions

unsigned int _newtonOptions option in the Newon iteration SICONOS_TS_LINEAR or SICONOS_TS_LINEAR_IMPLICIT SICONOS_TS_NONLINEAR will force a single iteration of the Newton Solver SICONOS_TS_NONLINEAR (default) will perform the newton iteration up to convergence

double _newtonResiduDSMax

Maximum Residual for the Dynamical system.

double _newtonResiduYMax

Maximum Residual for the output of the relation.

double _newtonResiduRMax

Maximum Residual for the input of the relation.

bool _computeResiduY

boolean variable to know whether the ResiduY has to be computed or not if true, the ResiduY is computed and the convergence is checked

bool _computeResiduR

boolean variable to know whether the ResiduR has to be computed or not if true, the ResiduR is computed and the convergence is checked

bool _isNewtonConverge

boolean variable to know whether Newton iterations converge or not

bool _newtonUpdateInteractionsPerIteration

boolean variable indicating whether interactions should be updated within the Newton loop.

bool _displayNewtonConvergence

boolean variable to display Newton info

bool _warnOnNonConvergence

boolean variable to display warning on non-convergence

bool _resetAllLambda

boolean variable to resetAllLamda at each step (default true)

bool _skip_last_updateOutput

boolean variable to skip updateOutput at the end of the step (default false)

bool _skip_last_updateInput

boolean variable to skip updateInput at the end of the step (default false) useful for Global integrators that do not need to compute input in the linear case

bool _skip_resetLambdas

boolean variable to skip resetLambdas (default false)