Are there any SPH planet collision simulators?

Click For Summary

Discussion Overview

The discussion revolves around the search for publicly available collision simulators for planets that utilize Smoothed Particle Hydrodynamics (SPH). Participants explore existing software options, their capabilities, and limitations regarding planetary collision simulations.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant inquires about publicly available SPH collision simulators for planets, noting that US2 does not use SPH for collisions.
  • Another participant mentions GADGET 2, which uses SPH but states it does not handle planetary collisions.
  • Some participants discuss the need to generate initial conditions for simulations, suggesting that the .param file in GADGET 2 does not provide sufficient information for particle motion.
  • There is a suggestion that while GADGET 2 could potentially be adapted for planetary collisions, it requires additional coding to set up initial conditions.
  • One participant references MAGMA, an SPH code used for neutron star collisions, but notes it is not publicly available.
  • Technical details about reading and writing initial conditions for GADGET 2 are shared, including Python code snippets for handling data files.

Areas of Agreement / Disagreement

Participants express differing views on the capabilities of GADGET 2 regarding planetary collisions, with some asserting it cannot perform such simulations while others believe it could be adapted with the right setup. The discussion remains unresolved regarding the availability of a suitable SPH simulator for planetary collisions.

Contextual Notes

Participants highlight limitations in existing software, particularly regarding the generation of initial conditions and the interpretation of output data. There are also mentions of specific formats and requirements for using GADGET 2 effectively.

MrQuack
Hello, I've been searching for a collision simulator for planets that uses SPH. I haven't found any though. US2 doesn't use SPH collisions. But does anyone know any that are publically available? Example video below:

And a channel with a few: https://www.youtube.com/user/joetaicoon/videos
 
Astronomy news on Phys.org
GADGET 2 - "GADGET computes gravitational forces with a hierarchical tree algorithm (optionally in combination with a particle-mesh scheme for long-range gravitational forces) and represents fluids by means of smoothed particle hydrodynamics (SPH)." - Free software, released in May 2005
 
|Glitch| said:
GADGET 2 - "GADGET computes gravitational forces with a hierarchical tree algorithm (optionally in combination with a particle-mesh scheme for long-range gravitational forces) and represents fluids by means of smoothed particle hydrodynamics (SPH)." - Free software, released in May 2005
Sadly that doesn't do planetary collisions.
 
Bump, don't know when i can bump but I haven't found a rule book thing
 
MrQuack said:
Bump, don't know when i can bump but I haven't found a rule book thing

The link to PF Terms and Rules can be found at the bottom right of every page on the site and under the "Info" tab at the top.

Per the rules:

Bumping
Do not "bump" one of your threads to the top of a forum's thread list by posting a basically empty message to it, until at least 24 hours have passed since the latest post in the thread; and then do it only once per thread.
 
Drakkith said:
The link to PF Terms and Rules can be found at the bottom right of every page on the site and under the "Info" tab at the top.

Per the rules:

Bumping
Do not "bump" one of your threads to the top of a forum's thread list by posting a basically empty message to it, until at least 24 hours have passed since the latest post in the thread; and then do it only once per thread.
Ah sorry. I didn't see that
 
MrQuack said:
Sadly that doesn't do planetary collisions.

Why do you say it doesn't do planetary collisions? If you have gravity and fluid mechanics, what in your mind is missing? Why isn't it just a matter of setting up the initial conditions properly?
 
phyzguy said:
Why do you say it doesn't do planetary collisions? If you have gravity and fluid mechanics, what in your mind is missing? Why isn't it just a matter of setting up the initial conditions properly?
afaik I don't know any way to create new conditions for it. The .param file is just for the loading and not the objects. a.k.a It doesn't say where the particles and motion it just says stuff like when the simulation should end & write the files for loading.
 
MrQuack said:
afaik I don't know any way to create new conditions for it. The .param file is just for the loading and not the objects. a.k.a It doesn't say where the particles and motion it just says stuff like when the simulation should end & write the files for loading.
Oh also it is for gas and dark matter simulations.
 
  • #10
