JuliaAstroSim / AstroNbodySim.jl

Unitful and differentiable gravitational N-body simulation code in Julia
GNU General Public License v3.0
32 stars 0 forks source link

How to allow update of CSV@0.10.12 in the family of AstroNbodySim.jl codes ? #11

Open martinmestre opened 9 months ago

martinmestre commented 9 months ago

Hello, I am trying to perform this example: https://juliaastrosim.github.io/AstroNbodySim.jl/dev/examples/05-plummer/ but there is an error that I have tracked to CSV version. According to Julia Discourse, I should update to a higher version but the code AstroIO, AstroPlots, etc has restrictions. How could I do to update CSV in order to run the example? Thank you very much. Best.

martinmestre commented 9 months ago

Hi, I have an additional question. Do you know why in that same example, the softening length is set to a value of 0.0177 kpc by the algorithm even though the Plummer scale is only 0.01 kpc ? I would have expected a much smaller softening length, much smaller than the average interparticle distance. Thanks for any comment.

islent commented 9 months ago

there is an error that I have tracked to CSV version

I have updated upper bounds of CSV version to v0.10. Have a try!

the softening length is set to a value of 0.0177 kpc by the algorithm even though the Plummer scale is only 0.01 kpc

The softening lengths in Plummer example (numbered 03 in @v0.1.1) is set by suggest_softlen!, which simple use the averaged seperation length cbrt(Volumn / number of particles). To use a preferred softening length, you can use set_softlen!, as compared:

suggest_softlen!(sim)  # where you got 0.0177 kpc

set_soflen!(sim, 0.001u"kpc")  # or anything you want
martinmestre commented 9 months ago

Thanks for you answers and solutions. Just to know I understand, do you know why the code is suggesting such a large value of softening for this case of Plummer sphere with virial radius of 0.01 kpc ?

islent commented 8 months ago

do you know why the code is suggesting such a large value of softening for this case of Plummer sphere with virial radius of 0.01 kpc ?

image

In the Plummer example, the softening lengths are suggested as cbrt(V / N), where V is volumn, and N is the number of particles. The definition is arbitrary. Feel free to change it with set_softlen!

The softening lengths in Plummer example (numbered 03 in @v0.1.1) is set by suggest_softlen!, which simple use the averaged seperation length cbrt(Volumn / number of particles). To use a preferred softening length, you can use set_softlen!

The definitions of above functions locate here: https://github.com/JuliaAstroSim/AstroNbodySim.jl/blob/main/src/tools/SofteningLength.jl