Skip to content

Commit

Permalink
Fix a face-CT divB problem by avoiding applying any custom conditions…
Browse files Browse the repository at this point in the history
… to coarse buffers
  • Loading branch information
Ben Prather committed Dec 4, 2023
1 parent abd00a4 commit f15c1ae
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
9 changes: 7 additions & 2 deletions kharma/boundaries/boundaries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,18 @@ void KBoundaries::ApplyBoundary(std::shared_ptr<MeshBlockData<Real>> &rc, IndexD
pkg->KBoundaries[bface](rc, coarse);
EndFlag();

// Nothing below is designed, nor necessary, for coarse buffers
if (coarse) {
EndFlag();
return;
}

// If we're syncing EMFs and in spherical, explicitly zero polar faces
// Since we manipulate the j coord, we'd overstep coarse bufs
auto& emfpack = rc->PackVariables(std::vector<std::string>{"B_CT.emf"});
if (bdir == X2DIR &&
pmb->coords.coords.is_spherical() &&
emfpack.GetDim(4) > 0 &&
!coarse) {
emfpack.GetDim(4) > 0) {
Flag("BoundaryEdge_"+bname);
for (TE el : {TE::E1, TE::E3}) {
int off = (binner) ? 1 : -1;
Expand Down
4 changes: 4 additions & 0 deletions kharma/driver/kharma_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,15 @@ TaskStatus KHARMADriver::SyncAllBounds(std::shared_ptr<MeshData<Real>> &md)
Flag("SyncAllBounds");
TaskID t_none(0);

//MPIBarrier();

TaskCollection tc;
auto tr = tc.AddRegion(1);
AddBoundarySync(t_none, tr[0], md);
while (!tr.Execute());

//MPIBarrier();

EndFlag();
return TaskStatus::complete;
}
Expand Down
6 changes: 3 additions & 3 deletions kharma/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ int main(int argc, char *argv[])
}
// If very verbose, print # meshblocks on every rank
if (verbose > 1) {
MPIBarrier();
//MPIBarrier();
if (MPIRank() > 0)
std::cout << "Blocks on rank " << MPIRank() << ": " << pmesh->block_list.size() << "\n" << std::endl;
}
Expand Down Expand Up @@ -234,14 +234,14 @@ int main(int argc, char *argv[])
auto pin = pman.pinput.get(); // All parameters in the input file or command line

// We now have just one driver package, with different TaskLists for different modes
MPIBarrier();
//MPIBarrier();
KHARMADriver driver(pin, papp, pmesh);

// Then execute the driver. This is a Parthenon function inherited by our KHARMADriver object,
// which will call MakeTaskCollection, then execute the tasks on the mesh for each portion
// of each step until a stop criterion is reached.
Flag("driver.Execute");
MPIBarrier();
//MPIBarrier();
auto driver_status = driver.Execute();
EndFlag();
}
Expand Down

0 comments on commit f15c1ae

Please sign in to comment.