Skip to content

Conversation

@hsinhaoHHuang
Copy link
Contributor

Motivations

In this PR, I propose we skip the dual-energy fix inside Hydro_FullStepUpdate when the results are unphysical.

If there are some reasons that the Riemann solver gets large fluxes, the full-step updated density can be low, the velocity can be high, the kinetic energy may be unphysically large, the total energy can be negative or positive, but the internal energy can be largely negative.

We expect the dual-energy fix to work when the internal energy is low or even slightly negative while other variables are normal. But when the other variables are obviously unphysical, we should not update the total energy by dual-energy fix and let the unphysical results be detected by the check later to invoke 1st-order flux correction or AUTO_REDUCE_DT.

The dual-energy fix may falsely mask the unphysical results updated by the full-step fluxes.

Example

This is one real case in my isolated galaxy simulations:
Input
[Dens, MomX, MomY, MomZ, Engy] = [ 1.67E-06, -1.67E-04, 1.59E-03, -1.18E-03, 5.07E+01 ]
so
[DENS, VELX, VELY, VELZ, EINT] = [ 1.67E-06, -9.99E+01, 9.57E+02, -7.08E+02, 4.96E+01 ]

After the full-step update, it becomes
Output
[Dens, MomX, MomY, MomZ, Engy] = [ 4.52E-07, -2.52E-03, -3.98E-02, -4.54E-04, -5.16E+01 ]
which is
[DENS, VELX, VELY, VELZ, EINT] = [ 4.52E-07, -5.58E+03, -8.80E+04, -1.00E+03, -1.81E+03 ]

The total energy is negative, and the velocity is unreasonably large, so the internal energy is largely negative.

After the dual-energy fix inside Hydro_FullStepUpdate(), the total energy will be updated by the sum of the kinetic energy and the internal energy from dual energy and become largely positive (dominated by the kinetic energy).
Output Engy after dual-energy fix = 1.7622859e+03, and the internal energy is also positive.

In Flu_Close()->CorrectUnphysical(), we will not notice there are unphysical problems in this cell.
The large total energy will cause other problems later, such as an explosion.

Changes

In Hydro_FullStepUpdate(), only apply the dual-energy fix when the density is positive and the kinetic energy is less than twice the total energy. In this way, the negative total energy or negative internal energy will be kept and noticed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant