Skip to content

Commit

Permalink
Merge pull request #904 from parthenon-hpc-lab/lroberts36/add-noncell…
Browse files Browse the repository at this point in the history
…-amr

AMR for non-cell centered fields
  • Loading branch information
bprather authored Aug 18, 2023
2 parents fb6110c + 02566c2 commit 0830cde
Show file tree
Hide file tree
Showing 15 changed files with 480 additions and 452 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- [[PR 890]](https://github.com/parthenon-hpc-lab/parthenon/pull/890) Fix bugs in sparse communication and prolongation

### Infrastructure (changes irrelevant to downstream codes)
- [[PR 904]](https://github.com/parthenon-hpc-lab/parthenon/pull/904) Move to prolongation/restriction in one for AMR and communicate non-cell centered fields
- [[PR 918]](https://github.com/parthenon-hpc-lab/parthenon/pull/918) Refactor RegionSize
- [[PR 901]](https://github.com/parthenon-hpc-lab/parthenon/pull/901) Implement shared element ownership model

Expand Down
50 changes: 0 additions & 50 deletions src/bvals/boundary_conditions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,56 +133,6 @@ bool DoPhysicalBoundary_(const BoundaryFlag flag, const BoundaryFace face,
return true; // reflect, outflow, user, dims correct
}

void ProlongateGhostCells_(std::shared_ptr<MeshBlockData<Real>> &rc,
const NeighborBlock &nb, int si, int ei, int sj, int ej,
int sk, int ek) {
std::shared_ptr<MeshBlock> pmb = rc->GetBlockPointer();
auto &pmr = pmb->pmr;

for (auto var : rc->GetVariableVector()) {
if (!var->IsAllocated()) continue;
if (!(var->IsSet(Metadata::Independent) || var->IsSet(Metadata::FillGhost))) continue;

if (var->IsSet(Metadata::Cell)) {
pmr->ProlongateCellCenteredValues(var.get(), si, ei, sj, ej, sk, ek);
} else {
PARTHENON_FAIL("Prolongation not implemented for non-cell centered variables.");
}
}

// TODO(LFR): Deal with prolongation of non-cell centered values
}

void ComputeProlongationBounds_(const std::shared_ptr<MeshBlock> &pmb,
const NeighborBlock &nb, IndexRange &bi, IndexRange &bj,
IndexRange &bk) {
const IndexDomain interior = IndexDomain::interior;
int cn = pmb->cnghost - 1;

auto getbounds = [=](const int nbx, const std::int64_t &lx, const IndexRange bblock,
IndexRange &bprol) {
if (nbx == 0) {
bprol.s = bblock.s;
bprol.e = bblock.e;
if ((lx & 1LL) == 0LL) {
bprol.e += cn;
} else {
bprol.s -= cn;
}
} else if (nbx > 0) {
bprol.s = bblock.e + 1;
bprol.e = bblock.e + cn;
} else {
bprol.s = bblock.s - cn;
bprol.e = bblock.s - 1;
}
};

getbounds(nb.ni.ox1, pmb->loc.lx1(), pmb->c_cellbounds.GetBoundsI(interior), bi);
getbounds(nb.ni.ox2, pmb->loc.lx2(), pmb->c_cellbounds.GetBoundsJ(interior), bj);
getbounds(nb.ni.ox3, pmb->loc.lx3(), pmb->c_cellbounds.GetBoundsK(interior), bk);
}

} // namespace boundary_cond_impl

} // namespace parthenon
Loading

0 comments on commit 0830cde

Please sign in to comment.