These coefficients are instrisic to the type contact you are trying to model. Very often these parameters are derived from testing or adjusted for simulation only. However, here are a couple of guidelines that will help you come up with a good initial guess depending on the mass of the object involved and the intended outcome.
Some things to note first:
- When it comes to stiffness and damping, more is not always better. Setting more than the necessary values for these parameters can heavily affect the speed of your simulations.
- If objects are visually going through each other, then the stiffness set is likely not enough.
- The following suggestions are for a single point of contact, but you can scale the coefficients and distribute necessary contact forces depending on how many points of contact are active on a rigid body.
So how do I find out values that work well?
- Simplify your application to a spring-mass-damper system in order to calculate the necessary stiffness to prevent objects from penetrating each other.
Stiffness - The Static Hold
- The definition of stiffness is k=F/d where d is the displacement. In this case d is our desired maximum penetration distance between two bodies. If we try to calculate the necessary contact stiffness to hold up an object affected by gravity then k=m*g/d (k=m*a/d where the only source acceleration is gravity).
- Example: We have an object with a mass of 2kg under gravity, resting on a stationary floor. We don't want the bodies to have a penetration of more than 0.01m. k = 2*9.81/0.01 = 1962 N/m That should hold the object without falling through given the force of gravity.
- Impact on Simulation Speed: If simulation speed is a priority, consider relaxing your requirement for penetration distance. This will likely help your simulations run considerably faster.
Stiffness - The Dynamic Collision
- If you expect your object to come into collision multiple times or bounce, then you should consider evaluating the natural oscillation frequency of the impact. Wn=sqrt(k/m)
- From the natural frequency you can derive the period at which your object will bounce.
- Simulation Fidelity: If your oscillation period is very small, you should make sure to use appropriate solver settings. If you are using a fixed-step solver, make sure your step size is smaller than the period of oscillation of the collision. Going by a Nyquist frequency might be a good start to capture essential dynamics.
Damping:
- Damping is the energy dissipation and is dependent on the velocity of an object.
- Note that since energy dissipation is based on velocity, the effects of damping are coupled to the stiffness of the contact.
- Damping effects to the object dynamics are tied to parameters tracked over time, like oscillations and settling times to the desired penetration.
- If two objects are meant to come in contact and settle, but are instead bouncing. The collision is underdamped. This means the damping coefficient between them is too low and if the damping coefficient is too high this means there will be no compliance, or the system is overdamped and the first time they collide the energy required to contained the impact is very high.
- Practical Approach: A good recommendation is to start with damping value one or two orders of magnitude smaller than the set stiffness (10x to 100x smaller) and adjust by sensing the separation distance using the additional output from the Spatial Contact force block.
- Critical Damping: For a more deterministic approach, try setting your collision to be critically damped to get the fastest settling time. You can use the damping ratio equation c/m = 2*zeta*Wn, where c is the damping coefficient, m is mass, Wn is the natural frequency defined above, and zeta is the damping ratio. For critical damping, zeta = 1, yielding c = 2*m*sqrt(k/m) = 2*sqrt(k*m).
- Impact on Simulation Speed: Capturing the dynamics of a high impact overdamped collision can require small solver steps and can severly affect your simulation speed. If simulation speed is a priority, consider further adjusting the damping coefficient.
Finally, unless you have collision dynamics you want to replicate, you could separately explore initial parameters estimates based on a spring-mass-damper system approximation using the model attached.