Skip to content

Commit

Permalink
ok... lets try this
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahm-LANL committed Jan 3, 2025
1 parent 26dd8f5 commit be2f5b9
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions singularity-eos/eos/eos_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,10 +856,10 @@ class EosBase {
using RootFinding1D::findRoot; // more robust but slower. Better default.
using RootFinding1D::Status;

// Pressure is not monotone in density at low densities, due to a
// phase transition, which can prevent convergence. We want to
// approach tension from above, not below. Choose close to, but
// above, normal density for a metal like copper.
// Pressure is not monotone in density at low densities, which can
// prevent convergence. We want to approach tension from above,
// not below. Choose close to, but above, normal density for a
// metal like copper.
constexpr Real DEFAULT_RHO_GUESS = 12;

CRTP copy = *(static_cast<CRTP const *>(this));
Expand All @@ -870,14 +870,13 @@ class EosBase {
return copy.PressureFromDensityTemperature(r, temp, lambda);
};
Real rhoguess = rho; // use input density
if ((rhoguess < rhomin) || (rhoguess > rhomax)) {
if ((rhomin < DEFAULT_RHO_GUESS) && (DEFAULT_RHO_GUESS < rhomax)) {
if ((rhoguess <= rhomin) || (rhoguess >= rhomax)) {
if ((rhomin <= DEFAULT_RHO_GUESS) && (DEFAULT_RHO_GUESS <= rhomax)) {
rhoguess = DEFAULT_RHO_GUESS;
} else {
rhoguess = 0.5 * (rhomin + rhomax);
}
}
printf("%.14e %.14e %.14e\n", rhomin, rhomax, rhoguess);
auto status = findRoot(PofRT, press, rhoguess, rhomin, rhomax, robust::EPS(),
robust::EPS(), rho);
// JMM: This needs to not fail and instead return something sane
Expand Down

0 comments on commit be2f5b9

Please sign in to comment.