danieljprice / phantom

Phantom Smoothed Particle Hydrodynamics and Magnetohydrodynamics code
https://phantomsph.github.io
Other
94 stars 223 forks source link

Bug in unit.f90 #498

Closed tajjankovic closed 6 months ago

tajjankovic commented 6 months ago

I think there is a bug in line 103. Now it's:

   umass = udist**2/(gg*utime**2)

However, it should be:

   umass = udist**3/(gg*utime**2)
rieder commented 6 months ago

And in line 109 too.

danieljprice commented 6 months ago

this is a terrifying bug, fortunately I don't think it affects any previous simulations as we have always used either G=1 with mass and distance units set, or G=c=1 and mass units set, so the case of setting G=1 with time and mass or G=1 with distance and time have not been used to my knowledge.

But still, we should have a unit test to check these cases... thanks for fixing!