Are there any SPH planet collision simulators?

Npart[1]): # Gas particles pos = array.array("f") pos.fromfile(file,3) icfile.pos.append(pos) vel = array.array("f") vel.fromfile(file,3) icfile.vel.append(vel) id = array.array("I") id.fromfile(file,1) icfile.id.append(id) mass = array.array("f") mass.fromfile(file,1) icfile.mass.append(mass) for i in range(Npart[2]): # Dark matter particles pos = array.array("f") pos.fromfile(file,3) icfile.pos.append(pos) vel = array.array
  • #1
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
  • #2
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
 
  • #3
|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.
 
  • #4
Bump, don't know when i can bump but I haven't found a rule book thing
 
  • #5
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.
 
  • #6
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
 
  • #7
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?
 
  • #8
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.
 
  • #9
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.
 

1. What is a SPH planet collision simulator?

A SPH (Smoothed Particle Hydrodynamics) planet collision simulator is a computer program that uses mathematical equations and algorithms to simulate the collision of two or more planets. It takes into account factors such as mass, velocity, and density to predict the outcome of the collision.

2. How accurate are SPH planet collision simulators?

The accuracy of SPH planet collision simulators depends on the quality of the input data and the complexity of the simulation. With accurate input data and advanced algorithms, these simulators can produce results that closely match real-world observations.

3. What can SPH planet collision simulators be used for?

SPH planet collision simulators can be used for a variety of purposes, including studying the formation of planets and planetary systems, understanding the effects of impacts on the evolution of planets, and predicting the outcome of potential collisions between celestial bodies.

4. Are there any limitations to SPH planet collision simulators?

Like any computer simulation, SPH planet collision simulators have limitations. They may not be able to accurately simulate extremely complex collisions or account for all possible variables. Additionally, they rely on the input data and assumptions made by the user, which can affect the accuracy of the results.

5. How can I access and use a SPH planet collision simulator?

There are various SPH planet collision simulators available online, some for free and others for purchase. These programs often come with user guides and tutorials to help users understand and use the software effectively. However, a background in physics and computer science may be helpful in fully utilizing these simulators.

Similar threads

  • Astronomy and Astrophysics
Replies
1
Views
1K
  • Astronomy and Astrophysics
Replies
14
Views
2K
  • Introductory Physics Homework Help
Replies
16
Views
2K
  • Astronomy and Astrophysics
Replies
6
Views
1K
  • Astronomy and Astrophysics
Replies
1
Views
1K
  • Introductory Physics Homework Help
Replies
18
Views
998
  • Astronomy and Astrophysics
Replies
7
Views
2K
  • Programming and Computer Science
Replies
19
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Sci-Fi Writing and World Building
Replies
0
Views
599
Back
Top