Repository navigation
EOSX/Con2PrimFactory: correct tabulated energy and temperature handling (Phase A) - #175
Open
jaykalinani wants to merge 10 commits into
Open
jaykalinani wants to merge 10 commits into
jaykalinani wants to merge 10 commits into
Conversation
Retain negative physical energies and bound inverse inputs before taking log(eps + energy_shift). Keep the shift internal to interpolation. Add opt-in EOSX tests for shifted table bounds, temperature round trips, ideal-gas controls and active-EOS device queries. Patch and whitespace checks passed. Compilation and runtime tests were not run, as requested.
Bound rho, temperature and Ye before deriving pressure, physical energy and table entropy. Remove independent pressure and energy floors and declare the entropy write. Preserve the existing atmosphere selection, grading and non-finite-temperature fallback. Record invalid selected inputs or EOS outputs on the device and report them with CCTK_ERROR on the host after synchronization. Add an optional read-only check of the converted grid values. Approved-patch and whitespace checks passed; no compilation or runtime tests were run.
Replace the atmosphere-energy floor with the local EOS interval in the existing temperature path. Preserve raw recovered energy, accept EOS-valid negative energy, and mark clipping for conservative recomputation without broadening the nonnegative-EOS fallback policy. Add host-side tabulated and ideal-gas regression tests in the existing thorn test file. Preserve the pre-existing Wminus2 clamps, root tolerances and bracketing. Approved patch and whitespace checks passed. No compilation or runtime tests were run.
Use a conservative global enthalpy lower bound instead of sampling the EOS at minimum density and forcing h0 above unity. Preserve the existing nonpositive-energy fallback for nonnegative EOSs, and accept negative physical energy within the local EOS range. Add synthetic tabulated and ideal-gas regression cases for the root bracket, recovery, clipping, and invalid energy input. Reviewed and whitespace-checked; not compiled or run.
Screen tau using the global physical energy bound, then query the local EOS minimum only when repair is needed. Preserve valid negative energies and clarify tauFluid_atmo as an undensitized repair margin. AsterX: skip pre-C2P limiting after atmosphere or excision resets. Add synthetic-table and ideal-gas conservative-limiter regressions, including boundary and invalid-input checks. Reviewed patch applied exactly; not compiled or run.
acwen11
approved these changes
Oct 7, 2026
acwen11
left a comment
Collaborator
There was a problem hiding this comment.
Looks good, just a generic comment
| h0 = fmax(h0, CCTK_REAL(1.0) + std::numeric_limits<CCTK_REAL>::epsilon()); | ||
| // For P >= 0, h >= 1 + eps_min over the entire EOS domain. Sampling | ||
| // h at rho_min is not a global bound; negative physical eps permits h < 1. | ||
| // solve checks eps_min > -1 before constructing the root function. |
Collaborator
There was a problem hiding this comment.
Just a generic comment, I feel like AI is leaving a lot of comments in the code referencing either the prompt or previous code that is now deleted, and that is cluttering up the code a bit. I think we should avoid leaving these comments in whenever possible.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is the first phase of the incremental EOS updates based on dev.
It addresses inconsistent energy bounds and temperature handling.
Tabulated EOSs can contain negative physical specific internal energy.
Treating that energy as necessarily positive, or using atmosphere energy
as a universal minimum, can alter otherwise valid thermodynamic states.
Changes
A1 — Preserve physical tabulated energy bounds
log(eps + shift), retaining the existing local temperature-edge bounds.
A2 — Keep tabulated initial thermodynamics consistent
atmosphere temperature handling.
A3 — Use local EOS energy bounds in Palenzuela
at the trial/recovered rho and Ye, retaining the existing use_temp gate.
nonpositive-energy fallback policy for nonnegative EOSs.
A4 — Allow EOS-valid negative energy in RePrimAnd
assuming nonnegative pressure.
A5 — Make conservative energy repair EOS-aware