MrQuack said:
afaik I don't know any way to create new conditions for it. The .param file is just for the loading and not the objects. a.k.a It doesn't say where the particles and motion it just says stuff like when the simulation should end & write the files for loading.

You will need to write code to generate the particle initial conditions. If you don't know how to do this, then you won't know how to interpret the simulator output either, because it is just files with lists of particle positions and velocities. I think Gadget could do the job, but I won't argue the point. I know that Rosswog's group uses the SPH code MAGMA to simulate neutron star collisions, but as far as I know it is not publicly available.
 
  • #11
phyzguy said:
You will need to write code to generate the particle initial conditions. If you don't know how to do this, then you won't know how to interpret the simulator output either, because it is just files with lists of particle positions and velocities. I think Gadget could do the job, but I won't argue the point. I know that Rosswog's group uses the SPH code MAGMA to simulate neutron star collisions, but as far as I know it is not publicly available.
I mean, the data is .dat files and it's binary littleendian and bigendian so it's very very hard to interpret it!
 
  • #12
GADGET 2 is presumably open-source. That should make it possible to find out what it does by reading its source code. There ought to be some place in it for reading in initial conditions. From how it reads in, one can find the initial-conditions data format and work out how to generate initial conditions with one's own software. It's essentially a lot of particle positions and velocities with extra info on how they behave.
 
  • #13
@MrQuack It's not that hard to read and write the Gadget IC files. I've attached below some Python code to read a Gadget IC file and print out the position and velocity of one of the particles. It's not the cleanest code in the world, but it works. Maybe this will be of some use to you.

Python:
#!/usr/bin/env python

from pylab import *
import arraydef ReadGadgetICFile(filename):# Reads an initial conditions file

    class ICfile:
        pass

    icfile = ICfile()
    file = open(filename,"rb")
    icfile.header = ReadGadgetHeader(file) # Header data
    icfile.data = ReadGadgetData(file, icfile.header,1)
    file.close()

    return icfile

def ReadGadgetHeader(file): # Reads the header of the snapshot or IC file

    class HeadData:
        pass
    header=HeadData()

    header.blocksize = array.array("i")
    header.Npart = array.array("I")
    header.Massarr = array.array("d")
    header.Time = array.array("d")
    header.Redshift = array.array("d")
    header.FlagSfr = array.array("i")
    header.FlagFeedback = array.array("i")
    header.Nall = array.array("i")
    header.FlagCooling = array.array("i")
    header.NumFiles = array.array("i")
    header.BoxSize = array.array("d")
    header.Omega0 = array.array("d")
    header.OmegaLambda = array.array("d")
    header.HubbleParam = array.array("d")
    header.FlagAge = array.array("i")
    header.FlagMetals = array.array("i")
    header.NallHW = array.array("i")
    header.flag_entr_ics = array.array("i")
    header.unused = array.array("i")

    header.blocksize.fromfile(file,1)
    header.Npart.fromfile(file,6)
    header.Massarr.fromfile(file,6)
    header.Time.fromfile(file,1)
    header.Redshift.fromfile(file,1)
    header.FlagSfr.fromfile(file,1)
    header.FlagFeedback.fromfile(file,1)
    header.Nall.fromfile(file,6)
    header.FlagCooling.fromfile(file,1)
    header.NumFiles.fromfile(file,1)
    header.BoxSize.fromfile(file,1)
    header.Omega0.fromfile(file,1)
    header.OmegaLambda.fromfile(file,1)
    header.HubbleParam.fromfile(file,1)
    header.FlagAge.fromfile(file,1)
    header.FlagMetals.fromfile(file,1)
    header.NallHW.fromfile(file,6)
    header.flag_entr_ics.fromfile(file,1)
    header.unused.fromfile(file,15)
    header.blocksize.fromfile(file,1)

    return header

