# File kernel/src/simulationTools/D1MinusLinearOSI.hpp¶

Go to the source code of this file

D1MinusLinearOSI Time-Integrator for Dynamical Systems T. Schindler, V. Acary

Variables

const double DEFAULT_TOL_D1MINUS = 1e-8

Time-Integrator for Dynamical Systems.

Reference:

Timestepping schemes for nonsmooth dynamics based on discontinuous Galerkin methods: Definition and outlook Thorsten Schindler; Vincent Acary Mathematics and Computers in Simulation, Elsevier, 2014, 95, pp. 180-199

A D1MinusLinearOSI instance is defined by the list of concerned dynamical systems.

Main functions:

• computeFreeState(): computes xfree (or vfree), dynamical systems state without taking non-smooth part into account

• updateState(): computes x(q,v), the complete dynamical systems states.

## Some details on the implementation¶

### Various implementations¶

at various levels.

To be completed

The (lower-case) lambda vector that corresponds to the (non-impulsive) contact forces are computed for the closed contact with vanishing relative velocity (the number of the index set depends on the type of D1minulinear) The result, stored in lambda(2) and p(2) is computed by solving (*allOSNS)[SICONOS_OSNSP_TS_VELOCITY + 1] at different specific time

The impact equation are solved at the velocity level as in MoreauJeanOSI using lambda(1) and p(1). The number of the index set depends on the type of D1minulinear

### sec_D1MinusLinear_implementation_halfAcc¶

HalfExplicitAccelerationLevel

The (lower-case) lambda $$\lambda$$ that corresponds to the (non-impulsive) contact forces are computed at the acceleration level for the closed contact with vanishing relative velocity (indexSet2)

The problem, solved for lambda(2) and p(2) (*allOSNS)[SICONOS_OSNSP_TS_VELOCITY + 1] is solved at time told for $$\lambda^+_{k}$$ and time t for $$\lambda^-_{k+1}$$

The problem, solved for lambda(1) and p(1) (*allOSNS)[SICONOS_OSNSP_TS_VELOCITY + 1] is solved at time t for $$Lambda_{k+1}$$.

We use four index sets to compute the multipliers:

• indexSet0 is the set of all constraints

• indexSet1 is the set of closed constraints (computed with $$q_{k,1}$$)

• indexSet2 is the set of closed constraints and vanishing velocities (computed with $$q_{k,1}$$ and $$v_{k,1}$$ )

• indexSet3 is the set of the constraints that have been closed within the time&#8212;step (computed with $$q_{k,0}$$ and $$q_{k,1}$$ )

$\begin{split} \begin{cases} v_{k,0} = \mbox{vold} \\ q_{k,0} = \mbox{qold} \\ F^+_{k} = \mbox{F(told,qold,vold)} \\ v_{k,1} = v_{k,0} + h M^{-1}_k (P^+_{2,k}+F^+_{k}) \\[2mm] q_{k,1} = q_{k,0} + \frac{h}{2} (v_{k,0} + v_{k,1}) \\[2mm] F^-_{k+1} = F(t^{-}_{k+1},q_{k,1},v_{k,1}) \\[2mm] R_{free} = - \frac{h}{2} M^{-1}_k (P^+_{2,k}+F^+_{k}) - \frac{h}{2} M^{-1}_{k+1} (P^-_{2,k+1}+F^-_{k+1}) \\[2mm] \end{cases} \end{split}$

### sec_D1MinusLinear_implementation_halfVel¶

HalfExplicitVelocityLevel

class D1MinusLinearOSI : public OneStepIntegrator

Public Types

enum ListOfTypeOfD1MinusLinearOSI

Switching variable for various versions of D1MinusLinear.

Values:

enumerator halfexplicit_acceleration_level
enumerator halfexplicit_acceleration_level_full
enumerator explicit_velocity_level
enumerator halfexplicit_velocity_level
enumerator numberOfTypeOfD1MinusLinearOSI
enum D1MinusLinearOSI_ds_workVector_id

Values:

