From 09686d364f981e0d6cc4402f9922474bc7bccaec Mon Sep 17 00:00:00 2001 From: Olga Shapoval <30510597+oshapoval@users.noreply.github.com> Date: Wed, 11 Mar 2020 19:29:26 -0700 Subject: Added optional user defined number of guard cells to use with PSATD solver (#787) * Added optional user defined number of quard cells to use with PSATD solver. * Removed temporary comments. * Changed names nx_guard_psatd to psatd.nx_guard for consistency. --- Source/Parallelization/GuardCellManager.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'Source/Parallelization/GuardCellManager.cpp') 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 - +#include using namespace amrex; @@ -29,12 +28,6 @@ guardCellManager::Init( const amrex::Array 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