File kernel/src/simulationTools/TimeStepping.hpp

Go to the source code of this file

Time-Stepping simulation.

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

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

Standard constructor.

Parameters
  • nsds: NonSmoothDynamicalSystem 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
  • nsds: NonSmoothDynamicalSystem to be simulated
  • td: pointer to a timeDiscretisation used in the integration
  • nb: number of non smooth problem

virtual ~TimeStepping()

Destructor.

ACCEPT_STD_VISITORS()

visitors hook

void advanceToEvent()

step from current event to next event of EventsManager

void computeFreeState()

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

void computeOneStep()

run one timestep of the simulation

virtual bool computeResiduR()

To known if the input interaction residu must be computed.

Return
bool _computeResiduR

virtual bool computeResiduY()

To know if the output interaction residu must be computed.

Return
bool _computeResiduY

void DefaultCheckSolverOutput(int info)

check returning value from computeOneStepNSProblem and process

Parameters
  • info: solver-specific error code return by the nonsmooth solver

unsigned int getNewtonCumulativeNbIterations()

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

Return
the cumulative number of steps performed by the Newton algorithm

unsigned int getNewtonNbIterations()

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

Return
the 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.

virtual void initOSNS()

initialisation specific to TimeStepping for OneStepNSProblem.

bool isNewtonConverge()
bool newtonCheckConvergence(double criterion)

check the convergence of Newton algorithm according to criterion

Return
bool = true if Newton method has converged
Parameters
  • criterion: convergence criterion

double newtonMaxIteration()

get the maximum number of Newton iteration

Return
maximum number of Newton solver iterations

unsigned int newtonOptions()

get the NewtonOptions

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

double newtonResiduDSMax()

accessor to _newtonResiduDSMax

Return
_newtonResiduDSMax

double newtonResiduRMax()

accessor to _newtonResiduRMax

Return
_newtonResiduRMax

double newtonResiduYMax()

accessor to _newtonResiduYMax

Return
_newtonResiduYMax

double newtonTolerance()

get the Newton tolerance

Return
default Newton solver tolerance

virtual void nextStep()

Used by the updateIndexSet function in order to deactivate SP::Interaction.

Used by the updateIndexSet function in order to activate SP::Interaction.increment model current time according to User TimeDiscretisation and call SaveInMemory.

void prepareNewtonIteration()
void resetLambdas()

Reset all lambdas of all interactions.

void run()

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

void saveYandLambdaInOldVariables()
void setCheckSolverFunction(CheckSolverFPtr newF)

Set CheckSolverOutput function.

Parameters
  • newF: pointer to function steering the behavior of simulation when nonsmooth solver failed

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

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

void setDisplayNewtonConvergence(bool newval)
void setNewtonMaxIteration(unsigned int maxStep)

set the maximum number of Newton iteration

Parameters
  • maxStep: maximum number of Newton solver iterations

void setNewtonOptions(unsigned int v)

set the NewtonOptions

Parameters
  • v: Newton solver options

void setNewtonTolerance(double tol)

set the Default Newton tolerance

Parameters
  • tol: Newton solver tolerance

void setResetAllLambda(bool newval)
void setWarnOnNonConvergence(bool newval)
virtual void updateIndexSet(unsigned int i)

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

Parameters
  • i: the number of the set to be updated

Protected Functions

TimeStepping()

Default Constructor.

ACCEPT_SERIALIZATION(TimeStepping)

serialization hooks

virtual void newtonSolve(double criterion, unsigned int maxStep)

newton algorithm

Parameters
  • criterion: convergence criterion
  • maxStep: maximum number of Newton steps

Protected Attributes

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 _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 _displayNewtonConvergence

boolean variable to display Newton info

bool _isNewtonConverge

boolean variable to know whether Newton iterations converge or not

unsigned int _newtonCumulativeNbIterations

Cumulative number of steps performed in the Newton Loops.

unsigned int _newtonMaxIteration

Default maximum number of Newton iteration.

unsigned int _newtonNbIterations

Number of steps performed in the Newton Loop.

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 _newtonResiduRMax

Maximum Residual for the input of the relation.

double _newtonResiduYMax

Maximum Residual for the output of the relation.

double _newtonTolerance

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

bool _newtonUpdateInteractionsPerIteration

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

bool _resetAllLambda

boolean variable to resetAllLamda at each step (default true)

bool _warnOnNonConvergence

boolean variable to display warning on non-convergence