Skip to content

Commit

Permalink
Merge pull request #218 from lanl/blb/frontier
Browse files Browse the repository at this point in the history
  • Loading branch information
AstroBarker authored Oct 15, 2024
2 parents b45c04a + 3c11d58 commit 157a790
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 36 deletions.
2 changes: 1 addition & 1 deletion external/singularity-eos
Submodule singularity-eos updated 145 files
2 changes: 1 addition & 1 deletion src/geometry/mckinney_gammie_ryan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class McKinneyGammieRyan {
Real smooth, Real hexp_br, Real hexp_nsq, Real hexp_csq)
: derefine_poles_(derefine_poles), h_(h), xt_(xt), alpha_(alpha), x0_(x0),
smooth_(smooth), norm_(GetNorm_(alpha_, xt_)), hexp_br_(hexp_br),
hexp_nsq_(hexp_nsq), hexp_csq_(hexp_csq_) {}
hexp_nsq_(hexp_nsq), hexp_csq_(hexp_csq) {}
McKinneyGammieRyan(bool derefine_poles, Real h, Real xt, Real alpha, Real x0,
Real smooth)
: derefine_poles_(derefine_poles), h_(h), xt_(xt), alpha_(alpha), x0_(x0),
Expand Down
1 change: 0 additions & 1 deletion src/microphysics/eos_phoebus/eos_phoebus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ std::shared_ptr<StateDescriptor> Initialize(ParameterInput *pin) {
// Can specify rho_min, etc, in <eos>
rho_min = pin->GetOrAddReal("eos", "rho_min", 0.0);
sie_min = pin->GetOrAddReal("eos", "sie_min", 0.0);
lambda[2] = {0.};
T_min = eos_host.TemperatureFromDensityInternalEnergy(rho_min, sie_min, lambda);
rho_max = pin->GetOrAddReal("eos", "rho_max", 1e18);
sie_max = pin->GetOrAddReal("eos", "sie_max", 1e35);
Expand Down
29 changes: 0 additions & 29 deletions src/pgen/pgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "geometry/geometry.hpp"

#include "pgen.hpp"
#include "phoebus_utils/root_find.hpp"

namespace phoebus {

Expand Down Expand Up @@ -56,32 +55,4 @@ void PostInitializationModifier(ParameterInput *pin, Mesh *pmesh) {
f(pin, pmesh);
}

class PressResidual {
public:
KOKKOS_INLINE_FUNCTION
PressResidual(const EOS &eos, const Real rho, const Real P, const Real Ye)
: eos_(eos), rho_(rho), P_(P) {
lambda_[0] = Ye;
}
KOKKOS_INLINE_FUNCTION
Real operator()(const Real e) {
return eos_.PressureFromDensityInternalEnergy(rho_, e, lambda_) - P_;
}

private:
const EOS &eos_;
Real rho_, P_;
Real lambda_[2];
};

KOKKOS_FUNCTION
Real energy_from_rho_P(const EOS &eos, const Real rho, const Real P, const Real emin,
const Real emax, const Real Ye) {
PARTHENON_REQUIRE(P >= 0, "Pressure is negative!");
PressResidual res(eos, rho, P, Ye);
root_find::RootFind root;
Real eroot = root.regula_falsi(res, emin, emax, 1.e-10 * P, emin - 1.e10);
return rho * eroot;
}

} // namespace phoebus
32 changes: 29 additions & 3 deletions src/pgen/pgen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ using namespace parthenon::package::prelude;
// internal includes
#include "fluid/fluid.hpp"
#include "geometry/geometry.hpp"
#include "phoebus_utils/root_find.hpp"
#include "phoebus_utils/variables.hpp"
#include "radiation/radiation.hpp"
#include "tracers/tracers.hpp"
Expand Down Expand Up @@ -117,9 +118,34 @@ static std::map<std::string, std::function<void(ParameterInput *pin, Mesh *pmesh
// END OF UNTOUCHABLE MACRO SECTION
*/

KOKKOS_FUNCTION
Real energy_from_rho_P(const Microphysics::EOS::EOS &eos, const Real rho, const Real P,
const Real emin, const Real emax, const Real Ye = 0.0);
class PressResidual {
public:
KOKKOS_INLINE_FUNCTION
PressResidual(const EOS &eos, const Real rho, const Real P, const Real Ye)
: eos_(eos), rho_(rho), P_(P) {
lambda_[0] = Ye;
}
KOKKOS_INLINE_FUNCTION
Real operator()(const Real e) {
return eos_.PressureFromDensityInternalEnergy(rho_, e, lambda_) - P_;
}

private:
const EOS &eos_;
Real rho_, P_;
Real lambda_[2];
};

template <typename T>
KOKKOS_INLINE_FUNCTION Real energy_from_rho_P(T &eos, const Real rho, const Real P,
const Real emin, const Real emax,
const Real Ye = 0.0) {
PARTHENON_REQUIRE(P >= 0, "Pressure is negative!");
PressResidual res(eos, rho, P, Ye);
root_find::RootFind root;
Real eroot = root.regula_falsi(res, emin, emax, 1.e-10 * P, emin - 1.e10);
return rho * eroot;
}

} // namespace phoebus

Expand Down
2 changes: 1 addition & 1 deletion src/pgen/sedov.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) {

const Real rhoa = pin->GetOrAddReal("sedov", "rho_ambient", 1.0);
const Real rinner = pin->GetOrAddReal("sedov", "rinner", 0.01);
const bool spherical = pin->GetOrAddReal("sedov", "spherical_coords", true);
const bool spherical = pin->GetOrAddBoolean("sedov", "spherical_coords", true);

auto &coords = pmb->coords;
auto pmesh = pmb->pmy_mesh;
Expand Down

0 comments on commit 157a790

Please sign in to comment.