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/FieldSolver/SpectralSolver/SpectralSolver.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'Source/FieldSolver/SpectralSolver/SpectralSolver.cpp') diff --git a/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp b/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp index 89a7ce1f5..113ea97c3 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp @@ -23,6 +23,7 @@ SpectralSolver::SpectralSolver( const amrex::DistributionMapping& dm, const int norder_x, const int norder_y, const int norder_z, const bool nodal, + const amrex::IntVect& fill_guards, const amrex::Array& v_galilean, const amrex::Array& v_comoving, const amrex::RealVect dx, const amrex::Real dt, @@ -45,24 +46,29 @@ SpectralSolver::SpectralSolver( if (pml) { algorithm = std::make_unique( - k_space, dm, norder_x, norder_y, norder_z, nodal, dt, dive_cleaning, divb_cleaning); + k_space, dm, norder_x, norder_y, norder_z, nodal, + fill_guards, dt, dive_cleaning, divb_cleaning); } else { // Comoving PSATD algorithm if (v_comoving[0] != 0. || v_comoving[1] != 0. || v_comoving[2] != 0.) { algorithm = std::make_unique( - k_space, dm, norder_x, norder_y, norder_z, nodal, v_comoving, dt, update_with_rho); + k_space, dm, norder_x, norder_y, norder_z, nodal, + fill_guards, v_comoving, dt, update_with_rho); } // PSATD algorithms: standard, Galilean, or averaged Galilean else { algorithm = std::make_unique( - k_space, dm, norder_x, norder_y, norder_z, nodal, v_galilean, dt, update_with_rho, fft_do_time_averaging, J_linear_in_time); + k_space, dm, norder_x, norder_y, norder_z, nodal, fill_guards, + v_galilean, dt, update_with_rho, fft_do_time_averaging, J_linear_in_time); } } // - Initialize arrays for fields in spectral space + FFT plans field_data = SpectralFieldData( lev, realspace_ba, k_space, dm, algorithm->getRequiredNumberOfFields(), periodic_single_box); + + m_fill_guards = fill_guards; } void @@ -82,7 +88,7 @@ SpectralSolver::BackwardTransform( const int lev, const int i_comp ) { WARPX_PROFILE("SpectralSolver::BackwardTransform"); - field_data.BackwardTransform( lev, mf, field_index, i_comp ); + field_data.BackwardTransform(lev, mf, field_index, i_comp, m_fill_guards); } void -- cgit v1.2.3