From 4a2590e940efbfd7fe73d85c5986b228bdb82b9e Mon Sep 17 00:00:00 2001 From: David Grote Date: Tue, 12 Nov 2024 12:40:12 -0800 Subject: [PATCH] Set use_filter false for implicit evolve schemes (#5453) This PR sets the `use_filter` input parameter to false by default for the implicit evolve schemes. Note that this does not affect any of the related CI tests since the parameter is explicitly specified in all cases. --- Docs/source/usage/parameters.rst | 9 ++++++--- Source/WarpX.cpp | 7 ++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Docs/source/usage/parameters.rst b/Docs/source/usage/parameters.rst index 1b5c3e7b186..37b0e1f6656 100644 --- a/Docs/source/usage/parameters.rst +++ b/Docs/source/usage/parameters.rst @@ -2186,10 +2186,13 @@ Time step Filtering ^^^^^^^^^ -* ``warpx.use_filter`` (`0` or `1`; default: `1`, except for RZ FDTD) - Whether to smooth the charge and currents on the mesh, after depositing them from the macro-particles. +* ``warpx.use_filter`` (`0` or `1`) + Whether to use filtering in the simulation. + With the explicit evolve scheme, the filtering is turned on by default, except for RZ FDTD. + With the implicit evolve schemes, the filtering is turned off by default. + The filtering smoothes the charge and currents on the mesh, after depositing them from the macro-particles. + With implicit schemes, the electric field is also filtered (to maintain consistency for energy conservation). This uses a bilinear filter (see the :ref:`filtering section `). - The default is `1` in all cases, except for simulations in RZ geometry using the FDTD solver. With the RZ PSATD solver, the filtering is done in :math:`k`-space. .. warning:: diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp index cb46f3129c8..5c2f16f317d 100644 --- a/Source/WarpX.cpp +++ b/Source/WarpX.cpp @@ -488,6 +488,7 @@ WarpX::ReadParameters () if (electromagnetic_solver_id == ElectromagneticSolverAlgo::ECT && !EB::enabled()) { throw std::runtime_error("ECP Solver requires to enable embedded boundaries at runtime."); } + pp_algo.query_enum_sloppy("evolve_scheme", evolve_scheme, "-_"); } { @@ -706,6 +707,11 @@ WarpX::ReadParameters () pp_warpx.queryarr("dt_update_interval", dt_interval_vec); dt_update_interval = utils::parser::IntervalsParser(dt_interval_vec); + // Filter defaults to true for the explicit scheme, and false for the implicit schemes + if (evolve_scheme != EvolveScheme::Explicit) { + use_filter = false; + } + // Filter currently not working with FDTD solver in RZ geometry: turn OFF by default // (see https://github.com/ECP-WarpX/WarpX/issues/1943) #ifdef WARPX_DIM_RZ @@ -1113,7 +1119,6 @@ WarpX::ReadParameters () pp_algo.query_enum_sloppy("current_deposition", current_deposition_algo, "-_"); pp_algo.query_enum_sloppy("charge_deposition", charge_deposition_algo, "-_"); pp_algo.query_enum_sloppy("particle_pusher", particle_pusher_algo, "-_"); - pp_algo.query_enum_sloppy("evolve_scheme", evolve_scheme, "-_"); // check for implicit evolve scheme if (evolve_scheme == EvolveScheme::SemiImplicitEM) {