hermite_grx's People
hermite_grx's Issues
Collision handling sometimes fails
For simulations where the internal time-step is too large, the colliding particles will (at rare times) not flag the AMUSE collision stopping condition causing the integrator to break.
Small code to reproduce issue below:
from amuse.lab import *
from amuse.community.hermite.interface import Hermite
from amuse.community.Hermite_GRX.interface import HermiteGRX
converter = nbody_system.nbody_to_si(100 | units.MSun, 1 | units.pc)
bodies = new_plummer_model(3, convert_nbody=converter)
bodies.mass = 1 | units.MSun
bodies[0].mass *= 100
bodies.radius = 1 | units.RSun
converter = nbody_system.nbody_to_si(bodies.mass.sum(), 0.1|units.pc)
bodies.scale_to_standard(convert_nbody=converter)
bodies[-1].position = bodies[0].position + 0.1*bodies[-1].radius
tend = 1 | units.Myr
t = 0 | units.yr
gravity = Hermite(converter, number_of_workers=1)
gravity.particles.add_particles(bodies)
gravity = HermiteGRX(converter, number_of_workers = 1)
perturbations = ["1PN_Pairwise", "1PN_EIH", "2.5PN_EIH"]
gravity.parameters.perturbation = perturbations[0]
gravity.parameters.dt_param = 1e-1 #1e-4 detects, but not 1e-3
gravity.parameters.integrator = 'RegularizedHermite'
gravity.small_particles.add_particles(bodies[bodies.mass<bodies.mass.max()])
gravity.large_particles.add_particles(bodies[bodies.mass==bodies.mass.max()])
stopping_condition = gravity.stopping_conditions.collision_detection
stopping_condition.enable()
gravity.evolve_model(tend)
if stopping_condition.is_set():
print("...Collision
print(gravity.
STOP
gravity.stop()
Depending on the internal timestep, "...Collision Detected..." is outputted. This isn't replicated with Hermite who detects the collision no matter the internal timestep.
My current fix is not too elegant, and is the following:
line 5 of Pairwise1PNPerturbation.h: I've added #include "StoppingConditions.h";
line 14 of Pairwise1PNPerturbation.h: I've added StoppingConditions m_StoppingCond;
line 14 of Pairwise1PNPerturbation.h: I've added bool m_ConditionsSet;
line 45 of Pairwise1PNPerturbation::Pairwise1PNPerturbation.cpp in the Pairwise1PNPerturbation::CalculateAccelerations functions: I've added m_ConditionsSet = m_StoppingCond.Check(model);
line 166 of EIHPerturbation.cpp in the EIH2dot5PNPerturbation::CalculateAccelerations functions: I've added m_ConditionsSet = m_StoppingCond.Check(model);
line 373 of EIHPerturbation.cpp in the EIH1PNPerturbation::CalculateAccelerations functions: I've added m_ConditionsSet = m_StoppingCond.Check(model);
I haven't tested the change in performance nor if it affects any of the physics (this I doubt. MY current changes results in amuse.support.exceptions.AmuseException: Unable to add a particle, because it was already part of this set
.
Other solution is simply changing the collision radius.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.