Skip to content

Commit

Permalink
bug fixed in ISMR
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyerin Cho committed Oct 9, 2024
1 parent 202139d commit 9eb64b7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions kharma/ismr/ismr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ TaskStatus ISMR::DerefinePoles(MeshData<Real> *md)
int ng = Globals::nghost;
for (auto &pmb : pmesh->block_list) {
auto& rc = pmb->meshblock_data.Get();
PackIndexMap cons_map;
PackIndexMap cons_map, cons_map_utop;
auto vars = rc->PackVariables(std::vector<MetadataFlag>{Metadata::Conserved, Metadata::Cell, Metadata::Independent}, cons_map);
auto vars_avg = rc->PackVariables(std::vector<std::string>{"ismr.vars_avg"});
auto vars_utop = rc->PackVariables(std::vector<MetadataFlag>{Metadata::Conserved, Metadata::Cell}, cons_map_utop);
const int nvar = vars.GetDim(4);
for (int i = 0; i < BOUNDARY_NFACES; i++) {
BoundaryFace bface = (BoundaryFace) i;
Expand Down Expand Up @@ -136,7 +137,7 @@ TaskStatus ISMR::DerefinePoles(MeshData<Real> *md)
// UtoP for the GRMHD variables
PackIndexMap prims_map;
auto P = rc->PackVariables(std::vector<MetadataFlag>{Metadata::GetUserFlag("Primitive"), Metadata::Cell}, prims_map);
VarMap m_u(cons_map, true), m_p(prims_map, false);
VarMap m_u(cons_map_utop, true), m_p(prims_map, false);
const auto& G = pmb->coords;
const Real gam = pmb->packages.Get("GRMHD")->Param<Real>("gamma");
const Floors::Prescription floors = pmb->packages.Get("Floors")->Param<Floors::Prescription>("prescription");
Expand All @@ -145,13 +146,13 @@ TaskStatus ISMR::DerefinePoles(MeshData<Real> *md)
const int j_c = j + ((binner) ? 0 : -1); // cell center
// The usual inverter is not EMHD-aware, so it's going to dump all of T into the
// ideal GRMHD fluid variables
Inverter::u_to_p<Inverter::Type::onedw>(G, vars, m_u, gam, k, j_c, i, P, m_p, Loci::center,
Inverter::u_to_p<Inverter::Type::onedw>(G, vars_utop, m_u, gam, k, j_c, i, P, m_p, Loci::center,
floors, 8, 1e-8);
// Consistent with that, we zero out the EMHD extra variables. This switches theories to
// evolving ideal GRMHD in ISMR region, but conserves the components of T themselves
if (m_u.Q >= 0) vars(m_u.Q, k, j_c, i) = 0.;
if (m_u.Q >= 0) vars_utop(m_u.Q, k, j_c, i) = 0.;
if (m_p.Q >= 0) P(m_p.Q, k, j_c, i) = 0.;
if (m_u.DP >= 0) vars(m_u.DP, k, j_c, i) = 0.;
if (m_u.DP >= 0) vars_utop(m_u.DP, k, j_c, i) = 0.;
if (m_p.DP >= 0) P(m_p.DP, k, j_c, i) = 0.;
}
);
Expand Down

0 comments on commit 9eb64b7

Please sign in to comment.