aboutsummaryrefslogtreecommitdiff
path: root/Source/Parallelization/GuardCellManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Parallelization/GuardCellManager.cpp')
-rw-r--r--Source/Parallelization/GuardCellManager.cpp46
1 files changed, 36 insertions, 10 deletions
diff --git a/Source/Parallelization/GuardCellManager.cpp b/Source/Parallelization/GuardCellManager.cpp
index b569c43e7..c03172460 100644
--- a/Source/Parallelization/GuardCellManager.cpp
+++ b/Source/Parallelization/GuardCellManager.cpp
@@ -8,7 +8,13 @@
#include "Filter/NCIGodfreyFilter.H"
#include "Utils/WarpXAlgorithmSelection.H"
#include "Utils/WarpXConst.H"
-
+#ifdef WARPX_DIM_RZ
+# include "FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CylindricalYeeAlgorithm.H"
+#else
+# include "FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianYeeAlgorithm.H"
+# include "FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianNodalAlgorithm.H"
+# include "FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianCKCAlgorithm.H"
+#endif
#include <AMReX_ParmParse.H>
#include <AMReX.H>
@@ -184,11 +190,36 @@ guardCellManager::Init (
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));
}
+#ifdef WARPX_DIM_RZ
+ else if (maxwell_solver_id == MaxwellSolverAlgo::Yee) {
+ ng_FieldSolver = CylindricalYeeAlgorithm::GetMaxGuardCell();
+ ng_FieldSolverF = CylindricalYeeAlgorithm::GetMaxGuardCell();
+ ng_FieldSolverG = CylindricalYeeAlgorithm::GetMaxGuardCell();
+ }
+#else
+ else {
+ if (do_nodal) {
+ ng_FieldSolver = CartesianNodalAlgorithm::GetMaxGuardCell();
+ ng_FieldSolverF = CartesianNodalAlgorithm::GetMaxGuardCell();
+ ng_FieldSolverG = CartesianNodalAlgorithm::GetMaxGuardCell();
+ } else if (maxwell_solver_id == MaxwellSolverAlgo::Yee) {
+ ng_FieldSolver = CartesianYeeAlgorithm::GetMaxGuardCell();
+ ng_FieldSolverF = CartesianYeeAlgorithm::GetMaxGuardCell();
+ ng_FieldSolverG = CartesianYeeAlgorithm::GetMaxGuardCell();
+ } else if (maxwell_solver_id == MaxwellSolverAlgo::CKC) {
+ ng_FieldSolver = CartesianCKCAlgorithm::GetMaxGuardCell();
+ ng_FieldSolverF = CartesianCKCAlgorithm::GetMaxGuardCell();
+ ng_FieldSolverG = CartesianCKCAlgorithm::GetMaxGuardCell();
+ }
+ }
+#endif
+
+ // Number of guard cells is the max of that determined by particle shape factor and
+ // the stencil used in the field solve
+ ng_alloc_EB.max( ng_FieldSolver );
+ ng_alloc_F.max( ng_FieldSolverF );
+ ng_alloc_G.max( ng_FieldSolverG );
if (safe_guard_cells){
// Run in safe mode: exchange all allocated guard cells at each
@@ -202,9 +233,6 @@ guardCellManager::Init (
ng_MovingWindow = ng_alloc_EB;
}
} else {
-
- ng_FieldSolver = ng_FieldSolver.min(ng_alloc_EB);
-
// Compute number of cells required for Field Gather
int FGcell[4] = {0,1,1,2}; // Index is nox
IntVect ng_FieldGather_noNCI = IntVect(AMREX_D_DECL(FGcell[nox],FGcell[nox],FGcell[nox]));
@@ -224,8 +252,6 @@ guardCellManager::Init (
// Make sure we do not exchange more guard cells than allocated.
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.