diff options
Diffstat (limited to 'Source/Parallelization')
-rw-r--r-- | Source/Parallelization/GuardCellManager.H | 4 | ||||
-rw-r--r-- | Source/Parallelization/GuardCellManager.cpp | 9 | ||||
-rw-r--r-- | Source/Parallelization/WarpXComm.cpp | 60 |
3 files changed, 72 insertions, 1 deletions
diff --git a/Source/Parallelization/GuardCellManager.H b/Source/Parallelization/GuardCellManager.H index 84aa45d38..1583c0bd6 100644 --- a/Source/Parallelization/GuardCellManager.H +++ b/Source/Parallelization/GuardCellManager.H @@ -61,6 +61,8 @@ public: amrex::IntVect ng_alloc_Rho = amrex::IntVect::TheZeroVector(); // Guard cells allocated for MultiFab F amrex::IntVect ng_alloc_F = amrex::IntVect::TheZeroVector(); + // Guard cells allocated for MultiFab G + amrex::IntVect ng_alloc_G = amrex::IntVect::TheZeroVector(); // Guard cells exchanged for specific parts of the PIC loop @@ -68,6 +70,8 @@ public: amrex::IntVect ng_FieldSolver = amrex::IntVect::TheZeroVector(); // Number of guard cells of F that must exchanged before Field Solver amrex::IntVect ng_FieldSolverF = amrex::IntVect::TheZeroVector(); + // Number of guard cells of G that must be exchanged before Field Solver + amrex::IntVect ng_FieldSolverG = amrex::IntVect::TheZeroVector(); // Number of guard cells of E and B that must exchanged before Field Gather amrex::IntVect ng_FieldGather = amrex::IntVect::TheZeroVector(); // Number of guard cells of E and B that must exchanged before updating the Aux grid diff --git a/Source/Parallelization/GuardCellManager.cpp b/Source/Parallelization/GuardCellManager.cpp index b40c4433b..b569c43e7 100644 --- a/Source/Parallelization/GuardCellManager.cpp +++ b/Source/Parallelization/GuardCellManager.cpp @@ -122,6 +122,11 @@ guardCellManager::Init ( if (maxwell_solver_id == MaxwellSolverAlgo::CKC) ng_alloc_F_int = std::max( ng_alloc_F_int, 1 ); ng_alloc_F = IntVect(AMREX_D_DECL(ng_alloc_F_int, ng_alloc_F_int, ng_alloc_F_int)); + // Used if warpx.do_divb_cleaning = 1 + int ng_alloc_G_int = (do_moving_window) ? 2 : 1; + // TODO Does the CKC solver require one additional guard cell (as for F)? + ng_alloc_G = IntVect(AMREX_D_DECL(ng_alloc_G_int, ng_alloc_G_int, ng_alloc_G_int)); + if (maxwell_solver_id == MaxwellSolverAlgo::PSATD) { // The number of guard cells should be enough to contain the stencil of the FFT solver. @@ -178,9 +183,11 @@ guardCellManager::Init ( if (maxwell_solver_id == MaxwellSolverAlgo::PSATD) { ng_FieldSolver = ng_alloc_EB; ng_FieldSolverF = ng_alloc_EB; + ng_FieldSolverG = ng_alloc_EB; } else { ng_FieldSolver = IntVect(AMREX_D_DECL(1, 1, 1)); ng_FieldSolverF = IntVect(AMREX_D_DECL(1, 1, 1)); + ng_FieldSolverG = IntVect(AMREX_D_DECL(1, 1, 1)); } if (safe_guard_cells){ @@ -188,6 +195,7 @@ guardCellManager::Init ( // call of FillBoundary ng_FieldSolver = ng_alloc_EB; ng_FieldSolverF = ng_alloc_F; + ng_FieldSolverG = ng_alloc_G; ng_FieldGather = ng_alloc_EB; ng_UpdateAux = ng_alloc_EB; if (do_moving_window){ @@ -217,6 +225,7 @@ guardCellManager::Init ( ng_FieldGather = ng_FieldGather.min(ng_alloc_EB); ng_UpdateAux = ng_UpdateAux.min(ng_alloc_EB); ng_FieldSolverF = ng_FieldSolverF.min(ng_alloc_F); + ng_FieldSolverG = ng_FieldSolverG.min(ng_alloc_G); // Only FillBoundary(ng_FieldGather) is called between consecutive // field solves. So ng_FieldGather must have enough cells // for the field solve too. diff --git a/Source/Parallelization/WarpXComm.cpp b/Source/Parallelization/WarpXComm.cpp index d92cffb11..3badbdf2d 100644 --- a/Source/Parallelization/WarpXComm.cpp +++ b/Source/Parallelization/WarpXComm.cpp @@ -457,6 +457,15 @@ WarpX::FillBoundaryF (IntVect ng) } void +WarpX::FillBoundaryG (IntVect ng) +{ + for (int lev = 0; lev <= finest_level; ++lev) + { + FillBoundaryG(lev, ng); + } +} + +void WarpX::FillBoundaryB_avg (IntVect ng) { for (int lev = 0; lev <= finest_level; ++lev) @@ -702,7 +711,6 @@ WarpX::FillBoundaryB_avg (int lev, PatchType patch_type, IntVect ng) } } - void WarpX::FillBoundaryF (int lev, IntVect ng) { @@ -753,6 +761,56 @@ WarpX::FillBoundaryF (int lev, PatchType patch_type, IntVect ng) } } +void WarpX::FillBoundaryG (int lev, IntVect ng) +{ + FillBoundaryG(lev, PatchType::fine, ng); + + if (lev > 0) + { + FillBoundaryG(lev, PatchType::coarse, ng); + } +} + +void WarpX::FillBoundaryG (int lev, PatchType patch_type, IntVect ng) +{ + if (patch_type == PatchType::fine && G_fp[lev]) + { + // TODO Exchange in PML cells will go here + + const auto& period = Geom(lev).periodicity(); + + if (safe_guard_cells) + { + G_fp[lev]->FillBoundary(period); + } + else + { + AMREX_ALWAYS_ASSERT_WITH_MESSAGE(ng <= G_fp[lev]->nGrowVect(), + "Error: in FillBoundaryG, requested more guard cells than allocated"); + + G_fp[lev]->FillBoundary(ng, period); + } + } + else if (patch_type == PatchType::coarse && G_cp[lev]) + { + // TODO Exchange in PML cells will go here + + const auto& cperiod = Geom(lev-1).periodicity(); + + if (safe_guard_cells) + { + G_cp[lev]->FillBoundary(cperiod); + } + else + { + AMREX_ALWAYS_ASSERT_WITH_MESSAGE(ng <= G_cp[lev]->nGrowVect(), + "Error: in FillBoundaryG, requested more guard cells than allocated"); + + G_cp[lev]->FillBoundary(ng, cperiod); + } + } +} + void WarpX::FillBoundaryAux (IntVect ng) { |