AMReX-Astro / AMReX-Astro/Castro
reset_internal_energy is unnecessary
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 340
- Forks
- 105
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 8
Description
Consider the algorithm for allow_small_energy == 0, which is the stricter version we should ideally enforce. First, it computes small_e = EOS(rho, small_temp). Then it checks if eint < small_e. If so it resets eint it with an EOS call; if not, it applies the dual energy criterion, then checks if eint < small_e and if so resets eint with an EOS call.
There is a simpler way to do this. First, we can apply the dual energy criterion, which either updates UEINT or leaves it alone. In either case, we might get a UEINT that is below small_e. Now, the reason the first EOS call is there is to determine what small_e actually is for this zone. But the EOS should indirectly enforce small_e, because it has a small_temp and small_dens and will floor out if these are violated. So we can simply call the EOS after the dual energy criterion has been applied, relying on the EOS to provide the flooring, and we are done.
And if we're doing that, we can simply merge reset_internal_e into compute_temp, by first applying the dual energy criterion and then calling the EOS, giving us both the correct e and T in one shot. The main thing we have to be careful of is that if we apply eos_input_is_constant, that we ignore that parameter if the internal energy floors, and allow it to be updated in that case. In other cases we can leave the internal energy as it is when we're calling with eos_input_re.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating reset_internal_energy and compute_temp, then trace how the dual energy criterion, EOS calls, and eos_input_is_constant are handled for allow_small_energy == 0. The refactor is complete when compute_temp performs the intended dual-energy update and EOS flooring while preserving the stated internal-energy update behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- hpc
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100