Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bulk modulus calculation in spiner EOS #370

Merged
merged 4 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- [[PR#357]](https://github.com/lanl/singularity-eos/pull/357) Added support for C++17 (e.g., needed when using newer Kokkos).

### Fixed (Repair bugs, etc)
- [[PR370]](https://github.com/lanl/singularity-eos/pull/370) Fix bulk modulus calculation in spiner EOS
- [[PR343]](https://github.com/lanl/singularity-eos/pull/343) Add chemical potentials to stellar collapse gold files
- [[PR342]](https://github.com/lanl/singularity-eos/pull/342) Fix missing using statement in stellar collapse root finding routines
- [[PR341]](https://github.com/lanl/singularity-eos/pull/341) Short-circuit HDF5 machinery when cray-wrappers used in-tree
Expand All @@ -36,7 +37,7 @@ Date: 11/28/2023
- [[PR278]](https://github.com/lanl/singularity-eos/pull/278) Fixed EOSPAC unit conversion errors for scalar lookups
- [[PR316]](https://github.com/lanl/singularity-eos/pull/316) removed `fmax-errors=3` from `singularity-eos` compile flags
- [[PR296]](https://github.com/lanl/singularity-eos/pull/296) changed `CMAKE_SOURCE_DIR` to `PROJECT_SOURCE_DIR` to fix downstream submodule build
- [[PR291]](https://github.com/lanl/singularity-eos/pull/291) package.py updates to reflect new CMake options
- [[PR291]](https://github.com/lanl/singularity-eos/pull/291) package.py updates to reflect new CMake options
- [[PR290]](https://github.com/lanl/singularity-eos/pull/290) Added target guards on export config
- [[PR288]](https://github.com/lanl/singularity-eos/pull/288) Don't build tests that depend on spiner when spiner is disabled
- [[PR287]](https://github.com/lanl/singularity-eos/pull/287) Fix testing logic with new HDF5 options
Expand Down
28 changes: 14 additions & 14 deletions singularity-eos/eos/eos_spiner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -870,15 +870,15 @@ inline void SpinerEOSDependsRhoT::fixBulkModulus_() {
for (int i = 0; i < numT_; i++) {
Real lT = bMod_.range(0).x(i);
Real press = P_.interpToReal(lRho, lT);
Real DPDR = dPdRho_.interpToReal(lRho, lT);
Real DPDE = dPdE_.interpToReal(lRho, lT);
Real DEDR = dEdRho_.interpToReal(lRho, lT);
Real DTDE = dTdE_.interpToReal(lRho, lT);
Real DPDR_E = dPdRho_.interpToReal(lRho, lT);
Real DPDE_R = dPdE_.interpToReal(lRho, lT);
Real DEDR_T = dEdRho_.interpToReal(lRho, lT);
Real DPDR_T = DPDR_E + DPDE_R * DEDR_T;
Real bMod;
if (DPDE > 0.0 && rho > 0.0) {
bMod = rho * DPDR + DPDE * (press / rho - rho * DEDR);
if (DPDE_R > 0.0 && rho > 0.0) {
bMod = rho * DPDR_E + DPDE_R * (press / rho);
} else if (rho > 0.0) {
bMod = std::max(rho * DPDR, 0.0);
bMod = std::max(rho * DPDR_T, 0.0);
} else {
bMod = 0.0;
}
Expand Down Expand Up @@ -1637,15 +1637,15 @@ inline void SpinerEOSDependsRhoSie::calcBMod_(SP5Tables &tables) {
Real rho = fromLog_(lRho, lRhoOffset_);
for (int i = 0; i < tables.bMod.dim(1); i++) {
Real press = tables.P(j, i);
Real DPDR = tables.dPdRho(j, i);
Real DPDE = tables.dPdE(j, i);
Real DEDR = tables.dEdRho(j, i);
Real DTDE = tables.dTdE(j, i);
Real DPDR_E = tables.dPdRho(j, i);
Real DPDE_R = tables.dPdE(j, i);
Real DEDR_T = tables.dEdRho(j, i);
Real DPDR_T = DPDR_E + DPDE_R * DEDR_T;
Real bMod;
if (DPDE > 0.0 && rho > 0.0) {
bMod = rho * DPDR + DPDE * (press / rho - rho * DEDR);
if (DPDE_R > 0.0 && rho > 0.0) {
bMod = rho * DPDR_E + DPDE_R * (press / rho);
} else if (rho > 0.0) {
bMod = std::max(rho * DPDR, 0.0);
bMod = std::max(rho * DPDR_T, 0.0);
} else {
bMod = 0.0;
}
Expand Down
Loading