From 52e304443c95d58036e7ee75f7c916617c58ff45 Mon Sep 17 00:00:00 2001 From: Jonah Maxwell Miller Date: Thu, 19 Oct 2023 12:13:19 -0600 Subject: [PATCH 01/14] starting work on refactor --- src/fluid/fluid.cpp | 42 ++++++----- src/phoebus_utils/variables.hpp | 130 ++++++++++++++++++-------------- 2 files changed, 98 insertions(+), 74 deletions(-) diff --git a/src/fluid/fluid.cpp b/src/fluid/fluid.cpp index f3cd80584..fe1683fe6 100644 --- a/src/fluid/fluid.cpp +++ b/src/fluid/fluid.cpp @@ -189,9 +189,9 @@ std::shared_ptr Initialize(ParameterInput *pin) { ndim = 2; // add the primitive variables - physics->AddField(p::density, mprim_scalar); - physics->AddField(p::velocity, mprim_threev); - physics->AddField(p::energy, mprim_scalar); + physics->AddField(mprim_scalar); + physics->AddField(mprim_threev); + physics->AddField(p::energy::name(), mprim_scalar); if (mhd) { physics->AddField(p::bfield, mprim_threev); if (ndim == 2) { @@ -539,6 +539,7 @@ TaskStatus CalculateFluidSourceTerms(MeshBlockData *rc, constexpr int ND = Geometry::NDFULL; constexpr int NS = Geometry::NDSPACE; auto *pmb = rc->GetParentPointer().get(); + auto &resolved_pkgs = pkb->resolved_packages.get(); auto &fluid = pmb->packages.Get("fluid"); if (!fluid->Param("active") || fluid->Param("zero_sources")) return TaskStatus::complete; @@ -547,16 +548,19 @@ TaskStatus CalculateFluidSourceTerms(MeshBlockData *rc, IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); - std::vector vars({fluid_cons::momentum, fluid_cons::energy}); + + using namespace c = fluid_cons; + using namespace diag = diagnostic_variables; #if SET_FLUX_SRC_DIAGS - vars.push_back(diagnostic_variables::src_terms); + static auto desc = + parthenon::MakePackDescriptor(resolved_pkgs); +#else + static auto desc = + parthenon::MakePackDescriptor( + resolved_pkgs); #endif - PackIndexMap imap; - auto src = rc_src->PackVariables(vars, imap); - const int cmom_lo = imap[fluid_cons::momentum].first; - const int cmom_hi = imap[fluid_cons::momentum].second; - const int ceng = imap[fluid_cons::energy].first; - const int idiag = imap[diagnostic_variables::src_terms].first; + auto src = desc.GetPack(rc); auto tmunu = BuildStressEnergyTensor(rc); auto geom = Geometry::GetCoordinateSystem(rc); @@ -576,7 +580,7 @@ TaskStatus CalculateFluidSourceTerms(MeshBlockData *rc, SPACETIMELOOP2(m, n) { src_mom += Tmunu[m][n] * (dg[n][l + 1][m] - gam[l + 1][n][m]); } - src(cmom_lo + l, k, j, i) = gdet * src_mom; + src(fluid_cons::momentum(l), k, j, i) = gdet * src_mom; } // energy source term @@ -606,21 +610,21 @@ TaskStatus CalculateFluidSourceTerms(MeshBlockData *rc, for (int m = 0; m < ND; m++) { Ta += Tmunu[m][0] * da[m]; } - src(ceng, k, j, i) = gdet * alpha * (Ta - TGam); + src(fluid_cons::energy(), k, j, i) = gdet * alpha * (Ta - TGam); #else SPACETIMELOOP2(mu, nu) { TGam += Tmunu[mu][nu] * gam[nu][0][mu]; } - src(ceng, k, j, i) = gdet * TGam; + src(fluid_cons::energy(), k, j, i) = gdet * TGam; #endif // USE_VALENCIA } #if SET_FLUX_SRC_DIAGS - src(idiag, k, j, i) = 0.0; - src(idiag + 1, k, j, i) = src(cmom_lo, k, j, i); - src(idiag + 2, k, j, i) = src(cmom_lo + 1, k, j, i); - src(idiag + 3, k, j, i) = src(cmom_lo + 2, k, j, i); - src(idiag + 4, k, j, i) = src(ceng, k, j, i); + src(diag::src_terms(0), k, j, i) = 0.0; + src(diag::src_terms(1), k, j, i) = src(c::momentum(0), k, j, i); + src(diag::src_terms(2), k, j, i) = src(c::momentum(1), k, j, i); + src(diag::src_terms(3), k, j, i) = src(c::momentum(2), k, j, i); + src(diag::src_terms(4), k, j, i) = src(c::energy(), k, j, i); #endif }); diff --git a/src/phoebus_utils/variables.hpp b/src/phoebus_utils/variables.hpp index 85867f820..98c287418 100644 --- a/src/phoebus_utils/variables.hpp +++ b/src/phoebus_utils/variables.hpp @@ -14,86 +14,106 @@ #ifndef PHOEBUS_UTILS_VARIABLES_HPP_ #define PHOEBUS_UTILS_VARIABLES_HPP_ +#include + +#define VARIABLE(ns, varname) \ + struct varname : public parthenon::variable_names::base_t { \ + template \ + KOKKOS_INLINE_FUNCTION varname(Ts &&...args) \ + : parthenon::variable_names::base_t(std::forward(args)...) {} \ + static std::string name() { return #ns "." #varname; } \ + } + +#define VARIABLE_NONS(varname) \ + struct varname : public parthenon::variable_names::base_t { \ + template \ + KOKKOS_INLINE_FUNCTION varname(Ts &&...args) \ + : parthenon::variable_names::base_t(std::forward(args)...) {} \ + static std::string name() { return #varname; } \ + } + namespace fluid_prim { -constexpr char density[] = "p.density"; -constexpr char velocity[] = "p.velocity"; -constexpr char energy[] = "p.energy"; -constexpr char bfield[] = "p.bfield"; -constexpr char ye[] = "p.ye"; -constexpr char pressure[] = "pressure"; -constexpr char temperature[] = "temperature"; -constexpr char gamma1[] = "gamma1"; +VARIABLE(p, density); +VARIABLE(p, velocity); +VARIABLE(p, energy); +VARIABLE(p, bfield); +VARIABLE(p, ye); +VARIABLE_NONS(pressure); +VARAIBLE_NONS(temperature); +VARIABLE_NONS(gamma1); } // namespace fluid_prim namespace fluid_cons { -constexpr char density[] = "c.density"; -constexpr char momentum[] = "c.momentum"; -constexpr char energy[] = "c.energy"; -constexpr char bfield[] = "c.bfield"; -constexpr char ye[] = "c.ye"; +VARIABLE(c, density); +VARIABLE(c, momentum); +VARIABLE(c, energy); +VARIABLE(c, bfield); +VARIABLE(c, ye); } // namespace fluid_cons namespace radmoment_prim { -constexpr char J[] = "r.p.J"; -constexpr char H[] = "r.p.H"; +VARIABLE(r, p.J); +VARIABLE(r, p.H); } // namespace radmoment_prim namespace radmoment_cons { -constexpr char E[] = "r.c.E"; -constexpr char F[] = "r.c.F"; +VARIABLE(r, c.E); +VARIABLE(r, c.F); } // namespace radmoment_cons namespace radmoment_internal { -constexpr char xi[] = "r.i.xi"; -constexpr char phi[] = "r.i.phi"; -constexpr char ql[] = "r.i.ql"; -constexpr char qr[] = "r.i.qr"; -constexpr char ql_v[] = "r.i.ql_v"; -constexpr char qr_v[] = "r.i.qr_v"; -constexpr char dJ[] = "r.i.dJ"; -constexpr char kappaJ[] = "r.i.kappaJ"; -constexpr char kappaH[] = "r.i.kappaH"; -constexpr char JBB[] = "r.i.JBB"; -constexpr char tilPi[] = "r.i.tilPi"; -constexpr char kappaH_mean[] = "r.i.kappaH_mean"; -constexpr char c2pfail[] = "r.i.c2p_fail"; -constexpr char srcfail[] = "r.i.src_fail"; +VARIABLE(r, i.xi); +VARIABLE(r, i.phi); +VARIABLE(r, i.ql); +VARIABLE(r, i.qr); +VARIABLE(r, i.ql_v); +VARIABLE(r, i.qr_v); +VARIABLE(r, i.dJ); +VARIABLE(r, i.kappaJ); +VARIABLE(r, i.kappaH); +VARIABLE(r, i.JBB); +VARIABLE(r, i.tilPi); +VARIABLE(r, i.kappaH_mean); +VARIABLE(r, i.c2p_fail); +VARIABLE(r, i.src_fail); } // namespace radmoment_internal namespace mocmc_internal { -constexpr char dnsamp[] = "mocmc.i.dnsamp"; -constexpr char Inu0[] = "mocmc.i.inu0"; -constexpr char Inu1[] = "mocmc.i.inu1"; -constexpr char jinvs[] = "mocmc.i.jinvs"; +VARIABLE(mocmc, i.dnsamp); +VARIABLE(mocmc, i.inu0); +VARIABLE(mocmc, i.inu1); +VARIABLE(mocmc, i.jinvs); } // namespace mocmc_internal namespace internal_variables { -constexpr char face_signal_speed[] = "face_signal_speed"; -constexpr char cell_signal_speed[] = "cell_signal_speed"; -constexpr char emf[] = "emf"; -constexpr char c2p_scratch[] = "c2p_scratch"; -constexpr char ql[] = "ql"; -constexpr char qr[] = "qr"; -constexpr char fail[] = "fail"; -constexpr char Gcov[] = "Gcov"; -constexpr char Gye[] = "Gye"; -constexpr char c2p_mu[] = "c2p_mu"; -constexpr char tau[] = "light_bulb_tau"; -constexpr char GcovHeat[] = "GcovHeat"; -constexpr char GcovCool[] = "GcovCool"; +VARIABLE_NONS(face_signal_speed); +VARIABLE_NONS(cell_signal_speed); +VARIABLE_NONS(emf); +VARIABLE_NONS(c2p_scratch); +VARIABLE_NONS(ql); +VARIABLE_NONS(qr); +VARIABLE_NONS(fail); +VARIABLE_NONS(Gcov); +VARIABLE_NONS(Gye); +VARIABLE_NONS(c2p_mu); +VARIABLE_NONS(light_bulb_tau); +VARIABLE_NONS(GcovHeat); +VARIABLE_NONS(GcovCool); } // namespace internal_variables namespace geometric_variables { -constexpr char cell_coords[] = "g.c.coord"; -constexpr char node_coords[] = "g.n.coord"; +VARIABLE(g, c.coord); +VARIABLE(g, n.coord); } // namespace geometric_variables namespace diagnostic_variables { -constexpr char divb[] = "divb"; -constexpr char divf[] = "flux_divergence"; -constexpr char src_terms[] = "src_terms"; -constexpr char r_divf[] = "r.flux_divergence"; -constexpr char r_src_terms[] = "r.src_terms"; +VARIABLE_NONS(divb); +VARIABLE_NONS(flux_divergence); +VARIABLE_NONS(src_terms); +VARIABLE(r, flux_divergence); +VARIABLE(r, src_terms); } // namespace diagnostic_variables +#undef VARIABLE + #endif // PHOEBUS_UTILS_VARIABLES_HPP_ From ae814235a97593024df5d5b2b59eb52c72bf9098 Mon Sep 17 00:00:00 2001 From: Jonah Maxwell Miller Date: Tue, 5 Dec 2023 12:12:14 -0700 Subject: [PATCH 02/14] revert in-progress changes to try more gentle conversion --- src/fluid/fluid.cpp | 42 +++++------ src/phoebus_utils/variables.hpp | 130 ++++++++++++++------------------ 2 files changed, 74 insertions(+), 98 deletions(-) diff --git a/src/fluid/fluid.cpp b/src/fluid/fluid.cpp index fe1683fe6..f3cd80584 100644 --- a/src/fluid/fluid.cpp +++ b/src/fluid/fluid.cpp @@ -189,9 +189,9 @@ std::shared_ptr Initialize(ParameterInput *pin) { ndim = 2; // add the primitive variables - physics->AddField(mprim_scalar); - physics->AddField(mprim_threev); - physics->AddField(p::energy::name(), mprim_scalar); + physics->AddField(p::density, mprim_scalar); + physics->AddField(p::velocity, mprim_threev); + physics->AddField(p::energy, mprim_scalar); if (mhd) { physics->AddField(p::bfield, mprim_threev); if (ndim == 2) { @@ -539,7 +539,6 @@ TaskStatus CalculateFluidSourceTerms(MeshBlockData *rc, constexpr int ND = Geometry::NDFULL; constexpr int NS = Geometry::NDSPACE; auto *pmb = rc->GetParentPointer().get(); - auto &resolved_pkgs = pkb->resolved_packages.get(); auto &fluid = pmb->packages.Get("fluid"); if (!fluid->Param("active") || fluid->Param("zero_sources")) return TaskStatus::complete; @@ -548,19 +547,16 @@ TaskStatus CalculateFluidSourceTerms(MeshBlockData *rc, IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); - - using namespace c = fluid_cons; - using namespace diag = diagnostic_variables; + std::vector vars({fluid_cons::momentum, fluid_cons::energy}); #if SET_FLUX_SRC_DIAGS - static auto desc = - parthenon::MakePackDescriptor(resolved_pkgs); -#else - static auto desc = - parthenon::MakePackDescriptor( - resolved_pkgs); + vars.push_back(diagnostic_variables::src_terms); #endif - auto src = desc.GetPack(rc); + PackIndexMap imap; + auto src = rc_src->PackVariables(vars, imap); + const int cmom_lo = imap[fluid_cons::momentum].first; + const int cmom_hi = imap[fluid_cons::momentum].second; + const int ceng = imap[fluid_cons::energy].first; + const int idiag = imap[diagnostic_variables::src_terms].first; auto tmunu = BuildStressEnergyTensor(rc); auto geom = Geometry::GetCoordinateSystem(rc); @@ -580,7 +576,7 @@ TaskStatus CalculateFluidSourceTerms(MeshBlockData *rc, SPACETIMELOOP2(m, n) { src_mom += Tmunu[m][n] * (dg[n][l + 1][m] - gam[l + 1][n][m]); } - src(fluid_cons::momentum(l), k, j, i) = gdet * src_mom; + src(cmom_lo + l, k, j, i) = gdet * src_mom; } // energy source term @@ -610,21 +606,21 @@ TaskStatus CalculateFluidSourceTerms(MeshBlockData *rc, for (int m = 0; m < ND; m++) { Ta += Tmunu[m][0] * da[m]; } - src(fluid_cons::energy(), k, j, i) = gdet * alpha * (Ta - TGam); + src(ceng, k, j, i) = gdet * alpha * (Ta - TGam); #else SPACETIMELOOP2(mu, nu) { TGam += Tmunu[mu][nu] * gam[nu][0][mu]; } - src(fluid_cons::energy(), k, j, i) = gdet * TGam; + src(ceng, k, j, i) = gdet * TGam; #endif // USE_VALENCIA } #if SET_FLUX_SRC_DIAGS - src(diag::src_terms(0), k, j, i) = 0.0; - src(diag::src_terms(1), k, j, i) = src(c::momentum(0), k, j, i); - src(diag::src_terms(2), k, j, i) = src(c::momentum(1), k, j, i); - src(diag::src_terms(3), k, j, i) = src(c::momentum(2), k, j, i); - src(diag::src_terms(4), k, j, i) = src(c::energy(), k, j, i); + src(idiag, k, j, i) = 0.0; + src(idiag + 1, k, j, i) = src(cmom_lo, k, j, i); + src(idiag + 2, k, j, i) = src(cmom_lo + 1, k, j, i); + src(idiag + 3, k, j, i) = src(cmom_lo + 2, k, j, i); + src(idiag + 4, k, j, i) = src(ceng, k, j, i); #endif }); diff --git a/src/phoebus_utils/variables.hpp b/src/phoebus_utils/variables.hpp index 98c287418..85867f820 100644 --- a/src/phoebus_utils/variables.hpp +++ b/src/phoebus_utils/variables.hpp @@ -14,106 +14,86 @@ #ifndef PHOEBUS_UTILS_VARIABLES_HPP_ #define PHOEBUS_UTILS_VARIABLES_HPP_ -#include - -#define VARIABLE(ns, varname) \ - struct varname : public parthenon::variable_names::base_t { \ - template \ - KOKKOS_INLINE_FUNCTION varname(Ts &&...args) \ - : parthenon::variable_names::base_t(std::forward(args)...) {} \ - static std::string name() { return #ns "." #varname; } \ - } - -#define VARIABLE_NONS(varname) \ - struct varname : public parthenon::variable_names::base_t { \ - template \ - KOKKOS_INLINE_FUNCTION varname(Ts &&...args) \ - : parthenon::variable_names::base_t(std::forward(args)...) {} \ - static std::string name() { return #varname; } \ - } - namespace fluid_prim { -VARIABLE(p, density); -VARIABLE(p, velocity); -VARIABLE(p, energy); -VARIABLE(p, bfield); -VARIABLE(p, ye); -VARIABLE_NONS(pressure); -VARAIBLE_NONS(temperature); -VARIABLE_NONS(gamma1); +constexpr char density[] = "p.density"; +constexpr char velocity[] = "p.velocity"; +constexpr char energy[] = "p.energy"; +constexpr char bfield[] = "p.bfield"; +constexpr char ye[] = "p.ye"; +constexpr char pressure[] = "pressure"; +constexpr char temperature[] = "temperature"; +constexpr char gamma1[] = "gamma1"; } // namespace fluid_prim namespace fluid_cons { -VARIABLE(c, density); -VARIABLE(c, momentum); -VARIABLE(c, energy); -VARIABLE(c, bfield); -VARIABLE(c, ye); +constexpr char density[] = "c.density"; +constexpr char momentum[] = "c.momentum"; +constexpr char energy[] = "c.energy"; +constexpr char bfield[] = "c.bfield"; +constexpr char ye[] = "c.ye"; } // namespace fluid_cons namespace radmoment_prim { -VARIABLE(r, p.J); -VARIABLE(r, p.H); +constexpr char J[] = "r.p.J"; +constexpr char H[] = "r.p.H"; } // namespace radmoment_prim namespace radmoment_cons { -VARIABLE(r, c.E); -VARIABLE(r, c.F); +constexpr char E[] = "r.c.E"; +constexpr char F[] = "r.c.F"; } // namespace radmoment_cons namespace radmoment_internal { -VARIABLE(r, i.xi); -VARIABLE(r, i.phi); -VARIABLE(r, i.ql); -VARIABLE(r, i.qr); -VARIABLE(r, i.ql_v); -VARIABLE(r, i.qr_v); -VARIABLE(r, i.dJ); -VARIABLE(r, i.kappaJ); -VARIABLE(r, i.kappaH); -VARIABLE(r, i.JBB); -VARIABLE(r, i.tilPi); -VARIABLE(r, i.kappaH_mean); -VARIABLE(r, i.c2p_fail); -VARIABLE(r, i.src_fail); +constexpr char xi[] = "r.i.xi"; +constexpr char phi[] = "r.i.phi"; +constexpr char ql[] = "r.i.ql"; +constexpr char qr[] = "r.i.qr"; +constexpr char ql_v[] = "r.i.ql_v"; +constexpr char qr_v[] = "r.i.qr_v"; +constexpr char dJ[] = "r.i.dJ"; +constexpr char kappaJ[] = "r.i.kappaJ"; +constexpr char kappaH[] = "r.i.kappaH"; +constexpr char JBB[] = "r.i.JBB"; +constexpr char tilPi[] = "r.i.tilPi"; +constexpr char kappaH_mean[] = "r.i.kappaH_mean"; +constexpr char c2pfail[] = "r.i.c2p_fail"; +constexpr char srcfail[] = "r.i.src_fail"; } // namespace radmoment_internal namespace mocmc_internal { -VARIABLE(mocmc, i.dnsamp); -VARIABLE(mocmc, i.inu0); -VARIABLE(mocmc, i.inu1); -VARIABLE(mocmc, i.jinvs); +constexpr char dnsamp[] = "mocmc.i.dnsamp"; +constexpr char Inu0[] = "mocmc.i.inu0"; +constexpr char Inu1[] = "mocmc.i.inu1"; +constexpr char jinvs[] = "mocmc.i.jinvs"; } // namespace mocmc_internal namespace internal_variables { -VARIABLE_NONS(face_signal_speed); -VARIABLE_NONS(cell_signal_speed); -VARIABLE_NONS(emf); -VARIABLE_NONS(c2p_scratch); -VARIABLE_NONS(ql); -VARIABLE_NONS(qr); -VARIABLE_NONS(fail); -VARIABLE_NONS(Gcov); -VARIABLE_NONS(Gye); -VARIABLE_NONS(c2p_mu); -VARIABLE_NONS(light_bulb_tau); -VARIABLE_NONS(GcovHeat); -VARIABLE_NONS(GcovCool); +constexpr char face_signal_speed[] = "face_signal_speed"; +constexpr char cell_signal_speed[] = "cell_signal_speed"; +constexpr char emf[] = "emf"; +constexpr char c2p_scratch[] = "c2p_scratch"; +constexpr char ql[] = "ql"; +constexpr char qr[] = "qr"; +constexpr char fail[] = "fail"; +constexpr char Gcov[] = "Gcov"; +constexpr char Gye[] = "Gye"; +constexpr char c2p_mu[] = "c2p_mu"; +constexpr char tau[] = "light_bulb_tau"; +constexpr char GcovHeat[] = "GcovHeat"; +constexpr char GcovCool[] = "GcovCool"; } // namespace internal_variables namespace geometric_variables { -VARIABLE(g, c.coord); -VARIABLE(g, n.coord); +constexpr char cell_coords[] = "g.c.coord"; +constexpr char node_coords[] = "g.n.coord"; } // namespace geometric_variables namespace diagnostic_variables { -VARIABLE_NONS(divb); -VARIABLE_NONS(flux_divergence); -VARIABLE_NONS(src_terms); -VARIABLE(r, flux_divergence); -VARIABLE(r, src_terms); +constexpr char divb[] = "divb"; +constexpr char divf[] = "flux_divergence"; +constexpr char src_terms[] = "src_terms"; +constexpr char r_divf[] = "r.flux_divergence"; +constexpr char r_src_terms[] = "r.src_terms"; } // namespace diagnostic_variables -#undef VARIABLE - #endif // PHOEBUS_UTILS_VARIABLES_HPP_ From ee84cbd719ed9b2a013fc1c7406c3ff53961b907 Mon Sep 17 00:00:00 2001 From: Jonah Maxwell Miller Date: Tue, 5 Dec 2023 16:48:25 -0700 Subject: [PATCH 03/14] moved density to new parthen variables machinery. updated parthenon and changed all the references to GetParentPointer that I needed to. --- external/parthenon | 2 +- src/analysis/history.cpp | 32 +++--- src/fixup/fixup.cpp | 36 +++---- src/fixup/fixup_c2p.cpp | 36 +++---- src/fixup/fixup_netfield.cpp | 10 +- src/fixup/fixup_radc2p.cpp | 30 +++--- src/fixup/fixup_src.cpp | 40 ++++---- src/fluid/con2prim.hpp | 5 +- src/fluid/con2prim_robust.hpp | 6 +- src/fluid/fluid.cpp | 99 ++++++++++--------- src/fluid/fluid.hpp | 6 +- src/fluid/riemann.hpp | 25 +++-- src/fluid/tmunu.hpp | 8 +- src/geometry/boosted_minkowski.cpp | 4 +- src/geometry/boyer_lindquist.cpp | 4 +- src/geometry/cached_system.hpp | 6 +- src/geometry/flrw.cpp | 4 +- src/geometry/fmks.cpp | 4 +- src/geometry/geometry.cpp | 6 +- src/geometry/inchworm.cpp | 4 +- src/geometry/monopole.cpp | 12 +-- src/geometry/snake.cpp | 4 +- src/geometry/spherical_kerr_schild.cpp | 4 +- src/monopole_gr/interp_3d_to_1d.hpp | 2 +- src/monopole_gr/monopole_gr.cpp | 14 +-- src/pgen/advection.cpp | 11 ++- src/pgen/blandford_mckee.cpp | 11 ++- src/pgen/bondi.cpp | 11 ++- src/pgen/friedmann.cpp | 11 ++- src/pgen/homogeneous_sphere.cpp | 9 +- src/pgen/kh.cpp | 11 ++- src/pgen/leptoneq.cpp | 8 +- src/pgen/linear_modes.cpp | 4 +- src/pgen/p2c2p.cpp | 11 ++- src/pgen/progenitor.cpp | 11 ++- src/pgen/radiation_advection.cpp | 10 +- src/pgen/radiation_equilibration.cpp | 4 +- src/pgen/rhs_tester.cpp | 11 ++- src/pgen/rotor.cpp | 11 ++- src/pgen/sedov.cpp | 11 ++- src/pgen/shock_tube.cpp | 11 ++- src/pgen/thin_cooling.cpp | 8 +- src/pgen/torus.cpp | 10 +- src/pgen/tov.cpp | 11 ++- src/phoebus_boundaries/phoebus_boundaries.cpp | 28 +++--- src/phoebus_utils/grid_utils.hpp | 12 +++ src/phoebus_utils/variables.hpp | 21 +++- src/radiation/cooling_function.cpp | 44 ++++----- src/radiation/mocmc.cpp | 23 ++--- src/radiation/moments.cpp | 55 +++++------ src/radiation/moments_source.cpp | 15 +-- src/radiation/monte_carlo.cpp | 19 ++-- src/radiation/radiation.cpp | 7 +- src/tov/tov.cpp | 2 +- 54 files changed, 428 insertions(+), 386 deletions(-) diff --git a/external/parthenon b/external/parthenon index ec2d945f6..a540d3976 160000 --- a/external/parthenon +++ b/external/parthenon @@ -1 +1 @@ -Subproject commit ec2d945f6886604bef4447555568cb0845e98be5 +Subproject commit a540d39766022b9fccc2f48cc9263efc8717d663 diff --git a/src/analysis/history.cpp b/src/analysis/history.cpp index 4f1c64e51..ab3733521 100644 --- a/src/analysis/history.cpp +++ b/src/analysis/history.cpp @@ -24,17 +24,17 @@ Real ReduceMassAccretionRate(MeshData *md) { const auto jb = md->GetBoundsJ(IndexDomain::interior); const auto kb = md->GetBoundsK(IndexDomain::interior); - auto pmb = md->GetParentPointer(); - auto &pars = pmb->packages.Get("geometry")->AllParams(); + Mesh *pmesh = md->GetMeshPointer(); + auto &pars = pmesh->packages.Get("geometry")->AllParams(); const Real xh = pars.Get("xh"); namespace p = fluid_prim; - const std::vector vars({p::density, p::velocity}); + const std::vector vars({p::density::name(), p::velocity}); PackIndexMap imap; auto pack = md->PackVariables(vars, imap); - const int prho = imap[p::density].first; + const int prho = imap[p::density::name()].first; const int pvel_lo = imap[p::velocity].first; const int pvel_hi = imap[p::velocity].second; @@ -73,17 +73,17 @@ Real ReduceJetEnergyFlux(MeshData *md) { const auto jb = md->GetBoundsJ(IndexDomain::interior); const auto kb = md->GetBoundsK(IndexDomain::interior); - auto pmb = md->GetParentPointer(); - auto &pars = pmb->packages.Get("geometry")->AllParams(); + Mesh *pmesh = md->GetMeshPointer(); + auto &pars = pmesh->packages.Get("geometry")->AllParams(); const Real xh = pars.Get("xh"); namespace p = fluid_prim; - const std::vector vars({p::density, p::bfield, p::velocity}); + const std::vector vars({p::density::name(), p::bfield, p::velocity}); PackIndexMap imap; auto pack = md->PackVariables(vars, imap); - const int prho = imap[p::density].first; + const int prho = imap[p::density::name()].first; const int pvel_lo = imap[p::velocity].first; const int pvel_hi = imap[p::velocity].second; const int pb_lo = imap[p::bfield].first; @@ -91,7 +91,7 @@ Real ReduceJetEnergyFlux(MeshData *md) { auto geom = Geometry::GetCoordinateSystem(md); - const Real sigma_cutoff = pmb->packages.Get("fluid")->Param("sigma_cutoff"); + const Real sigma_cutoff = pmesh->packages.Get("fluid")->Param("sigma_cutoff"); Real result = 0.0; parthenon::par_reduce( @@ -132,17 +132,17 @@ Real ReduceJetMomentumFlux(MeshData *md) { const auto jb = md->GetBoundsJ(IndexDomain::interior); const auto kb = md->GetBoundsK(IndexDomain::interior); - auto pmb = md->GetParentPointer(); - auto &pars = pmb->packages.Get("geometry")->AllParams(); + Mesh *pmesh = md->GetMeshPointer(); + auto &pars = pmesh->packages.Get("geometry")->AllParams(); const Real xh = pars.Get("xh"); namespace p = fluid_prim; - const std::vector vars({p::density, p::bfield, p::velocity}); + const std::vector vars({p::density::name(), p::bfield, p::velocity}); PackIndexMap imap; auto pack = md->PackVariables(vars, imap); - const int prho = imap[p::density].first; + const int prho = imap[p::density::name()].first; const int pvel_lo = imap[p::velocity].first; const int pvel_hi = imap[p::velocity].second; const int pb_lo = imap[p::bfield].first; @@ -150,7 +150,7 @@ Real ReduceJetMomentumFlux(MeshData *md) { auto geom = Geometry::GetCoordinateSystem(md); - const Real sigma_cutoff = pmb->packages.Get("fluid")->Param("sigma_cutoff"); + const Real sigma_cutoff = pmesh->packages.Get("fluid")->Param("sigma_cutoff"); Real result = 0.0; parthenon::par_reduce( @@ -191,8 +191,8 @@ Real ReduceMagneticFluxPhi(MeshData *md) { const auto jb = md->GetBoundsJ(IndexDomain::interior); const auto kb = md->GetBoundsK(IndexDomain::interior); - auto pmb = md->GetParentPointer(); - auto &pars = pmb->packages.Get("geometry")->AllParams(); + Mesh *pmesh = md->GetMeshPointer(); + auto &pars = pmesh->packages.Get("geometry")->AllParams(); const Real xh = pars.Get("xh"); namespace c = fluid_cons; diff --git a/src/fixup/fixup.cpp b/src/fixup/fixup.cpp index 2eb4d74ee..1999f08ac 100644 --- a/src/fixup/fixup.cpp +++ b/src/fixup/fixup.cpp @@ -288,15 +288,15 @@ TaskStatus ApplyFloorsImpl(T *rc, IndexDomain domain = IndexDomain::entire) { namespace cr = radmoment_cons; namespace ir = radmoment_internal; namespace impl = internal_variables; - auto *pmb = rc->GetParentPointer().get(); - IndexRange ib = pmb->cellbounds.GetBoundsI(domain); - IndexRange jb = pmb->cellbounds.GetBoundsJ(domain); - IndexRange kb = pmb->cellbounds.GetBoundsK(domain); + auto *pmesh = rc->GetMeshPointer(); + IndexRange ib = rc->GetBoundsI(domain); + IndexRange jb = rc->GetBoundsJ(domain); + IndexRange kb = rc->GetBoundsK(domain); - StateDescriptor *fix_pkg = pmb->packages.Get("fixup").get(); - StateDescriptor *eos_pkg = pmb->packages.Get("eos").get(); - StateDescriptor *fluid_pkg = pmb->packages.Get("fluid").get(); - StateDescriptor *rad_pkg = pmb->packages.Get("radiation").get(); + StateDescriptor *fix_pkg = pmesh->packages.Get("fixup").get(); + StateDescriptor *eos_pkg = pmesh->packages.Get("eos").get(); + StateDescriptor *fluid_pkg = pmesh->packages.Get("fluid").get(); + StateDescriptor *rad_pkg = pmesh->packages.Get("radiation").get(); bool rad_active = rad_pkg->Param("active"); @@ -307,14 +307,14 @@ TaskStatus ApplyFloorsImpl(T *rc, IndexDomain domain = IndexDomain::entire) { if (!enable_floors) return TaskStatus::complete; const std::vector vars( - {p::density, c::density, p::velocity, c::momentum, p::energy, c::energy, p::bfield, - 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::density::name(), c::density, p::velocity, c::momentum, p::energy, c::energy, + p::bfield, 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}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); - const int prho = imap[p::density].first; + const int prho = imap[p::density::name()].first; const int crho = imap[c::density].first; const int pvel_lo = imap[p::velocity].first; const int pvel_hi = imap[p::velocity].second; @@ -352,7 +352,7 @@ TaskStatus ApplyFloorsImpl(T *rc, IndexDomain domain = IndexDomain::entire) { c2p_floor_scale_fac, c2p_fail_on_floors, c2p_fail_on_ceilings); - Coordinates_t coords = rc->GetParentPointer().get()->coords; + Coordinates_t coords = rc->GetParentPointer()->coords; parthenon::par_for( DEFAULT_LOOP_PATTERN, "ApplyFloors", DevExecSpace(), 0, v.GetDim(5) - 1, kb.s, kb.e, @@ -673,7 +673,7 @@ TaskStatus ApplyFloorsImpl(T *rc, IndexDomain domain = IndexDomain::entire) { template TaskStatus ApplyFloors(T *rc) { - auto *pm = rc->GetParentPointer().get(); + auto *pm = rc->GetMeshPointer(); StateDescriptor *rad_pkg = pm->packages.Get("radiation").get(); StateDescriptor *fix_pkg = pm->packages.Get("fixup").get(); const bool enable_rad_floors = fix_pkg->Param("enable_rad_floors"); @@ -706,7 +706,7 @@ template TaskStatus ApplyFloors>(MeshBlockData *rc); TaskStatus FixFluxes(MeshBlockData *rc) { using parthenon::BoundaryFace; using parthenon::BoundaryFlag; - auto *pmb = rc->GetParentPointer().get(); + auto *pmb = rc->GetParentPointer(); auto &fixup_pkg = pmb->packages.Get("fixup"); if (!fixup_pkg->Param("enable_flux_fixup")) return TaskStatus::complete; @@ -723,9 +723,9 @@ TaskStatus FixFluxes(MeshBlockData *rc) { } auto moments_active = rad->Param("moments_active"); - IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::interior); - IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); - IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); + IndexRange ib = rc->GetBoundsI(IndexDomain::interior); + IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); + IndexRange kb = rc->GetBoundsK(IndexDomain::interior); const int ndim = pmb->pmy_mesh->ndim; namespace p = fluid_prim; diff --git a/src/fixup/fixup_c2p.cpp b/src/fixup/fixup_c2p.cpp index 5a110a070..698eaa46e 100644 --- a/src/fixup/fixup_c2p.cpp +++ b/src/fixup/fixup_c2p.cpp @@ -49,17 +49,17 @@ TaskStatus ConservedToPrimitiveFixupImpl(T *rc) { namespace ir = radmoment_internal; namespace pr = radmoment_prim; namespace cr = radmoment_cons; - auto *pmb = rc->GetParentPointer().get(); - IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::interior); - IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); - IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); + Mesh *pmesh = rc->GetMeshPointer(); + IndexRange ib = rc->GetBoundsI(IndexDomain::interior); + IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); + IndexRange kb = rc->GetBoundsK(IndexDomain::interior); - StateDescriptor *fix_pkg = pmb->packages.Get("fixup").get(); - StateDescriptor *fluid_pkg = pmb->packages.Get("fluid").get(); - StateDescriptor *rad_pkg = pmb->packages.Get("radiation").get(); - StateDescriptor *eos_pkg = pmb->packages.Get("eos").get(); + StateDescriptor *fix_pkg = pmesh->packages.Get("fixup").get(); + StateDescriptor *fluid_pkg = pmesh->packages.Get("fluid").get(); + StateDescriptor *rad_pkg = pmesh->packages.Get("radiation").get(); + StateDescriptor *eos_pkg = pmesh->packages.Get("eos").get(); - const std::vector vars({p::density, + const std::vector vars({p::density::name(), c::density, p::velocity, c::momentum, @@ -85,7 +85,7 @@ TaskStatus ConservedToPrimitiveFixupImpl(T *rc) { PackIndexMap imap; auto v = rc->PackVariables(vars, imap); - const int prho = imap[p::density].first; + const int prho = imap[p::density::name()].first; const int crho = imap[c::density].first; const int pvel_lo = imap[p::velocity].first; const int pvel_hi = imap[p::velocity].second; @@ -134,9 +134,9 @@ TaskStatus ConservedToPrimitiveFixupImpl(T *rc) { }, Kokkos::Sum(nfail_total)); printf("total nfail: %i\n", nfail_total); - IndexRange ibi = pmb->cellbounds.GetBoundsI(IndexDomain::interior); - IndexRange jbi = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); - IndexRange kbi = pmb->cellbounds.GetBoundsK(IndexDomain::interior); + IndexRange ibi = rc->GetBoundsI(IndexDomain::interior); + IndexRange jbi = rc->GetBoundsJ(IndexDomain::interior); + IndexRange kbi = rc->GetBoundsK(IndexDomain::interior); nfail_total = 0; parthenon::par_reduce( parthenon::loop_pattern_mdrange_tag, "Rad ConToPrim::Solve fixup failures", @@ -150,13 +150,13 @@ TaskStatus ConservedToPrimitiveFixupImpl(T *rc) { printf("total interior nfail: %i\n", nfail_total); } - const int ndim = pmb->pmy_mesh->ndim; + const int ndim = pmesh->ndim; auto eos = eos_pkg->Param("d.EOS"); auto geom = Geometry::GetCoordinateSystem(rc); auto bounds = fix_pkg->Param("bounds"); - Coordinates_t coords = rc->GetParentPointer().get()->coords; + Coordinates_t coords = rc->GetParentPointer()->coords; auto fluid_c2p_failure_strategy = fix_pkg->Param("fluid_c2p_failure_strategy"); @@ -356,9 +356,9 @@ TaskStatus ConservedToPrimitiveFixupImpl(T *rc) { template TaskStatus ConservedToPrimitiveFixup(T *rc) { - auto *pm = rc->GetParentPointer().get(); - StateDescriptor *rad_pkg = pm->packages.Get("radiation").get(); - StateDescriptor *fix_pkg = pm->packages.Get("fixup").get(); + Mesh *pmesh = rc->GetMeshPointer(); + StateDescriptor *rad_pkg = pmesh->packages.Get("radiation").get(); + StateDescriptor *fix_pkg = pmesh->packages.Get("fixup").get(); const bool enable_rad_floors = fix_pkg->Param("enable_rad_floors"); std::string method; if (enable_rad_floors) { diff --git a/src/fixup/fixup_netfield.cpp b/src/fixup/fixup_netfield.cpp index c253145ff..c17098349 100644 --- a/src/fixup/fixup_netfield.cpp +++ b/src/fixup/fixup_netfield.cpp @@ -38,7 +38,7 @@ namespace fixup { TaskStatus SumMdotPhiForNetFieldScaling(MeshData *md, const Real t, const int stage, std::vector *sums) { - auto *pm = md->GetParentPointer(); + Mesh *pm = md->GetMeshPointer(); StateDescriptor *fix_pkg = pm->packages.Get("fixup").get(); const bool enable_phi_enforcement = fix_pkg->Param("enable_phi_enforcement"); @@ -64,7 +64,7 @@ TaskStatus SumMdotPhiForNetFieldScaling(MeshData *md, const Real t, const TaskStatus NetFieldStartReduce(MeshData *md, const Real t, const int stage, AllReduce> *net_field_totals) { - auto *pm = md->GetParentPointer(); + Mesh *pm = md->GetMeshPointer(); StateDescriptor *fix_pkg = pm->packages.Get("fixup").get(); const bool enable_phi_enforcement = fix_pkg->Param("enable_phi_enforcement"); @@ -88,7 +88,7 @@ TaskStatus NetFieldCheckReduce(MeshData *md, const Real t, const int stage return TaskStatus::complete; } - auto *pm = md->GetParentPointer(); + Mesh *pm = md->GetMeshPointer(); StateDescriptor *fix_pkg = pm->packages.Get("fixup").get(); const bool enable_phi_enforcement = fix_pkg->Param("enable_phi_enforcement"); @@ -112,7 +112,7 @@ TaskStatus UpdateNetFieldScaleControls(MeshData *md, const Real t, const R if (stage != 1) { return TaskStatus::complete; } - auto *pm = md->GetParentPointer(); + Mesh *pm = md->GetMeshPointer(); StateDescriptor *fix_pkg = pm->packages.Get("fixup").get(); const bool enable_phi_enforcement = fix_pkg->Param("enable_phi_enforcement"); @@ -158,7 +158,7 @@ TaskStatus ModifyNetField(MeshData *md, const Real t, const Real dt, if (stage != 1 && fiducial) { return TaskStatus::complete; } - auto *pm = md->GetParentPointer(); + Mesh *pm = md->GetMeshPointer(); StateDescriptor *fix_pkg = pm->packages.Get("fixup").get(); const bool enable_phi_enforcement = fix_pkg->Param("enable_phi_enforcement"); diff --git a/src/fixup/fixup_radc2p.cpp b/src/fixup/fixup_radc2p.cpp index 63d6c1da0..6cbd9f723 100644 --- a/src/fixup/fixup_radc2p.cpp +++ b/src/fixup/fixup_radc2p.cpp @@ -50,14 +50,14 @@ TaskStatus RadConservedToPrimitiveFixupImpl(T *rc) { namespace pr = radmoment_prim; namespace cr = radmoment_cons; - auto *pmb = rc->GetParentPointer().get(); - IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::interior); - IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); - IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); + Mesh *pmesh = rc->GetMeshPointer(); + IndexRange ib = rc->GetBoundsI(IndexDomain::interior); + IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); + IndexRange kb = rc->GetBoundsK(IndexDomain::interior); - StateDescriptor *fix_pkg = pmb->packages.Get("fixup").get(); - StateDescriptor *eos_pkg = pmb->packages.Get("eos").get(); - StateDescriptor *rad_pkg = pmb->packages.Get("radiation").get(); + StateDescriptor *fix_pkg = pmesh->packages.Get("fixup").get(); + StateDescriptor *eos_pkg = pmesh->packages.Get("eos").get(); + StateDescriptor *rad_pkg = pmesh->packages.Get("radiation").get(); bool enable_c2p_fixup = fix_pkg->Param("enable_c2p_fixup"); bool update_rad = rad_pkg->Param("active"); @@ -93,9 +93,9 @@ TaskStatus RadConservedToPrimitiveFixupImpl(T *rc) { }, Kokkos::Sum(nfail_total)); printf("total rad nfail: %i\n", nfail_total); - IndexRange ibi = pmb->cellbounds.GetBoundsI(IndexDomain::interior); - IndexRange jbi = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); - IndexRange kbi = pmb->cellbounds.GetBoundsK(IndexDomain::interior); + IndexRange ibi = rc->GetBoundsI(IndexDomain::interior); + IndexRange jbi = rc->GetBoundsJ(IndexDomain::interior); + IndexRange kbi = rc->GetBoundsK(IndexDomain::interior); nfail_total = 0; parthenon::par_reduce( parthenon::loop_pattern_mdrange_tag, "Rad ConToPrim::Solve fixup failures", @@ -112,10 +112,10 @@ TaskStatus RadConservedToPrimitiveFixupImpl(T *rc) { auto geom = Geometry::GetCoordinateSystem(rc); auto bounds = fix_pkg->Param("bounds"); - Coordinates_t coords = rc->GetParentPointer().get()->coords; + Coordinates_t coords = rc->GetParentPointer()->coords; const int nspec = idx_E.DimSize(1); - const int ndim = pmb->pmy_mesh->ndim; + const int ndim = pmesh->ndim; auto rad_c2p_failure_strategy = fix_pkg->Param("rad_c2p_failure_strategy"); @@ -223,9 +223,9 @@ TaskStatus RadConservedToPrimitiveFixupImpl(T *rc) { template TaskStatus RadConservedToPrimitiveFixup(T *rc) { - auto *pm = rc->GetParentPointer().get(); - StateDescriptor *rad_pkg = pm->packages.Get("radiation").get(); - StateDescriptor *fix_pkg = pm->packages.Get("fixup").get(); + Mesh *pmesh = rc->GetMeshPointer(); + StateDescriptor *rad_pkg = pmesh->packages.Get("radiation").get(); + StateDescriptor *fix_pkg = pmesh->packages.Get("fixup").get(); const bool enable_rad_floors = fix_pkg->Param("enable_rad_floors"); std::string method; if (enable_rad_floors) { diff --git a/src/fixup/fixup_src.cpp b/src/fixup/fixup_src.cpp index d235f9dba..32e3c47e2 100644 --- a/src/fixup/fixup_src.cpp +++ b/src/fixup/fixup_src.cpp @@ -55,14 +55,14 @@ TaskStatus SourceFixupImpl(T *rc) { namespace pr = radmoment_prim; namespace cr = radmoment_cons; namespace ir = radmoment_internal; - auto *pmb = rc->GetParentPointer().get(); - IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::interior); - IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); - IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); - - StateDescriptor *fix_pkg = pmb->packages.Get("fixup").get(); - StateDescriptor *eos_pkg = pmb->packages.Get("eos").get(); - StateDescriptor *rad_pkg = pmb->packages.Get("radiation").get(); + Mesh *pmesh = rc->GetMeshPointer(); + IndexRange ib = rc->GetBoundsI(IndexDomain::interior); + IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); + IndexRange kb = rc->GetBoundsK(IndexDomain::interior); + + StateDescriptor *fix_pkg = pmesh->packages.Get("fixup").get(); + StateDescriptor *eos_pkg = pmesh->packages.Get("eos").get(); + StateDescriptor *rad_pkg = pmesh->packages.Get("radiation").get(); if (!rad_pkg->Param("active")) { return TaskStatus::complete; } @@ -75,14 +75,14 @@ TaskStatus SourceFixupImpl(T *rc) { auto bounds = fix_pkg->Param("bounds"); const std::vector vars( - {p::density, c::density, p::velocity, c::momentum, p::energy, c::energy, p::bfield, - 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::density::name(), c::density, p::velocity, c::momentum, p::energy, c::energy, + p::bfield, 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}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); - const int prho = imap[p::density].first; + const int prho = imap[p::density::name()].first; const int crho = imap[c::density].first; auto idx_pvel = imap.GetFlatIdx(p::velocity); auto idx_cmom = imap.GetFlatIdx(c::momentum); @@ -119,17 +119,17 @@ TaskStatus SourceFixupImpl(T *rc) { printf("total source nfail: %i\n", nfail_total); } - const int ndim = pmb->pmy_mesh->ndim; + const int ndim = pmesh->ndim; auto geom = Geometry::GetCoordinateSystem(rc); - Coordinates_t coords = rc->GetParentPointer().get()->coords; + Coordinates_t coords = rc->GetParentPointer()->coords; auto num_species = rad_pkg->Param("num_species"); // TODO(BRR) make this less ugly - IndexRange ibe = pmb->cellbounds.GetBoundsI(IndexDomain::entire); - IndexRange jbe = pmb->cellbounds.GetBoundsJ(IndexDomain::entire); - IndexRange kbe = pmb->cellbounds.GetBoundsK(IndexDomain::entire); + IndexRange ibe = rc->GetBoundsI(IndexDomain::entire); + IndexRange jbe = rc->GetBoundsJ(IndexDomain::entire); + IndexRange kbe = rc->GetBoundsK(IndexDomain::entire); parthenon::par_for( DEFAULT_LOOP_PATTERN, "Source fail initialization", DevExecSpace(), 0, v.GetDim(5) - 1, kbe.s, kbe.e, jbe.s, jbe.e, ibe.s, ibe.e, @@ -323,9 +323,9 @@ TaskStatus SourceFixupImpl(T *rc) { template TaskStatus SourceFixup(T *rc) { - auto *pm = rc->GetParentPointer().get(); - StateDescriptor *rad_pkg = pm->packages.Get("radiation").get(); - StateDescriptor *fix_pkg = pm->packages.Get("fixup").get(); + Mesh *pmesh = rc->GetMeshPointer(); + StateDescriptor *rad_pkg = pmesh->packages.Get("radiation").get(); + StateDescriptor *fix_pkg = pmesh->packages.Get("fixup").get(); const bool enable_rad_floors = fix_pkg->Param("enable_rad_floors"); std::string method; if (enable_rad_floors) { diff --git a/src/fluid/con2prim.hpp b/src/fluid/con2prim.hpp index 0de536f51..0d3e3841b 100644 --- a/src/fluid/con2prim.hpp +++ b/src/fluid/con2prim.hpp @@ -130,7 +130,8 @@ class ConToPrim { ConToPrim(Data_t *rc, const Real tol, const int max_iterations) : ConToPrim(rc, PackIndexMap(), tol, max_iterations) {} ConToPrim(Data_t *rc, PackIndexMap imap, const Real tol, const int max_iterations) - : var(rc->PackVariables(Vars(), imap)), prho(imap[fluid_prim::density].first), + : var(rc->PackVariables(Vars(), imap)), + prho(imap[fluid_prim::density::name()].first), crho(imap[fluid_cons::density].first), pvel_lo(imap[fluid_prim::velocity].first), pvel_hi(imap[fluid_prim::velocity].second), cmom_lo(imap[fluid_cons::momentum].first), @@ -148,7 +149,7 @@ class ConToPrim { std::vector Vars() { return std::vector( - {fluid_prim::density, fluid_cons::density, fluid_prim::velocity, + {fluid_prim::density::name(), fluid_cons::density, fluid_prim::velocity, fluid_cons::momentum, fluid_prim::energy, fluid_cons::energy, fluid_prim::bfield, fluid_cons::bfield, fluid_prim::ye, fluid_cons::ye, fluid_prim::pressure, fluid_prim::temperature, internal_variables::cell_signal_speed, diff --git a/src/fluid/con2prim_robust.hpp b/src/fluid/con2prim_robust.hpp index be848f755..006fbdccc 100644 --- a/src/fluid/con2prim_robust.hpp +++ b/src/fluid/con2prim_robust.hpp @@ -228,8 +228,8 @@ class ConToPrim { const Real floor_scale_fac, const bool fail_on_floors, const bool fail_on_ceilings) : bounds(bnds), var(rc->PackVariables(Vars(), imap)), - prho(imap[fluid_prim::density].first), crho(imap[fluid_cons::density].first), - pvel_lo(imap[fluid_prim::velocity].first), + prho(imap[fluid_prim::density::name()].first), + crho(imap[fluid_cons::density].first), pvel_lo(imap[fluid_prim::velocity].first), pvel_hi(imap[fluid_prim::velocity].second), cmom_lo(imap[fluid_cons::momentum].first), cmom_hi(imap[fluid_cons::momentum].second), peng(imap[fluid_prim::energy].first), @@ -247,7 +247,7 @@ class ConToPrim { std::vector Vars() { return std::vector( - {fluid_prim::density, fluid_cons::density, fluid_prim::velocity, + {fluid_prim::density::name(), fluid_cons::density, fluid_prim::velocity, fluid_cons::momentum, fluid_prim::energy, fluid_cons::energy, fluid_prim::bfield, fluid_cons::bfield, fluid_prim::ye, fluid_cons::ye, fluid_prim::pressure, fluid_prim::temperature, internal_variables::cell_signal_speed, diff --git a/src/fluid/fluid.cpp b/src/fluid/fluid.cpp index daf9c479e..56c0f9753 100644 --- a/src/fluid/fluid.cpp +++ b/src/fluid/fluid.cpp @@ -189,7 +189,7 @@ std::shared_ptr Initialize(ParameterInput *pin) { ndim = 2; // add the primitive variables - physics->AddField(p::density, mprim_scalar); + physics->template AddField(mprim_scalar); physics->AddField(p::velocity, mprim_threev); physics->AddField(p::energy, mprim_scalar); if (mhd) { @@ -256,7 +256,7 @@ std::shared_ptr Initialize(ParameterInput *pin) { // set up the arrays for left and right states // add the base state for reconstruction/fluxes - std::vector rvars({p::density, p::velocity, p::energy}); + std::vector rvars({p::density::name(), p::velocity, p::energy}); riemann::FluxState::ReconVars(rvars); if (mhd) riemann::FluxState::ReconVars(p::bfield); if (ye) riemann::FluxState::ReconVars(p::ye); @@ -334,7 +334,7 @@ std::shared_ptr Initialize(ParameterInput *pin) { // template TaskStatus PrimitiveToConserved(MeshBlockData *rc) { - auto *pmb = rc->GetParentPointer().get(); + auto *pmb = rc->GetParentPointer(); IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::entire); IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::entire); IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::entire); @@ -347,16 +347,17 @@ TaskStatus PrimitiveToConservedRegion(MeshBlockData *rc, const IndexRange namespace p = fluid_prim; namespace c = fluid_cons; namespace impl = internal_variables; - auto *pmb = rc->GetParentPointer().get(); + auto *pmb = rc->GetParentPointer(); - const std::vector vars( - {p::density, c::density, p::velocity, c::momentum, p::energy, c::energy, p::bfield, - c::bfield, p::ye, c::ye, p::pressure, p::gamma1, impl::cell_signal_speed}); + const std::vector vars({p::density::name(), c::density, p::velocity, + c::momentum, p::energy, c::energy, p::bfield, + c::bfield, p::ye, c::ye, p::pressure, p::gamma1, + impl::cell_signal_speed}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); - const int prho = imap[p::density].first; + const int prho = imap[p::density::name()].first; const int crho = imap[c::density].first; const int pvel_lo = imap[p::velocity].first; const int pvel_hi = imap[p::velocity].second; @@ -438,25 +439,25 @@ TaskStatus PrimitiveToConservedRegion(MeshBlockData *rc, const IndexRange template TaskStatus ConservedToPrimitiveRegion(T *rc, const IndexRange &ib, const IndexRange &jb, const IndexRange &kb) { - auto *pmb = rc->GetParentPointer().get(); - StateDescriptor *pkg = pmb->packages.Get("fluid").get(); + Mesh *pm = rc->GetMeshPointer(); + StateDescriptor *pkg = pm->packages.Get("fluid").get(); auto c2p = pkg->Param>("c2p_func"); return c2p(rc, ib, jb, kb); } template TaskStatus ConservedToPrimitive(T *rc) { - auto *pmb = rc->GetParentPointer().get(); - IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::entire); - IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::entire); - IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::entire); + IndexRange ib = rc->GetBoundsI(IndexDomain::entire); + IndexRange jb = rc->GetBoundsJ(IndexDomain::entire); + IndexRange kb = rc->GetBoundsK(IndexDomain::entire); return ConservedToPrimitiveRegion(rc, ib, jb, kb); } template TaskStatus ConservedToPrimitiveRobust(T *rc, const IndexRange &ib, const IndexRange &jb, const IndexRange &kb) { - auto *pmb = rc->GetParentPointer().get(); + // TODO(JMM): This one will not work with meshblock packs + auto *pmb = rc->GetParentPointer(); StateDescriptor *fix_pkg = pmb->packages.Get("fixup").get(); auto bounds = fix_pkg->Param("bounds"); @@ -496,17 +497,17 @@ template TaskStatus ConservedToPrimitiveClassic(T *rc, const IndexRange &ib, const IndexRange &jb, const IndexRange &kb) { using namespace con2prim; - auto *pmb = rc->GetParentPointer().get(); + auto *pmesh = rc->GetMeshPointer(); - StateDescriptor *fix_pkg = pmb->packages.Get("fixup").get(); + StateDescriptor *fix_pkg = pmesh->packages.Get("fixup").get(); auto bounds = fix_pkg->Param("bounds"); - StateDescriptor *pkg = pmb->packages.Get("fluid").get(); + StateDescriptor *pkg = pmesh->packages.Get("fluid").get(); const Real c2p_tol = pkg->Param("c2p_tol"); const int c2p_max_iter = pkg->Param("c2p_max_iter"); auto invert = con2prim::ConToPrimSetup(rc, c2p_tol, c2p_max_iter); - StateDescriptor *eos_pkg = pmb->packages.Get("eos").get(); + StateDescriptor *eos_pkg = pmesh->packages.Get("eos").get(); auto eos = eos_pkg->Param("d.EOS"); auto geom = Geometry::GetCoordinateSystem(rc); auto fail = rc->Get(internal_variables::fail).data; @@ -543,14 +544,14 @@ TaskStatus CalculateFluidSourceTerms(MeshBlockData *rc, MeshBlockData *rc_src) { constexpr int ND = Geometry::NDFULL; constexpr int NS = Geometry::NDSPACE; - auto *pmb = rc->GetParentPointer().get(); - auto &fluid = pmb->packages.Get("fluid"); + Mesh *pmesh = rc->GetMeshPointer(); + auto &fluid = pmesh->packages.Get("fluid"); if (!fluid->Param("active") || fluid->Param("zero_sources")) return TaskStatus::complete; - IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::interior); - IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); - IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); + IndexRange ib = rc->GetBoundsI(IndexDomain::interior); + IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); + IndexRange kb = rc->GetBoundsK(IndexDomain::interior); std::vector vars({fluid_cons::momentum, fluid_cons::energy}); #if SET_FLUX_SRC_DIAGS @@ -634,24 +635,25 @@ TaskStatus CalculateFluidSourceTerms(MeshBlockData *rc, TaskStatus CalculateFluxes(MeshBlockData *rc) { using namespace PhoebusReconstruction; - auto *pmb = rc->GetParentPointer().get(); - auto &fluid = pmb->packages.Get("fluid"); + Mesh *pmesh = rc->GetMeshPointer(); + auto &fluid = pmesh->packages.Get("fluid"); if (!fluid->Param("active") || fluid->Param("zero_fluxes")) return TaskStatus::complete; auto flux = riemann::FluxState(rc); auto sig = rc->Get(internal_variables::face_signal_speed).data; - IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::interior); - IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); - IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); + IndexRange ib = rc->GetBoundsI(IndexDomain::interior); + IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); + IndexRange kb = rc->GetBoundsK(IndexDomain::interior); - const int ndim = pmb->pmy_mesh->ndim; + const int ndim = pmesh->ndim; const int dk = (ndim == 3 ? 1 : 0); const int dj = (ndim > 1 ? 1 : 0); const int nrecon = flux.ql.GetDim(4) - 1; - auto rt = pmb->packages.Get("fluid")->Param("Recon"); - auto st = pmb->packages.Get("fluid")->Param("RiemannSolver"); + auto rt = + pmesh->packages.Get("fluid")->Param("Recon"); + auto st = pmesh->packages.Get("fluid")->Param("RiemannSolver"); parthenon::par_for_outer( DEFAULT_OUTER_LOOP_PATTERN, "Reconstruct", DevExecSpace(), 0, 0, 0, nrecon, @@ -727,9 +729,9 @@ TaskStatus CalculateFluxes(MeshBlockData *rc) { #define FLUX(method) \ parthenon::par_for( \ - DEFAULT_LOOP_PATTERN, "CalculateFluxes", DevExecSpace(), X1DIR, \ - pmb->pmy_mesh->ndim, kb.s - dk, kb.e + dk, jb.s - dj, jb.e + dj, ib.s - 1, \ - ib.e + 1, KOKKOS_LAMBDA(const int d, const int k, const int j, const int i) { \ + DEFAULT_LOOP_PATTERN, "CalculateFluxes", DevExecSpace(), X1DIR, ndim, kb.s - dk, \ + kb.e + dk, jb.s - dj, jb.e + dj, ib.s - 1, ib.e + 1, \ + KOKKOS_LAMBDA(const int d, const int k, const int j, const int i) { \ sig(d - 1, k, j, i) = method(flux, d, k, j, i); \ }); switch (st) { @@ -748,17 +750,17 @@ TaskStatus CalculateFluxes(MeshBlockData *rc) { } TaskStatus FluxCT(MeshBlockData *rc) { - auto *pmb = rc->GetParentPointer().get(); - auto &fluid = pmb->packages.Get("fluid"); + Mesh *pmesh = rc->GetMeshPointer(); + auto &fluid = pmesh->packages.Get("fluid"); if (!fluid->Param("mhd") || !fluid->Param("active") || fluid->Param("zero_fluxes")) return TaskStatus::complete; - const int ndim = pmb->pmy_mesh->ndim; + const int ndim = pmesh->ndim; if (ndim == 1) return TaskStatus::complete; - IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::interior); - IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); - IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); + IndexRange ib = rc->GetBoundsI(IndexDomain::interior); + IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); + IndexRange kb = rc->GetBoundsK(IndexDomain::interior); auto f1 = rc->Get(fluid_cons::bfield).flux[X1DIR]; auto f2 = rc->Get(fluid_cons::bfield).flux[X2DIR]; @@ -810,15 +812,16 @@ TaskStatus FluxCT(MeshBlockData *rc) { } TaskStatus CalculateDivB(MeshBlockData *rc) { - auto pmb = rc->GetBlockPointer(); + auto *pmb = rc->GetParentPointer(); if (!pmb->packages.Get("fluid")->Param("active")) return TaskStatus::complete; if (!pmb->packages.Get("fluid")->Param("mhd")) return TaskStatus::complete; const int ndim = pmb->pmy_mesh->ndim; - IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::interior); - IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); - IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); + IndexRange ib = rc->GetBoundsI(IndexDomain::interior); + IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); + IndexRange kb = rc->GetBoundsK(IndexDomain::interior); + // This is the problem for doing things with meshblock packs auto coords = pmb->coords; auto b = rc->Get(fluid_cons::bfield).data; auto divb = rc->Get(diagnostic_variables::divb).data; @@ -866,9 +869,9 @@ TaskStatus CalculateDivB(MeshBlockData *rc) { Real EstimateTimestepBlock(MeshBlockData *rc) { auto pmb = rc->GetBlockPointer(); - IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::interior); - IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); - IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); + IndexRange ib = rc->GetBoundsI(IndexDomain::interior); + IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); + IndexRange kb = rc->GetBoundsK(IndexDomain::interior); auto &coords = pmb->coords; const int ndim = pmb->pmy_mesh->ndim; diff --git a/src/fluid/fluid.hpp b/src/fluid/fluid.hpp index a6e3ff9f8..533a14e11 100644 --- a/src/fluid/fluid.hpp +++ b/src/fluid/fluid.hpp @@ -62,8 +62,8 @@ using c2p_mesh_type = c2p_type>; #if SET_FLUX_SRC_DIAGS template TaskStatus CopyFluxDivergence(T *rc) { - auto pmb = rc->GetParentPointer(); - auto &fluid = pmb->packages.Get("fluid"); + Mesh *pm = rc->GetMeshPointer(); + auto &fluid = pm->packages.Get("fluid"); const Params ¶ms = fluid->AllParams(); if (!params.Get("active")) return TaskStatus::complete; @@ -85,7 +85,7 @@ TaskStatus CopyFluxDivergence(T *rc) { auto diag = rc->PackVariables(diag_vars, imap_diag); auto idx_r_divf = imap_diag.GetFlatIdx(diagnostic_variables::r_divf, false); - StateDescriptor *rad = pmb->packages.Get("radiation").get(); + StateDescriptor *rad = pm->packages.Get("radiation").get(); int num_species = 0; if (idx_E.IsValid()) { num_species = rad->Param("num_species"); diff --git a/src/fluid/riemann.hpp b/src/fluid/riemann.hpp index b5780a081..3f320fd70 100644 --- a/src/fluid/riemann.hpp +++ b/src/fluid/riemann.hpp @@ -215,20 +215,17 @@ class FluxState { : v(rc->PackVariablesAndFluxes(ReconVars(), FluxVars(), imap)), ql(rc->Get("ql").data), qr(rc->Get("qr").data), geom(Geometry::GetCoordinateSystem(rc)), - coords(rc->GetParentPointer().get()->coords), - bounds(rc->GetParentPointer() - .get() - ->packages.Get("fixup") - .get() - ->Param("bounds")), - prho(imap[fluid_prim::density].first), pvel_lo(imap[fluid_prim::velocity].first), - peng(imap[fluid_prim::energy].first), pb_lo(imap[fluid_prim::bfield].first), - pb_hi(imap[fluid_prim::bfield].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), - ceng(imap[fluid_cons::energy].first), cb_lo(imap[fluid_cons::bfield].first), - cb_hi(imap[fluid_cons::bfield].second), cye(imap[fluid_cons::ye].first), - ncons(5 + (pb_hi - pb_lo + 1) + (cye > 0)) { + coords(rc->GetParentPointer()->coords), // problem for packs + bounds(rc->GetParentPointer()->packages.Get("fixup").get()->Param( + "bounds")), + prho(imap[fluid_prim::density::name()].first), + pvel_lo(imap[fluid_prim::velocity].first), peng(imap[fluid_prim::energy].first), + pb_lo(imap[fluid_prim::bfield].first), pb_hi(imap[fluid_prim::bfield].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), ceng(imap[fluid_cons::energy].first), + cb_lo(imap[fluid_cons::bfield].first), cb_hi(imap[fluid_cons::bfield].second), + cye(imap[fluid_cons::ye].first), ncons(5 + (pb_hi - pb_lo + 1) + (cye > 0)) { PARTHENON_REQUIRE_THROWS( ncons <= NCONS_MAX, "ncons exceeds NCONS_MAX. Reconfigure to increase NCONS_MAX."); diff --git a/src/fluid/tmunu.hpp b/src/fluid/tmunu.hpp index 1bbdfa1e3..89cc36544 100644 --- a/src/fluid/tmunu.hpp +++ b/src/fluid/tmunu.hpp @@ -27,9 +27,9 @@ namespace fluid { -const std::vector TMUNU_VARS = {fluid_prim::density, fluid_prim::velocity, - fluid_prim::energy, fluid_prim::pressure, - fluid_prim::bfield}; +const std::vector TMUNU_VARS = {fluid_prim::density::name(), + fluid_prim::velocity, fluid_prim::energy, + fluid_prim::pressure, fluid_prim::bfield}; // Indices are upstairs template class StressEnergyTensorCon { @@ -46,7 +46,7 @@ class StressEnergyTensorCon { pack_ = rc->PackVariables(TMUNU_VARS, imap); system_ = Geometry::GetCoordinateSystem(rc); - ir_ = imap[fluid_prim::density].first; + ir_ = imap[fluid_prim::density::name()].first; iv_ = imap[fluid_prim::velocity].first; iu_ = imap[fluid_prim::energy].first; ip_ = imap[fluid_prim::pressure].first; diff --git a/src/geometry/boosted_minkowski.cpp b/src/geometry/boosted_minkowski.cpp index c4cc21f70..02c01b477 100644 --- a/src/geometry/boosted_minkowski.cpp +++ b/src/geometry/boosted_minkowski.cpp @@ -53,7 +53,7 @@ void Initialize(ParameterInput *pin, template <> BoostedMinkowskiMeshBlock GetCoordinateSystem(MeshBlockData *rc) { - auto &pkg = rc->GetParentPointer()->packages.Get("geometry"); + auto &pkg = rc->GetMeshPointer()->packages.Get("geometry"); auto indexer = GetIndexer(rc); Real vx = pkg->Param("vx"); Real vy = pkg->Param("vy"); @@ -63,7 +63,7 @@ GetCoordinateSystem(MeshBlockData *rc) { template <> BoostedMinkowskiMesh GetCoordinateSystem(MeshData *rc) { - auto &pkg = rc->GetParentPointer()->packages.Get("geometry"); + auto &pkg = rc->GetMeshPointer()->packages.Get("geometry"); auto indexer = GetIndexer(rc); Real vx = pkg->Param("vx"); Real vy = pkg->Param("vy"); diff --git a/src/geometry/boyer_lindquist.cpp b/src/geometry/boyer_lindquist.cpp index 91a50cfa5..7197ca391 100644 --- a/src/geometry/boyer_lindquist.cpp +++ b/src/geometry/boyer_lindquist.cpp @@ -47,7 +47,7 @@ void SetGeometry(MeshData *rc) {} template <> BoyerLindquistMeshBlock GetCoordinateSystem(MeshBlockData *rc) { - auto &pkg = rc->GetParentPointer()->packages.Get("geometry"); + auto &pkg = rc->GetMeshPointer()->packages.Get("geometry"); auto indexer = GetIndexer(rc); Real a = pkg->Param("a"); Real dxfd = pkg->Param("dxfd"); @@ -55,7 +55,7 @@ GetCoordinateSystem(MeshBlockData *rc) { } template <> BoyerLindquistMesh GetCoordinateSystem(MeshData *rc) { - auto &pkg = rc->GetParentPointer()->packages.Get("geometry"); + auto &pkg = rc->GetMeshPointer()->packages.Get("geometry"); auto indexer = GetIndexer(rc); Real a = pkg->Param("a"); Real dxfd = pkg->Param("dxfd"); diff --git a/src/geometry/cached_system.hpp b/src/geometry/cached_system.hpp index 6016ebf0b..94b96d89d 100644 --- a/src/geometry/cached_system.hpp +++ b/src/geometry/cached_system.hpp @@ -575,7 +575,7 @@ void InitializeCachedCoordinateSystem(ParameterInput *pin, StateDescriptor *geom template CachedOverMeshBlock GetCachedCoordinateSystem(MeshBlockData *rc) { auto system = GetCoordinateSystem(rc); - auto &pkg = rc->GetParentPointer()->packages.Get("geometry"); + auto &pkg = rc->GetMeshPointer()->packages.Get("geometry"); bool axisymmetric = pkg->Param("axisymmetric"); bool time_dependent = pkg->Param("time_dependent"); return CachedOverMeshBlock(rc, system, axisymmetric, time_dependent); @@ -583,7 +583,7 @@ CachedOverMeshBlock GetCachedCoordinateSystem(MeshBlockData *rc) { template CachedOverMesh GetCachedCoordinateSystem(MeshData *rc) { auto system = GetCoordinateSystem(rc); - auto &pkg = rc->GetParentPointer()->packages.Get("geometry"); + auto &pkg = rc->GetMeshPointer()->packages.Get("geometry"); bool axisymmetric = pkg->Param("axisymmetric"); bool time_dependent = pkg->Param("time_dependent"); return CachedOverMesh(rc, system, axisymmetric, time_dependent); @@ -591,7 +591,7 @@ CachedOverMesh GetCachedCoordinateSystem(MeshData *rc) { template void SetCachedCoordinateSystem(Data *rc) { - auto pparent = rc->GetParentPointer(); + Mesh *pparent = rc->GetMeshPointer(); auto system = GetCoordinateSystem(rc); auto &pkg = pparent->packages.Get("geometry"); diff --git a/src/geometry/flrw.cpp b/src/geometry/flrw.cpp index 034d644e2..db81fb468 100644 --- a/src/geometry/flrw.cpp +++ b/src/geometry/flrw.cpp @@ -55,7 +55,7 @@ void Initialize(ParameterInput *pin, StateDescriptor *geometry) template <> FLRWMeshBlock GetCoordinateSystem(MeshBlockData *rc) { - auto &pkg = rc->GetParentPointer()->packages.Get("geometry"); + auto &pkg = rc->GetMeshPointer()->packages.Get("geometry"); auto indexer = GetIndexer(rc); Real a0 = pkg->Param("a0"); Real dadt = pkg->Param("dadt"); @@ -65,7 +65,7 @@ FLRWMeshBlock GetCoordinateSystem(MeshBlockData *rc) { template <> FLRWMesh GetCoordinateSystem(MeshData *rc) { - auto &pkg = rc->GetParentPointer()->packages.Get("geometry"); + auto &pkg = rc->GetMeshPointer()->packages.Get("geometry"); auto indexer = GetIndexer(rc); Real a0 = pkg->Param("a0"); Real dadt = pkg->Param("dadt"); diff --git a/src/geometry/fmks.cpp b/src/geometry/fmks.cpp index a8bbe80f7..3eb727e12 100644 --- a/src/geometry/fmks.cpp +++ b/src/geometry/fmks.cpp @@ -93,7 +93,7 @@ void SetGeometry(MeshData *rc) {} template <> FMKSMeshBlock GetCoordinateSystem(MeshBlockData *rc) { - auto &pkg = rc->GetParentPointer()->packages.Get("geometry"); + auto &pkg = rc->GetMeshPointer()->packages.Get("geometry"); auto indexer = GetIndexer(rc); Real a = pkg->Param("a"); Real dxfd = pkg->Param("dxfd"); @@ -102,7 +102,7 @@ FMKSMeshBlock GetCoordinateSystem(MeshBlockData *rc) { } template <> FMKSMesh GetCoordinateSystem(MeshData *rc) { - auto &pkg = rc->GetParentPointer()->packages.Get("geometry"); + auto &pkg = rc->GetMeshPointer()->packages.Get("geometry"); auto indexer = GetIndexer(rc); Real a = pkg->Param("a"); Real dxfd = pkg->Param("dxfd"); diff --git a/src/geometry/geometry.cpp b/src/geometry/geometry.cpp index 1d7d3b2f3..163891420 100644 --- a/src/geometry/geometry.cpp +++ b/src/geometry/geometry.cpp @@ -109,7 +109,7 @@ CoordSysMesh GetCoordinateSystem(MeshData *rc) { void SetGeometryBlock(MeshBlock *pmb, ParameterInput *pin) { MeshBlockData *rc = pmb->meshblock_data.Get().get(); - auto *pparent = rc->GetParentPointer().get(); + Mesh *pparent = rc->GetMeshPointer(); StateDescriptor *pkg = pparent->packages.Get("geometry").get(); bool do_defaults = pkg->AllParams().Get("do_defaults", true); auto system = GetCoordinateSystem(rc); @@ -119,7 +119,7 @@ void SetGeometryBlock(MeshBlock *pmb, ParameterInput *pin) { template <> TaskStatus UpdateGeometry>(MeshBlockData *rc) { - auto *pparent = rc->GetParentPointer().get(); + Mesh *pparent = rc->GetMeshPointer(); StateDescriptor *pkg = pparent->packages.Get("geometry").get(); bool update_coords = pkg->AllParams().Get("update_coords", false); auto system = GetCoordinateSystem(rc); @@ -130,7 +130,7 @@ TaskStatus UpdateGeometry>(MeshBlockData *rc) { template <> TaskStatus UpdateGeometry>(MeshData *rc) { - auto *pparent = rc->GetParentPointer(); + Mesh *pparent = rc->GetMeshPointer(); StateDescriptor *pkg = pparent->packages.Get("geometry").get(); bool update_coords = pkg->AllParams().Get("update_coords", false); auto system = GetCoordinateSystem(rc); diff --git a/src/geometry/inchworm.cpp b/src/geometry/inchworm.cpp index a3824e707..6d50ed9b8 100644 --- a/src/geometry/inchworm.cpp +++ b/src/geometry/inchworm.cpp @@ -48,7 +48,7 @@ void SetGeometry(MeshData *rc) {} template <> InchwormMeshBlock GetCoordinateSystem(MeshBlockData *rc) { - auto &pkg = rc->GetParentPointer()->packages.Get("geometry"); + auto &pkg = rc->GetMeshPointer()->packages.Get("geometry"); auto indexer = GetIndexer(rc); Real a = pkg->Param("a"); Real k = pkg->Param("k"); @@ -56,7 +56,7 @@ InchwormMeshBlock GetCoordinateSystem(MeshBlockData *rc } template <> InchwormMesh GetCoordinateSystem(MeshData *rc) { - auto &pkg = rc->GetParentPointer()->packages.Get("geometry"); + auto &pkg = rc->GetMeshPointer()->packages.Get("geometry"); auto indexer = GetIndexer(rc); Real a = pkg->Param("a"); Real k = pkg->Param("k"); diff --git a/src/geometry/monopole.cpp b/src/geometry/monopole.cpp index 2123b541e..2ddfd0435 100644 --- a/src/geometry/monopole.cpp +++ b/src/geometry/monopole.cpp @@ -67,7 +67,7 @@ void SetGeometry(MeshData *rc) {} template <> MplSphMeshBlock GetCoordinateSystem(MeshBlockData *rc) { - auto &pkg = rc->GetParentPointer()->packages.Get("monopole_gr"); + auto &pkg = rc->GetMeshPointer()->packages.Get("monopole_gr"); auto ¶ms = pkg->AllParams(); auto enabled = params.Get("enable_monopole_gr"); PARTHENON_REQUIRE_THROWS(enabled, "MonopoleGR must be enabled for this metric"); @@ -82,7 +82,7 @@ MplSphMeshBlock GetCoordinateSystem(MeshBlockData *rc) { } template <> MplSphMesh GetCoordinateSystem(MeshData *rc) { - auto &pkg = rc->GetParentPointer()->packages.Get("monopole_gr"); + auto &pkg = rc->GetMeshPointer()->packages.Get("monopole_gr"); auto ¶ms = pkg->AllParams(); auto enabled = params.Get("enable_monopole_gr"); PARTHENON_REQUIRE_THROWS(enabled, "MonopoleGR must be enabled for this metric"); @@ -98,7 +98,7 @@ MplSphMesh GetCoordinateSystem(MeshData *rc) { template <> MplCartMeshBlock GetCoordinateSystem(MeshBlockData *rc) { - auto &pkg = rc->GetParentPointer()->packages.Get("monopole_gr"); + auto &pkg = rc->GetMeshPointer()->packages.Get("monopole_gr"); auto ¶ms = pkg->AllParams(); auto enabled = params.Get("enable_monopole_gr"); PARTHENON_REQUIRE_THROWS(enabled, "MonopoleGR must be enabled for this metric"); @@ -110,7 +110,7 @@ MplCartMeshBlock GetCoordinateSystem(MeshBlockData *rc) auto rgrid = params.Get("radius"); auto indexer = GetIndexer(rc); - auto &geom_pkg = rc->GetParentPointer()->packages.Get("geometry"); + auto &geom_pkg = rc->GetMeshPointer()->packages.Get("geometry"); Real dxfd = geom_pkg->Param("dxfd"); auto transformation = GetTransformation(pkg.get()); @@ -119,7 +119,7 @@ MplCartMeshBlock GetCoordinateSystem(MeshBlockData *rc) } template <> MplCartMesh GetCoordinateSystem(MeshData *rc) { - auto &pkg = rc->GetParentPointer()->packages.Get("monopole_gr"); + auto &pkg = rc->GetMeshPointer()->packages.Get("monopole_gr"); auto ¶ms = pkg->AllParams(); auto enabled = params.Get("enable_monopole_gr"); PARTHENON_REQUIRE_THROWS(enabled, "MonopoleGR must be enabled for this metric"); @@ -131,7 +131,7 @@ MplCartMesh GetCoordinateSystem(MeshData *rc) { auto rgrid = params.Get("radius"); auto indexer = GetIndexer(rc); - auto &geom_pkg = rc->GetParentPointer()->packages.Get("geometry"); + auto &geom_pkg = rc->GetMeshPointer()->packages.Get("geometry"); Real dxfd = geom_pkg->Param("dxfd"); auto transformation = GetTransformation(pkg.get()); diff --git a/src/geometry/snake.cpp b/src/geometry/snake.cpp index 8a16fd5ed..a42516a46 100644 --- a/src/geometry/snake.cpp +++ b/src/geometry/snake.cpp @@ -54,7 +54,7 @@ void SetGeometry(MeshData *rc) {} template <> SnakeMeshBlock GetCoordinateSystem(MeshBlockData *rc) { - auto &pkg = rc->GetParentPointer()->packages.Get("geometry"); + auto &pkg = rc->GetMeshPointer()->packages.Get("geometry"); auto indexer = GetIndexer(rc); Real a = pkg->Param("a"); Real k = pkg->Param("k"); @@ -64,7 +64,7 @@ SnakeMeshBlock GetCoordinateSystem(MeshBlockData *rc) { } template <> SnakeMesh GetCoordinateSystem(MeshData *rc) { - auto &pkg = rc->GetParentPointer()->packages.Get("geometry"); + auto &pkg = rc->GetMeshPointer()->packages.Get("geometry"); auto indexer = GetIndexer(rc); Real a = pkg->Param("a"); Real k = pkg->Param("k"); diff --git a/src/geometry/spherical_kerr_schild.cpp b/src/geometry/spherical_kerr_schild.cpp index f45664314..816bd8ca5 100644 --- a/src/geometry/spherical_kerr_schild.cpp +++ b/src/geometry/spherical_kerr_schild.cpp @@ -45,14 +45,14 @@ void SetGeometry(MeshData *rc) {} template <> SphericalKSMeshBlock GetCoordinateSystem(MeshBlockData *rc) { - auto &pkg = rc->GetParentPointer()->packages.Get("geometry"); + auto &pkg = rc->GetMeshPointer()->packages.Get("geometry"); auto indexer = GetIndexer(rc); Real a = pkg->Param("a"); return SphericalKSMeshBlock(indexer, a); } template <> SphericalKSMesh GetCoordinateSystem(MeshData *rc) { - auto &pkg = rc->GetParentPointer()->packages.Get("geometry"); + auto &pkg = rc->GetMeshPointer()->packages.Get("geometry"); auto indexer = GetIndexer(rc); Real a = pkg->Param("a"); return SphericalKSMesh(indexer, a); diff --git a/src/monopole_gr/interp_3d_to_1d.hpp b/src/monopole_gr/interp_3d_to_1d.hpp index d012256f6..483b6c6c0 100644 --- a/src/monopole_gr/interp_3d_to_1d.hpp +++ b/src/monopole_gr/interp_3d_to_1d.hpp @@ -67,7 +67,7 @@ TaskStatus InterpolateMatterTo1D(Data *rc) { using namespace impl; // Available in both mesh and meshblock - auto pparent = rc->GetParentPointer(); + Mesh *pparent = rc->GetMeshPointer(); std::shared_ptr const &pkg = pparent->packages.Get("monopole_gr"); auto ¶ms = pkg->AllParams(); diff --git a/src/monopole_gr/monopole_gr.cpp b/src/monopole_gr/monopole_gr.cpp index 6770c3088..a77058d15 100644 --- a/src/monopole_gr/monopole_gr.cpp +++ b/src/monopole_gr/monopole_gr.cpp @@ -242,12 +242,12 @@ Real EstimateTimeStep(StateDescriptor *pkg) { // Could template this but whatever. I'd only save like 4 lines. Real EstimateTimestepBlock(MeshBlockData *rc) { - auto pmb = rc->GetParentPointer(); - StateDescriptor *pkg = pmb->packages.Get("monopole_gr").get(); + Mesh *pmesh = rc->GetMeshPointer(); + StateDescriptor *pkg = pmesh->packages.Get("monopole_gr").get(); return EstimateTimeStep(pkg); } Real EstimateTimeStepMesh(MeshData *rc) { - auto pmesh = rc->GetParentPointer(); + Mesh *pmesh = rc->GetMeshPointer(); StateDescriptor *pkg = pmesh->packages.Get("monopole_gr").get(); return EstimateTimeStep(pkg); } @@ -666,7 +666,7 @@ void DumpHypersurface(const std::string &filename, Matter_host_t &matter, #ifndef PHOEBUS_IN_UNIT_TESTS template TaskStatus InterpMetricToGrid(T *rc) { - auto *pmb = rc->GetParentPointer().get(); + auto *pmb = rc->GetParentPointer(); StateDescriptor *pkg = pmb->packages.Get("monopole_gr").get(); auto ¶ms = pkg->AllParams(); @@ -681,9 +681,9 @@ TaskStatus InterpMetricToGrid(T *rc) { const bool is_monopole_sph = (typeid(PHOEBUS_GEOMETRY) == typeid(Geometry::MonopoleSph)); - IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::interior); - IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); - IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); + IndexRange ib = rc->GetBoundsI(IndexDomain::interior); + IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); + IndexRange kb = rc->GetBoundsK(IndexDomain::interior); parthenon::Coordinates_t coords = pmb->coords; using Transformation_t = Geometry::SphericalToCartesian; diff --git a/src/pgen/advection.cpp b/src/pgen/advection.cpp index 3380e18fa..f2ec10c14 100644 --- a/src/pgen/advection.cpp +++ b/src/pgen/advection.cpp @@ -26,12 +26,13 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables( - {fluid_prim::density, fluid_prim::velocity, fluid_prim::energy, fluid_prim::bfield, - fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1}, - imap); + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, + fluid_prim::pressure, fluid_prim::temperature, + fluid_prim::gamma1}, + imap); - const int irho = imap[fluid_prim::density].first; + const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity].first; const int ivhi = imap[fluid_prim::velocity].second; const int ieng = imap[fluid_prim::energy].first; diff --git a/src/pgen/blandford_mckee.cpp b/src/pgen/blandford_mckee.cpp index 1ee34003e..5a2669b74 100644 --- a/src/pgen/blandford_mckee.cpp +++ b/src/pgen/blandford_mckee.cpp @@ -31,12 +31,13 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables( - {fluid_prim::density, fluid_prim::velocity, fluid_prim::energy, fluid_prim::bfield, - fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1}, - imap); + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, + fluid_prim::pressure, fluid_prim::temperature, + fluid_prim::gamma1}, + imap); - const int irho = imap[fluid_prim::density].first; + const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity].first; const int ivhi = imap[fluid_prim::velocity].second; const int ieng = imap[fluid_prim::energy].first; diff --git a/src/pgen/bondi.cpp b/src/pgen/bondi.cpp index 4e4f088e7..15cee1f44 100644 --- a/src/pgen/bondi.cpp +++ b/src/pgen/bondi.cpp @@ -91,12 +91,13 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto rc = pmb->meshblock_data.Get().get(); PackIndexMap imap; - auto v = rc->PackVariables( - {fluid_prim::density, fluid_prim::velocity, fluid_prim::energy, fluid_prim::bfield, - fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1}, - imap); + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, + fluid_prim::pressure, fluid_prim::temperature, + fluid_prim::gamma1}, + imap); - const int irho = imap[fluid_prim::density].first; + const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity].first; const int ivhi = imap[fluid_prim::velocity].second; const int ieng = imap[fluid_prim::energy].first; diff --git a/src/pgen/friedmann.cpp b/src/pgen/friedmann.cpp index e1cfbc163..632433f80 100644 --- a/src/pgen/friedmann.cpp +++ b/src/pgen/friedmann.cpp @@ -36,11 +36,12 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables( - {fluid_prim::density, fluid_prim::velocity, fluid_prim::energy, fluid_prim::bfield, - fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1}, - imap); - const int irho = imap[fluid_prim::density].first; + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, + 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].first; const int ieng = imap[fluid_prim::energy].first; const int iye = imap[fluid_prim::ye].second; diff --git a/src/pgen/homogeneous_sphere.cpp b/src/pgen/homogeneous_sphere.cpp index 6497b90d1..c339df474 100644 --- a/src/pgen/homogeneous_sphere.cpp +++ b/src/pgen/homogeneous_sphere.cpp @@ -29,9 +29,10 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { PackIndexMap imap; auto v = rc->PackVariables( - std::vector({radmoment_prim::J, radmoment_prim::H, fluid_prim::density, - fluid_prim::temperature, fluid_prim::velocity, - radmoment_internal::xi, radmoment_internal::phi}), + std::vector({radmoment_prim::J, radmoment_prim::H, + fluid_prim::density::name(), fluid_prim::temperature, + fluid_prim::velocity, radmoment_internal::xi, + radmoment_internal::phi}), imap); auto idJ = imap.GetFlatIdx(radmoment_prim::J); @@ -39,7 +40,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto idv = imap.GetFlatIdx(fluid_prim::velocity); auto ixi = imap.GetFlatIdx(radmoment_internal::xi); auto iphi = imap.GetFlatIdx(radmoment_internal::phi); - const int prho = imap[fluid_prim::density].first; + const int prho = imap[fluid_prim::density::name()].first; const int pT = imap[fluid_prim::temperature].first; const auto specB = idJ.GetBounds(1); diff --git a/src/pgen/kh.cpp b/src/pgen/kh.cpp index 873b48067..d67e1cc79 100644 --- a/src/pgen/kh.cpp +++ b/src/pgen/kh.cpp @@ -26,12 +26,13 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables( - {fluid_prim::density, fluid_prim::velocity, fluid_prim::energy, fluid_prim::bfield, - fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1}, - imap); + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, + fluid_prim::pressure, fluid_prim::temperature, + fluid_prim::gamma1}, + imap); - const int irho = imap[fluid_prim::density].first; + const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity].first; const int ivhi = imap[fluid_prim::velocity].second; const int ieng = imap[fluid_prim::energy].first; diff --git a/src/pgen/leptoneq.cpp b/src/pgen/leptoneq.cpp index 19f853807..387d6dded 100644 --- a/src/pgen/leptoneq.cpp +++ b/src/pgen/leptoneq.cpp @@ -31,11 +31,11 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables( - {p::density, p::velocity, p::energy, p::ye, p::pressure, p::temperature, p::gamma1}, - imap); + auto v = rc->PackVariables({p::density::name(), p::velocity, p::energy, p::ye, + p::pressure, p::temperature, p::gamma1}, + imap); - const int irho = imap[p::density].first; + const int irho = imap[p::density::name()].first; const int ivlo = imap[p::velocity].first; const int ivhi = imap[p::velocity].second; const int ieng = imap[p::energy].first; diff --git a/src/pgen/linear_modes.cpp b/src/pgen/linear_modes.cpp index ef9daddd8..6a771121e 100644 --- a/src/pgen/linear_modes.cpp +++ b/src/pgen/linear_modes.cpp @@ -43,13 +43,13 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int ndim = pmb->pmy_mesh->ndim; PackIndexMap imap; - std::vector vars({fluid_prim::density, fluid_prim::velocity, + std::vector vars({fluid_prim::density::name(), fluid_prim::velocity, fluid_prim::energy, fluid_prim::bfield, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1, fluid_prim::ye}); auto v = rc->PackVariables(vars, imap); - const int irho = imap[fluid_prim::density].first; + const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity].first; const int ivhi = imap[fluid_prim::velocity].second; const int ieng = imap[fluid_prim::energy].first; diff --git a/src/pgen/p2c2p.cpp b/src/pgen/p2c2p.cpp index 8a9611500..4e18de781 100644 --- a/src/pgen/p2c2p.cpp +++ b/src/pgen/p2c2p.cpp @@ -73,12 +73,13 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables( - {fluid_prim::density, fluid_prim::velocity, fluid_prim::energy, fluid_prim::bfield, - fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1}, - imap); + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, + fluid_prim::pressure, fluid_prim::temperature, + fluid_prim::gamma1}, + imap); - const int irho = imap[fluid_prim::density].first; + const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity].first; const int ivhi = imap[fluid_prim::velocity].second; const int ieng = imap[fluid_prim::energy].first; diff --git a/src/pgen/progenitor.cpp b/src/pgen/progenitor.cpp index 0c6cda5d5..7fbae9bc1 100644 --- a/src/pgen/progenitor.cpp +++ b/src/pgen/progenitor.cpp @@ -35,11 +35,12 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto geom = Geometry::GetCoordinateSystem(rc.get()); PackIndexMap imap; - auto v = rc->PackVariables( - {fluid_prim::density, fluid_prim::velocity, fluid_prim::energy, fluid_prim::bfield, - fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1}, - imap); - const int irho = imap[fluid_prim::density].first; + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, + 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].first; const int ivhi = imap[fluid_prim::velocity].second; const int ieng = imap[fluid_prim::energy].first; diff --git a/src/pgen/radiation_advection.cpp b/src/pgen/radiation_advection.cpp index 6bdc2a140..3c32dccc8 100644 --- a/src/pgen/radiation_advection.cpp +++ b/src/pgen/radiation_advection.cpp @@ -28,10 +28,10 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { PackIndexMap imap; auto v = rc->PackVariables( - std::vector({radmoment_prim::J, radmoment_prim::H, fluid_prim::density, - fluid_prim::temperature, fluid_prim::energy, - fluid_prim::velocity, radmoment_internal::xi, - radmoment_internal::phi}), + std::vector({radmoment_prim::J, radmoment_prim::H, + fluid_prim::density::name(), fluid_prim::temperature, + fluid_prim::energy, fluid_prim::velocity, + radmoment_internal::xi, radmoment_internal::phi}), imap); auto idJ = imap.GetFlatIdx(radmoment_prim::J); @@ -39,7 +39,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto idv = imap.GetFlatIdx(fluid_prim::velocity); auto ixi = imap.GetFlatIdx(radmoment_internal::xi); auto iphi = imap.GetFlatIdx(radmoment_internal::phi); - const int prho = imap[fluid_prim::density].first; + const int prho = imap[fluid_prim::density::name()].first; const int pT = imap[fluid_prim::temperature].first; const int peng = imap[fluid_prim::energy].first; diff --git a/src/pgen/radiation_equilibration.cpp b/src/pgen/radiation_equilibration.cpp index 27dbb0bf0..359908715 100644 --- a/src/pgen/radiation_equilibration.cpp +++ b/src/pgen/radiation_equilibration.cpp @@ -33,7 +33,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { PackIndexMap imap; auto v = rc->PackVariables({radmoment_prim::J, radmoment_prim::H, radmoment_internal::xi, radmoment_internal::phi, - fluid_prim::density, fluid_prim::temperature, + fluid_prim::density::name(), fluid_prim::temperature, fluid_prim::pressure, fluid_prim::gamma1, fluid_prim::energy, fluid_prim::ye, fluid_prim::velocity}, imap); @@ -43,7 +43,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto ixi = imap.GetFlatIdx(radmoment_internal::xi); auto iphi = imap.GetFlatIdx(radmoment_internal::phi); - const int iRho = imap[fluid_prim::density].first; + const int iRho = imap[fluid_prim::density::name()].first; const int iT = imap[fluid_prim::temperature].first; const int iP = imap[fluid_prim::pressure].first; const int igm1 = imap[fluid_prim::gamma1].first; diff --git a/src/pgen/rhs_tester.cpp b/src/pgen/rhs_tester.cpp index 6e712dd2a..850f58356 100644 --- a/src/pgen/rhs_tester.cpp +++ b/src/pgen/rhs_tester.cpp @@ -20,12 +20,13 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables( - {fluid_prim::density, fluid_prim::velocity, fluid_prim::energy, fluid_prim::bfield, - fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1}, - imap); + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, + fluid_prim::pressure, fluid_prim::temperature, + fluid_prim::gamma1}, + imap); - const int irho = imap[fluid_prim::density].first; + const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity].first; const int ivhi = imap[fluid_prim::velocity].second; const int ieng = imap[fluid_prim::energy].first; diff --git a/src/pgen/rotor.cpp b/src/pgen/rotor.cpp index ac66315f2..6abda006f 100644 --- a/src/pgen/rotor.cpp +++ b/src/pgen/rotor.cpp @@ -32,12 +32,13 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables( - {fluid_prim::density, fluid_prim::velocity, fluid_prim::energy, fluid_prim::bfield, - fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1}, - imap); + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, + fluid_prim::pressure, fluid_prim::temperature, + fluid_prim::gamma1}, + imap); - const int irho = imap[fluid_prim::density].first; + const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity].first; const int ivhi = imap[fluid_prim::velocity].second; const int ieng = imap[fluid_prim::energy].first; diff --git a/src/pgen/sedov.cpp b/src/pgen/sedov.cpp index dab0853eb..95d123cfb 100644 --- a/src/pgen/sedov.cpp +++ b/src/pgen/sedov.cpp @@ -31,12 +31,13 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables( - {fluid_prim::density, fluid_prim::velocity, fluid_prim::energy, fluid_prim::bfield, - fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1}, - imap); + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, + fluid_prim::pressure, fluid_prim::temperature, + fluid_prim::gamma1}, + imap); - const int irho = imap[fluid_prim::density].first; + const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity].first; const int ivhi = imap[fluid_prim::velocity].second; const int ieng = imap[fluid_prim::energy].first; diff --git a/src/pgen/shock_tube.cpp b/src/pgen/shock_tube.cpp index 0db551501..4e38035e9 100644 --- a/src/pgen/shock_tube.cpp +++ b/src/pgen/shock_tube.cpp @@ -35,12 +35,13 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables( - {fluid_prim::density, fluid_prim::velocity, fluid_prim::energy, fluid_prim::bfield, - fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1}, - imap); + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, + fluid_prim::pressure, fluid_prim::temperature, + fluid_prim::gamma1}, + imap); - const int irho = imap[fluid_prim::density].first; + const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity].first; const int ivhi = imap[fluid_prim::velocity].second; const int ieng = imap[fluid_prim::energy].first; diff --git a/src/pgen/thin_cooling.cpp b/src/pgen/thin_cooling.cpp index b82d77e6f..4ac14c44f 100644 --- a/src/pgen/thin_cooling.cpp +++ b/src/pgen/thin_cooling.cpp @@ -31,11 +31,11 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables( - {p::density, p::velocity, p::energy, p::ye, p::pressure, p::temperature, p::gamma1}, - imap); + auto v = rc->PackVariables({p::density::name(), p::velocity, p::energy, p::ye, + p::pressure, p::temperature, p::gamma1}, + imap); - const int irho = imap[p::density].first; + const int irho = imap[p::density::name()].first; const int ivlo = imap[p::velocity].first; const int ivhi = imap[p::velocity].second; const int ieng = imap[p::energy].first; diff --git a/src/pgen/torus.cpp b/src/pgen/torus.cpp index 2efeb89ca..7859ef57c 100644 --- a/src/pgen/torus.cpp +++ b/src/pgen/torus.cpp @@ -138,13 +138,13 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { bool do_rad = rad_pkg->Param("active"); PackIndexMap imap; - auto v = rc->PackVariables({fluid_prim::density, fluid_prim::velocity, + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1, radmoment_prim::J, radmoment_prim::H}, imap); - const int irho = imap[fluid_prim::density].first; + const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity].first; const int ivhi = imap[fluid_prim::velocity].second; const int ieng = imap[fluid_prim::energy].first; @@ -679,11 +679,11 @@ void ComputeBetas(Mesh *pmesh, Real rho_min_bnorm, Real &beta_min_global, PackIndexMap imap; auto v = - rc->PackVariables({fluid_prim::density, fluid_prim::velocity, fluid_prim::bfield, - fluid_prim::pressure, radmoment_prim::J}, + rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + fluid_prim::bfield, fluid_prim::pressure, radmoment_prim::J}, imap); - const int irho = imap[fluid_prim::density].first; + const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity].first; const int ivhi = imap[fluid_prim::velocity].second; const int iblo = imap[fluid_prim::bfield].first; diff --git a/src/pgen/tov.cpp b/src/pgen/tov.cpp index 0a69b64c6..d56bc2b42 100644 --- a/src/pgen/tov.cpp +++ b/src/pgen/tov.cpp @@ -71,12 +71,13 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto geom = Geometry::GetCoordinateSystem(rc.get()); PackIndexMap imap; - auto v = rc->PackVariables( - {fluid_prim::density, fluid_prim::velocity, fluid_prim::energy, fluid_prim::bfield, - fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1}, - imap); + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, + fluid_prim::pressure, fluid_prim::temperature, + fluid_prim::gamma1}, + imap); - const int irho = imap[fluid_prim::density].first; + const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity].first; const int ivhi = imap[fluid_prim::velocity].second; const int ieng = imap[fluid_prim::energy].first; diff --git a/src/phoebus_boundaries/phoebus_boundaries.cpp b/src/phoebus_boundaries/phoebus_boundaries.cpp index decc5362f..c983257dd 100644 --- a/src/phoebus_boundaries/phoebus_boundaries.cpp +++ b/src/phoebus_boundaries/phoebus_boundaries.cpp @@ -80,7 +80,7 @@ void GenericBC(std::shared_ptr> &rc, bool coarse) { // needed because our conserved variables are densitized auto geom = Geometry::GetCoordinateSystem(rc.get()); - auto &fluid = rc->GetParentPointer()->packages.Get("fluid"); + auto &fluid = rc->GetMeshPointer()->packages.Get("fluid"); const bool rescale = fluid->Param("bc_vars") == "conserved"; // Do the thing @@ -113,7 +113,7 @@ void GenericBC(std::shared_ptr> &rc, bool coarse) { } void OutflowInnerX1(std::shared_ptr> &rc, bool coarse) { - std::shared_ptr pmb = rc->GetBlockPointer(); + auto pmb = rc->GetBlockPointer(); auto geom = Geometry::GetCoordinateSystem(rc.get()); auto bounds = coarse ? pmb->c_cellbounds : pmb->cellbounds; @@ -125,7 +125,7 @@ void OutflowInnerX1(std::shared_ptr> &rc, bool coarse) { // auto nb1 = IndexRange{0, 0}; auto domain = IndexDomain::inner_x1; - auto &fluid = rc->GetParentPointer()->packages.Get("fluid"); + auto &fluid = rc->GetMeshPointer()->packages.Get("fluid"); std::string bc_vars = fluid->Param("bc_vars"); if (bc_vars == "conserved") { @@ -147,7 +147,7 @@ void OutflowInnerX1(std::shared_ptr> &rc, bool coarse) { } void PolarInnerX2(std::shared_ptr> &rc, bool coarse) { - std::shared_ptr pmb = rc->GetBlockPointer(); + auto pmb = rc->GetBlockPointer(); auto geom = Geometry::GetCoordinateSystem(rc.get()); auto bounds = coarse ? pmb->c_cellbounds : pmb->cellbounds; @@ -158,7 +158,7 @@ void PolarInnerX2(std::shared_ptr> &rc, bool coarse) { auto domain = IndexDomain::inner_x2; const int j0 = bounds.GetBoundsJ(IndexDomain::interior).s; - auto &fluid = rc->GetParentPointer()->packages.Get("fluid"); + auto &fluid = rc->GetMeshPointer()->packages.Get("fluid"); std::string bc_vars = fluid->Param("bc_vars"); PARTHENON_REQUIRE(bc_vars == "primitive", "Polar X2 reflecting BCs not supported"); @@ -180,7 +180,7 @@ void PolarInnerX2(std::shared_ptr> &rc, bool coarse) { } void PolarOuterX2(std::shared_ptr> &rc, bool coarse) { - std::shared_ptr pmb = rc->GetBlockPointer(); + auto pmb = rc->GetBlockPointer(); auto geom = Geometry::GetCoordinateSystem(rc.get()); auto bounds = coarse ? pmb->c_cellbounds : pmb->cellbounds; @@ -191,7 +191,7 @@ void PolarOuterX2(std::shared_ptr> &rc, bool coarse) { auto domain = IndexDomain::outer_x2; const int j0 = bounds.GetBoundsJ(IndexDomain::interior).e; - auto &fluid = rc->GetParentPointer()->packages.Get("fluid"); + auto &fluid = rc->GetMeshPointer()->packages.Get("fluid"); std::string bc_vars = fluid->Param("bc_vars"); PARTHENON_REQUIRE(bc_vars == "primitive", "Polar X2 reflecting BCs not supported"); @@ -214,7 +214,7 @@ void PolarOuterX2(std::shared_ptr> &rc, bool coarse) { } void OutflowOuterX1(std::shared_ptr> &rc, bool coarse) { - std::shared_ptr pmb = rc->GetBlockPointer(); + auto pmb = rc->GetBlockPointer(); auto geom = Geometry::GetCoordinateSystem(rc.get()); auto bounds = coarse ? pmb->c_cellbounds : pmb->cellbounds; @@ -230,8 +230,8 @@ void OutflowOuterX1(std::shared_ptr> &rc, bool coarse) { const int pv_lo = imap[fluid_prim::velocity].first; auto idx_H = imap.GetFlatIdx(radmoment_prim::H, false); - auto &fluid = rc->GetParentPointer()->packages.Get("fluid"); - auto &rad = rc->GetParentPointer()->packages.Get("radiation"); + auto &fluid = rc->GetMeshPointer()->packages.Get("fluid"); + auto &rad = rc->GetMeshPointer()->packages.Get("radiation"); std::string bc_vars = fluid->Param("bc_vars"); const int num_species = rad->Param("active") ? rad->Param("num_species") : 0; @@ -307,9 +307,9 @@ TaskStatus ConvertBoundaryConditions(std::shared_ptr> &rc) { } } - auto &pkg = rc->GetParentPointer()->packages.Get("fluid"); - auto &pkg_rad = rc->GetParentPointer()->packages.Get("radiation"); - auto &pkg_fix = rc->GetParentPointer()->packages.Get("fixup"); + auto &pkg = rc->GetMeshPointer()->packages.Get("fluid"); + auto &pkg_rad = rc->GetMeshPointer()->packages.Get("radiation"); + auto &pkg_fix = rc->GetMeshPointer()->packages.Get("fixup"); std::string bc_vars = pkg->Param("bc_vars"); // Apply inflow check to ox1 for BH problem at simulation BC only @@ -330,7 +330,7 @@ TaskStatus ConvertBoundaryConditions(std::shared_ptr> &rc) { } // Inflow check and then p2c - std::shared_ptr pmb = rc->GetBlockPointer(); + auto pmb = rc->GetBlockPointer(); auto geom = Geometry::GetCoordinateSystem(rc.get()); // TODO(BRR) Is this always true? diff --git a/src/phoebus_utils/grid_utils.hpp b/src/phoebus_utils/grid_utils.hpp index ab927648f..45c1e25ff 100644 --- a/src/phoebus_utils/grid_utils.hpp +++ b/src/phoebus_utils/grid_utils.hpp @@ -55,4 +55,16 @@ KOKKOS_FORCEINLINE_FUNCTION Real GetXv(const int i, const int dir, } // namespace Coordinates +namespace PhoebusUtils { +inline Real GetRegionVolume(const parthenon::RegionSize ®) { + using parthenon::CoordinateDirection; + Real vol = 1; + for (int d = X1DIR; d <= X3DIR; ++d) { + CoordinateDirection dir = static_cast(d); + vol *= (reg.xmax(dir) - reg.xmin(dir)); + } + return vol; +} +} // namespace PhoebusUtils + #endif // PHOEBUS_UTILS_GRID_UTILS_HPP_ diff --git a/src/phoebus_utils/variables.hpp b/src/phoebus_utils/variables.hpp index 85867f820..f4b087549 100644 --- a/src/phoebus_utils/variables.hpp +++ b/src/phoebus_utils/variables.hpp @@ -14,8 +14,27 @@ #ifndef PHOEBUS_UTILS_VARIABLES_HPP_ #define PHOEBUS_UTILS_VARIABLES_HPP_ +#include + +#define VARIABLE(ns, varname) \ + struct varname : public parthenon::variable_names::base_t { \ + template \ + KOKKOS_INLINE_FUNCTION varname(Ts &&...args) \ + : parthenon::variable_names::base_t(std::forward(args)...) {} \ + static std::string name() { return #ns "." #varname; } \ + } + +#define VARIABLE_NONS(varname) \ + struct varname : public parthenon::variable_names::base_t { \ + template \ + KOKKOS_INLINE_FUNCTION varname(Ts &&...args) \ + : parthenon::variable_names::base_t(std::forward(args)...) {} \ + static std::string name() { return #varname; } \ + } + namespace fluid_prim { -constexpr char density[] = "p.density"; +VARIABLE(p, density); +// constexpr char density[] = "p.density"; constexpr char velocity[] = "p.velocity"; constexpr char energy[] = "p.energy"; constexpr char bfield[] = "p.bfield"; diff --git a/src/radiation/cooling_function.cpp b/src/radiation/cooling_function.cpp index bd47ddbe2..9e1302131 100644 --- a/src/radiation/cooling_function.cpp +++ b/src/radiation/cooling_function.cpp @@ -26,21 +26,21 @@ TaskStatus LightBulbCalcTau(MeshBlockData *rc) { namespace p = fluid_prim; namespace c = fluid_cons; namespace iv = internal_variables; - auto *pmb = rc->GetParentPointer().get(); + Mesh *pmesh = rc->GetMeshPointer(); - std::vector vars({p::density, iv::tau}); + std::vector vars({p::density::name(), iv::tau}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); - const int prho = imap[p::density].first; + const int prho = imap[p::density::name()].first; const int ptau = imap[iv::tau].first; - IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::interior); - IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); - IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); + IndexRange ib = rc->GetBoundsI(IndexDomain::interior); + IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); + IndexRange kb = rc->GetBoundsK(IndexDomain::interior); auto &unit_conv = - pmb->packages.Get("phoebus")->Param("unit_conv"); + pmesh->packages.Get("phoebus")->Param("unit_conv"); parthenon::par_for( DEFAULT_LOOP_PATTERN, "CalcTau", DevExecSpace(), kb.s, kb.e, jb.s, jb.e, ib.s, ib.e, KOKKOS_LAMBDA(const int k, const int j, const int i) { @@ -76,7 +76,7 @@ TaskStatus CheckDoGain(MeshBlockData *rc, bool *do_gain_global) { namespace p = fluid_prim; namespace c = fluid_cons; namespace iv = internal_variables; - auto *pmb = rc->GetParentPointer().get(); + Mesh *pmesh = rc->GetMeshPointer(); std::vector vars({iv::tau}); @@ -84,14 +84,14 @@ TaskStatus CheckDoGain(MeshBlockData *rc, bool *do_gain_global) { auto v = rc->PackVariables(vars, imap); const int ptau = imap[iv::tau].first; - IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::interior); - IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); - IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); + IndexRange ib = rc->GetBoundsI(IndexDomain::interior); + IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); + IndexRange kb = rc->GetBoundsK(IndexDomain::interior); auto &unit_conv = - pmb->packages.Get("phoebus")->Param("unit_conv"); - auto rad = pmb->packages.Get("radiation").get(); - auto opac = pmb->packages.Get("opacity").get(); + pmesh->packages.Get("phoebus")->Param("unit_conv"); + auto rad = pmesh->packages.Get("radiation").get(); + auto opac = pmesh->packages.Get("opacity").get(); int do_gain_local = 0; bool do_gain; @@ -111,16 +111,16 @@ TaskStatus CoolingFunctionCalculateFourForce(MeshBlockData *rc, const doub namespace p = fluid_prim; namespace c = fluid_cons; namespace iv = internal_variables; - auto *pmb = rc->GetParentPointer().get(); + auto *pmb = rc->GetParentPointer(); - std::vector vars({c::density, p::density, p::velocity, p::temperature, - p::ye, c::energy, iv::Gcov, iv::GcovHeat, iv::GcovCool, - iv::Gye, iv::tau, p::energy}); + std::vector vars({c::density, p::density::name(), p::velocity, + p::temperature, p::ye, c::energy, iv::Gcov, iv::GcovHeat, + iv::GcovCool, iv::Gye, iv::tau, p::energy}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); const int crho = imap[c::density].first; - const int prho = imap[p::density].first; + const int prho = imap[p::density::name()].first; const int pvlo = imap[p::velocity].first; const int pvhi = imap[p::velocity].second; const int ptemp = imap[p::temperature].first; @@ -133,9 +133,9 @@ TaskStatus CoolingFunctionCalculateFourForce(MeshBlockData *rc, const doub const int GcovHeat = imap[iv::GcovHeat].first; const int GcovCool = imap[iv::GcovCool].first; - IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::interior); - IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); - IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); + IndexRange ib = rc->GetBoundsI(IndexDomain::interior); + IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); + IndexRange kb = rc->GetBoundsK(IndexDomain::interior); auto &unit_conv = pmb->packages.Get("phoebus")->Param("unit_conv"); diff --git a/src/radiation/mocmc.cpp b/src/radiation/mocmc.cpp index 8f95a8c7e..2db4915d7 100644 --- a/src/radiation/mocmc.cpp +++ b/src/radiation/mocmc.cpp @@ -54,7 +54,7 @@ get_nsamp_per_zone(const int &k, const int &j, const int &i, template void MOCMCInitSamples(T *rc) { - auto *pmb = rc->GetParentPointer().get(); + auto *pmb = rc->GetParentPointer(); auto &sc = pmb->swarm_data.Get(); auto &swarm = sc->Get("mocmc"); StateDescriptor *rad = pmb->packages.Get("radiation").get(); @@ -81,14 +81,15 @@ void MOCMCInitSamples(T *rc) { const auto opac = opac_pkg->template Param("opacities"); StateDescriptor *eos = pmb->packages.Get("eos").get(); - std::vector variables{pr::J, pr::H, pf::density, pf::velocity, - pf::temperature, pf::ye, im::dnsamp}; + std::vector variables{pr::J, pr::H, pf::density::name(), + pf::velocity, pf::temperature, pf::ye, + im::dnsamp}; PackIndexMap imap; auto v = rc->PackVariables(variables, imap); auto pJ = imap.GetFlatIdx(pr::J); auto pH = imap.GetFlatIdx(pr::H); - auto pdens = imap[pf::density].first; + auto pdens = imap[pf::density::name()].first; auto pv = imap.GetFlatIdx(fluid_prim::velocity); auto pT = imap[pf::temperature].first; auto pye = imap[pf::ye].first; @@ -232,7 +233,7 @@ void MOCMCInitSamples(T *rc) { template TaskStatus MOCMCSampleBoundaries(T *rc) { - auto *pmb = rc->GetParentPointer().get(); + auto *pmb = rc->GetParentPointer(); auto &sc = pmb->swarm_data.Get(); auto &swarm = sc->Get("mocmc"); StateDescriptor *rad = pmb->packages.Get("radiation").get(); @@ -347,7 +348,7 @@ TaskStatus MOCMCSampleBoundaries(T *rc) { template TaskStatus MOCMCReconstruction(T *rc) { - auto *pmb = rc->GetParentPointer().get(); + auto *pmb = rc->GetParentPointer(); auto &sc = pmb->swarm_data.Get(); auto &swarm = sc->Get("mocmc"); StateDescriptor *rad = pmb->packages.Get("radiation").get(); @@ -462,7 +463,7 @@ TaskStatus MOCMCReconstruction(T *rc) { template TaskStatus MOCMCTransport(T *rc, const Real dt) { - auto *pmb = rc->GetParentPointer().get(); + auto *pmb = rc->GetParentPointer(); auto &sc = pmb->swarm_data.Get(); auto &swarm = sc->Get("mocmc"); @@ -503,7 +504,7 @@ template TaskStatus MOCMCFluidSource(T *rc, const Real dt, const bool update_fluid) { // Assume particles are already sorted from MOCMCReconstruction call! - auto *pmb = rc->GetParentPointer().get(); + auto *pmb = rc->GetParentPointer(); auto &sc = pmb->swarm_data.Get(); auto &swarm = sc->Get("mocmc"); StateDescriptor *rad = pmb->packages.Get("radiation").get(); @@ -521,7 +522,7 @@ TaskStatus MOCMCFluidSource(T *rc, const Real dt, const bool update_fluid) { const auto eos_d = eos->template Param("d.EOS"); std::vector variables{ - cr::E, cr::F, pr::J, pr::H, pf::density, + cr::E, cr::F, pr::J, pr::H, pf::density::name(), pf::energy, pf::velocity, pf::temperature, pf::ye, ir::tilPi, ir::kappaH, im::dnsamp, im::Inu0, im::Inu1, im::jinvs}; if (update_fluid) { @@ -534,7 +535,7 @@ TaskStatus MOCMCFluidSource(T *rc, const Real dt, const bool update_fluid) { const auto pJ = imap.GetFlatIdx(pr::J); const auto pH = imap.GetFlatIdx(pr::H); - const auto pdens = imap[pf::density].first; + const auto pdens = imap[pf::density::name()].first; const auto peng = imap[pf::energy].first; const auto pv = imap.GetFlatIdx(fluid_prim::velocity); const auto pT = imap[pf::temperature].first; @@ -784,7 +785,7 @@ TaskStatus MOCMCEddington(T *rc) { // Assume list is sorted! namespace ir = radmoment_internal; - auto *pmb = rc->GetParentPointer().get(); + auto *pmb = rc->GetParentPointer(); auto &sc = pmb->swarm_data.Get(); auto &swarm = sc->Get("mocmc"); StateDescriptor *rad = pmb->packages.Get("radiation").get(); diff --git a/src/radiation/moments.cpp b/src/radiation/moments.cpp index 1a0859db3..ff5ba23e9 100644 --- a/src/radiation/moments.cpp +++ b/src/radiation/moments.cpp @@ -63,12 +63,12 @@ TaskStatus MomentCon2PrimImpl(T *rc) { namespace pr = radmoment_prim; namespace ir = radmoment_internal; - auto *pm = rc->GetParentPointer().get(); - StateDescriptor *rad = pm->packages.Get("radiation").get(); + Mesh *pmesh = rc->GetMeshPointer(); + StateDescriptor *rad = pmesh->packages.Get("radiation").get(); - IndexRange ib = pm->cellbounds.GetBoundsI(IndexDomain::entire); - IndexRange jb = pm->cellbounds.GetBoundsJ(IndexDomain::entire); - IndexRange kb = pm->cellbounds.GetBoundsK(IndexDomain::entire); + IndexRange ib = rc->GetBoundsI(IndexDomain::entire); + IndexRange jb = rc->GetBoundsJ(IndexDomain::entire); + IndexRange kb = rc->GetBoundsK(IndexDomain::entire); std::vector variables{ cr::E, cr::F, pr::J, pr::H, fluid_prim::velocity, @@ -168,7 +168,7 @@ template // TODO(BRR) add domain so we can do this only over interior if we are using prims as // boundary data? TaskStatus MomentCon2Prim(T *rc) { - auto *pm = rc->GetParentPointer().get(); + Mesh *pm = rc->GetMeshPointer(); StateDescriptor *rad = pm->packages.Get("radiation").get(); auto method = rad->Param("method"); @@ -194,11 +194,9 @@ TaskStatus MomentPrim2ConImpl(T *rc, IndexDomain domain) { namespace pr = radmoment_prim; namespace ir = radmoment_internal; - auto *pm = rc->GetParentPointer().get(); - - IndexRange ib = pm->cellbounds.GetBoundsI(domain); - IndexRange jb = pm->cellbounds.GetBoundsJ(domain); - IndexRange kb = pm->cellbounds.GetBoundsK(domain); + IndexRange ib = rc->GetBoundsI(domain); + IndexRange jb = rc->GetBoundsJ(domain); + IndexRange kb = rc->GetBoundsK(domain); std::vector variables{cr::E, cr::F, pr::J, pr::H, fluid_prim::velocity}; if (programming::is_specialization_of::value) { @@ -268,7 +266,7 @@ TaskStatus MomentPrim2ConImpl(T *rc, IndexDomain domain) { template TaskStatus MomentPrim2Con(T *rc, IndexDomain domain) { - auto *pm = rc->GetParentPointer().get(); + Mesh *pm = rc->GetMeshPointer(); StateDescriptor *rad = pm->packages.Get("radiation").get(); auto method = rad->Param("method"); using settings = @@ -292,7 +290,7 @@ template TaskStatus ReconstructEdgeStates(T *rc) { using namespace PhoebusReconstruction; - auto *pmb = rc->GetParentPointer().get(); + auto *pmb = rc->GetParentPointer(); StateDescriptor *rad_pkg = pmb->packages.Get("radiation").get(); auto rt = rad_pkg->Param("Recon"); @@ -491,7 +489,7 @@ template TaskStatus ReconstructEdgeStates>(MeshBlockData TaskStatus CalculateFluxesImpl(T *rc) { - auto *pmb = rc->GetParentPointer().get(); + auto *pmb = rc->GetParentPointer(); StateDescriptor *rad_pkg = pmb->packages.Get("radiation").get(); StateDescriptor *fix_pkg = pmb->packages.Get("fixup").get(); @@ -748,7 +746,7 @@ TaskStatus CalculateFluxesImpl(T *rc) { template TaskStatus CalculateFluxes(T *rc) { - auto *pm = rc->GetParentPointer().get(); + Mesh *pm = rc->GetMeshPointer(); StateDescriptor *rad = pm->packages.Get("radiation").get(); auto method = rad->Param("method"); using settings = @@ -769,7 +767,6 @@ template TaskStatus CalculateFluxes>(MeshBlockData *); template TaskStatus CalculateGeometricSourceImpl(T *rc, T *rc_src) { constexpr int ND = Geometry::NDFULL; - auto *pmb = rc->GetParentPointer().get(); namespace cr = radmoment_cons; namespace pr = radmoment_prim; @@ -796,9 +793,9 @@ TaskStatus CalculateGeometricSourceImpl(T *rc, T *rc_src) { auto idx_E_src = imap_src.GetFlatIdx(cr::E); auto idx_F_src = imap_src.GetFlatIdx(cr::F); - IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::interior); - IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); - IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); + IndexRange ib = rc->GetBoundsI(IndexDomain::interior); + IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); + IndexRange kb = rc->GetBoundsK(IndexDomain::interior); // Get the background geometry auto geom = Geometry::GetCoordinateSystem(rc); @@ -908,7 +905,7 @@ TaskStatus CalculateGeometricSourceImpl(T *rc, T *rc_src) { template TaskStatus CalculateGeometricSource(T *rc, T *rc_src) { - auto *pm = rc->GetParentPointer().get(); + Mesh *pm = rc->GetMeshPointer(); StateDescriptor *rad = pm->packages.Get("radiation").get(); auto method = rad->Param("method"); using settings = @@ -929,10 +926,10 @@ template TaskStatus CalculateGeometricSource>(MeshBlockData< template TaskStatus MomentCalculateOpacities(T *rc) { - auto *pmb = rc->GetParentPointer().get(); + Mesh *pm = rc->GetMeshPointer(); - StateDescriptor *opac = pmb->packages.Get("opacity").get(); - StateDescriptor *rad = pmb->packages.Get("radiation").get(); + StateDescriptor *opac = pm->packages.Get("opacity").get(); + StateDescriptor *rad = pm->packages.Get("radiation").get(); const bool rad_mocmc_active = (rad->Param("method") == "mocmc"); if (rad_mocmc_active) { @@ -945,14 +942,14 @@ TaskStatus MomentCalculateOpacities(T *rc) { namespace ir = radmoment_internal; namespace c = fluid_cons; namespace p = fluid_prim; - std::vector vars{p::density, p::temperature, p::ye, p::velocity, - ir::kappaJ, ir::kappaH, ir::JBB}; + std::vector vars{p::density::name(), p::temperature, p::ye, p::velocity, + ir::kappaJ, ir::kappaH, ir::JBB}; PackIndexMap imap; auto v = rc->PackVariables(vars, imap); auto pv = imap.GetFlatIdx(p::velocity); - int prho = imap[p::density].first; + int prho = imap[p::density::name()].first; int pT = imap[p::temperature].first; int pYe = imap[p::ye].first; @@ -960,9 +957,9 @@ TaskStatus MomentCalculateOpacities(T *rc) { auto idx_kappaH = imap.GetFlatIdx(ir::kappaH); auto idx_JBB = imap.GetFlatIdx(ir::JBB); - IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::entire); - IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::entire); - IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::entire); + IndexRange ib = rc->GetBoundsI(IndexDomain::entire); + IndexRange jb = rc->GetBoundsJ(IndexDomain::entire); + IndexRange kb = rc->GetBoundsK(IndexDomain::entire); // Get the device opacity object const auto &opacities = opac->Param("opacities"); diff --git a/src/radiation/moments_source.cpp b/src/radiation/moments_source.cpp index ebce26fc6..b0d2fb1e5 100644 --- a/src/radiation/moments_source.cpp +++ b/src/radiation/moments_source.cpp @@ -204,7 +204,7 @@ template TaskStatus MomentFluidSourceImpl(T *rc, Real dt, bool update_fluid) { PARTHENON_REQUIRE(USE_VALENCIA, "Covariant MHD formulation not supported!"); - auto *pmb = rc->GetParentPointer().get(); + auto *pmb = rc->GetParentPointer(); StateDescriptor *fluid_pkg = pmb->packages.Get("fluid").get(); StateDescriptor *rad = pmb->packages.Get("radiation").get(); StateDescriptor *eos_pkg = pmb->packages.Get("eos").get(); @@ -217,10 +217,11 @@ TaskStatus MomentFluidSourceImpl(T *rc, Real dt, bool update_fluid) { namespace c = fluid_cons; namespace p = fluid_prim; std::vector vars{ - c::density, c::energy, c::momentum, c::ye, cr::E, cr::F, - c::bfield, p::density, p::temperature, p::energy, p::ye, p::velocity, - p::pressure, p::gamma1, p::bfield, pr::J, pr::H, ir::kappaJ, - ir::kappaH, ir::JBB, ir::tilPi}; + c::density, c::energy, c::momentum, c::ye, cr::E, + cr::F, c::bfield, p::density::name(), p::temperature, p::energy, + p::ye, p::velocity, p::pressure, p::gamma1, p::bfield, + pr::J, pr::H, ir::kappaJ, ir::kappaH, ir::JBB, + ir::tilPi}; PackIndexMap imap; auto v = rc->PackVariables(vars, imap); @@ -235,7 +236,7 @@ TaskStatus MomentFluidSourceImpl(T *rc, Real dt, bool update_fluid) { auto idx_tilPi = imap.GetFlatIdx(ir::tilPi, false); auto pv = imap.GetFlatIdx(p::velocity); - int prho = imap[p::density].first; + int prho = imap[p::density::name()].first; int peng = imap[p::energy].first; int pT = imap[p::temperature].first; int pprs = imap[p::pressure].first; @@ -964,7 +965,7 @@ TaskStatus MomentFluidSourceImpl(T *rc, Real dt, bool update_fluid) { } template TaskStatus MomentFluidSource(T *rc, Real dt, bool update_fluid) { - auto *pm = rc->GetParentPointer().get(); + Mesh *pm = rc->GetMeshPointer(); StateDescriptor *rad = pm->packages.Get("radiation").get(); auto method = rad->Param("method"); using settings = diff --git a/src/radiation/monte_carlo.cpp b/src/radiation/monte_carlo.cpp index 4c674e834..07d67b67b 100644 --- a/src/radiation/monte_carlo.cpp +++ b/src/radiation/monte_carlo.cpp @@ -12,6 +12,7 @@ // publicly, and to permit others to do so. #include "geodesics.hpp" +#include "phoebus_utils/grid_utils.hpp" #include "phoebus_utils/reduction.hpp" #include "phoebus_utils/robust.hpp" #include "radiation.hpp" @@ -53,8 +54,8 @@ void ComputeTotalEmissivity(Mesh *pmesh) { namespace p = fluid_prim; PackIndexMap imap; - auto v = rc->PackVariables({p::density, p::temperature, p::ye}, imap); - const int prho = imap[p::density].first; + auto v = rc->PackVariables({p::density::name(), p::temperature, p::ye}, imap); + const int prho = imap[p::density::name()].first; const int ptemp = imap[p::temperature].first; const int pye = imap[p::ye].first; @@ -89,8 +90,7 @@ void SetWeight(Mesh *pmesh) { const auto nusamp = rad->Param>("nusamp"); auto &code_constants = phoebus_pkg->Param("code_constants"); - const Real sim_vol = - pmesh->mesh_size.x1max * pmesh->mesh_size.x2max * pmesh->mesh_size.x3max; + const Real sim_vol = PhoebusUtils::GetRegionVolume(pmesh->mesh_size); const Real h_code = code_constants.h; const Real dNtot = rad->Param("tune_emission") / (std::pow(sim_vol, 1. / 3.) * 1.0); // Note: may need a dt term here? @@ -150,12 +150,12 @@ TaskStatus MonteCarloSourceParticles(MeshBlock *pmb, MeshBlockData *rc, const Real h_code = code_constants.h; const Real mp_code = code_constants.mp; - std::vector vars({p::density, p::temperature, p::ye, p::velocity, + std::vector vars({p::density::name(), p::temperature, p::ye, p::velocity, "dNdlnu_max", "dNdlnu", "dN", "Ns", iv::Gcov, iv::Gye}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); const int pye = imap[p::ye].first; - const int pdens = imap[p::density].first; + const int pdens = imap[p::density::name()].first; const int ptemp = imap[p::temperature].first; const int pvlo = imap[p::velocity].first; const int pvhi = imap[p::velocity].second; @@ -456,10 +456,10 @@ TaskStatus MonteCarloTransport(MeshBlock *pmb, MeshBlockData *rc, const Real mp_code = code_constants.mp; std::vector vars( - {p::density, p::ye, p::velocity, p::temperature, iv::Gcov, iv::Gye}); + {p::density::name(), p::ye, p::velocity, p::temperature, iv::Gcov, iv::Gye}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); - const int prho = imap[p::density].first; + const int prho = imap[p::density::name()].first; const int iye = imap[p::ye].first; const int ivlo = imap[p::velocity].first; const int ivhi = imap[p::velocity].second; @@ -585,8 +585,7 @@ TaskStatus MonteCarloUpdateTuning(Mesh *pmesh, std::vector *resolution, const auto t_tune_scattering = rad->Param("t_tune_scattering"); const auto dt_tune_scattering = rad->Param("dt_tune_scattering"); const auto num_particles = rad->Param("num_particles"); - const Real sim_vol = - pmesh->mesh_size.x1max * pmesh->mesh_size.x2max * pmesh->mesh_size.x3max; + const Real sim_vol = PhoebusUtils::GetRegionVolume(pmesh->mesh_size); if (tuning == "static") { // Do nothing diff --git a/src/radiation/radiation.cpp b/src/radiation/radiation.cpp index ea7203aa3..77d01de2a 100644 --- a/src/radiation/radiation.cpp +++ b/src/radiation/radiation.cpp @@ -543,7 +543,6 @@ TaskStatus ApplyRadiationFourForce(MeshBlockData *rc, const double dt) { namespace c = fluid_cons; namespace iv = internal_variables; - auto *pmb = rc->GetParentPointer().get(); std::vector vars( {c::density, c::energy, c::momentum, c::ye, iv::Gcov, iv::Gye}); @@ -557,9 +556,9 @@ TaskStatus ApplyRadiationFourForce(MeshBlockData *rc, const double dt) { const int Gcov_lo = imap[iv::Gcov].first; const int Gcov_hi = imap[iv::Gcov].second; const int Gye = imap[iv::Gye].first; - IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::interior); - IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); - IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); + IndexRange ib = rc->GetBoundsI(IndexDomain::interior); + IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); + IndexRange kb = rc->GetBoundsK(IndexDomain::interior); parthenon::par_for( DEFAULT_LOOP_PATTERN, "ApplyRadiationFourForce", DevExecSpace(), kb.s, kb.e, jb.s, diff --git a/src/tov/tov.cpp b/src/tov/tov.cpp index 0d051a3ba..c9f88b78f 100644 --- a/src/tov/tov.cpp +++ b/src/tov/tov.cpp @@ -93,7 +93,7 @@ std::shared_ptr Initialize(ParameterInput *pin) { return History::ReduceOneVar>(md, fluid_prim::pressure, 0); }; auto ReduceDens = [](MeshData *md) { - return History::ReduceOneVar>(md, fluid_prim::density, 0); + return History::ReduceOneVar>(md, fluid_prim::density::name(), 0); }; parthenon::HstVar_list hst_vars = {}; hst_vars.emplace_back(parthenon::HistoryOutputVar(HstMax, ReducePress, "max pressure")); From b4985be09ea0530da30de9de48d90ce9d6c603fb Mon Sep 17 00:00:00 2001 From: Jonah Maxwell Miller Date: Tue, 5 Dec 2023 18:54:38 -0700 Subject: [PATCH 04/14] fix tests and update prim velocity --- src/analysis/history.cpp | 18 ++++---- src/fixup/fixup.cpp | 10 ++--- src/fixup/fixup_c2p.cpp | 6 +-- src/fixup/fixup_radc2p.cpp | 6 +-- src/fixup/fixup_src.cpp | 8 ++-- src/fluid/con2prim.hpp | 7 ++-- src/fluid/con2prim_robust.hpp | 7 ++-- src/fluid/fluid.cpp | 16 ++++---- src/fluid/riemann.hpp | 15 +++---- src/fluid/tmunu.hpp | 8 ++-- src/pgen/advection.cpp | 6 +-- src/pgen/blandford_mckee.cpp | 6 +-- src/pgen/bondi.cpp | 6 +-- src/pgen/friedmann.cpp | 4 +- src/pgen/homogeneous_sphere.cpp | 4 +- src/pgen/kh.cpp | 6 +-- src/pgen/leptoneq.cpp | 6 +-- src/pgen/linear_modes.cpp | 12 +++--- src/pgen/p2c2p.cpp | 6 +-- src/pgen/progenitor.cpp | 6 +-- src/pgen/radiation_advection.cpp | 4 +- src/pgen/radiation_equilibration.cpp | 14 +++---- src/pgen/rhs_tester.cpp | 6 +-- src/pgen/rotor.cpp | 6 +-- src/pgen/sedov.cpp | 6 +-- src/pgen/shock_tube.cpp | 6 +-- src/pgen/thin_cooling.cpp | 6 +-- src/pgen/torus.cpp | 12 +++--- src/pgen/tov.cpp | 6 +-- src/phoebus_boundaries/phoebus_boundaries.cpp | 10 ++--- src/phoebus_utils/variables.hpp | 2 +- src/radiation/cooling_function.cpp | 6 +-- src/radiation/mocmc.cpp | 41 ++++++++++++------- src/radiation/moments.cpp | 11 ++--- src/radiation/moments_source.cpp | 11 ++--- src/radiation/monte_carlo.cpp | 17 ++++---- src/radiation/radiation.cpp | 10 ++--- tst/unit/monopole_gr/test_interp_3d_to_1d.cpp | 19 +++------ 38 files changed, 182 insertions(+), 174 deletions(-) diff --git a/src/analysis/history.cpp b/src/analysis/history.cpp index ab3733521..7b9b02bca 100644 --- a/src/analysis/history.cpp +++ b/src/analysis/history.cpp @@ -29,14 +29,14 @@ Real ReduceMassAccretionRate(MeshData *md) { const Real xh = pars.Get("xh"); namespace p = fluid_prim; - const std::vector vars({p::density::name(), p::velocity}); + const std::vector vars({p::density::name(), p::velocity::name()}); PackIndexMap imap; auto pack = md->PackVariables(vars, imap); const int prho = imap[p::density::name()].first; - const int pvel_lo = imap[p::velocity].first; - const int pvel_hi = imap[p::velocity].second; + const int pvel_lo = imap[p::velocity::name()].first; + const int pvel_hi = imap[p::velocity::name()].second; auto geom = Geometry::GetCoordinateSystem(md); @@ -78,14 +78,14 @@ Real ReduceJetEnergyFlux(MeshData *md) { const Real xh = pars.Get("xh"); namespace p = fluid_prim; - const std::vector vars({p::density::name(), p::bfield, p::velocity}); + const std::vector vars({p::density::name(), p::bfield, p::velocity::name()}); PackIndexMap imap; auto pack = md->PackVariables(vars, imap); const int prho = imap[p::density::name()].first; - const int pvel_lo = imap[p::velocity].first; - const int pvel_hi = imap[p::velocity].second; + const int pvel_lo = imap[p::velocity::name()].first; + const int pvel_hi = imap[p::velocity::name()].second; const int pb_lo = imap[p::bfield].first; const int pb_hi = imap[p::bfield].second; @@ -137,14 +137,14 @@ Real ReduceJetMomentumFlux(MeshData *md) { const Real xh = pars.Get("xh"); namespace p = fluid_prim; - const std::vector vars({p::density::name(), p::bfield, p::velocity}); + const std::vector vars({p::density::name(), p::bfield, p::velocity::name()}); PackIndexMap imap; auto pack = md->PackVariables(vars, imap); const int prho = imap[p::density::name()].first; - const int pvel_lo = imap[p::velocity].first; - const int pvel_hi = imap[p::velocity].second; + const int pvel_lo = imap[p::velocity::name()].first; + const int pvel_hi = imap[p::velocity::name()].second; const int pb_lo = imap[p::bfield].first; const int pb_hi = imap[p::bfield].second; diff --git a/src/fixup/fixup.cpp b/src/fixup/fixup.cpp index 1999f08ac..a37e0fd8b 100644 --- a/src/fixup/fixup.cpp +++ b/src/fixup/fixup.cpp @@ -307,17 +307,17 @@ TaskStatus ApplyFloorsImpl(T *rc, IndexDomain domain = IndexDomain::entire) { if (!enable_floors) return TaskStatus::complete; const std::vector vars( - {p::density::name(), c::density, p::velocity, c::momentum, p::energy, c::energy, - p::bfield, 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::density::name(), c::density, p::velocity::name(), c::momentum, p::energy, + c::energy, p::bfield, 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}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); const int prho = imap[p::density::name()].first; const int crho = imap[c::density].first; - const int pvel_lo = imap[p::velocity].first; - const int pvel_hi = imap[p::velocity].second; + const int pvel_lo = imap[p::velocity::name()].first; + const int pvel_hi = imap[p::velocity::name()].second; const int cmom_lo = imap[c::momentum].first; const int cmom_hi = imap[c::momentum].second; const int peng = imap[p::energy].first; diff --git a/src/fixup/fixup_c2p.cpp b/src/fixup/fixup_c2p.cpp index 698eaa46e..5d620e6d8 100644 --- a/src/fixup/fixup_c2p.cpp +++ b/src/fixup/fixup_c2p.cpp @@ -61,7 +61,7 @@ TaskStatus ConservedToPrimitiveFixupImpl(T *rc) { const std::vector vars({p::density::name(), c::density, - p::velocity, + p::velocity::name(), c::momentum, p::energy, c::energy, @@ -87,8 +87,8 @@ TaskStatus ConservedToPrimitiveFixupImpl(T *rc) { const int prho = imap[p::density::name()].first; const int crho = imap[c::density].first; - const int pvel_lo = imap[p::velocity].first; - const int pvel_hi = imap[p::velocity].second; + const int pvel_lo = imap[p::velocity::name()].first; + const int pvel_hi = imap[p::velocity::name()].second; const int cmom_lo = imap[c::momentum].first; const int cmom_hi = imap[c::momentum].second; const int peng = imap[p::energy].first; diff --git a/src/fixup/fixup_radc2p.cpp b/src/fixup/fixup_radc2p.cpp index 6cbd9f723..f194fdb5d 100644 --- a/src/fixup/fixup_radc2p.cpp +++ b/src/fixup/fixup_radc2p.cpp @@ -63,13 +63,13 @@ TaskStatus RadConservedToPrimitiveFixupImpl(T *rc) { bool update_rad = rad_pkg->Param("active"); if (!enable_c2p_fixup || !update_rad) return TaskStatus::complete; - const std::vector vars({p::velocity, p::ye, c::ye, pr::J, pr::H, cr::E, - cr::F, ir::tilPi, ir::c2pfail, impl::fail}); + const std::vector vars({p::velocity::name(), p::ye, c::ye, 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); + auto idx_pvel = imap.GetFlatIdx(p::velocity::name()); int pye = imap[p::ye].second; // negative if not present int cye = imap[c::ye].second; auto idx_J = imap.GetFlatIdx(pr::J, false); diff --git a/src/fixup/fixup_src.cpp b/src/fixup/fixup_src.cpp index 32e3c47e2..6cdacf882 100644 --- a/src/fixup/fixup_src.cpp +++ b/src/fixup/fixup_src.cpp @@ -75,16 +75,16 @@ TaskStatus SourceFixupImpl(T *rc) { auto bounds = fix_pkg->Param("bounds"); const std::vector vars( - {p::density::name(), c::density, p::velocity, c::momentum, p::energy, c::energy, - p::bfield, 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::density::name(), c::density, p::velocity::name(), c::momentum, p::energy, + c::energy, p::bfield, 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}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); const int prho = imap[p::density::name()].first; const int crho = imap[c::density].first; - auto idx_pvel = imap.GetFlatIdx(p::velocity); + auto idx_pvel = imap.GetFlatIdx(p::velocity::name()); auto idx_cmom = imap.GetFlatIdx(c::momentum); const int peng = imap[p::energy].first; const int ceng = imap[c::energy].first; diff --git a/src/fluid/con2prim.hpp b/src/fluid/con2prim.hpp index 0d3e3841b..0b3ff8542 100644 --- a/src/fluid/con2prim.hpp +++ b/src/fluid/con2prim.hpp @@ -132,8 +132,9 @@ class ConToPrim { ConToPrim(Data_t *rc, PackIndexMap imap, const Real tol, const int max_iterations) : var(rc->PackVariables(Vars(), imap)), prho(imap[fluid_prim::density::name()].first), - crho(imap[fluid_cons::density].first), pvel_lo(imap[fluid_prim::velocity].first), - pvel_hi(imap[fluid_prim::velocity].second), + crho(imap[fluid_cons::density].first), + pvel_lo(imap[fluid_prim::velocity::name()].first), + pvel_hi(imap[fluid_prim::velocity::name()].second), cmom_lo(imap[fluid_cons::momentum].first), cmom_hi(imap[fluid_cons::momentum].second), peng(imap[fluid_prim::energy].first), ceng(imap[fluid_cons::energy].first), pb_lo(imap[fluid_prim::bfield].first), @@ -149,7 +150,7 @@ class ConToPrim { std::vector Vars() { return std::vector( - {fluid_prim::density::name(), fluid_cons::density, fluid_prim::velocity, + {fluid_prim::density::name(), fluid_cons::density, fluid_prim::velocity::name(), fluid_cons::momentum, fluid_prim::energy, fluid_cons::energy, fluid_prim::bfield, fluid_cons::bfield, fluid_prim::ye, fluid_cons::ye, fluid_prim::pressure, fluid_prim::temperature, internal_variables::cell_signal_speed, diff --git a/src/fluid/con2prim_robust.hpp b/src/fluid/con2prim_robust.hpp index 006fbdccc..c5a9cd939 100644 --- a/src/fluid/con2prim_robust.hpp +++ b/src/fluid/con2prim_robust.hpp @@ -229,8 +229,9 @@ class ConToPrim { const bool fail_on_ceilings) : bounds(bnds), var(rc->PackVariables(Vars(), imap)), prho(imap[fluid_prim::density::name()].first), - crho(imap[fluid_cons::density].first), pvel_lo(imap[fluid_prim::velocity].first), - pvel_hi(imap[fluid_prim::velocity].second), + crho(imap[fluid_cons::density].first), + pvel_lo(imap[fluid_prim::velocity::name()].first), + pvel_hi(imap[fluid_prim::velocity::name()].second), cmom_lo(imap[fluid_cons::momentum].first), cmom_hi(imap[fluid_cons::momentum].second), peng(imap[fluid_prim::energy].first), ceng(imap[fluid_cons::energy].first), pb_lo(imap[fluid_prim::bfield].first), @@ -247,7 +248,7 @@ class ConToPrim { std::vector Vars() { return std::vector( - {fluid_prim::density::name(), fluid_cons::density, fluid_prim::velocity, + {fluid_prim::density::name(), fluid_cons::density, fluid_prim::velocity::name(), fluid_cons::momentum, fluid_prim::energy, fluid_cons::energy, fluid_prim::bfield, fluid_cons::bfield, fluid_prim::ye, fluid_cons::ye, fluid_prim::pressure, fluid_prim::temperature, internal_variables::cell_signal_speed, diff --git a/src/fluid/fluid.cpp b/src/fluid/fluid.cpp index 56c0f9753..e4e5bd094 100644 --- a/src/fluid/fluid.cpp +++ b/src/fluid/fluid.cpp @@ -190,7 +190,7 @@ std::shared_ptr Initialize(ParameterInput *pin) { // add the primitive variables physics->template AddField(mprim_scalar); - physics->AddField(p::velocity, mprim_threev); + physics->AddField(p::velocity::name(), mprim_threev); physics->AddField(p::energy, mprim_scalar); if (mhd) { physics->AddField(p::bfield, mprim_threev); @@ -256,7 +256,7 @@ std::shared_ptr Initialize(ParameterInput *pin) { // set up the arrays for left and right states // add the base state for reconstruction/fluxes - std::vector rvars({p::density::name(), p::velocity, p::energy}); + std::vector rvars({p::density::name(), p::velocity::name(), p::energy}); riemann::FluxState::ReconVars(rvars); if (mhd) riemann::FluxState::ReconVars(p::bfield); if (ye) riemann::FluxState::ReconVars(p::ye); @@ -349,18 +349,18 @@ TaskStatus PrimitiveToConservedRegion(MeshBlockData *rc, const IndexRange namespace impl = internal_variables; auto *pmb = rc->GetParentPointer(); - const std::vector vars({p::density::name(), c::density, p::velocity, - c::momentum, p::energy, c::energy, p::bfield, - c::bfield, p::ye, c::ye, p::pressure, p::gamma1, - impl::cell_signal_speed}); + const std::vector vars({p::density::name(), c::density, + p::velocity::name(), c::momentum, p::energy, + c::energy, p::bfield, c::bfield, p::ye, c::ye, + p::pressure, p::gamma1, impl::cell_signal_speed}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); const int prho = imap[p::density::name()].first; const int crho = imap[c::density].first; - const int pvel_lo = imap[p::velocity].first; - const int pvel_hi = imap[p::velocity].second; + const int pvel_lo = imap[p::velocity::name()].first; + const int pvel_hi = imap[p::velocity::name()].second; const int cmom_lo = imap[c::momentum].first; const int cmom_hi = imap[c::momentum].second; const int peng = imap[p::energy].first; diff --git a/src/fluid/riemann.hpp b/src/fluid/riemann.hpp index 3f320fd70..0d4b6f8ae 100644 --- a/src/fluid/riemann.hpp +++ b/src/fluid/riemann.hpp @@ -219,13 +219,14 @@ class FluxState { bounds(rc->GetParentPointer()->packages.Get("fixup").get()->Param( "bounds")), prho(imap[fluid_prim::density::name()].first), - pvel_lo(imap[fluid_prim::velocity].first), peng(imap[fluid_prim::energy].first), - pb_lo(imap[fluid_prim::bfield].first), pb_hi(imap[fluid_prim::bfield].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), ceng(imap[fluid_cons::energy].first), - cb_lo(imap[fluid_cons::bfield].first), cb_hi(imap[fluid_cons::bfield].second), - cye(imap[fluid_cons::ye].first), ncons(5 + (pb_hi - pb_lo + 1) + (cye > 0)) { + pvel_lo(imap[fluid_prim::velocity::name()].first), + peng(imap[fluid_prim::energy].first), pb_lo(imap[fluid_prim::bfield].first), + pb_hi(imap[fluid_prim::bfield].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), + ceng(imap[fluid_cons::energy].first), cb_lo(imap[fluid_cons::bfield].first), + cb_hi(imap[fluid_cons::bfield].second), cye(imap[fluid_cons::ye].first), + ncons(5 + (pb_hi - pb_lo + 1) + (cye > 0)) { PARTHENON_REQUIRE_THROWS( ncons <= NCONS_MAX, "ncons exceeds NCONS_MAX. Reconfigure to increase NCONS_MAX."); diff --git a/src/fluid/tmunu.hpp b/src/fluid/tmunu.hpp index 89cc36544..c62cf112a 100644 --- a/src/fluid/tmunu.hpp +++ b/src/fluid/tmunu.hpp @@ -27,9 +27,9 @@ namespace fluid { -const std::vector TMUNU_VARS = {fluid_prim::density::name(), - fluid_prim::velocity, fluid_prim::energy, - fluid_prim::pressure, fluid_prim::bfield}; +const std::vector TMUNU_VARS = { + fluid_prim::density::name(), fluid_prim::velocity::name(), fluid_prim::energy, + fluid_prim::pressure, fluid_prim::bfield}; // Indices are upstairs template class StressEnergyTensorCon { @@ -47,7 +47,7 @@ class StressEnergyTensorCon { system_ = Geometry::GetCoordinateSystem(rc); ir_ = imap[fluid_prim::density::name()].first; - iv_ = imap[fluid_prim::velocity].first; + iv_ = imap[fluid_prim::velocity::name()].first; iu_ = imap[fluid_prim::energy].first; ip_ = imap[fluid_prim::pressure].first; ib_ = imap[fluid_prim::bfield].first; diff --git a/src/pgen/advection.cpp b/src/pgen/advection.cpp index f2ec10c14..1f0547143 100644 --- a/src/pgen/advection.cpp +++ b/src/pgen/advection.cpp @@ -26,15 +26,15 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, 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].first; - const int ivhi = imap[fluid_prim::velocity].second; + const int ivlo = imap[fluid_prim::velocity::name()].first; + const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy].first; const int ib_lo = imap[fluid_prim::bfield].first; const int ib_hi = imap[fluid_prim::bfield].second; diff --git a/src/pgen/blandford_mckee.cpp b/src/pgen/blandford_mckee.cpp index 5a2669b74..b55450306 100644 --- a/src/pgen/blandford_mckee.cpp +++ b/src/pgen/blandford_mckee.cpp @@ -31,15 +31,15 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, 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].first; - const int ivhi = imap[fluid_prim::velocity].second; + const int ivlo = imap[fluid_prim::velocity::name()].first; + const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy].first; const int ib_lo = imap[fluid_prim::bfield].first; const int ib_hi = imap[fluid_prim::bfield].second; diff --git a/src/pgen/bondi.cpp b/src/pgen/bondi.cpp index 15cee1f44..08fe210ea 100644 --- a/src/pgen/bondi.cpp +++ b/src/pgen/bondi.cpp @@ -91,15 +91,15 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto rc = pmb->meshblock_data.Get().get(); PackIndexMap imap; - auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, 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].first; - const int ivhi = imap[fluid_prim::velocity].second; + const int ivlo = imap[fluid_prim::velocity::name()].first; + const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy].first; const int ib_lo = imap[fluid_prim::bfield].first; const int ib_hi = imap[fluid_prim::bfield].second; diff --git a/src/pgen/friedmann.cpp b/src/pgen/friedmann.cpp index 632433f80..2dda4ef9d 100644 --- a/src/pgen/friedmann.cpp +++ b/src/pgen/friedmann.cpp @@ -36,13 +36,13 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, 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].first; + const int ivlo = imap[fluid_prim::velocity::name()].first; const int ieng = imap[fluid_prim::energy].first; const int iye = imap[fluid_prim::ye].second; const int iprs = imap[fluid_prim::pressure].first; diff --git a/src/pgen/homogeneous_sphere.cpp b/src/pgen/homogeneous_sphere.cpp index c339df474..b1e80de83 100644 --- a/src/pgen/homogeneous_sphere.cpp +++ b/src/pgen/homogeneous_sphere.cpp @@ -31,13 +31,13 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto v = rc->PackVariables( std::vector({radmoment_prim::J, radmoment_prim::H, fluid_prim::density::name(), fluid_prim::temperature, - fluid_prim::velocity, radmoment_internal::xi, + fluid_prim::velocity::name(), radmoment_internal::xi, radmoment_internal::phi}), imap); auto idJ = imap.GetFlatIdx(radmoment_prim::J); auto idH = imap.GetFlatIdx(radmoment_prim::H); - auto idv = imap.GetFlatIdx(fluid_prim::velocity); + auto idv = imap.GetFlatIdx(fluid_prim::velocity::name()); auto ixi = imap.GetFlatIdx(radmoment_internal::xi); auto iphi = imap.GetFlatIdx(radmoment_internal::phi); const int prho = imap[fluid_prim::density::name()].first; diff --git a/src/pgen/kh.cpp b/src/pgen/kh.cpp index d67e1cc79..b73b18319 100644 --- a/src/pgen/kh.cpp +++ b/src/pgen/kh.cpp @@ -26,15 +26,15 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, 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].first; - const int ivhi = imap[fluid_prim::velocity].second; + const int ivlo = imap[fluid_prim::velocity::name()].first; + const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy].first; const int ib_lo = imap[fluid_prim::bfield].first; const int ib_hi = imap[fluid_prim::bfield].second; diff --git a/src/pgen/leptoneq.cpp b/src/pgen/leptoneq.cpp index 387d6dded..475ec168b 100644 --- a/src/pgen/leptoneq.cpp +++ b/src/pgen/leptoneq.cpp @@ -31,13 +31,13 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables({p::density::name(), p::velocity, p::energy, p::ye, + auto v = rc->PackVariables({p::density::name(), p::velocity::name(), p::energy, p::ye, p::pressure, p::temperature, p::gamma1}, imap); const int irho = imap[p::density::name()].first; - const int ivlo = imap[p::velocity].first; - const int ivhi = imap[p::velocity].second; + const int ivlo = imap[p::velocity::name()].first; + const int ivhi = imap[p::velocity::name()].second; const int ieng = imap[p::energy].first; const int iye = imap[p::ye].first; const int iprs = imap[p::pressure].first; diff --git a/src/pgen/linear_modes.cpp b/src/pgen/linear_modes.cpp index 6a771121e..2564642aa 100644 --- a/src/pgen/linear_modes.cpp +++ b/src/pgen/linear_modes.cpp @@ -43,15 +43,15 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int ndim = pmb->pmy_mesh->ndim; PackIndexMap imap; - std::vector vars({fluid_prim::density::name(), fluid_prim::velocity, - fluid_prim::energy, fluid_prim::bfield, - fluid_prim::pressure, fluid_prim::temperature, - fluid_prim::gamma1, fluid_prim::ye}); + std::vector vars( + {fluid_prim::density::name(), fluid_prim::velocity::name(), fluid_prim::energy, + fluid_prim::bfield, fluid_prim::pressure, fluid_prim::temperature, + fluid_prim::gamma1, fluid_prim::ye}); auto v = rc->PackVariables(vars, imap); const int irho = imap[fluid_prim::density::name()].first; - const int ivlo = imap[fluid_prim::velocity].first; - const int ivhi = imap[fluid_prim::velocity].second; + const int ivlo = imap[fluid_prim::velocity::name()].first; + const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy].first; const int ib_lo = imap[fluid_prim::bfield].first; const int ib_hi = imap[fluid_prim::bfield].second; diff --git a/src/pgen/p2c2p.cpp b/src/pgen/p2c2p.cpp index 4e18de781..d88a929a8 100644 --- a/src/pgen/p2c2p.cpp +++ b/src/pgen/p2c2p.cpp @@ -73,15 +73,15 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, 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].first; - const int ivhi = imap[fluid_prim::velocity].second; + const int ivlo = imap[fluid_prim::velocity::name()].first; + const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy].first; const int ib_lo = imap[fluid_prim::bfield].first; const int ib_hi = imap[fluid_prim::bfield].second; diff --git a/src/pgen/progenitor.cpp b/src/pgen/progenitor.cpp index 7fbae9bc1..bd0d3100c 100644 --- a/src/pgen/progenitor.cpp +++ b/src/pgen/progenitor.cpp @@ -35,14 +35,14 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto geom = Geometry::GetCoordinateSystem(rc.get()); PackIndexMap imap; - auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, 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].first; - const int ivhi = imap[fluid_prim::velocity].second; + const int ivlo = imap[fluid_prim::velocity::name()].first; + const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy].first; const int ib_lo = imap[fluid_prim::bfield].first; const int ib_hi = imap[fluid_prim::bfield].second; diff --git a/src/pgen/radiation_advection.cpp b/src/pgen/radiation_advection.cpp index 3c32dccc8..7eb43e46f 100644 --- a/src/pgen/radiation_advection.cpp +++ b/src/pgen/radiation_advection.cpp @@ -30,13 +30,13 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto v = rc->PackVariables( std::vector({radmoment_prim::J, radmoment_prim::H, fluid_prim::density::name(), fluid_prim::temperature, - fluid_prim::energy, fluid_prim::velocity, + fluid_prim::energy, fluid_prim::velocity::name(), radmoment_internal::xi, radmoment_internal::phi}), imap); auto idJ = imap.GetFlatIdx(radmoment_prim::J); auto idH = imap.GetFlatIdx(radmoment_prim::H); - auto idv = imap.GetFlatIdx(fluid_prim::velocity); + auto idv = imap.GetFlatIdx(fluid_prim::velocity::name()); auto ixi = imap.GetFlatIdx(radmoment_internal::xi); auto iphi = imap.GetFlatIdx(radmoment_internal::phi); const int prho = imap[fluid_prim::density::name()].first; diff --git a/src/pgen/radiation_equilibration.cpp b/src/pgen/radiation_equilibration.cpp index 359908715..e47778bcc 100644 --- a/src/pgen/radiation_equilibration.cpp +++ b/src/pgen/radiation_equilibration.cpp @@ -31,12 +31,12 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables({radmoment_prim::J, radmoment_prim::H, - radmoment_internal::xi, radmoment_internal::phi, - fluid_prim::density::name(), fluid_prim::temperature, - fluid_prim::pressure, fluid_prim::gamma1, - fluid_prim::energy, fluid_prim::ye, fluid_prim::velocity}, - imap); + auto v = rc->PackVariables( + {radmoment_prim::J, radmoment_prim::H, radmoment_internal::xi, + radmoment_internal::phi, fluid_prim::density::name(), fluid_prim::temperature, + fluid_prim::pressure, fluid_prim::gamma1, fluid_prim::energy, fluid_prim::ye, + fluid_prim::velocity::name()}, + imap); auto idJ = imap.GetFlatIdx(radmoment_prim::J); auto idH = imap.GetFlatIdx(radmoment_prim::H); @@ -49,7 +49,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int igm1 = imap[fluid_prim::gamma1].first; const int ieng = imap[fluid_prim::energy].first; const int pye = imap[fluid_prim::ye].first; - auto idv = imap.GetFlatIdx(fluid_prim::velocity); + auto idv = imap.GetFlatIdx(fluid_prim::velocity::name()); const auto specB = idJ.GetBounds(1); const Real J = pin->GetOrAddReal("radiation_equilibration", "J", 0.0); diff --git a/src/pgen/rhs_tester.cpp b/src/pgen/rhs_tester.cpp index 850f58356..7a9622ce3 100644 --- a/src/pgen/rhs_tester.cpp +++ b/src/pgen/rhs_tester.cpp @@ -20,15 +20,15 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, 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].first; - const int ivhi = imap[fluid_prim::velocity].second; + const int ivlo = imap[fluid_prim::velocity::name()].first; + const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy].first; const int ib_lo = imap[fluid_prim::bfield].first; const int ib_hi = imap[fluid_prim::bfield].second; diff --git a/src/pgen/rotor.cpp b/src/pgen/rotor.cpp index 6abda006f..ce769dbe3 100644 --- a/src/pgen/rotor.cpp +++ b/src/pgen/rotor.cpp @@ -32,15 +32,15 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, 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].first; - const int ivhi = imap[fluid_prim::velocity].second; + const int ivlo = imap[fluid_prim::velocity::name()].first; + const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy].first; const int ib_lo = imap[fluid_prim::bfield].first; const int ib_hi = imap[fluid_prim::bfield].second; diff --git a/src/pgen/sedov.cpp b/src/pgen/sedov.cpp index 95d123cfb..09924ea08 100644 --- a/src/pgen/sedov.cpp +++ b/src/pgen/sedov.cpp @@ -31,15 +31,15 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, 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].first; - const int ivhi = imap[fluid_prim::velocity].second; + const int ivlo = imap[fluid_prim::velocity::name()].first; + const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy].first; const int ib_lo = imap[fluid_prim::bfield].first; const int ib_hi = imap[fluid_prim::bfield].second; diff --git a/src/pgen/shock_tube.cpp b/src/pgen/shock_tube.cpp index 4e38035e9..435e908a7 100644 --- a/src/pgen/shock_tube.cpp +++ b/src/pgen/shock_tube.cpp @@ -35,15 +35,15 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, 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].first; - const int ivhi = imap[fluid_prim::velocity].second; + const int ivlo = imap[fluid_prim::velocity::name()].first; + const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy].first; const int ib_lo = imap[fluid_prim::bfield].first; const int ib_hi = imap[fluid_prim::bfield].second; diff --git a/src/pgen/thin_cooling.cpp b/src/pgen/thin_cooling.cpp index 4ac14c44f..db2943986 100644 --- a/src/pgen/thin_cooling.cpp +++ b/src/pgen/thin_cooling.cpp @@ -31,13 +31,13 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables({p::density::name(), p::velocity, p::energy, p::ye, + auto v = rc->PackVariables({p::density::name(), p::velocity::name(), p::energy, p::ye, p::pressure, p::temperature, p::gamma1}, imap); const int irho = imap[p::density::name()].first; - const int ivlo = imap[p::velocity].first; - const int ivhi = imap[p::velocity].second; + const int ivlo = imap[p::velocity::name()].first; + const int ivhi = imap[p::velocity::name()].second; const int ieng = imap[p::energy].first; const int iye = imap[p::ye].second; const int iprs = imap[p::pressure].first; diff --git a/src/pgen/torus.cpp b/src/pgen/torus.cpp index 7859ef57c..fcbe9b812 100644 --- a/src/pgen/torus.cpp +++ b/src/pgen/torus.cpp @@ -138,15 +138,15 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { bool do_rad = rad_pkg->Param("active"); PackIndexMap imap; - auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1, radmoment_prim::J, radmoment_prim::H}, imap); const int irho = imap[fluid_prim::density::name()].first; - const int ivlo = imap[fluid_prim::velocity].first; - const int ivhi = imap[fluid_prim::velocity].second; + const int ivlo = imap[fluid_prim::velocity::name()].first; + const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy].first; const int iblo = imap[fluid_prim::bfield].first; const int ibhi = imap[fluid_prim::bfield].second; @@ -679,13 +679,13 @@ void ComputeBetas(Mesh *pmesh, Real rho_min_bnorm, Real &beta_min_global, PackIndexMap imap; auto v = - rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), fluid_prim::bfield, fluid_prim::pressure, radmoment_prim::J}, imap); const int irho = imap[fluid_prim::density::name()].first; - const int ivlo = imap[fluid_prim::velocity].first; - const int ivhi = imap[fluid_prim::velocity].second; + const int ivlo = imap[fluid_prim::velocity::name()].first; + const int ivhi = imap[fluid_prim::velocity::name()].second; const int iblo = imap[fluid_prim::bfield].first; const int ibhi = imap[fluid_prim::bfield].second; const int iprs = imap[fluid_prim::pressure].first; diff --git a/src/pgen/tov.cpp b/src/pgen/tov.cpp index d56bc2b42..1b52d9b42 100644 --- a/src/pgen/tov.cpp +++ b/src/pgen/tov.cpp @@ -71,15 +71,15 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto geom = Geometry::GetCoordinateSystem(rc.get()); PackIndexMap imap; - auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity, + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, 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].first; - const int ivhi = imap[fluid_prim::velocity].second; + const int ivlo = imap[fluid_prim::velocity::name()].first; + const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy].first; const int iblo = imap[fluid_prim::bfield].first; const int ibhi = imap[fluid_prim::bfield].second; diff --git a/src/phoebus_boundaries/phoebus_boundaries.cpp b/src/phoebus_boundaries/phoebus_boundaries.cpp index c983257dd..b38c3a97d 100644 --- a/src/phoebus_boundaries/phoebus_boundaries.cpp +++ b/src/phoebus_boundaries/phoebus_boundaries.cpp @@ -162,7 +162,7 @@ void PolarInnerX2(std::shared_ptr> &rc, bool coarse) { std::string bc_vars = fluid->Param("bc_vars"); PARTHENON_REQUIRE(bc_vars == "primitive", "Polar X2 reflecting BCs not supported"); - const auto idx_pvel = imap.GetFlatIdx(fluid_prim::velocity, false); + const auto idx_pvel = imap.GetFlatIdx(fluid_prim::velocity::name(), false); const auto idx_pb = imap.GetFlatIdx(fluid_prim::bfield, false); pmb->par_for_bndry( @@ -195,7 +195,7 @@ void PolarOuterX2(std::shared_ptr> &rc, bool coarse) { std::string bc_vars = fluid->Param("bc_vars"); PARTHENON_REQUIRE(bc_vars == "primitive", "Polar X2 reflecting BCs not supported"); - const auto idx_pvel = imap.GetFlatIdx(fluid_prim::velocity, false); + const auto idx_pvel = imap.GetFlatIdx(fluid_prim::velocity::name(), false); const auto idx_pb = imap.GetFlatIdx(fluid_prim::bfield, false); const std::string label = "PolarOuterX2Prim"; @@ -227,7 +227,7 @@ void OutflowOuterX1(std::shared_ptr> &rc, bool coarse) { auto domain = IndexDomain::outer_x1; - const int pv_lo = imap[fluid_prim::velocity].first; + const int pv_lo = imap[fluid_prim::velocity::name()].first; auto idx_H = imap.GetFlatIdx(radmoment_prim::H, false); auto &fluid = rc->GetMeshPointer()->packages.Get("fluid"); @@ -337,11 +337,11 @@ TaskStatus ConvertBoundaryConditions(std::shared_ptr> &rc) { const bool coarse = false; PackIndexMap imap; - std::vector vars{fluid_prim::velocity, radmoment_prim::H}; + std::vector vars{fluid_prim::velocity::name(), radmoment_prim::H}; auto q = rc->PackVariables(vars, imap, coarse); auto nb1 = IndexRange{0, 0}; - const int pv_lo = imap[fluid_prim::velocity].first; + const int pv_lo = imap[fluid_prim::velocity::name()].first; auto idx_H = imap.GetFlatIdx(radmoment_prim::H, false); const int num_species = diff --git a/src/phoebus_utils/variables.hpp b/src/phoebus_utils/variables.hpp index f4b087549..41981d0f5 100644 --- a/src/phoebus_utils/variables.hpp +++ b/src/phoebus_utils/variables.hpp @@ -34,7 +34,7 @@ namespace fluid_prim { VARIABLE(p, density); -// constexpr char density[] = "p.density"; +VARIABLE(p, velocity); constexpr char velocity[] = "p.velocity"; constexpr char energy[] = "p.energy"; constexpr char bfield[] = "p.bfield"; diff --git a/src/radiation/cooling_function.cpp b/src/radiation/cooling_function.cpp index 9e1302131..1eedf0f1b 100644 --- a/src/radiation/cooling_function.cpp +++ b/src/radiation/cooling_function.cpp @@ -113,7 +113,7 @@ TaskStatus CoolingFunctionCalculateFourForce(MeshBlockData *rc, const doub namespace iv = internal_variables; auto *pmb = rc->GetParentPointer(); - std::vector vars({c::density, p::density::name(), p::velocity, + std::vector vars({c::density, p::density::name(), p::velocity::name(), p::temperature, p::ye, c::energy, iv::Gcov, iv::GcovHeat, iv::GcovCool, iv::Gye, iv::tau, p::energy}); @@ -121,8 +121,8 @@ TaskStatus CoolingFunctionCalculateFourForce(MeshBlockData *rc, const doub auto v = rc->PackVariables(vars, imap); const int crho = imap[c::density].first; const int prho = imap[p::density::name()].first; - const int pvlo = imap[p::velocity].first; - const int pvhi = imap[p::velocity].second; + const int pvlo = imap[p::velocity::name()].first; + const int pvhi = imap[p::velocity::name()].second; const int ptemp = imap[p::temperature].first; const int pye = imap[p::ye].first; const int penergy = imap[p::energy].first; diff --git a/src/radiation/mocmc.cpp b/src/radiation/mocmc.cpp index 2db4915d7..734606230 100644 --- a/src/radiation/mocmc.cpp +++ b/src/radiation/mocmc.cpp @@ -81,16 +81,16 @@ void MOCMCInitSamples(T *rc) { const auto opac = opac_pkg->template Param("opacities"); StateDescriptor *eos = pmb->packages.Get("eos").get(); - std::vector variables{pr::J, pr::H, pf::density::name(), - pf::velocity, pf::temperature, pf::ye, - im::dnsamp}; + std::vector variables{ + pr::J, pr::H, pf::density::name(), pf::velocity::name(), + pf::temperature, pf::ye, im::dnsamp}; PackIndexMap imap; auto v = rc->PackVariables(variables, imap); auto pJ = imap.GetFlatIdx(pr::J); auto pH = imap.GetFlatIdx(pr::H); auto pdens = imap[pf::density::name()].first; - auto pv = imap.GetFlatIdx(fluid_prim::velocity); + auto pv = imap.GetFlatIdx(fluid_prim::velocity::name()); auto pT = imap[pf::temperature].first; auto pye = imap[pf::ye].first; auto dn = imap[im::dnsamp].first; @@ -243,7 +243,7 @@ TaskStatus MOCMCSampleBoundaries(T *rc) { IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); - std::vector variables{pr::J, pf::velocity, ir::tilPi}; + std::vector variables{pr::J, pf::velocity::name(), ir::tilPi}; PackIndexMap imap; auto v = rc->PackVariables(variables, imap); @@ -260,7 +260,7 @@ TaskStatus MOCMCSampleBoundaries(T *rc) { const auto &mu_hi = swarm->template Get("mu_hi").Get(); const auto &phi_lo = swarm->template Get("phi_lo").Get(); const auto &phi_hi = swarm->template Get("phi_hi").Get(); - auto pv = imap.GetFlatIdx(pf::velocity); + auto pv = imap.GetFlatIdx(pf::velocity::name()); auto iTilPi = imap.GetFlatIdx(ir::tilPi); auto iJ = imap.GetFlatIdx(pr::J); @@ -358,7 +358,7 @@ TaskStatus MOCMCReconstruction(T *rc) { IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); - std::vector variables{pf::velocity, ir::tilPi}; + std::vector variables{pf::velocity::name(), ir::tilPi}; PackIndexMap imap; auto v = rc->PackVariables(variables, imap); @@ -371,7 +371,7 @@ TaskStatus MOCMCReconstruction(T *rc) { const auto &mu_hi = swarm->template Get("mu_hi").Get(); const auto &phi_lo = swarm->template Get("phi_lo").Get(); const auto &phi_hi = swarm->template Get("phi_hi").Get(); - auto pv = imap.GetFlatIdx(pf::velocity); + auto pv = imap.GetFlatIdx(pf::velocity::name()); auto iTilPi = imap.GetFlatIdx(ir::tilPi); auto nusamp = rad->Param>("nusamp"); @@ -521,10 +521,21 @@ TaskStatus MOCMCFluidSource(T *rc, const Real dt, const bool update_fluid) { StateDescriptor *eos = pmb->packages.Get("eos").get(); const auto eos_d = eos->template Param("d.EOS"); - std::vector variables{ - cr::E, cr::F, pr::J, pr::H, pf::density::name(), - pf::energy, pf::velocity, pf::temperature, pf::ye, ir::tilPi, - ir::kappaH, im::dnsamp, im::Inu0, im::Inu1, im::jinvs}; + std::vector variables{cr::E, + cr::F, + pr::J, + pr::H, + pf::density::name(), + pf::energy, + pf::velocity::name(), + pf::temperature, + pf::ye, + ir::tilPi, + ir::kappaH, + im::dnsamp, + im::Inu0, + im::Inu1, + im::jinvs}; if (update_fluid) { variables.push_back(cf::energy); variables.push_back(cf::momentum); @@ -537,7 +548,7 @@ TaskStatus MOCMCFluidSource(T *rc, const Real dt, const bool update_fluid) { const auto pH = imap.GetFlatIdx(pr::H); const auto pdens = imap[pf::density::name()].first; const auto peng = imap[pf::energy].first; - const auto pv = imap.GetFlatIdx(fluid_prim::velocity); + const auto pv = imap.GetFlatIdx(fluid_prim::velocity::name()); const auto pT = imap[pf::temperature].first; const auto pye = imap[pf::ye].first; const auto Inu0 = imap.GetFlatIdx(im::Inu0); @@ -796,7 +807,7 @@ TaskStatus MOCMCEddington(T *rc) { auto geom = Geometry::GetCoordinateSystem(rc); - std::vector variables{ir::tilPi, pf::velocity}; + std::vector variables{ir::tilPi, pf::velocity::name()}; PackIndexMap imap; auto v = rc->PackVariables(variables, imap); @@ -807,7 +818,7 @@ TaskStatus MOCMCEddington(T *rc) { const auto &phi_lo = swarm->template Get("phi_lo").Get(); const auto &phi_hi = swarm->template Get("phi_hi").Get(); auto iTilPi = imap.GetFlatIdx(ir::tilPi); - const auto pvel_lo = imap[pf::velocity].first; + const auto pvel_lo = imap[pf::velocity::name()].first; const int nu_bins = rad->Param("nu_bins"); const Real dlnu = rad->Param("dlnu"); diff --git a/src/radiation/moments.cpp b/src/radiation/moments.cpp index ff5ba23e9..754696313 100644 --- a/src/radiation/moments.cpp +++ b/src/radiation/moments.cpp @@ -71,7 +71,7 @@ TaskStatus MomentCon2PrimImpl(T *rc) { IndexRange kb = rc->GetBoundsK(IndexDomain::entire); std::vector variables{ - cr::E, cr::F, pr::J, pr::H, fluid_prim::velocity, + cr::E, cr::F, pr::J, pr::H, fluid_prim::velocity::name(), ir::xi, ir::phi, ir::c2pfail, ir::tilPi}; PackIndexMap imap; auto v = rc->PackVariables(variables, imap); @@ -80,7 +80,7 @@ TaskStatus MomentCon2PrimImpl(T *rc) { auto pJ = imap.GetFlatIdx(pr::J); auto cF = imap.GetFlatIdx(cr::F); auto pH = imap.GetFlatIdx(pr::H); - auto pv = imap.GetFlatIdx(fluid_prim::velocity); + auto pv = imap.GetFlatIdx(fluid_prim::velocity::name()); auto iTilPi = imap.GetFlatIdx(ir::tilPi, false); auto specB = cE.GetBounds(1); auto dirB = pH.GetBounds(2); @@ -198,7 +198,8 @@ TaskStatus MomentPrim2ConImpl(T *rc, IndexDomain domain) { IndexRange jb = rc->GetBoundsJ(domain); IndexRange kb = rc->GetBoundsK(domain); - std::vector variables{cr::E, cr::F, pr::J, pr::H, fluid_prim::velocity}; + std::vector variables{cr::E, cr::F, pr::J, pr::H, + fluid_prim::velocity::name()}; if (programming::is_specialization_of::value) { variables.push_back(ir::tilPi); } @@ -209,7 +210,7 @@ TaskStatus MomentPrim2ConImpl(T *rc, IndexDomain domain) { auto pJ = imap.GetFlatIdx(pr::J); auto cF = imap.GetFlatIdx(cr::F); auto pH = imap.GetFlatIdx(pr::H); - auto pv = imap.GetFlatIdx(fluid_prim::velocity); + auto pv = imap.GetFlatIdx(fluid_prim::velocity::name()); auto iTilPi = imap.GetFlatIdx(ir::tilPi, false); auto specB = cE.GetBounds(1); @@ -321,7 +322,7 @@ TaskStatus ReconstructEdgeStates(T *rc) { ParArrayND ql_v = rc->Get(ir::ql_v).data; ParArrayND qr_v = rc->Get(ir::qr_v).data; VariablePack v_vel = - rc->PackVariables(std::vector{fluid_prim::velocity}); + rc->PackVariables(std::vector{fluid_prim::velocity::name()}); auto qIdx = imap_ql.GetFlatIdx(ir::ql); const int nspec = qIdx.DimSize(1); diff --git a/src/radiation/moments_source.cpp b/src/radiation/moments_source.cpp index b0d2fb1e5..3e77d9d67 100644 --- a/src/radiation/moments_source.cpp +++ b/src/radiation/moments_source.cpp @@ -217,10 +217,11 @@ TaskStatus MomentFluidSourceImpl(T *rc, Real dt, bool update_fluid) { namespace c = fluid_cons; namespace p = fluid_prim; std::vector vars{ - c::density, c::energy, c::momentum, c::ye, cr::E, - cr::F, c::bfield, p::density::name(), p::temperature, p::energy, - p::ye, p::velocity, p::pressure, p::gamma1, p::bfield, - pr::J, pr::H, ir::kappaJ, ir::kappaH, ir::JBB, + c::density, c::energy, c::momentum, c::ye, + cr::E, cr::F, c::bfield, p::density::name(), + p::temperature, p::energy, p::ye, p::velocity::name(), + p::pressure, p::gamma1, p::bfield, pr::J, + pr::H, ir::kappaJ, ir::kappaH, ir::JBB, ir::tilPi}; PackIndexMap imap; @@ -234,7 +235,7 @@ TaskStatus MomentFluidSourceImpl(T *rc, Real dt, bool update_fluid) { auto idx_kappaH = imap.GetFlatIdx(ir::kappaH); auto idx_JBB = imap.GetFlatIdx(ir::JBB); auto idx_tilPi = imap.GetFlatIdx(ir::tilPi, false); - auto pv = imap.GetFlatIdx(p::velocity); + auto pv = imap.GetFlatIdx(p::velocity::name()); int prho = imap[p::density::name()].first; int peng = imap[p::energy].first; diff --git a/src/radiation/monte_carlo.cpp b/src/radiation/monte_carlo.cpp index 07d67b67b..793045ea6 100644 --- a/src/radiation/monte_carlo.cpp +++ b/src/radiation/monte_carlo.cpp @@ -150,15 +150,16 @@ TaskStatus MonteCarloSourceParticles(MeshBlock *pmb, MeshBlockData *rc, const Real h_code = code_constants.h; const Real mp_code = code_constants.mp; - std::vector vars({p::density::name(), p::temperature, p::ye, p::velocity, - "dNdlnu_max", "dNdlnu", "dN", "Ns", iv::Gcov, iv::Gye}); + std::vector vars({p::density::name(), p::temperature, p::ye, + p::velocity::name(), "dNdlnu_max", "dNdlnu", "dN", "Ns", + iv::Gcov, iv::Gye}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); const int pye = imap[p::ye].first; const int pdens = imap[p::density::name()].first; const int ptemp = imap[p::temperature].first; - const int pvlo = imap[p::velocity].first; - const int pvhi = imap[p::velocity].second; + const int pvlo = imap[p::velocity::name()].first; + const int pvhi = imap[p::velocity::name()].second; const int idNdlnu = imap["dNdlnu"].first; const int idNdlnu_max = imap["dNdlnu_max"].first; const int idN = imap["dN"].first; @@ -455,14 +456,14 @@ TaskStatus MonteCarloTransport(MeshBlock *pmb, MeshBlockData *rc, const Real h_code = code_constants.h; const Real mp_code = code_constants.mp; - std::vector vars( - {p::density::name(), p::ye, p::velocity, p::temperature, iv::Gcov, iv::Gye}); + std::vector vars({p::density::name(), p::ye, p::velocity::name(), + p::temperature, iv::Gcov, iv::Gye}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); const int prho = imap[p::density::name()].first; const int iye = imap[p::ye].first; - const int ivlo = imap[p::velocity].first; - const int ivhi = imap[p::velocity].second; + const int ivlo = imap[p::velocity::name()].first; + const int ivhi = imap[p::velocity::name()].second; const int itemp = imap[p::temperature].first; const int iGcov_lo = imap[iv::Gcov].first; const int iGcov_hi = imap[iv::Gcov].second; diff --git a/src/radiation/radiation.cpp b/src/radiation/radiation.cpp index 77d01de2a..b1773f2b7 100644 --- a/src/radiation/radiation.cpp +++ b/src/radiation/radiation.cpp @@ -579,9 +579,9 @@ Real EstimateTimestepBlock(MeshBlockData *rc) { // Note that this is still used for the cooling function even though that option // contains no transport. This is useful for consistency between methods. auto pmb = rc->GetBlockPointer(); - IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::interior); - IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); - IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); + IndexRange ib = rc->GetBoundsI(IndexDomain::interior); + IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); + IndexRange kb = rc->GetBoundsK(IndexDomain::interior); StateDescriptor *rad = pmb->packages.Get("radiation").get(); @@ -591,9 +591,9 @@ Real EstimateTimestepBlock(MeshBlockData *rc) { auto geom = Geometry::GetCoordinateSystem(rc); PackIndexMap imap; - std::vector vars{ir::kappaH, p::velocity}; + std::vector vars{ir::kappaH, p::velocity::name()}; auto v = rc->PackVariables(vars, imap); - auto idx_v = imap.GetFlatIdx(p::velocity); + auto idx_v = imap.GetFlatIdx(p::velocity::name()); auto idx_kappaH = imap.GetFlatIdx(ir::kappaH, false); auto num_species = rad->Param("num_species"); diff --git a/tst/unit/monopole_gr/test_interp_3d_to_1d.cpp b/tst/unit/monopole_gr/test_interp_3d_to_1d.cpp index f57edc949..567f5cdaf 100644 --- a/tst/unit/monopole_gr/test_interp_3d_to_1d.cpp +++ b/tst/unit/monopole_gr/test_interp_3d_to_1d.cpp @@ -41,19 +41,10 @@ TEST_CASE("Coordinates in spherical geometry", "[MonopoleGR]") { GIVEN("A parthenon coords object tuned to spherical geometry") { // TODO(JMM): This test is more of a sanity check than anything ParameterInput pin; - RegionSize rs; - rs.x1min = 0; - rs.x1max = 100; - rs.x2min = 0; - rs.x2max = M_PI; - rs.x3min = 0; - rs.x3max = 2 * M_PI; - rs.nx1 = 10; - rs.nx2 = 1; - rs.nx3 = 1; - const Real dr_true = (rs.x1max - rs.x1min) / (rs.nx1); - const Real dth_true = (rs.x2max - rs.x2min) / (rs.nx2); - const Real dph_true = (rs.x3max - rs.x3min) / (rs.nx3); + RegionSize rs({0, 0, 0}, {100, M_PI, 2*M_PI}, {1, 1, 1}, {10, 1, 1}); + const Real dr_true = (rs.xmax(X1DIR) - rs.xmin(X1DIR)) / (rs.nx(X1DIR)); + const Real dth_true = (rs.xmax(X2DIR) - rs.xmin(X2DIR)) / (rs.nx(X2DIR)); + const Real dph_true = (rs.xmax(X3DIR) - rs.xmin(X3DIR)) / (rs.nx(X3DIR)); Coordinates_t coords(rs, &pin); WHEN("We loop through the grid") { int nwrong = 0; @@ -61,7 +52,7 @@ TEST_CASE("Coordinates in spherical geometry", "[MonopoleGR]") { const int j = 0; parthenon::par_reduce( parthenon::loop_pattern_flatrange_tag, "check coords values", - parthenon::DevExecSpace(), 0, rs.nx1 - 1, + parthenon::DevExecSpace(), 0, rs.nx(X1DIR) - 1, KOKKOS_LAMBDA(const int i, int &nw) { Real r, th, ph, dr, dth, dph, dv; MonopoleGR::Interp3DTo1D::GetCoordsAndDerivsSph(k, j, i, coords, r, th, ph, From 1c5644672c83b803b1973ef5405c8994dc748872 Mon Sep 17 00:00:00 2001 From: Jonah Maxwell Miller Date: Tue, 5 Dec 2023 18:55:48 -0700 Subject: [PATCH 05/14] formatting --- src/analysis/history.cpp | 6 ++++-- tst/unit/monopole_gr/test_interp_3d_to_1d.cpp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/analysis/history.cpp b/src/analysis/history.cpp index 7b9b02bca..5b759c153 100644 --- a/src/analysis/history.cpp +++ b/src/analysis/history.cpp @@ -78,7 +78,8 @@ Real ReduceJetEnergyFlux(MeshData *md) { const Real xh = pars.Get("xh"); namespace p = fluid_prim; - const std::vector vars({p::density::name(), p::bfield, p::velocity::name()}); + const std::vector vars( + {p::density::name(), p::bfield, p::velocity::name()}); PackIndexMap imap; auto pack = md->PackVariables(vars, imap); @@ -137,7 +138,8 @@ Real ReduceJetMomentumFlux(MeshData *md) { const Real xh = pars.Get("xh"); namespace p = fluid_prim; - const std::vector vars({p::density::name(), p::bfield, p::velocity::name()}); + const std::vector vars( + {p::density::name(), p::bfield, p::velocity::name()}); PackIndexMap imap; auto pack = md->PackVariables(vars, imap); diff --git a/tst/unit/monopole_gr/test_interp_3d_to_1d.cpp b/tst/unit/monopole_gr/test_interp_3d_to_1d.cpp index 567f5cdaf..1f1060ef0 100644 --- a/tst/unit/monopole_gr/test_interp_3d_to_1d.cpp +++ b/tst/unit/monopole_gr/test_interp_3d_to_1d.cpp @@ -41,7 +41,7 @@ TEST_CASE("Coordinates in spherical geometry", "[MonopoleGR]") { GIVEN("A parthenon coords object tuned to spherical geometry") { // TODO(JMM): This test is more of a sanity check than anything ParameterInput pin; - RegionSize rs({0, 0, 0}, {100, M_PI, 2*M_PI}, {1, 1, 1}, {10, 1, 1}); + RegionSize rs({0, 0, 0}, {100, M_PI, 2 * M_PI}, {1, 1, 1}, {10, 1, 1}); const Real dr_true = (rs.xmax(X1DIR) - rs.xmin(X1DIR)) / (rs.nx(X1DIR)); const Real dth_true = (rs.xmax(X2DIR) - rs.xmin(X2DIR)) / (rs.nx(X2DIR)); const Real dph_true = (rs.xmax(X3DIR) - rs.xmin(X3DIR)) / (rs.nx(X3DIR)); From 31a58005a56c6818fbc87128a086218a73d92eed Mon Sep 17 00:00:00 2001 From: Jonah Maxwell Miller Date: Wed, 6 Dec 2023 12:44:33 -0700 Subject: [PATCH 06/14] how was I even allowed to have a type and a var with the same name? --- src/phoebus_utils/variables.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/phoebus_utils/variables.hpp b/src/phoebus_utils/variables.hpp index 41981d0f5..31516f881 100644 --- a/src/phoebus_utils/variables.hpp +++ b/src/phoebus_utils/variables.hpp @@ -35,7 +35,6 @@ namespace fluid_prim { VARIABLE(p, density); VARIABLE(p, velocity); -constexpr char velocity[] = "p.velocity"; constexpr char energy[] = "p.energy"; constexpr char bfield[] = "p.bfield"; constexpr char ye[] = "p.ye"; From a8353498cade8cfc6a43acfa85ac338c683037fd Mon Sep 17 00:00:00 2001 From: Jonah Maxwell Miller Date: Wed, 6 Dec 2023 12:50:28 -0700 Subject: [PATCH 07/14] fix moments code to use velocity class --- src/radiation/moments.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/radiation/moments.cpp b/src/radiation/moments.cpp index 754696313..429e70c7c 100644 --- a/src/radiation/moments.cpp +++ b/src/radiation/moments.cpp @@ -774,7 +774,8 @@ TaskStatus CalculateGeometricSourceImpl(T *rc, T *rc_src) { namespace ir = radmoment_internal; namespace p = fluid_prim; PackIndexMap imap; - std::vector vars{cr::E, cr::F, pr::J, pr::H, p::velocity, ir::tilPi}; + std::vector vars{cr::E, cr::F, pr::J, pr::H, p::velocity::name(), + ir::tilPi}; vars.push_back(diagnostic_variables::r_src_terms); #if SET_FLUX_SRC_DIAGS vars.push_back(diagnostic_variables::r_src_terms); @@ -784,7 +785,7 @@ TaskStatus CalculateGeometricSourceImpl(T *rc, T *rc_src) { auto idx_F = imap.GetFlatIdx(cr::F); auto idx_J = imap.GetFlatIdx(pr::J); auto idx_H = imap.GetFlatIdx(pr::H); - auto pv = imap.GetFlatIdx(p::velocity); + auto pv = imap.GetFlatIdx(p::velocity::name()); auto iTilPi = imap.GetFlatIdx(ir::tilPi, false); auto idx_diag = imap.GetFlatIdx(diagnostic_variables::r_src_terms, false); @@ -943,12 +944,13 @@ TaskStatus MomentCalculateOpacities(T *rc) { namespace ir = radmoment_internal; namespace c = fluid_cons; namespace p = fluid_prim; - std::vector vars{p::density::name(), p::temperature, p::ye, p::velocity, - ir::kappaJ, ir::kappaH, ir::JBB}; + std::vector vars{ + p::density::name(), p::temperature, p::ye, p::velocity::name(), + ir::kappaJ, ir::kappaH, ir::JBB}; PackIndexMap imap; auto v = rc->PackVariables(vars, imap); - auto pv = imap.GetFlatIdx(p::velocity); + auto pv = imap.GetFlatIdx(p::velocity::name()); int prho = imap[p::density::name()].first; int pT = imap[p::temperature].first; From 19cad1a6ed0d5ad4f6e57663098ea2bafb7306ba Mon Sep 17 00:00:00 2001 From: Jonah Maxwell Miller Date: Wed, 6 Dec 2023 13:29:39 -0700 Subject: [PATCH 08/14] move prim and cons energy to variable type --- src/fixup/fixup.cpp | 63 +++++++++++++++------------- src/fixup/fixup_c2p.cpp | 8 ++-- src/fixup/fixup_src.cpp | 11 ++--- src/fluid/con2prim.hpp | 22 +++++----- src/fluid/con2prim_robust.hpp | 22 +++++----- src/fluid/fluid.cpp | 27 ++++++------ src/fluid/fluid.hpp | 4 +- src/fluid/riemann.hpp | 15 +++---- src/fluid/tmunu.hpp | 4 +- src/monopole_gr/interp_3d_to_1d.hpp | 2 +- src/pgen/advection.cpp | 8 ++-- src/pgen/blandford_mckee.cpp | 8 ++-- src/pgen/bondi.cpp | 8 ++-- src/pgen/friedmann.cpp | 8 ++-- src/pgen/kh.cpp | 8 ++-- src/pgen/leptoneq.cpp | 6 +-- src/pgen/linear_modes.cpp | 8 ++-- src/pgen/p2c2p.cpp | 8 ++-- src/pgen/progenitor.cpp | 8 ++-- src/pgen/radiation_advection.cpp | 4 +- src/pgen/radiation_equilibration.cpp | 6 +-- src/pgen/rhs_tester.cpp | 8 ++-- src/pgen/rotor.cpp | 8 ++-- src/pgen/sedov.cpp | 8 ++-- src/pgen/shock_tube.cpp | 8 ++-- src/pgen/thin_cooling.cpp | 6 +-- src/pgen/torus.cpp | 13 +++--- src/pgen/tov.cpp | 8 ++-- src/phoebus_driver.cpp | 2 +- src/phoebus_utils/variables.hpp | 4 +- src/radiation/cooling_function.cpp | 7 ++-- src/radiation/mocmc.cpp | 8 ++-- src/radiation/moments_source.cpp | 22 ++++++---- src/radiation/radiation.cpp | 4 +- 34 files changed, 191 insertions(+), 173 deletions(-) diff --git a/src/fixup/fixup.cpp b/src/fixup/fixup.cpp index a37e0fd8b..c5c23fa5b 100644 --- a/src/fixup/fixup.cpp +++ b/src/fixup/fixup.cpp @@ -307,9 +307,10 @@ TaskStatus ApplyFloorsImpl(T *rc, IndexDomain domain = IndexDomain::entire) { if (!enable_floors) return TaskStatus::complete; const std::vector vars( - {p::density::name(), c::density, p::velocity::name(), c::momentum, p::energy, - c::energy, p::bfield, 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::density::name(), c::density, p::velocity::name(), c::momentum, + p::energy::name(), c::energy::name(), p::bfield, 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}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); @@ -320,8 +321,8 @@ TaskStatus ApplyFloorsImpl(T *rc, IndexDomain domain = IndexDomain::entire) { const int pvel_hi = imap[p::velocity::name()].second; const int cmom_lo = imap[c::momentum].first; const int cmom_hi = imap[c::momentum].second; - const int peng = imap[p::energy].first; - const int ceng = imap[c::energy].first; + const int peng = imap[p::energy::name()].first; + const int ceng = imap[c::energy::name()].first; const int prs = imap[p::pressure].first; const int tmp = imap[p::temperature].first; const int gm1 = imap[p::gamma1].first; @@ -747,10 +748,10 @@ TaskStatus FixFluxes(MeshBlockData *rc) { } else if (ix1_bc == "reflect") { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( - std::vector({c::density, c::energy, cr::E}), - std::vector({c::density, c::energy, cr::E}), imap); + std::vector({c::density, c::energy::name(), cr::E}), + std::vector({c::density, c::energy::name(), cr::E}), imap); const auto crho = imap[c::density].first; - const auto cener = imap[c::energy].first; + const auto cener = imap[c::energy::name()].first; auto idx_E = imap.GetFlatIdx(cr::E, false); parthenon::par_for( DEFAULT_LOOP_PATTERN, "FixFluxes::x1", DevExecSpace(), kb.s, kb.e, jb.s, jb.e, @@ -779,10 +780,10 @@ TaskStatus FixFluxes(MeshBlockData *rc) { } else if (ox1_bc == "reflect") { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( - std::vector({c::density, c::energy, cr::E}), - std::vector({c::density, c::energy, cr::E}), imap); + std::vector({c::density, c::energy::name(), cr::E}), + std::vector({c::density, c::energy::name(), cr::E}), imap); const auto crho = imap[c::density].first; - const auto cener = imap[c::energy].first; + const auto cener = imap[c::energy::name()].first; auto idx_E = imap.GetFlatIdx(cr::E, false); parthenon::par_for( DEFAULT_LOOP_PATTERN, "FixFluxes::x1", DevExecSpace(), kb.s, kb.e, jb.s, jb.e, @@ -815,12 +816,12 @@ TaskStatus FixFluxes(MeshBlockData *rc) { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( std::vector( - {c::density, c::energy, c::momentum, c::bfield, cr::E, cr::F}), + {c::density, c::energy::name(), c::momentum, c::bfield, cr::E, cr::F}), std::vector( - {c::density, c::energy, c::momentum, c::bfield, cr::E, cr::F}), + {c::density, c::energy::name(), c::momentum, c::bfield, cr::E, cr::F}), imap); const auto crho = imap[c::density].first; - const auto cener = imap[c::energy].first; + const auto cener = imap[c::energy::name()].first; auto idx_cb = imap.GetFlatIdx(c::bfield, false); auto idx_cmom = imap.GetFlatIdx(c::momentum); auto idx_E = imap.GetFlatIdx(cr::E, false); @@ -850,11 +851,13 @@ TaskStatus FixFluxes(MeshBlockData *rc) { } else if (ix2_bc == "reflect") { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( - std::vector({c::density, c::energy, c::momentum, cr::E, cr::F}), - std::vector({c::density, c::energy, c::momentum, cr::E, cr::F}), + std::vector( + {c::density, c::energy::name(), c::momentum, cr::E, cr::F}), + std::vector( + {c::density, c::energy::name(), c::momentum, cr::E, cr::F}), imap); const auto crho = imap[c::density].first; - const auto cener = imap[c::energy].first; + const auto cener = imap[c::energy::name()].first; auto idx_cb = imap.GetFlatIdx(c::bfield, false); auto idx_cmom = imap.GetFlatIdx(c::momentum); auto idx_E = imap.GetFlatIdx(cr::E, false); @@ -893,12 +896,12 @@ TaskStatus FixFluxes(MeshBlockData *rc) { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( std::vector( - {c::density, c::energy, c::momentum, c::bfield, cr::E, cr::F}), + {c::density, c::energy::name(), c::momentum, c::bfield, cr::E, cr::F}), std::vector( - {c::density, c::energy, c::momentum, c::bfield, cr::E, cr::F}), + {c::density, c::energy::name(), c::momentum, c::bfield, cr::E, cr::F}), imap); const auto crho = imap[c::density].first; - const auto cener = imap[c::energy].first; + const auto cener = imap[c::energy::name()].first; auto idx_cb = imap.GetFlatIdx(c::bfield, false); auto idx_cmom = imap.GetFlatIdx(c::momentum); auto idx_E = imap.GetFlatIdx(cr::E, false); @@ -928,11 +931,13 @@ TaskStatus FixFluxes(MeshBlockData *rc) { } else if (ox2_bc == "reflect") { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( - std::vector({c::density, c::energy, c::momentum, cr::E, cr::F}), - std::vector({c::density, c::energy, c::momentum, cr::E, cr::F}), + std::vector( + {c::density, c::energy::name(), c::momentum, cr::E, cr::F}), + std::vector( + {c::density, c::energy::name(), c::momentum, cr::E, cr::F}), imap); const auto crho = imap[c::density].first; - const auto cener = imap[c::energy].first; + const auto cener = imap[c::energy::name()].first; auto idx_cmom = imap.GetFlatIdx(c::momentum); auto idx_cb = imap.GetFlatIdx(c::bfield, false); auto idx_E = imap.GetFlatIdx(cr::E, false); @@ -972,10 +977,10 @@ TaskStatus FixFluxes(MeshBlockData *rc) { } else if (pmb->boundary_flag[BoundaryFace::inner_x3] == BoundaryFlag::reflect) { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( - std::vector({c::density, c::energy, cr::E}), - std::vector({c::density, c::energy, cr::E}), imap); + std::vector({c::density, c::energy::name(), cr::E}), + std::vector({c::density, c::energy::name(), cr::E}), imap); const auto crho = imap[c::density].first; - const auto cener = imap[c::energy].first; + const auto cener = imap[c::energy::name()].first; auto idx_E = imap.GetFlatIdx(cr::E, false); parthenon::par_for( DEFAULT_LOOP_PATTERN, "FixFluxes::x3", DevExecSpace(), kb.s, kb.s, jb.s, jb.e, @@ -1002,10 +1007,10 @@ TaskStatus FixFluxes(MeshBlockData *rc) { } else if (pmb->boundary_flag[BoundaryFace::outer_x3] == BoundaryFlag::reflect) { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( - std::vector({c::density, c::energy, cr::E}), - std::vector({c::density, c::energy, cr::E}), imap); + std::vector({c::density, c::energy::name(), cr::E}), + std::vector({c::density, c::energy::name(), cr::E}), imap); const auto crho = imap[c::density].first; - const auto cener = imap[c::energy].first; + const auto cener = imap[c::energy::name()].first; auto idx_E = imap.GetFlatIdx(cr::E, false); parthenon::par_for( DEFAULT_LOOP_PATTERN, "FixFluxes::x3", DevExecSpace(), kb.e + 1, kb.e + 1, jb.s, diff --git a/src/fixup/fixup_c2p.cpp b/src/fixup/fixup_c2p.cpp index 5d620e6d8..84eb86dc6 100644 --- a/src/fixup/fixup_c2p.cpp +++ b/src/fixup/fixup_c2p.cpp @@ -63,8 +63,8 @@ TaskStatus ConservedToPrimitiveFixupImpl(T *rc) { c::density, p::velocity::name(), c::momentum, - p::energy, - c::energy, + p::energy::name(), + c::energy::name(), p::bfield, p::ye, c::ye, @@ -91,8 +91,8 @@ TaskStatus ConservedToPrimitiveFixupImpl(T *rc) { const int pvel_hi = imap[p::velocity::name()].second; const int cmom_lo = imap[c::momentum].first; const int cmom_hi = imap[c::momentum].second; - const int peng = imap[p::energy].first; - const int ceng = imap[c::energy].first; + const int peng = imap[p::energy::name()].first; + const int ceng = imap[c::energy::name()].first; const int prs = imap[p::pressure].first; const int tmp = imap[p::temperature].first; const int gm1 = imap[p::gamma1].first; diff --git a/src/fixup/fixup_src.cpp b/src/fixup/fixup_src.cpp index 6cdacf882..452179067 100644 --- a/src/fixup/fixup_src.cpp +++ b/src/fixup/fixup_src.cpp @@ -75,9 +75,10 @@ TaskStatus SourceFixupImpl(T *rc) { auto bounds = fix_pkg->Param("bounds"); const std::vector vars( - {p::density::name(), c::density, p::velocity::name(), c::momentum, p::energy, - c::energy, p::bfield, 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::density::name(), c::density, p::velocity::name(), c::momentum, + p::energy::name(), c::energy::name(), p::bfield, 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}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); @@ -86,8 +87,8 @@ TaskStatus SourceFixupImpl(T *rc) { const int crho = imap[c::density].first; auto idx_pvel = imap.GetFlatIdx(p::velocity::name()); auto idx_cmom = imap.GetFlatIdx(c::momentum); - const int peng = imap[p::energy].first; - const int ceng = imap[c::energy].first; + const int peng = imap[p::energy::name()].first; + const int ceng = imap[c::energy::name()].first; const int prs = imap[p::pressure].first; const int tmp = imap[p::temperature].first; const int gm1 = imap[p::gamma1].first; diff --git a/src/fluid/con2prim.hpp b/src/fluid/con2prim.hpp index 0b3ff8542..375a70fd9 100644 --- a/src/fluid/con2prim.hpp +++ b/src/fluid/con2prim.hpp @@ -136,12 +136,13 @@ class ConToPrim { pvel_lo(imap[fluid_prim::velocity::name()].first), pvel_hi(imap[fluid_prim::velocity::name()].second), cmom_lo(imap[fluid_cons::momentum].first), - cmom_hi(imap[fluid_cons::momentum].second), peng(imap[fluid_prim::energy].first), - ceng(imap[fluid_cons::energy].first), pb_lo(imap[fluid_prim::bfield].first), - pb_hi(imap[fluid_prim::bfield].second), cb_lo(imap[fluid_cons::bfield].first), - cb_hi(imap[fluid_cons::bfield].second), pye(imap[fluid_prim::ye].second), - cye(imap[fluid_cons::ye].second), prs(imap[fluid_prim::pressure].first), - tmp(imap[fluid_prim::temperature].first), + cmom_hi(imap[fluid_cons::momentum].second), + peng(imap[fluid_prim::energy::name()].first), + ceng(imap[fluid_cons::energy::name()].first), + pb_lo(imap[fluid_prim::bfield].first), pb_hi(imap[fluid_prim::bfield].second), + cb_lo(imap[fluid_cons::bfield].first), cb_hi(imap[fluid_cons::bfield].second), + pye(imap[fluid_prim::ye].second), cye(imap[fluid_cons::ye].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), gm1(imap[fluid_prim::gamma1].first), @@ -151,10 +152,11 @@ class ConToPrim { std::vector Vars() { return std::vector( {fluid_prim::density::name(), fluid_cons::density, fluid_prim::velocity::name(), - fluid_cons::momentum, fluid_prim::energy, fluid_cons::energy, fluid_prim::bfield, - fluid_cons::bfield, fluid_prim::ye, fluid_cons::ye, fluid_prim::pressure, - fluid_prim::temperature, internal_variables::cell_signal_speed, - fluid_prim::gamma1, internal_variables::c2p_scratch}); + fluid_cons::momentum, fluid_prim::energy::name(), fluid_cons::energy::name(), + fluid_prim::bfield, fluid_cons::bfield, fluid_prim::ye, fluid_cons::ye, + fluid_prim::pressure, fluid_prim::temperature, + internal_variables::cell_signal_speed, fluid_prim::gamma1, + internal_variables::c2p_scratch}); } template diff --git a/src/fluid/con2prim_robust.hpp b/src/fluid/con2prim_robust.hpp index c5a9cd939..bd1fd9c23 100644 --- a/src/fluid/con2prim_robust.hpp +++ b/src/fluid/con2prim_robust.hpp @@ -233,12 +233,13 @@ class ConToPrim { pvel_lo(imap[fluid_prim::velocity::name()].first), pvel_hi(imap[fluid_prim::velocity::name()].second), cmom_lo(imap[fluid_cons::momentum].first), - cmom_hi(imap[fluid_cons::momentum].second), peng(imap[fluid_prim::energy].first), - ceng(imap[fluid_cons::energy].first), pb_lo(imap[fluid_prim::bfield].first), - pb_hi(imap[fluid_prim::bfield].second), cb_lo(imap[fluid_cons::bfield].first), - cb_hi(imap[fluid_cons::bfield].second), pye(imap[fluid_prim::ye].second), - cye(imap[fluid_cons::ye].second), prs(imap[fluid_prim::pressure].first), - tmp(imap[fluid_prim::temperature].first), + cmom_hi(imap[fluid_cons::momentum].second), + peng(imap[fluid_prim::energy::name()].first), + ceng(imap[fluid_cons::energy::name()].first), + pb_lo(imap[fluid_prim::bfield].first), pb_hi(imap[fluid_prim::bfield].second), + cb_lo(imap[fluid_cons::bfield].first), cb_hi(imap[fluid_cons::bfield].second), + pye(imap[fluid_prim::ye].second), cye(imap[fluid_cons::ye].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), gm1(imap[fluid_prim::gamma1].first), @@ -249,10 +250,11 @@ class ConToPrim { std::vector Vars() { return std::vector( {fluid_prim::density::name(), fluid_cons::density, fluid_prim::velocity::name(), - fluid_cons::momentum, fluid_prim::energy, fluid_cons::energy, fluid_prim::bfield, - fluid_cons::bfield, fluid_prim::ye, fluid_cons::ye, fluid_prim::pressure, - fluid_prim::temperature, internal_variables::cell_signal_speed, - fluid_prim::gamma1, internal_variables::c2p_mu}); + fluid_cons::momentum, fluid_prim::energy::name(), fluid_cons::energy::name(), + fluid_prim::bfield, fluid_cons::bfield, fluid_prim::ye, fluid_cons::ye, + fluid_prim::pressure, fluid_prim::temperature, + internal_variables::cell_signal_speed, fluid_prim::gamma1, + internal_variables::c2p_mu}); } template diff --git a/src/fluid/fluid.cpp b/src/fluid/fluid.cpp index e4e5bd094..d28a3c72c 100644 --- a/src/fluid/fluid.cpp +++ b/src/fluid/fluid.cpp @@ -191,7 +191,7 @@ std::shared_ptr Initialize(ParameterInput *pin) { // add the primitive variables physics->template AddField(mprim_scalar); physics->AddField(p::velocity::name(), mprim_threev); - physics->AddField(p::energy, mprim_scalar); + physics->AddField(p::energy::name(), mprim_scalar); if (mhd) { physics->AddField(p::bfield, mprim_threev); if (ndim == 2) { @@ -225,7 +225,7 @@ std::shared_ptr Initialize(ParameterInput *pin) { // add the conserved variables physics->AddField(c::density, mcons_scalar); physics->AddField(c::momentum, mcons_threev); - physics->AddField(c::energy, mcons_scalar); + physics->AddField(c::energy::name(), mcons_scalar); if (mhd) { physics->AddField(c::bfield, mcons_threev); } @@ -256,12 +256,13 @@ std::shared_ptr Initialize(ParameterInput *pin) { // set up the arrays for left and right states // add the base state for reconstruction/fluxes - std::vector rvars({p::density::name(), p::velocity::name(), p::energy}); + std::vector rvars( + {p::density::name(), p::velocity::name(), p::energy::name()}); riemann::FluxState::ReconVars(rvars); if (mhd) riemann::FluxState::ReconVars(p::bfield); if (ye) riemann::FluxState::ReconVars(p::ye); - std::vector fvars({c::density, c::momentum, c::energy}); + std::vector fvars({c::density, c::momentum, c::energy::name()}); riemann::FluxState::FluxVars(fvars); if (mhd) riemann::FluxState::FluxVars(c::bfield); if (ye) riemann::FluxState::FluxVars(c::ye); @@ -310,7 +311,7 @@ std::shared_ptr Initialize(ParameterInput *pin) { return ReduceOneVar>(md, fluid_cons::density, 0); }; auto ReduceEn = [](MeshData *md) { - return ReduceOneVar>(md, fluid_cons::energy, 0); + return ReduceOneVar>(md, fluid_cons::energy::name(), 0); }; hst_vars.emplace_back(HistoryOutputVar(HstSum, ReduceMass, "total baryon number")); hst_vars.emplace_back(HistoryOutputVar(HstSum, ReduceEn, "total conserved energy tau")); @@ -349,10 +350,10 @@ TaskStatus PrimitiveToConservedRegion(MeshBlockData *rc, const IndexRange namespace impl = internal_variables; auto *pmb = rc->GetParentPointer(); - const std::vector vars({p::density::name(), c::density, - p::velocity::name(), c::momentum, p::energy, - c::energy, p::bfield, c::bfield, p::ye, c::ye, - p::pressure, p::gamma1, impl::cell_signal_speed}); + const std::vector vars( + {p::density::name(), c::density, p::velocity::name(), c::momentum, + p::energy::name(), c::energy::name(), p::bfield, c::bfield, p::ye, c::ye, + p::pressure, p::gamma1, impl::cell_signal_speed}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); @@ -363,8 +364,8 @@ TaskStatus PrimitiveToConservedRegion(MeshBlockData *rc, const IndexRange const int pvel_hi = imap[p::velocity::name()].second; const int cmom_lo = imap[c::momentum].first; const int cmom_hi = imap[c::momentum].second; - const int peng = imap[p::energy].first; - const int ceng = imap[c::energy].first; + const int peng = imap[p::energy::name()].first; + const int ceng = imap[c::energy::name()].first; const int prs = imap[p::pressure].first; const int gm1 = imap[p::gamma1].first; const int pb_lo = imap[p::bfield].first; @@ -553,7 +554,7 @@ TaskStatus CalculateFluidSourceTerms(MeshBlockData *rc, IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); IndexRange kb = rc->GetBoundsK(IndexDomain::interior); - std::vector vars({fluid_cons::momentum, fluid_cons::energy}); + std::vector vars({fluid_cons::momentum, fluid_cons::energy::name()}); #if SET_FLUX_SRC_DIAGS vars.push_back(diagnostic_variables::src_terms); #endif @@ -561,7 +562,7 @@ TaskStatus CalculateFluidSourceTerms(MeshBlockData *rc, auto src = rc_src->PackVariables(vars, imap); const int cmom_lo = imap[fluid_cons::momentum].first; const int cmom_hi = imap[fluid_cons::momentum].second; - const int ceng = imap[fluid_cons::energy].first; + const int ceng = imap[fluid_cons::energy::name()].first; const int idiag = imap[diagnostic_variables::src_terms].first; auto tmunu = BuildStressEnergyTensor(rc); diff --git a/src/fluid/fluid.hpp b/src/fluid/fluid.hpp index 533a14e11..7705609fb 100644 --- a/src/fluid/fluid.hpp +++ b/src/fluid/fluid.hpp @@ -68,7 +68,7 @@ TaskStatus CopyFluxDivergence(T *rc) { if (!params.Get("active")) return TaskStatus::complete; std::vector vars( - {fluid_cons::density, fluid_cons::momentum, fluid_cons::energy}); + {fluid_cons::density, fluid_cons::momentum, fluid_cons::energy::name()}); vars.push_back(radmoment_cons::E); vars.push_back(radmoment_cons::F); PackIndexMap imap; @@ -76,7 +76,7 @@ TaskStatus CopyFluxDivergence(T *rc) { const int crho = imap[fluid_cons::density].first; const int cmom_lo = imap[fluid_cons::momentum].first; const int cmom_hi = imap[fluid_cons::momentum].second; - const int ceng = imap[fluid_cons::energy].first; + const int ceng = imap[fluid_cons::energy::name()].first; auto idx_E = imap.GetFlatIdx(radmoment_cons::E, false); auto idx_F = imap.GetFlatIdx(radmoment_cons::F, false); std::vector diag_vars( diff --git a/src/fluid/riemann.hpp b/src/fluid/riemann.hpp index 0d4b6f8ae..aee4eb928 100644 --- a/src/fluid/riemann.hpp +++ b/src/fluid/riemann.hpp @@ -220,13 +220,14 @@ class FluxState { "bounds")), prho(imap[fluid_prim::density::name()].first), pvel_lo(imap[fluid_prim::velocity::name()].first), - peng(imap[fluid_prim::energy].first), pb_lo(imap[fluid_prim::bfield].first), - pb_hi(imap[fluid_prim::bfield].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), - ceng(imap[fluid_cons::energy].first), cb_lo(imap[fluid_cons::bfield].first), - cb_hi(imap[fluid_cons::bfield].second), cye(imap[fluid_cons::ye].first), - ncons(5 + (pb_hi - pb_lo + 1) + (cye > 0)) { + peng(imap[fluid_prim::energy::name()].first), + pb_lo(imap[fluid_prim::bfield].first), pb_hi(imap[fluid_prim::bfield].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), + ceng(imap[fluid_cons::energy::name()].first), + cb_lo(imap[fluid_cons::bfield].first), cb_hi(imap[fluid_cons::bfield].second), + cye(imap[fluid_cons::ye].first), ncons(5 + (pb_hi - pb_lo + 1) + (cye > 0)) { PARTHENON_REQUIRE_THROWS( ncons <= NCONS_MAX, "ncons exceeds NCONS_MAX. Reconfigure to increase NCONS_MAX."); diff --git a/src/fluid/tmunu.hpp b/src/fluid/tmunu.hpp index c62cf112a..909b667bd 100644 --- a/src/fluid/tmunu.hpp +++ b/src/fluid/tmunu.hpp @@ -28,7 +28,7 @@ namespace fluid { const std::vector TMUNU_VARS = { - fluid_prim::density::name(), fluid_prim::velocity::name(), fluid_prim::energy, + fluid_prim::density::name(), fluid_prim::velocity::name(), fluid_prim::energy::name(), fluid_prim::pressure, fluid_prim::bfield}; // Indices are upstairs template @@ -48,7 +48,7 @@ class StressEnergyTensorCon { ir_ = imap[fluid_prim::density::name()].first; iv_ = imap[fluid_prim::velocity::name()].first; - iu_ = imap[fluid_prim::energy].first; + iu_ = imap[fluid_prim::energy::name()].first; ip_ = imap[fluid_prim::pressure].first; ib_ = imap[fluid_prim::bfield].first; } diff --git a/src/monopole_gr/interp_3d_to_1d.hpp b/src/monopole_gr/interp_3d_to_1d.hpp index 483b6c6c0..72f942bfd 100644 --- a/src/monopole_gr/interp_3d_to_1d.hpp +++ b/src/monopole_gr/interp_3d_to_1d.hpp @@ -104,7 +104,7 @@ TaskStatus InterpolateMatterTo1D(Data *rc) { // but I may want these quantities in a future // iteration, so I ask for them here. std::vector vars( - {fluid_cons::density, fluid_cons::energy, fluid_cons::momentum}); + {fluid_cons::density, fluid_cons::energy::name(), fluid_cons::momentum}); // PackIndexMap imap; auto pack = rc->PackVariables(vars); diff --git a/src/pgen/advection.cpp b/src/pgen/advection.cpp index 1f0547143..63a2a8807 100644 --- a/src/pgen/advection.cpp +++ b/src/pgen/advection.cpp @@ -27,15 +27,15 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { PackIndexMap imap; auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), - fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, - fluid_prim::pressure, fluid_prim::temperature, - fluid_prim::gamma1}, + fluid_prim::energy::name(), fluid_prim::bfield, + fluid_prim::ye, 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 ivhi = imap[fluid_prim::velocity::name()].second; - const int ieng = imap[fluid_prim::energy].first; + const int ieng = imap[fluid_prim::energy::name()].first; const int ib_lo = imap[fluid_prim::bfield].first; const int ib_hi = imap[fluid_prim::bfield].second; const int iye = imap[fluid_prim::ye].second; diff --git a/src/pgen/blandford_mckee.cpp b/src/pgen/blandford_mckee.cpp index b55450306..c2eaa278e 100644 --- a/src/pgen/blandford_mckee.cpp +++ b/src/pgen/blandford_mckee.cpp @@ -32,15 +32,15 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { PackIndexMap imap; auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), - fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, - fluid_prim::pressure, fluid_prim::temperature, - fluid_prim::gamma1}, + fluid_prim::energy::name(), fluid_prim::bfield, + fluid_prim::ye, 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 ivhi = imap[fluid_prim::velocity::name()].second; - const int ieng = imap[fluid_prim::energy].first; + const int ieng = imap[fluid_prim::energy::name()].first; const int ib_lo = imap[fluid_prim::bfield].first; const int ib_hi = imap[fluid_prim::bfield].second; const int iye = imap[fluid_prim::ye].second; diff --git a/src/pgen/bondi.cpp b/src/pgen/bondi.cpp index 08fe210ea..00d936235 100644 --- a/src/pgen/bondi.cpp +++ b/src/pgen/bondi.cpp @@ -92,15 +92,15 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { PackIndexMap imap; auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), - fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, - fluid_prim::pressure, fluid_prim::temperature, - fluid_prim::gamma1}, + fluid_prim::energy::name(), fluid_prim::bfield, + fluid_prim::ye, 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 ivhi = imap[fluid_prim::velocity::name()].second; - const int ieng = imap[fluid_prim::energy].first; + const int ieng = imap[fluid_prim::energy::name()].first; const int ib_lo = imap[fluid_prim::bfield].first; const int ib_hi = imap[fluid_prim::bfield].second; const int iye = imap[fluid_prim::ye].second; diff --git a/src/pgen/friedmann.cpp b/src/pgen/friedmann.cpp index 2dda4ef9d..51fdf629c 100644 --- a/src/pgen/friedmann.cpp +++ b/src/pgen/friedmann.cpp @@ -37,13 +37,13 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { PackIndexMap imap; auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), - fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, - fluid_prim::pressure, fluid_prim::temperature, - fluid_prim::gamma1}, + fluid_prim::energy::name(), fluid_prim::bfield, + fluid_prim::ye, 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].first; + const int ieng = imap[fluid_prim::energy::name()].first; const int iye = imap[fluid_prim::ye].second; const int iprs = imap[fluid_prim::pressure].first; const int itmp = imap[fluid_prim::temperature].first; diff --git a/src/pgen/kh.cpp b/src/pgen/kh.cpp index b73b18319..956f44d28 100644 --- a/src/pgen/kh.cpp +++ b/src/pgen/kh.cpp @@ -27,15 +27,15 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { PackIndexMap imap; auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), - fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, - fluid_prim::pressure, fluid_prim::temperature, - fluid_prim::gamma1}, + fluid_prim::energy::name(), fluid_prim::bfield, + fluid_prim::ye, 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 ivhi = imap[fluid_prim::velocity::name()].second; - const int ieng = imap[fluid_prim::energy].first; + const int ieng = imap[fluid_prim::energy::name()].first; const int ib_lo = imap[fluid_prim::bfield].first; const int ib_hi = imap[fluid_prim::bfield].second; const int iye = imap[fluid_prim::ye].second; diff --git a/src/pgen/leptoneq.cpp b/src/pgen/leptoneq.cpp index 475ec168b..77ffb30b7 100644 --- a/src/pgen/leptoneq.cpp +++ b/src/pgen/leptoneq.cpp @@ -31,14 +31,14 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables({p::density::name(), p::velocity::name(), p::energy, p::ye, - p::pressure, p::temperature, p::gamma1}, + auto v = rc->PackVariables({p::density::name(), p::velocity::name(), p::energy::name(), + p::ye, 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].first; + const int ieng = imap[p::energy::name()].first; const int iye = imap[p::ye].first; const int iprs = imap[p::pressure].first; const int itmp = imap[p::temperature].first; diff --git a/src/pgen/linear_modes.cpp b/src/pgen/linear_modes.cpp index 2564642aa..521d6f266 100644 --- a/src/pgen/linear_modes.cpp +++ b/src/pgen/linear_modes.cpp @@ -44,15 +44,15 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { PackIndexMap imap; std::vector vars( - {fluid_prim::density::name(), fluid_prim::velocity::name(), fluid_prim::energy, - fluid_prim::bfield, fluid_prim::pressure, fluid_prim::temperature, - fluid_prim::gamma1, fluid_prim::ye}); + {fluid_prim::density::name(), fluid_prim::velocity::name(), + fluid_prim::energy::name(), fluid_prim::bfield, fluid_prim::pressure, + fluid_prim::temperature, fluid_prim::gamma1, fluid_prim::ye}); auto v = rc->PackVariables(vars, imap); const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity::name()].first; const int ivhi = imap[fluid_prim::velocity::name()].second; - const int ieng = imap[fluid_prim::energy].first; + const int ieng = imap[fluid_prim::energy::name()].first; const int ib_lo = imap[fluid_prim::bfield].first; const int ib_hi = imap[fluid_prim::bfield].second; const int iprs = imap[fluid_prim::pressure].first; diff --git a/src/pgen/p2c2p.cpp b/src/pgen/p2c2p.cpp index d88a929a8..49c9ac751 100644 --- a/src/pgen/p2c2p.cpp +++ b/src/pgen/p2c2p.cpp @@ -74,15 +74,15 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { PackIndexMap imap; auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), - fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, - fluid_prim::pressure, fluid_prim::temperature, - fluid_prim::gamma1}, + fluid_prim::energy::name(), fluid_prim::bfield, + fluid_prim::ye, 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 ivhi = imap[fluid_prim::velocity::name()].second; - const int ieng = imap[fluid_prim::energy].first; + const int ieng = imap[fluid_prim::energy::name()].first; const int ib_lo = imap[fluid_prim::bfield].first; const int ib_hi = imap[fluid_prim::bfield].second; const int iprs = imap[fluid_prim::pressure].first; diff --git a/src/pgen/progenitor.cpp b/src/pgen/progenitor.cpp index bd0d3100c..cc6c5e020 100644 --- a/src/pgen/progenitor.cpp +++ b/src/pgen/progenitor.cpp @@ -36,14 +36,14 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { PackIndexMap imap; auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), - fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, - fluid_prim::pressure, fluid_prim::temperature, - fluid_prim::gamma1}, + fluid_prim::energy::name(), fluid_prim::bfield, + fluid_prim::ye, 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 ivhi = imap[fluid_prim::velocity::name()].second; - const int ieng = imap[fluid_prim::energy].first; + const int ieng = imap[fluid_prim::energy::name()].first; const int ib_lo = imap[fluid_prim::bfield].first; const int ib_hi = imap[fluid_prim::bfield].second; const int iye = imap[fluid_prim::ye].second; diff --git a/src/pgen/radiation_advection.cpp b/src/pgen/radiation_advection.cpp index 7eb43e46f..9e16b5a62 100644 --- a/src/pgen/radiation_advection.cpp +++ b/src/pgen/radiation_advection.cpp @@ -30,7 +30,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto v = rc->PackVariables( std::vector({radmoment_prim::J, radmoment_prim::H, fluid_prim::density::name(), fluid_prim::temperature, - fluid_prim::energy, fluid_prim::velocity::name(), + fluid_prim::energy::name(), fluid_prim::velocity::name(), radmoment_internal::xi, radmoment_internal::phi}), imap); @@ -41,7 +41,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto iphi = imap.GetFlatIdx(radmoment_internal::phi); const int prho = imap[fluid_prim::density::name()].first; const int pT = imap[fluid_prim::temperature].first; - const int peng = imap[fluid_prim::energy].first; + const int peng = imap[fluid_prim::energy::name()].first; Params &phoebus_params = pmb->packages.Get("phoebus")->AllParams(); diff --git a/src/pgen/radiation_equilibration.cpp b/src/pgen/radiation_equilibration.cpp index e47778bcc..520ae1d80 100644 --- a/src/pgen/radiation_equilibration.cpp +++ b/src/pgen/radiation_equilibration.cpp @@ -34,8 +34,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto v = rc->PackVariables( {radmoment_prim::J, radmoment_prim::H, radmoment_internal::xi, radmoment_internal::phi, fluid_prim::density::name(), fluid_prim::temperature, - fluid_prim::pressure, fluid_prim::gamma1, fluid_prim::energy, fluid_prim::ye, - fluid_prim::velocity::name()}, + fluid_prim::pressure, fluid_prim::gamma1, fluid_prim::energy::name(), + fluid_prim::ye, fluid_prim::velocity::name()}, imap); auto idJ = imap.GetFlatIdx(radmoment_prim::J); @@ -47,7 +47,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int iT = imap[fluid_prim::temperature].first; const int iP = imap[fluid_prim::pressure].first; const int igm1 = imap[fluid_prim::gamma1].first; - const int ieng = imap[fluid_prim::energy].first; + const int ieng = imap[fluid_prim::energy::name()].first; const int pye = imap[fluid_prim::ye].first; auto idv = imap.GetFlatIdx(fluid_prim::velocity::name()); diff --git a/src/pgen/rhs_tester.cpp b/src/pgen/rhs_tester.cpp index 7a9622ce3..53d903d89 100644 --- a/src/pgen/rhs_tester.cpp +++ b/src/pgen/rhs_tester.cpp @@ -21,15 +21,15 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { PackIndexMap imap; auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), - fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, - fluid_prim::pressure, fluid_prim::temperature, - fluid_prim::gamma1}, + fluid_prim::energy::name(), fluid_prim::bfield, + fluid_prim::ye, 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 ivhi = imap[fluid_prim::velocity::name()].second; - const int ieng = imap[fluid_prim::energy].first; + const int ieng = imap[fluid_prim::energy::name()].first; const int ib_lo = imap[fluid_prim::bfield].first; const int ib_hi = imap[fluid_prim::bfield].second; const int iye = imap[fluid_prim::ye].second; diff --git a/src/pgen/rotor.cpp b/src/pgen/rotor.cpp index ce769dbe3..ee82e4a1c 100644 --- a/src/pgen/rotor.cpp +++ b/src/pgen/rotor.cpp @@ -33,15 +33,15 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { PackIndexMap imap; auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), - fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, - fluid_prim::pressure, fluid_prim::temperature, - fluid_prim::gamma1}, + fluid_prim::energy::name(), fluid_prim::bfield, + fluid_prim::ye, 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 ivhi = imap[fluid_prim::velocity::name()].second; - const int ieng = imap[fluid_prim::energy].first; + const int ieng = imap[fluid_prim::energy::name()].first; const int ib_lo = imap[fluid_prim::bfield].first; const int ib_hi = imap[fluid_prim::bfield].second; const int iye = imap[fluid_prim::ye].second; diff --git a/src/pgen/sedov.cpp b/src/pgen/sedov.cpp index 09924ea08..f35bc23b5 100644 --- a/src/pgen/sedov.cpp +++ b/src/pgen/sedov.cpp @@ -32,15 +32,15 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { PackIndexMap imap; auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), - fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, - fluid_prim::pressure, fluid_prim::temperature, - fluid_prim::gamma1}, + fluid_prim::energy::name(), fluid_prim::bfield, + fluid_prim::ye, 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 ivhi = imap[fluid_prim::velocity::name()].second; - const int ieng = imap[fluid_prim::energy].first; + const int ieng = imap[fluid_prim::energy::name()].first; const int ib_lo = imap[fluid_prim::bfield].first; const int ib_hi = imap[fluid_prim::bfield].second; const int iye = imap[fluid_prim::ye].second; diff --git a/src/pgen/shock_tube.cpp b/src/pgen/shock_tube.cpp index 435e908a7..c601915c4 100644 --- a/src/pgen/shock_tube.cpp +++ b/src/pgen/shock_tube.cpp @@ -36,15 +36,15 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { PackIndexMap imap; auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), - fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, - fluid_prim::pressure, fluid_prim::temperature, - fluid_prim::gamma1}, + fluid_prim::energy::name(), fluid_prim::bfield, + fluid_prim::ye, 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 ivhi = imap[fluid_prim::velocity::name()].second; - const int ieng = imap[fluid_prim::energy].first; + const int ieng = imap[fluid_prim::energy::name()].first; const int ib_lo = imap[fluid_prim::bfield].first; const int ib_hi = imap[fluid_prim::bfield].second; const int iye = imap[fluid_prim::ye].second; diff --git a/src/pgen/thin_cooling.cpp b/src/pgen/thin_cooling.cpp index db2943986..8bfcdbe02 100644 --- a/src/pgen/thin_cooling.cpp +++ b/src/pgen/thin_cooling.cpp @@ -31,14 +31,14 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables({p::density::name(), p::velocity::name(), p::energy, p::ye, - p::pressure, p::temperature, p::gamma1}, + auto v = rc->PackVariables({p::density::name(), p::velocity::name(), p::energy::name(), + p::ye, 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].first; + const int ieng = imap[p::energy::name()].first; const int iye = imap[p::ye].second; const int iprs = imap[p::pressure].first; const int itmp = imap[p::temperature].first; diff --git a/src/pgen/torus.cpp b/src/pgen/torus.cpp index fcbe9b812..63815253d 100644 --- a/src/pgen/torus.cpp +++ b/src/pgen/torus.cpp @@ -138,16 +138,17 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { bool do_rad = rad_pkg->Param("active"); PackIndexMap imap; - auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), - fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, - fluid_prim::pressure, fluid_prim::temperature, - fluid_prim::gamma1, radmoment_prim::J, radmoment_prim::H}, - imap); + auto v = + rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), + fluid_prim::energy::name(), fluid_prim::bfield, fluid_prim::ye, + fluid_prim::pressure, fluid_prim::temperature, + fluid_prim::gamma1, radmoment_prim::J, radmoment_prim::H}, + imap); const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity::name()].first; const int ivhi = imap[fluid_prim::velocity::name()].second; - const int ieng = imap[fluid_prim::energy].first; + const int ieng = imap[fluid_prim::energy::name()].first; const int iblo = imap[fluid_prim::bfield].first; const int ibhi = imap[fluid_prim::bfield].second; const int iye = imap[fluid_prim::ye].second; diff --git a/src/pgen/tov.cpp b/src/pgen/tov.cpp index 1b52d9b42..fc5ae6d01 100644 --- a/src/pgen/tov.cpp +++ b/src/pgen/tov.cpp @@ -72,15 +72,15 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { PackIndexMap imap; auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), - fluid_prim::energy, fluid_prim::bfield, fluid_prim::ye, - fluid_prim::pressure, fluid_prim::temperature, - fluid_prim::gamma1}, + fluid_prim::energy::name(), fluid_prim::bfield, + fluid_prim::ye, 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 ivhi = imap[fluid_prim::velocity::name()].second; - const int ieng = imap[fluid_prim::energy].first; + const int ieng = imap[fluid_prim::energy::name()].first; const int iblo = imap[fluid_prim::bfield].first; const int ibhi = imap[fluid_prim::bfield].second; const int iye = imap[fluid_prim::ye].second; diff --git a/src/phoebus_driver.cpp b/src/phoebus_driver.cpp index ac5f050fe..4933fee34 100644 --- a/src/phoebus_driver.cpp +++ b/src/phoebus_driver.cpp @@ -199,7 +199,7 @@ TaskCollection PhoebusDriver::RungeKuttaStage(const int stage) { std::vector src_w_diag; if (fluid_active) { src_names.push_back(fluid_cons::momentum); - src_names.push_back(fluid_cons::energy); + src_names.push_back(fluid_cons::energy::name()); } if (rad_moments_active) { src_names.push_back(radmoment_cons::E); diff --git a/src/phoebus_utils/variables.hpp b/src/phoebus_utils/variables.hpp index 31516f881..aa4d37a71 100644 --- a/src/phoebus_utils/variables.hpp +++ b/src/phoebus_utils/variables.hpp @@ -35,7 +35,7 @@ namespace fluid_prim { VARIABLE(p, density); VARIABLE(p, velocity); -constexpr char energy[] = "p.energy"; +VARIABLE(p, energy); constexpr char bfield[] = "p.bfield"; constexpr char ye[] = "p.ye"; constexpr char pressure[] = "pressure"; @@ -46,7 +46,7 @@ constexpr char gamma1[] = "gamma1"; namespace fluid_cons { constexpr char density[] = "c.density"; constexpr char momentum[] = "c.momentum"; -constexpr char energy[] = "c.energy"; +VARIABLE(c, energy); constexpr char bfield[] = "c.bfield"; constexpr char ye[] = "c.ye"; } // namespace fluid_cons diff --git a/src/radiation/cooling_function.cpp b/src/radiation/cooling_function.cpp index 1eedf0f1b..b6c05be39 100644 --- a/src/radiation/cooling_function.cpp +++ b/src/radiation/cooling_function.cpp @@ -114,8 +114,9 @@ TaskStatus CoolingFunctionCalculateFourForce(MeshBlockData *rc, const doub auto *pmb = rc->GetParentPointer(); std::vector vars({c::density, p::density::name(), p::velocity::name(), - p::temperature, p::ye, c::energy, iv::Gcov, iv::GcovHeat, - iv::GcovCool, iv::Gye, iv::tau, p::energy}); + p::temperature, p::ye, c::energy::name(), iv::Gcov, + iv::GcovHeat, iv::GcovCool, iv::Gye, iv::tau, + p::energy::name()}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); @@ -125,7 +126,7 @@ TaskStatus CoolingFunctionCalculateFourForce(MeshBlockData *rc, const doub const int pvhi = imap[p::velocity::name()].second; const int ptemp = imap[p::temperature].first; const int pye = imap[p::ye].first; - const int penergy = imap[p::energy].first; + const int penergy = imap[p::energy::name()].first; const int Gcov_lo = imap[iv::Gcov].first; const int Gcov_hi = imap[iv::Gcov].second; const int Gye = imap[iv::Gye].first; diff --git a/src/radiation/mocmc.cpp b/src/radiation/mocmc.cpp index 734606230..4602f2639 100644 --- a/src/radiation/mocmc.cpp +++ b/src/radiation/mocmc.cpp @@ -526,7 +526,7 @@ TaskStatus MOCMCFluidSource(T *rc, const Real dt, const bool update_fluid) { pr::J, pr::H, pf::density::name(), - pf::energy, + pf::energy::name(), pf::velocity::name(), pf::temperature, pf::ye, @@ -537,7 +537,7 @@ TaskStatus MOCMCFluidSource(T *rc, const Real dt, const bool update_fluid) { im::Inu1, im::jinvs}; if (update_fluid) { - variables.push_back(cf::energy); + variables.push_back(cf::energy::name()); variables.push_back(cf::momentum); variables.push_back(cf::ye); } @@ -547,7 +547,7 @@ TaskStatus MOCMCFluidSource(T *rc, const Real dt, const bool update_fluid) { const auto pJ = imap.GetFlatIdx(pr::J); const auto pH = imap.GetFlatIdx(pr::H); const auto pdens = imap[pf::density::name()].first; - const auto peng = imap[pf::energy].first; + const auto peng = imap[pf::energy::name()].first; const auto pv = imap.GetFlatIdx(fluid_prim::velocity::name()); const auto pT = imap[pf::temperature].first; const auto pye = imap[pf::ye].first; @@ -560,7 +560,7 @@ TaskStatus MOCMCFluidSource(T *rc, const Real dt, const bool update_fluid) { auto idx_kappaH = imap.GetFlatIdx(ir::kappaH); int ceng(-1), cmom_lo(-1), cye(-1); if (update_fluid) { - ceng = imap[cf::energy].first; + ceng = imap[cf::energy::name()].first; cmom_lo = imap[cf::momentum].first; cye = imap[cf::ye].first; } diff --git a/src/radiation/moments_source.cpp b/src/radiation/moments_source.cpp index 3e77d9d67..dfa8b7e45 100644 --- a/src/radiation/moments_source.cpp +++ b/src/radiation/moments_source.cpp @@ -216,13 +216,17 @@ TaskStatus MomentFluidSourceImpl(T *rc, Real dt, bool update_fluid) { namespace ir = radmoment_internal; namespace c = fluid_cons; namespace p = fluid_prim; - std::vector vars{ - c::density, c::energy, c::momentum, c::ye, - cr::E, cr::F, c::bfield, p::density::name(), - p::temperature, p::energy, p::ye, p::velocity::name(), - p::pressure, p::gamma1, p::bfield, pr::J, - pr::H, ir::kappaJ, ir::kappaH, ir::JBB, - ir::tilPi}; + std::vector vars{c::density, c::energy::name(), + c::momentum, c::ye, + cr::E, cr::F, + c::bfield, p::density::name(), + p::temperature, p::energy::name(), + p::ye, p::velocity::name(), + p::pressure, p::gamma1, + p::bfield, pr::J, + pr::H, ir::kappaJ, + ir::kappaH, ir::JBB, + ir::tilPi}; PackIndexMap imap; auto v = rc->PackVariables(vars, imap); @@ -238,7 +242,7 @@ TaskStatus MomentFluidSourceImpl(T *rc, Real dt, bool update_fluid) { auto pv = imap.GetFlatIdx(p::velocity::name()); int prho = imap[p::density::name()].first; - int peng = imap[p::energy].first; + int peng = imap[p::energy::name()].first; int pT = imap[p::temperature].first; int pprs = imap[p::pressure].first; int pgm1 = imap[p::gamma1].first; @@ -247,7 +251,7 @@ TaskStatus MomentFluidSourceImpl(T *rc, Real dt, bool update_fluid) { int cb_lo = imap[c::bfield].first; int crho = imap[c::density].first; - int ceng = imap[c::energy].first; + int ceng = imap[c::energy::name()].first; int cmom_lo = imap[c::momentum].first; int cmom_hi = imap[c::momentum].second; int cye = imap[c::ye].first; diff --git a/src/radiation/radiation.cpp b/src/radiation/radiation.cpp index b1773f2b7..4632b8be2 100644 --- a/src/radiation/radiation.cpp +++ b/src/radiation/radiation.cpp @@ -545,11 +545,11 @@ TaskStatus ApplyRadiationFourForce(MeshBlockData *rc, const double dt) { namespace iv = internal_variables; std::vector vars( - {c::density, c::energy, c::momentum, c::ye, iv::Gcov, iv::Gye}); + {c::density, c::energy::name(), c::momentum, c::ye, iv::Gcov, iv::Gye}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); const int crho = imap[c::density].first; - const int ceng = imap[c::energy].first; + const int ceng = imap[c::energy::name()].first; const int cmom_lo = imap[c::momentum].first; const int cmom_hi = imap[c::momentum].second; const int cye = imap[c::ye].first; From 6089c700d2eabf84e577a8937a0ed95b514b7635 Mon Sep 17 00:00:00 2001 From: Jonah Maxwell Miller Date: Wed, 6 Dec 2023 13:32:12 -0700 Subject: [PATCH 09/14] move bfield to variable types --- src/analysis/history.cpp | 16 ++++----- src/fixup/fixup.cpp | 30 ++++++++-------- src/fixup/fixup_c2p.cpp | 6 ++-- src/fixup/fixup_netfield.cpp | 6 ++-- src/fixup/fixup_src.cpp | 6 ++-- src/fluid/con2prim.hpp | 14 ++++---- src/fluid/con2prim_robust.hpp | 14 ++++---- src/fluid/fluid.cpp | 28 +++++++-------- src/fluid/riemann.hpp | 13 +++---- src/fluid/tmunu.hpp | 4 +-- src/pgen/advection.cpp | 6 ++-- src/pgen/blandford_mckee.cpp | 6 ++-- src/pgen/bondi.cpp | 6 ++-- src/pgen/friedmann.cpp | 2 +- src/pgen/kh.cpp | 6 ++-- src/pgen/linear_modes.cpp | 6 ++-- src/pgen/p2c2p.cpp | 6 ++-- src/pgen/progenitor.cpp | 6 ++-- src/pgen/rhs_tester.cpp | 6 ++-- src/pgen/rotor.cpp | 6 ++-- src/pgen/sedov.cpp | 6 ++-- src/pgen/shock_tube.cpp | 6 ++-- src/pgen/torus.cpp | 26 +++++++------- src/pgen/tov.cpp | 6 ++-- src/phoebus_boundaries/phoebus_boundaries.cpp | 4 +-- src/phoebus_utils/variables.hpp | 4 +-- src/radiation/moments_source.cpp | 34 ++++++++++++------- 27 files changed, 147 insertions(+), 132 deletions(-) diff --git a/src/analysis/history.cpp b/src/analysis/history.cpp index 5b759c153..5b0449396 100644 --- a/src/analysis/history.cpp +++ b/src/analysis/history.cpp @@ -79,7 +79,7 @@ Real ReduceJetEnergyFlux(MeshData *md) { namespace p = fluid_prim; const std::vector vars( - {p::density::name(), p::bfield, p::velocity::name()}); + {p::density::name(), p::bfield::name(), p::velocity::name()}); PackIndexMap imap; auto pack = md->PackVariables(vars, imap); @@ -87,8 +87,8 @@ Real ReduceJetEnergyFlux(MeshData *md) { const int prho = imap[p::density::name()].first; const int pvel_lo = imap[p::velocity::name()].first; const int pvel_hi = imap[p::velocity::name()].second; - const int pb_lo = imap[p::bfield].first; - const int pb_hi = imap[p::bfield].second; + const int pb_lo = imap[p::bfield::name()].first; + const int pb_hi = imap[p::bfield::name()].second; auto geom = Geometry::GetCoordinateSystem(md); @@ -139,7 +139,7 @@ Real ReduceJetMomentumFlux(MeshData *md) { namespace p = fluid_prim; const std::vector vars( - {p::density::name(), p::bfield, p::velocity::name()}); + {p::density::name(), p::bfield::name(), p::velocity::name()}); PackIndexMap imap; auto pack = md->PackVariables(vars, imap); @@ -147,8 +147,8 @@ Real ReduceJetMomentumFlux(MeshData *md) { const int prho = imap[p::density::name()].first; const int pvel_lo = imap[p::velocity::name()].first; const int pvel_hi = imap[p::velocity::name()].second; - const int pb_lo = imap[p::bfield].first; - const int pb_hi = imap[p::bfield].second; + const int pb_lo = imap[p::bfield::name()].first; + const int pb_hi = imap[p::bfield::name()].second; auto geom = Geometry::GetCoordinateSystem(md); @@ -198,12 +198,12 @@ Real ReduceMagneticFluxPhi(MeshData *md) { const Real xh = pars.Get("xh"); namespace c = fluid_cons; - const std::vector vars({c::bfield}); + const std::vector vars({c::bfield::name()}); PackIndexMap imap; auto pack = md->PackVariables(vars, imap); - const int cb_lo = imap[c::bfield].first; + const int cb_lo = imap[c::bfield::name()].first; auto geom = Geometry::GetCoordinateSystem(md); diff --git a/src/fixup/fixup.cpp b/src/fixup/fixup.cpp index c5c23fa5b..e6771cfe4 100644 --- a/src/fixup/fixup.cpp +++ b/src/fixup/fixup.cpp @@ -308,7 +308,7 @@ TaskStatus ApplyFloorsImpl(T *rc, IndexDomain domain = IndexDomain::entire) { const std::vector vars( {p::density::name(), c::density, p::velocity::name(), c::momentum, - p::energy::name(), c::energy::name(), p::bfield, p::ye, c::ye, p::pressure, + 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}); @@ -328,8 +328,8 @@ TaskStatus ApplyFloorsImpl(T *rc, IndexDomain domain = IndexDomain::entire) { 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; - const int pb_lo = imap[p::bfield].first; - const int pb_hi = imap[p::bfield].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; auto idx_J = imap.GetFlatIdx(pr::J, false); @@ -815,14 +815,14 @@ TaskStatus FixFluxes(MeshBlockData *rc) { } else if (ix2_bc == "polar") { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( - std::vector( - {c::density, c::energy::name(), c::momentum, c::bfield, cr::E, cr::F}), - std::vector( - {c::density, c::energy::name(), c::momentum, c::bfield, cr::E, cr::F}), + std::vector({c::density, c::energy::name(), c::momentum, + c::bfield::name(), cr::E, cr::F}), + std::vector({c::density, c::energy::name(), c::momentum, + c::bfield::name(), cr::E, cr::F}), imap); const auto crho = imap[c::density].first; const auto cener = imap[c::energy::name()].first; - auto idx_cb = imap.GetFlatIdx(c::bfield, false); + auto idx_cb = imap.GetFlatIdx(c::bfield::name(), false); auto idx_cmom = imap.GetFlatIdx(c::momentum); auto idx_E = imap.GetFlatIdx(cr::E, false); auto idx_F = imap.GetFlatIdx(cr::F, false); @@ -858,7 +858,7 @@ TaskStatus FixFluxes(MeshBlockData *rc) { imap); const auto crho = imap[c::density].first; const auto cener = imap[c::energy::name()].first; - auto idx_cb = imap.GetFlatIdx(c::bfield, false); + auto idx_cb = imap.GetFlatIdx(c::bfield::name(), false); auto idx_cmom = imap.GetFlatIdx(c::momentum); auto idx_E = imap.GetFlatIdx(cr::E, false); auto idx_F = imap.GetFlatIdx(cr::F, false); @@ -895,14 +895,14 @@ TaskStatus FixFluxes(MeshBlockData *rc) { } else if (ox2_bc == "polar") { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( - std::vector( - {c::density, c::energy::name(), c::momentum, c::bfield, cr::E, cr::F}), - std::vector( - {c::density, c::energy::name(), c::momentum, c::bfield, cr::E, cr::F}), + std::vector({c::density, c::energy::name(), c::momentum, + c::bfield::name(), cr::E, cr::F}), + std::vector({c::density, c::energy::name(), c::momentum, + c::bfield::name(), cr::E, cr::F}), imap); const auto crho = imap[c::density].first; const auto cener = imap[c::energy::name()].first; - auto idx_cb = imap.GetFlatIdx(c::bfield, false); + auto idx_cb = imap.GetFlatIdx(c::bfield::name(), false); auto idx_cmom = imap.GetFlatIdx(c::momentum); auto idx_E = imap.GetFlatIdx(cr::E, false); auto idx_F = imap.GetFlatIdx(cr::F, false); @@ -939,7 +939,7 @@ TaskStatus FixFluxes(MeshBlockData *rc) { const auto crho = imap[c::density].first; const auto cener = imap[c::energy::name()].first; auto idx_cmom = imap.GetFlatIdx(c::momentum); - auto idx_cb = imap.GetFlatIdx(c::bfield, false); + auto idx_cb = imap.GetFlatIdx(c::bfield::name(), false); auto idx_E = imap.GetFlatIdx(cr::E, false); auto idx_F = imap.GetFlatIdx(cr::F, false); parthenon::par_for( diff --git a/src/fixup/fixup_c2p.cpp b/src/fixup/fixup_c2p.cpp index 84eb86dc6..4f178d779 100644 --- a/src/fixup/fixup_c2p.cpp +++ b/src/fixup/fixup_c2p.cpp @@ -65,7 +65,7 @@ TaskStatus ConservedToPrimitiveFixupImpl(T *rc) { c::momentum, p::energy::name(), c::energy::name(), - p::bfield, + p::bfield::name(), p::ye, c::ye, p::pressure, @@ -98,8 +98,8 @@ TaskStatus ConservedToPrimitiveFixupImpl(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; - const int pb_lo = imap[p::bfield].first; - const int pb_hi = imap[p::bfield].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; diff --git a/src/fixup/fixup_netfield.cpp b/src/fixup/fixup_netfield.cpp index c17098349..3195b0a75 100644 --- a/src/fixup/fixup_netfield.cpp +++ b/src/fixup/fixup_netfield.cpp @@ -174,12 +174,12 @@ TaskStatus ModifyNetField(MeshData *md, const Real t, const Real dt, namespace p = fluid_prim; namespace c = fluid_cons; - const std::vector vars({p::bfield, c::bfield}); + const std::vector vars({p::bfield::name(), c::bfield::name()}); PackIndexMap imap; auto pack = md->PackVariables(vars, imap); - const int pblo = imap[p::bfield].first; - const int cblo = imap[c::bfield].first; + const int pblo = imap[p::bfield::name()].first; + const int cblo = imap[c::bfield::name()].first; const auto ib = md->GetBoundsI(IndexDomain::interior); const auto jb = md->GetBoundsJ(IndexDomain::interior); diff --git a/src/fixup/fixup_src.cpp b/src/fixup/fixup_src.cpp index 452179067..3900853d7 100644 --- a/src/fixup/fixup_src.cpp +++ b/src/fixup/fixup_src.cpp @@ -76,7 +76,7 @@ TaskStatus SourceFixupImpl(T *rc) { const std::vector vars( {p::density::name(), c::density, p::velocity::name(), c::momentum, - p::energy::name(), c::energy::name(), p::bfield, p::ye, c::ye, p::pressure, + 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}); @@ -96,8 +96,8 @@ TaskStatus SourceFixupImpl(T *rc) { const int shi = imap[impl::cell_signal_speed].second; int pye = imap[p::ye].second; int cye = imap[c::ye].second; - const int pb_lo = imap[p::bfield].first; - const int pb_hi = imap[p::bfield].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); auto idx_H = imap.GetFlatIdx(pr::H); auto idx_E = imap.GetFlatIdx(cr::E); diff --git a/src/fluid/con2prim.hpp b/src/fluid/con2prim.hpp index 375a70fd9..3d0aa322c 100644 --- a/src/fluid/con2prim.hpp +++ b/src/fluid/con2prim.hpp @@ -139,10 +139,12 @@ class ConToPrim { cmom_hi(imap[fluid_cons::momentum].second), peng(imap[fluid_prim::energy::name()].first), ceng(imap[fluid_cons::energy::name()].first), - pb_lo(imap[fluid_prim::bfield].first), pb_hi(imap[fluid_prim::bfield].second), - cb_lo(imap[fluid_cons::bfield].first), cb_hi(imap[fluid_cons::bfield].second), - pye(imap[fluid_prim::ye].second), cye(imap[fluid_cons::ye].second), - prs(imap[fluid_prim::pressure].first), tmp(imap[fluid_prim::temperature].first), + 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), + tmp(imap[fluid_prim::temperature].first), sig_lo(imap[internal_variables::cell_signal_speed].first), sig_hi(imap[internal_variables::cell_signal_speed].second), gm1(imap[fluid_prim::gamma1].first), @@ -153,8 +155,8 @@ class ConToPrim { return std::vector( {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, fluid_cons::bfield, fluid_prim::ye, fluid_cons::ye, - fluid_prim::pressure, fluid_prim::temperature, + fluid_prim::bfield::name(), fluid_cons::bfield::name(), fluid_prim::ye, + fluid_cons::ye, fluid_prim::pressure, fluid_prim::temperature, internal_variables::cell_signal_speed, fluid_prim::gamma1, internal_variables::c2p_scratch}); } diff --git a/src/fluid/con2prim_robust.hpp b/src/fluid/con2prim_robust.hpp index bd1fd9c23..0e6fc2ff8 100644 --- a/src/fluid/con2prim_robust.hpp +++ b/src/fluid/con2prim_robust.hpp @@ -236,10 +236,12 @@ class ConToPrim { cmom_hi(imap[fluid_cons::momentum].second), peng(imap[fluid_prim::energy::name()].first), ceng(imap[fluid_cons::energy::name()].first), - pb_lo(imap[fluid_prim::bfield].first), pb_hi(imap[fluid_prim::bfield].second), - cb_lo(imap[fluid_cons::bfield].first), cb_hi(imap[fluid_cons::bfield].second), - pye(imap[fluid_prim::ye].second), cye(imap[fluid_cons::ye].second), - prs(imap[fluid_prim::pressure].first), tmp(imap[fluid_prim::temperature].first), + 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), + tmp(imap[fluid_prim::temperature].first), sig_lo(imap[internal_variables::cell_signal_speed].first), sig_hi(imap[internal_variables::cell_signal_speed].second), gm1(imap[fluid_prim::gamma1].first), @@ -251,8 +253,8 @@ class ConToPrim { return std::vector( {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, fluid_cons::bfield, fluid_prim::ye, fluid_cons::ye, - fluid_prim::pressure, fluid_prim::temperature, + fluid_prim::bfield::name(), fluid_cons::bfield::name(), fluid_prim::ye, + fluid_cons::ye, fluid_prim::pressure, fluid_prim::temperature, internal_variables::cell_signal_speed, fluid_prim::gamma1, internal_variables::c2p_mu}); } diff --git a/src/fluid/fluid.cpp b/src/fluid/fluid.cpp index d28a3c72c..5e06a5cbe 100644 --- a/src/fluid/fluid.cpp +++ b/src/fluid/fluid.cpp @@ -193,7 +193,7 @@ std::shared_ptr Initialize(ParameterInput *pin) { physics->AddField(p::velocity::name(), mprim_threev); physics->AddField(p::energy::name(), mprim_scalar); if (mhd) { - physics->AddField(p::bfield, mprim_threev); + physics->AddField(p::bfield::name(), mprim_threev); if (ndim == 2) { physics->AddField(impl::emf, mprim_scalar); } else if (ndim == 3) { @@ -227,7 +227,7 @@ std::shared_ptr Initialize(ParameterInput *pin) { physics->AddField(c::momentum, mcons_threev); physics->AddField(c::energy::name(), mcons_scalar); if (mhd) { - physics->AddField(c::bfield, mcons_threev); + physics->AddField(c::bfield::name(), mcons_threev); } if (ye) { physics->AddField(c::ye, mcons_scalar); @@ -259,12 +259,12 @@ std::shared_ptr Initialize(ParameterInput *pin) { std::vector rvars( {p::density::name(), p::velocity::name(), p::energy::name()}); riemann::FluxState::ReconVars(rvars); - if (mhd) riemann::FluxState::ReconVars(p::bfield); + if (mhd) riemann::FluxState::ReconVars(p::bfield::name()); if (ye) riemann::FluxState::ReconVars(p::ye); std::vector fvars({c::density, c::momentum, c::energy::name()}); riemann::FluxState::FluxVars(fvars); - if (mhd) riemann::FluxState::FluxVars(c::bfield); + if (mhd) riemann::FluxState::FluxVars(c::bfield::name()); if (ye) riemann::FluxState::FluxVars(c::ye); // add some extra fields for reconstruction @@ -352,8 +352,8 @@ TaskStatus PrimitiveToConservedRegion(MeshBlockData *rc, const IndexRange const std::vector vars( {p::density::name(), c::density, p::velocity::name(), c::momentum, - p::energy::name(), c::energy::name(), p::bfield, c::bfield, 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, + c::ye, p::pressure, p::gamma1, impl::cell_signal_speed}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); @@ -368,10 +368,10 @@ TaskStatus PrimitiveToConservedRegion(MeshBlockData *rc, const IndexRange const int ceng = imap[c::energy::name()].first; const int prs = imap[p::pressure].first; const int gm1 = imap[p::gamma1].first; - const int pb_lo = imap[p::bfield].first; - const int pb_hi = imap[p::bfield].second; - const int cb_lo = imap[c::bfield].first; - const int cb_hi = imap[c::bfield].second; + const int pb_lo = imap[p::bfield::name()].first; + 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 sig_lo = imap[impl::cell_signal_speed].first; @@ -763,9 +763,9 @@ TaskStatus FluxCT(MeshBlockData *rc) { IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); IndexRange kb = rc->GetBoundsK(IndexDomain::interior); - auto f1 = rc->Get(fluid_cons::bfield).flux[X1DIR]; - auto f2 = rc->Get(fluid_cons::bfield).flux[X2DIR]; - auto f3 = rc->Get(fluid_cons::bfield).flux[X3DIR]; + auto f1 = rc->Get(fluid_cons::bfield::name()).flux[X1DIR]; + auto f2 = rc->Get(fluid_cons::bfield::name()).flux[X2DIR]; + auto f3 = rc->Get(fluid_cons::bfield::name()).flux[X3DIR]; auto emf = rc->Get(internal_variables::emf).data; if (ndim == 2) { @@ -824,7 +824,7 @@ TaskStatus CalculateDivB(MeshBlockData *rc) { // This is the problem for doing things with meshblock packs auto coords = pmb->coords; - auto b = rc->Get(fluid_cons::bfield).data; + auto b = rc->Get(fluid_cons::bfield::name()).data; auto divb = rc->Get(diagnostic_variables::divb).data; if (ndim == 2) { // todo(jcd): these are supposed to be node centered, and this misses the diff --git a/src/fluid/riemann.hpp b/src/fluid/riemann.hpp index aee4eb928..9bc1765bf 100644 --- a/src/fluid/riemann.hpp +++ b/src/fluid/riemann.hpp @@ -221,13 +221,14 @@ class FluxState { prho(imap[fluid_prim::density::name()].first), pvel_lo(imap[fluid_prim::velocity::name()].first), peng(imap[fluid_prim::energy::name()].first), - pb_lo(imap[fluid_prim::bfield].first), pb_hi(imap[fluid_prim::bfield].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_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), ceng(imap[fluid_cons::energy::name()].first), - cb_lo(imap[fluid_cons::bfield].first), cb_hi(imap[fluid_cons::bfield].second), - cye(imap[fluid_cons::ye].first), ncons(5 + (pb_hi - pb_lo + 1) + (cye > 0)) { + cb_lo(imap[fluid_cons::bfield::name()].first), + cb_hi(imap[fluid_cons::bfield::name()].second), cye(imap[fluid_cons::ye].first), + ncons(5 + (pb_hi - pb_lo + 1) + (cye > 0)) { PARTHENON_REQUIRE_THROWS( ncons <= NCONS_MAX, "ncons exceeds NCONS_MAX. Reconfigure to increase NCONS_MAX."); diff --git a/src/fluid/tmunu.hpp b/src/fluid/tmunu.hpp index 909b667bd..983013c8b 100644 --- a/src/fluid/tmunu.hpp +++ b/src/fluid/tmunu.hpp @@ -29,7 +29,7 @@ namespace fluid { const std::vector TMUNU_VARS = { fluid_prim::density::name(), fluid_prim::velocity::name(), fluid_prim::energy::name(), - fluid_prim::pressure, fluid_prim::bfield}; + fluid_prim::pressure, fluid_prim::bfield::name()}; // Indices are upstairs template class StressEnergyTensorCon { @@ -50,7 +50,7 @@ class StressEnergyTensorCon { iv_ = imap[fluid_prim::velocity::name()].first; iu_ = imap[fluid_prim::energy::name()].first; ip_ = imap[fluid_prim::pressure].first; - ib_ = imap[fluid_prim::bfield].first; + ib_ = imap[fluid_prim::bfield::name()].first; } // TODO(JMM): Assumes cell centers. If that needs to change, this diff --git a/src/pgen/advection.cpp b/src/pgen/advection.cpp index 63a2a8807..977a98143 100644 --- a/src/pgen/advection.cpp +++ b/src/pgen/advection.cpp @@ -27,7 +27,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, + fluid_prim::energy::name(), fluid_prim::bfield::name(), fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1}, imap); @@ -36,8 +36,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int ivlo = imap[fluid_prim::velocity::name()].first; const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy::name()].first; - const int ib_lo = imap[fluid_prim::bfield].first; - const int ib_hi = imap[fluid_prim::bfield].second; + 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 iprs = imap[fluid_prim::pressure].first; const int itmp = imap[fluid_prim::temperature].first; diff --git a/src/pgen/blandford_mckee.cpp b/src/pgen/blandford_mckee.cpp index c2eaa278e..e5647d887 100644 --- a/src/pgen/blandford_mckee.cpp +++ b/src/pgen/blandford_mckee.cpp @@ -32,7 +32,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, + fluid_prim::energy::name(), fluid_prim::bfield::name(), fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1}, imap); @@ -41,8 +41,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int ivlo = imap[fluid_prim::velocity::name()].first; const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy::name()].first; - const int ib_lo = imap[fluid_prim::bfield].first; - const int ib_hi = imap[fluid_prim::bfield].second; + 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 iprs = imap[fluid_prim::pressure].first; const int itmp = imap[fluid_prim::temperature].first; diff --git a/src/pgen/bondi.cpp b/src/pgen/bondi.cpp index 00d936235..f0f54cc20 100644 --- a/src/pgen/bondi.cpp +++ b/src/pgen/bondi.cpp @@ -92,7 +92,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, + fluid_prim::energy::name(), fluid_prim::bfield::name(), fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1}, imap); @@ -101,8 +101,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int ivlo = imap[fluid_prim::velocity::name()].first; const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy::name()].first; - const int ib_lo = imap[fluid_prim::bfield].first; - const int ib_hi = imap[fluid_prim::bfield].second; + 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 iprs = imap[fluid_prim::pressure].first; const int itmp = imap[fluid_prim::temperature].first; diff --git a/src/pgen/friedmann.cpp b/src/pgen/friedmann.cpp index 51fdf629c..67c9f0909 100644 --- a/src/pgen/friedmann.cpp +++ b/src/pgen/friedmann.cpp @@ -37,7 +37,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, + fluid_prim::energy::name(), fluid_prim::bfield::name(), fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1}, imap); diff --git a/src/pgen/kh.cpp b/src/pgen/kh.cpp index 956f44d28..a464bc723 100644 --- a/src/pgen/kh.cpp +++ b/src/pgen/kh.cpp @@ -27,7 +27,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, + fluid_prim::energy::name(), fluid_prim::bfield::name(), fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1}, imap); @@ -36,8 +36,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int ivlo = imap[fluid_prim::velocity::name()].first; const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy::name()].first; - const int ib_lo = imap[fluid_prim::bfield].first; - const int ib_hi = imap[fluid_prim::bfield].second; + 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 iprs = imap[fluid_prim::pressure].first; const int itmp = imap[fluid_prim::temperature].first; diff --git a/src/pgen/linear_modes.cpp b/src/pgen/linear_modes.cpp index 521d6f266..7722fbffa 100644 --- a/src/pgen/linear_modes.cpp +++ b/src/pgen/linear_modes.cpp @@ -45,7 +45,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { PackIndexMap imap; std::vector vars( {fluid_prim::density::name(), fluid_prim::velocity::name(), - fluid_prim::energy::name(), fluid_prim::bfield, fluid_prim::pressure, + fluid_prim::energy::name(), fluid_prim::bfield::name(), fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1, fluid_prim::ye}); auto v = rc->PackVariables(vars, imap); @@ -53,8 +53,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int ivlo = imap[fluid_prim::velocity::name()].first; const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy::name()].first; - const int ib_lo = imap[fluid_prim::bfield].first; - const int ib_hi = imap[fluid_prim::bfield].second; + const int ib_lo = imap[fluid_prim::bfield::name()].first; + const int ib_hi = imap[fluid_prim::bfield::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; diff --git a/src/pgen/p2c2p.cpp b/src/pgen/p2c2p.cpp index 49c9ac751..9e6ef79b1 100644 --- a/src/pgen/p2c2p.cpp +++ b/src/pgen/p2c2p.cpp @@ -74,7 +74,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, + fluid_prim::energy::name(), fluid_prim::bfield::name(), fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1}, imap); @@ -83,8 +83,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int ivlo = imap[fluid_prim::velocity::name()].first; const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy::name()].first; - const int ib_lo = imap[fluid_prim::bfield].first; - const int ib_hi = imap[fluid_prim::bfield].second; + const int ib_lo = imap[fluid_prim::bfield::name()].first; + const int ib_hi = imap[fluid_prim::bfield::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; diff --git a/src/pgen/progenitor.cpp b/src/pgen/progenitor.cpp index cc6c5e020..461ca83a0 100644 --- a/src/pgen/progenitor.cpp +++ b/src/pgen/progenitor.cpp @@ -36,7 +36,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, + fluid_prim::energy::name(), fluid_prim::bfield::name(), fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1}, imap); @@ -44,8 +44,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int ivlo = imap[fluid_prim::velocity::name()].first; const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy::name()].first; - const int ib_lo = imap[fluid_prim::bfield].first; - const int ib_hi = imap[fluid_prim::bfield].second; + 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 iprs = imap[fluid_prim::pressure].first; const int itmp = imap[fluid_prim::temperature].first; diff --git a/src/pgen/rhs_tester.cpp b/src/pgen/rhs_tester.cpp index 53d903d89..116da124c 100644 --- a/src/pgen/rhs_tester.cpp +++ b/src/pgen/rhs_tester.cpp @@ -21,7 +21,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, + fluid_prim::energy::name(), fluid_prim::bfield::name(), fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1}, imap); @@ -30,8 +30,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int ivlo = imap[fluid_prim::velocity::name()].first; const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy::name()].first; - const int ib_lo = imap[fluid_prim::bfield].first; - const int ib_hi = imap[fluid_prim::bfield].second; + 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 iprs = imap[fluid_prim::pressure].first; const int itmp = imap[fluid_prim::temperature].first; diff --git a/src/pgen/rotor.cpp b/src/pgen/rotor.cpp index ee82e4a1c..6e89c7d8a 100644 --- a/src/pgen/rotor.cpp +++ b/src/pgen/rotor.cpp @@ -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, + fluid_prim::energy::name(), fluid_prim::bfield::name(), fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1}, imap); @@ -42,8 +42,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int ivlo = imap[fluid_prim::velocity::name()].first; const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy::name()].first; - const int ib_lo = imap[fluid_prim::bfield].first; - const int ib_hi = imap[fluid_prim::bfield].second; + 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 iprs = imap[fluid_prim::pressure].first; const int itmp = imap[fluid_prim::temperature].first; diff --git a/src/pgen/sedov.cpp b/src/pgen/sedov.cpp index f35bc23b5..725b2b438 100644 --- a/src/pgen/sedov.cpp +++ b/src/pgen/sedov.cpp @@ -32,7 +32,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, + fluid_prim::energy::name(), fluid_prim::bfield::name(), fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1}, imap); @@ -41,8 +41,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int ivlo = imap[fluid_prim::velocity::name()].first; const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy::name()].first; - const int ib_lo = imap[fluid_prim::bfield].first; - const int ib_hi = imap[fluid_prim::bfield].second; + 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 iprs = imap[fluid_prim::pressure].first; const int itmp = imap[fluid_prim::temperature].first; diff --git a/src/pgen/shock_tube.cpp b/src/pgen/shock_tube.cpp index c601915c4..99732ce0b 100644 --- a/src/pgen/shock_tube.cpp +++ b/src/pgen/shock_tube.cpp @@ -36,7 +36,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, + fluid_prim::energy::name(), fluid_prim::bfield::name(), fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1}, imap); @@ -45,8 +45,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int ivlo = imap[fluid_prim::velocity::name()].first; const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy::name()].first; - const int ib_lo = imap[fluid_prim::bfield].first; - const int ib_hi = imap[fluid_prim::bfield].second; + 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 iprs = imap[fluid_prim::pressure].first; const int itmp = imap[fluid_prim::temperature].first; diff --git a/src/pgen/torus.cpp b/src/pgen/torus.cpp index 63815253d..f40b2a7df 100644 --- a/src/pgen/torus.cpp +++ b/src/pgen/torus.cpp @@ -140,8 +140,8 @@ 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, fluid_prim::ye, - fluid_prim::pressure, fluid_prim::temperature, + fluid_prim::energy::name(), fluid_prim::bfield::name(), + fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1, radmoment_prim::J, radmoment_prim::H}, imap); @@ -149,8 +149,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int ivlo = imap[fluid_prim::velocity::name()].first; const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy::name()].first; - const int iblo = imap[fluid_prim::bfield].first; - const int ibhi = imap[fluid_prim::bfield].second; + const int iblo = imap[fluid_prim::bfield::name()].first; + const int ibhi = imap[fluid_prim::bfield::name()].second; const int iye = imap[fluid_prim::ye].second; const int iprs = imap[fluid_prim::pressure].first; const int itmp = imap[fluid_prim::temperature].first; @@ -541,9 +541,9 @@ void PostInitializationModifier(ParameterInput *pin, Mesh *pmesh) { auto kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); PackIndexMap imap; - auto v = rc->PackVariables({fluid_prim::bfield}, imap); - const int iblo = imap[fluid_prim::bfield].first; - const int ibhi = imap[fluid_prim::bfield].second; + auto v = rc->PackVariables({fluid_prim::bfield::name()}, imap); + const int iblo = imap[fluid_prim::bfield::name()].first; + const int ibhi = imap[fluid_prim::bfield::name()].second; pmb->par_for( "Phoebus::ProblemGenerator::Torus::BFieldNorm", kb.s, kb.e, jb.s, jb.e, ib.s, @@ -679,16 +679,16 @@ void ComputeBetas(Mesh *pmesh, Real rho_min_bnorm, Real &beta_min_global, auto kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); PackIndexMap imap; - auto v = - rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), - fluid_prim::bfield, fluid_prim::pressure, radmoment_prim::J}, - imap); + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), + fluid_prim::bfield::name(), fluid_prim::pressure, + radmoment_prim::J}, + imap); const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity::name()].first; const int ivhi = imap[fluid_prim::velocity::name()].second; - const int iblo = imap[fluid_prim::bfield].first; - const int ibhi = imap[fluid_prim::bfield].second; + const int iblo = imap[fluid_prim::bfield::name()].first; + const int ibhi = imap[fluid_prim::bfield::name()].second; const int iprs = imap[fluid_prim::pressure].first; auto idx_J = imap.GetFlatIdx(radmoment_prim::J, false); diff --git a/src/pgen/tov.cpp b/src/pgen/tov.cpp index fc5ae6d01..82de66247 100644 --- a/src/pgen/tov.cpp +++ b/src/pgen/tov.cpp @@ -72,7 +72,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, + fluid_prim::energy::name(), fluid_prim::bfield::name(), fluid_prim::ye, fluid_prim::pressure, fluid_prim::temperature, fluid_prim::gamma1}, imap); @@ -81,8 +81,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int ivlo = imap[fluid_prim::velocity::name()].first; const int ivhi = imap[fluid_prim::velocity::name()].second; const int ieng = imap[fluid_prim::energy::name()].first; - const int iblo = imap[fluid_prim::bfield].first; - const int ibhi = imap[fluid_prim::bfield].second; + const int iblo = imap[fluid_prim::bfield::name()].first; + const int ibhi = imap[fluid_prim::bfield::name()].second; const int iye = imap[fluid_prim::ye].second; const int iprs = imap[fluid_prim::pressure].first; const int itmp = imap[fluid_prim::temperature].first; diff --git a/src/phoebus_boundaries/phoebus_boundaries.cpp b/src/phoebus_boundaries/phoebus_boundaries.cpp index b38c3a97d..ec53a703f 100644 --- a/src/phoebus_boundaries/phoebus_boundaries.cpp +++ b/src/phoebus_boundaries/phoebus_boundaries.cpp @@ -163,7 +163,7 @@ void PolarInnerX2(std::shared_ptr> &rc, bool coarse) { PARTHENON_REQUIRE(bc_vars == "primitive", "Polar X2 reflecting BCs not supported"); const auto idx_pvel = imap.GetFlatIdx(fluid_prim::velocity::name(), false); - const auto idx_pb = imap.GetFlatIdx(fluid_prim::bfield, false); + const auto idx_pb = imap.GetFlatIdx(fluid_prim::bfield::name(), false); pmb->par_for_bndry( "PolarInnerX2Prim", nb, domain, CC, coarse, @@ -196,7 +196,7 @@ void PolarOuterX2(std::shared_ptr> &rc, bool coarse) { PARTHENON_REQUIRE(bc_vars == "primitive", "Polar X2 reflecting BCs not supported"); const auto idx_pvel = imap.GetFlatIdx(fluid_prim::velocity::name(), false); - const auto idx_pb = imap.GetFlatIdx(fluid_prim::bfield, false); + const auto idx_pb = imap.GetFlatIdx(fluid_prim::bfield::name(), false); const std::string label = "PolarOuterX2Prim"; pmb->par_for_bndry( diff --git a/src/phoebus_utils/variables.hpp b/src/phoebus_utils/variables.hpp index aa4d37a71..72b29dcc0 100644 --- a/src/phoebus_utils/variables.hpp +++ b/src/phoebus_utils/variables.hpp @@ -36,7 +36,7 @@ namespace fluid_prim { VARIABLE(p, density); VARIABLE(p, velocity); VARIABLE(p, energy); -constexpr char bfield[] = "p.bfield"; +VARIABLE(p, bfield); constexpr char ye[] = "p.ye"; constexpr char pressure[] = "pressure"; constexpr char temperature[] = "temperature"; @@ -47,7 +47,7 @@ namespace fluid_cons { constexpr char density[] = "c.density"; constexpr char momentum[] = "c.momentum"; VARIABLE(c, energy); -constexpr char bfield[] = "c.bfield"; +VARIABLE(c, bfield); constexpr char ye[] = "c.ye"; } // namespace fluid_cons diff --git a/src/radiation/moments_source.cpp b/src/radiation/moments_source.cpp index dfa8b7e45..e92ac2a71 100644 --- a/src/radiation/moments_source.cpp +++ b/src/radiation/moments_source.cpp @@ -216,16 +216,26 @@ TaskStatus MomentFluidSourceImpl(T *rc, Real dt, bool update_fluid) { namespace ir = radmoment_internal; namespace c = fluid_cons; namespace p = fluid_prim; - std::vector vars{c::density, c::energy::name(), - c::momentum, c::ye, - cr::E, cr::F, - c::bfield, p::density::name(), - p::temperature, p::energy::name(), - p::ye, p::velocity::name(), - p::pressure, p::gamma1, - p::bfield, pr::J, - pr::H, ir::kappaJ, - ir::kappaH, ir::JBB, + std::vector vars{c::density, + c::energy::name(), + c::momentum, + c::ye, + cr::E, + cr::F, + c::bfield::name(), + p::density::name(), + p::temperature, + p::energy::name(), + p::ye, + p::velocity::name(), + p::pressure, + p::gamma1, + p::bfield::name(), + pr::J, + pr::H, + ir::kappaJ, + ir::kappaH, + ir::JBB, ir::tilPi}; PackIndexMap imap; @@ -247,8 +257,8 @@ TaskStatus MomentFluidSourceImpl(T *rc, Real dt, bool update_fluid) { int pprs = imap[p::pressure].first; int pgm1 = imap[p::gamma1].first; int pYe = imap[p::ye].first; - int pb_lo = imap[p::bfield].first; - int cb_lo = imap[c::bfield].first; + int pb_lo = imap[p::bfield::name()].first; + int cb_lo = imap[c::bfield::name()].first; int crho = imap[c::density].first; int ceng = imap[c::energy::name()].first; From b52dc021b5bb64d22fba25f622ac9a9bb5b5a9ff Mon Sep 17 00:00:00 2001 From: Jonah Maxwell Miller Date: Wed, 6 Dec 2023 13:36:30 -0700 Subject: [PATCH 10/14] move ye to variable types --- src/fixup/fixup.cpp | 10 +++++----- src/fixup/fixup_c2p.cpp | 8 ++++---- src/fixup/fixup_radc2p.cpp | 9 +++++---- src/fixup/fixup_src.cpp | 10 +++++----- src/fluid/con2prim.hpp | 9 +++++---- src/fluid/con2prim_robust.hpp | 9 +++++---- src/fluid/fluid.cpp | 16 ++++++++-------- src/fluid/riemann.hpp | 10 ++++++---- src/microphysics/eos_phoebus/eos_phoebus.cpp | 2 +- src/pgen/advection.cpp | 4 ++-- src/pgen/blandford_mckee.cpp | 4 ++-- src/pgen/bondi.cpp | 4 ++-- src/pgen/friedmann.cpp | 4 ++-- src/pgen/kh.cpp | 4 ++-- src/pgen/leptoneq.cpp | 4 ++-- src/pgen/linear_modes.cpp | 4 ++-- src/pgen/p2c2p.cpp | 2 +- src/pgen/progenitor.cpp | 4 ++-- src/pgen/radiation_equilibration.cpp | 4 ++-- src/pgen/rhs_tester.cpp | 4 ++-- src/pgen/rotor.cpp | 4 ++-- src/pgen/sedov.cpp | 4 ++-- src/pgen/shock_tube.cpp | 4 ++-- src/pgen/thin_cooling.cpp | 4 ++-- src/pgen/torus.cpp | 14 +++++++------- src/pgen/tov.cpp | 4 ++-- src/phoebus_utils/variables.hpp | 4 ++-- src/radiation/cooling_function.cpp | 6 +++--- src/radiation/mocmc.cpp | 14 +++++++------- src/radiation/moments.cpp | 4 ++-- src/radiation/moments_source.cpp | 8 ++++---- src/radiation/monte_carlo.cpp | 12 ++++++------ src/radiation/radiation.cpp | 4 ++-- 33 files changed, 108 insertions(+), 103 deletions(-) diff --git a/src/fixup/fixup.cpp b/src/fixup/fixup.cpp index e6771cfe4..ac35c9539 100644 --- a/src/fixup/fixup.cpp +++ b/src/fixup/fixup.cpp @@ -308,9 +308,9 @@ TaskStatus ApplyFloorsImpl(T *rc, IndexDomain domain = IndexDomain::entire) { const std::vector 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); @@ -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); diff --git a/src/fixup/fixup_c2p.cpp b/src/fixup/fixup_c2p.cpp index 4f178d779..8e582d031 100644 --- a/src/fixup/fixup_c2p.cpp +++ b/src/fixup/fixup_c2p.cpp @@ -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, @@ -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; diff --git a/src/fixup/fixup_radc2p.cpp b/src/fixup/fixup_radc2p.cpp index f194fdb5d..35881a099 100644 --- a/src/fixup/fixup_radc2p.cpp +++ b/src/fixup/fixup_radc2p.cpp @@ -63,15 +63,16 @@ TaskStatus RadConservedToPrimitiveFixupImpl(T *rc) { bool update_rad = rad_pkg->Param("active"); if (!enable_c2p_fixup || !update_rad) return TaskStatus::complete; - const std::vector 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 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); diff --git a/src/fixup/fixup_src.cpp b/src/fixup/fixup_src.cpp index 3900853d7..47be522ea 100644 --- a/src/fixup/fixup_src.cpp +++ b/src/fixup/fixup_src.cpp @@ -76,9 +76,9 @@ TaskStatus SourceFixupImpl(T *rc) { const std::vector 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); @@ -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); diff --git a/src/fluid/con2prim.hpp b/src/fluid/con2prim.hpp index 3d0aa322c..97c51b4b9 100644 --- a/src/fluid/con2prim.hpp +++ b/src/fluid/con2prim.hpp @@ -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), @@ -155,8 +156,8 @@ class ConToPrim { return std::vector( {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}); } diff --git a/src/fluid/con2prim_robust.hpp b/src/fluid/con2prim_robust.hpp index 0e6fc2ff8..4a0dc6d2c 100644 --- a/src/fluid/con2prim_robust.hpp +++ b/src/fluid/con2prim_robust.hpp @@ -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), @@ -253,8 +254,8 @@ class ConToPrim { return std::vector( {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}); } diff --git a/src/fluid/fluid.cpp b/src/fluid/fluid.cpp index 5e06a5cbe..8ebcf1c68 100644 --- a/src/fluid/fluid.cpp +++ b/src/fluid/fluid.cpp @@ -205,7 +205,7 @@ std::shared_ptr 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); @@ -230,7 +230,7 @@ std::shared_ptr 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> net_field_totals; @@ -260,12 +260,12 @@ std::shared_ptr 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 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({p::pressure, p::gamma1}); @@ -352,8 +352,8 @@ TaskStatus PrimitiveToConservedRegion(MeshBlockData *rc, const IndexRange const std::vector 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); @@ -372,8 +372,8 @@ TaskStatus PrimitiveToConservedRegion(MeshBlockData *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; diff --git a/src/fluid/riemann.hpp b/src/fluid/riemann.hpp index 9bc1765bf..057c9d348 100644 --- a/src/fluid/riemann.hpp +++ b/src/fluid/riemann.hpp @@ -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, diff --git a/src/microphysics/eos_phoebus/eos_phoebus.cpp b/src/microphysics/eos_phoebus/eos_phoebus.cpp index 69ca8d5b8..a425a6eef 100644 --- a/src/microphysics/eos_phoebus/eos_phoebus.cpp +++ b/src/microphysics/eos_phoebus/eos_phoebus.cpp @@ -97,7 +97,7 @@ std::shared_ptr 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"); diff --git a/src/pgen/advection.cpp b/src/pgen/advection.cpp index 977a98143..8fa7bdaf8 100644 --- a/src/pgen/advection.cpp +++ b/src/pgen/advection.cpp @@ -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); @@ -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; diff --git a/src/pgen/blandford_mckee.cpp b/src/pgen/blandford_mckee.cpp index e5647d887..a42e6f6d4 100644 --- a/src/pgen/blandford_mckee.cpp +++ b/src/pgen/blandford_mckee.cpp @@ -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); @@ -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; diff --git a/src/pgen/bondi.cpp b/src/pgen/bondi.cpp index f0f54cc20..96fd79be7 100644 --- a/src/pgen/bondi.cpp +++ b/src/pgen/bondi.cpp @@ -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); @@ -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; diff --git a/src/pgen/friedmann.cpp b/src/pgen/friedmann.cpp index 67c9f0909..a7a71f072 100644 --- a/src/pgen/friedmann.cpp +++ b/src/pgen/friedmann.cpp @@ -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; diff --git a/src/pgen/kh.cpp b/src/pgen/kh.cpp index a464bc723..86a1f06ff 100644 --- a/src/pgen/kh.cpp +++ b/src/pgen/kh.cpp @@ -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); @@ -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; diff --git a/src/pgen/leptoneq.cpp b/src/pgen/leptoneq.cpp index 77ffb30b7..9605c95da 100644 --- a/src/pgen/leptoneq.cpp +++ b/src/pgen/leptoneq.cpp @@ -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; diff --git a/src/pgen/linear_modes.cpp b/src/pgen/linear_modes.cpp index 7722fbffa..067c49d82 100644 --- a/src/pgen/linear_modes.cpp +++ b/src/pgen/linear_modes.cpp @@ -46,7 +46,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { std::vector 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; @@ -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"); diff --git a/src/pgen/p2c2p.cpp b/src/pgen/p2c2p.cpp index 9e6ef79b1..fac0d6a30 100644 --- a/src/pgen/p2c2p.cpp +++ b/src/pgen/p2c2p.cpp @@ -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); diff --git a/src/pgen/progenitor.cpp b/src/pgen/progenitor.cpp index 461ca83a0..aa0bb4c2d 100644 --- a/src/pgen/progenitor.cpp +++ b/src/pgen/progenitor.cpp @@ -37,7 +37,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); const int irho = imap[fluid_prim::density::name()].first; @@ -46,7 +46,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; diff --git a/src/pgen/radiation_equilibration.cpp b/src/pgen/radiation_equilibration.cpp index 520ae1d80..71151f509 100644 --- a/src/pgen/radiation_equilibration.cpp +++ b/src/pgen/radiation_equilibration.cpp @@ -35,7 +35,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { {radmoment_prim::J, radmoment_prim::H, radmoment_internal::xi, radmoment_internal::phi, fluid_prim::density::name(), fluid_prim::temperature, fluid_prim::pressure, fluid_prim::gamma1, fluid_prim::energy::name(), - fluid_prim::ye, fluid_prim::velocity::name()}, + fluid_prim::ye::name(), fluid_prim::velocity::name()}, imap); auto idJ = imap.GetFlatIdx(radmoment_prim::J); @@ -48,7 +48,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int iP = imap[fluid_prim::pressure].first; const int igm1 = imap[fluid_prim::gamma1].first; const int ieng = imap[fluid_prim::energy::name()].first; - const int pye = imap[fluid_prim::ye].first; + const int pye = imap[fluid_prim::ye::name()].first; auto idv = imap.GetFlatIdx(fluid_prim::velocity::name()); const auto specB = idJ.GetBounds(1); diff --git a/src/pgen/rhs_tester.cpp b/src/pgen/rhs_tester.cpp index 116da124c..d2ee11da5 100644 --- a/src/pgen/rhs_tester.cpp +++ b/src/pgen/rhs_tester.cpp @@ -22,7 +22,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); @@ -32,7 +32,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; diff --git a/src/pgen/rotor.cpp b/src/pgen/rotor.cpp index 6e89c7d8a..33ced5f69 100644 --- a/src/pgen/rotor.cpp +++ b/src/pgen/rotor.cpp @@ -34,7 +34,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); @@ -44,7 +44,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; diff --git a/src/pgen/sedov.cpp b/src/pgen/sedov.cpp index 725b2b438..bf5225749 100644 --- a/src/pgen/sedov.cpp +++ b/src/pgen/sedov.cpp @@ -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); @@ -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; diff --git a/src/pgen/shock_tube.cpp b/src/pgen/shock_tube.cpp index 99732ce0b..928c00881 100644 --- a/src/pgen/shock_tube.cpp +++ b/src/pgen/shock_tube.cpp @@ -37,7 +37,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); @@ -47,7 +47,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; diff --git a/src/pgen/thin_cooling.cpp b/src/pgen/thin_cooling.cpp index 8bfcdbe02..32890514f 100644 --- a/src/pgen/thin_cooling.cpp +++ b/src/pgen/thin_cooling.cpp @@ -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].second; + const int iye = imap[p::ye::name()].second; const int iprs = imap[p::pressure].first; const int itmp = imap[p::temperature].first; const int igm1 = imap[p::gamma1].first; diff --git a/src/pgen/torus.cpp b/src/pgen/torus.cpp index f40b2a7df..b153e054d 100644 --- a/src/pgen/torus.cpp +++ b/src/pgen/torus.cpp @@ -138,12 +138,12 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { bool do_rad = rad_pkg->Param("active"); 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::temperature, - fluid_prim::gamma1, radmoment_prim::J, radmoment_prim::H}, - imap); + auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), + fluid_prim::energy::name(), fluid_prim::bfield::name(), + fluid_prim::ye::name(), fluid_prim::pressure, + fluid_prim::temperature, fluid_prim::gamma1, + radmoment_prim::J, radmoment_prim::H}, + imap); const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity::name()].first; @@ -151,7 +151,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int ieng = imap[fluid_prim::energy::name()].first; const int iblo = imap[fluid_prim::bfield::name()].first; const int ibhi = 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; diff --git a/src/pgen/tov.cpp b/src/pgen/tov.cpp index 82de66247..780bfd10a 100644 --- a/src/pgen/tov.cpp +++ b/src/pgen/tov.cpp @@ -73,7 +73,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); @@ -83,7 +83,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int ieng = imap[fluid_prim::energy::name()].first; const int iblo = imap[fluid_prim::bfield::name()].first; const int ibhi = 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; diff --git a/src/phoebus_utils/variables.hpp b/src/phoebus_utils/variables.hpp index 72b29dcc0..98f18ff39 100644 --- a/src/phoebus_utils/variables.hpp +++ b/src/phoebus_utils/variables.hpp @@ -37,7 +37,7 @@ VARIABLE(p, density); VARIABLE(p, velocity); VARIABLE(p, energy); VARIABLE(p, bfield); -constexpr char ye[] = "p.ye"; +VARIABLE(p, ye); constexpr char pressure[] = "pressure"; constexpr char temperature[] = "temperature"; constexpr char gamma1[] = "gamma1"; @@ -48,7 +48,7 @@ constexpr char density[] = "c.density"; constexpr char momentum[] = "c.momentum"; VARIABLE(c, energy); VARIABLE(c, bfield); -constexpr char ye[] = "c.ye"; +VARIABLE(c, ye); } // namespace fluid_cons namespace radmoment_prim { diff --git a/src/radiation/cooling_function.cpp b/src/radiation/cooling_function.cpp index b6c05be39..57ad9a635 100644 --- a/src/radiation/cooling_function.cpp +++ b/src/radiation/cooling_function.cpp @@ -114,8 +114,8 @@ TaskStatus CoolingFunctionCalculateFourForce(MeshBlockData *rc, const doub auto *pmb = rc->GetParentPointer(); std::vector vars({c::density, p::density::name(), p::velocity::name(), - p::temperature, p::ye, c::energy::name(), iv::Gcov, - iv::GcovHeat, iv::GcovCool, iv::Gye, iv::tau, + p::temperature, p::ye::name(), c::energy::name(), + iv::Gcov, iv::GcovHeat, iv::GcovCool, iv::Gye, iv::tau, p::energy::name()}); PackIndexMap imap; @@ -125,7 +125,7 @@ TaskStatus CoolingFunctionCalculateFourForce(MeshBlockData *rc, const doub const int pvlo = imap[p::velocity::name()].first; const int pvhi = imap[p::velocity::name()].second; const int ptemp = imap[p::temperature].first; - const int pye = imap[p::ye].first; + const int pye = imap[p::ye::name()].first; const int penergy = imap[p::energy::name()].first; const int Gcov_lo = imap[iv::Gcov].first; const int Gcov_hi = imap[iv::Gcov].second; diff --git a/src/radiation/mocmc.cpp b/src/radiation/mocmc.cpp index 4602f2639..7a62f0c01 100644 --- a/src/radiation/mocmc.cpp +++ b/src/radiation/mocmc.cpp @@ -82,8 +82,8 @@ void MOCMCInitSamples(T *rc) { StateDescriptor *eos = pmb->packages.Get("eos").get(); std::vector variables{ - pr::J, pr::H, pf::density::name(), pf::velocity::name(), - pf::temperature, pf::ye, im::dnsamp}; + pr::J, pr::H, pf::density::name(), pf::velocity::name(), + pf::temperature, pf::ye::name(), im::dnsamp}; PackIndexMap imap; auto v = rc->PackVariables(variables, imap); @@ -92,7 +92,7 @@ void MOCMCInitSamples(T *rc) { auto pdens = imap[pf::density::name()].first; auto pv = imap.GetFlatIdx(fluid_prim::velocity::name()); auto pT = imap[pf::temperature].first; - auto pye = imap[pf::ye].first; + auto pye = imap[pf::ye::name()].first; auto dn = imap[im::dnsamp].first; const int nblock = v.GetDim(5); @@ -529,7 +529,7 @@ TaskStatus MOCMCFluidSource(T *rc, const Real dt, const bool update_fluid) { pf::energy::name(), pf::velocity::name(), pf::temperature, - pf::ye, + pf::ye::name(), ir::tilPi, ir::kappaH, im::dnsamp, @@ -539,7 +539,7 @@ TaskStatus MOCMCFluidSource(T *rc, const Real dt, const bool update_fluid) { if (update_fluid) { variables.push_back(cf::energy::name()); variables.push_back(cf::momentum); - variables.push_back(cf::ye); + variables.push_back(cf::ye::name()); } PackIndexMap imap; auto v = rc->PackVariables(variables, imap); @@ -550,7 +550,7 @@ TaskStatus MOCMCFluidSource(T *rc, const Real dt, const bool update_fluid) { const auto peng = imap[pf::energy::name()].first; const auto pv = imap.GetFlatIdx(fluid_prim::velocity::name()); const auto pT = imap[pf::temperature].first; - const auto pye = imap[pf::ye].first; + const auto pye = imap[pf::ye::name()].first; const auto Inu0 = imap.GetFlatIdx(im::Inu0); const auto Inu1 = imap.GetFlatIdx(im::Inu1); const auto ijinvs = imap.GetFlatIdx(im::jinvs); @@ -562,7 +562,7 @@ TaskStatus MOCMCFluidSource(T *rc, const Real dt, const bool update_fluid) { if (update_fluid) { ceng = imap[cf::energy::name()].first; cmom_lo = imap[cf::momentum].first; - cye = imap[cf::ye].first; + cye = imap[cf::ye::name()].first; } const auto &ncov = swarm->template Get("ncov").Get(); diff --git a/src/radiation/moments.cpp b/src/radiation/moments.cpp index 429e70c7c..716b55131 100644 --- a/src/radiation/moments.cpp +++ b/src/radiation/moments.cpp @@ -945,7 +945,7 @@ TaskStatus MomentCalculateOpacities(T *rc) { namespace c = fluid_cons; namespace p = fluid_prim; std::vector vars{ - p::density::name(), p::temperature, p::ye, p::velocity::name(), + p::density::name(), p::temperature, p::ye::name(), p::velocity::name(), ir::kappaJ, ir::kappaH, ir::JBB}; PackIndexMap imap; @@ -954,7 +954,7 @@ TaskStatus MomentCalculateOpacities(T *rc) { int prho = imap[p::density::name()].first; int pT = imap[p::temperature].first; - int pYe = imap[p::ye].first; + int pYe = imap[p::ye::name()].first; auto idx_kappaJ = imap.GetFlatIdx(ir::kappaJ); auto idx_kappaH = imap.GetFlatIdx(ir::kappaH); diff --git a/src/radiation/moments_source.cpp b/src/radiation/moments_source.cpp index e92ac2a71..7e0c637db 100644 --- a/src/radiation/moments_source.cpp +++ b/src/radiation/moments_source.cpp @@ -219,14 +219,14 @@ TaskStatus MomentFluidSourceImpl(T *rc, Real dt, bool update_fluid) { std::vector vars{c::density, c::energy::name(), c::momentum, - c::ye, + c::ye::name(), cr::E, cr::F, c::bfield::name(), p::density::name(), p::temperature, p::energy::name(), - p::ye, + p::ye::name(), p::velocity::name(), p::pressure, p::gamma1, @@ -256,7 +256,7 @@ TaskStatus MomentFluidSourceImpl(T *rc, Real dt, bool update_fluid) { int pT = imap[p::temperature].first; int pprs = imap[p::pressure].first; int pgm1 = imap[p::gamma1].first; - int pYe = imap[p::ye].first; + int pYe = imap[p::ye::name()].first; int pb_lo = imap[p::bfield::name()].first; int cb_lo = imap[c::bfield::name()].first; @@ -264,7 +264,7 @@ TaskStatus MomentFluidSourceImpl(T *rc, Real dt, bool update_fluid) { int ceng = imap[c::energy::name()].first; int cmom_lo = imap[c::momentum].first; int cmom_hi = imap[c::momentum].second; - int cye = imap[c::ye].first; + int cye = imap[c::ye::name()].first; IndexRange ib = rc->GetBoundsI(IndexDomain::interior); IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); diff --git a/src/radiation/monte_carlo.cpp b/src/radiation/monte_carlo.cpp index 793045ea6..4af727e35 100644 --- a/src/radiation/monte_carlo.cpp +++ b/src/radiation/monte_carlo.cpp @@ -54,10 +54,10 @@ void ComputeTotalEmissivity(Mesh *pmesh) { namespace p = fluid_prim; PackIndexMap imap; - auto v = rc->PackVariables({p::density::name(), p::temperature, p::ye}, imap); + auto v = rc->PackVariables({p::density::name(), p::temperature, p::ye::name()}, imap); const int prho = imap[p::density::name()].first; const int ptemp = imap[p::temperature].first; - const int pye = imap[p::ye].first; + const int pye = imap[p::ye::name()].first; Real Jtot_b = 0.0; // per block // into par_for @@ -150,12 +150,12 @@ TaskStatus MonteCarloSourceParticles(MeshBlock *pmb, MeshBlockData *rc, const Real h_code = code_constants.h; const Real mp_code = code_constants.mp; - std::vector vars({p::density::name(), p::temperature, p::ye, + std::vector vars({p::density::name(), p::temperature, p::ye::name(), p::velocity::name(), "dNdlnu_max", "dNdlnu", "dN", "Ns", iv::Gcov, iv::Gye}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); - const int pye = imap[p::ye].first; + const int pye = imap[p::ye::name()].first; const int pdens = imap[p::density::name()].first; const int ptemp = imap[p::temperature].first; const int pvlo = imap[p::velocity::name()].first; @@ -456,12 +456,12 @@ TaskStatus MonteCarloTransport(MeshBlock *pmb, MeshBlockData *rc, const Real h_code = code_constants.h; const Real mp_code = code_constants.mp; - std::vector vars({p::density::name(), p::ye, p::velocity::name(), + std::vector vars({p::density::name(), p::ye::name(), p::velocity::name(), p::temperature, iv::Gcov, iv::Gye}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); const int prho = imap[p::density::name()].first; - const int iye = imap[p::ye].first; + const int iye = imap[p::ye::name()].first; const int ivlo = imap[p::velocity::name()].first; const int ivhi = imap[p::velocity::name()].second; const int itemp = imap[p::temperature].first; diff --git a/src/radiation/radiation.cpp b/src/radiation/radiation.cpp index 4632b8be2..3dc6e7265 100644 --- a/src/radiation/radiation.cpp +++ b/src/radiation/radiation.cpp @@ -545,14 +545,14 @@ TaskStatus ApplyRadiationFourForce(MeshBlockData *rc, const double dt) { namespace iv = internal_variables; std::vector vars( - {c::density, c::energy::name(), c::momentum, c::ye, iv::Gcov, iv::Gye}); + {c::density, c::energy::name(), c::momentum, c::ye::name(), iv::Gcov, iv::Gye}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); const int crho = imap[c::density].first; const int ceng = imap[c::energy::name()].first; const int cmom_lo = imap[c::momentum].first; const int cmom_hi = imap[c::momentum].second; - const int cye = imap[c::ye].first; + const int cye = imap[c::ye::name()].first; const int Gcov_lo = imap[iv::Gcov].first; const int Gcov_hi = imap[iv::Gcov].second; const int Gye = imap[iv::Gye].first; From 294e06a27eee8c6b3d54dddf6cd4a29902d3c2be Mon Sep 17 00:00:00 2001 From: Jonah Maxwell Miller Date: Wed, 6 Dec 2023 13:39:36 -0700 Subject: [PATCH 11/14] move momentum to variable types --- src/fixup/fixup.cpp | 30 ++++++++++++++--------------- src/fixup/fixup_c2p.cpp | 6 +++--- src/fixup/fixup_src.cpp | 4 ++-- src/fluid/con2prim.hpp | 11 ++++++----- src/fluid/con2prim_robust.hpp | 11 ++++++----- src/fluid/fluid.cpp | 20 ++++++++++--------- src/fluid/fluid.hpp | 6 +++--- src/fluid/riemann.hpp | 2 +- src/monopole_gr/interp_3d_to_1d.hpp | 2 +- src/phoebus_driver.cpp | 2 +- src/phoebus_utils/variables.hpp | 2 +- src/radiation/mocmc.cpp | 4 ++-- src/radiation/moments_source.cpp | 6 +++--- src/radiation/radiation.cpp | 8 ++++---- 14 files changed, 59 insertions(+), 55 deletions(-) diff --git a/src/fixup/fixup.cpp b/src/fixup/fixup.cpp index ac35c9539..fd40e68d2 100644 --- a/src/fixup/fixup.cpp +++ b/src/fixup/fixup.cpp @@ -307,7 +307,7 @@ TaskStatus ApplyFloorsImpl(T *rc, IndexDomain domain = IndexDomain::entire) { if (!enable_floors) return TaskStatus::complete; const std::vector vars( - {p::density::name(), c::density, p::velocity::name(), c::momentum, + {p::density::name(), c::density, p::velocity::name(), c::momentum::name(), 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}); @@ -319,8 +319,8 @@ TaskStatus ApplyFloorsImpl(T *rc, IndexDomain domain = IndexDomain::entire) { const int crho = imap[c::density].first; const int pvel_lo = imap[p::velocity::name()].first; const int pvel_hi = imap[p::velocity::name()].second; - const int cmom_lo = imap[c::momentum].first; - const int cmom_hi = imap[c::momentum].second; + const int cmom_lo = imap[c::momentum::name()].first; + const int cmom_hi = imap[c::momentum::name()].second; const int peng = imap[p::energy::name()].first; const int ceng = imap[c::energy::name()].first; const int prs = imap[p::pressure].first; @@ -815,15 +815,15 @@ TaskStatus FixFluxes(MeshBlockData *rc) { } else if (ix2_bc == "polar") { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( - std::vector({c::density, c::energy::name(), c::momentum, + std::vector({c::density, c::energy::name(), c::momentum::name(), c::bfield::name(), cr::E, cr::F}), - std::vector({c::density, c::energy::name(), c::momentum, + std::vector({c::density, c::energy::name(), c::momentum::name(), c::bfield::name(), cr::E, cr::F}), imap); const auto crho = imap[c::density].first; const auto cener = imap[c::energy::name()].first; auto idx_cb = imap.GetFlatIdx(c::bfield::name(), false); - auto idx_cmom = imap.GetFlatIdx(c::momentum); + auto idx_cmom = imap.GetFlatIdx(c::momentum::name()); auto idx_E = imap.GetFlatIdx(cr::E, false); auto idx_F = imap.GetFlatIdx(cr::F, false); parthenon::par_for( @@ -852,14 +852,14 @@ TaskStatus FixFluxes(MeshBlockData *rc) { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( std::vector( - {c::density, c::energy::name(), c::momentum, cr::E, cr::F}), + {c::density, c::energy::name(), c::momentum::name(), cr::E, cr::F}), std::vector( - {c::density, c::energy::name(), c::momentum, cr::E, cr::F}), + {c::density, c::energy::name(), c::momentum::name(), cr::E, cr::F}), imap); const auto crho = imap[c::density].first; const auto cener = imap[c::energy::name()].first; auto idx_cb = imap.GetFlatIdx(c::bfield::name(), false); - auto idx_cmom = imap.GetFlatIdx(c::momentum); + auto idx_cmom = imap.GetFlatIdx(c::momentum::name()); auto idx_E = imap.GetFlatIdx(cr::E, false); auto idx_F = imap.GetFlatIdx(cr::F, false); parthenon::par_for( @@ -895,15 +895,15 @@ TaskStatus FixFluxes(MeshBlockData *rc) { } else if (ox2_bc == "polar") { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( - std::vector({c::density, c::energy::name(), c::momentum, + std::vector({c::density, c::energy::name(), c::momentum::name(), c::bfield::name(), cr::E, cr::F}), - std::vector({c::density, c::energy::name(), c::momentum, + std::vector({c::density, c::energy::name(), c::momentum::name(), c::bfield::name(), cr::E, cr::F}), imap); const auto crho = imap[c::density].first; const auto cener = imap[c::energy::name()].first; auto idx_cb = imap.GetFlatIdx(c::bfield::name(), false); - auto idx_cmom = imap.GetFlatIdx(c::momentum); + auto idx_cmom = imap.GetFlatIdx(c::momentum::name()); auto idx_E = imap.GetFlatIdx(cr::E, false); auto idx_F = imap.GetFlatIdx(cr::F, false); parthenon::par_for( @@ -932,13 +932,13 @@ TaskStatus FixFluxes(MeshBlockData *rc) { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( std::vector( - {c::density, c::energy::name(), c::momentum, cr::E, cr::F}), + {c::density, c::energy::name(), c::momentum::name(), cr::E, cr::F}), std::vector( - {c::density, c::energy::name(), c::momentum, cr::E, cr::F}), + {c::density, c::energy::name(), c::momentum::name(), cr::E, cr::F}), imap); const auto crho = imap[c::density].first; const auto cener = imap[c::energy::name()].first; - auto idx_cmom = imap.GetFlatIdx(c::momentum); + auto idx_cmom = imap.GetFlatIdx(c::momentum::name()); auto idx_cb = imap.GetFlatIdx(c::bfield::name(), false); auto idx_E = imap.GetFlatIdx(cr::E, false); auto idx_F = imap.GetFlatIdx(cr::F, false); diff --git a/src/fixup/fixup_c2p.cpp b/src/fixup/fixup_c2p.cpp index 8e582d031..e9c87c1b1 100644 --- a/src/fixup/fixup_c2p.cpp +++ b/src/fixup/fixup_c2p.cpp @@ -62,7 +62,7 @@ TaskStatus ConservedToPrimitiveFixupImpl(T *rc) { const std::vector vars({p::density::name(), c::density, p::velocity::name(), - c::momentum, + c::momentum::name(), p::energy::name(), c::energy::name(), p::bfield::name(), @@ -89,8 +89,8 @@ TaskStatus ConservedToPrimitiveFixupImpl(T *rc) { const int crho = imap[c::density].first; const int pvel_lo = imap[p::velocity::name()].first; const int pvel_hi = imap[p::velocity::name()].second; - const int cmom_lo = imap[c::momentum].first; - const int cmom_hi = imap[c::momentum].second; + const int cmom_lo = imap[c::momentum::name()].first; + const int cmom_hi = imap[c::momentum::name()].second; const int peng = imap[p::energy::name()].first; const int ceng = imap[c::energy::name()].first; const int prs = imap[p::pressure].first; diff --git a/src/fixup/fixup_src.cpp b/src/fixup/fixup_src.cpp index 47be522ea..84ae27ee5 100644 --- a/src/fixup/fixup_src.cpp +++ b/src/fixup/fixup_src.cpp @@ -75,7 +75,7 @@ TaskStatus SourceFixupImpl(T *rc) { auto bounds = fix_pkg->Param("bounds"); const std::vector vars( - {p::density::name(), c::density, p::velocity::name(), c::momentum, + {p::density::name(), c::density, p::velocity::name(), c::momentum::name(), 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}); @@ -86,7 +86,7 @@ TaskStatus SourceFixupImpl(T *rc) { const int prho = imap[p::density::name()].first; const int crho = imap[c::density].first; auto idx_pvel = imap.GetFlatIdx(p::velocity::name()); - auto idx_cmom = imap.GetFlatIdx(c::momentum); + auto idx_cmom = imap.GetFlatIdx(c::momentum::name()); const int peng = imap[p::energy::name()].first; const int ceng = imap[c::energy::name()].first; const int prs = imap[p::pressure].first; diff --git a/src/fluid/con2prim.hpp b/src/fluid/con2prim.hpp index 97c51b4b9..922ee2dcd 100644 --- a/src/fluid/con2prim.hpp +++ b/src/fluid/con2prim.hpp @@ -135,8 +135,8 @@ class ConToPrim { crho(imap[fluid_cons::density].first), pvel_lo(imap[fluid_prim::velocity::name()].first), pvel_hi(imap[fluid_prim::velocity::name()].second), - cmom_lo(imap[fluid_cons::momentum].first), - cmom_hi(imap[fluid_cons::momentum].second), + cmom_lo(imap[fluid_cons::momentum::name()].first), + cmom_hi(imap[fluid_cons::momentum::name()].second), peng(imap[fluid_prim::energy::name()].first), ceng(imap[fluid_cons::energy::name()].first), pb_lo(imap[fluid_prim::bfield::name()].first), @@ -155,9 +155,10 @@ class ConToPrim { std::vector Vars() { return std::vector( {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::name(), - fluid_cons::ye::name(), fluid_prim::pressure, fluid_prim::temperature, + fluid_cons::momentum::name(), fluid_prim::energy::name(), + fluid_cons::energy::name(), 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}); } diff --git a/src/fluid/con2prim_robust.hpp b/src/fluid/con2prim_robust.hpp index 4a0dc6d2c..1957ff7a3 100644 --- a/src/fluid/con2prim_robust.hpp +++ b/src/fluid/con2prim_robust.hpp @@ -232,8 +232,8 @@ class ConToPrim { crho(imap[fluid_cons::density].first), pvel_lo(imap[fluid_prim::velocity::name()].first), pvel_hi(imap[fluid_prim::velocity::name()].second), - cmom_lo(imap[fluid_cons::momentum].first), - cmom_hi(imap[fluid_cons::momentum].second), + cmom_lo(imap[fluid_cons::momentum::name()].first), + cmom_hi(imap[fluid_cons::momentum::name()].second), peng(imap[fluid_prim::energy::name()].first), ceng(imap[fluid_cons::energy::name()].first), pb_lo(imap[fluid_prim::bfield::name()].first), @@ -253,9 +253,10 @@ class ConToPrim { std::vector Vars() { return std::vector( {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::name(), - fluid_cons::ye::name(), fluid_prim::pressure, fluid_prim::temperature, + fluid_cons::momentum::name(), fluid_prim::energy::name(), + fluid_cons::energy::name(), 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}); } diff --git a/src/fluid/fluid.cpp b/src/fluid/fluid.cpp index 8ebcf1c68..b8b3b92a4 100644 --- a/src/fluid/fluid.cpp +++ b/src/fluid/fluid.cpp @@ -224,7 +224,7 @@ std::shared_ptr Initialize(ParameterInput *pin) { // add the conserved variables physics->AddField(c::density, mcons_scalar); - physics->AddField(c::momentum, mcons_threev); + physics->AddField(c::momentum::name(), mcons_threev); physics->AddField(c::energy::name(), mcons_scalar); if (mhd) { physics->AddField(c::bfield::name(), mcons_threev); @@ -262,7 +262,7 @@ std::shared_ptr Initialize(ParameterInput *pin) { if (mhd) riemann::FluxState::ReconVars(p::bfield::name()); if (ye) riemann::FluxState::ReconVars(p::ye::name()); - std::vector fvars({c::density, c::momentum, c::energy::name()}); + std::vector fvars({c::density, c::momentum::name(), c::energy::name()}); riemann::FluxState::FluxVars(fvars); if (mhd) riemann::FluxState::FluxVars(c::bfield::name()); if (ye) riemann::FluxState::FluxVars(c::ye::name()); @@ -318,7 +318,8 @@ std::shared_ptr Initialize(ParameterInput *pin) { for (int d = 0; d < 3; ++d) { auto ReduceMom = [d](MeshData *md) { - return History::ReduceOneVar>(md, fluid_cons::momentum, d); + return History::ReduceOneVar>(md, fluid_cons::momentum::name(), + d); }; hst_vars.emplace_back(HistoryOutputVar( HstSum, ReduceMom, "total X" + std::to_string(d + 1) + " momentum")); @@ -351,7 +352,7 @@ TaskStatus PrimitiveToConservedRegion(MeshBlockData *rc, const IndexRange auto *pmb = rc->GetParentPointer(); const std::vector vars( - {p::density::name(), c::density, p::velocity::name(), c::momentum, + {p::density::name(), c::density, p::velocity::name(), c::momentum::name(), 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}); @@ -362,8 +363,8 @@ TaskStatus PrimitiveToConservedRegion(MeshBlockData *rc, const IndexRange const int crho = imap[c::density].first; const int pvel_lo = imap[p::velocity::name()].first; const int pvel_hi = imap[p::velocity::name()].second; - const int cmom_lo = imap[c::momentum].first; - const int cmom_hi = imap[c::momentum].second; + const int cmom_lo = imap[c::momentum::name()].first; + const int cmom_hi = imap[c::momentum::name()].second; const int peng = imap[p::energy::name()].first; const int ceng = imap[c::energy::name()].first; const int prs = imap[p::pressure].first; @@ -554,14 +555,15 @@ TaskStatus CalculateFluidSourceTerms(MeshBlockData *rc, IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); IndexRange kb = rc->GetBoundsK(IndexDomain::interior); - std::vector vars({fluid_cons::momentum, fluid_cons::energy::name()}); + std::vector vars( + {fluid_cons::momentum::name(), fluid_cons::energy::name()}); #if SET_FLUX_SRC_DIAGS vars.push_back(diagnostic_variables::src_terms); #endif PackIndexMap imap; auto src = rc_src->PackVariables(vars, imap); - const int cmom_lo = imap[fluid_cons::momentum].first; - const int cmom_hi = imap[fluid_cons::momentum].second; + const int cmom_lo = imap[fluid_cons::momentum::name()].first; + const int cmom_hi = imap[fluid_cons::momentum::name()].second; const int ceng = imap[fluid_cons::energy::name()].first; const int idiag = imap[diagnostic_variables::src_terms].first; diff --git a/src/fluid/fluid.hpp b/src/fluid/fluid.hpp index 7705609fb..afea200b4 100644 --- a/src/fluid/fluid.hpp +++ b/src/fluid/fluid.hpp @@ -68,14 +68,14 @@ TaskStatus CopyFluxDivergence(T *rc) { if (!params.Get("active")) return TaskStatus::complete; std::vector vars( - {fluid_cons::density, fluid_cons::momentum, fluid_cons::energy::name()}); + {fluid_cons::density, fluid_cons::momentum::name(), fluid_cons::energy::name()}); vars.push_back(radmoment_cons::E); vars.push_back(radmoment_cons::F); PackIndexMap imap; auto divf = rc->PackVariables(vars, imap); const int crho = imap[fluid_cons::density].first; - const int cmom_lo = imap[fluid_cons::momentum].first; - const int cmom_hi = imap[fluid_cons::momentum].second; + const int cmom_lo = imap[fluid_cons::momentum::name()].first; + const int cmom_hi = imap[fluid_cons::momentum::name()].second; const int ceng = imap[fluid_cons::energy::name()].first; auto idx_E = imap.GetFlatIdx(radmoment_cons::E, false); auto idx_F = imap.GetFlatIdx(radmoment_cons::F, false); diff --git a/src/fluid/riemann.hpp b/src/fluid/riemann.hpp index 057c9d348..3361d51d3 100644 --- a/src/fluid/riemann.hpp +++ b/src/fluid/riemann.hpp @@ -225,7 +225,7 @@ class FluxState { 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), + cmom_lo(imap[fluid_cons::momentum::name()].first), ceng(imap[fluid_cons::energy::name()].first), cb_lo(imap[fluid_cons::bfield::name()].first), cb_hi(imap[fluid_cons::bfield::name()].second), diff --git a/src/monopole_gr/interp_3d_to_1d.hpp b/src/monopole_gr/interp_3d_to_1d.hpp index 72f942bfd..36ab47505 100644 --- a/src/monopole_gr/interp_3d_to_1d.hpp +++ b/src/monopole_gr/interp_3d_to_1d.hpp @@ -104,7 +104,7 @@ TaskStatus InterpolateMatterTo1D(Data *rc) { // but I may want these quantities in a future // iteration, so I ask for them here. std::vector vars( - {fluid_cons::density, fluid_cons::energy::name(), fluid_cons::momentum}); + {fluid_cons::density, fluid_cons::energy::name(), fluid_cons::momentum::name()}); // PackIndexMap imap; auto pack = rc->PackVariables(vars); diff --git a/src/phoebus_driver.cpp b/src/phoebus_driver.cpp index 4933fee34..0bf4cf6e3 100644 --- a/src/phoebus_driver.cpp +++ b/src/phoebus_driver.cpp @@ -198,7 +198,7 @@ TaskCollection PhoebusDriver::RungeKuttaStage(const int stage) { std::vector src_names; std::vector src_w_diag; if (fluid_active) { - src_names.push_back(fluid_cons::momentum); + src_names.push_back(fluid_cons::momentum::name()); src_names.push_back(fluid_cons::energy::name()); } if (rad_moments_active) { diff --git a/src/phoebus_utils/variables.hpp b/src/phoebus_utils/variables.hpp index 98f18ff39..dcb4640af 100644 --- a/src/phoebus_utils/variables.hpp +++ b/src/phoebus_utils/variables.hpp @@ -45,7 +45,7 @@ constexpr char gamma1[] = "gamma1"; namespace fluid_cons { constexpr char density[] = "c.density"; -constexpr char momentum[] = "c.momentum"; +VARIABLE(c, momentum); VARIABLE(c, energy); VARIABLE(c, bfield); VARIABLE(c, ye); diff --git a/src/radiation/mocmc.cpp b/src/radiation/mocmc.cpp index 7a62f0c01..c4c941e10 100644 --- a/src/radiation/mocmc.cpp +++ b/src/radiation/mocmc.cpp @@ -538,7 +538,7 @@ TaskStatus MOCMCFluidSource(T *rc, const Real dt, const bool update_fluid) { im::jinvs}; if (update_fluid) { variables.push_back(cf::energy::name()); - variables.push_back(cf::momentum); + variables.push_back(cf::momentum::name()); variables.push_back(cf::ye::name()); } PackIndexMap imap; @@ -561,7 +561,7 @@ TaskStatus MOCMCFluidSource(T *rc, const Real dt, const bool update_fluid) { int ceng(-1), cmom_lo(-1), cye(-1); if (update_fluid) { ceng = imap[cf::energy::name()].first; - cmom_lo = imap[cf::momentum].first; + cmom_lo = imap[cf::momentum::name()].first; cye = imap[cf::ye::name()].first; } diff --git a/src/radiation/moments_source.cpp b/src/radiation/moments_source.cpp index 7e0c637db..e56fb101b 100644 --- a/src/radiation/moments_source.cpp +++ b/src/radiation/moments_source.cpp @@ -218,7 +218,7 @@ TaskStatus MomentFluidSourceImpl(T *rc, Real dt, bool update_fluid) { namespace p = fluid_prim; std::vector vars{c::density, c::energy::name(), - c::momentum, + c::momentum::name(), c::ye::name(), cr::E, cr::F, @@ -262,8 +262,8 @@ TaskStatus MomentFluidSourceImpl(T *rc, Real dt, bool update_fluid) { int crho = imap[c::density].first; int ceng = imap[c::energy::name()].first; - int cmom_lo = imap[c::momentum].first; - int cmom_hi = imap[c::momentum].second; + int cmom_lo = imap[c::momentum::name()].first; + int cmom_hi = imap[c::momentum::name()].second; int cye = imap[c::ye::name()].first; IndexRange ib = rc->GetBoundsI(IndexDomain::interior); diff --git a/src/radiation/radiation.cpp b/src/radiation/radiation.cpp index 3dc6e7265..57356fdf4 100644 --- a/src/radiation/radiation.cpp +++ b/src/radiation/radiation.cpp @@ -544,14 +544,14 @@ TaskStatus ApplyRadiationFourForce(MeshBlockData *rc, const double dt) { namespace c = fluid_cons; namespace iv = internal_variables; - std::vector vars( - {c::density, c::energy::name(), c::momentum, c::ye::name(), iv::Gcov, iv::Gye}); + std::vector vars({c::density, c::energy::name(), c::momentum::name(), + c::ye::name(), iv::Gcov, iv::Gye}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); const int crho = imap[c::density].first; const int ceng = imap[c::energy::name()].first; - const int cmom_lo = imap[c::momentum].first; - const int cmom_hi = imap[c::momentum].second; + const int cmom_lo = imap[c::momentum::name()].first; + const int cmom_hi = imap[c::momentum::name()].second; const int cye = imap[c::ye::name()].first; const int Gcov_lo = imap[iv::Gcov].first; const int Gcov_hi = imap[iv::Gcov].second; From a5b18125696603be9edbdf6c242d0ccc89021b1a Mon Sep 17 00:00:00 2001 From: Jonah Maxwell Miller Date: Wed, 6 Dec 2023 13:42:11 -0700 Subject: [PATCH 12/14] conserved density to variable types --- src/fixup/fixup.cpp | 106 +++++++++++++++------------- src/fixup/fixup_c2p.cpp | 4 +- src/fixup/fixup_src.cpp | 4 +- src/fluid/con2prim.hpp | 12 ++-- src/fluid/con2prim_robust.hpp | 12 ++-- src/fluid/fluid.cpp | 11 +-- src/fluid/fluid.hpp | 7 +- src/fluid/riemann.hpp | 3 +- src/monopole_gr/interp_3d_to_1d.hpp | 4 +- src/phoebus_utils/variables.hpp | 2 +- src/radiation/cooling_function.cpp | 10 +-- src/radiation/moments_source.cpp | 4 +- src/radiation/radiation.cpp | 6 +- 13 files changed, 99 insertions(+), 86 deletions(-) diff --git a/src/fixup/fixup.cpp b/src/fixup/fixup.cpp index fd40e68d2..d1c641cc3 100644 --- a/src/fixup/fixup.cpp +++ b/src/fixup/fixup.cpp @@ -307,7 +307,7 @@ TaskStatus ApplyFloorsImpl(T *rc, IndexDomain domain = IndexDomain::entire) { if (!enable_floors) return TaskStatus::complete; const std::vector vars( - {p::density::name(), c::density, p::velocity::name(), c::momentum::name(), + {p::density::name(), c::density::name(), p::velocity::name(), c::momentum::name(), 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}); @@ -316,7 +316,7 @@ TaskStatus ApplyFloorsImpl(T *rc, IndexDomain domain = IndexDomain::entire) { auto v = rc->PackVariables(vars, imap); const int prho = imap[p::density::name()].first; - const int crho = imap[c::density].first; + const int crho = imap[c::density::name()].first; const int pvel_lo = imap[p::velocity::name()].first; const int pvel_hi = imap[p::velocity::name()].second; const int cmom_lo = imap[c::momentum::name()].first; @@ -737,9 +737,10 @@ TaskStatus FixFluxes(MeshBlockData *rc) { if (pmb->boundary_flag[BoundaryFace::inner_x1] == BoundaryFlag::user) { if (ix1_bc == "outflow") { PackIndexMap imap; - auto v = rc->PackVariablesAndFluxes(std::vector({c::density}), - std::vector({c::density}), imap); - const auto crho = imap[c::density].first; + auto v = rc->PackVariablesAndFluxes(std::vector({c::density::name()}), + std::vector({c::density::name()}), + imap); + const auto crho = imap[c::density::name()].first; parthenon::par_for( DEFAULT_LOOP_PATTERN, "FixFluxes::x1", DevExecSpace(), kb.s, kb.e, jb.s, jb.e, ib.s, ib.s, KOKKOS_LAMBDA(const int k, const int j, const int i) { @@ -748,9 +749,9 @@ TaskStatus FixFluxes(MeshBlockData *rc) { } else if (ix1_bc == "reflect") { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( - std::vector({c::density, c::energy::name(), cr::E}), - std::vector({c::density, c::energy::name(), cr::E}), imap); - const auto crho = imap[c::density].first; + std::vector({c::density::name(), c::energy::name(), cr::E}), + std::vector({c::density::name(), c::energy::name(), cr::E}), imap); + const auto crho = imap[c::density::name()].first; const auto cener = imap[c::energy::name()].first; auto idx_E = imap.GetFlatIdx(cr::E, false); parthenon::par_for( @@ -769,9 +770,10 @@ TaskStatus FixFluxes(MeshBlockData *rc) { if (pmb->boundary_flag[BoundaryFace::outer_x1] == BoundaryFlag::user) { if (ox1_bc == "outflow") { PackIndexMap imap; - auto v = rc->PackVariablesAndFluxes(std::vector({c::density}), - std::vector({c::density}), imap); - const auto crho = imap[c::density].first; + auto v = rc->PackVariablesAndFluxes(std::vector({c::density::name()}), + std::vector({c::density::name()}), + imap); + const auto crho = imap[c::density::name()].first; parthenon::par_for( DEFAULT_LOOP_PATTERN, "FixFluxes::x1", DevExecSpace(), kb.s, kb.e, jb.s, jb.e, ib.e + 1, ib.e + 1, KOKKOS_LAMBDA(const int k, const int j, const int i) { @@ -780,9 +782,9 @@ TaskStatus FixFluxes(MeshBlockData *rc) { } else if (ox1_bc == "reflect") { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( - std::vector({c::density, c::energy::name(), cr::E}), - std::vector({c::density, c::energy::name(), cr::E}), imap); - const auto crho = imap[c::density].first; + std::vector({c::density::name(), c::energy::name(), cr::E}), + std::vector({c::density::name(), c::energy::name(), cr::E}), imap); + const auto crho = imap[c::density::name()].first; const auto cener = imap[c::energy::name()].first; auto idx_E = imap.GetFlatIdx(cr::E, false); parthenon::par_for( @@ -804,9 +806,10 @@ TaskStatus FixFluxes(MeshBlockData *rc) { if (pmb->boundary_flag[BoundaryFace::inner_x2] == BoundaryFlag::user) { if (ix2_bc == "outflow") { PackIndexMap imap; - auto v = rc->PackVariablesAndFluxes(std::vector({c::density}), - std::vector({c::density}), imap); - const auto crho = imap[c::density].first; + auto v = rc->PackVariablesAndFluxes(std::vector({c::density::name()}), + std::vector({c::density::name()}), + imap); + const auto crho = imap[c::density::name()].first; parthenon::par_for( DEFAULT_LOOP_PATTERN, "FixFluxes::x2", DevExecSpace(), kb.s, kb.e, jb.s, jb.s, ib.s, ib.e, KOKKOS_LAMBDA(const int k, const int j, const int i) { @@ -815,12 +818,14 @@ TaskStatus FixFluxes(MeshBlockData *rc) { } else if (ix2_bc == "polar") { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( - std::vector({c::density, c::energy::name(), c::momentum::name(), - c::bfield::name(), cr::E, cr::F}), - std::vector({c::density, c::energy::name(), c::momentum::name(), - c::bfield::name(), cr::E, cr::F}), + std::vector({c::density::name(), c::energy::name(), + c::momentum::name(), c::bfield::name(), cr::E, + cr::F}), + std::vector({c::density::name(), c::energy::name(), + c::momentum::name(), c::bfield::name(), cr::E, + cr::F}), imap); - const auto crho = imap[c::density].first; + const auto crho = imap[c::density::name()].first; const auto cener = imap[c::energy::name()].first; auto idx_cb = imap.GetFlatIdx(c::bfield::name(), false); auto idx_cmom = imap.GetFlatIdx(c::momentum::name()); @@ -852,11 +857,11 @@ TaskStatus FixFluxes(MeshBlockData *rc) { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( std::vector( - {c::density, c::energy::name(), c::momentum::name(), cr::E, cr::F}), + {c::density::name(), c::energy::name(), c::momentum::name(), cr::E, cr::F}), std::vector( - {c::density, c::energy::name(), c::momentum::name(), cr::E, cr::F}), + {c::density::name(), c::energy::name(), c::momentum::name(), cr::E, cr::F}), imap); - const auto crho = imap[c::density].first; + const auto crho = imap[c::density::name()].first; const auto cener = imap[c::energy::name()].first; auto idx_cb = imap.GetFlatIdx(c::bfield::name(), false); auto idx_cmom = imap.GetFlatIdx(c::momentum::name()); @@ -883,9 +888,10 @@ TaskStatus FixFluxes(MeshBlockData *rc) { if (pmb->boundary_flag[BoundaryFace::outer_x2] == BoundaryFlag::user) { if (ox2_bc == "outflow") { PackIndexMap imap; - auto v = rc->PackVariablesAndFluxes(std::vector({c::density}), - std::vector({c::density}), imap); - const auto crho = imap[c::density].first; + auto v = rc->PackVariablesAndFluxes(std::vector({c::density::name()}), + std::vector({c::density::name()}), + imap); + const auto crho = imap[c::density::name()].first; parthenon::par_for( DEFAULT_LOOP_PATTERN, "FixFluxes::x2", DevExecSpace(), kb.s, kb.e, jb.e + 1, @@ -895,12 +901,14 @@ TaskStatus FixFluxes(MeshBlockData *rc) { } else if (ox2_bc == "polar") { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( - std::vector({c::density, c::energy::name(), c::momentum::name(), - c::bfield::name(), cr::E, cr::F}), - std::vector({c::density, c::energy::name(), c::momentum::name(), - c::bfield::name(), cr::E, cr::F}), + std::vector({c::density::name(), c::energy::name(), + c::momentum::name(), c::bfield::name(), cr::E, + cr::F}), + std::vector({c::density::name(), c::energy::name(), + c::momentum::name(), c::bfield::name(), cr::E, + cr::F}), imap); - const auto crho = imap[c::density].first; + const auto crho = imap[c::density::name()].first; const auto cener = imap[c::energy::name()].first; auto idx_cb = imap.GetFlatIdx(c::bfield::name(), false); auto idx_cmom = imap.GetFlatIdx(c::momentum::name()); @@ -932,11 +940,11 @@ TaskStatus FixFluxes(MeshBlockData *rc) { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( std::vector( - {c::density, c::energy::name(), c::momentum::name(), cr::E, cr::F}), + {c::density::name(), c::energy::name(), c::momentum::name(), cr::E, cr::F}), std::vector( - {c::density, c::energy::name(), c::momentum::name(), cr::E, cr::F}), + {c::density::name(), c::energy::name(), c::momentum::name(), cr::E, cr::F}), imap); - const auto crho = imap[c::density].first; + const auto crho = imap[c::density::name()].first; const auto cener = imap[c::energy::name()].first; auto idx_cmom = imap.GetFlatIdx(c::momentum::name()); auto idx_cb = imap.GetFlatIdx(c::bfield::name(), false); @@ -966,9 +974,10 @@ TaskStatus FixFluxes(MeshBlockData *rc) { // x3-direction if (pmb->boundary_flag[BoundaryFace::inner_x3] == BoundaryFlag::outflow) { PackIndexMap imap; - auto v = rc->PackVariablesAndFluxes(std::vector({c::density}), - std::vector({c::density}), imap); - const auto crho = imap[c::density].first; + auto v = + rc->PackVariablesAndFluxes(std::vector({c::density::name()}), + std::vector({c::density::name()}), imap); + const auto crho = imap[c::density::name()].first; parthenon::par_for( DEFAULT_LOOP_PATTERN, "FixFluxes::x3", DevExecSpace(), kb.s, kb.s, jb.s, jb.e, ib.s, ib.e, KOKKOS_LAMBDA(const int k, const int j, const int i) { @@ -977,9 +986,9 @@ TaskStatus FixFluxes(MeshBlockData *rc) { } else if (pmb->boundary_flag[BoundaryFace::inner_x3] == BoundaryFlag::reflect) { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( - std::vector({c::density, c::energy::name(), cr::E}), - std::vector({c::density, c::energy::name(), cr::E}), imap); - const auto crho = imap[c::density].first; + std::vector({c::density::name(), c::energy::name(), cr::E}), + std::vector({c::density::name(), c::energy::name(), cr::E}), imap); + const auto crho = imap[c::density::name()].first; const auto cener = imap[c::energy::name()].first; auto idx_E = imap.GetFlatIdx(cr::E, false); parthenon::par_for( @@ -996,9 +1005,10 @@ TaskStatus FixFluxes(MeshBlockData *rc) { } if (pmb->boundary_flag[BoundaryFace::outer_x3] == BoundaryFlag::outflow) { PackIndexMap imap; - auto v = rc->PackVariablesAndFluxes(std::vector({c::density}), - std::vector({c::density}), imap); - const auto crho = imap[c::density].first; + auto v = + rc->PackVariablesAndFluxes(std::vector({c::density::name()}), + std::vector({c::density::name()}), imap); + const auto crho = imap[c::density::name()].first; parthenon::par_for( DEFAULT_LOOP_PATTERN, "FixFluxes::x3", DevExecSpace(), kb.e + 1, kb.e + 1, jb.s, jb.e, ib.s, ib.e, KOKKOS_LAMBDA(const int k, const int j, const int i) { @@ -1007,9 +1017,9 @@ TaskStatus FixFluxes(MeshBlockData *rc) { } else if (pmb->boundary_flag[BoundaryFace::outer_x3] == BoundaryFlag::reflect) { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( - std::vector({c::density, c::energy::name(), cr::E}), - std::vector({c::density, c::energy::name(), cr::E}), imap); - const auto crho = imap[c::density].first; + std::vector({c::density::name(), c::energy::name(), cr::E}), + std::vector({c::density::name(), c::energy::name(), cr::E}), imap); + const auto crho = imap[c::density::name()].first; const auto cener = imap[c::energy::name()].first; auto idx_E = imap.GetFlatIdx(cr::E, false); parthenon::par_for( diff --git a/src/fixup/fixup_c2p.cpp b/src/fixup/fixup_c2p.cpp index e9c87c1b1..e39ca21fc 100644 --- a/src/fixup/fixup_c2p.cpp +++ b/src/fixup/fixup_c2p.cpp @@ -60,7 +60,7 @@ TaskStatus ConservedToPrimitiveFixupImpl(T *rc) { StateDescriptor *eos_pkg = pmesh->packages.Get("eos").get(); const std::vector vars({p::density::name(), - c::density, + c::density::name(), p::velocity::name(), c::momentum::name(), p::energy::name(), @@ -86,7 +86,7 @@ TaskStatus ConservedToPrimitiveFixupImpl(T *rc) { auto v = rc->PackVariables(vars, imap); const int prho = imap[p::density::name()].first; - const int crho = imap[c::density].first; + const int crho = imap[c::density::name()].first; const int pvel_lo = imap[p::velocity::name()].first; const int pvel_hi = imap[p::velocity::name()].second; const int cmom_lo = imap[c::momentum::name()].first; diff --git a/src/fixup/fixup_src.cpp b/src/fixup/fixup_src.cpp index 84ae27ee5..d09a0aa05 100644 --- a/src/fixup/fixup_src.cpp +++ b/src/fixup/fixup_src.cpp @@ -75,7 +75,7 @@ TaskStatus SourceFixupImpl(T *rc) { auto bounds = fix_pkg->Param("bounds"); const std::vector vars( - {p::density::name(), c::density, p::velocity::name(), c::momentum::name(), + {p::density::name(), c::density::name(), p::velocity::name(), c::momentum::name(), 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}); @@ -84,7 +84,7 @@ TaskStatus SourceFixupImpl(T *rc) { auto v = rc->PackVariables(vars, imap); const int prho = imap[p::density::name()].first; - const int crho = imap[c::density].first; + const int crho = imap[c::density::name()].first; auto idx_pvel = imap.GetFlatIdx(p::velocity::name()); auto idx_cmom = imap.GetFlatIdx(c::momentum::name()); const int peng = imap[p::energy::name()].first; diff --git a/src/fluid/con2prim.hpp b/src/fluid/con2prim.hpp index 922ee2dcd..c4acbff19 100644 --- a/src/fluid/con2prim.hpp +++ b/src/fluid/con2prim.hpp @@ -132,7 +132,7 @@ class ConToPrim { ConToPrim(Data_t *rc, PackIndexMap imap, const Real tol, const int max_iterations) : var(rc->PackVariables(Vars(), imap)), prho(imap[fluid_prim::density::name()].first), - crho(imap[fluid_cons::density].first), + crho(imap[fluid_cons::density::name()].first), pvel_lo(imap[fluid_prim::velocity::name()].first), pvel_hi(imap[fluid_prim::velocity::name()].second), cmom_lo(imap[fluid_cons::momentum::name()].first), @@ -154,11 +154,11 @@ class ConToPrim { std::vector Vars() { return std::vector( - {fluid_prim::density::name(), fluid_cons::density, fluid_prim::velocity::name(), - fluid_cons::momentum::name(), fluid_prim::energy::name(), - fluid_cons::energy::name(), fluid_prim::bfield::name(), - fluid_cons::bfield::name(), fluid_prim::ye::name(), fluid_cons::ye::name(), - fluid_prim::pressure, fluid_prim::temperature, + {fluid_prim::density::name(), fluid_cons::density::name(), + fluid_prim::velocity::name(), fluid_cons::momentum::name(), + fluid_prim::energy::name(), fluid_cons::energy::name(), + 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}); } diff --git a/src/fluid/con2prim_robust.hpp b/src/fluid/con2prim_robust.hpp index 1957ff7a3..12cb0b188 100644 --- a/src/fluid/con2prim_robust.hpp +++ b/src/fluid/con2prim_robust.hpp @@ -229,7 +229,7 @@ class ConToPrim { const bool fail_on_ceilings) : bounds(bnds), var(rc->PackVariables(Vars(), imap)), prho(imap[fluid_prim::density::name()].first), - crho(imap[fluid_cons::density].first), + crho(imap[fluid_cons::density::name()].first), pvel_lo(imap[fluid_prim::velocity::name()].first), pvel_hi(imap[fluid_prim::velocity::name()].second), cmom_lo(imap[fluid_cons::momentum::name()].first), @@ -252,11 +252,11 @@ class ConToPrim { std::vector Vars() { return std::vector( - {fluid_prim::density::name(), fluid_cons::density, fluid_prim::velocity::name(), - fluid_cons::momentum::name(), fluid_prim::energy::name(), - fluid_cons::energy::name(), fluid_prim::bfield::name(), - fluid_cons::bfield::name(), fluid_prim::ye::name(), fluid_cons::ye::name(), - fluid_prim::pressure, fluid_prim::temperature, + {fluid_prim::density::name(), fluid_cons::density::name(), + fluid_prim::velocity::name(), fluid_cons::momentum::name(), + fluid_prim::energy::name(), fluid_cons::energy::name(), + 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}); } diff --git a/src/fluid/fluid.cpp b/src/fluid/fluid.cpp index b8b3b92a4..2aa84e2f9 100644 --- a/src/fluid/fluid.cpp +++ b/src/fluid/fluid.cpp @@ -223,7 +223,7 @@ std::shared_ptr Initialize(ParameterInput *pin) { physics->AddField(impl::fail, mprim_scalar); // add the conserved variables - physics->AddField(c::density, mcons_scalar); + physics->AddField(c::density::name(), mcons_scalar); physics->AddField(c::momentum::name(), mcons_threev); physics->AddField(c::energy::name(), mcons_scalar); if (mhd) { @@ -262,7 +262,8 @@ std::shared_ptr Initialize(ParameterInput *pin) { if (mhd) riemann::FluxState::ReconVars(p::bfield::name()); if (ye) riemann::FluxState::ReconVars(p::ye::name()); - std::vector fvars({c::density, c::momentum::name(), c::energy::name()}); + std::vector fvars( + {c::density::name(), c::momentum::name(), c::energy::name()}); riemann::FluxState::FluxVars(fvars); if (mhd) riemann::FluxState::FluxVars(c::bfield::name()); if (ye) riemann::FluxState::FluxVars(c::ye::name()); @@ -308,7 +309,7 @@ std::shared_ptr Initialize(ParameterInput *pin) { parthenon::HstVar_list hst_vars = {}; auto ReduceMass = [](MeshData *md) { - return ReduceOneVar>(md, fluid_cons::density, 0); + return ReduceOneVar>(md, fluid_cons::density::name(), 0); }; auto ReduceEn = [](MeshData *md) { return ReduceOneVar>(md, fluid_cons::energy::name(), 0); @@ -352,7 +353,7 @@ TaskStatus PrimitiveToConservedRegion(MeshBlockData *rc, const IndexRange auto *pmb = rc->GetParentPointer(); const std::vector vars( - {p::density::name(), c::density, p::velocity::name(), c::momentum::name(), + {p::density::name(), c::density::name(), p::velocity::name(), c::momentum::name(), 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}); @@ -360,7 +361,7 @@ TaskStatus PrimitiveToConservedRegion(MeshBlockData *rc, const IndexRange auto v = rc->PackVariables(vars, imap); const int prho = imap[p::density::name()].first; - const int crho = imap[c::density].first; + const int crho = imap[c::density::name()].first; const int pvel_lo = imap[p::velocity::name()].first; const int pvel_hi = imap[p::velocity::name()].second; const int cmom_lo = imap[c::momentum::name()].first; diff --git a/src/fluid/fluid.hpp b/src/fluid/fluid.hpp index afea200b4..b51911bed 100644 --- a/src/fluid/fluid.hpp +++ b/src/fluid/fluid.hpp @@ -67,13 +67,14 @@ TaskStatus CopyFluxDivergence(T *rc) { const Params ¶ms = fluid->AllParams(); if (!params.Get("active")) return TaskStatus::complete; - std::vector vars( - {fluid_cons::density, fluid_cons::momentum::name(), fluid_cons::energy::name()}); + std::vector vars({fluid_cons::density::name(), + fluid_cons::momentum::name(), + fluid_cons::energy::name()}); vars.push_back(radmoment_cons::E); vars.push_back(radmoment_cons::F); PackIndexMap imap; auto divf = rc->PackVariables(vars, imap); - const int crho = imap[fluid_cons::density].first; + const int crho = imap[fluid_cons::density::name()].first; const int cmom_lo = imap[fluid_cons::momentum::name()].first; const int cmom_hi = imap[fluid_cons::momentum::name()].second; const int ceng = imap[fluid_cons::energy::name()].first; diff --git a/src/fluid/riemann.hpp b/src/fluid/riemann.hpp index 3361d51d3..f6632d4ef 100644 --- a/src/fluid/riemann.hpp +++ b/src/fluid/riemann.hpp @@ -224,7 +224,8 @@ class FluxState { pb_lo(imap[fluid_prim::bfield::name()].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), + gm1(imap[fluid_prim::gamma1].first), + crho(imap[fluid_cons::density::name()].first), cmom_lo(imap[fluid_cons::momentum::name()].first), ceng(imap[fluid_cons::energy::name()].first), cb_lo(imap[fluid_cons::bfield::name()].first), diff --git a/src/monopole_gr/interp_3d_to_1d.hpp b/src/monopole_gr/interp_3d_to_1d.hpp index 36ab47505..38e87653b 100644 --- a/src/monopole_gr/interp_3d_to_1d.hpp +++ b/src/monopole_gr/interp_3d_to_1d.hpp @@ -103,8 +103,8 @@ TaskStatus InterpolateMatterTo1D(Data *rc) { // I just need the pack for the coords object, // but I may want these quantities in a future // iteration, so I ask for them here. - std::vector vars( - {fluid_cons::density, fluid_cons::energy::name(), fluid_cons::momentum::name()}); + std::vector vars({fluid_cons::density::name(), fluid_cons::energy::name(), + fluid_cons::momentum::name()}); // PackIndexMap imap; auto pack = rc->PackVariables(vars); diff --git a/src/phoebus_utils/variables.hpp b/src/phoebus_utils/variables.hpp index dcb4640af..64fb7d888 100644 --- a/src/phoebus_utils/variables.hpp +++ b/src/phoebus_utils/variables.hpp @@ -44,7 +44,7 @@ constexpr char gamma1[] = "gamma1"; } // namespace fluid_prim namespace fluid_cons { -constexpr char density[] = "c.density"; +VARIABLE(c, density); VARIABLE(c, momentum); VARIABLE(c, energy); VARIABLE(c, bfield); diff --git a/src/radiation/cooling_function.cpp b/src/radiation/cooling_function.cpp index 57ad9a635..555e09c1f 100644 --- a/src/radiation/cooling_function.cpp +++ b/src/radiation/cooling_function.cpp @@ -113,14 +113,14 @@ TaskStatus CoolingFunctionCalculateFourForce(MeshBlockData *rc, const doub namespace iv = internal_variables; auto *pmb = rc->GetParentPointer(); - std::vector vars({c::density, p::density::name(), p::velocity::name(), - p::temperature, p::ye::name(), c::energy::name(), - iv::Gcov, iv::GcovHeat, iv::GcovCool, iv::Gye, iv::tau, - p::energy::name()}); + std::vector vars({c::density::name(), p::density::name(), + p::velocity::name(), p::temperature, p::ye::name(), + c::energy::name(), iv::Gcov, iv::GcovHeat, iv::GcovCool, + iv::Gye, iv::tau, p::energy::name()}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); - const int crho = imap[c::density].first; + const int crho = imap[c::density::name()].first; const int prho = imap[p::density::name()].first; const int pvlo = imap[p::velocity::name()].first; const int pvhi = imap[p::velocity::name()].second; diff --git a/src/radiation/moments_source.cpp b/src/radiation/moments_source.cpp index e56fb101b..e5148448d 100644 --- a/src/radiation/moments_source.cpp +++ b/src/radiation/moments_source.cpp @@ -216,7 +216,7 @@ TaskStatus MomentFluidSourceImpl(T *rc, Real dt, bool update_fluid) { namespace ir = radmoment_internal; namespace c = fluid_cons; namespace p = fluid_prim; - std::vector vars{c::density, + std::vector vars{c::density::name(), c::energy::name(), c::momentum::name(), c::ye::name(), @@ -260,7 +260,7 @@ TaskStatus MomentFluidSourceImpl(T *rc, Real dt, bool update_fluid) { int pb_lo = imap[p::bfield::name()].first; int cb_lo = imap[c::bfield::name()].first; - int crho = imap[c::density].first; + int crho = imap[c::density::name()].first; int ceng = imap[c::energy::name()].first; int cmom_lo = imap[c::momentum::name()].first; int cmom_hi = imap[c::momentum::name()].second; diff --git a/src/radiation/radiation.cpp b/src/radiation/radiation.cpp index 57356fdf4..7dfd3a524 100644 --- a/src/radiation/radiation.cpp +++ b/src/radiation/radiation.cpp @@ -544,11 +544,11 @@ TaskStatus ApplyRadiationFourForce(MeshBlockData *rc, const double dt) { namespace c = fluid_cons; namespace iv = internal_variables; - std::vector vars({c::density, c::energy::name(), c::momentum::name(), - c::ye::name(), iv::Gcov, iv::Gye}); + std::vector vars({c::density::name(), c::energy::name(), + c::momentum::name(), c::ye::name(), iv::Gcov, iv::Gye}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); - const int crho = imap[c::density].first; + const int crho = imap[c::density::name()].first; const int ceng = imap[c::energy::name()].first; const int cmom_lo = imap[c::momentum::name()].first; const int cmom_hi = imap[c::momentum::name()].second; From dfd337862dbfc6070df7bd66047cbe6792b96009 Mon Sep 17 00:00:00 2001 From: Jonah Maxwell Miller Date: Wed, 6 Dec 2023 13:51:26 -0700 Subject: [PATCH 13/14] pressure and temperature to variable types --- src/fixup/fixup.cpp | 8 ++++---- src/fixup/fixup_c2p.cpp | 8 ++++---- src/fixup/fixup_src.cpp | 8 ++++---- src/fluid/con2prim.hpp | 11 ++++++----- src/fluid/con2prim_robust.hpp | 11 ++++++----- src/fluid/fluid.cpp | 11 ++++++----- src/fluid/riemann.hpp | 3 ++- src/fluid/tmunu.hpp | 4 ++-- src/microphysics/eos_phoebus/eos_phoebus.cpp | 2 +- src/pgen/advection.cpp | 8 ++++---- src/pgen/blandford_mckee.cpp | 8 ++++---- src/pgen/bondi.cpp | 8 ++++---- src/pgen/friedmann.cpp | 8 ++++---- src/pgen/homogeneous_sphere.cpp | 10 +++++----- src/pgen/kh.cpp | 8 ++++---- src/pgen/leptoneq.cpp | 7 ++++--- src/pgen/linear_modes.cpp | 13 +++++++------ src/pgen/p2c2p.cpp | 8 ++++---- src/pgen/progenitor.cpp | 8 ++++---- src/pgen/radiation_advection.cpp | 15 ++++++++------- src/pgen/radiation_equilibration.cpp | 10 +++++----- src/pgen/rhs_tester.cpp | 8 ++++---- src/pgen/rotor.cpp | 8 ++++---- src/pgen/sedov.cpp | 8 ++++---- src/pgen/shock_tube.cpp | 8 ++++---- src/pgen/thin_cooling.cpp | 7 ++++--- src/pgen/torus.cpp | 12 ++++++------ src/pgen/tov.cpp | 8 ++++---- src/phoebus_utils/variables.hpp | 4 ++-- src/radiation/cooling_function.cpp | 8 ++++---- src/radiation/mocmc.cpp | 16 ++++++++++------ src/radiation/moments.cpp | 12 ++++++++---- src/radiation/moments_source.cpp | 8 ++++---- src/radiation/monte_carlo.cpp | 17 +++++++++-------- src/tov/tov.cpp | 2 +- 35 files changed, 160 insertions(+), 143 deletions(-) diff --git a/src/fixup/fixup.cpp b/src/fixup/fixup.cpp index d1c641cc3..1dc5c3c76 100644 --- a/src/fixup/fixup.cpp +++ b/src/fixup/fixup.cpp @@ -309,8 +309,8 @@ TaskStatus ApplyFloorsImpl(T *rc, IndexDomain domain = IndexDomain::entire) { const std::vector vars( {p::density::name(), c::density::name(), p::velocity::name(), c::momentum::name(), 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}); + c::ye::name(), p::pressure::name(), p::temperature::name(), 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); @@ -323,8 +323,8 @@ TaskStatus ApplyFloorsImpl(T *rc, IndexDomain domain = IndexDomain::entire) { const int cmom_hi = imap[c::momentum::name()].second; const int peng = imap[p::energy::name()].first; const int ceng = imap[c::energy::name()].first; - const int prs = imap[p::pressure].first; - const int tmp = imap[p::temperature].first; + const int prs = imap[p::pressure::name()].first; + const int tmp = imap[p::temperature::name()].first; 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; diff --git a/src/fixup/fixup_c2p.cpp b/src/fixup/fixup_c2p.cpp index e39ca21fc..795dd7475 100644 --- a/src/fixup/fixup_c2p.cpp +++ b/src/fixup/fixup_c2p.cpp @@ -68,8 +68,8 @@ TaskStatus ConservedToPrimitiveFixupImpl(T *rc) { p::bfield::name(), p::ye::name(), c::ye::name(), - p::pressure, - p::temperature, + p::pressure::name(), + p::temperature::name(), p::gamma1, impl::cell_signal_speed, impl::fail, @@ -93,8 +93,8 @@ TaskStatus ConservedToPrimitiveFixupImpl(T *rc) { const int cmom_hi = imap[c::momentum::name()].second; const int peng = imap[p::energy::name()].first; const int ceng = imap[c::energy::name()].first; - const int prs = imap[p::pressure].first; - const int tmp = imap[p::temperature].first; + const int prs = imap[p::pressure::name()].first; + const int tmp = imap[p::temperature::name()].first; 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; diff --git a/src/fixup/fixup_src.cpp b/src/fixup/fixup_src.cpp index d09a0aa05..cd70e21f2 100644 --- a/src/fixup/fixup_src.cpp +++ b/src/fixup/fixup_src.cpp @@ -77,8 +77,8 @@ TaskStatus SourceFixupImpl(T *rc) { const std::vector vars( {p::density::name(), c::density::name(), p::velocity::name(), c::momentum::name(), 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}); + c::ye::name(), p::pressure::name(), p::temperature::name(), 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); @@ -89,8 +89,8 @@ TaskStatus SourceFixupImpl(T *rc) { auto idx_cmom = imap.GetFlatIdx(c::momentum::name()); const int peng = imap[p::energy::name()].first; const int ceng = imap[c::energy::name()].first; - const int prs = imap[p::pressure].first; - const int tmp = imap[p::temperature].first; + const int prs = imap[p::pressure::name()].first; + const int tmp = imap[p::temperature::name()].first; 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; diff --git a/src/fluid/con2prim.hpp b/src/fluid/con2prim.hpp index c4acbff19..605c90e3f 100644 --- a/src/fluid/con2prim.hpp +++ b/src/fluid/con2prim.hpp @@ -144,8 +144,9 @@ class ConToPrim { cb_lo(imap[fluid_cons::bfield::name()].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), + cye(imap[fluid_cons::ye::name()].second), + prs(imap[fluid_prim::pressure::name()].first), + tmp(imap[fluid_prim::temperature::name()].first), sig_lo(imap[internal_variables::cell_signal_speed].first), sig_hi(imap[internal_variables::cell_signal_speed].second), gm1(imap[fluid_prim::gamma1].first), @@ -158,9 +159,9 @@ class ConToPrim { fluid_prim::velocity::name(), fluid_cons::momentum::name(), fluid_prim::energy::name(), fluid_cons::energy::name(), 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}); + fluid_cons::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), internal_variables::cell_signal_speed, + fluid_prim::gamma1, internal_variables::c2p_scratch}); } template diff --git a/src/fluid/con2prim_robust.hpp b/src/fluid/con2prim_robust.hpp index 12cb0b188..dc5c21e95 100644 --- a/src/fluid/con2prim_robust.hpp +++ b/src/fluid/con2prim_robust.hpp @@ -241,8 +241,9 @@ class ConToPrim { cb_lo(imap[fluid_cons::bfield::name()].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), + cye(imap[fluid_cons::ye::name()].second), + prs(imap[fluid_prim::pressure::name()].first), + tmp(imap[fluid_prim::temperature::name()].first), sig_lo(imap[internal_variables::cell_signal_speed].first), sig_hi(imap[internal_variables::cell_signal_speed].second), gm1(imap[fluid_prim::gamma1].first), @@ -256,9 +257,9 @@ class ConToPrim { fluid_prim::velocity::name(), fluid_cons::momentum::name(), fluid_prim::energy::name(), fluid_cons::energy::name(), 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}); + fluid_cons::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), internal_variables::cell_signal_speed, + fluid_prim::gamma1, internal_variables::c2p_mu}); } template diff --git a/src/fluid/fluid.cpp b/src/fluid/fluid.cpp index 2aa84e2f9..635dd4834 100644 --- a/src/fluid/fluid.cpp +++ b/src/fluid/fluid.cpp @@ -201,8 +201,8 @@ std::shared_ptr Initialize(ParameterInput *pin) { } physics->AddField(diag::divb, mprim_scalar); } - physics->AddField(p::pressure, mprim_scalar); - physics->AddField(p::temperature, mprim_scalar); + physics->AddField(p::pressure::name(), mprim_scalar); + physics->AddField(p::temperature::name(), mprim_scalar); physics->AddField(p::gamma1, mprim_scalar); if (ye) { physics->AddField(p::ye::name(), mprim_scalar); @@ -269,7 +269,7 @@ std::shared_ptr Initialize(ParameterInput *pin) { if (ye) riemann::FluxState::FluxVars(c::ye::name()); // add some extra fields for reconstruction - rvars = std::vector({p::pressure, p::gamma1}); + rvars = std::vector({p::pressure::name(), p::gamma1}); riemann::FluxState::ReconVars(rvars); auto recon_vars = riemann::FluxState::ReconVars(); @@ -355,7 +355,8 @@ TaskStatus PrimitiveToConservedRegion(MeshBlockData *rc, const IndexRange const std::vector vars( {p::density::name(), c::density::name(), p::velocity::name(), c::momentum::name(), 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}); + p::ye::name(), c::ye::name(), p::pressure::name(), p::gamma1, + impl::cell_signal_speed}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); @@ -368,7 +369,7 @@ TaskStatus PrimitiveToConservedRegion(MeshBlockData *rc, const IndexRange const int cmom_hi = imap[c::momentum::name()].second; const int peng = imap[p::energy::name()].first; const int ceng = imap[c::energy::name()].first; - const int prs = imap[p::pressure].first; + const int prs = imap[p::pressure::name()].first; const int gm1 = imap[p::gamma1].first; const int pb_lo = imap[p::bfield::name()].first; const int pb_hi = imap[p::bfield::name()].second; diff --git a/src/fluid/riemann.hpp b/src/fluid/riemann.hpp index f6632d4ef..39597b6b3 100644 --- a/src/fluid/riemann.hpp +++ b/src/fluid/riemann.hpp @@ -223,7 +223,8 @@ class FluxState { 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::name()].second), prs(imap[fluid_prim::pressure].first), + pye(imap[fluid_prim::ye::name()].second), + prs(imap[fluid_prim::pressure::name()].first), gm1(imap[fluid_prim::gamma1].first), crho(imap[fluid_cons::density::name()].first), cmom_lo(imap[fluid_cons::momentum::name()].first), diff --git a/src/fluid/tmunu.hpp b/src/fluid/tmunu.hpp index 983013c8b..fdbac2f50 100644 --- a/src/fluid/tmunu.hpp +++ b/src/fluid/tmunu.hpp @@ -29,7 +29,7 @@ namespace fluid { const std::vector TMUNU_VARS = { fluid_prim::density::name(), fluid_prim::velocity::name(), fluid_prim::energy::name(), - fluid_prim::pressure, fluid_prim::bfield::name()}; + fluid_prim::pressure::name(), fluid_prim::bfield::name()}; // Indices are upstairs template class StressEnergyTensorCon { @@ -49,7 +49,7 @@ class StressEnergyTensorCon { ir_ = imap[fluid_prim::density::name()].first; iv_ = imap[fluid_prim::velocity::name()].first; iu_ = imap[fluid_prim::energy::name()].first; - ip_ = imap[fluid_prim::pressure].first; + ip_ = imap[fluid_prim::pressure::name()].first; ib_ = imap[fluid_prim::bfield::name()].first; } diff --git a/src/microphysics/eos_phoebus/eos_phoebus.cpp b/src/microphysics/eos_phoebus/eos_phoebus.cpp index a425a6eef..39f4eba4f 100644 --- a/src/microphysics/eos_phoebus/eos_phoebus.cpp +++ b/src/microphysics/eos_phoebus/eos_phoebus.cpp @@ -98,7 +98,7 @@ std::shared_ptr Initialize(ParameterInput *pin) { Metadata m = Metadata({Metadata::Cell, Metadata::Intensive, Metadata::Derived, Metadata::OneCopy, Metadata::Requires}); pkg->AddField(fluid_prim::ye::name(), m); - pkg->AddField(fluid_prim::temperature, m); + pkg->AddField(fluid_prim::temperature::name(), m); const std::string filename = pin->GetString(block_name, "filename"); const bool use_sp5 = pin->GetOrAddBoolean(block_name, "use_sp5", true); diff --git a/src/pgen/advection.cpp b/src/pgen/advection.cpp index 8fa7bdaf8..6bda58ab3 100644 --- a/src/pgen/advection.cpp +++ b/src/pgen/advection.cpp @@ -28,8 +28,8 @@ 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::name(), fluid_prim::pressure, - fluid_prim::temperature, fluid_prim::gamma1}, + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1}, imap); const int irho = imap[fluid_prim::density::name()].first; @@ -39,8 +39,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { 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::name()].second; - const int iprs = imap[fluid_prim::pressure].first; - const int itmp = imap[fluid_prim::temperature].first; + const int iprs = imap[fluid_prim::pressure::name()].first; + const int itmp = imap[fluid_prim::temperature::name()].first; const int igm1 = imap[fluid_prim::gamma1].first; const Real rho = pin->GetOrAddReal("advection", "rho", 1.0); diff --git a/src/pgen/blandford_mckee.cpp b/src/pgen/blandford_mckee.cpp index a42e6f6d4..fbeae64bd 100644 --- a/src/pgen/blandford_mckee.cpp +++ b/src/pgen/blandford_mckee.cpp @@ -33,8 +33,8 @@ 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::name(), fluid_prim::pressure, - fluid_prim::temperature, fluid_prim::gamma1}, + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1}, imap); const int irho = imap[fluid_prim::density::name()].first; @@ -44,8 +44,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { 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::name()].second; - const int iprs = imap[fluid_prim::pressure].first; - const int itmp = imap[fluid_prim::temperature].first; + const int iprs = imap[fluid_prim::pressure::name()].first; + const int itmp = imap[fluid_prim::temperature::name()].first; const int igm1 = imap[fluid_prim::gamma1].first; const Real wshock = pin->GetOrAddReal("blandford_mckee", "lorentz_shock", 7); diff --git a/src/pgen/bondi.cpp b/src/pgen/bondi.cpp index 96fd79be7..a2c2eea8d 100644 --- a/src/pgen/bondi.cpp +++ b/src/pgen/bondi.cpp @@ -93,8 +93,8 @@ 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::name(), fluid_prim::pressure, - fluid_prim::temperature, fluid_prim::gamma1}, + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1}, imap); const int irho = imap[fluid_prim::density::name()].first; @@ -104,8 +104,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { 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::name()].second; - const int iprs = imap[fluid_prim::pressure].first; - const int itmp = imap[fluid_prim::temperature].first; + const int iprs = imap[fluid_prim::pressure::name()].first; + const int itmp = imap[fluid_prim::temperature::name()].first; const int igm1 = imap[fluid_prim::gamma1].first; // this only works with ideal gases diff --git a/src/pgen/friedmann.cpp b/src/pgen/friedmann.cpp index a7a71f072..1722f0ec4 100644 --- a/src/pgen/friedmann.cpp +++ b/src/pgen/friedmann.cpp @@ -38,15 +38,15 @@ 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::name(), fluid_prim::pressure, - fluid_prim::temperature, fluid_prim::gamma1}, + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), 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::name()].second; - const int iprs = imap[fluid_prim::pressure].first; - const int itmp = imap[fluid_prim::temperature].first; + const int iprs = imap[fluid_prim::pressure::name()].first; + const int itmp = imap[fluid_prim::temperature::name()].first; const int igm1 = imap[fluid_prim::gamma1].first; const Real rho = pin->GetOrAddReal("friedmann", "rho", 1.0); diff --git a/src/pgen/homogeneous_sphere.cpp b/src/pgen/homogeneous_sphere.cpp index b1e80de83..bd76f2458 100644 --- a/src/pgen/homogeneous_sphere.cpp +++ b/src/pgen/homogeneous_sphere.cpp @@ -29,10 +29,10 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { PackIndexMap imap; auto v = rc->PackVariables( - std::vector({radmoment_prim::J, radmoment_prim::H, - fluid_prim::density::name(), fluid_prim::temperature, - fluid_prim::velocity::name(), radmoment_internal::xi, - radmoment_internal::phi}), + std::vector( + {radmoment_prim::J, radmoment_prim::H, fluid_prim::density::name(), + fluid_prim::temperature::name(), fluid_prim::velocity::name(), + radmoment_internal::xi, radmoment_internal::phi}), imap); auto idJ = imap.GetFlatIdx(radmoment_prim::J); @@ -41,7 +41,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto ixi = imap.GetFlatIdx(radmoment_internal::xi); auto iphi = imap.GetFlatIdx(radmoment_internal::phi); const int prho = imap[fluid_prim::density::name()].first; - const int pT = imap[fluid_prim::temperature].first; + const int pT = imap[fluid_prim::temperature::name()].first; const auto specB = idJ.GetBounds(1); const Real sphere_rad = pin->GetOrAddReal("homogeneous_sphere", "radius", 1.0); diff --git a/src/pgen/kh.cpp b/src/pgen/kh.cpp index 86a1f06ff..2e26ca501 100644 --- a/src/pgen/kh.cpp +++ b/src/pgen/kh.cpp @@ -28,8 +28,8 @@ 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::name(), fluid_prim::pressure, - fluid_prim::temperature, fluid_prim::gamma1}, + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1}, imap); const int irho = imap[fluid_prim::density::name()].first; @@ -39,8 +39,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { 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::name()].second; - const int iprs = imap[fluid_prim::pressure].first; - const int itmp = imap[fluid_prim::temperature].first; + const int iprs = imap[fluid_prim::pressure::name()].first; + const int itmp = imap[fluid_prim::temperature::name()].first; const int igm1 = imap[fluid_prim::gamma1].first; const Real rho0 = pin->GetOrAddReal("kelvin_helmholtz", "rho0", 1.0); diff --git a/src/pgen/leptoneq.cpp b/src/pgen/leptoneq.cpp index 9605c95da..4eb77c642 100644 --- a/src/pgen/leptoneq.cpp +++ b/src/pgen/leptoneq.cpp @@ -32,7 +32,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { PackIndexMap imap; auto v = rc->PackVariables({p::density::name(), p::velocity::name(), p::energy::name(), - p::ye::name(), p::pressure, p::temperature, p::gamma1}, + p::ye::name(), p::pressure::name(), p::temperature::name(), + p::gamma1}, imap); const int irho = imap[p::density::name()].first; @@ -40,8 +41,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int ivhi = imap[p::velocity::name()].second; const int ieng = imap[p::energy::name()].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 iprs = imap[p::pressure::name()].first; + const int itmp = imap[p::temperature::name()].first; const int igm1 = imap[p::gamma1].first; IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::entire); diff --git a/src/pgen/linear_modes.cpp b/src/pgen/linear_modes.cpp index 067c49d82..3eddb41a7 100644 --- a/src/pgen/linear_modes.cpp +++ b/src/pgen/linear_modes.cpp @@ -43,10 +43,11 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int ndim = pmb->pmy_mesh->ndim; PackIndexMap imap; - std::vector 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::name()}); + std::vector vars({fluid_prim::density::name(), + fluid_prim::velocity::name(), fluid_prim::energy::name(), + fluid_prim::bfield::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1, + fluid_prim::ye::name()}); auto v = rc->PackVariables(vars, imap); const int irho = imap[fluid_prim::density::name()].first; @@ -55,8 +56,8 @@ 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 iprs = imap[fluid_prim::pressure].first; - const int itmp = imap[fluid_prim::temperature].first; + const int iprs = imap[fluid_prim::pressure::name()].first; + const int itmp = imap[fluid_prim::temperature::name()].first; const int igm1 = imap[fluid_prim::gamma1].first; const int iye = imap[fluid_prim::ye::name()].second; const int nv = ivhi - ivlo + 1; diff --git a/src/pgen/p2c2p.cpp b/src/pgen/p2c2p.cpp index fac0d6a30..897b1e96e 100644 --- a/src/pgen/p2c2p.cpp +++ b/src/pgen/p2c2p.cpp @@ -75,8 +75,8 @@ 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::name(), fluid_prim::pressure, - fluid_prim::temperature, fluid_prim::gamma1}, + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1}, imap); const int irho = imap[fluid_prim::density::name()].first; @@ -85,8 +85,8 @@ 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 iprs = imap[fluid_prim::pressure].first; - const int itmp = imap[fluid_prim::temperature].first; + const int iprs = imap[fluid_prim::pressure::name()].first; + const int itmp = imap[fluid_prim::temperature::name()].first; const int igm1 = imap[fluid_prim::gamma1].first; IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::entire); diff --git a/src/pgen/progenitor.cpp b/src/pgen/progenitor.cpp index aa0bb4c2d..511de54c9 100644 --- a/src/pgen/progenitor.cpp +++ b/src/pgen/progenitor.cpp @@ -37,8 +37,8 @@ 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::name(), fluid_prim::pressure, - fluid_prim::temperature, fluid_prim::gamma1}, + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1}, imap); const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity::name()].first; @@ -47,8 +47,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { 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::name()].second; - const int iprs = imap[fluid_prim::pressure].first; - const int itmp = imap[fluid_prim::temperature].first; + const int iprs = imap[fluid_prim::pressure::name()].first; + const int itmp = imap[fluid_prim::temperature::name()].first; const int igm1 = imap[fluid_prim::gamma1].first; auto &coords = pmb->coords; diff --git a/src/pgen/radiation_advection.cpp b/src/pgen/radiation_advection.cpp index 9e16b5a62..caee5c807 100644 --- a/src/pgen/radiation_advection.cpp +++ b/src/pgen/radiation_advection.cpp @@ -27,12 +27,13 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables( - std::vector({radmoment_prim::J, radmoment_prim::H, - fluid_prim::density::name(), fluid_prim::temperature, - fluid_prim::energy::name(), fluid_prim::velocity::name(), - radmoment_internal::xi, radmoment_internal::phi}), - imap); + auto v = + rc->PackVariables(std::vector( + {radmoment_prim::J, radmoment_prim::H, + fluid_prim::density::name(), fluid_prim::temperature::name(), + fluid_prim::energy::name(), fluid_prim::velocity::name(), + radmoment_internal::xi, radmoment_internal::phi}), + imap); auto idJ = imap.GetFlatIdx(radmoment_prim::J); auto idH = imap.GetFlatIdx(radmoment_prim::H); @@ -40,7 +41,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto ixi = imap.GetFlatIdx(radmoment_internal::xi); auto iphi = imap.GetFlatIdx(radmoment_internal::phi); const int prho = imap[fluid_prim::density::name()].first; - const int pT = imap[fluid_prim::temperature].first; + const int pT = imap[fluid_prim::temperature::name()].first; const int peng = imap[fluid_prim::energy::name()].first; Params &phoebus_params = pmb->packages.Get("phoebus")->AllParams(); diff --git a/src/pgen/radiation_equilibration.cpp b/src/pgen/radiation_equilibration.cpp index 71151f509..f2d35f1e2 100644 --- a/src/pgen/radiation_equilibration.cpp +++ b/src/pgen/radiation_equilibration.cpp @@ -33,9 +33,9 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { PackIndexMap imap; auto v = rc->PackVariables( {radmoment_prim::J, radmoment_prim::H, radmoment_internal::xi, - radmoment_internal::phi, fluid_prim::density::name(), fluid_prim::temperature, - fluid_prim::pressure, fluid_prim::gamma1, fluid_prim::energy::name(), - fluid_prim::ye::name(), fluid_prim::velocity::name()}, + radmoment_internal::phi, fluid_prim::density::name(), + fluid_prim::temperature::name(), fluid_prim::pressure::name(), fluid_prim::gamma1, + fluid_prim::energy::name(), fluid_prim::ye::name(), fluid_prim::velocity::name()}, imap); auto idJ = imap.GetFlatIdx(radmoment_prim::J); @@ -44,8 +44,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto iphi = imap.GetFlatIdx(radmoment_internal::phi); const int iRho = imap[fluid_prim::density::name()].first; - const int iT = imap[fluid_prim::temperature].first; - const int iP = imap[fluid_prim::pressure].first; + const int iT = imap[fluid_prim::temperature::name()].first; + const int iP = imap[fluid_prim::pressure::name()].first; const int igm1 = imap[fluid_prim::gamma1].first; const int ieng = imap[fluid_prim::energy::name()].first; const int pye = imap[fluid_prim::ye::name()].first; diff --git a/src/pgen/rhs_tester.cpp b/src/pgen/rhs_tester.cpp index d2ee11da5..63a0b5760 100644 --- a/src/pgen/rhs_tester.cpp +++ b/src/pgen/rhs_tester.cpp @@ -22,8 +22,8 @@ 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::name(), fluid_prim::pressure, - fluid_prim::temperature, fluid_prim::gamma1}, + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1}, imap); const int irho = imap[fluid_prim::density::name()].first; @@ -33,8 +33,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { 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::name()].second; - const int iprs = imap[fluid_prim::pressure].first; - const int itmp = imap[fluid_prim::temperature].first; + const int iprs = imap[fluid_prim::pressure::name()].first; + const int itmp = imap[fluid_prim::temperature::name()].first; const int igm1 = imap[fluid_prim::gamma1].first; IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::entire); diff --git a/src/pgen/rotor.cpp b/src/pgen/rotor.cpp index 33ced5f69..b3d5f3b52 100644 --- a/src/pgen/rotor.cpp +++ b/src/pgen/rotor.cpp @@ -34,8 +34,8 @@ 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::name(), fluid_prim::pressure, - fluid_prim::temperature, fluid_prim::gamma1}, + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1}, imap); const int irho = imap[fluid_prim::density::name()].first; @@ -45,8 +45,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { 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::name()].second; - const int iprs = imap[fluid_prim::pressure].first; - const int itmp = imap[fluid_prim::temperature].first; + const int iprs = imap[fluid_prim::pressure::name()].first; + const int itmp = imap[fluid_prim::temperature::name()].first; const int igm1 = imap[fluid_prim::gamma1].first; const Real rho0 = pin->GetOrAddReal("rotor", "rho0", 10.0); diff --git a/src/pgen/sedov.cpp b/src/pgen/sedov.cpp index bf5225749..d024356eb 100644 --- a/src/pgen/sedov.cpp +++ b/src/pgen/sedov.cpp @@ -33,8 +33,8 @@ 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::name(), fluid_prim::pressure, - fluid_prim::temperature, fluid_prim::gamma1}, + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1}, imap); const int irho = imap[fluid_prim::density::name()].first; @@ -44,8 +44,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { 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::name()].second; - const int iprs = imap[fluid_prim::pressure].first; - const int itmp = imap[fluid_prim::temperature].first; + const int iprs = imap[fluid_prim::pressure::name()].first; + const int itmp = imap[fluid_prim::temperature::name()].first; const int igm1 = imap[fluid_prim::gamma1].first; const Real rhoa = pin->GetOrAddReal("sedov", "rho_ambient", 1.0); diff --git a/src/pgen/shock_tube.cpp b/src/pgen/shock_tube.cpp index 928c00881..efcf4b121 100644 --- a/src/pgen/shock_tube.cpp +++ b/src/pgen/shock_tube.cpp @@ -37,8 +37,8 @@ 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::name(), fluid_prim::pressure, - fluid_prim::temperature, fluid_prim::gamma1}, + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1}, imap); const int irho = imap[fluid_prim::density::name()].first; @@ -48,8 +48,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { 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::name()].second; - const int iprs = imap[fluid_prim::pressure].first; - const int itmp = imap[fluid_prim::temperature].first; + const int iprs = imap[fluid_prim::pressure::name()].first; + const int itmp = imap[fluid_prim::temperature::name()].first; const int igm1 = imap[fluid_prim::gamma1].first; const Real rhol = pin->GetOrAddReal("shocktube", "rhol", 1.0); diff --git a/src/pgen/thin_cooling.cpp b/src/pgen/thin_cooling.cpp index 32890514f..111f4b228 100644 --- a/src/pgen/thin_cooling.cpp +++ b/src/pgen/thin_cooling.cpp @@ -32,7 +32,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { PackIndexMap imap; auto v = rc->PackVariables({p::density::name(), p::velocity::name(), p::energy::name(), - p::ye::name(), p::pressure, p::temperature, p::gamma1}, + p::ye::name(), p::pressure::name(), p::temperature::name(), + p::gamma1}, imap); const int irho = imap[p::density::name()].first; @@ -40,8 +41,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int ivhi = imap[p::velocity::name()].second; const int ieng = imap[p::energy::name()].first; const int iye = imap[p::ye::name()].second; - const int iprs = imap[p::pressure].first; - const int itmp = imap[p::temperature].first; + const int iprs = imap[p::pressure::name()].first; + const int itmp = imap[p::temperature::name()].first; const int igm1 = imap[p::gamma1].first; IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::entire); diff --git a/src/pgen/torus.cpp b/src/pgen/torus.cpp index b153e054d..b85fb34d8 100644 --- a/src/pgen/torus.cpp +++ b/src/pgen/torus.cpp @@ -140,8 +140,8 @@ 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::name(), fluid_prim::pressure, - fluid_prim::temperature, fluid_prim::gamma1, + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1, radmoment_prim::J, radmoment_prim::H}, imap); @@ -152,8 +152,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int iblo = imap[fluid_prim::bfield::name()].first; const int ibhi = imap[fluid_prim::bfield::name()].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 iprs = imap[fluid_prim::pressure::name()].first; + const int itmp = imap[fluid_prim::temperature::name()].first; const int igm1 = imap[fluid_prim::gamma1].first; auto iJ = imap.GetFlatIdx(radmoment_prim::J, false); @@ -680,7 +680,7 @@ void ComputeBetas(Mesh *pmesh, Real rho_min_bnorm, Real &beta_min_global, PackIndexMap imap; auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), - fluid_prim::bfield::name(), fluid_prim::pressure, + fluid_prim::bfield::name(), fluid_prim::pressure::name(), radmoment_prim::J}, imap); @@ -689,7 +689,7 @@ void ComputeBetas(Mesh *pmesh, Real rho_min_bnorm, Real &beta_min_global, const int ivhi = imap[fluid_prim::velocity::name()].second; const int iblo = imap[fluid_prim::bfield::name()].first; const int ibhi = imap[fluid_prim::bfield::name()].second; - const int iprs = imap[fluid_prim::pressure].first; + const int iprs = imap[fluid_prim::pressure::name()].first; auto idx_J = imap.GetFlatIdx(radmoment_prim::J, false); diff --git a/src/pgen/tov.cpp b/src/pgen/tov.cpp index 780bfd10a..e42281c64 100644 --- a/src/pgen/tov.cpp +++ b/src/pgen/tov.cpp @@ -73,8 +73,8 @@ 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::name(), fluid_prim::pressure, - fluid_prim::temperature, fluid_prim::gamma1}, + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1}, imap); const int irho = imap[fluid_prim::density::name()].first; @@ -84,8 +84,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int iblo = imap[fluid_prim::bfield::name()].first; const int ibhi = imap[fluid_prim::bfield::name()].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 iprs = imap[fluid_prim::pressure::name()].first; + const int itmp = imap[fluid_prim::temperature::name()].first; const int igm1 = imap[fluid_prim::gamma1].first; pmb->par_for( diff --git a/src/phoebus_utils/variables.hpp b/src/phoebus_utils/variables.hpp index 64fb7d888..e8ee64d0a 100644 --- a/src/phoebus_utils/variables.hpp +++ b/src/phoebus_utils/variables.hpp @@ -38,8 +38,8 @@ VARIABLE(p, velocity); VARIABLE(p, energy); VARIABLE(p, bfield); VARIABLE(p, ye); -constexpr char pressure[] = "pressure"; -constexpr char temperature[] = "temperature"; +VARIABLE_NONS(pressure); +VARIABLE_NONS(temperature); constexpr char gamma1[] = "gamma1"; } // namespace fluid_prim diff --git a/src/radiation/cooling_function.cpp b/src/radiation/cooling_function.cpp index 555e09c1f..3a638c0e1 100644 --- a/src/radiation/cooling_function.cpp +++ b/src/radiation/cooling_function.cpp @@ -114,9 +114,9 @@ TaskStatus CoolingFunctionCalculateFourForce(MeshBlockData *rc, const doub auto *pmb = rc->GetParentPointer(); std::vector vars({c::density::name(), p::density::name(), - p::velocity::name(), p::temperature, p::ye::name(), - c::energy::name(), iv::Gcov, iv::GcovHeat, iv::GcovCool, - iv::Gye, iv::tau, p::energy::name()}); + p::velocity::name(), p::temperature::name(), + p::ye::name(), c::energy::name(), iv::Gcov, iv::GcovHeat, + iv::GcovCool, iv::Gye, iv::tau, p::energy::name()}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); @@ -124,7 +124,7 @@ TaskStatus CoolingFunctionCalculateFourForce(MeshBlockData *rc, const doub const int prho = imap[p::density::name()].first; const int pvlo = imap[p::velocity::name()].first; const int pvhi = imap[p::velocity::name()].second; - const int ptemp = imap[p::temperature].first; + const int ptemp = imap[p::temperature::name()].first; const int pye = imap[p::ye::name()].first; const int penergy = imap[p::energy::name()].first; const int Gcov_lo = imap[iv::Gcov].first; diff --git a/src/radiation/mocmc.cpp b/src/radiation/mocmc.cpp index c4c941e10..67a78ee46 100644 --- a/src/radiation/mocmc.cpp +++ b/src/radiation/mocmc.cpp @@ -81,9 +81,13 @@ void MOCMCInitSamples(T *rc) { const auto opac = opac_pkg->template Param("opacities"); StateDescriptor *eos = pmb->packages.Get("eos").get(); - std::vector variables{ - pr::J, pr::H, pf::density::name(), pf::velocity::name(), - pf::temperature, pf::ye::name(), im::dnsamp}; + std::vector variables{pr::J, + pr::H, + pf::density::name(), + pf::velocity::name(), + pf::temperature::name(), + pf::ye::name(), + im::dnsamp}; PackIndexMap imap; auto v = rc->PackVariables(variables, imap); @@ -91,7 +95,7 @@ void MOCMCInitSamples(T *rc) { auto pH = imap.GetFlatIdx(pr::H); auto pdens = imap[pf::density::name()].first; auto pv = imap.GetFlatIdx(fluid_prim::velocity::name()); - auto pT = imap[pf::temperature].first; + auto pT = imap[pf::temperature::name()].first; auto pye = imap[pf::ye::name()].first; auto dn = imap[im::dnsamp].first; @@ -528,7 +532,7 @@ TaskStatus MOCMCFluidSource(T *rc, const Real dt, const bool update_fluid) { pf::density::name(), pf::energy::name(), pf::velocity::name(), - pf::temperature, + pf::temperature::name(), pf::ye::name(), ir::tilPi, ir::kappaH, @@ -549,7 +553,7 @@ TaskStatus MOCMCFluidSource(T *rc, const Real dt, const bool update_fluid) { const auto pdens = imap[pf::density::name()].first; const auto peng = imap[pf::energy::name()].first; const auto pv = imap.GetFlatIdx(fluid_prim::velocity::name()); - const auto pT = imap[pf::temperature].first; + const auto pT = imap[pf::temperature::name()].first; const auto pye = imap[pf::ye::name()].first; const auto Inu0 = imap.GetFlatIdx(im::Inu0); const auto Inu1 = imap.GetFlatIdx(im::Inu1); diff --git a/src/radiation/moments.cpp b/src/radiation/moments.cpp index 716b55131..60828940e 100644 --- a/src/radiation/moments.cpp +++ b/src/radiation/moments.cpp @@ -944,16 +944,20 @@ TaskStatus MomentCalculateOpacities(T *rc) { namespace ir = radmoment_internal; namespace c = fluid_cons; namespace p = fluid_prim; - std::vector vars{ - p::density::name(), p::temperature, p::ye::name(), p::velocity::name(), - ir::kappaJ, ir::kappaH, ir::JBB}; + std::vector vars{p::density::name(), + p::temperature::name(), + p::ye::name(), + p::velocity::name(), + ir::kappaJ, + ir::kappaH, + ir::JBB}; PackIndexMap imap; auto v = rc->PackVariables(vars, imap); auto pv = imap.GetFlatIdx(p::velocity::name()); int prho = imap[p::density::name()].first; - int pT = imap[p::temperature].first; + int pT = imap[p::temperature::name()].first; int pYe = imap[p::ye::name()].first; auto idx_kappaJ = imap.GetFlatIdx(ir::kappaJ); diff --git a/src/radiation/moments_source.cpp b/src/radiation/moments_source.cpp index e5148448d..79eef6642 100644 --- a/src/radiation/moments_source.cpp +++ b/src/radiation/moments_source.cpp @@ -224,11 +224,11 @@ TaskStatus MomentFluidSourceImpl(T *rc, Real dt, bool update_fluid) { cr::F, c::bfield::name(), p::density::name(), - p::temperature, + p::temperature::name(), p::energy::name(), p::ye::name(), p::velocity::name(), - p::pressure, + p::pressure::name(), p::gamma1, p::bfield::name(), pr::J, @@ -253,8 +253,8 @@ TaskStatus MomentFluidSourceImpl(T *rc, Real dt, bool update_fluid) { int prho = imap[p::density::name()].first; int peng = imap[p::energy::name()].first; - int pT = imap[p::temperature].first; - int pprs = imap[p::pressure].first; + int pT = imap[p::temperature::name()].first; + int pprs = imap[p::pressure::name()].first; int pgm1 = imap[p::gamma1].first; int pYe = imap[p::ye::name()].first; int pb_lo = imap[p::bfield::name()].first; diff --git a/src/radiation/monte_carlo.cpp b/src/radiation/monte_carlo.cpp index 4af727e35..ca36a2a03 100644 --- a/src/radiation/monte_carlo.cpp +++ b/src/radiation/monte_carlo.cpp @@ -54,9 +54,10 @@ void ComputeTotalEmissivity(Mesh *pmesh) { namespace p = fluid_prim; PackIndexMap imap; - auto v = rc->PackVariables({p::density::name(), p::temperature, p::ye::name()}, imap); + auto v = rc->PackVariables( + {p::density::name(), p::temperature::name(), p::ye::name()}, imap); const int prho = imap[p::density::name()].first; - const int ptemp = imap[p::temperature].first; + const int ptemp = imap[p::temperature::name()].first; const int pye = imap[p::ye::name()].first; Real Jtot_b = 0.0; // per block @@ -150,14 +151,14 @@ TaskStatus MonteCarloSourceParticles(MeshBlock *pmb, MeshBlockData *rc, const Real h_code = code_constants.h; const Real mp_code = code_constants.mp; - std::vector vars({p::density::name(), p::temperature, p::ye::name(), - p::velocity::name(), "dNdlnu_max", "dNdlnu", "dN", "Ns", - iv::Gcov, iv::Gye}); + std::vector vars({p::density::name(), p::temperature::name(), + p::ye::name(), p::velocity::name(), "dNdlnu_max", + "dNdlnu", "dN", "Ns", iv::Gcov, iv::Gye}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); const int pye = imap[p::ye::name()].first; const int pdens = imap[p::density::name()].first; - const int ptemp = imap[p::temperature].first; + const int ptemp = imap[p::temperature::name()].first; const int pvlo = imap[p::velocity::name()].first; const int pvhi = imap[p::velocity::name()].second; const int idNdlnu = imap["dNdlnu"].first; @@ -457,14 +458,14 @@ TaskStatus MonteCarloTransport(MeshBlock *pmb, MeshBlockData *rc, const Real mp_code = code_constants.mp; std::vector vars({p::density::name(), p::ye::name(), p::velocity::name(), - p::temperature, iv::Gcov, iv::Gye}); + p::temperature::name(), iv::Gcov, iv::Gye}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); const int prho = imap[p::density::name()].first; const int iye = imap[p::ye::name()].first; const int ivlo = imap[p::velocity::name()].first; const int ivhi = imap[p::velocity::name()].second; - const int itemp = imap[p::temperature].first; + const int itemp = imap[p::temperature::name()].first; const int iGcov_lo = imap[iv::Gcov].first; const int iGcov_hi = imap[iv::Gcov].second; const int iGye = imap[iv::Gye].first; diff --git a/src/tov/tov.cpp b/src/tov/tov.cpp index c9f88b78f..0efe1bbbf 100644 --- a/src/tov/tov.cpp +++ b/src/tov/tov.cpp @@ -90,7 +90,7 @@ std::shared_ptr Initialize(ParameterInput *pin) { // Redutions for history file auto HstMax = parthenon::UserHistoryOperation::max; auto ReducePress = [](MeshData *md) { - return History::ReduceOneVar>(md, fluid_prim::pressure, 0); + return History::ReduceOneVar>(md, fluid_prim::pressure::name(), 0); }; auto ReduceDens = [](MeshData *md) { return History::ReduceOneVar>(md, fluid_prim::density::name(), 0); From 4caa49de6cf4c3b40243a3981cf19e4d2087efd0 Mon Sep 17 00:00:00 2001 From: Jonah Maxwell Miller Date: Wed, 6 Dec 2023 18:44:03 -0700 Subject: [PATCH 14/14] all variables now use types --- src/fixup/fixup.cpp | 101 +++++++------- src/fixup/fixup_c2p.cpp | 46 +++---- src/fixup/fixup_radc2p.cpp | 19 +-- src/fixup/fixup_src.cpp | 23 ++-- src/fluid/con2prim.hpp | 12 +- src/fluid/con2prim_robust.hpp | 12 +- src/fluid/fluid.cpp | 56 ++++---- src/fluid/fluid.hpp | 12 +- src/fluid/riemann.hpp | 2 +- src/geometry/geometry.cpp | 4 +- src/geometry/geometry_utils.hpp | 4 +- src/pgen/advection.cpp | 13 +- src/pgen/blandford_mckee.cpp | 13 +- src/pgen/bondi.cpp | 13 +- src/pgen/friedmann.cpp | 13 +- src/pgen/homogeneous_sphere.cpp | 23 ++-- src/pgen/kh.cpp | 13 +- src/pgen/leptoneq.cpp | 4 +- src/pgen/linear_modes.cpp | 6 +- src/pgen/p2c2p.cpp | 13 +- src/pgen/progenitor.cpp | 13 +- src/pgen/radiation_advection.cpp | 24 ++-- src/pgen/radiation_equilibration.cpp | 17 +-- src/pgen/rhs_tester.cpp | 13 +- src/pgen/rotor.cpp | 13 +- src/pgen/sedov.cpp | 13 +- src/pgen/shock_tube.cpp | 13 +- src/pgen/thin_cooling.cpp | 4 +- src/pgen/torus.cpp | 14 +- src/pgen/tov.cpp | 13 +- src/phoebus_boundaries/phoebus_boundaries.cpp | 7 +- src/phoebus_driver.cpp | 6 +- src/phoebus_utils/variables.hpp | 95 +++++++------ src/radiation/cooling_function.cpp | 25 ++-- src/radiation/mocmc.cpp | 72 ++++------ src/radiation/moments.cpp | 129 +++++++++--------- src/radiation/moments_source.cpp | 49 +++---- src/radiation/monte_carlo.cpp | 21 +-- src/radiation/radiation.cpp | 73 +++++----- 39 files changed, 516 insertions(+), 500 deletions(-) diff --git a/src/fixup/fixup.cpp b/src/fixup/fixup.cpp index 1dc5c3c76..73d6dcc2a 100644 --- a/src/fixup/fixup.cpp +++ b/src/fixup/fixup.cpp @@ -309,8 +309,9 @@ TaskStatus ApplyFloorsImpl(T *rc, IndexDomain domain = IndexDomain::entire) { const std::vector vars( {p::density::name(), c::density::name(), p::velocity::name(), c::momentum::name(), p::energy::name(), c::energy::name(), p::bfield::name(), p::ye::name(), - c::ye::name(), p::pressure::name(), p::temperature::name(), p::gamma1, pr::J, - pr::H, cr::E, cr::F, impl::cell_signal_speed, impl::fail, ir::tilPi}); + c::ye::name(), p::pressure::name(), p::temperature::name(), p::gamma1::name(), + pr::J::name(), pr::H::name(), cr::E::name(), cr::F::name(), + impl::cell_signal_speed::name(), impl::fail::name(), ir::tilPi::name()}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); @@ -325,18 +326,18 @@ TaskStatus ApplyFloorsImpl(T *rc, IndexDomain domain = IndexDomain::entire) { const int ceng = imap[c::energy::name()].first; const int prs = imap[p::pressure::name()].first; const int tmp = imap[p::temperature::name()].first; - 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; + const int gm1 = imap[p::gamma1::name()].first; + const int slo = imap[impl::cell_signal_speed::name()].first; + const int shi = imap[impl::cell_signal_speed::name()].second; const int pb_lo = imap[p::bfield::name()].first; const int pb_hi = imap[p::bfield::name()].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); - auto idx_F = imap.GetFlatIdx(cr::F, false); - auto iTilPi = imap.GetFlatIdx(ir::tilPi, false); + auto idx_J = imap.GetFlatIdx(pr::J::name(), false); + auto idx_H = imap.GetFlatIdx(pr::H::name(), false); + auto idx_E = imap.GetFlatIdx(cr::E::name(), false); + auto idx_F = imap.GetFlatIdx(cr::F::name(), false); + auto iTilPi = imap.GetFlatIdx(ir::tilPi::name(), false); const int num_species = enable_rad_floors ? rad_pkg->Param("num_species") : 0; @@ -749,11 +750,14 @@ TaskStatus FixFluxes(MeshBlockData *rc) { } else if (ix1_bc == "reflect") { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( - std::vector({c::density::name(), c::energy::name(), cr::E}), - std::vector({c::density::name(), c::energy::name(), cr::E}), imap); + std::vector( + {c::density::name(), c::energy::name(), cr::E::name()}), + std::vector( + {c::density::name(), c::energy::name(), cr::E::name()}), + imap); const auto crho = imap[c::density::name()].first; const auto cener = imap[c::energy::name()].first; - auto idx_E = imap.GetFlatIdx(cr::E, false); + auto idx_E = imap.GetFlatIdx(cr::E::name(), false); parthenon::par_for( DEFAULT_LOOP_PATTERN, "FixFluxes::x1", DevExecSpace(), kb.s, kb.e, jb.s, jb.e, ib.s, ib.s, KOKKOS_LAMBDA(const int k, const int j, const int i) { @@ -782,11 +786,14 @@ TaskStatus FixFluxes(MeshBlockData *rc) { } else if (ox1_bc == "reflect") { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( - std::vector({c::density::name(), c::energy::name(), cr::E}), - std::vector({c::density::name(), c::energy::name(), cr::E}), imap); + std::vector( + {c::density::name(), c::energy::name(), cr::E::name()}), + std::vector( + {c::density::name(), c::energy::name(), cr::E::name()}), + imap); const auto crho = imap[c::density::name()].first; const auto cener = imap[c::energy::name()].first; - auto idx_E = imap.GetFlatIdx(cr::E, false); + auto idx_E = imap.GetFlatIdx(cr::E::name(), false); parthenon::par_for( DEFAULT_LOOP_PATTERN, "FixFluxes::x1", DevExecSpace(), kb.s, kb.e, jb.s, jb.e, ib.e + 1, ib.e + 1, KOKKOS_LAMBDA(const int k, const int j, const int i) { @@ -819,18 +826,18 @@ TaskStatus FixFluxes(MeshBlockData *rc) { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( std::vector({c::density::name(), c::energy::name(), - c::momentum::name(), c::bfield::name(), cr::E, - cr::F}), + c::momentum::name(), c::bfield::name(), cr::E::name(), + cr::F::name()}), std::vector({c::density::name(), c::energy::name(), - c::momentum::name(), c::bfield::name(), cr::E, - cr::F}), + c::momentum::name(), c::bfield::name(), cr::E::name(), + cr::F::name()}), imap); const auto crho = imap[c::density::name()].first; const auto cener = imap[c::energy::name()].first; auto idx_cb = imap.GetFlatIdx(c::bfield::name(), false); auto idx_cmom = imap.GetFlatIdx(c::momentum::name()); - auto idx_E = imap.GetFlatIdx(cr::E, false); - auto idx_F = imap.GetFlatIdx(cr::F, false); + auto idx_E = imap.GetFlatIdx(cr::E::name(), false); + auto idx_F = imap.GetFlatIdx(cr::F::name(), false); parthenon::par_for( DEFAULT_LOOP_PATTERN, "FixFluxes::x2", DevExecSpace(), kb.s, kb.e, jb.s, jb.s, ib.s, ib.e, KOKKOS_LAMBDA(const int k, const int j, const int i) { @@ -856,17 +863,17 @@ TaskStatus FixFluxes(MeshBlockData *rc) { } else if (ix2_bc == "reflect") { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( - std::vector( - {c::density::name(), c::energy::name(), c::momentum::name(), cr::E, cr::F}), - std::vector( - {c::density::name(), c::energy::name(), c::momentum::name(), cr::E, cr::F}), + std::vector({c::density::name(), c::energy::name(), + c::momentum::name(), cr::E::name(), cr::F::name()}), + std::vector({c::density::name(), c::energy::name(), + c::momentum::name(), cr::E::name(), cr::F::name()}), imap); const auto crho = imap[c::density::name()].first; const auto cener = imap[c::energy::name()].first; auto idx_cb = imap.GetFlatIdx(c::bfield::name(), false); auto idx_cmom = imap.GetFlatIdx(c::momentum::name()); - auto idx_E = imap.GetFlatIdx(cr::E, false); - auto idx_F = imap.GetFlatIdx(cr::F, false); + auto idx_E = imap.GetFlatIdx(cr::E::name(), false); + auto idx_F = imap.GetFlatIdx(cr::F::name(), false); parthenon::par_for( DEFAULT_LOOP_PATTERN, "FixFluxes::x2", DevExecSpace(), kb.s, kb.e, jb.s, jb.s, ib.s, ib.e, KOKKOS_LAMBDA(const int k, const int j, const int i) { @@ -902,18 +909,18 @@ TaskStatus FixFluxes(MeshBlockData *rc) { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( std::vector({c::density::name(), c::energy::name(), - c::momentum::name(), c::bfield::name(), cr::E, - cr::F}), + c::momentum::name(), c::bfield::name(), cr::E::name(), + cr::F::name()}), std::vector({c::density::name(), c::energy::name(), - c::momentum::name(), c::bfield::name(), cr::E, - cr::F}), + c::momentum::name(), c::bfield::name(), cr::E::name(), + cr::F::name()}), imap); const auto crho = imap[c::density::name()].first; const auto cener = imap[c::energy::name()].first; auto idx_cb = imap.GetFlatIdx(c::bfield::name(), false); auto idx_cmom = imap.GetFlatIdx(c::momentum::name()); - auto idx_E = imap.GetFlatIdx(cr::E, false); - auto idx_F = imap.GetFlatIdx(cr::F, false); + auto idx_E = imap.GetFlatIdx(cr::E::name(), false); + auto idx_F = imap.GetFlatIdx(cr::F::name(), false); parthenon::par_for( DEFAULT_LOOP_PATTERN, "FixFluxes::x2", DevExecSpace(), kb.s, kb.e, jb.e + 1, jb.e + 1, ib.s, ib.e, KOKKOS_LAMBDA(const int k, const int j, const int i) { @@ -939,17 +946,17 @@ TaskStatus FixFluxes(MeshBlockData *rc) { } else if (ox2_bc == "reflect") { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( - std::vector( - {c::density::name(), c::energy::name(), c::momentum::name(), cr::E, cr::F}), - std::vector( - {c::density::name(), c::energy::name(), c::momentum::name(), cr::E, cr::F}), + std::vector({c::density::name(), c::energy::name(), + c::momentum::name(), cr::E::name(), cr::F::name()}), + std::vector({c::density::name(), c::energy::name(), + c::momentum::name(), cr::E::name(), cr::F::name()}), imap); const auto crho = imap[c::density::name()].first; const auto cener = imap[c::energy::name()].first; auto idx_cmom = imap.GetFlatIdx(c::momentum::name()); auto idx_cb = imap.GetFlatIdx(c::bfield::name(), false); - auto idx_E = imap.GetFlatIdx(cr::E, false); - auto idx_F = imap.GetFlatIdx(cr::F, false); + auto idx_E = imap.GetFlatIdx(cr::E::name(), false); + auto idx_F = imap.GetFlatIdx(cr::F::name(), false); parthenon::par_for( DEFAULT_LOOP_PATTERN, "FixFluxes::x2", DevExecSpace(), kb.s, kb.e, jb.e + 1, jb.e + 1, ib.s, ib.e, KOKKOS_LAMBDA(const int k, const int j, const int i) { @@ -986,11 +993,12 @@ TaskStatus FixFluxes(MeshBlockData *rc) { } else if (pmb->boundary_flag[BoundaryFace::inner_x3] == BoundaryFlag::reflect) { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( - std::vector({c::density::name(), c::energy::name(), cr::E}), - std::vector({c::density::name(), c::energy::name(), cr::E}), imap); + std::vector({c::density::name(), c::energy::name(), cr::E::name()}), + std::vector({c::density::name(), c::energy::name(), cr::E::name()}), + imap); const auto crho = imap[c::density::name()].first; const auto cener = imap[c::energy::name()].first; - auto idx_E = imap.GetFlatIdx(cr::E, false); + auto idx_E = imap.GetFlatIdx(cr::E::name(), false); parthenon::par_for( DEFAULT_LOOP_PATTERN, "FixFluxes::x3", DevExecSpace(), kb.s, kb.s, jb.s, jb.e, ib.s, ib.e, KOKKOS_LAMBDA(const int k, const int j, const int i) { @@ -1017,11 +1025,12 @@ TaskStatus FixFluxes(MeshBlockData *rc) { } else if (pmb->boundary_flag[BoundaryFace::outer_x3] == BoundaryFlag::reflect) { PackIndexMap imap; auto v = rc->PackVariablesAndFluxes( - std::vector({c::density::name(), c::energy::name(), cr::E}), - std::vector({c::density::name(), c::energy::name(), cr::E}), imap); + std::vector({c::density::name(), c::energy::name(), cr::E::name()}), + std::vector({c::density::name(), c::energy::name(), cr::E::name()}), + imap); const auto crho = imap[c::density::name()].first; const auto cener = imap[c::energy::name()].first; - auto idx_E = imap.GetFlatIdx(cr::E, false); + auto idx_E = imap.GetFlatIdx(cr::E::name(), false); parthenon::par_for( DEFAULT_LOOP_PATTERN, "FixFluxes::x3", DevExecSpace(), kb.e + 1, kb.e + 1, jb.s, jb.e, ib.s, ib.e, KOKKOS_LAMBDA(const int k, const int j, const int i) { diff --git a/src/fixup/fixup_c2p.cpp b/src/fixup/fixup_c2p.cpp index 795dd7475..eb9bf5c2b 100644 --- a/src/fixup/fixup_c2p.cpp +++ b/src/fixup/fixup_c2p.cpp @@ -70,17 +70,17 @@ TaskStatus ConservedToPrimitiveFixupImpl(T *rc) { c::ye::name(), p::pressure::name(), p::temperature::name(), - p::gamma1, - impl::cell_signal_speed, - impl::fail, - ir::c2pfail, - ir::tilPi, - pr::J, - pr::H, - cr::E, - cr::F, - ir::xi, - ir::phi}); + p::gamma1::name(), + impl::cell_signal_speed::name(), + impl::fail::name(), + ir::c2pfail::name(), + ir::tilPi::name(), + pr::J::name(), + pr::H::name(), + cr::E::name(), + cr::F::name(), + ir::xi::name(), + ir::phi::name()}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); @@ -95,24 +95,24 @@ TaskStatus ConservedToPrimitiveFixupImpl(T *rc) { const int ceng = imap[c::energy::name()].first; const int prs = imap[p::pressure::name()].first; const int tmp = imap[p::temperature::name()].first; - 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; + const int gm1 = imap[p::gamma1::name()].first; + const int slo = imap[impl::cell_signal_speed::name()].first; + const int shi = imap[impl::cell_signal_speed::name()].second; const int pb_lo = imap[p::bfield::name()].first; const int pb_hi = imap[p::bfield::name()].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; + int ifail = imap[impl::fail::name()].first; + int irfail = imap[ir::c2pfail::name()].first; - auto idx_E = imap.GetFlatIdx(cr::E, false); - auto idx_F = imap.GetFlatIdx(cr::F, false); - auto idx_J = imap.GetFlatIdx(pr::J, false); - auto idx_H = imap.GetFlatIdx(pr::H, false); - auto iTilPi = imap.GetFlatIdx(ir::tilPi, false); - auto iXi = imap.GetFlatIdx(ir::xi, false); - auto iPhi = imap.GetFlatIdx(ir::phi, false); + auto idx_E = imap.GetFlatIdx(cr::E::name(), false); + auto idx_F = imap.GetFlatIdx(cr::F::name(), false); + auto idx_J = imap.GetFlatIdx(pr::J::name(), false); + auto idx_H = imap.GetFlatIdx(pr::H::name(), false); + auto iTilPi = imap.GetFlatIdx(ir::tilPi::name(), false); + auto iXi = imap.GetFlatIdx(ir::xi::name(), false); + auto iPhi = imap.GetFlatIdx(ir::phi::name(), false); const bool rad_active = rad_pkg->Param("active"); const int num_species = rad_active ? rad_pkg->Param("num_species") : 0; diff --git a/src/fixup/fixup_radc2p.cpp b/src/fixup/fixup_radc2p.cpp index 35881a099..11d4ed660 100644 --- a/src/fixup/fixup_radc2p.cpp +++ b/src/fixup/fixup_radc2p.cpp @@ -64,8 +64,9 @@ TaskStatus RadConservedToPrimitiveFixupImpl(T *rc) { if (!enable_c2p_fixup || !update_rad) return TaskStatus::complete; const std::vector vars({p::velocity::name(), p::ye::name(), c::ye::name(), - pr::J, pr::H, cr::E, cr::F, ir::tilPi, ir::c2pfail, - impl::fail}); + pr::J::name(), pr::H::name(), cr::E::name(), + cr::F::name(), ir::tilPi::name(), + ir::c2pfail::name(), impl::fail::name()}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); @@ -73,13 +74,13 @@ TaskStatus RadConservedToPrimitiveFixupImpl(T *rc) { auto idx_pvel = imap.GetFlatIdx(p::velocity::name()); 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); - auto idx_F = imap.GetFlatIdx(cr::F, false); - int ifluidfail = imap[impl::fail].first; - int iradfail = imap[ir::c2pfail].first; - auto iTilPi = imap.GetFlatIdx(ir::tilPi, false); + auto idx_J = imap.GetFlatIdx(pr::J::name(), false); + auto idx_H = imap.GetFlatIdx(pr::H::name(), false); + auto idx_E = imap.GetFlatIdx(cr::E::name(), false); + auto idx_F = imap.GetFlatIdx(cr::F::name(), false); + int ifluidfail = imap[impl::fail::name()].first; + int iradfail = imap[ir::c2pfail::name()].first; + auto iTilPi = imap.GetFlatIdx(ir::tilPi::name(), false); bool report_c2p_fails = fix_pkg->Param("report_c2p_fails"); if (report_c2p_fails) { diff --git a/src/fixup/fixup_src.cpp b/src/fixup/fixup_src.cpp index cd70e21f2..c96eacded 100644 --- a/src/fixup/fixup_src.cpp +++ b/src/fixup/fixup_src.cpp @@ -77,8 +77,9 @@ TaskStatus SourceFixupImpl(T *rc) { const std::vector vars( {p::density::name(), c::density::name(), p::velocity::name(), c::momentum::name(), p::energy::name(), c::energy::name(), p::bfield::name(), p::ye::name(), - c::ye::name(), p::pressure::name(), p::temperature::name(), p::gamma1, pr::J, - pr::H, cr::E, cr::F, impl::cell_signal_speed, ir::srcfail, ir::tilPi}); + c::ye::name(), p::pressure::name(), p::temperature::name(), p::gamma1::name(), + pr::J::name(), pr::H::name(), cr::E::name(), cr::F::name(), + impl::cell_signal_speed::name(), ir::srcfail::name(), ir::tilPi::name()}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); @@ -91,19 +92,19 @@ TaskStatus SourceFixupImpl(T *rc) { const int ceng = imap[c::energy::name()].first; const int prs = imap[p::pressure::name()].first; const int tmp = imap[p::temperature::name()].first; - 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; + const int gm1 = imap[p::gamma1::name()].first; + const int slo = imap[impl::cell_signal_speed::name()].first; + const int shi = imap[impl::cell_signal_speed::name()].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); - auto idx_H = imap.GetFlatIdx(pr::H); - auto idx_E = imap.GetFlatIdx(cr::E); - auto idx_F = imap.GetFlatIdx(cr::F); - int ifail = imap[ir::srcfail].first; - auto iTilPi = imap.GetFlatIdx(ir::tilPi, false); + auto idx_J = imap.GetFlatIdx(pr::J::name()); + auto idx_H = imap.GetFlatIdx(pr::H::name()); + auto idx_E = imap.GetFlatIdx(cr::E::name()); + auto idx_F = imap.GetFlatIdx(cr::F::name()); + int ifail = imap[ir::srcfail::name()].first; + auto iTilPi = imap.GetFlatIdx(ir::tilPi::name(), false); bool report_source_fails = fix_pkg->Param("report_source_fails"); if (report_source_fails) { diff --git a/src/fluid/con2prim.hpp b/src/fluid/con2prim.hpp index 605c90e3f..d5cda7857 100644 --- a/src/fluid/con2prim.hpp +++ b/src/fluid/con2prim.hpp @@ -147,10 +147,10 @@ class ConToPrim { cye(imap[fluid_cons::ye::name()].second), prs(imap[fluid_prim::pressure::name()].first), tmp(imap[fluid_prim::temperature::name()].first), - sig_lo(imap[internal_variables::cell_signal_speed].first), - sig_hi(imap[internal_variables::cell_signal_speed].second), - gm1(imap[fluid_prim::gamma1].first), - scr_lo(imap[internal_variables::c2p_scratch].first), rel_tolerance(tol), + sig_lo(imap[internal_variables::cell_signal_speed::name()].first), + sig_hi(imap[internal_variables::cell_signal_speed::name()].second), + gm1(imap[fluid_prim::gamma1::name()].first), + scr_lo(imap[internal_variables::c2p_scratch::name()].first), rel_tolerance(tol), max_iter(max_iterations) {} std::vector Vars() { @@ -160,8 +160,8 @@ class ConToPrim { fluid_prim::energy::name(), fluid_cons::energy::name(), fluid_prim::bfield::name(), fluid_cons::bfield::name(), fluid_prim::ye::name(), fluid_cons::ye::name(), fluid_prim::pressure::name(), - fluid_prim::temperature::name(), internal_variables::cell_signal_speed, - fluid_prim::gamma1, internal_variables::c2p_scratch}); + fluid_prim::temperature::name(), internal_variables::cell_signal_speed::name(), + fluid_prim::gamma1::name(), internal_variables::c2p_scratch::name()}); } template diff --git a/src/fluid/con2prim_robust.hpp b/src/fluid/con2prim_robust.hpp index dc5c21e95..79db255a9 100644 --- a/src/fluid/con2prim_robust.hpp +++ b/src/fluid/con2prim_robust.hpp @@ -244,10 +244,10 @@ class ConToPrim { cye(imap[fluid_cons::ye::name()].second), prs(imap[fluid_prim::pressure::name()].first), tmp(imap[fluid_prim::temperature::name()].first), - sig_lo(imap[internal_variables::cell_signal_speed].first), - sig_hi(imap[internal_variables::cell_signal_speed].second), - gm1(imap[fluid_prim::gamma1].first), - c2p_mu(imap[internal_variables::c2p_mu].first), rel_tolerance(tol), + sig_lo(imap[internal_variables::cell_signal_speed::name()].first), + sig_hi(imap[internal_variables::cell_signal_speed::name()].second), + gm1(imap[fluid_prim::gamma1::name()].first), + c2p_mu(imap[internal_variables::c2p_mu::name()].first), rel_tolerance(tol), max_iter(max_iterations), h0sq_(1.0), floor_scale_fac_(floor_scale_fac), fail_on_floors_(fail_on_floors), fail_on_ceilings_(fail_on_ceilings) {} @@ -258,8 +258,8 @@ class ConToPrim { fluid_prim::energy::name(), fluid_cons::energy::name(), fluid_prim::bfield::name(), fluid_cons::bfield::name(), fluid_prim::ye::name(), fluid_cons::ye::name(), fluid_prim::pressure::name(), - fluid_prim::temperature::name(), internal_variables::cell_signal_speed, - fluid_prim::gamma1, internal_variables::c2p_mu}); + fluid_prim::temperature::name(), internal_variables::cell_signal_speed::name(), + fluid_prim::gamma1::name(), internal_variables::c2p_mu::name()}); } template diff --git a/src/fluid/fluid.cpp b/src/fluid/fluid.cpp index 635dd4834..f870c6fa3 100644 --- a/src/fluid/fluid.cpp +++ b/src/fluid/fluid.cpp @@ -195,20 +195,20 @@ std::shared_ptr Initialize(ParameterInput *pin) { if (mhd) { physics->AddField(p::bfield::name(), mprim_threev); if (ndim == 2) { - physics->AddField(impl::emf, mprim_scalar); + physics->AddField(impl::emf::name(), mprim_scalar); } else if (ndim == 3) { - physics->AddField(impl::emf, mprim_threev); + physics->AddField(impl::emf::name(), mprim_threev); } - physics->AddField(diag::divb, mprim_scalar); + physics->AddField(diag::divb::name(), mprim_scalar); } physics->AddField(p::pressure::name(), mprim_scalar); physics->AddField(p::temperature::name(), mprim_scalar); - physics->AddField(p::gamma1, mprim_scalar); + physics->AddField(p::gamma1::name(), mprim_scalar); if (ye) { physics->AddField(p::ye::name(), mprim_scalar); } if (pin->GetOrAddString("fluid", "c2p_method", "robust") == "robust") { - physics->AddField(impl::c2p_mu, mprim_scalar); + physics->AddField(impl::c2p_mu::name(), mprim_scalar); } // Just want constant primitive fields around to serve as // background if we are not evolving the fluid, don't need @@ -220,7 +220,7 @@ std::shared_ptr Initialize(ParameterInput *pin) { // this fail flag should really be an enum or something // but parthenon doesn't yet support that kind of thing - physics->AddField(impl::fail, mprim_scalar); + physics->AddField(impl::fail::name(), mprim_scalar); // add the conserved variables physics->AddField(c::density::name(), mcons_scalar); @@ -247,11 +247,11 @@ std::shared_ptr Initialize(ParameterInput *pin) { Metadata mdiv = Metadata({Metadata::Cell, Metadata::Intensive, Metadata::Vector, Metadata::Derived, Metadata::OneCopy}, five_vec); - physics->AddField(diag::divf, mdiv); + physics->AddField(diag::divf::name(), mdiv); Metadata mdiag = Metadata({Metadata::Cell, Metadata::Intensive, Metadata::Vector, Metadata::Derived, Metadata::OneCopy}, five_vec); - physics->AddField(diag::src_terms, mdiag); + physics->AddField(diag::src_terms::name(), mdiag); #endif // set up the arrays for left and right states @@ -269,7 +269,7 @@ std::shared_ptr Initialize(ParameterInput *pin) { if (ye) riemann::FluxState::FluxVars(c::ye::name()); // add some extra fields for reconstruction - rvars = std::vector({p::pressure::name(), p::gamma1}); + rvars = std::vector({p::pressure::name(), p::gamma1::name()}); riemann::FluxState::ReconVars(rvars); auto recon_vars = riemann::FluxState::ReconVars(); @@ -287,19 +287,19 @@ std::shared_ptr Initialize(ParameterInput *pin) { std::vector recon_shape({nrecon, ndim}); Metadata mrecon = Metadata({Metadata::Cell, Metadata::Derived, Metadata::OneCopy}, recon_shape); - physics->AddField(impl::ql, mrecon); - physics->AddField(impl::qr, mrecon); + physics->AddField(impl::ql::name(), mrecon); + physics->AddField(impl::qr::name(), mrecon); std::vector signal_shape(1, ndim); Metadata msignal = Metadata({Metadata::Cell, Metadata::Derived, Metadata::OneCopy}, signal_shape); - physics->AddField(impl::face_signal_speed, msignal); - physics->AddField(impl::cell_signal_speed, msignal); + physics->AddField(impl::face_signal_speed::name(), msignal); + physics->AddField(impl::cell_signal_speed::name(), msignal); std::vector c2p_scratch_size(1, 5); Metadata c2p_meta = Metadata({Metadata::Cell, Metadata::Derived, Metadata::OneCopy}, c2p_scratch_size); - physics->AddField(impl::c2p_scratch, c2p_meta); + physics->AddField(impl::c2p_scratch::name(), c2p_meta); // Reductions // By default compute integrated value of scalar conserved vars @@ -355,8 +355,8 @@ TaskStatus PrimitiveToConservedRegion(MeshBlockData *rc, const IndexRange const std::vector vars( {p::density::name(), c::density::name(), p::velocity::name(), c::momentum::name(), p::energy::name(), c::energy::name(), p::bfield::name(), c::bfield::name(), - p::ye::name(), c::ye::name(), p::pressure::name(), p::gamma1, - impl::cell_signal_speed}); + p::ye::name(), c::ye::name(), p::pressure::name(), p::gamma1::name(), + impl::cell_signal_speed::name()}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); @@ -370,15 +370,15 @@ TaskStatus PrimitiveToConservedRegion(MeshBlockData *rc, const IndexRange const int peng = imap[p::energy::name()].first; const int ceng = imap[c::energy::name()].first; const int prs = imap[p::pressure::name()].first; - const int gm1 = imap[p::gamma1].first; + const int gm1 = imap[p::gamma1::name()].first; const int pb_lo = imap[p::bfield::name()].first; 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::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; + const int sig_lo = imap[impl::cell_signal_speed::name()].first; + const int sig_hi = imap[impl::cell_signal_speed::name()].second; auto geom = Geometry::GetCoordinateSystem(rc); auto coords = pmb->coords; @@ -482,7 +482,7 @@ TaskStatus ConservedToPrimitiveRobust(T *rc, const IndexRange &ib, const IndexRa auto coords = pmb->coords; // TODO(JCD): move the setting of this into the solver so we can call this on MeshData - auto fail = rc->Get(internal_variables::fail).data; + auto fail = rc->Get(internal_variables::fail::name()).data; parthenon::par_for( DEFAULT_LOOP_PATTERN, "ConToPrim::Solve", DevExecSpace(), 0, invert.NumBlocks() - 1, @@ -514,7 +514,7 @@ TaskStatus ConservedToPrimitiveClassic(T *rc, const IndexRange &ib, const IndexR StateDescriptor *eos_pkg = pmesh->packages.Get("eos").get(); auto eos = eos_pkg->Param("d.EOS"); auto geom = Geometry::GetCoordinateSystem(rc); - auto fail = rc->Get(internal_variables::fail).data; + auto fail = rc->Get(internal_variables::fail::name()).data; // breaking con2prim into 3 kernels seems more performant. WHY? // if we can combine them, we can get rid of the mesh sized scratch array @@ -560,14 +560,14 @@ TaskStatus CalculateFluidSourceTerms(MeshBlockData *rc, std::vector vars( {fluid_cons::momentum::name(), fluid_cons::energy::name()}); #if SET_FLUX_SRC_DIAGS - vars.push_back(diagnostic_variables::src_terms); + vars.push_back(diagnostic_variables::src_terms::name()); #endif PackIndexMap imap; auto src = rc_src->PackVariables(vars, imap); const int cmom_lo = imap[fluid_cons::momentum::name()].first; const int cmom_hi = imap[fluid_cons::momentum::name()].second; const int ceng = imap[fluid_cons::energy::name()].first; - const int idiag = imap[diagnostic_variables::src_terms].first; + const int idiag = imap[diagnostic_variables::src_terms::name()].first; auto tmunu = BuildStressEnergyTensor(rc); auto geom = Geometry::GetCoordinateSystem(rc); @@ -646,7 +646,7 @@ TaskStatus CalculateFluxes(MeshBlockData *rc) { return TaskStatus::complete; auto flux = riemann::FluxState(rc); - auto sig = rc->Get(internal_variables::face_signal_speed).data; + auto sig = rc->Get(internal_variables::face_signal_speed::name()).data; IndexRange ib = rc->GetBoundsI(IndexDomain::interior); IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); @@ -770,7 +770,7 @@ TaskStatus FluxCT(MeshBlockData *rc) { auto f1 = rc->Get(fluid_cons::bfield::name()).flux[X1DIR]; auto f2 = rc->Get(fluid_cons::bfield::name()).flux[X2DIR]; auto f3 = rc->Get(fluid_cons::bfield::name()).flux[X3DIR]; - auto emf = rc->Get(internal_variables::emf).data; + auto emf = rc->Get(internal_variables::emf::name()).data; if (ndim == 2) { parthenon::par_for( @@ -829,7 +829,7 @@ TaskStatus CalculateDivB(MeshBlockData *rc) { // This is the problem for doing things with meshblock packs auto coords = pmb->coords; auto b = rc->Get(fluid_cons::bfield::name()).data; - auto divb = rc->Get(diagnostic_variables::divb).data; + auto divb = rc->Get(diagnostic_variables::divb::name()).data; if (ndim == 2) { // todo(jcd): these are supposed to be node centered, and this misses the // high boundaries @@ -883,9 +883,9 @@ Real EstimateTimestepBlock(MeshBlockData *rc) { auto &pars = pmb->packages.Get("fluid")->AllParams(); Real min_dt; - auto csig = rc->Get(internal_variables::cell_signal_speed).data; + auto csig = rc->Get(internal_variables::cell_signal_speed::name()).data; if (pars.hasKey("has_face_speeds")) { - auto fsig = rc->Get(internal_variables::face_signal_speed).data; + auto fsig = rc->Get(internal_variables::face_signal_speed::name()).data; pmb->par_reduce( "Hydro::EstimateTimestep::1", kb.s, kb.e, jb.s, jb.e, ib.s, ib.e, KOKKOS_LAMBDA(const int k, const int j, const int i, Real &lmin_dt) { diff --git a/src/fluid/fluid.hpp b/src/fluid/fluid.hpp index b51911bed..3eb63583f 100644 --- a/src/fluid/fluid.hpp +++ b/src/fluid/fluid.hpp @@ -70,21 +70,21 @@ TaskStatus CopyFluxDivergence(T *rc) { std::vector vars({fluid_cons::density::name(), fluid_cons::momentum::name(), fluid_cons::energy::name()}); - vars.push_back(radmoment_cons::E); - vars.push_back(radmoment_cons::F); + vars.push_back(radmoment_cons::E::name()); + vars.push_back(radmoment_cons::F::name()); PackIndexMap imap; auto divf = rc->PackVariables(vars, imap); const int crho = imap[fluid_cons::density::name()].first; const int cmom_lo = imap[fluid_cons::momentum::name()].first; const int cmom_hi = imap[fluid_cons::momentum::name()].second; const int ceng = imap[fluid_cons::energy::name()].first; - auto idx_E = imap.GetFlatIdx(radmoment_cons::E, false); - auto idx_F = imap.GetFlatIdx(radmoment_cons::F, false); + auto idx_E = imap.GetFlatIdx(radmoment_cons::E::name(), false); + auto idx_F = imap.GetFlatIdx(radmoment_cons::F::name(), false); std::vector diag_vars( - {diagnostic_variables::divf, diagnostic_variables::r_divf}); + {diagnostic_variables::divf::name(), diagnostic_variables::r_divf::name()}); PackIndexMap imap_diag; auto diag = rc->PackVariables(diag_vars, imap_diag); - auto idx_r_divf = imap_diag.GetFlatIdx(diagnostic_variables::r_divf, false); + auto idx_r_divf = imap_diag.GetFlatIdx(diagnostic_variables::r_divf::name(), false); StateDescriptor *rad = pm->packages.Get("radiation").get(); int num_species = 0; diff --git a/src/fluid/riemann.hpp b/src/fluid/riemann.hpp index 39597b6b3..c2c43b94d 100644 --- a/src/fluid/riemann.hpp +++ b/src/fluid/riemann.hpp @@ -225,7 +225,7 @@ class FluxState { pb_hi(imap[fluid_prim::bfield::name()].second), pye(imap[fluid_prim::ye::name()].second), prs(imap[fluid_prim::pressure::name()].first), - gm1(imap[fluid_prim::gamma1].first), + gm1(imap[fluid_prim::gamma1::name()].first), crho(imap[fluid_cons::density::name()].first), cmom_lo(imap[fluid_cons::momentum::name()].first), ceng(imap[fluid_cons::energy::name()].first), diff --git a/src/geometry/geometry.cpp b/src/geometry/geometry.cpp index 163891420..2ceff06d0 100644 --- a/src/geometry/geometry.cpp +++ b/src/geometry/geometry.cpp @@ -56,8 +56,8 @@ std::shared_ptr Initialize(ParameterInput *pin) { // TODO(JMM): Make this actual node-centered data when available std::vector node_shape = {dims.nx1 + 1, dims.nx2 + 1, dims.nx3 + 1, 4}; Metadata gcoord_node = Metadata({Metadata::Derived, Metadata::OneCopy}, node_shape); - geometry->AddField(geometric_variables::cell_coords, gcoord_cell); - geometry->AddField(geometric_variables::node_coords, gcoord_node); + geometry->AddField(geometric_variables::cell_coords::name(), gcoord_cell); + geometry->AddField(geometric_variables::node_coords::name(), gcoord_node); // Reductions const bool do_mhd = pin->GetOrAddBoolean("fluid", "mhd", false); diff --git a/src/geometry/geometry_utils.hpp b/src/geometry/geometry_utils.hpp index 6efda739c..3ba0472f9 100644 --- a/src/geometry/geometry_utils.hpp +++ b/src/geometry/geometry_utils.hpp @@ -202,8 +202,8 @@ KOKKOS_INLINE_FUNCTION int SymSize() { namespace impl { template void SetGeometryDefault(Data *rc, const System &system) { - std::vector coord_names = {geometric_variables::cell_coords, - geometric_variables::node_coords}; + std::vector coord_names = {geometric_variables::cell_coords::name(), + geometric_variables::node_coords::name()}; PackIndexMap imap; auto pack = rc->PackVariables(coord_names, imap); PARTHENON_REQUIRE(imap["g.c.coord"].second >= 0, "g.c.coord exists"); diff --git a/src/pgen/advection.cpp b/src/pgen/advection.cpp index 6bda58ab3..c67a5caf9 100644 --- a/src/pgen/advection.cpp +++ b/src/pgen/advection.cpp @@ -26,11 +26,12 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); 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::name(), fluid_prim::pressure::name(), - fluid_prim::temperature::name(), fluid_prim::gamma1}, - imap); + auto v = + rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), + fluid_prim::energy::name(), fluid_prim::bfield::name(), + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1::name()}, + imap); const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity::name()].first; @@ -41,7 +42,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int iye = imap[fluid_prim::ye::name()].second; const int iprs = imap[fluid_prim::pressure::name()].first; const int itmp = imap[fluid_prim::temperature::name()].first; - const int igm1 = imap[fluid_prim::gamma1].first; + const int igm1 = imap[fluid_prim::gamma1::name()].first; const Real rho = pin->GetOrAddReal("advection", "rho", 1.0); const Real u = pin->GetOrAddReal("advection", "u", 1.0); diff --git a/src/pgen/blandford_mckee.cpp b/src/pgen/blandford_mckee.cpp index fbeae64bd..3323c1e84 100644 --- a/src/pgen/blandford_mckee.cpp +++ b/src/pgen/blandford_mckee.cpp @@ -31,11 +31,12 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); 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::name(), fluid_prim::pressure::name(), - fluid_prim::temperature::name(), fluid_prim::gamma1}, - imap); + auto v = + rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), + fluid_prim::energy::name(), fluid_prim::bfield::name(), + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1::name()}, + imap); const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity::name()].first; @@ -46,7 +47,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int iye = imap[fluid_prim::ye::name()].second; const int iprs = imap[fluid_prim::pressure::name()].first; const int itmp = imap[fluid_prim::temperature::name()].first; - const int igm1 = imap[fluid_prim::gamma1].first; + const int igm1 = imap[fluid_prim::gamma1::name()].first; const Real wshock = pin->GetOrAddReal("blandford_mckee", "lorentz_shock", 7); Real rescale = std::sqrt(1 - (1 / (wshock * wshock))); diff --git a/src/pgen/bondi.cpp b/src/pgen/bondi.cpp index a2c2eea8d..d52a77781 100644 --- a/src/pgen/bondi.cpp +++ b/src/pgen/bondi.cpp @@ -91,11 +91,12 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto rc = pmb->meshblock_data.Get().get(); 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::name(), fluid_prim::pressure::name(), - fluid_prim::temperature::name(), fluid_prim::gamma1}, - imap); + auto v = + rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), + fluid_prim::energy::name(), fluid_prim::bfield::name(), + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1::name()}, + imap); const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity::name()].first; @@ -106,7 +107,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int iye = imap[fluid_prim::ye::name()].second; const int iprs = imap[fluid_prim::pressure::name()].first; const int itmp = imap[fluid_prim::temperature::name()].first; - const int igm1 = imap[fluid_prim::gamma1].first; + const int igm1 = imap[fluid_prim::gamma1::name()].first; // this only works with ideal gases const std::string eos_type = pin->GetString("eos", "type"); diff --git a/src/pgen/friedmann.cpp b/src/pgen/friedmann.cpp index 1722f0ec4..561361eda 100644 --- a/src/pgen/friedmann.cpp +++ b/src/pgen/friedmann.cpp @@ -36,18 +36,19 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); 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::name(), fluid_prim::pressure::name(), - fluid_prim::temperature::name(), fluid_prim::gamma1}, - imap); + auto v = + rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), + fluid_prim::energy::name(), fluid_prim::bfield::name(), + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1::name()}, + 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::name()].second; const int iprs = imap[fluid_prim::pressure::name()].first; const int itmp = imap[fluid_prim::temperature::name()].first; - const int igm1 = imap[fluid_prim::gamma1].first; + const int igm1 = imap[fluid_prim::gamma1::name()].first; const Real rho = pin->GetOrAddReal("friedmann", "rho", 1.0); const Real eps = pin->GetOrAddReal("friedmann", "sie", 1.0); diff --git a/src/pgen/homogeneous_sphere.cpp b/src/pgen/homogeneous_sphere.cpp index bd76f2458..a02e7c914 100644 --- a/src/pgen/homogeneous_sphere.cpp +++ b/src/pgen/homogeneous_sphere.cpp @@ -28,18 +28,19 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = rc->PackVariables( - std::vector( - {radmoment_prim::J, radmoment_prim::H, fluid_prim::density::name(), - fluid_prim::temperature::name(), fluid_prim::velocity::name(), - radmoment_internal::xi, radmoment_internal::phi}), - imap); - - auto idJ = imap.GetFlatIdx(radmoment_prim::J); - auto idH = imap.GetFlatIdx(radmoment_prim::H); + auto v = + rc->PackVariables(std::vector( + {radmoment_prim::J::name(), radmoment_prim::H::name(), + fluid_prim::density::name(), fluid_prim::temperature::name(), + fluid_prim::velocity::name(), radmoment_internal::xi::name(), + radmoment_internal::phi::name()}), + imap); + + auto idJ = imap.GetFlatIdx(radmoment_prim::J::name()); + auto idH = imap.GetFlatIdx(radmoment_prim::H::name()); auto idv = imap.GetFlatIdx(fluid_prim::velocity::name()); - auto ixi = imap.GetFlatIdx(radmoment_internal::xi); - auto iphi = imap.GetFlatIdx(radmoment_internal::phi); + auto ixi = imap.GetFlatIdx(radmoment_internal::xi::name()); + auto iphi = imap.GetFlatIdx(radmoment_internal::phi::name()); const int prho = imap[fluid_prim::density::name()].first; const int pT = imap[fluid_prim::temperature::name()].first; diff --git a/src/pgen/kh.cpp b/src/pgen/kh.cpp index 2e26ca501..6122219bc 100644 --- a/src/pgen/kh.cpp +++ b/src/pgen/kh.cpp @@ -26,11 +26,12 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); 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::name(), fluid_prim::pressure::name(), - fluid_prim::temperature::name(), fluid_prim::gamma1}, - imap); + auto v = + rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), + fluid_prim::energy::name(), fluid_prim::bfield::name(), + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1::name()}, + imap); const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity::name()].first; @@ -41,7 +42,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int iye = imap[fluid_prim::ye::name()].second; const int iprs = imap[fluid_prim::pressure::name()].first; const int itmp = imap[fluid_prim::temperature::name()].first; - const int igm1 = imap[fluid_prim::gamma1].first; + const int igm1 = imap[fluid_prim::gamma1::name()].first; const Real rho0 = pin->GetOrAddReal("kelvin_helmholtz", "rho0", 1.0); const Real rho1 = pin->GetOrAddReal("kelvin_helmholtz", "rho1", 1.0); diff --git a/src/pgen/leptoneq.cpp b/src/pgen/leptoneq.cpp index 4eb77c642..911d177f8 100644 --- a/src/pgen/leptoneq.cpp +++ b/src/pgen/leptoneq.cpp @@ -33,7 +33,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { PackIndexMap imap; auto v = rc->PackVariables({p::density::name(), p::velocity::name(), p::energy::name(), p::ye::name(), p::pressure::name(), p::temperature::name(), - p::gamma1}, + p::gamma1::name()}, imap); const int irho = imap[p::density::name()].first; @@ -43,7 +43,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int iye = imap[p::ye::name()].first; const int iprs = imap[p::pressure::name()].first; const int itmp = imap[p::temperature::name()].first; - const int igm1 = imap[p::gamma1].first; + const int igm1 = imap[p::gamma1::name()].first; IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::entire); IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::entire); diff --git a/src/pgen/linear_modes.cpp b/src/pgen/linear_modes.cpp index 3eddb41a7..8b1067c3b 100644 --- a/src/pgen/linear_modes.cpp +++ b/src/pgen/linear_modes.cpp @@ -46,8 +46,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { std::vector vars({fluid_prim::density::name(), fluid_prim::velocity::name(), fluid_prim::energy::name(), fluid_prim::bfield::name(), fluid_prim::pressure::name(), - fluid_prim::temperature::name(), fluid_prim::gamma1, - fluid_prim::ye::name()}); + fluid_prim::temperature::name(), + fluid_prim::gamma1::name(), fluid_prim::ye::name()}); auto v = rc->PackVariables(vars, imap); const int irho = imap[fluid_prim::density::name()].first; @@ -58,7 +58,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int ib_hi = imap[fluid_prim::bfield::name()].second; const int iprs = imap[fluid_prim::pressure::name()].first; const int itmp = imap[fluid_prim::temperature::name()].first; - const int igm1 = imap[fluid_prim::gamma1].first; + const int igm1 = imap[fluid_prim::gamma1::name()].first; const int iye = imap[fluid_prim::ye::name()].second; const int nv = ivhi - ivlo + 1; diff --git a/src/pgen/p2c2p.cpp b/src/pgen/p2c2p.cpp index 897b1e96e..5c46b8b3e 100644 --- a/src/pgen/p2c2p.cpp +++ b/src/pgen/p2c2p.cpp @@ -73,11 +73,12 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); 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::name(), fluid_prim::pressure::name(), - fluid_prim::temperature::name(), fluid_prim::gamma1}, - imap); + auto v = + rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), + fluid_prim::energy::name(), fluid_prim::bfield::name(), + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1::name()}, + imap); const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity::name()].first; @@ -87,7 +88,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int ib_hi = imap[fluid_prim::bfield::name()].second; const int iprs = imap[fluid_prim::pressure::name()].first; const int itmp = imap[fluid_prim::temperature::name()].first; - const int igm1 = imap[fluid_prim::gamma1].first; + const int igm1 = imap[fluid_prim::gamma1::name()].first; IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::entire); IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::entire); diff --git a/src/pgen/progenitor.cpp b/src/pgen/progenitor.cpp index 511de54c9..8b917707c 100644 --- a/src/pgen/progenitor.cpp +++ b/src/pgen/progenitor.cpp @@ -35,11 +35,12 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto geom = Geometry::GetCoordinateSystem(rc.get()); 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::name(), fluid_prim::pressure::name(), - fluid_prim::temperature::name(), fluid_prim::gamma1}, - imap); + auto v = + rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), + fluid_prim::energy::name(), fluid_prim::bfield::name(), + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1::name()}, + imap); const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity::name()].first; const int ivhi = imap[fluid_prim::velocity::name()].second; @@ -49,7 +50,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int iye = imap[fluid_prim::ye::name()].second; const int iprs = imap[fluid_prim::pressure::name()].first; const int itmp = imap[fluid_prim::temperature::name()].first; - const int igm1 = imap[fluid_prim::gamma1].first; + const int igm1 = imap[fluid_prim::gamma1::name()].first; auto &coords = pmb->coords; auto pmesh = pmb->pmy_mesh; diff --git a/src/pgen/radiation_advection.cpp b/src/pgen/radiation_advection.cpp index caee5c807..c01bc6c68 100644 --- a/src/pgen/radiation_advection.cpp +++ b/src/pgen/radiation_advection.cpp @@ -27,19 +27,19 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); PackIndexMap imap; - auto v = - rc->PackVariables(std::vector( - {radmoment_prim::J, radmoment_prim::H, - fluid_prim::density::name(), fluid_prim::temperature::name(), - fluid_prim::energy::name(), fluid_prim::velocity::name(), - radmoment_internal::xi, radmoment_internal::phi}), - imap); - - auto idJ = imap.GetFlatIdx(radmoment_prim::J); - auto idH = imap.GetFlatIdx(radmoment_prim::H); + auto v = rc->PackVariables( + std::vector( + {radmoment_prim::J::name(), radmoment_prim::H::name(), + fluid_prim::density::name(), fluid_prim::temperature::name(), + fluid_prim::energy::name(), fluid_prim::velocity::name(), + radmoment_internal::xi::name(), radmoment_internal::phi::name()}), + imap); + + auto idJ = imap.GetFlatIdx(radmoment_prim::J::name()); + auto idH = imap.GetFlatIdx(radmoment_prim::H::name()); auto idv = imap.GetFlatIdx(fluid_prim::velocity::name()); - auto ixi = imap.GetFlatIdx(radmoment_internal::xi); - auto iphi = imap.GetFlatIdx(radmoment_internal::phi); + auto ixi = imap.GetFlatIdx(radmoment_internal::xi::name()); + auto iphi = imap.GetFlatIdx(radmoment_internal::phi::name()); const int prho = imap[fluid_prim::density::name()].first; const int pT = imap[fluid_prim::temperature::name()].first; const int peng = imap[fluid_prim::energy::name()].first; diff --git a/src/pgen/radiation_equilibration.cpp b/src/pgen/radiation_equilibration.cpp index f2d35f1e2..b9c48c68f 100644 --- a/src/pgen/radiation_equilibration.cpp +++ b/src/pgen/radiation_equilibration.cpp @@ -32,21 +32,22 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { PackIndexMap imap; auto v = rc->PackVariables( - {radmoment_prim::J, radmoment_prim::H, radmoment_internal::xi, - radmoment_internal::phi, fluid_prim::density::name(), - fluid_prim::temperature::name(), fluid_prim::pressure::name(), fluid_prim::gamma1, + {radmoment_prim::J::name(), radmoment_prim::H::name(), + radmoment_internal::xi::name(), radmoment_internal::phi::name(), + fluid_prim::density::name(), fluid_prim::temperature::name(), + fluid_prim::pressure::name(), fluid_prim::gamma1::name(), fluid_prim::energy::name(), fluid_prim::ye::name(), fluid_prim::velocity::name()}, imap); - auto idJ = imap.GetFlatIdx(radmoment_prim::J); - auto idH = imap.GetFlatIdx(radmoment_prim::H); - auto ixi = imap.GetFlatIdx(radmoment_internal::xi); - auto iphi = imap.GetFlatIdx(radmoment_internal::phi); + auto idJ = imap.GetFlatIdx(radmoment_prim::J::name()); + auto idH = imap.GetFlatIdx(radmoment_prim::H::name()); + auto ixi = imap.GetFlatIdx(radmoment_internal::xi::name()); + auto iphi = imap.GetFlatIdx(radmoment_internal::phi::name()); const int iRho = imap[fluid_prim::density::name()].first; const int iT = imap[fluid_prim::temperature::name()].first; const int iP = imap[fluid_prim::pressure::name()].first; - const int igm1 = imap[fluid_prim::gamma1].first; + const int igm1 = imap[fluid_prim::gamma1::name()].first; const int ieng = imap[fluid_prim::energy::name()].first; const int pye = imap[fluid_prim::ye::name()].first; auto idv = imap.GetFlatIdx(fluid_prim::velocity::name()); diff --git a/src/pgen/rhs_tester.cpp b/src/pgen/rhs_tester.cpp index 63a0b5760..855dc4100 100644 --- a/src/pgen/rhs_tester.cpp +++ b/src/pgen/rhs_tester.cpp @@ -20,11 +20,12 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); 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::name(), fluid_prim::pressure::name(), - fluid_prim::temperature::name(), fluid_prim::gamma1}, - imap); + auto v = + rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), + fluid_prim::energy::name(), fluid_prim::bfield::name(), + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1::name()}, + imap); const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity::name()].first; @@ -35,7 +36,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int iye = imap[fluid_prim::ye::name()].second; const int iprs = imap[fluid_prim::pressure::name()].first; const int itmp = imap[fluid_prim::temperature::name()].first; - const int igm1 = imap[fluid_prim::gamma1].first; + const int igm1 = imap[fluid_prim::gamma1::name()].first; IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::entire); IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::entire); diff --git a/src/pgen/rotor.cpp b/src/pgen/rotor.cpp index b3d5f3b52..4d9a9cdc2 100644 --- a/src/pgen/rotor.cpp +++ b/src/pgen/rotor.cpp @@ -32,11 +32,12 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); 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::name(), fluid_prim::pressure::name(), - fluid_prim::temperature::name(), fluid_prim::gamma1}, - imap); + auto v = + rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), + fluid_prim::energy::name(), fluid_prim::bfield::name(), + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1::name()}, + imap); const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity::name()].first; @@ -47,7 +48,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int iye = imap[fluid_prim::ye::name()].second; const int iprs = imap[fluid_prim::pressure::name()].first; const int itmp = imap[fluid_prim::temperature::name()].first; - const int igm1 = imap[fluid_prim::gamma1].first; + const int igm1 = imap[fluid_prim::gamma1::name()].first; const Real rho0 = pin->GetOrAddReal("rotor", "rho0", 10.0); const Real rho1 = pin->GetOrAddReal("rotor", "rho1", 1.0); diff --git a/src/pgen/sedov.cpp b/src/pgen/sedov.cpp index d024356eb..c317e1992 100644 --- a/src/pgen/sedov.cpp +++ b/src/pgen/sedov.cpp @@ -31,11 +31,12 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); 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::name(), fluid_prim::pressure::name(), - fluid_prim::temperature::name(), fluid_prim::gamma1}, - imap); + auto v = + rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), + fluid_prim::energy::name(), fluid_prim::bfield::name(), + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1::name()}, + imap); const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity::name()].first; @@ -46,7 +47,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int iye = imap[fluid_prim::ye::name()].second; const int iprs = imap[fluid_prim::pressure::name()].first; const int itmp = imap[fluid_prim::temperature::name()].first; - const int igm1 = imap[fluid_prim::gamma1].first; + const int igm1 = imap[fluid_prim::gamma1::name()].first; const Real rhoa = pin->GetOrAddReal("sedov", "rho_ambient", 1.0); const Real rinner = pin->GetOrAddReal("sedov", "rinner", 0.01); diff --git a/src/pgen/shock_tube.cpp b/src/pgen/shock_tube.cpp index efcf4b121..1fe0b169a 100644 --- a/src/pgen/shock_tube.cpp +++ b/src/pgen/shock_tube.cpp @@ -35,11 +35,12 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto &rc = pmb->meshblock_data.Get(); 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::name(), fluid_prim::pressure::name(), - fluid_prim::temperature::name(), fluid_prim::gamma1}, - imap); + auto v = + rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), + fluid_prim::energy::name(), fluid_prim::bfield::name(), + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1::name()}, + imap); const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity::name()].first; @@ -50,7 +51,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int iye = imap[fluid_prim::ye::name()].second; const int iprs = imap[fluid_prim::pressure::name()].first; const int itmp = imap[fluid_prim::temperature::name()].first; - const int igm1 = imap[fluid_prim::gamma1].first; + const int igm1 = imap[fluid_prim::gamma1::name()].first; const Real rhol = pin->GetOrAddReal("shocktube", "rhol", 1.0); const Real Pl = pin->GetOrAddReal("shocktube", "Pl", 1.0); diff --git a/src/pgen/thin_cooling.cpp b/src/pgen/thin_cooling.cpp index 111f4b228..b29ad8b26 100644 --- a/src/pgen/thin_cooling.cpp +++ b/src/pgen/thin_cooling.cpp @@ -33,7 +33,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { PackIndexMap imap; auto v = rc->PackVariables({p::density::name(), p::velocity::name(), p::energy::name(), p::ye::name(), p::pressure::name(), p::temperature::name(), - p::gamma1}, + p::gamma1::name()}, imap); const int irho = imap[p::density::name()].first; @@ -43,7 +43,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int iye = imap[p::ye::name()].second; const int iprs = imap[p::pressure::name()].first; const int itmp = imap[p::temperature::name()].first; - const int igm1 = imap[p::gamma1].first; + const int igm1 = imap[p::gamma1::name()].first; IndexRange ib = pmb->cellbounds.GetBoundsI(IndexDomain::entire); IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::entire); diff --git a/src/pgen/torus.cpp b/src/pgen/torus.cpp index b85fb34d8..d7ccd2359 100644 --- a/src/pgen/torus.cpp +++ b/src/pgen/torus.cpp @@ -141,8 +141,8 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), fluid_prim::energy::name(), fluid_prim::bfield::name(), fluid_prim::ye::name(), fluid_prim::pressure::name(), - fluid_prim::temperature::name(), fluid_prim::gamma1, - radmoment_prim::J, radmoment_prim::H}, + fluid_prim::temperature::name(), fluid_prim::gamma1::name(), + radmoment_prim::J::name(), radmoment_prim::H::name()}, imap); const int irho = imap[fluid_prim::density::name()].first; @@ -154,10 +154,10 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int iye = imap[fluid_prim::ye::name()].second; const int iprs = imap[fluid_prim::pressure::name()].first; const int itmp = imap[fluid_prim::temperature::name()].first; - const int igm1 = imap[fluid_prim::gamma1].first; + const int igm1 = imap[fluid_prim::gamma1::name()].first; - auto iJ = imap.GetFlatIdx(radmoment_prim::J, false); - auto iH = imap.GetFlatIdx(radmoment_prim::H, false); + auto iJ = imap.GetFlatIdx(radmoment_prim::J::name(), false); + auto iH = imap.GetFlatIdx(radmoment_prim::H::name(), false); const auto specB = iJ.IsValid() ? iJ.GetBounds(1) : parthenon::IndexRange(); // this only works with ideal gases @@ -681,7 +681,7 @@ void ComputeBetas(Mesh *pmesh, Real rho_min_bnorm, Real &beta_min_global, PackIndexMap imap; auto v = rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), fluid_prim::bfield::name(), fluid_prim::pressure::name(), - radmoment_prim::J}, + radmoment_prim::J::name()}, imap); const int irho = imap[fluid_prim::density::name()].first; @@ -691,7 +691,7 @@ void ComputeBetas(Mesh *pmesh, Real rho_min_bnorm, Real &beta_min_global, const int ibhi = imap[fluid_prim::bfield::name()].second; const int iprs = imap[fluid_prim::pressure::name()].first; - auto idx_J = imap.GetFlatIdx(radmoment_prim::J, false); + auto idx_J = imap.GetFlatIdx(radmoment_prim::J::name(), false); if (ibhi < 0) return; diff --git a/src/pgen/tov.cpp b/src/pgen/tov.cpp index e42281c64..112de634e 100644 --- a/src/pgen/tov.cpp +++ b/src/pgen/tov.cpp @@ -71,11 +71,12 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { auto geom = Geometry::GetCoordinateSystem(rc.get()); 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::name(), fluid_prim::pressure::name(), - fluid_prim::temperature::name(), fluid_prim::gamma1}, - imap); + auto v = + rc->PackVariables({fluid_prim::density::name(), fluid_prim::velocity::name(), + fluid_prim::energy::name(), fluid_prim::bfield::name(), + fluid_prim::ye::name(), fluid_prim::pressure::name(), + fluid_prim::temperature::name(), fluid_prim::gamma1::name()}, + imap); const int irho = imap[fluid_prim::density::name()].first; const int ivlo = imap[fluid_prim::velocity::name()].first; @@ -86,7 +87,7 @@ void ProblemGenerator(MeshBlock *pmb, ParameterInput *pin) { const int iye = imap[fluid_prim::ye::name()].second; const int iprs = imap[fluid_prim::pressure::name()].first; const int itmp = imap[fluid_prim::temperature::name()].first; - const int igm1 = imap[fluid_prim::gamma1].first; + const int igm1 = imap[fluid_prim::gamma1::name()].first; pmb->par_for( "Phoebus::ProblemGenerator::TOV", kb.s, kb.e, jb.s, jb.e, ib.s, ib.e, diff --git a/src/phoebus_boundaries/phoebus_boundaries.cpp b/src/phoebus_boundaries/phoebus_boundaries.cpp index ec53a703f..e440ddaa9 100644 --- a/src/phoebus_boundaries/phoebus_boundaries.cpp +++ b/src/phoebus_boundaries/phoebus_boundaries.cpp @@ -228,7 +228,7 @@ void OutflowOuterX1(std::shared_ptr> &rc, bool coarse) { auto domain = IndexDomain::outer_x1; const int pv_lo = imap[fluid_prim::velocity::name()].first; - auto idx_H = imap.GetFlatIdx(radmoment_prim::H, false); + auto idx_H = imap.GetFlatIdx(radmoment_prim::H::name(), false); auto &fluid = rc->GetMeshPointer()->packages.Get("fluid"); auto &rad = rc->GetMeshPointer()->packages.Get("radiation"); @@ -337,12 +337,13 @@ TaskStatus ConvertBoundaryConditions(std::shared_ptr> &rc) { const bool coarse = false; PackIndexMap imap; - std::vector vars{fluid_prim::velocity::name(), radmoment_prim::H}; + std::vector vars{fluid_prim::velocity::name(), + radmoment_prim::H::name()}; auto q = rc->PackVariables(vars, imap, coarse); auto nb1 = IndexRange{0, 0}; const int pv_lo = imap[fluid_prim::velocity::name()].first; - auto idx_H = imap.GetFlatIdx(radmoment_prim::H, false); + auto idx_H = imap.GetFlatIdx(radmoment_prim::H::name(), false); const int num_species = pkg_rad->Param("active") ? pkg_rad->Param("num_species") : 0; diff --git a/src/phoebus_driver.cpp b/src/phoebus_driver.cpp index 0bf4cf6e3..8299f5b4f 100644 --- a/src/phoebus_driver.cpp +++ b/src/phoebus_driver.cpp @@ -202,12 +202,12 @@ TaskCollection PhoebusDriver::RungeKuttaStage(const int stage) { src_names.push_back(fluid_cons::energy::name()); } if (rad_moments_active) { - src_names.push_back(radmoment_cons::E); - src_names.push_back(radmoment_cons::F); + src_names.push_back(radmoment_cons::E::name()); + src_names.push_back(radmoment_cons::F::name()); } src_w_diag = src_names; #if SET_FLUX_SRC_DIAGS - if (fluid_active) src_w_diag.push_back(diagnostic_variables::src_terms); + if (fluid_active) src_w_diag.push_back(diagnostic_variables::src_terms::name()); #endif using MonoMatRed_t = AllReduce; diff --git a/src/phoebus_utils/variables.hpp b/src/phoebus_utils/variables.hpp index e8ee64d0a..d4a315476 100644 --- a/src/phoebus_utils/variables.hpp +++ b/src/phoebus_utils/variables.hpp @@ -32,6 +32,14 @@ static std::string name() { return #varname; } \ } +#define VARIABLE_CUSTOM(varname, varstring) \ + struct varname : public parthenon::variable_names::base_t { \ + template \ + KOKKOS_INLINE_FUNCTION varname(Ts &&...args) \ + : parthenon::variable_names::base_t(std::forward(args)...) {} \ + static std::string name() { return #varstring; } \ + } + namespace fluid_prim { VARIABLE(p, density); VARIABLE(p, velocity); @@ -40,7 +48,7 @@ VARIABLE(p, bfield); VARIABLE(p, ye); VARIABLE_NONS(pressure); VARIABLE_NONS(temperature); -constexpr char gamma1[] = "gamma1"; +VARIABLE_NONS(gamma1); } // namespace fluid_prim namespace fluid_cons { @@ -52,66 +60,67 @@ VARIABLE(c, ye); } // namespace fluid_cons namespace radmoment_prim { -constexpr char J[] = "r.p.J"; -constexpr char H[] = "r.p.H"; +VARIABLE(r.p, J); +VARIABLE(r.p, H); } // namespace radmoment_prim namespace radmoment_cons { -constexpr char E[] = "r.c.E"; -constexpr char F[] = "r.c.F"; +VARIABLE(r.c, E); +VARIABLE(r.c, F); } // namespace radmoment_cons namespace radmoment_internal { -constexpr char xi[] = "r.i.xi"; -constexpr char phi[] = "r.i.phi"; -constexpr char ql[] = "r.i.ql"; -constexpr char qr[] = "r.i.qr"; -constexpr char ql_v[] = "r.i.ql_v"; -constexpr char qr_v[] = "r.i.qr_v"; -constexpr char dJ[] = "r.i.dJ"; -constexpr char kappaJ[] = "r.i.kappaJ"; -constexpr char kappaH[] = "r.i.kappaH"; -constexpr char JBB[] = "r.i.JBB"; -constexpr char tilPi[] = "r.i.tilPi"; -constexpr char kappaH_mean[] = "r.i.kappaH_mean"; -constexpr char c2pfail[] = "r.i.c2p_fail"; -constexpr char srcfail[] = "r.i.src_fail"; +VARIABLE(r.i, xi); +VARIABLE(r.i, phi); +VARIABLE(r.i, ql); +VARIABLE(r.i, qr); +VARIABLE(r.i, ql_v); +VARIABLE(r.i, qr_v); +VARIABLE(r.i, dJ); +VARIABLE(r.i, kappaJ); +VARIABLE(r.i, kappaH); +VARIABLE(r.i, JBB); +VARIABLE(r.i, tilPi); +VARIABLE(r.i, kappaH_mean); +VARIABLE(r.i, c2pfail); +VARIABLE(r.i, srcfail); } // namespace radmoment_internal namespace mocmc_internal { -constexpr char dnsamp[] = "mocmc.i.dnsamp"; -constexpr char Inu0[] = "mocmc.i.inu0"; -constexpr char Inu1[] = "mocmc.i.inu1"; -constexpr char jinvs[] = "mocmc.i.jinvs"; +VARIABLE(mocmc.i, dnsamp); +VARIABLE(mocmc.i, Inu0); +VARIABLE(mocmc.i, Inu1); +VARIABLE(mocmc.i, jinvs); } // namespace mocmc_internal namespace internal_variables { -constexpr char face_signal_speed[] = "face_signal_speed"; -constexpr char cell_signal_speed[] = "cell_signal_speed"; -constexpr char emf[] = "emf"; -constexpr char c2p_scratch[] = "c2p_scratch"; -constexpr char ql[] = "ql"; -constexpr char qr[] = "qr"; -constexpr char fail[] = "fail"; -constexpr char Gcov[] = "Gcov"; -constexpr char Gye[] = "Gye"; -constexpr char c2p_mu[] = "c2p_mu"; -constexpr char tau[] = "light_bulb_tau"; -constexpr char GcovHeat[] = "GcovHeat"; -constexpr char GcovCool[] = "GcovCool"; +VARIABLE_NONS(face_signal_speed); +VARIABLE_NONS(cell_signal_speed); +VARIABLE_NONS(emf); +VARIABLE_NONS(c2p_scratch); +VARIABLE_NONS(ql); +VARIABLE_NONS(qr); +VARIABLE_NONS(fail); +VARIABLE_NONS(Gcov); +VARIABLE_NONS(Gye); +VARIABLE_NONS(c2p_mu); +VARIABLE_NONS(tau); +; +VARIABLE_NONS(GcovHeat); +VARIABLE_NONS(GcovCool); } // namespace internal_variables namespace geometric_variables { -constexpr char cell_coords[] = "g.c.coord"; -constexpr char node_coords[] = "g.n.coord"; +VARIABLE_CUSTOM(cell_coords, g.c.coord); +VARIABLE_CUSTOM(node_coords, g.n.coord); } // namespace geometric_variables namespace diagnostic_variables { -constexpr char divb[] = "divb"; -constexpr char divf[] = "flux_divergence"; -constexpr char src_terms[] = "src_terms"; -constexpr char r_divf[] = "r.flux_divergence"; -constexpr char r_src_terms[] = "r.src_terms"; +VARIABLE_NONS(divb); +VARIABLE_CUSTOM(divf, flux_divergence); +VARIABLE_NONS(src_terms); +VARIABLE_CUSTOM(r_divf, r.flux_divergence); +VARIABLE_CUSTOM(r_src_terms, r.src_terms); } // namespace diagnostic_variables #endif // PHOEBUS_UTILS_VARIABLES_HPP_ diff --git a/src/radiation/cooling_function.cpp b/src/radiation/cooling_function.cpp index 3a638c0e1..97caba52a 100644 --- a/src/radiation/cooling_function.cpp +++ b/src/radiation/cooling_function.cpp @@ -28,12 +28,12 @@ TaskStatus LightBulbCalcTau(MeshBlockData *rc) { namespace iv = internal_variables; Mesh *pmesh = rc->GetMeshPointer(); - std::vector vars({p::density::name(), iv::tau}); + std::vector vars({p::density::name(), iv::tau::name()}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); const int prho = imap[p::density::name()].first; - const int ptau = imap[iv::tau].first; + const int ptau = imap[iv::tau::name()].first; IndexRange ib = rc->GetBoundsI(IndexDomain::interior); IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); @@ -78,11 +78,11 @@ TaskStatus CheckDoGain(MeshBlockData *rc, bool *do_gain_global) { namespace iv = internal_variables; Mesh *pmesh = rc->GetMeshPointer(); - std::vector vars({iv::tau}); + std::vector vars({iv::tau::name()}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); - const int ptau = imap[iv::tau].first; + const int ptau = imap[iv::tau::name()].first; IndexRange ib = rc->GetBoundsI(IndexDomain::interior); IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); @@ -115,8 +115,9 @@ TaskStatus CoolingFunctionCalculateFourForce(MeshBlockData *rc, const doub std::vector vars({c::density::name(), p::density::name(), p::velocity::name(), p::temperature::name(), - p::ye::name(), c::energy::name(), iv::Gcov, iv::GcovHeat, - iv::GcovCool, iv::Gye, iv::tau, p::energy::name()}); + p::ye::name(), c::energy::name(), iv::Gcov::name(), + iv::GcovHeat::name(), iv::GcovCool::name(), + iv::Gye::name(), iv::tau::name(), p::energy::name()}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); @@ -127,12 +128,12 @@ TaskStatus CoolingFunctionCalculateFourForce(MeshBlockData *rc, const doub const int ptemp = imap[p::temperature::name()].first; const int pye = imap[p::ye::name()].first; const int penergy = imap[p::energy::name()].first; - const int Gcov_lo = imap[iv::Gcov].first; - const int Gcov_hi = imap[iv::Gcov].second; - const int Gye = imap[iv::Gye].first; - const int ptau = imap[iv::tau].first; - const int GcovHeat = imap[iv::GcovHeat].first; - const int GcovCool = imap[iv::GcovCool].first; + const int Gcov_lo = imap[iv::Gcov::name()].first; + const int Gcov_hi = imap[iv::Gcov::name()].second; + const int Gye = imap[iv::Gye::name()].first; + const int ptau = imap[iv::tau::name()].first; + const int GcovHeat = imap[iv::GcovHeat::name()].first; + const int GcovCool = imap[iv::GcovCool::name()].first; IndexRange ib = rc->GetBoundsI(IndexDomain::interior); IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); diff --git a/src/radiation/mocmc.cpp b/src/radiation/mocmc.cpp index 67a78ee46..4d479c7b2 100644 --- a/src/radiation/mocmc.cpp +++ b/src/radiation/mocmc.cpp @@ -81,23 +81,19 @@ void MOCMCInitSamples(T *rc) { const auto opac = opac_pkg->template Param("opacities"); StateDescriptor *eos = pmb->packages.Get("eos").get(); - std::vector variables{pr::J, - pr::H, - pf::density::name(), - pf::velocity::name(), - pf::temperature::name(), - pf::ye::name(), - im::dnsamp}; + std::vector variables{ + pr::J::name(), pr::H::name(), pf::density::name(), pf::velocity::name(), + pf::temperature::name(), pf::ye::name(), im::dnsamp::name()}; PackIndexMap imap; auto v = rc->PackVariables(variables, imap); - auto pJ = imap.GetFlatIdx(pr::J); - auto pH = imap.GetFlatIdx(pr::H); + auto pJ = imap.GetFlatIdx(pr::J::name()); + auto pH = imap.GetFlatIdx(pr::H::name()); auto pdens = imap[pf::density::name()].first; auto pv = imap.GetFlatIdx(fluid_prim::velocity::name()); auto pT = imap[pf::temperature::name()].first; auto pye = imap[pf::ye::name()].first; - auto dn = imap[im::dnsamp].first; + auto dn = imap[im::dnsamp::name()].first; const int nblock = v.GetDim(5); PARTHENON_REQUIRE_THROWS(nblock == 1, "Packing not currently supported for swarms"); @@ -138,7 +134,7 @@ void MOCMCInitSamples(T *rc) { // Calculate array of starting index for each zone to compute particles ParArrayND starting_index("Starting index", nx_k, nx_j, nx_i); auto starting_index_h = starting_index.GetHostMirror(); - auto dN = rc->Get(im::dnsamp).data; + auto dN = rc->Get(im::dnsamp::name()).data; auto dN_h = dN.GetHostMirrorAndCopy(); int index = 0; for (int k = 0; k < nx_k; k++) { @@ -247,7 +243,8 @@ TaskStatus MOCMCSampleBoundaries(T *rc) { IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); - std::vector variables{pr::J, pf::velocity::name(), ir::tilPi}; + std::vector variables{pr::J::name(), pf::velocity::name(), + ir::tilPi::name()}; PackIndexMap imap; auto v = rc->PackVariables(variables, imap); @@ -265,8 +262,8 @@ TaskStatus MOCMCSampleBoundaries(T *rc) { const auto &phi_lo = swarm->template Get("phi_lo").Get(); const auto &phi_hi = swarm->template Get("phi_hi").Get(); auto pv = imap.GetFlatIdx(pf::velocity::name()); - auto iTilPi = imap.GetFlatIdx(ir::tilPi); - auto iJ = imap.GetFlatIdx(pr::J); + auto iTilPi = imap.GetFlatIdx(ir::tilPi::name()); + auto iJ = imap.GetFlatIdx(pr::J::name()); auto nusamp = rad->Param>("nusamp"); const int nu_bins = rad->Param("nu_bins"); @@ -362,7 +359,7 @@ TaskStatus MOCMCReconstruction(T *rc) { IndexRange jb = pmb->cellbounds.GetBoundsJ(IndexDomain::interior); IndexRange kb = pmb->cellbounds.GetBoundsK(IndexDomain::interior); - std::vector variables{pf::velocity::name(), ir::tilPi}; + std::vector variables{pf::velocity::name(), ir::tilPi::name()}; PackIndexMap imap; auto v = rc->PackVariables(variables, imap); @@ -376,7 +373,7 @@ TaskStatus MOCMCReconstruction(T *rc) { const auto &phi_lo = swarm->template Get("phi_lo").Get(); const auto &phi_hi = swarm->template Get("phi_hi").Get(); auto pv = imap.GetFlatIdx(pf::velocity::name()); - auto iTilPi = imap.GetFlatIdx(ir::tilPi); + auto iTilPi = imap.GetFlatIdx(ir::tilPi::name()); auto nusamp = rad->Param>("nusamp"); const int nu_bins = rad->Param("nu_bins"); @@ -525,21 +522,12 @@ TaskStatus MOCMCFluidSource(T *rc, const Real dt, const bool update_fluid) { StateDescriptor *eos = pmb->packages.Get("eos").get(); const auto eos_d = eos->template Param("d.EOS"); - std::vector variables{cr::E, - cr::F, - pr::J, - pr::H, - pf::density::name(), - pf::energy::name(), - pf::velocity::name(), - pf::temperature::name(), - pf::ye::name(), - ir::tilPi, - ir::kappaH, - im::dnsamp, - im::Inu0, - im::Inu1, - im::jinvs}; + std::vector variables{ + cr::E::name(), cr::F::name(), pr::J::name(), + pr::H::name(), pf::density::name(), pf::energy::name(), + pf::velocity::name(), pf::temperature::name(), pf::ye::name(), + ir::tilPi::name(), ir::kappaH::name(), im::dnsamp::name(), + im::Inu0::name(), im::Inu1::name(), im::jinvs::name()}; if (update_fluid) { variables.push_back(cf::energy::name()); variables.push_back(cf::momentum::name()); @@ -548,20 +536,20 @@ TaskStatus MOCMCFluidSource(T *rc, const Real dt, const bool update_fluid) { PackIndexMap imap; auto v = rc->PackVariables(variables, imap); - const auto pJ = imap.GetFlatIdx(pr::J); - const auto pH = imap.GetFlatIdx(pr::H); + const auto pJ = imap.GetFlatIdx(pr::J::name()); + const auto pH = imap.GetFlatIdx(pr::H::name()); const auto pdens = imap[pf::density::name()].first; const auto peng = imap[pf::energy::name()].first; const auto pv = imap.GetFlatIdx(fluid_prim::velocity::name()); const auto pT = imap[pf::temperature::name()].first; const auto pye = imap[pf::ye::name()].first; - const auto Inu0 = imap.GetFlatIdx(im::Inu0); - const auto Inu1 = imap.GetFlatIdx(im::Inu1); - const auto ijinvs = imap.GetFlatIdx(im::jinvs); - const auto iTilPi = imap.GetFlatIdx(ir::tilPi); - auto idx_E = imap.GetFlatIdx(cr::E); - auto idx_F = imap.GetFlatIdx(cr::F); - auto idx_kappaH = imap.GetFlatIdx(ir::kappaH); + const auto Inu0 = imap.GetFlatIdx(im::Inu0::name()); + const auto Inu1 = imap.GetFlatIdx(im::Inu1::name()); + const auto ijinvs = imap.GetFlatIdx(im::jinvs::name()); + const auto iTilPi = imap.GetFlatIdx(ir::tilPi::name()); + auto idx_E = imap.GetFlatIdx(cr::E::name()); + auto idx_F = imap.GetFlatIdx(cr::F::name()); + auto idx_kappaH = imap.GetFlatIdx(ir::kappaH::name()); int ceng(-1), cmom_lo(-1), cye(-1); if (update_fluid) { ceng = imap[cf::energy::name()].first; @@ -811,7 +799,7 @@ TaskStatus MOCMCEddington(T *rc) { auto geom = Geometry::GetCoordinateSystem(rc); - std::vector variables{ir::tilPi, pf::velocity::name()}; + std::vector variables{ir::tilPi::name(), pf::velocity::name()}; PackIndexMap imap; auto v = rc->PackVariables(variables, imap); @@ -821,7 +809,7 @@ TaskStatus MOCMCEddington(T *rc) { const auto &mu_hi = swarm->template Get("mu_hi").Get(); const auto &phi_lo = swarm->template Get("phi_lo").Get(); const auto &phi_hi = swarm->template Get("phi_hi").Get(); - auto iTilPi = imap.GetFlatIdx(ir::tilPi); + auto iTilPi = imap.GetFlatIdx(ir::tilPi::name()); const auto pvel_lo = imap[pf::velocity::name()].first; const int nu_bins = rad->Param("nu_bins"); diff --git a/src/radiation/moments.cpp b/src/radiation/moments.cpp index 60828940e..293c71ede 100644 --- a/src/radiation/moments.cpp +++ b/src/radiation/moments.cpp @@ -70,25 +70,31 @@ TaskStatus MomentCon2PrimImpl(T *rc) { IndexRange jb = rc->GetBoundsJ(IndexDomain::entire); IndexRange kb = rc->GetBoundsK(IndexDomain::entire); - std::vector variables{ - cr::E, cr::F, pr::J, pr::H, fluid_prim::velocity::name(), - ir::xi, ir::phi, ir::c2pfail, ir::tilPi}; + std::vector variables{cr::E::name(), + cr::F::name(), + pr::J::name(), + pr::H::name(), + fluid_prim::velocity::name(), + ir::xi::name(), + ir::phi::name(), + ir::c2pfail::name(), + ir::tilPi::name()}; PackIndexMap imap; auto v = rc->PackVariables(variables, imap); - auto cE = imap.GetFlatIdx(cr::E); - auto pJ = imap.GetFlatIdx(pr::J); - auto cF = imap.GetFlatIdx(cr::F); - auto pH = imap.GetFlatIdx(pr::H); + auto cE = imap.GetFlatIdx(cr::E::name()); + auto pJ = imap.GetFlatIdx(pr::J::name()); + auto cF = imap.GetFlatIdx(cr::F::name()); + auto pH = imap.GetFlatIdx(pr::H::name()); auto pv = imap.GetFlatIdx(fluid_prim::velocity::name()); - auto iTilPi = imap.GetFlatIdx(ir::tilPi, false); + auto iTilPi = imap.GetFlatIdx(ir::tilPi::name(), false); auto specB = cE.GetBounds(1); auto dirB = pH.GetBounds(2); - auto iXi = imap.GetFlatIdx(ir::xi); - auto iPhi = imap.GetFlatIdx(ir::phi); + auto iXi = imap.GetFlatIdx(ir::xi::name()); + auto iPhi = imap.GetFlatIdx(ir::phi::name()); - auto ifail = imap[ir::c2pfail].first; + auto ifail = imap[ir::c2pfail::name()].first; auto geom = Geometry::GetCoordinateSystem(rc); const Real pi = acos(-1); @@ -198,20 +204,20 @@ TaskStatus MomentPrim2ConImpl(T *rc, IndexDomain domain) { IndexRange jb = rc->GetBoundsJ(domain); IndexRange kb = rc->GetBoundsK(domain); - std::vector variables{cr::E, cr::F, pr::J, pr::H, - fluid_prim::velocity::name()}; + std::vector variables{cr::E::name(), cr::F::name(), pr::J::name(), + pr::H::name(), fluid_prim::velocity::name()}; if (programming::is_specialization_of::value) { - variables.push_back(ir::tilPi); + variables.push_back(ir::tilPi::name()); } PackIndexMap imap; auto v = rc->PackVariables(variables, imap); - auto cE = imap.GetFlatIdx(cr::E); - auto pJ = imap.GetFlatIdx(pr::J); - auto cF = imap.GetFlatIdx(cr::F); - auto pH = imap.GetFlatIdx(pr::H); + auto cE = imap.GetFlatIdx(cr::E::name()); + auto pJ = imap.GetFlatIdx(pr::J::name()); + auto cF = imap.GetFlatIdx(cr::F::name()); + auto pH = imap.GetFlatIdx(pr::H::name()); auto pv = imap.GetFlatIdx(fluid_prim::velocity::name()); - auto iTilPi = imap.GetFlatIdx(ir::tilPi, false); + auto iTilPi = imap.GetFlatIdx(ir::tilPi::name(), false); auto specB = cE.GetBounds(1); auto dirB = pH.GetBounds(2); @@ -309,21 +315,21 @@ TaskStatus ReconstructEdgeStates(T *rc) { PackIndexMap imap_ql, imap_qr, imap; VariablePack ql_base = - rc->PackVariables(std::vector{ir::ql}, imap_ql); + rc->PackVariables(std::vector{ir::ql::name()}, imap_ql); VariablePack qr_base = - rc->PackVariables(std::vector{ir::qr}, imap_qr); - std::vector variables = {pr::J, pr::H, ir::tilPi}; - variables.push_back(ir::dJ); + rc->PackVariables(std::vector{ir::qr::name()}, imap_qr); + std::vector variables = {pr::J::name(), pr::H::name(), ir::tilPi::name()}; + variables.push_back(ir::dJ::name()); VariablePack v = rc->PackVariables(variables, imap); - auto idx_J = imap.GetFlatIdx(pr::J); - auto idx_dJ = imap.GetFlatIdx(ir::dJ); - auto iTilPi = imap.GetFlatIdx(ir::tilPi, false); + auto idx_J = imap.GetFlatIdx(pr::J::name()); + auto idx_dJ = imap.GetFlatIdx(ir::dJ::name()); + auto iTilPi = imap.GetFlatIdx(ir::tilPi::name(), false); - ParArrayND ql_v = rc->Get(ir::ql_v).data; - ParArrayND qr_v = rc->Get(ir::qr_v).data; + ParArrayND ql_v = rc->Get(ir::ql_v::name()).data; + ParArrayND qr_v = rc->Get(ir::qr_v::name()).data; VariablePack v_vel = rc->PackVariables(std::vector{fluid_prim::velocity::name()}); - auto qIdx = imap_ql.GetFlatIdx(ir::ql); + auto qIdx = imap_ql.GetFlatIdx(ir::ql::name()); const int nspec = qIdx.DimSize(1); int nrecon = 4 * nspec; @@ -331,7 +337,7 @@ TaskStatus ReconstructEdgeStates(T *rc) { nrecon = (4 + 9) * nspec; // TODO(BRR) 6 instead of 9 for conTilPi by symmetry } - const int offset = imap_ql[ir::ql].first; + const int offset = imap_ql[ir::ql::name()].first; const int nblock = ql_base.GetDim(5); const int ndim = pmb->pmy_mesh->ndim; @@ -508,20 +514,21 @@ TaskStatus CalculateFluxesImpl(T *rc) { namespace ir = radmoment_internal; PackIndexMap imap_ql, imap_qr, imap; - std::vector vars{ir::ql, ir::qr, ir::ql_v, ir::qr_v, ir::dJ, ir::kappaH}; - std::vector flxs{cr::E, cr::F}; + std::vector vars{ir::ql::name(), ir::qr::name(), ir::ql_v::name(), + ir::qr_v::name(), ir::dJ::name(), ir::kappaH::name()}; + std::vector flxs{cr::E::name(), cr::F::name()}; auto v = rc->PackVariablesAndFluxes(vars, flxs, imap); - auto idx_qlv = imap.GetFlatIdx(ir::ql_v); - auto idx_qrv = imap.GetFlatIdx(ir::qr_v); - auto idx_ql = imap.GetFlatIdx(ir::ql); - auto idx_qr = imap.GetFlatIdx(ir::qr); - auto idx_dJ = imap.GetFlatIdx(ir::dJ); - auto idx_kappaH = imap.GetFlatIdx(ir::kappaH); + auto idx_qlv = imap.GetFlatIdx(ir::ql_v::name()); + auto idx_qrv = imap.GetFlatIdx(ir::qr_v::name()); + auto idx_ql = imap.GetFlatIdx(ir::ql::name()); + auto idx_qr = imap.GetFlatIdx(ir::qr::name()); + auto idx_dJ = imap.GetFlatIdx(ir::dJ::name()); + auto idx_kappaH = imap.GetFlatIdx(ir::kappaH::name()); - auto idx_Ff = imap.GetFlatIdx(cr::F); - auto idx_Ef = imap.GetFlatIdx(cr::E); + auto idx_Ff = imap.GetFlatIdx(cr::F::name()); + auto idx_Ef = imap.GetFlatIdx(cr::E::name()); auto num_species = rad_pkg->Param("num_species"); @@ -774,26 +781,26 @@ TaskStatus CalculateGeometricSourceImpl(T *rc, T *rc_src) { namespace ir = radmoment_internal; namespace p = fluid_prim; PackIndexMap imap; - std::vector vars{cr::E, cr::F, pr::J, pr::H, p::velocity::name(), - ir::tilPi}; - vars.push_back(diagnostic_variables::r_src_terms); + std::vector vars{cr::E::name(), cr::F::name(), pr::J::name(), + pr::H::name(), p::velocity::name(), ir::tilPi::name()}; + vars.push_back(diagnostic_variables::r_src_terms::name()); #if SET_FLUX_SRC_DIAGS - vars.push_back(diagnostic_variables::r_src_terms); + vars.push_back(diagnostic_variables::r_src_terms::name()); #endif auto v = rc->PackVariables(vars, imap); - auto idx_E = imap.GetFlatIdx(cr::E); - auto idx_F = imap.GetFlatIdx(cr::F); - auto idx_J = imap.GetFlatIdx(pr::J); - auto idx_H = imap.GetFlatIdx(pr::H); + auto idx_E = imap.GetFlatIdx(cr::E::name()); + auto idx_F = imap.GetFlatIdx(cr::F::name()); + auto idx_J = imap.GetFlatIdx(pr::J::name()); + auto idx_H = imap.GetFlatIdx(pr::H::name()); auto pv = imap.GetFlatIdx(p::velocity::name()); - auto iTilPi = imap.GetFlatIdx(ir::tilPi, false); - auto idx_diag = imap.GetFlatIdx(diagnostic_variables::r_src_terms, false); + auto iTilPi = imap.GetFlatIdx(ir::tilPi::name(), false); + auto idx_diag = imap.GetFlatIdx(diagnostic_variables::r_src_terms::name(), false); PackIndexMap imap_src; - std::vector vars_src{cr::E, cr::F}; + std::vector vars_src{cr::E::name(), cr::F::name()}; auto v_src = rc_src->PackVariables(vars_src, imap_src); - auto idx_E_src = imap_src.GetFlatIdx(cr::E); - auto idx_F_src = imap_src.GetFlatIdx(cr::F); + auto idx_E_src = imap_src.GetFlatIdx(cr::E::name()); + auto idx_F_src = imap_src.GetFlatIdx(cr::F::name()); IndexRange ib = rc->GetBoundsI(IndexDomain::interior); IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); @@ -944,13 +951,9 @@ TaskStatus MomentCalculateOpacities(T *rc) { namespace ir = radmoment_internal; namespace c = fluid_cons; namespace p = fluid_prim; - std::vector vars{p::density::name(), - p::temperature::name(), - p::ye::name(), - p::velocity::name(), - ir::kappaJ, - ir::kappaH, - ir::JBB}; + std::vector vars{ + p::density::name(), p::temperature::name(), p::ye::name(), p::velocity::name(), + ir::kappaJ::name(), ir::kappaH::name(), ir::JBB::name()}; PackIndexMap imap; auto v = rc->PackVariables(vars, imap); @@ -960,9 +963,9 @@ TaskStatus MomentCalculateOpacities(T *rc) { int pT = imap[p::temperature::name()].first; int pYe = imap[p::ye::name()].first; - auto idx_kappaJ = imap.GetFlatIdx(ir::kappaJ); - auto idx_kappaH = imap.GetFlatIdx(ir::kappaH); - auto idx_JBB = imap.GetFlatIdx(ir::JBB); + auto idx_kappaJ = imap.GetFlatIdx(ir::kappaJ::name()); + auto idx_kappaH = imap.GetFlatIdx(ir::kappaH::name()); + auto idx_JBB = imap.GetFlatIdx(ir::JBB::name()); IndexRange ib = rc->GetBoundsI(IndexDomain::entire); IndexRange jb = rc->GetBoundsJ(IndexDomain::entire); diff --git a/src/radiation/moments_source.cpp b/src/radiation/moments_source.cpp index 79eef6642..5d127b68b 100644 --- a/src/radiation/moments_source.cpp +++ b/src/radiation/moments_source.cpp @@ -216,46 +216,33 @@ TaskStatus MomentFluidSourceImpl(T *rc, Real dt, bool update_fluid) { namespace ir = radmoment_internal; namespace c = fluid_cons; namespace p = fluid_prim; - std::vector vars{c::density::name(), - c::energy::name(), - c::momentum::name(), - c::ye::name(), - cr::E, - cr::F, - c::bfield::name(), - p::density::name(), - p::temperature::name(), - p::energy::name(), - p::ye::name(), - p::velocity::name(), - p::pressure::name(), - p::gamma1, - p::bfield::name(), - pr::J, - pr::H, - ir::kappaJ, - ir::kappaH, - ir::JBB, - ir::tilPi}; + std::vector vars{ + c::density::name(), c::energy::name(), c::momentum::name(), + c::ye::name(), cr::E::name(), cr::F::name(), + c::bfield::name(), p::density::name(), p::temperature::name(), + p::energy::name(), p::ye::name(), p::velocity::name(), + p::pressure::name(), p::gamma1::name(), p::bfield::name(), + pr::J::name(), pr::H::name(), ir::kappaJ::name(), + ir::kappaH::name(), ir::JBB::name(), ir::tilPi::name()}; PackIndexMap imap; auto v = rc->PackVariables(vars, imap); - auto idx_E = imap.GetFlatIdx(cr::E); - auto idx_F = imap.GetFlatIdx(cr::F); - auto idx_J = imap.GetFlatIdx(pr::J); - auto idx_H = imap.GetFlatIdx(pr::H); - - auto idx_kappaJ = imap.GetFlatIdx(ir::kappaJ); - auto idx_kappaH = imap.GetFlatIdx(ir::kappaH); - auto idx_JBB = imap.GetFlatIdx(ir::JBB); - auto idx_tilPi = imap.GetFlatIdx(ir::tilPi, false); + auto idx_E = imap.GetFlatIdx(cr::E::name()); + auto idx_F = imap.GetFlatIdx(cr::F::name()); + auto idx_J = imap.GetFlatIdx(pr::J::name()); + auto idx_H = imap.GetFlatIdx(pr::H::name()); + + auto idx_kappaJ = imap.GetFlatIdx(ir::kappaJ::name()); + auto idx_kappaH = imap.GetFlatIdx(ir::kappaH::name()); + auto idx_JBB = imap.GetFlatIdx(ir::JBB::name()); + auto idx_tilPi = imap.GetFlatIdx(ir::tilPi::name(), false); auto pv = imap.GetFlatIdx(p::velocity::name()); int prho = imap[p::density::name()].first; int peng = imap[p::energy::name()].first; int pT = imap[p::temperature::name()].first; int pprs = imap[p::pressure::name()].first; - int pgm1 = imap[p::gamma1].first; + int pgm1 = imap[p::gamma1::name()].first; int pYe = imap[p::ye::name()].first; int pb_lo = imap[p::bfield::name()].first; int cb_lo = imap[c::bfield::name()].first; diff --git a/src/radiation/monte_carlo.cpp b/src/radiation/monte_carlo.cpp index ca36a2a03..30684f900 100644 --- a/src/radiation/monte_carlo.cpp +++ b/src/radiation/monte_carlo.cpp @@ -151,9 +151,9 @@ TaskStatus MonteCarloSourceParticles(MeshBlock *pmb, MeshBlockData *rc, const Real h_code = code_constants.h; const Real mp_code = code_constants.mp; - std::vector vars({p::density::name(), p::temperature::name(), - p::ye::name(), p::velocity::name(), "dNdlnu_max", - "dNdlnu", "dN", "Ns", iv::Gcov, iv::Gye}); + std::vector vars( + {p::density::name(), p::temperature::name(), p::ye::name(), p::velocity::name(), + "dNdlnu_max", "dNdlnu", "dN", "Ns", iv::Gcov::name(), iv::Gye::name()}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); const int pye = imap[p::ye::name()].first; @@ -165,9 +165,9 @@ TaskStatus MonteCarloSourceParticles(MeshBlock *pmb, MeshBlockData *rc, const int idNdlnu_max = imap["dNdlnu_max"].first; const int idN = imap["dN"].first; const int iNs = imap["Ns"].first; - const int Gcov_lo = imap[iv::Gcov].first; - const int Gcov_hi = imap[iv::Gcov].second; - const int Gye = imap[iv::Gye].first; + const int Gcov_lo = imap[iv::Gcov::name()].first; + const int Gcov_hi = imap[iv::Gcov::name()].second; + const int Gye = imap[iv::Gye::name()].first; // TODO(BRR) update this dynamically somewhere else. Get a reasonable starting value Real wgtC = rad->Param("wgtC"); @@ -458,7 +458,8 @@ TaskStatus MonteCarloTransport(MeshBlock *pmb, MeshBlockData *rc, const Real mp_code = code_constants.mp; std::vector vars({p::density::name(), p::ye::name(), p::velocity::name(), - p::temperature::name(), iv::Gcov, iv::Gye}); + p::temperature::name(), iv::Gcov::name(), + iv::Gye::name()}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); const int prho = imap[p::density::name()].first; @@ -466,9 +467,9 @@ TaskStatus MonteCarloTransport(MeshBlock *pmb, MeshBlockData *rc, const int ivlo = imap[p::velocity::name()].first; const int ivhi = imap[p::velocity::name()].second; const int itemp = imap[p::temperature::name()].first; - const int iGcov_lo = imap[iv::Gcov].first; - const int iGcov_hi = imap[iv::Gcov].second; - const int iGye = imap[iv::Gye].first; + const int iGcov_lo = imap[iv::Gcov::name()].first; + const int iGcov_hi = imap[iv::Gcov::name()].second; + const int iGye = imap[iv::Gye::name()].first; ParArray1D num_interactions("Number interactions", 2); diff --git a/src/radiation/radiation.cpp b/src/radiation/radiation.cpp index 7dfd3a524..0303752a6 100644 --- a/src/radiation/radiation.cpp +++ b/src/radiation/radiation.cpp @@ -43,10 +43,10 @@ std::shared_ptr Initialize(ParameterInput *pin) { std::vector four_vec(1, 4); Metadata mfourforce = Metadata({Metadata::Cell, Metadata::OneCopy}, four_vec); - physics->AddField(iv::Gcov, mfourforce); + physics->AddField(iv::Gcov::name(), mfourforce); Metadata mscalar = Metadata({Metadata::Cell, Metadata::OneCopy}); - physics->AddField(iv::Gye, mscalar); + physics->AddField(iv::Gye::name(), mscalar); std::string method = pin->GetString("radiation", "method"); params.Add("method", method); @@ -123,8 +123,8 @@ std::shared_ptr Initialize(ParameterInput *pin) { params.Add("do_lightbulb", do_lightbulb); params.Add("lum", lum); if (do_lightbulb) { - physics->AddField(iv::GcovHeat, mscalar); - physics->AddField(iv::GcovCool, mscalar); + physics->AddField(iv::GcovHeat::name(), mscalar); + physics->AddField(iv::GcovCool::name(), mscalar); std::string eos_type = pin->GetString("eos", "type"); #ifdef SPINER_USE_HDF if (eos_type != singularity::StellarCollapse::EosType()) { @@ -134,7 +134,7 @@ std::shared_ptr Initialize(ParameterInput *pin) { PARTHENON_THROW("Lightbulb only supported with HDF5 support"); #endif // SPINER_USE_HDF Metadata m({Metadata::Cell, Metadata::OneCopy}); - physics->AddField(iv::tau, m); + physics->AddField(iv::tau::name(), m); parthenon::AllReduce do_gain_reducer; bool always_gain = pin->GetOrAddBoolean("radiation", "always_gain", false); do_gain_reducer.val = always_gain; @@ -214,10 +214,10 @@ std::shared_ptr Initialize(ParameterInput *pin) { std::vector Inu_size{num_species, nu_bins}; Metadata mInu = Metadata({Metadata::Cell, Metadata::OneCopy}, Inu_size); - physics->AddField(mocmc_internal::Inu0, mInu); - physics->AddField(mocmc_internal::Inu1, mInu); - physics->AddField(mocmc_internal::jinvs, mInu); - physics->AddField(iv::Gye, mscalar); + physics->AddField(mocmc_internal::Inu0::name(), mInu); + physics->AddField(mocmc_internal::Inu1::name(), mInu); + physics->AddField(mocmc_internal::jinvs::name(), mInu); + physics->AddField(iv::Gye::name(), mscalar); Real num_total = 0.; params.Add("num_total", num_total, true); @@ -454,15 +454,15 @@ std::shared_ptr Initialize(ParameterInput *pin) { Metadata::Intensive, Metadata::WithFluxes, Metadata::FillGhost}, std::vector{num_species}); - physics->AddField(c::E, mspecies_scalar_cons); - physics->AddField(c::F, mspecies_three_vector_cons); + physics->AddField(c::E::name(), mspecies_scalar_cons); + physics->AddField(c::F::name(), mspecies_three_vector_cons); - physics->AddField(p::J, mspecies_scalar); - physics->AddField(p::H, mspecies_three_vector); + physics->AddField(p::J::name(), mspecies_scalar); + physics->AddField(p::H::name(), mspecies_three_vector); // Fields for saving guesses for NR iteration in the radiation Con2Prim type solve - physics->AddField(i::xi, mspecies_scalar); - physics->AddField(i::phi, mspecies_scalar); + physics->AddField(i::xi::name(), mspecies_scalar); + physics->AddField(i::phi::name(), mspecies_scalar); // Fields for cell edge reconstruction /// TODO: (LFR) The amount of storage can likely be reduced, but maybe at the expense @@ -475,29 +475,29 @@ std::shared_ptr Initialize(ParameterInput *pin) { std::vector{num_species, nrecon, ndim}); Metadata mrecon_v = Metadata({Metadata::Cell, Metadata::Derived, Metadata::OneCopy}, std::vector{3, ndim}); - physics->AddField(i::ql, mrecon); - physics->AddField(i::qr, mrecon); - physics->AddField(i::ql_v, mrecon_v); - physics->AddField(i::qr_v, mrecon_v); + physics->AddField(i::ql::name(), mrecon); + physics->AddField(i::qr::name(), mrecon); + physics->AddField(i::ql_v::name(), mrecon_v); + physics->AddField(i::qr_v::name(), mrecon_v); // Add variable for calculating gradients of rest frame energy density Metadata mdJ = Metadata({Metadata::Cell, Metadata::Derived, Metadata::OneCopy}, std::vector{num_species, ndim, ndim}); - physics->AddField(i::dJ, mdJ); + physics->AddField(i::dJ::name(), mdJ); // Add variables for source functions Metadata mSourceVar = Metadata({Metadata::Cell, Metadata::Derived, Metadata::OneCopy}, std::vector{num_species}); - physics->AddField(i::kappaJ, mSourceVar); - physics->AddField(i::kappaH, mSourceVar); - physics->AddField(i::JBB, mSourceVar); + physics->AddField(i::kappaJ::name(), mSourceVar); + physics->AddField(i::kappaH::name(), mSourceVar); + physics->AddField(i::JBB::name(), mSourceVar); // this fail flag should really be an enum or something // but parthenon doesn't yet support that kind of thing Metadata m_scalar = Metadata({Metadata::Cell, Metadata::OneCopy, Metadata::Derived, Metadata::Intensive, Metadata::FillGhost}); - physics->AddField(i::c2pfail, m_scalar); - physics->AddField(i::srcfail, m_scalar); + physics->AddField(i::c2pfail::name(), m_scalar); + physics->AddField(i::srcfail::name(), m_scalar); // Make Eddington tensor an independent quantity for MOCMC to supply if (method == "mocmc") { @@ -505,8 +505,8 @@ std::shared_ptr Initialize(ParameterInput *pin) { {Metadata::Cell, Metadata::Derived, Metadata::OneCopy, Metadata::FillGhost}, std::vector{num_species, 3, 3}); - physics->AddField(i::tilPi, mspecies_three_tensor); - physics->AddField(mocmc_internal::dnsamp, mscalar); + physics->AddField(i::tilPi::name(), mspecies_three_tensor); + physics->AddField(mocmc_internal::dnsamp::name(), mscalar); } #if SET_FLUX_SRC_DIAGS @@ -515,12 +515,12 @@ std::shared_ptr Initialize(ParameterInput *pin) { Metadata mdiv = Metadata({Metadata::Cell, Metadata::Intensive, Metadata::Vector, Metadata::Derived, Metadata::OneCopy}, std::vector{num_species, 4}); - physics->AddField(diagnostic_variables::r_divf, mdiv); + physics->AddField(diagnostic_variables::r_divf::name(), mdiv); Metadata mdiag = Metadata({Metadata::Cell, Metadata::Intensive, Metadata::Vector, Metadata::Derived, Metadata::OneCopy}, std::vector{num_species, 4}); - physics->AddField(diagnostic_variables::r_src_terms, mdiag); - printf("name: %s\n", diagnostic_variables::r_src_terms); + physics->AddField(diagnostic_variables::r_src_terms::name(), mdiag); + printf("name: %s\n", diagnostic_variables::r_src_terms::name()); printf("Added fields!\n"); #endif @@ -545,7 +545,8 @@ TaskStatus ApplyRadiationFourForce(MeshBlockData *rc, const double dt) { namespace iv = internal_variables; std::vector vars({c::density::name(), c::energy::name(), - c::momentum::name(), c::ye::name(), iv::Gcov, iv::Gye}); + c::momentum::name(), c::ye::name(), iv::Gcov::name(), + iv::Gye::name()}); PackIndexMap imap; auto v = rc->PackVariables(vars, imap); const int crho = imap[c::density::name()].first; @@ -553,9 +554,9 @@ TaskStatus ApplyRadiationFourForce(MeshBlockData *rc, const double dt) { const int cmom_lo = imap[c::momentum::name()].first; const int cmom_hi = imap[c::momentum::name()].second; const int cye = imap[c::ye::name()].first; - const int Gcov_lo = imap[iv::Gcov].first; - const int Gcov_hi = imap[iv::Gcov].second; - const int Gye = imap[iv::Gye].first; + const int Gcov_lo = imap[iv::Gcov::name()].first; + const int Gcov_hi = imap[iv::Gcov::name()].second; + const int Gye = imap[iv::Gye::name()].first; IndexRange ib = rc->GetBoundsI(IndexDomain::interior); IndexRange jb = rc->GetBoundsJ(IndexDomain::interior); IndexRange kb = rc->GetBoundsK(IndexDomain::interior); @@ -591,10 +592,10 @@ Real EstimateTimestepBlock(MeshBlockData *rc) { auto geom = Geometry::GetCoordinateSystem(rc); PackIndexMap imap; - std::vector vars{ir::kappaH, p::velocity::name()}; + std::vector vars{ir::kappaH::name(), p::velocity::name()}; auto v = rc->PackVariables(vars, imap); auto idx_v = imap.GetFlatIdx(p::velocity::name()); - auto idx_kappaH = imap.GetFlatIdx(ir::kappaH, false); + auto idx_kappaH = imap.GetFlatIdx(ir::kappaH::name(), false); auto num_species = rad->Param("num_species");