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> --- .../FieldSolver/SpectralSolver/SpectralFieldData.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp') diff --git a/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp b/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp index 56189e0ff..e1db4e5ab 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp @@ -51,10 +51,8 @@ SpectralFieldIndex::SpectralFieldIndex (const bool update_with_rho, { Ex = c++; Ey = c++; Ez = c++; Bx = c++; By = c++; Bz = c++; - Jx = c++; Jy = c++; Jz = c++; // TODO Allocate rho_old and rho_new only when needed - rho_old = c++; rho_new = c++; // Reuse data corresponding to index Bx = 3 to avoid storing extra memory divE = 3; @@ -69,17 +67,25 @@ SpectralFieldIndex::SpectralFieldIndex (const bool update_with_rho, if (divb_cleaning) G = c++; - if (J_in_time == JInTime::Linear) + if (J_in_time == JInTime::Constant) { - Jx_new = c++; - Jy_new = c++; - Jz_new = c++; + Jx_mid = c++; Jy_mid = c++; Jz_mid = c++; + } + else if (J_in_time == JInTime::Linear) + { + Jx_old = c++; Jy_old = c++; Jz_old = c++; + Jx_new = c++; Jy_new = c++; Jz_new = c++; } - if (rho_in_time == RhoInTime::Quadratic) + if (rho_in_time == RhoInTime::Constant) { rho_mid = c++; } + else if (rho_in_time == RhoInTime::Linear) + { + rho_old = c++; + rho_new = c++; + } if (pml_rz) { -- cgit v1.2.3