enumerator RESIDU_FREE
enumerator FREE
enumerator FREE_TDG
enumerator WORK_LENGTH
enum D1MinusLinearOSI_interaction_workVector_id

Values:

enumerator OSNSP_RHS
enumerator WORK_INTERACTION_LENGTH
enum D1MinusLinearOSI_workBlockVector_id

Values:

enumerator xfree
enumerator BLOCK_WORK_LENGTH

Public Functions

D1MinusLinearOSI()

basic constructor

D1MinusLinearOSI(unsigned int type)

Constructor with type of D1MinusLinear.

Parameters

type – unsigned int that specifies the type of D1MinusLinear D1MinusLinearOSI::halfexplicit_acceleration_level, D1MinusLinearOSI::halfexplicit_acceleration_level_full, D1MinusLinearOSI::explicit_velocity_level, D1MinusLinearOSI::halfexplicit_velocity_level, D1MinusLinearOSI::numberOfTypeOfD1MinusLinearOSI

inline virtual ~D1MinusLinearOSI()

destructor

void setTypeOfD1MinusLinearOSI(unsigned int type)

Set the type of the D1MinusLinear.

Parameters

type – the type to set D1MinusLinearOSI::halfexplicit_acceleration_level, D1MinusLinearOSI::halfexplicit_acceleration_level_full, D1MinusLinearOSI::explicit_velocity_level, D1MinusLinearOSI::halfexplicit_velocity_level, D1MinusLinearOSI::numberOfTypeOfD1MinusLinearOSI

inline unsigned int typeOfD1MinusLinearOSI()

get the type of the D1MinusLinear

Returns

unsigned int type the type to set D1MinusLinearOSI::halfexplicit_acceleration_level, D1MinusLinearOSI::halfexplicit_acceleration_level_full, D1MinusLinearOSI::explicit_velocity_level, D1MinusLinearOSI::halfexplicit_velocity_level, D1MinusLinearOSI::numberOfTypeOfD1MinusLinearOSI

virtual unsigned int numberOfIndexSets() const override

get the number of index sets required for the simulation

Returns

unsigned int

virtual void initialize_nonsmooth_problems() override

initialization of the D1MinusLinearOSI integrator; for linear time invariant systems, we compute time invariant operator

virtual void initializeWorkVectorsForDS(double t, SP::DynamicalSystem ds) override

initialization of the work vectors and matrices (properties) related to one dynamical system on the graph and needed by the osi

Parameters
• t – time of initialization

• ds – the dynamical system

virtual void initializeWorkVectorsForInteraction(Interaction &inter, InteractionProperties &interProp, DynamicalSystemsGraph &DSG) override

initialization of the work vectors and matrices (properties) related to one interaction on the graph and needed by the osi

Parameters
• inter – the interaction

• interProp – the properties on the graph

• DSG – the dynamical systems graph

virtual double computeResidu() override

return the maximum of all norms for the residus of DS

Post

{ds->residuFree will be calculated, ds->q() contains new position, ds->velocity contains predicted velocity}

Returns

double

virtual double computeResiduHalfExplicitAccelerationLevel()

return the maximum of all norms for the residus of DS for the type explicit_acceleration_level

Post

{ds->residuFree will be calculated, ds->q() contains new position, ds->velocity contains predicted velocity}

Returns

double

virtual double computeResiduHalfExplicitAccelerationLevelFull()

return the maximum of all norms for the residus of DS for the type explicit_acceleration_level_full

Post

{ds->residuFree will be calculated, ds->q() contains new position, ds->velocity contains predicted velocity}

Returns

double

virtual double computeResiduHalfExplicitVelocityLevel()

return the maximum of all norms for the residus of DS for the type explicit_acceleration_level_full

Post

{ds->residuFree will be calculated, ds->q() contains new position, ds->velocity contains predicted velocity}

Returns

double

virtual void computeFreeState() override

integrates the Dynamical System linked to this integrator without taking non-smooth effects into account

Post

{ds->velocity contains predicted velocity}

