From 6269c20a6c42037c85efd76bfa9ed162a312df96 Mon Sep 17 00:00:00 2001 From: Edoardo Zoni <59625522+EZoni@users.noreply.github.com> Date: Thu, 8 Jul 2021 02:05:26 -0700 Subject: Do Not Fill Guard Cells with Inverse FFTs, Unless for Field Damping (#2045) * Do Not Always Fill Guard Cells with Inverse FFTs * Query psatd.fill_guards from Inputs * Clean Up and Reduce Style Changes * Fix Bug for Periodic Single Box * Clean Up and Reduce Style Changes * Fix Bug for RZ PSATD * Remove Input Parameter, Default 0 Unless Damping * Fix CI Tests (2D) * Fix CI Tests (3D) --- Source/WarpX.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'Source/WarpX.cpp') diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp index 0745b0941..3c5604a8b 100644 --- a/Source/WarpX.cpp +++ b/Source/WarpX.cpp @@ -99,6 +99,8 @@ Real WarpX::moving_window_v = std::numeric_limits::max(); bool WarpX::fft_do_time_averaging = false; +amrex::IntVect WarpX::fill_guards = amrex::IntVect(0); + Real WarpX::quantum_xi_c2 = PhysConst::xi_c2; Real WarpX::gamma_boost = 1._rt; Real WarpX::beta_boost = 0._rt; @@ -1089,6 +1091,18 @@ WarpX::ReadParameters () "field boundary in both lo and hi must be set to Damped for PSATD" ); } + + // Whether to fill the guard cells with inverse FFTs: + // WarpX::fill_guards = amrex::IntVect(0) by default, + // except for non-periodic directions with damping. + for (int dir = 0; dir < AMREX_SPACEDIM; dir++) + { + if (WarpX::field_boundary_lo[dir] == FieldBoundaryType::Damped || + WarpX::field_boundary_hi[dir] == FieldBoundaryType::Damped) + { + WarpX::fill_guards[dir] = 1; + } + } } if (maxwell_solver_id != MaxwellSolverAlgo::PSATD ) { @@ -1846,6 +1860,7 @@ void WarpX::AllocLevelSpectralSolver (amrex::Vector