diff options
-rw-r--r-- | Docs/source/running_cpp/parameters.rst | 5 | ||||
-rw-r--r-- | Source/Parallelization/GuardCellManager.cpp | 27 |
2 files changed, 18 insertions, 14 deletions
diff --git a/Docs/source/running_cpp/parameters.rst b/Docs/source/running_cpp/parameters.rst index 5966d2da1..dc8527d72 100644 --- a/Docs/source/running_cpp/parameters.rst +++ b/Docs/source/running_cpp/parameters.rst @@ -940,6 +940,11 @@ Numerics and algorithms * ``psatd.nox``, ``psatd.noy``, ``pstad.noz`` (`integer`) optional (default `16` for all) The order of accuracy of the spatial derivatives, when using the code compiled with a PSATD solver. +* ``psatd.nx_guard`, ``psatd.ny_guard``, ``psatd.nz_guard`` (`integer`) optional + The number of guard cells to use with PSATD solver. + If not set by users, these values are calculated automatically and determined *empirically* and + would be equal the order of the solver for nodal grid, and half the order of the solver for staggered. + * ``psatd.hybrid_mpi_decomposition`` (`0` or `1`; default: 0) Whether to use a different MPI decomposition for the particle-grid operations (deposition and gather) and for the PSATD solver. If `1`, the FFT will diff --git a/Source/Parallelization/GuardCellManager.cpp b/Source/Parallelization/GuardCellManager.cpp index 8e4eca183..f36c64214 100644 --- a/Source/Parallelization/GuardCellManager.cpp +++ b/Source/Parallelization/GuardCellManager.cpp @@ -6,9 +6,8 @@ */ #include "GuardCellManager.H" #include "Filter/NCIGodfreyFilter.H" - #include <AMReX_Print.H> - +#include <AMReX_ParmParse.H> using namespace amrex; @@ -29,12 +28,6 @@ guardCellManager::Init( const amrex::Array<amrex::Real,3> v_galilean, const bool safe_guard_cells) { -#ifndef WARPX_USE_PSATD - (void)do_fft_mpi_dec; - (void)nox_fft; - (void)noy_fft; - (void)noz_fft; -#endif // When using subcycling, the particles on the fine level perform two pushes // before being redistributed ; therefore, we need one extra guard cell // (the particles may move by 2*c*dt) @@ -110,12 +103,18 @@ guardCellManager::Init( // the stencil of the FFT solver. Here, this number (`ngFFT`) // is determined *empirically* to be the order of the solver // for nodal, and half the order of the solver for staggered. - IntVect ngFFT; - if (do_nodal) { - ngFFT = IntVect(AMREX_D_DECL(nox_fft, noy_fft, noz_fft)); - } else { - ngFFT = IntVect(AMREX_D_DECL(nox_fft/2, noy_fft/2, noz_fft/2)); - } + + int ngFFt_x = do_nodal ? nox_fft : nox_fft/2.; + int ngFFt_y = do_nodal ? noy_fft : noy_fft/2.; + int ngFFt_z = do_nodal ? noz_fft : noz_fft/2.; + + ParmParse pp("psatd"); + pp.query("nx_guard", ngFFt_x); + pp.query("ny_guard", ngFFt_y); + pp.query("nz_guard", ngFFt_z); + + IntVect ngFFT = IntVect(AMREX_D_DECL(ngFFt_x, ngFFt_y, ngFFt_z)); + for (int i_dim=0; i_dim<AMREX_SPACEDIM; i_dim++ ){ int ng_required = ngFFT[i_dim]; // Get the max |