Damping#
(added in version 0.3.0)
Built in damper module implementations
Description#
Damping is used to numerically stabilize the simulations.
Available Damping
Base class for damping module implementations. |
|
Analytical linear damper class. |
|
Laplace Dissipation Filter class. |
Compatibility#
Damping/Numerical Dissipation |
Rod |
Rigid Body |
---|---|---|
AnalyticalLinearDamper |
✅ |
✅ |
LaplaceDissipationFilter |
✅ |
❌ |
Built-in Constraints#
- class elastica.dissipation.DamperBase(*args, **kwargs)[source]#
Bases:
ABC
Base class for damping module implementations.
Notes
All damper classes must inherit DamperBase class.
- Attributes:
system
SystemType (RodBase or RigidBodyBase)get system (rod or rigid body) reference
- property system#
get system (rod or rigid body) reference
- Returns:
- SystemType
- class elastica.dissipation.AnalyticalLinearDamper(damping_constant, time_step, **kwargs)[source]#
Analytical linear damper class. This class corresponds to the analytical version of a linear damper, and uses the following equations to damp translational and rotational velocities:
\[ \begin{align}\begin{aligned}\mathbf{v}^{n+1} = \mathbf{v}^n \exp \left( - \nu~dt \right)\\\pmb{\omega}^{n+1} = \pmb{\omega}^n \exp \left( - \frac{{\nu}~m~dt } { \mathbf{J}} \right)\end{aligned}\end{align} \]Notes
Since this class analytically treats the damping term, it is unconditionally stable from a timestep perspective, i.e. the presence of damping does not impose any additional restriction on the simulation timestep size. This implies that when using AnalyticalLinearDamper, one can set damping_constant as high as possible, without worrying about the simulation becoming unstable. This now leads to a streamlined procedure for tuning the damping_constant:
Set a high value for damping_constant to first acheive a stable simulation.
If you feel the simulation is overdamped, reduce damping_constant until you feel the simulation is underdamped, and expected dynamics are recovered.
Examples
How to set analytical linear damper for rod or rigid body:
>>> simulator.dampen(rod).using( ... AnalyticalLinearDamper, ... damping_constant=0.1, ... time_step = 1E-4, # Simulation time-step ... )
- Attributes:
- translational_damping_coefficient: numpy.ndarray
1D array containing data with ‘float’ type. Damping coefficient acting on translational velocity.
- rotational_damping_coefficientnumpy.ndarray
1D array containing data with ‘float’ type. Damping coefficient acting on rotational velocity.
- class elastica.dissipation.LaplaceDissipationFilter(filter_order, **kwargs)[source]#
Laplace Dissipation Filter class. This class corresponds qualitatively to a low-pass filter generated via the 1D Laplacian operator. It is applied to the translational and rotational velocities, where it filters out the high frequency (noise) modes, while having negligible effect on the low frequency smooth modes.
Notes
The extent of filtering can be controlled by the filter_order, which refers to the number of times the Laplacian operator is applied. Small integer values (1, 2, etc.) result in aggressive filtering, and can lead to the “physics” being filtered out. While high values (9, 10, etc.) imply minimal filtering, and thus negligible effect on the velocities. Values in the range of 3-7 are usually recommended.
For details regarding the numerics behind the filtering, refer to [1], [2].
[1]Jeanmart, H., & Winckelmans, G. (2007). Investigation of eddy-viscosity models modified using discrete filters: a simplified “regularized variational multiscale model” and an “enhanced field model”. Physics of fluids, 19(5), 055110.
[2]Lorieul, G. (2018). Development and validation of a 2D Vortex Particle-Mesh method for incompressible multiphase flows (Doctoral dissertation, Université Catholique de Louvain).
Examples
How to set Laplace dissipation filter for rod:
>>> simulator.dampen(rod).using( ... LaplaceDissipationFilter, ... filter_order=3, # order of the filter ... )
- Attributes:
- filter_orderint
Filter order, which corresponds to the number of times the Laplacian operator is applied. Increasing filter_order implies higher-order/weaker filtering.
- velocity_filter_term: numpy.ndarray
2D array containing data with ‘float’ type. Filter term that modifies rod translational velocity.
- omega_filter_term: numpy.ndarray
2D array containing data with ‘float’ type. Filter term that modifies rod rotational velocity.