File kernel/src/simulationTools/OSNSMultipleImpact.hpp

Go to the source code of this file

Linear Complementarity Problem formulation and solving.

class OSNSMultipleImpact : public LinearOSNS
#include <OSNSMultipleImpact.hpp>

Formalization and Resolution of a Multiple Impact Non-Smooth problem.

Public Functions

OSNSMultipleImpact()

default constructor

OSNSMultipleImpact(std::string type, double step = 1.0e-5)

Constructor from data (step size is required here)

Parameters
  • type: the type of the compliance law

  • step: step size estimated

~OSNSMultipleImpact()

Destructor.

ACCEPT_STD_VISITORS()
void AllocateMemory()

To allocate the memory.

void BuildParaContact()

To build the vector of stiffnesses and restitution coefficient at contacts.

void Check_stateContact()

To check the state of contacts during impact.

int compute(double time)

compute the unknown post-impact relative velocity and post-impact impulse

Return

int

Parameters
  • time:

void Compute_distributionVector()

Calculate the vector of distributing rule.

void Compute_energyContact()

Compute the potential energy at contacts during each computation step.

void Compute_velocityContact()

Compute the relative velocity at contacts.

void ComputeImpact()

Run the iterative procedure to solve the multiple impact problem.

void ComputeImpulseContact()

Compute the normal imulse at contacts.

void display() const

print the data to the screen

double DurationImpact()
unsigned int EstimateNdataCols()

Estimate size of data matrix.

Return

unsigned int

std::string get_typeCompLaw() const
double GetStepSize()

To get step size.

Return

double

double getTolImpact()

To get the tolerance to define zero.

Return

double

void initialize(SP::Simulation sim)

initialize

Parameters
  • sim:

void InitializeInput()

To get the velocity of bodies, relative velocity and potential energy at the beginning of impact.

bool IsEnermaxZero()

To decide if the primary contact is selected according to the relative velocity or to the potential energy.

The first case happens when there is no potential energy at any contact

Return

bool

bool isEnerZero(double var)

To compare an energy value with zero.

Return

bool

Parameters
  • var:

bool IsMulImpactTerminate()

Check if the multiple impacts process is terminated or not.

Return

bool

bool IsVcminNegative()

Verify if the minimum relative velocity at contacts is negative or not.

Return

bool

bool isVelNegative(double var)

To compare a velocity value with zero.

Return

bool

Parameters
  • var:

bool isZero(double var)

To compare a double number with zero.

Return

bool

Parameters
  • var:

void PostComputeImpact()

Post-compute for multiple impacts.

void PreComputeImpact()

Pre-compute for multiple impacs.

void PrimConEnergy()

To get the primary contact according to the potential energy.

In this case, the primary contact corresponds to the one at which the potential energy is maximum

void PrimConVelocity()

To get the primary contact according to the relative velocity In this case, the primary contact correspond to the contact at which the relative velocity is minimum (the relative velocity for two approching bodies is negative so the magnitude of the relative velocity at the primary contact is maximum)

void SaveDataOneStep(unsigned int i)

Save data for each step.

Parameters
  • i: pointer to be save

void SelectPrimaContact()

To select the pramary contact.

void set_typeCompLaw(std::string newTypeLaw)

To set the type of the compliance law.

Parameters
  • newTypeLaw:

void SetNameOutput(std::string file_name)

To set the name for the output file.

Parameters
  • file_name:

void SetNstepMax(unsigned int var)

To set the maximal number of steps allowed for each computation.

Parameters
  • var:

void SetNstepSave(unsigned int var)

To set the variable _nStepSave.

Parameters
  • var:

void SetSaveData(bool var)

To set the flag to save the data during impact or not.

Parameters
  • var:

void SetSizeDataSave(unsigned int var)

Set number of points to be saved during impact.

Parameters
  • var:

void SetStepMinMaxSave(unsigned int min, unsigned int max)

Set the step number to start the data save and step number to stop save.

Parameters
  • min:

  • max:

void SetTolEner(double var)

Set tolerence to define whether or not a potential energy is zero.

Parameters
  • var:

void setTolImpact(double newTolZero)

To set the tolerance to define zero.

Parameters
  • newTolZero:

void SetTolVel(double var)

Set tolerence to define whether or not a velocity is zero.

Parameters
  • var:

void SetZeroEnerEndImp(double var)