def ReadGadgetData(file,header,filetype):
    # Reads the data (position, velocity, mass, ...)
    # filetype=0->snapshot file, filetype=1->IC file

    class Data:
        pass
    data=Data()

    Npart=header.Npart
    Massarr=header.Massarr
    Ngas=header.Npart[0]
    N=0
    for i in range(6):
        N = N+Npart[i]
    Nm=0
    for i in range(6):
        if Massarr[i]==0:
            Nm = Nm+Npart[i]

    data.blocksize = array.array("i")
    data.pos = array.array("f")
    data.vel = array.array("f")
    data.id = array.array("i")
    data.masses = array.array("f")
    data.u = array.array("f")
    data.rho = array.array("f")
    if header.FlagCooling[0]==1:
        data.ne = array.array("f")
        data.np = array.array("f")
    data.hsml = array.array("f")

    data.blocksize.fromfile(file,1)
    data.pos.fromfile(file,3*N)
    data.blocksize.fromfile(file,1)

    data.blocksize.fromfile(file,1)
    data.vel.fromfile(file,3*N)
    data.blocksize.fromfile(file,1)

    data.blocksize.fromfile(file,1)
    data.id.fromfile(file,N)
    data.blocksize.fromfile(file,1)

    if Nm!=0:
        data.blocksize.fromfile(file,1)
        data.masses.fromfile(file,Nm)
        data.blocksize.fromfile(file,1)
    if Ngas!=0:     
        data.blocksize.fromfile(file,1)
        data.u.fromfile(file,Ngas)
        data.blocksize.fromfile(file,1)

       if filetype==0:

            data.blocksize.fromfile(file,1)
            data.rho.fromfile(file,Ngas)
            data.blocksize.fromfile(file,1)

        if header.FlagCooling[0]==1:

                data.blocksize.fromfile(file,1)
                data.ne.fromfile(file,Ngas)
                data.blocksize.fromfile(file,1)

                data.blocksize.fromfile(file,1)
                data.np.fromfile(file,Ngas)
                data.blocksize.fromfile(file,1)

            data.blocksize.fromfile(file,1)
            data.hsml.fromfile(file,Ngas)
            data.blocksize.fromfile(file,1)

    return data

icfile = ReadGadgetICFile('bullet.dat')

id = 17

print "Particle # %d has mass %f, position (%f,%f,%f), and velocity (%f,%f,%f)"%(icfile.data.id[id], icfile.data.masses[id], icfile.data.pos[id], icfile.data.pos[id+1], icfile.data.pos[id+2], icfile.data.vel[id], icfile.data.vel[id+1], icfile.data.vel[id+2])
 
  • #14
@MrQuack : If you look at this paper, they are in fact using Gadget for planetary collision simulations.
 
  • #15
@phyzguy Ah thanks! Sorry for very late reply, forgot about forums for a little bit
 
  • #16
Sadly I'm not that good at reading papers though and can't understand most of them
 
  • #17
These simulators are not simple pieces of code. Using them is not like running a program like Excel. You have to dig into how they work in order to create the initial conditions and interpret the output. Often you have to modify the code itself. If you can't understand the paper I linked, then you probably won't be able to run these complex simulations. Sorry to be blunt, but that's the way it is.
 
  • #18
oh i guess I am not going to use any of that stuff then
 
  • #19
A very fast and simple SPH algorithm is described extensively in this paper:
http://www.ligum.umontreal.ca/Clavet-2005-PVFS/pvfs.pdf
Not the state of the art, but very suited for real-time applications, eg. Games.

That should take care of the velocity and position vectors.

Then you just need to use N-Body calculations for the acceleration vectors.
 
  • #20
If you just want some neat effects and are not aiming for accuracy, you should ignore soft body physics and directly simulate the planet as thousands of frictionless rigid body spheres, as a fluid with zero viscosity and surface tension is basically many rigid body particles.
 

Similar threads

  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 16 ·
Replies
16
Views
5K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 16 ·
Replies
16
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K