Skip to content

Commit

Permalink
move ye to variable types
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahm-LANL committed Dec 6, 2023
1 parent 6089c70 commit b52dc02
Show file tree
Hide file tree
Showing 33 changed files with 108 additions and 103 deletions.
10 changes: 5 additions & 5 deletions src/fixup/fixup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,9 @@ TaskStatus ApplyFloorsImpl(T *rc, IndexDomain domain = IndexDomain::entire) {

const std::vector<std::string> vars(
{p::density::name(), c::density, p::velocity::name(), c::momentum,
p::energy::name(), c::energy::name(), p::bfield::name(), p::ye, c::ye, p::pressure,
p::temperature, p::gamma1, pr::J, pr::H, cr::E, cr::F, impl::cell_signal_speed,
impl::fail, ir::tilPi});
p::energy::name(), c::energy::name(), p::bfield::name(), p::ye::name(),
c::ye::name(), p::pressure, p::temperature, p::gamma1, pr::J, pr::H, cr::E, cr::F,
impl::cell_signal_speed, impl::fail, ir::tilPi});

PackIndexMap imap;
auto v = rc->PackVariables(vars, imap);
Expand All @@ -330,8 +330,8 @@ TaskStatus ApplyFloorsImpl(T *rc, IndexDomain domain = IndexDomain::entire) {
const int shi = imap[impl::cell_signal_speed].second;
const int pb_lo = imap[p::bfield::name()].first;
const int pb_hi = imap[p::bfield::name()].second;
int pye = imap[p::ye].second; // negative if not present
int cye = imap[c::ye].second;
int pye = imap[p::ye::name()].second; // negative if not present
int cye = imap[c::ye::name()].second;
auto idx_J = imap.GetFlatIdx(pr::J, false);
auto idx_H = imap.GetFlatIdx(pr::H, false);
auto idx_E = imap.GetFlatIdx(cr::E, false);
Expand Down
8 changes: 4 additions & 4 deletions src/fixup/fixup_c2p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ TaskStatus ConservedToPrimitiveFixupImpl(T *rc) {
p::energy::name(),
c::energy::name(),
p::bfield::name(),
p::ye,
c::ye,
p::ye::name(),
c::ye::name(),
p::pressure,
p::temperature,
p::gamma1,
Expand Down Expand Up @@ -100,8 +100,8 @@ TaskStatus ConservedToPrimitiveFixupImpl(T *rc) {
const int shi = imap[impl::cell_signal_speed].second;
const int pb_lo = imap[p::bfield::name()].first;
const int pb_hi = imap[p::bfield::name()].second;
int pye = imap[p::ye].second; // negative if not present
int cye = imap[c::ye].second;
int pye = imap[p::ye::name()].second; // negative if not present
int cye = imap[c::ye::name()].second;

int ifail = imap[impl::fail].first;
int irfail = imap[ir::c2pfail].first;
Expand Down
9 changes: 5 additions & 4 deletions src/fixup/fixup_radc2p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,16 @@ TaskStatus RadConservedToPrimitiveFixupImpl(T *rc) {
bool update_rad = rad_pkg->Param<bool>("active");
if (!enable_c2p_fixup || !update_rad) return TaskStatus::complete;

const std::vector<std::string> vars({p::velocity::name(), p::ye, c::ye, pr::J, pr::H,
cr::E, cr::F, ir::tilPi, ir::c2pfail, impl::fail});
const std::vector<std::string> vars({p::velocity::name(), p::ye::name(), c::ye::name(),
pr::J, pr::H, cr::E, cr::F, ir::tilPi, ir::c2pfail,
impl::fail});

PackIndexMap imap;
auto v = rc->PackVariables(vars, imap);

auto idx_pvel = imap.GetFlatIdx(p::velocity::name());
int pye = imap[p::ye].second; // negative if not present
int cye = imap[c::ye].second;
int pye = imap[p::ye::name()].second; // negative if not present
int cye = imap[c::ye::name()].second;
auto idx_J = imap.GetFlatIdx(pr::J, false);
auto idx_H = imap.GetFlatIdx(pr::H, false);
auto idx_E = imap.GetFlatIdx(cr::E, false);
Expand Down
10 changes: 5 additions & 5 deletions src/fixup/fixup_src.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ TaskStatus SourceFixupImpl(T *rc) {

const std::vector<std::string> vars(
{p::density::name(), c::density, p::velocity::name(), c::momentum,
p::energy::name(), c::energy::name(), p::bfield::name(), p::ye, c::ye, p::pressure,
p::temperature, p::gamma1, pr::J, pr::H, cr::E, cr::F, impl::cell_signal_speed,
ir::srcfail, ir::tilPi});
p::energy::name(), c::energy::name(), p::bfield::name(), p::ye::name(),
c::ye::name(), p::pressure, p::temperature, p::gamma1, pr::J, pr::H, cr::E, cr::F,
impl::cell_signal_speed, ir::srcfail, ir::tilPi});

PackIndexMap imap;
auto v = rc->PackVariables(vars, imap);
Expand All @@ -94,8 +94,8 @@ TaskStatus SourceFixupImpl(T *rc) {
const int gm1 = imap[p::gamma1].first;
const int slo = imap[impl::cell_signal_speed].first;
const int shi = imap[impl::cell_signal_speed].second;
int pye = imap[p::ye].second;
int cye = imap[c::ye].second;
int pye = imap[p::ye::name()].second;
int cye = imap[c::ye::name()].second;
const int pb_lo = imap[p::bfield::name()].first;
const int pb_hi = imap[p::bfield::name()].second;
auto idx_J = imap.GetFlatIdx(pr::J);
Expand Down
9 changes: 5 additions & 4 deletions src/fluid/con2prim.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@ class ConToPrim {
pb_lo(imap[fluid_prim::bfield::name()].first),
pb_hi(imap[fluid_prim::bfield::name()].second),
cb_lo(imap[fluid_cons::bfield::name()].first),
cb_hi(imap[fluid_cons::bfield::name()].second), pye(imap[fluid_prim::ye].second),
cye(imap[fluid_cons::ye].second), prs(imap[fluid_prim::pressure].first),
cb_hi(imap[fluid_cons::bfield::name()].second),
pye(imap[fluid_prim::ye::name()].second),
cye(imap[fluid_cons::ye::name()].second), prs(imap[fluid_prim::pressure].first),
tmp(imap[fluid_prim::temperature].first),
sig_lo(imap[internal_variables::cell_signal_speed].first),
sig_hi(imap[internal_variables::cell_signal_speed].second),
Expand All @@ -155,8 +156,8 @@ class ConToPrim {
return std::vector<std::string>(
{fluid_prim::density::name(), fluid_cons::density, fluid_prim::velocity::name(),
fluid_cons::momentum, fluid_prim::energy::name(), fluid_cons::energy::name(),
fluid_prim::bfield::name(), fluid_cons::bfield::name(), fluid_prim::ye,
fluid_cons::ye, fluid_prim::pressure, fluid_prim::temperature,
fluid_prim::bfield::name(), fluid_cons::bfield::name(), fluid_prim::ye::name(),
fluid_cons::ye::name(), fluid_prim::pressure, fluid_prim::temperature,
internal_variables::cell_signal_speed, fluid_prim::gamma1,
internal_variables::c2p_scratch});
}
Expand Down
9 changes: 5 additions & 4 deletions src/fluid/con2prim_robust.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,9 @@ class ConToPrim {
pb_lo(imap[fluid_prim::bfield::name()].first),
pb_hi(imap[fluid_prim::bfield::name()].second),
cb_lo(imap[fluid_cons::bfield::name()].first),
cb_hi(imap[fluid_cons::bfield::name()].second), pye(imap[fluid_prim::ye].second),
cye(imap[fluid_cons::ye].second), prs(imap[fluid_prim::pressure].first),
cb_hi(imap[fluid_cons::bfield::name()].second),
pye(imap[fluid_prim::ye::name()].second),
cye(imap[fluid_cons::ye::name()].second), prs(imap[fluid_prim::pressure].first),
tmp(imap[fluid_prim::temperature].first),
sig_lo(imap[internal_variables::cell_signal_speed].first),
sig_hi(imap[internal_variables::cell_signal_speed].second),
Expand All @@ -253,8 +254,8 @@ class ConToPrim {
return std::vector<std::string>(
{fluid_prim::density::name(), fluid_cons::density, fluid_prim::velocity::name(),
fluid_cons::momentum, fluid_prim::energy::name(), fluid_cons::energy::name(),
fluid_prim::bfield::name(), fluid_cons::bfield::name(), fluid_prim::ye,
fluid_cons::ye, fluid_prim::pressure, fluid_prim::temperature,
fluid_prim::bfield::name(), fluid_cons::bfield::name(), fluid_prim::ye::name(),
fluid_cons::ye::name(), fluid_prim::pressure, fluid_prim::temperature,
internal_variables::cell_signal_speed, fluid_prim::gamma1,
internal_variables::c2p_mu});
}
Expand Down
16 changes: 8 additions & 8 deletions src/fluid/fluid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ std::shared_ptr<StateDescriptor> Initialize(ParameterInput *pin) {
physics->AddField(p::temperature, mprim_scalar);
physics->AddField(p::gamma1, mprim_scalar);
if (ye) {
physics->AddField(p::ye, mprim_scalar);
physics->AddField(p::ye::name(), mprim_scalar);
}
if (pin->GetOrAddString("fluid", "c2p_method", "robust") == "robust") {
physics->AddField(impl::c2p_mu, mprim_scalar);
Expand All @@ -230,7 +230,7 @@ std::shared_ptr<StateDescriptor> Initialize(ParameterInput *pin) {
physics->AddField(c::bfield::name(), mcons_threev);
}
if (ye) {
physics->AddField(c::ye, mcons_scalar);
physics->AddField(c::ye::name(), mcons_scalar);
}

AllReduce<std::vector<Real>> net_field_totals;
Expand Down Expand Up @@ -260,12 +260,12 @@ std::shared_ptr<StateDescriptor> Initialize(ParameterInput *pin) {
{p::density::name(), p::velocity::name(), p::energy::name()});
riemann::FluxState::ReconVars(rvars);
if (mhd) riemann::FluxState::ReconVars(p::bfield::name());
if (ye) riemann::FluxState::ReconVars(p::ye);
if (ye) riemann::FluxState::ReconVars(p::ye::name());

std::vector<std::string> fvars({c::density, c::momentum, c::energy::name()});
riemann::FluxState::FluxVars(fvars);
if (mhd) riemann::FluxState::FluxVars(c::bfield::name());
if (ye) riemann::FluxState::FluxVars(c::ye);
if (ye) riemann::FluxState::FluxVars(c::ye::name());

// add some extra fields for reconstruction
rvars = std::vector<std::string>({p::pressure, p::gamma1});
Expand Down Expand Up @@ -352,8 +352,8 @@ TaskStatus PrimitiveToConservedRegion(MeshBlockData<Real> *rc, const IndexRange

const std::vector<std::string> vars(
{p::density::name(), c::density, p::velocity::name(), c::momentum,
p::energy::name(), c::energy::name(), p::bfield::name(), c::bfield::name(), p::ye,
c::ye, p::pressure, p::gamma1, impl::cell_signal_speed});
p::energy::name(), c::energy::name(), p::bfield::name(), c::bfield::name(),
p::ye::name(), c::ye::name(), p::pressure, p::gamma1, impl::cell_signal_speed});

PackIndexMap imap;
auto v = rc->PackVariables(vars, imap);
Expand All @@ -372,8 +372,8 @@ TaskStatus PrimitiveToConservedRegion(MeshBlockData<Real> *rc, const IndexRange
const int pb_hi = imap[p::bfield::name()].second;
const int cb_lo = imap[c::bfield::name()].first;
const int cb_hi = imap[c::bfield::name()].second;
const int pye = imap[p::ye].second; // -1 if not present
const int cye = imap[c::ye].second;
const int pye = imap[p::ye::name()].second; // -1 if not present
const int cye = imap[c::ye::name()].second;
const int sig_lo = imap[impl::cell_signal_speed].first;
const int sig_hi = imap[impl::cell_signal_speed].second;

Expand Down
10 changes: 6 additions & 4 deletions src/fluid/riemann.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,14 @@ class FluxState {
pvel_lo(imap[fluid_prim::velocity::name()].first),
peng(imap[fluid_prim::energy::name()].first),
pb_lo(imap[fluid_prim::bfield::name()].first),
pb_hi(imap[fluid_prim::bfield::name()].second), pye(imap[fluid_prim::ye].second),
prs(imap[fluid_prim::pressure].first), gm1(imap[fluid_prim::gamma1].first),
crho(imap[fluid_cons::density].first), cmom_lo(imap[fluid_cons::momentum].first),
pb_hi(imap[fluid_prim::bfield::name()].second),
pye(imap[fluid_prim::ye::name()].second), prs(imap[fluid_prim::pressure].first),
gm1(imap[fluid_prim::gamma1].first), crho(imap[fluid_cons::density].first),
cmom_lo(imap[fluid_cons::momentum].first),
ceng(imap[fluid_cons::energy::name()].first),
cb_lo(imap[fluid_cons::bfield::name()].first),
cb_hi(imap[fluid_cons::bfield::name()].second), cye(imap[fluid_cons::ye].first),
cb_hi(imap[fluid_cons::bfield::name()].second),
cye(imap[fluid_cons::ye::name()].first),
ncons(5 + (pb_hi - pb_lo + 1) + (cye > 0)) {
PARTHENON_REQUIRE_THROWS(
ncons <= NCONS_MAX,
Expand Down
2 changes: 1 addition & 1 deletion src/microphysics/eos_phoebus/eos_phoebus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ std::shared_ptr<StateDescriptor> Initialize(ParameterInput *pin) {
// We request that Ye and temperature exist, but do not provide them.
Metadata m = Metadata({Metadata::Cell, Metadata::Intensive, Metadata::Derived,
Metadata::OneCopy, Metadata::Requires});
pkg->AddField(fluid_prim::ye, m);
pkg->AddField(fluid_prim::ye::name(), m);
pkg->AddField(fluid_prim::temperature, m);

const std::string filename = pin->GetString(block_name, "filename");
Expand Down
4 changes: 2 additions & 2 deletions src/pgen/advection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) {
PackIndexMap imap;
auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(),
fluid_prim::energy::name(), fluid_prim::bfield::name(),
fluid_prim::ye, fluid_prim::pressure,
fluid_prim::ye::name(), fluid_prim::pressure,
fluid_prim::temperature, fluid_prim::gamma1},
imap);

Expand All @@ -38,7 +38,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) {
const int ieng = imap[fluid_prim::energy::name()].first;
const int ib_lo = imap[fluid_prim::bfield::name()].first;
const int ib_hi = imap[fluid_prim::bfield::name()].second;
const int iye = imap[fluid_prim::ye].second;
const int iye = imap[fluid_prim::ye::name()].second;
const int iprs = imap[fluid_prim::pressure].first;
const int itmp = imap[fluid_prim::temperature].first;
const int igm1 = imap[fluid_prim::gamma1].first;
Expand Down
4 changes: 2 additions & 2 deletions src/pgen/blandford_mckee.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) {
PackIndexMap imap;
auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(),
fluid_prim::energy::name(), fluid_prim::bfield::name(),
fluid_prim::ye, fluid_prim::pressure,
fluid_prim::ye::name(), fluid_prim::pressure,
fluid_prim::temperature, fluid_prim::gamma1},
imap);

Expand All @@ -43,7 +43,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) {
const int ieng = imap[fluid_prim::energy::name()].first;
const int ib_lo = imap[fluid_prim::bfield::name()].first;
const int ib_hi = imap[fluid_prim::bfield::name()].second;
const int iye = imap[fluid_prim::ye].second;
const int iye = imap[fluid_prim::ye::name()].second;
const int iprs = imap[fluid_prim::pressure].first;
const int itmp = imap[fluid_prim::temperature].first;
const int igm1 = imap[fluid_prim::gamma1].first;
Expand Down
4 changes: 2 additions & 2 deletions src/pgen/bondi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) {
PackIndexMap imap;
auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(),
fluid_prim::energy::name(), fluid_prim::bfield::name(),
fluid_prim::ye, fluid_prim::pressure,
fluid_prim::ye::name(), fluid_prim::pressure,
fluid_prim::temperature, fluid_prim::gamma1},
imap);

Expand All @@ -103,7 +103,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) {
const int ieng = imap[fluid_prim::energy::name()].first;
const int ib_lo = imap[fluid_prim::bfield::name()].first;
const int ib_hi = imap[fluid_prim::bfield::name()].second;
const int iye = imap[fluid_prim::ye].second;
const int iye = imap[fluid_prim::ye::name()].second;
const int iprs = imap[fluid_prim::pressure].first;
const int itmp = imap[fluid_prim::temperature].first;
const int igm1 = imap[fluid_prim::gamma1].first;
Expand Down
4 changes: 2 additions & 2 deletions src/pgen/friedmann.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) {
PackIndexMap imap;
auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(),
fluid_prim::energy::name(), fluid_prim::bfield::name(),
fluid_prim::ye, fluid_prim::pressure,
fluid_prim::ye::name(), fluid_prim::pressure,
fluid_prim::temperature, fluid_prim::gamma1},
imap);
const int irho = imap[fluid_prim::density::name()].first;
const int ivlo = imap[fluid_prim::velocity::name()].first;
const int ieng = imap[fluid_prim::energy::name()].first;
const int iye = imap[fluid_prim::ye].second;
const int iye = imap[fluid_prim::ye::name()].second;
const int iprs = imap[fluid_prim::pressure].first;
const int itmp = imap[fluid_prim::temperature].first;
const int igm1 = imap[fluid_prim::gamma1].first;
Expand Down
4 changes: 2 additions & 2 deletions src/pgen/kh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) {
PackIndexMap imap;
auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(),
fluid_prim::energy::name(), fluid_prim::bfield::name(),
fluid_prim::ye, fluid_prim::pressure,
fluid_prim::ye::name(), fluid_prim::pressure,
fluid_prim::temperature, fluid_prim::gamma1},
imap);

Expand All @@ -38,7 +38,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) {
const int ieng = imap[fluid_prim::energy::name()].first;
const int ib_lo = imap[fluid_prim::bfield::name()].first;
const int ib_hi = imap[fluid_prim::bfield::name()].second;
const int iye = imap[fluid_prim::ye].second;
const int iye = imap[fluid_prim::ye::name()].second;
const int iprs = imap[fluid_prim::pressure].first;
const int itmp = imap[fluid_prim::temperature].first;
const int igm1 = imap[fluid_prim::gamma1].first;
Expand Down
4 changes: 2 additions & 2 deletions src/pgen/leptoneq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) {

PackIndexMap imap;
auto v = rc->PackVariables({p::density::name(), p::velocity::name(), p::energy::name(),
p::ye, p::pressure, p::temperature, p::gamma1},
p::ye::name(), p::pressure, p::temperature, p::gamma1},
imap);

const int irho = imap[p::density::name()].first;
const int ivlo = imap[p::velocity::name()].first;
const int ivhi = imap[p::velocity::name()].second;
const int ieng = imap[p::energy::name()].first;
const int iye = imap[p::ye].first;
const int iye = imap[p::ye::name()].first;
const int iprs = imap[p::pressure].first;
const int itmp = imap[p::temperature].first;
const int igm1 = imap[p::gamma1].first;
Expand Down
4 changes: 2 additions & 2 deletions src/pgen/linear_modes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) {
std::vector<std::string> vars(
{fluid_prim::density::name(), fluid_prim::velocity::name(),
fluid_prim::energy::name(), fluid_prim::bfield::name(), fluid_prim::pressure,
fluid_prim::temperature, fluid_prim::gamma1, fluid_prim::ye});
fluid_prim::temperature, fluid_prim::gamma1, fluid_prim::ye::name()});
auto v = rc->PackVariables(vars, imap);

const int irho = imap[fluid_prim::density::name()].first;
Expand All @@ -58,7 +58,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) {
const int iprs = imap[fluid_prim::pressure].first;
const int itmp = imap[fluid_prim::temperature].first;
const int igm1 = imap[fluid_prim::gamma1].first;
const int iye = imap[fluid_prim::ye].second;
const int iye = imap[fluid_prim::ye::name()].second;
const int nv = ivhi - ivlo + 1;

const Real gam = pin->GetReal("eos", "Gamma");
Expand Down
2 changes: 1 addition & 1 deletion src/pgen/p2c2p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) {
PackIndexMap imap;
auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(),
fluid_prim::energy::name(), fluid_prim::bfield::name(),
fluid_prim::ye, fluid_prim::pressure,
fluid_prim::ye::name(), fluid_prim::pressure,
fluid_prim::temperature, fluid_prim::gamma1},
imap);

Expand Down
Loading

0 comments on commit b52dc02

Please sign in to comment.