File kernel/src/simulationTools/MultipleImpact.hpp#
Go to the source code of this file
Linear Complementarity Problem formulation and solving.
-
class MultipleImpact : public LinearOSNS
- #include <MultipleImpact.hpp>
Formalization and Resolution of a Multiple Impact Non-Smooth problem.
- Todo:
write a short introduction about MultipleImpact …
Public Functions
-
inline MultipleImpact()
default constructor
-
MultipleImpact(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
-
inline ~MultipleImpact()
Destructor.
-
inline std::string get_typeCompLaw() const#
-
void set_typeCompLaw(std::string newTypeLaw)
To set the type of the compliance law.
- Parameters:
newTypeLaw –
-
void setTolImpact(double newTolZero)
To set the tolerance to define zero.
- Parameters:
newTolZero –
-
inline double getTolImpact()
To get the tolerance to define zero.
- Returns:
double
-
void SetSaveData(bool var)
To set the flag to save the data during impact or not.
- Parameters:
var –
-
void SetNameOutput(std::string file_name)
To set the name for the output file.
- Parameters:
file_name –
-
inline double GetStepSize()
To get step size.
- Returns:
double
-
inline double DurationImpact()#
-
void SetNstepSave(unsigned int var)
To set the variable _nStepSave.
- Parameters:
var –
-
void SetNstepMax(unsigned int var)
To set the maximal number of steps allowed for each computation.
- Parameters:
var –
-
void SetSizeDataSave(unsigned int var)
Set number of points to be saved during impact.
- Parameters:
var –
-
void SetTolVel(double var)
Set tolerence to define whether or not a velocity is zero.
- Parameters:
var –
-
void SetTolEner(double var)
Set tolerence to define whether or not a potential energy is zero.
- Parameters:
var –
-
void SetZeroVelEndImp(double var)
Set epsilon _ZeroVel_EndIm.
- Parameters:
var –
-
void SetZeroEnerEndImp(double var)
Set epsilon _ZeroEner_EndIm.
- 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 –
-
bool isZero(double var)
To compare a double number with zero.
- Parameters:
var –
- Returns:
bool
-
bool isVelNegative(double var)
To compare a velocity value with zero.
- Parameters:
var –
- Returns:
bool
-
bool isEnerZero(double var)
To compare an energy value with zero.
- Parameters:
var –
- Returns:
bool
-
void SelectPrimaContact()
To select the pramary contact.
-
void Compute_distributionVector()
Calculate the vector of distributing rule.
-
void ComputeImpulseContact()
Compute the normal imulse at contacts.
-
void Compute_velocityContact()
Compute the relative velocity at contacts.
-
void Compute_energyContact()
Compute the potential energy at contacts during each computation step.
-
void UpdateDuringImpact()
Compute the velocity of the bodies during impact.
-
void ComputeImpact()
Run the iterative procedure to solve the multiple impact problem.
-
void PostComputeImpact()
Post-compute for multiple impacts.
-
bool IsMulImpactTerminate()
Check if the multiple impacts process is terminated or not.
- Returns:
bool
-
void AllocateMemory()
To allocate the memory.
-
void BuildParaContact()
To build the vector of stiffnesses and restitution coefficient at contacts.
-
void InitializeInput()
To get the velocity of bodies, relative velocity and potential energy at the beginning of impact.
-
void Check_stateContact()
To check the state of contacts during impact.
-
void PreComputeImpact()
Pre-compute for multiple impacs.
-
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 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
-
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
- Returns:
bool
-
bool IsVcminNegative()
Verify if the minimum relative velocity at contacts is negative or not.
- Returns:
bool
-
virtual int compute(double time) override
compute the unknown post-impact relative velocity and post-impact impulse
- Parameters:
time –
- Returns:
int
-
virtual void initialize(SP::Simulation sim) override
initialize
- Parameters:
sim –
-
virtual bool checkCompatibleNSLaw(NonSmoothLaw &nslaw) override#
-
virtual void display() const override
print the data to the screen
-
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
-
void SaveDataOneStep(unsigned int i)
Save data for each step.
- Parameters:
i – pointer to be save
-
unsigned int EstimateNdataCols()
Estimate size of data matrix.
- Returns:
unsigned int
-
ACCEPT_STD_VISITORS()#
Private Functions
-
ACCEPT_SERIALIZATION(MultipleImpact)#
Private Members
-
double _impulseVariable = 0.#
Time-like variable (Impulse)
-
double _timeVariable = 0.#
Time variable.
-
unsigned int _nContact = 0#
Number of contacts (only the active contacts)
-
unsigned int _nStepMax = 100000#
Maximal number of steps for each computation.
-
double _tolImpact = DEFAULT__tolImpact#
Tolerance to define zero.
-
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 _oldVelocityContact#
Relative velocity during impact (at the beginning of each calculation step)
-
SP::SiconosVector _energyContact#
Potential energy during impact (at the end of each calculation step)
-
SP::SiconosVector _distributionVector#
Distribution vector to distribute the incremental impulse at contact.
-
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 _primaryContactId = 0#
ID of the primary contact.
-
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.
-
double _relativeVelocityPrimaryContact = 0.#
Relative velocity at primary contact.
-
double _energyPrimaryContact = 0.#
Potential energy at primary contact.
-
double _deltaP = 0.#
Step size for the iterative calculation.
-
std::string _namefile = "DataMultipleImpact.dat"#
Name of file into which the datat is writen.
-
bool _saveData = false#
YesWriteData = true ==>save the data during impact YesWriteData = false ==> not save the data during impact.
-
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::SiconosMatrix _DataMatrix#
If IsNumberOfStepsEst = false ==> user choose the step size.
Matrix on which the data during impact is saved
-
unsigned int _sizeDataSave = 1000#
Number of points to be save during impacts.
-
bool _IsImpactEnd = true#
indicator on the termination of the multiple impact process _IsImpactEnd = true: impact is terminated _IsImpactEnd = false: otherwise
-
double _Tol_Vel = DEFAULT_TOL_VEL#
Tolerance to define a negligeble value for a velocity grandeur.
-
double _Tol_Ener = DEFAULT_TOL_ENER#
Tolerance to define a negligeable value for a potential energy grandeur.
-
double _ZeroVel_EndIm = DEFAULT_TOL_VEL#
Epsilon to define a zero value for relative velocity in termination condition.
-
double _ZeroEner_EndIm = DEFAULT_TOL_ENER#
Epsilon to define a zero value for potential energy in termination condition.
-
unsigned int _stepMinSave = 1#
we start to save data from _stepMinSave to _stepMaxSave