Class EventDriven¶
Defined in Program listing for file kernel/src/simulationTools/EventDriven.hpp
-
class EventDriven : public Simulation¶
Simulation based on event driven method, ie events detection (see theoretical manual for more details).
WARNING: at the time only written for Lagrangian systems !!!
Public Functions
-
EventDriven(SP::NonSmoothDynamicalSystem nsds, SP::TimeDiscretisation td)¶
defaut constructor
- Parameters
nsds – current nonsmooth dynamical system
td – time discretisation
-
EventDriven(SP::NonSmoothDynamicalSystem nsds, SP::TimeDiscretisation td, int nb)¶
constructor with data
- Parameters
nsds – current nonsmooth dynamical system
td – time discretisation
nb – number of NSProblem
-
inline EventDriven()¶
defaut constructor (needed for serialization)
-
~EventDriven() noexcept = default¶
destructor
-
virtual void initialize() override¶
Overload Simulation::initialize.
-
virtual void firstInitialize() override¶
First (and unique) run of initialization step.
-
inline void setIstate(int newValue)¶
Set value to _istate.
- Parameters
newValue –
-
inline double istate()¶
Get value of _istate.
- Returns
_istate a double
-
inline void setToleranceED(double var)¶
Set value to _TOL_ED.
- Parameters
var – the new tolerance
-
inline double toleranceED()¶
Get value of _epsilon.
- Returns
double
-
inline bool isNewtonConverge()¶
To know if Newton Iteratio is convergent.
- Returns
_isNewtonConverge
-
inline unsigned int getNewtonNbIterations()¶
To known the number of steps performed by the Newton algorithm.
- Returns
_newtonNbIterations
-
inline void setNewtonMaxIteration(unsigned int maxStep)¶
Set value to the maximum number of iterations.
- Parameters
maxStep – maximum number of step
-
inline void setLocalizeEventsMaxIteration(unsigned int maxIter)¶
To set maximum number of iterations to localize events.
- Parameters
maxIter – maximum number of iterations
-
inline double newtonMaxIteration()¶
get the maximum number of Newton iteration
- Returns
unsigned int
-
inline unsigned int LocalizeEventsMaxIteration()¶
get the maximum number of iterations to localize events
- Returns
unsigned int: maximum number of iterations
-
inline double newtonResiduDSMax()¶
accessor to _newtonResiduDSMax
- Returns
double _newtonResiduDSMax
-
inline double newtonResiduYMax()¶
accessor to _newtonResiduYMax
- Returns
double _newtonResiduYMax
-
inline void setNewtonTolerance(double tol)¶
set the Default Newton tolerance
- Parameters
tol – new tolerance
-
inline double newtonTolerance()¶
get the Newton tolerance
- Returns
tolerance
-
virtual void insertIntegrator(SP::OneStepIntegrator) override¶
Redefine method insertIntegrator of the class Simulation.
-
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
-
void updateIndexSetsWithDoubleCondition()¶
update indexSets[1] and [2] (using current y and lambda values of Interactions) with conditions on y[2] AND lambda[2].
-
void computef(OneStepIntegrator &osi, integer *sizeOfX, doublereal *time, doublereal *x, doublereal *xdot)¶
compute right-hand side of xdot = f(x,t), for the integrator osi.
- Parameters
osi – the integrator (Lsodar)
sizeOfX – size of vector x
time – current time given by the integrator
x – state vector
xdot – derivative of x
-
void computeJacobianfx(OneStepIntegrator &osi, integer *sizeOfX, doublereal *time, doublereal *x, doublereal *jacob)¶
compute jacobian of the right-hand side
- Parameters
osi – the integrator (Lsodar)
sizeOfX – size of vector x
time – current time given by the integrator
x – state vector
jacob – jacobian of f according to x
-
virtual unsigned int computeSizeOfg()¶
compute the size of constraint function g(x,t,…) for osi
- Returns
unsigned int
-
virtual void computeg(SP::OneStepIntegrator osi, integer *sizeX, doublereal *time, doublereal *x, integer *sizeG, doublereal *g)¶
compute constraint function g(x,t,…) for osi.
- Parameters
osi – pointer to OneStepIntegrator.
sizeX – integer*, size of vector x
time – doublereal*, time
x – doublereal*, x:array of double
sizeG – integer*, size of vector g (ie number of constraints)
g – doublereal*, g (in-out parameter)
-
void updateImpactState()¶
update input for impact case (ie compute p[1])
-
void updateSmoothState()¶
update state for smooth dynamic case (i.e.
compute p[2] and update acceleration)
-
inline virtual void updateInput(unsigned int level) override¶
update input
- Parameters
level – of lambda used to compute input
-
virtual void updateState(unsigned int level) override¶
update state.
- Parameters
level – of lambda used to compute input
-
virtual void updateOutput(unsigned int level) override¶
update output and indexSets.
- Parameters
level – of lambda used to compute input
-
virtual void advanceToEvent() override¶
run simulation from one Event to the next, according to events manager settings.
-
double computeResiduConstraints()¶
Methods for NewMarkAlphaOSI scheme.
compute maximum residu over all gap functions of Index2 contacts
- Returns
double: maximum residu for all gap functions
-
void prepareNewtonIteration()¶
prepare for Newton iterations for all OSIs
- Returns
maximum residu over all DSs
-
bool newtonCheckConvergence(double)¶
Check convergence of Newton iteration.
- Returns
bool: true if convergent, false otherwise
-
void predictionNewtonIteration()¶
Predict the state of all Dynamical Systems before Newton iterations.
-
void correctionNewtonIteration()¶
Correct the state of all Dynamical Systems during Newton iterations.
-
void newtonSolve(double criterion, unsigned int maxStep)¶
Newton iteration to get the state of all Dynamical Systems at the end of step.
- Parameters
criterion – tolerance to check convergence
maxStep – maximum number of steps
-
double detectEvents(bool updateIstate = true)¶
Detect whether or not events occur during each integration step.
- Parameters
updateIstate – true if we need to update the flag _istate, false otherwise
- Returns
double, maximum of absolute values of constraint fonctions over all activated ot deactivated contacts
-
void LocalizeFirstEvent()¶
Localize time of the first event.
-
EventDriven(SP::NonSmoothDynamicalSystem nsds, SP::TimeDiscretisation td)¶