N-Body simulation: MERCURY vs. Swift

Click For Summary
SUMMARY

The discussion centers on the use of N-Body simulation codes, specifically MERCURY and Swift, which are not actively developed. Participants recommend using Gadget 2 for gravitational N-body simulations due to its stability and capability for large-scale computations. Users have reported installation challenges, particularly on Mac systems, where dependencies like FFTW and MPI can complicate the setup. Alternative tools such as Enzo are also mentioned for those interested in grid-based simulations.

PREREQUISITES
  • Familiarity with N-Body simulation concepts
  • Understanding of MPI (Message Passing Interface)
  • Experience with FFTW (Fastest Fourier Transform in the West)
  • Knowledge of HDF5 (Hierarchical Data Format version 5)
NEXT STEPS
  • Research the installation process for Gadget 2, focusing on dependency management
  • Explore the capabilities and features of Enzo for grid-based simulations
  • Learn about visualization tools compatible with HDF5 output, such as HDFView
  • Investigate alternative N-Body codes and their specific use cases in astrophysics
USEFUL FOR

Astrophysicists, computational scientists, and researchers involved in numerical simulations, particularly those focusing on gravitational N-Body problems and seeking reliable simulation tools.

zhermes
Messages
1,253
Reaction score
3
I've been hearing that these (MERCURY and Swift codes) are standards for N-Body evolution simulations. Neither of them seem to be currently in development however. Does anyone know if these (or others) are indeed still commonly in use?

If anyone has used either or both, could you say a few words on their features, strengths or weaknesses?

Thanks,
Z
 
Astronomy news on Phys.org
Hi there,

Weird, I work in numerical astrophysical simulations, among which Nbody, and I have never heard of either of these codes. I would advice you (if you want to do gravitational N-body simulations) to use the code Gadget 2, which is freely available on the web. The install may be a little difficult, but it is one of the most stable codes currently used in astrophysics. It is best for large scale computations (galaxies, cosmology) and if you want to do, say, a star cluster or solar system, you might also want to consider starlab. Let me know if you have issues installing, running or interpreting the code, as I have done all of that before.

Cheers, Harcel
 
Hi Harcel,

Thanks for your response! I was under the impression that Gadget was used primarily for SPH calculations---but I suppose that includes everything required for NBody... Naively I would still guess that Gadget is much slower than a purely NBody code---what do you think?

And I actually, just yesterday, tried to install Gadget---but I couldn't even get the necessary packages together on my MacBook Pro (snow leopard). It seems I need FFTW2.xxx for MPI compatibility, but FFTW2.xxx doesn't like my 64bit OpenMPI (included with the OS)... What type of system are you running on? Is it even worthwhile installing Gadget on a laptop, or is that too slow for even simple test cases?

Thanks very much!
Z
 
Hi!

So, yes, Gadget does pure Nbody, if you have zero SPH particles, and then it is not at all slower than pure Nbody codes (on the contrary, most Nbody codes don't do trees for the long range gravity). I have installed it on my laptop and desktop (both linux). I have not yet tried it on my MacPro.

Indeed, you need a lot of packages, that best be installed by hand, with some of the prefixes and flags set by hand, FFTW is not necessary for MPI (it in fact is used for th tree), but the installs all need to be consistent with one another. Did you follow the Gadget install manual? I had some issues with MPI and FFTW (and HDF5, but if you don't want to use that just don't install it with hdf5 capabilities). I think I used mpich2 instead of OpenMPI, but I am not sure about that. Also, OpenMPI should just work, but maybe you need some flags in an installation by hand (rather than the default using Fink or similar software).

If you follow the gadget install manual in the right order, and you get stuck somewhere, the error message usually is helpful... Give me some details if it doesn't work!

Good luck!
 
You may also want to look into http://lca.ucsd.edu/software/enzo/v1.0.1/. It's rather simple to code, and uses a grid scheme instead of calculating particles by themselves (it calculates densities and such of each of the grid cells and you can assign subgrids for areas that you need more resolution, like for hydrodynamics towards the center of the galaxy, or something). Enzo comes with some examples, and it has a pretty good documentation. Haven't worked much with Gadget, just GadgetViewer (really just modified the code to make it read my binary files), but plenty of people use that as well. Different tools really, so depends on what you want.
 
Last edited by a moderator:
I've been trying to figure out Gadget-2 for some time and I was able to run one of the examples that they give. The only problem is that I havn't been able to visualize them yet and I'm having problems reading the snapshot format when I set the output option to 2 which is the format compatible with Gadget-1.
I'm trying to use splotch4.4 but I'm not sure if I'm reading the snapshot file correctly or if I set something up wrong.

I was just wondering what visualization software or program you used for your simulations?
 
I use a variety of tools in both IDL and Python. I use the HDF5 output format, which is useful if you have HDF5 viewers (like e.g. hdfview) for first inspection. Compiling Gadget with the HDF5 option can be a bit more cumbersome though...

My tools won't be particularly useful for you, as we use a much extended output format, which is related to all the different subgrid routines we implemented. But at the very least you should be able to read the particle data with simple HDF5 viewer tools, if you are using hdf5.
 

Similar threads

  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 19 ·
Replies
19
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 15 ·
Replies
15
Views
3K