Open BKaperick opened 5 years ago
Currently, we use a fixed time step dt. If - in between two states - a collision occurred, the step is reversed, and we advance at increment dt/2. This is repeated, incrementing at dt/2^k until no collisions exist above COLLISION_TOL or the modified time increment dt/2^k is below EPSILON. We only seem to be gaining energy when the second condition fails:
This makes perfect sense, as this is exactly the scenario in which the collision resolution "fails" and has to bail out for fear of instability with a small time step.
Interestingly, changing the EPSILON parameter results in only negligible improvement in the magnitude of energy error incurred.
With GRAVITY=[0, 100]
and input file simulations/BOX_1SQUARE.in
:
EPSILON |
Relative Energy Gain in Collision |
---|---|
1e-4 | 1.83360663% |
1e-8 | 1.82640794% |
1e-9 | 1.82640756% |
1e-10 | 1.82640751% |
Reducing time discretization can make this energy gain arbitrarily small, at the cost of more computational time.
Here the ELASTICITY parameter is set to 1, to indicate that collisions with walls are perfectly elastic. We appear to gain a small (relative to system) amount of total energy with each hit. This effect likely exists with other choices of ELASTICITY, but this should be the simplest case to analyze.