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/Evolve/WarpXEvolve.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'Source/Evolve/WarpXEvolve.cpp') diff --git a/Source/Evolve/WarpXEvolve.cpp b/Source/Evolve/WarpXEvolve.cpp index e8e6a025b..8abfa0e7f 100644 --- a/Source/Evolve/WarpXEvolve.cpp +++ b/Source/Evolve/WarpXEvolve.cpp @@ -549,14 +549,14 @@ WarpX::OneStep_multiJ (const amrex::Real cur_time) // 3) Deposit rho (in rho_new, since it will be moved during the loop) // (after checking that pointer to rho_fp on MR level 0 is not null) - if (rho_fp[0]) + if (rho_fp[0] && rho_in_time == RhoInTime::Linear) { // Deposit rho at relative time -dt // (dt[0] denotes the time step on mesh refinement level 0) mypc->DepositCharge(rho_fp, -dt[0]); // Filter, exchange boundary, and interpolate across levels SyncRho(); - // Forward FFT of rho_new + // Forward FFT of rho PSATDForwardTransformRho(rho_fp, rho_cp, 0, 1); } @@ -587,17 +587,14 @@ WarpX::OneStep_multiJ (const amrex::Real cur_time) // Loop over multi-J depositions for (int i_depose = 0; i_depose < n_loop; i_depose++) { - // Move J deposited previously, from new to old - if (J_in_time == JInTime::Linear) - { - PSATDMoveJNewToJOld(); - } + // Move J from new to old if J is linear in time + if (J_in_time == JInTime::Linear) PSATDMoveJNewToJOld(); const amrex::Real t_depose_current = (J_in_time == JInTime::Linear) ? (i_depose-n_depose+1)*sub_dt : (i_depose-n_depose+0.5_rt)*sub_dt; - // TODO Update this when rho quadratic in time is implemented - const amrex::Real t_depose_charge = (i_depose-n_depose+1)*sub_dt; + const amrex::Real t_depose_charge = (rho_in_time == RhoInTime::Linear) ? + (i_depose-n_depose+1)*sub_dt : (i_depose-n_depose+0.5_rt)*sub_dt; // Deposit new J at relative time t_depose_current with time step dt // (dt[0] denotes the time step on mesh refinement level 0) @@ -616,14 +613,14 @@ WarpX::OneStep_multiJ (const amrex::Real cur_time) // (after checking that pointer to rho_fp on MR level 0 is not null) if (rho_fp[0]) { - // Move rho deposited previously, from new to old - PSATDMoveRhoNewToRhoOld(); + // Move rho from new to old if rho is linear in time + if (rho_in_time == RhoInTime::Linear) PSATDMoveRhoNewToRhoOld(); // Deposit rho at relative time t_depose_charge mypc->DepositCharge(rho_fp, t_depose_charge); // Filter, exchange boundary, and interpolate across levels SyncRho(); - // Forward FFT of rho_new + // Forward FFT of rho PSATDForwardTransformRho(rho_fp, rho_cp, 0, 1); } -- cgit v1.2.3