virtual void computeFreeOutput(InteractionsGraph::VDescriptor &vertex_inter, OneStepNSProblem *osnsp) override

integrates the Interaction linked to this integrator, without taking non-smooth effects into account

Parameters
• vertex_inter – of the interaction graph

• osnsp – pointer to OneStepNSProblem

virtual void computeFreeOutputHalfExplicitAccelerationLevel(InteractionsGraph::VDescriptor &vertex_inter, OneStepNSProblem *osnsp)

integrates the Interaction linked to this integrator, without taking non-smooth effects into account

Parameters
• vertex_inter – of the interaction graph

• osnsp – pointer to OneStepNSProblem

virtual void computeFreeOutputHalfExplicitVelocityLevel(InteractionsGraph::VDescriptor &vertex_inter, OneStepNSProblem *osnsp)

integrates the Interaction linked to this integrator, without taking non-smooth effects into account

Parameters
• vertex_inter – of the interaction graph

• osnsp – pointer to OneStepNSProblem

inline virtual void integrate(double &ti, double &tf, double &t, int &flag) override

integrate the system, between tinit and tend (->iout=true), with possible stop at tout (->iout=false)

Parameters
virtual void updateState(const unsigned int level) override

updates the state of the Dynamical Systems

Parameters

level – level of interest for the dynamics: not used at the time

Post

{ds->velocity contains new velocity}

virtual bool addInteractionInIndexSet(SP::Interaction inter, unsigned int i) override

Apply the rule to one Interaction to known if is it should be included in the IndexSet of level i.

Parameters
• inter – the involved interaction

• i – the index set level

Returns

a boolean if it needs to be added or not

virtual bool removeInteractionFromIndexSet(SP::Interaction inter, unsigned int i) override

Apply the rule to one Interaction to known if is it should be removed in the IndexSet of level i.

Parameters
• inter – the involved interaction

• i – the index set level

Returns

a boolean if it needs to be removed or not

virtual bool addInteractionInIndexSetHalfExplicitAccelerationLevel(SP::Interaction inter, unsigned int i)

Apply the rule to one Interaction to known if is it should be included in the IndexSet of level i.

Parameters
• inter – the involved interaction

• i – the index set level

Returns

a boolean if it needs to be added or not

virtual bool removeInteractionFromIndexSetHalfExplicitAccelerationLevel(SP::Interaction inter, unsigned int i)

Apply the rule to one Interaction to known if is it should be removed in the IndexSet of level i.

Parameters
• inter – the involved interaction

• i – the index set level

Returns

a boolean if it needs to be removed or not

virtual bool addInteractionInIndexSetHalfExplicitVelocityLevel(SP::Interaction inter, unsigned int i)

Apply the rule to one Interaction to known if is it should be included in the IndexSet of level i.

Parameters
• inter – the involved interaction

• i – the index set level

Returns

a boolean if it needs to be added or not

virtual bool removeInteractionFromIndexSetHalfExplicitVelocityLevel(SP::Interaction inter, unsigned int i)

Apply the rule to one Interaction to known if is it should be removed in the IndexSet of level i.

Parameters
• inter – the involved interaction

• i – the index set level

Returns

a boolean if it needs to be removed or not

inline virtual void display() override

displays the data of the D1MinusLinearOSI’s integrator

inline virtual void prepareNewtonIteration(double time) override

preparations for Newton iteration

Parameters

time – time

ACCEPT_STD_VISITORS()

Protected Attributes

bool _isThereImpactInTheTimeStep
unsigned int _typeOfD1MinusLinearOSI
struct _NSLEffectOnFreeOutput : public SiconosVisitor
#include <>

nslaw effects

Public Functions

inline _NSLEffectOnFreeOutput(OneStepNSProblem *p, SP::Interaction inter, InteractionProperties &interProp)
void visit(const NewtonImpactNSL &nslaw)
inline void visit(const EqualityConditionNSL &nslaw)

Public Members

OneStepNSProblem *_osnsp
SP::Interaction _inter
InteractionProperties &_interProp