From 4073384c7b66b1848bcc94e6c986f7d532c7da11 Mon Sep 17 00:00:00 2001 From: Edoardo Zoni <59625522+EZoni@users.noreply.github.com> Date: Wed, 7 Dec 2022 15:40:02 -0800 Subject: PSATD: Implement First-Order Equations (#3466) * Implement First-Order PSATD Equations * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix Unused Parameter Warning * Fix RZ Build * Fix Normalization of G to Match PML * Add CI Test: 3D Uniform Plasma * Cleaning * Update 2D CI Checksums * Update 3D CI Checksums * Add F,G to CI Checksums of `uniform_plasma_multiJ` * Allow User to Choose First-Order v. Second-Order * Add WARPX_ALWAYS_ASSERT_WITH_MESSAGE * Rename New Class `PsatdAlgorithmFirstOrder` * Remove Inline Comment * Update RZ CI Checksums * Fix inline comment * Use auxiliary variables to avoid divisions * Use auxiliary variables to avoid divisions * Make `nci_psatd_stability` dir and merge inputs * Move all Galilean tests to `nci_psatd_stability` * Fix CI * Fix index for backward FFT of J Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- Source/WarpX.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'Source/WarpX.cpp') diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp index 579387433..e51197089 100644 --- a/Source/WarpX.cpp +++ b/Source/WarpX.cpp @@ -120,6 +120,7 @@ short WarpX::charge_deposition_algo; short WarpX::field_gathering_algo; short WarpX::particle_pusher_algo; short WarpX::electromagnetic_solver_id; +short WarpX::psatd_solution_type; short WarpX::J_in_time; short WarpX::rho_in_time; short WarpX::load_balance_costs_update_algo; @@ -1148,6 +1149,11 @@ WarpX::ReadParameters () WARPX_ALWAYS_ASSERT_WITH_MESSAGE(noz_fft > 0, "PSATD order must be finite unless psatd.periodic_single_box_fft is used"); } + // Integer that corresponds to the order of the PSATD solution + // (whether the PSATD equations are derived from first-order or + // second-order solution) + psatd_solution_type = GetAlgorithmInteger(pp_psatd, "solution_type"); + // Integers that correspond to the time dependency of J (constant, linear) // and rho (linear, quadratic) for the PSATD algorithm J_in_time = GetAlgorithmInteger(pp_psatd, "J_in_time"); @@ -1311,13 +1317,6 @@ WarpX::ReadParameters () ); } - if (J_in_time == JInTime::Constant) - { - WARPX_ALWAYS_ASSERT_WITH_MESSAGE( - rho_in_time == RhoInTime::Linear, - "psatd.J_in_time=constant supports only psatd.rho_in_time=linear"); - } - if (J_in_time == JInTime::Linear) { WARPX_ALWAYS_ASSERT_WITH_MESSAGE( @@ -1331,6 +1330,14 @@ WarpX::ReadParameters () WARPX_ALWAYS_ASSERT_WITH_MESSAGE( v_comoving_is_zero, "psatd.J_in_time=linear not implemented with comoving PSATD"); + + WARPX_ALWAYS_ASSERT_WITH_MESSAGE( + !current_correction, + "psatd.current_correction=1 not implemented with psatd.J_in_time=linear"); + + WARPX_ALWAYS_ASSERT_WITH_MESSAGE( + current_deposition_algo != CurrentDepositionAlgo::Vay, + "algo.current_deposition=vay not implemented with psatd.J_in_time=linear"); } for (int dir = 0; dir < AMREX_SPACEDIM; dir++) @@ -2334,6 +2341,7 @@ void WarpX::AllocLevelSpectralSolver (amrex::Vector