Particular implementation of the collision resolution for the hard contacts.
The following code example illustrates the setup of the solver:
#include <HCSITS.h>
Classes | |
struct | BodyCache |
struct | ContactCache |
Public Member Functions | |
Constructor | |
HardContactSemiImplicitTimesteppingSolvers (const shared_ptr< BodyStorage > &globalBodyStorage, const shared_ptr< BlockStorage > &blockStorage, domain_decomposition::BlockDataID storageID, domain_decomposition::BlockDataID ccdID, domain_decomposition::BlockDataID fcdID, WcTimingTree *tt=nullptr) | |
Constructor of the CollisionSystem class. More... | |
Destructor | |
~HardContactSemiImplicitTimesteppingSolvers () override | |
Destructor of the CollisionSystem class. More... | |
Get functions | |
real_t | getMaximumPenetration () const override |
Returns the maximum penetration depth found in the last collision detection. More... | |
size_t | getNumberOfContacts () const override |
Returns the number of contacts found by the last collision detection. More... | |
size_t | getNumberOfContactsTreated () const override |
const std::map< IBlockID::IDType, ContactCache > | getContactCache () const |
real_t | getSpeedLimitFactor () const |
size_t | getMaxIterations () const |
real_t | getOverRelaxationParameter () const |
real_t | getRelaxationParameter () const |
real_t | getErrorReductionParameter () const |
RelaxationModel | getRelaxationModel () const |
Set functions | |
void | setOverRelaxationParameter (real_t omega) |
Sets the relaxation parameter for boundary bodies. More... | |
void | setRelaxationParameter (real_t f) |
Sets the relaxation parameter for boundary bodies. More... | |
void | setMaxIterations (size_t n) |
Sets the maximum number of iterations performed by the iterative solver. More... | |
void | setRelaxationModel (RelaxationModel relaxationModel) |
Sets the relaxation model used by the iterative solver. More... | |
void | setErrorReductionParameter (real_t erp) |
Sets the error reduction parameter. More... | |
void | setAbortThreshold (real_t threshold) |
Sets the threshold of movement of a particle during collision resolution. More... | |
void | setSpeedLimiter (bool active, const real_t speedLimitFactor=real_t(0.0)) |
Activates/Deactivates the speed limiter and sets the limit. More... | |
Query functions | |
bool | isSyncRequired () const |
Returns if a synchronization is required before the next time step. More... | |
bool | isSyncRequiredLocally () const |
Returns if a synchronization is required by the local process before the next time step. More... | |
bool | isSpeedLimiterActive () const |
Returns if speed limiter is currently active and working. More... | |
void | operator() (const real_t dt) |
forwards to timestep Convenience operator to make class a functor. More... | |
void | timestep (const real_t dt) override |
Advances the simulation dt seconds. More... | |
Public Member Functions inherited from walberla::pe::cr::ICR | |
ICR () | |
virtual | ~ICR ()=default |
void | setGlobalLinearAcceleration (const Vec3 &acc) |
Sets the global linear acceleration. More... | |
const Vec3 & | getGlobalLinearAcceleration () const |
Private Attributes | |
std::map< IBlockID::IDType, BodyCache > | blockToBodyCache_ |
std::map< IBlockID::IDType, ContactCache > | blockToContactCache_ |
Member variables | |
shared_ptr< BodyStorage > | globalBodyStorage_ |
shared_ptr< BlockStorage > | blockStorage_ |
domain_decomposition::BlockDataID | storageID_ |
domain_decomposition::BlockDataID | ccdID_ |
domain_decomposition::BlockDataID | fcdID_ |
WcTimingTree * | tt_ |
real_t | erp_ |
The error reduction parameter (0 <= erp_ <= 1). More... | |
size_t | maxIterations_ |
Maximum number of iterations. More... | |
size_t | iteration_ |
size_t | maxSubIterations_ |
Maximum number of iterations of iterative solvers in the one-contact problem. More... | |
real_t | abortThreshold_ |
If L-infinity iterate difference drops below this threshold the iteration is aborted. More... | |
RelaxationModel | relaxationModel_ |
The method used to relax unilateral contacts. More... | |
real_t | overRelaxationParam_ |
Parameter specifying the convergence speed for orthogonal projection models. More... | |
real_t | relaxationParam_ |
Parameter specifying underrelaxation of velocity corrections for boundary bodies. More... | |
real_t | maximumPenetration_ |
size_t | numContacts_ |
size_t | numContactsTreated_ |
bool | speedLimiterActive_ |
is the speed limiter active? More... | |
real_t | speedLimitFactor_ |
what multiple of boundingbox edge length is the body allowed to travel in one timestep More... | |
bool | requireSync_ |
Flag indicating whether this process requires a synchronization prior to the next time step. More... | |
|
inlineexplicit |
Constructor of the CollisionSystem class.
|
inlineoverride |
Destructor of the CollisionSystem class.
|
private |
|
inline |
|
inline |
|
inlineoverridevirtual |
Returns the maximum penetration depth found in the last collision detection.
Only contacts treated on the local process are considered.
Reimplemented from walberla::pe::cr::ICR.
|
inline |
|
inlineoverridevirtual |
Returns the number of contacts found by the last collision detection.
Only contacts treated on the local process are counted.
Reimplemented from walberla::pe::cr::ICR.
|
inlineoverridevirtual |
Reimplemented from walberla::pe::cr::ICR.
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
Calculates the initial velocity corrections of a given body.
body | The body whose velocities to time integrate |
dv | On return the initial linear velocity correction. |
dw | On return the initial angular velocity correction. |
dt | The time step size. |
Calculates the velocity corrections effected by external forces and torques in an explicit Euler time integration of the velocities of the given body. For fixed objects the velocity corrections are set to zero. External forces and torques are reset if indicated by the settings.
|
inlineprivate |
Time integration of the position and orientation of a given body.
body | The body whose position and orientation to time integrate |
v | The linear velocity to use for time integration of the position. |
w | The angular velocity to use for time integration of the orientation. |
dt | The time step size. |
Performs an Euler time integration of the positions of the given body. Velocities are damped if indicated by the settings and stored back in the body properties. The bounding box is recalculated and it is redetermined whether the body is awake or not. Also the data structure tracking the contacts attached to the body are cleared and
|
inline |
Returns if speed limiter is currently active and working.
|
inline |
Returns if a synchronization is required before the next time step.
Insertion or removal of bodies from the simulation can require a subsequent synchronization before performing the next time step. If e.g. no other process obtained a shadow copy of a body to be removed then a synchronization is not enforced. However, if a neighbor has a shadow copy a synchronization is required. Changing e.g. velocities or positions can lead to inconsistent descriptions of bodies across process boundaries but synchronization is not enforced. In this case it is the users obligation to synchronize whenever necessary.
WARNING: This query function uses an expensive allreduce MPI operation to determine the result!
|
inline |
Returns if a synchronization is required by the local process before the next time step.
Insertion or removal of bodies from the simulation can require a subsequent synchronization before performing the next time step. If e.g. no other process obtained a shadow copy of a body to be removed then a synchronization is not enforced. However, if a neighbor has a shadow copy a synchronization is required. Changing e.g. velocities or positions can lead to inconsistent descriptions of bodies across process boundaries but synchronization is not enforced. In this case it is the users obligation to synchronize whenever necessary.
|
inline |
forwards to timestep Convenience operator to make class a functor.
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
Relaxes all contacts once.
The contact model is for inelastic unilateral contacts with approximate Coulomb friction.
This function is to be called from resolveContacts(). Separating contacts are preferred over other solutions if valid. Static solutions are preferred over dynamic solutions. Dynamic solutions are computed by decoupling the normal from the frictional components. That is for a dynamic contact the normal component is relaxed first followed by the frictional components. The determination of the frictional components does not perform any subiterations and guarantees that the friction partially opposes slip.
|
inlineprivate |
Relaxes all contacts once.
The contact model is for inelastic unilateral contacts with Coulomb friction.
This function is to be called from resolveContacts(). Separating contacts are preferred over other solutions if valid. Static solutions are preferred over dynamic solutions. Dynamic solutions are computed by decoupling the normal from the frictional components. That is for a dynamic contact the normal component is relaxed first followed by the frictional components. How much the frictional components directly oppose slip as required by the Coulomb friction model depends on the number of subiterations performed. If no subiterations are performed the friction is guaranteed to be at least partially dissipative.
|
inlineprivate |
Relaxes all contacts once.
The contact model is for inelastic unilateral contacts with Coulomb friction.
dtinv | The inverse of the current time step. |
approximate | Use the approximate model showing bouncing. |
This function is to be called from resolveContacts(). The iterative method to solve the contact problem is e.g. described in the article "A matrix-free cone complementarity approach for solving large-scale, nonsmooth, rigid body dynamics" by A. Tasora and M. Anitescu in Computer Methods in Applied Mechanics and Engineering (Volume 200, Issues 5–8, 15 January 2011, Pages 439-453). The contact model is purely quadratic and convergence should be good but depends on a parameter. The one-contact problem has a unique solution. The frictional reactions for a dynamic contact converge to those that directly oppose slip. However, the contact is not perfectly inelastic for dynamic contacts but bounces. These vertical motions tend to go to zero for smaller time steps and can be interpreted as exaggerated vertical motions coming from micro asperities (see "Optimization-based simulation of nonsmooth rigid multibody dynamics" by M. Anitescu in Mathematical Programming (Volume 105, Issue 1, January 2006, Pages 113-143). These motions can be prevented by a small change in the iteration proposed in "The bipotential method: a constructive approach to design the complete contact law with friction and improved numerical algorithms" by G. De Saxce and Z-Q. Feng in Mathematical and Computer Modelling (Volume 28, Issue 4, 1998, Pages 225-245). Which iteration is used is controlled with the approximate parameter.
|
inlineprivate |
Relaxes all contacts once.
The contact model is for inelastic unilateral contacts without friction.
This function is to be called from resolveContacts(). Separating contacts are preferred over persisting solutions if valid.
|
inlineprivate |
Relaxes all contacts once.
The contact model is for inelastic unilateral contacts with the generalized maximum dissipation principle for friction.
This function is to be called from resolveContacts(). Dynamic solutions are computed by minimizing the kinetic energy along the intersection of the plane of maximum compression and the friction cone.
|
private |
|
inline |
Sets the threshold of movement of a particle during collision resolution.
threshold | If movement is smaller than threshold, col. resolution is stopped. |
|
inline |
Sets the error reduction parameter.
erp | The error reduction parameter. |
If body shapes overlap by x at a contact then the contact resolution aims to remove erp*x of the overlap. Thus the error reduction parameter must be between 0 and 1. 0 corresponds to no error reduction and is the default. 1 corresponds to full error reduction. Note that error reduction (constraint stabilization) introduces additional energy to the system.
|
inline |
Sets the maximum number of iterations performed by the iterative solver.
n | The maximum number of iterations. |
|
inline |
Sets the relaxation parameter for boundary bodies.
omega | The overrelaxation parameter. |
The overrelaxation parameter omega is only used when the relaxation model is one of
It is used to control the convergence of the model. Large values show faster convergence, but they can also lead to divergence ("exploding" particles). The default value is 1.0.
|
inline |
Sets the relaxation model used by the iterative solver.
relaxationModel | The relaxation model to be used by the iterative solver. |
|
inline |
Sets the relaxation parameter for boundary bodies.
f | The relaxation parameter. |
The iterative solvers are a mixture of non-linear Gauss-Seidel and Jacobi solvers. This might require underrelaxation. The parameter must be positive. Note that for dilute systems the solver might need stronger underrelaxation (smaller f) than for dense systems.
|
inline |
Activates/Deactivates the speed limiter and sets the limit.
active | activate/deactivate speed limiter |
speedLimitFactor | size of bounding box will be multiplied by this factor to get the maximal distance a body is allowed to travel within one timestep |
|
inlineprivate |
TODO.
|
inlineoverridevirtual |
Advances the simulation dt seconds.
Runs the simulation for one timestep.
dt | Size of the time step. |
Implements walberla::pe::cr::ICR.
|
private |
If L-infinity iterate difference drops below this threshold the iteration is aborted.
|
private |
|
private |
|
private |
|
private |
|
private |
The error reduction parameter (0 <= erp_ <= 1).
|
private |
|
private |
|
private |
|
private |
|
private |
Maximum number of iterations.
|
private |
Maximum number of iterations of iterative solvers in the one-contact problem.
|
private |
|
private |
|
private |
Parameter specifying the convergence speed for orthogonal projection models.
|
private |
The method used to relax unilateral contacts.
|
private |
Parameter specifying underrelaxation of velocity corrections for boundary bodies.
|
private |
Flag indicating whether this process requires a synchronization prior to the next time step.
|
private |
is the speed limiter active?
|
private |
what multiple of boundingbox edge length is the body allowed to travel in one timestep
|
private |
|
private |