aboutsummaryrefslogtreecommitdiff
path: root/Source/Parallelization
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Parallelization')
-rw-r--r--Source/Parallelization/GuardCellManager.H43
-rw-r--r--Source/Parallelization/GuardCellManager.cpp8
2 files changed, 40 insertions, 11 deletions
diff --git a/Source/Parallelization/GuardCellManager.H b/Source/Parallelization/GuardCellManager.H
index 2e1cebff8..34cf549cf 100644
--- a/Source/Parallelization/GuardCellManager.H
+++ b/Source/Parallelization/GuardCellManager.H
@@ -3,11 +3,33 @@
#include <AMReX_IntVect.H>
+/**
+ * \brief This class computes and stores the number of guard cells needed for
+ * the allocation of the MultiFabs and required for each part of the PIC loop.
+ */
class guardCellManager{
public:
- int Init(
+ /**
+ * \brief Initialize number of guard cells depending on the options used.
+ *
+ * \param do_subcycling bool, whether to use subcycling
+ * \param do_fdtd_nci_corr bool, whether to use Godfrey NCI corrector
+ * \param do_nodal bool, whether the field solver is nodal
+ * \param do_moving_window bool, whether to use moving window
+ * \param do_fft_mpi_dec bool, whether to do parallel FFTs for PSATD
+ * \param aux_is_nodal bool, true if the aux grid is nodal
+ * \param moving_window_dir direction of moving window
+ * \param nox order of current deposition
+ * \param nox_fft order of PSATD in x direction
+ * \param noy_fft order of PSATD in y direction
+ * \param noz_fft order of PSATD in z direction
+ * \param nci_corr_stencil stencil of NCI corrector
+ * \param maxwell_fdtd_solver_id if of Maxwell solver
+ * \param max_level max level of the simulation
+ */
+ void Init(
const bool do_subcycling,
const bool do_fdtd_nci_corr,
const bool do_nodal,
@@ -21,21 +43,32 @@ public:
const int maxwell_fdtd_solver_id,
const int max_level);
- // Guard cells allocated for each multifab
+ // Guard cells allocated for MultiFabs E and B
amrex::IntVect ng_alloc_EB = amrex::IntVect::TheZeroVector();
+ // Guard cells allocated for MultiFab J
amrex::IntVect ng_alloc_J = amrex::IntVect::TheZeroVector();
+ // Guard cells allocated for MultiFab Rho
amrex::IntVect ng_alloc_Rho = amrex::IntVect::TheZeroVector();
+ // Guard cells allocated for MultiFab F
amrex::IntVect ng_alloc_F = amrex::IntVect::TheZeroVector();
- int ng_alloc_F_int = 0;
- // Guard cells exchanged for specific in the PIC loop
+ // Guard cells exchanged for specific parts of the PIC loop
+
+ // Number of guard cells of E and B that must exchanged before Field Solver
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 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
amrex::IntVect ng_UpdateAux = amrex::IntVect::TheZeroVector();
+ // Number of guard cells of all MultiFabs that must exchanged before moving window
amrex::IntVect ng_MovingWindow = amrex::IntVect::TheZeroVector();
- // Extra guard cells for fine level of E and B
+ // When the auxiliary grid is nodal but the field solver is staggered
+ // (typically with momentum-conserving gather with FDTD Yee solver),
+ // An extra guard cell is needed on the fine grid to do the interpolation
+ // for E and B.
amrex::IntVect ng_Extra = amrex::IntVect::TheZeroVector();
};
diff --git a/Source/Parallelization/GuardCellManager.cpp b/Source/Parallelization/GuardCellManager.cpp
index 34454bd7e..99feca516 100644
--- a/Source/Parallelization/GuardCellManager.cpp
+++ b/Source/Parallelization/GuardCellManager.cpp
@@ -4,7 +4,7 @@
using namespace amrex;
-int
+void
guardCellManager::Init(
const bool do_subcycling,
const bool do_fdtd_nci_corr,
@@ -69,11 +69,9 @@ guardCellManager::Init(
ng_alloc_J = IntVect(ngJx,ngJz);
#endif
- int nJ_buffer = ng_alloc_J.max(); // guard cells for J required for deposition only.
-
ng_alloc_Rho = ng_alloc_J+1; //One extra ghost cell, so that it's safe to deposit charge density
// after pushing particle.
- ng_alloc_F_int = (do_moving_window) ? 2 : 0;
+ int ng_alloc_F_int = (do_moving_window) ? 2 : 0;
// CKC solver requires one additional guard cell
if (maxwell_fdtd_solver_id == 1) 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));
@@ -155,6 +153,4 @@ guardCellManager::Init(
if (do_moving_window){
ng_MovingWindow[moving_window_dir] = 1;
}
-
- return nJ_buffer;
}