Repository navigation
Amuse Tsunami Interface - #1281
elkogerville wants to merge 138 commits into
Conversation
…m new_particle buffer into Tsunami, while taking into account previously commited particles
…f_the_particle exists inside Tsunami
… with GravitationalDynamicsInterface
… get_center_of_mass_velocity, get_total_radius, get_number_of_particles
…Nparts, and def get_time
…ecking input particle data shapes
There was a problem hiding this comment.
Is the hard-coded converter in line 30 normal?
There was a problem hiding this comment.
@ErwanH29
I had a hard time getting this to work self consistently but the idea is that the Tsunami converter is hardcoded to use 1 mass unit = 1 Msun and 1 position unit = 1 AU
Then on line 1608:
if convert_nbody is not None:
M_s = convert_nbody.to_si(1 | generic_unit_system.mass).value_in(u.MSun)
L_s = convert_nbody.to_si(1 | generic_unit_system.length).value_in(u.AU)
self.set_units(M_s, L_s)
What do you think of this setup? Maybe I am overcomplicating things
There was a problem hiding this comment.
Ah, I see. So the hard-code doesn't change anything?
I see now the line 1608. From my experience, if a code doesn't have convert_nbody defined it will throw an error. Maybe best to keep that?
There was a problem hiding this comment.
I tested this on a cluster, and it appears to work with the current version of AMUSE. I have two suggestions:
- Makefile, line 17: Could we move this dependency-installation step into
./setup. Trying to installTsunamiafter I had already done a.setup install allcaused Conda to reinstall several packages in its attempt resolve compatibility issues. But this can disrupt the existing environment, which is not ideal. Also, the explicit NumPy requirement may be redundant since it is already provided in the./setupstage. Maybe it's best to add theTsunami-required packages in the install stage? - Required
.tar.gzarchive: Could the AMUSE build check whether the tar file is present (and in the right location), and if not, throw an error early explaining the fix? I realise theREADME.mdmentions this but I am not sure everyone will necessarily read this. - Version detection: So I don't know if this will be fixed in the event the PR is merged, but when installing `amuse-framework' I was asked to unshallow the cloned repo. I executed:
git fetch https://github.com/amusecode/amuse.git --tags
git describe --long --dirty --tags
to fix this, but it would be nice to fix this somehow within the build system. I am not sure if this is already a published issue.
Beyond this, I tested a simple Sun - Jupiter - Ganymede system, comparing Huayno to Tsunami to 0.1Myr. I get the following orbital elements and energy errors.
Code: Huayno, Energy error: 1.025811174850564e-15
Planet - Moon
M1 = 1.89813e+27 kg
M2 = 1.4819e+23 kg
SMA = 1070404501.41
ECC = 0.0012844243656483423
TR = -1.71344091259 rad
INC = 0.0442443402623 rad
LOA = -1.29156588838 rad
AOP = -2.81850994281 rad
Planet - Sun
M1 = 1.89813e+27 kg
M2 = 1.98892e+30
SMA = 778601022607.0 m
ECC = 0.048685958498929677
TR = -2.76328027991 rad
INC = 0.0227485136181 rad
LOA = -1.49973342277 rad
AOP = -1.38638401099 rad
Code: Tsunami, Energy error: 2.608209256531936e-10
Planet - Moon
M1 = 1.89813e+27 kg
M2 = 1.4819e+23 kg
SMA = 1070403464.19 m
ECC = 0.0012865706732800961,
TR = -1.97663193711 rad
INC = 0.0442443796584 rad
LOA = -1.29156803413 rad
AOP = -2.80696280045 rad
Planet - Sun
M1 = 1.89813e+27 kg
M2 = 1.98892e+30 kg
SMA = 778593340205.0 m
ECC = 0.048689212847655587
TR = -2.76234468324 rad
INC = 0.022748310834 rad
LOA = -1.49971934148 rad
AOP = -1.38602784706 rad
My first run found energy errors in Tsunami worth 1e-2. Trying to understand this, given the orbital parameters seemed good, I found that in the file Nbodyalgorithms.hpp of Tsunami, the potential is computed with a positive sign (potential += mass[j] * mass[k] * inv_dr), when it should be negative. Changing this, the energy error becomes dE = 1e-11, so I suggest this should be fixed.
I will assume tests of tidal effects are satisfactory from your discussions with Simon, so I think if you resolve the couple notes I put, this can be merged.
|
I see now that PR #1278 would fix one of the issues I mentioned, we should probably look into merging that one. |
|
I added an error message if the code is downloaded without the file. I also tried resolving the dependencies issue so let me know if this is fixed for you! I also contacted the main developer of Tsunami to fix the sign error upstream. |
This PR adds Tsunami (https://gitlab.com/aatrani/tsunami) as a community code along with tests.
Tsunami is a tidal evolution N-body code similar to Tidymess.
Notes:
commit_particlesThis PR closes #1274