Set epsilon _ZeroEner_EndIm.

Parameters
  • var:

void SetZeroVelEndImp(double var)

Set epsilon _ZeroVel_EndIm.

Parameters
  • var:

void UpdateDuringImpact()

Compute the velocity of the bodies during impact.

void WriteVectorIntoMatrix(const SiconosVector &v, const unsigned int row, const unsigned int col)

To write a SiconosVector into a matrix.

Parameters
  • v:

  • row: position starting to write

  • col: position starting to write

Private Functions

ACCEPT_SERIALIZATION(OSNSMultipleImpact)

serialization hooks

Private Members

SP::SiconosMatrix _DataMatrix

If IsNumberOfStepsEst = false ==> user choose the step size.

Matrix on which the data during impact is saved

SP::SiconosVector _deltaImpulseContact

Incremental impulse at contacts.

double _deltaP = 0.

Step size for the iterative calculation.

SP::SiconosVector _distributionVector

Distribution vector to distribute the incremental impulse at contact.

SP::SiconosVector _elasticyCoefficientcontact

Elasticity coefficient of contacts.

SP::SiconosVector _energyContact

Potential energy during impact (at the end of each calculation step)

double _energyPrimaryContact = 0.

Potential energy at primary contact.

SP::SiconosVector _forceContact

Force at contacts.

SP::SiconosVector _impulseContactUpdate

Impulse at contacts for each update time.

double _impulseVariable = 0.

Time-like variable (Impulse)

bool _IsImpactEnd = true

indicator on the termination of the multiple impact process _IsImpactEnd = true: impact is terminated _IsImpactEnd = false: otherwise

bool _isPrimaryContactEnergy = false

Indicator about the selection of the primary contact true if primary contact is selected according to the potential energy false if primary contact is selected according to the relative velocity.

SP::SiconosVector _Kcontact

Stiffness at contacts.

std::string _namefile = "DataMultipleImpact.dat"

Name of file into which the datat is writen.

unsigned int _nContact = 0

Number of contacts (only the active contacts)

unsigned int _nStepMax = 100000

Maximal number of steps for each computation.

unsigned int _nStepSave = 100

bool variable to set the step size for multiple impact computation If IsNumberOfStepsEst = true ==> estimate the step size from the state of the dynamic system before impact and the number of step needed Number of steps after which the data is saved

SP::SiconosVector _oldVelocityContact

Relative velocity during impact (at the beginning of each calculation step)

unsigned int _primaryContactId = 0

ID of the primary contact.

double _relativeVelocityPrimaryContact = 0.

Relative velocity at primary contact.

SP::SiconosVector _restitutionContact

Restitution coefficient of contacts.

bool _saveData = false

YesWriteData = true ==>save the data during impact YesWriteData = false ==> not save the data during impact.

unsigned int _sizeDataSave = 1000

Number of points to be save during impacts.

SP::IndexInt _stateContact

State of contacts at the beginning of impact if *_stateContact[i] = 0 => no impact at this contact (at contact with positive relative velocity and no potential energy, may be the impact has been terminated at this contact) if *_stateContact[i] = 1 => impact takes place at this contact without potential energy (beginning of impact or repeating impact) if *_stateContact[i] = 2 => impact takes place with not-zero potential energy.

unsigned int _stepMaxSave = _nStepMax
unsigned int _stepMinSave = 1

we start to save data from _stepMinSave to _stepMaxSave

double _timeVariable = 0.

Time variable.

double _Tol_Ener = DEFAULT_TOL_ENER

Tolerance to define a negligeable value for a potential energy grandeur.

double _Tol_Vel = DEFAULT_TOL_VEL

Tolerance to define a negligeble value for a velocity grandeur.

double _tolImpact = DEFAULT__tolImpact

Tolerance to define zero.

SP::SiconosVector _tolImpulseContact

Total impulse at contacts.

std::string _typeCompLaw = "BiStiffness"

Type of the compliance model.

SP::SiconosVector _velocityContact

Relative velocity during impact (at the end of each calculation step)

SP::SiconosVector _WorkcContact

Work done during the last compression phase at contact.

double _ZeroEner_EndIm = DEFAULT_TOL_ENER

Epsilon to define a zero value for potential energy in termination condition.

double _ZeroVel_EndIm = DEFAULT_TOL_VEL

Epsilon to define a zero value for relative velocity in termination condition.