siconos.kernel.EventDriven (Python class)

class siconos.kernel.EventDriven(*args)[source]

Bases: siconos.kernel.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 !!!

Generated class (swig), based on C++ header Program listing for file kernel/src/simulationTools/EventDriven.hpp.

Constructors

EventDriven(NonSmoothDynamicalSystem nsds, TimeDiscretisation td)

defaut constructor

Parameters:
  • nsds – current nonsmooth dynamical system
  • td – time discretisation
EventDriven(NonSmoothDynamicalSystem nsds, TimeDiscretisation td, int nb)

constructor with data

Parameters:
  • nsds – current nonsmooth dynamical system
  • td – time discretisation
  • nb – number of NSProblem
EventDriven()

defaut constructor (needed for serialization)

LocalizeEventsMaxIteration() → int[source]

get the maximum number of iterations to localize events

Returns:unsigned int (maximum number of iterations)
LocalizeFirstEvent() → None[source]

Localize time of the first event.

advanceToEvent() → None[source]

Initialize EventDriven.

run simulation from one Event to the next, according to events manager settings.

computeJacobianfx(OneStepIntegrator osi, integer *sizeOfX, doublereal *time, doublereal *x, doublereal *jacob) → None[source]

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
computeResiduConstraints() → double[source]

visitors hook

Methods for NewMarkAlphaOSI scheme compute maximum residu over all gap functions of Index2 contacts

Returns:double (maximum residu for all gap functions)
computeSizeOfg() → int[source]

compute the size of constraint function g(x,t,…) for osi

Returns:unsigned int
computef(OneStepIntegrator osi, integer *sizeOfX, doublereal *time, doublereal *x, doublereal *xdot) → None[source]

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
computeg(OneStepIntegrator osi, integer *sizeX, doublereal *time, doublereal *x, integer *sizeG, doublereal *g) → None[source]

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)
correctionNewtonIteration() → None[source]

Correct the state of all Dynamical Systems during Newton iterations.

detectEvents(bool updateIstate=True) → double[source]

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
getNewtonNbIterations() → int[source]

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

Returns:_newtonNbIterations
initialize() → None[source]

Overload Simulation::initialize.

insertIntegrator(OneStepIntegrator) → None[source]

Redefine method insertIntegrator of the class Simulation.

isNewtonConverge() → bool[source]

To know if Newton Iteratio is convergent.

Returns:_isNewtonConverge
istate() → double[source]

Get value of _istate.

Returns:_istate a double
newtonCheckConvergence(double) → bool[source]

Check convergence of Newton iteration.

Returns:bool (true if convergent, false otherwise)
newtonMaxIteration() → double[source]

get the maximum number of Newton iteration

Returns:unsigned int
newtonResiduDSMax() → double[source]

accessor to _newtonResiduDSMax

Returns:double _newtonResiduDSMax
newtonResiduYMax() → double[source]

accessor to _newtonResiduYMax

Returns:double _newtonResiduYMax
newtonSolve(double criterion, int maxStep) → None[source]

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
newtonTolerance() → double[source]

get the Newton tolerance

Returns:tolerance
predictionNewtonIteration() → None[source]

Predict the state of all Dynamical Systems before Newton iterations.

prepareNewtonIteration() → None[source]

prepare for Newton iterations for all OSIs

Returns:maximum residu over all DSs
setIstate(int newValue) → None[source]

Set value to _istate.

Parameters:newValue
setLocalizeEventsMaxIteration(int maxIter) → None[source]

To set maximum number of iterations to localize events.

Parameters:maxIter – maximum number of iterations
setNewtonMaxIteration(int maxStep) → None[source]

Set value to the maximum number of iterations.

Parameters:maxStep – maximum number of step
setNewtonTolerance(double tol) → None[source]

set the Default Newton tolerance

Parameters:tol – new tolerance
setToleranceED(double var) → None[source]

Set value to _TOL_ED.

Parameters:var – the new tolerance
toleranceED() → double[source]

Get value of _epsilon.

Returns:double
updateImpactState() → None[source]

update input for impact case (ie compute p[1])

updateIndexSet(int i) → None[source]

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

Parameters:i – the number of the set to be updated
updateIndexSetsWithDoubleCondition() → None[source]

update indexSets[1] and [2] (using current y and lambda values of Interactions) with conditions on y[2] AND lambda[2].

updateInput(int level) → None[source]

update input

Parameters:level – of lambda used to compute input
updateOutput(int level) → None[source]

update output and indexSets.

Parameters:level – of lambda used to compute input
updateSmoothState() → None[source]

update state for smooth dynamic case (i.e.

compute p[2] and update acceleration)

updateState(int level) → None[source]

update state.

Parameters:level – of lambda used to compute input