Skip to content

Commit

Permalink
Update changelog for internal energy scaling fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Mullen committed Aug 6, 2024
1 parent 45ea02e commit 9c35a24
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Added (new features/APIs/variables/...)

### Fixed (Repair bugs, etc)
- [[PR401]](https://github.com/lanl/singularity-eos/pull/401) Fix for internal energy scaling in PTE closure

### Changed (changing behavior/API/variables/...)

Expand Down Expand Up @@ -44,7 +45,7 @@ Date: 7/29/2024
### Changed (changing behavior/API/variables/...)
- [[PR363]](https://github.com/lanl/singularity-eos/pull/363) Template lambda values for scalar calls
- [[PR372]](https://github.com/lanl/singularity-eos/pull/372) Removed E0 from Davis Products EOS in favor of using the shifted EOS modifier. CHANGES API!
- [[PR#382]](https://github.com/lanl/singularity-eos/pull/382) Changed `get_sg_eos()` API to allow optionally specifying the mass fraction cutoff for materials to participate in the PTE solver
- [[PR#382]](https://github.com/lanl/singularity-eos/pull/382) Changed `get_sg_eos()` API to allow optionally specifying the mass fraction cutoff for materials to participate in the PTE solver

### Infrastructure (changes irrelevant to downstream codes)
- [[PR329]](https://github.com/lanl/singularity-eos/pull/329) Move vinet tests into analytic test suite
Expand Down
22 changes: 15 additions & 7 deletions singularity-eos/closure/mixed_cell_models.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,11 @@ class PTESolverBase {
}

// note the scaling of the material internal energy densities
for (int m = 0; m < nmat; ++m)
uscale_total = 0.0;
for (int m = 0; m < nmat; ++m) {
u[m] = sie[m] * robust::ratio(rhobar[m], uscale);
uscale_total += u[m];
}
}

PORTABLE_INLINE_FUNCTION
Expand Down Expand Up @@ -452,7 +455,7 @@ class PTESolverBase {
const RealIndexer &press;
Real *jacobian, *dx, *sol_scratch, *residual, *u, *rhobar;
CacheAccessor Cache;
Real rho_total, uscale, Tnorm;
Real rho_total, uscale, uscale_total, Tnorm;
};

} // namespace mix_impl
Expand Down Expand Up @@ -539,6 +542,7 @@ class PTESolverRhoT : public mix_impl::PTESolverBase<EOSIndexer, RealIndexer> {
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::press;
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::rho_total;
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::uscale;
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::uscale_total;
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::MatIndex;
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::TryIdealPTE;
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::jacobian;
Expand Down Expand Up @@ -590,8 +594,7 @@ class PTESolverRhoT : public mix_impl::PTESolverBase<EOSIndexer, RealIndexer> {
esum += u[m];
}
residual[0] = vfrac_total - vsum;
// the 1 here is the scaled total internal energy density
residual[1] = 1.0 - esum;
residual[1] = uscale_total - esum;
for (int m = 0; m < nmat - 1; ++m) {
residual[2 + m] = press[m + 1] - press[m];
}
Expand Down Expand Up @@ -766,6 +769,7 @@ class PTESolverFixedT : public mix_impl::PTESolverBase<EOSIndexer, RealIndexer>
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::press;
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::rho_total;
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::uscale;
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::uscale_total;
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::MatIndex;
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::jacobian;
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::residual;
Expand Down Expand Up @@ -817,9 +821,11 @@ class PTESolverFixedT : public mix_impl::PTESolverBase<EOSIndexer, RealIndexer>
// note the scaling of pressure
press[m] = eos[m].PressureFromDensityTemperature(rho[m], Tequil, Cache[m]);
}
uscale_total = 0.0;
for (int m = 0; m < nmat; ++m) {
press[m] = robust::ratio(press[m], uscale);
u[m] = sie[m] * robust::ratio(rhobar[m], uscale);
uscale_total += u[m];
}
Residual();
return ResidualNorm();
Expand All @@ -831,7 +837,6 @@ class PTESolverFixedT : public mix_impl::PTESolverBase<EOSIndexer, RealIndexer>
for (int m = 0; m < nmat; ++m) {
vsum += vfrac[m];
}
// the 1 here is the scaled volume fraction
residual[0] = vfrac_total - vsum;
for (int m = 0; m < nmat - 1; ++m) {
residual[1 + m] = press[m] - press[m + 1];
Expand Down Expand Up @@ -975,6 +980,7 @@ class PTESolverFixedP : public mix_impl::PTESolverBase<EOSIndexer, RealIndexer>
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::press;
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::rho_total;
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::uscale;
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::uscale_total;
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::MatIndex;
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::TryIdealPTE;
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::jacobian;
Expand Down Expand Up @@ -1027,10 +1033,12 @@ class PTESolverFixedP : public mix_impl::PTESolverBase<EOSIndexer, RealIndexer>
}

// note the scaling of the material internal energy densities
uscale_total = 0.0;
for (int m = 0; m < nmat; ++m) {
u[m] = robust::ratio(sie[m] * rhobar[m], uscale);
press[m] = robust::ratio(
eos[m].PressureFromDensityTemperature(rho[m], Tguess, Cache[m]), uscale);
uscale_total += u[m];
}
Residual();
// Set the current guess for the equilibrium temperature. Note that this is already
Expand Down Expand Up @@ -1207,6 +1215,7 @@ class PTESolverRhoU : public mix_impl::PTESolverBase<EOSIndexer, RealIndexer> {
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::press;
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::rho_total;
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::uscale;
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::uscale_total;
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::TryIdealPTE;
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::MatIndex;
using mix_impl::PTESolverBase<EOSIndexer, RealIndexer>::jacobian;
Expand Down Expand Up @@ -1257,8 +1266,7 @@ class PTESolverRhoU : public mix_impl::PTESolverBase<EOSIndexer, RealIndexer> {
esum += u[m];
}
residual[0] = vfrac_total - vsum;
// the 1 here is the scaled total internal energy density
residual[1] = 1.0 - esum;
residual[1] = uscale_total - esum;
for (int m = 0; m < nmat - 1; ++m) {
residual[2 + m] = press[m + 1] - press[m];
}
Expand Down

0 comments on commit 9c35a24

Please sign in to comment.