Skip to content

Commit

Permalink
address most of jdolence comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahm-LANL committed Nov 13, 2020
1 parent 4f1175b commit ba2c60d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 45 deletions.
3 changes: 1 addition & 2 deletions example/advection/advection_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ TaskCollection AdvectionDriver::MakeTaskCollection(BlockList_t &blocks, const in
// set physical boundaries
// note "false" in call to ApplyBoundaryConditions.
// AddTask is not smart enough to resolve function overloads or default arguments.
auto set_bc =
tl.AddTask(prolongBound, parthenon::ApplyBoundaryConditions, sc1, false);
auto set_bc = tl.AddTask(prolongBound, parthenon::ApplyBoundaryConditions, sc1);

// fill in derived fields
auto fill_derived =
Expand Down
6 changes: 3 additions & 3 deletions src/bvals/boundary_conditions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ TaskStatus ProlongateBoundaries(std::shared_ptr<MeshBlockData<Real>> &rc) {
rc->RestrictBoundaries(); // Step 1: restrict physical boundaries

// Step 2. Re-apply physical boundaries on the coarse boundary,
ApplyBoundaryConditions(rc, true);
ApplyBoundaryConditionsOnCoarseOrFine(rc, true);

// Step 3. Finally, the ghost-ghost zones are ready for prolongation:
rc->ProlongateBoundaries();

return TaskStatus::complete;
}

TaskStatus ApplyBoundaryConditions(std::shared_ptr<MeshBlockData<Real>> &rc,
bool coarse) {
TaskStatus ApplyBoundaryConditionsOnCoarseOrFine(std::shared_ptr<MeshBlockData<Real>> &rc,
bool coarse) {
using namespace boundary_cond_impl;
std::shared_ptr<MeshBlock> pmb = rc->GetBlockPointer();
Mesh *pmesh = pmb->pmy_mesh;
Expand Down
8 changes: 6 additions & 2 deletions src/bvals/boundary_conditions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ using BValFunc = std::function<void(std::shared_ptr<MeshBlockData<Real>> &, bool

TaskStatus ProlongateBoundaries(std::shared_ptr<MeshBlockData<Real>> &rc);

TaskStatus ApplyBoundaryConditions(std::shared_ptr<MeshBlockData<Real>> &rc,
bool coarse = false);
TaskStatus ApplyBoundaryConditionsOnCoarseOrFine(std::shared_ptr<MeshBlockData<Real>> &rc,
bool coarse);

inline TaskStatus ApplyBoundaryConditions(std::shared_ptr<MeshBlockData<Real>> &rc) {
return ApplyBoundaryConditionsOnCoarseOrFine(rc, false);
}

namespace BoundaryFunction {

Expand Down
34 changes: 2 additions & 32 deletions src/interface/meshblock_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -818,46 +818,16 @@ TaskStatus MeshBlockData<T>::ClearBoundary(BoundaryCommSubset phase) {

template <typename T>
void MeshBlockData<T>::RestrictBoundaries() {
// TODO(JMM): Change this upon refactor of BoundaryValues
auto pmb = GetBlockPointer();
pmb->pbval->RestrictBoundaries();
// TODO(JMM): once we have variable-level pbvals we can do this
/*
for (auto &v : varVector_) {
if (v->IsSet(Metadata::FillGhost)) {
v->pbvals->RestrictBoundaries();
}
}
for (auto &sv : sparseVector_) {
if (sv->IsSet(Metadata::FillGhost)) {
CellVariableVector<T> vvec = sv->GetVector();
for (auto &v : vvec) {
v->pbvals->RestrictBoundaries();
}
}
}
*/
}

template <typename T>
void MeshBlockData<T>::ProlongateBoundaries() {
// TODO(JMM): Change this upon refactor of BoundaryValues
auto pmb = GetBlockPointer();
pmb->pbval->ProlongateBoundaries();
// TODO(JMM): once we have variable-level pbvals we can do this
/*
for (auto &v : varVector_) {
if (v->IsSet(Metadata::FillGhost)) {
v->pbvals->ProlongateBoundaries();
}
}
for (auto &sv : sparseVector_) {
if (sv->IsSet(Metadata::FillGhost)) {
CellVariableVector<T> vvec = sv->GetVector();
for (auto &v : vvec) {
v->pbvals->ProlongateBoundaries();
}
}
}
*/
}

template <typename T>
Expand Down
12 changes: 6 additions & 6 deletions src/mesh/mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ Mesh::Mesh(ParameterInput *pin, ApplicationInput *app_in, Properties_t &properti
pin->GetInteger("parthenon/mesh", "nx2"),
pin->GetInteger("parthenon/mesh", "nx3")},
mesh_bcs{
GetBoundaryFlag(pin->GetOrAddString("parthenon/mesh", "ix1_bc", "periodic")),
GetBoundaryFlag(pin->GetOrAddString("parthenon/mesh", "ox1_bc", "periodic")),
GetBoundaryFlag(pin->GetOrAddString("parthenon/mesh", "ix2_bc", "periodic")),
GetBoundaryFlag(pin->GetOrAddString("parthenon/mesh", "ox2_bc", "periodic")),
GetBoundaryFlag(pin->GetOrAddString("parthenon/mesh", "ix3_bc", "periodic")),
GetBoundaryFlag(pin->GetOrAddString("parthenon/mesh", "ox3_bc", "periodic"))},
GetBoundaryFlag(pin->GetOrAddString("parthenon/mesh", "ix1_bc", "reflecting")),
GetBoundaryFlag(pin->GetOrAddString("parthenon/mesh", "ox1_bc", "reflecting")),
GetBoundaryFlag(pin->GetOrAddString("parthenon/mesh", "ix2_bc", "reflecting")),
GetBoundaryFlag(pin->GetOrAddString("parthenon/mesh", "ox2_bc", "reflecting")),
GetBoundaryFlag(pin->GetOrAddString("parthenon/mesh", "ix3_bc", "reflecting")),
GetBoundaryFlag(pin->GetOrAddString("parthenon/mesh", "ox3_bc", "reflecting"))},
ndim((mesh_size.nx3 > 1) ? 3 : ((mesh_size.nx2 > 1) ? 2 : 1)),
adaptive(pin->GetOrAddString("parthenon/mesh", "refinement", "none") == "adaptive"
? true
Expand Down

0 comments on commit ba2c60d

Please sign in to comment.