Sphenix pressure floor
In this merge request, I am implementing the pressure floor for SPHENIX. As it is a density scheme, the solution is straight forward and simply requires to use the pressure with the floor in both the momentum and internal equations.
This was tested with the new example PressureFloor
. It is simply the cooling box with self gravity. The setup is done in order to collapse quickly (about 1min of simulation) without pressure floor. With the SPHENIX pressure floor, I am able to avoid this collapse.
@jborrow, I am touching a bit SPHENIX, therefore I guess that you may want to take a quick look.
Merge request reports
Activity
407 408 408 409 /* Compute the sound speed */ 409 410 const float pressure = gas_pressure_from_internal_energy(p->rho, p->u); 411 const float pressure_floor = 412 pressure_floor_get_comoving_pressure(p, pressure, cosmo); 410 413 const float soundspeed = gas_soundspeed_from_pressure(p->rho, pressure); Sincerely, I do not think there is a good answer to that question. It depends a bit on how you interpret the pressure floor. Either you can see it as a change in the equation of state and
c^2 = \frac{dP}{d\rho} = 0
as the pressure does not depend on the density anymore or you can simply see it as a modification of the equation of motion + energy and then the definition of the sound speed stays the same.I decided to take a more pragmatic approach and simply keep everything as simple as possible otherwise I will spend 6 months on it and will not have time to finish properly my thesis. Anyway the sound speed is only used in the artificial terms, therefore it will not have a huge impact and it is only for the particles that are badly resolved and will be transformed into stars.
I agree. (And have already argued in the past that a pressure floor like that causes a lot of philosophical troubles.)
However, the problem with the sound-speed is that you may end up with time-step lengths that are long compare to what they should be if the particle had this pressure. So you may not be able to correctly capture shocks. If this is OK, then that's fine by me but I think this is worth thinking about.
Also, in any case, we should update the online documentation to specify exactly which variables are affected by the floor.
Edited by Matthieu SchallerYou actually have a large time-step now.
dt = h / c = h / sqrt(gamma * P/rho)
If you increase
P
at fixedrho
andh
,dt
should go down. But only if you recompute it with your newP
. If you don't, then you have adt
that is too large.Edited by Matthieu Schallerchanged this line in version 6 of the diff
I have updated the sound speed. In order to do so, I had to change a bit the code in order to compute the sound speed directly from the pressure and not the internal energy. There is a comment about looking at theory just above one of the changes, but from my understanding this comment should not be here and only matters for the pressure-* schemes.
@jborrow happy with the latest changes to
src/hydro/SPHENIX/hydro.h
?- Resolved by Loic Hausammann
- Resolved by Loic Hausammann
- Resolved by Loic Hausammann
- Resolved by Loic Hausammann