Skip to content

Amuse Tsunami Interface - #1281

Open
elkogerville wants to merge 138 commits into
amusecode:mainfrom
elkogerville:amuse_tsunami
Open

elkogerville wants to merge 138 commits into
amusecode:mainfrom
elkogerville:amuse_tsunami

Conversation

@elkogerville

@elkogerville elkogerville commented Sep 11, 2026 •

Copy link
Copy Markdown
Member

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:

  • particles are added to temporary buffers before committing them to Tsunami in commit_particles
  • Tsunami is a private code, and therefore a copy is needed from Dr. Alessandro Alberto Trani before the interface can be compiled.

This PR closes #1274

…m new_particle buffer into Tsunami, while taking into account previously commited particles
… get_center_of_mass_velocity, get_total_radius, get_number_of_particles
@elkogerville
elkogerville requested a review from a team as a code owner September 11, 2026 14:29
@elkogerville elkogerville added area: community_code Issue concerns a community code and/or its AMUSE bindings area: interfaces Issues related to the standardised interfaces in amuse.community.interface and swappability of codes labels Sep 11, 2026
@elkogerville elkogerville added the kind: feature request The issue requests a feature that AMUSE does not currently have label Sep 11, 2026
@elkogerville elkogerville moved this from Backlog to Open PRs in Development Board Sep 18, 2026
@elkogerville elkogerville self-assigned this Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the hard-coded converter in line 30 normal?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@ErwanH29 ErwanH29 left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 install Tsunami after I had already done a .setup install all caused 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 ./setup stage. Maybe it's best to add the Tsunami-required packages in the install stage?
  • Required .tar.gz archive: 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 the README.md mentions 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.

@ErwanH29

ErwanH29 commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator

I see now that PR #1278 would fix one of the issues I mentioned, we should probably look into merging that one.

@elkogerville

Copy link
Copy Markdown
Member Author

@ErwanH29

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 branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: community_code Issue concerns a community code and/or its AMUSE bindings area: interfaces Issues related to the standardised interfaces in amuse.community.interface and swappability of codes kind: feature request The issue requests a feature that AMUSE does not currently have

Projects

Status: Open PRs

Development

Successfully merging this pull request may close these issues.

Add Tsunami interface to AMUSE

2 participants