From 4dcee1f248e18c5a16da5beec287c119258d416e Mon Sep 17 00:00:00 2001 From: Edoardo Zoni <59625522+EZoni@users.noreply.github.com> Date: Mon, 20 Jul 2020 08:33:30 -0700 Subject: Vay current deposition (#1051) * Added stub for current correction in RZ spectral solver * Start implementation of Vay deposition * Continue implementation of Vay deposition * Correct deposition of D * Add phase shift for staggered currents * Small clean-up * Fix units in deposition of D * Implement average of cumulative sum (needs bug fix) * Start fixing bug in average of cumulative sum * Still debugging * Cumulative sums should be correct now * Subtract averages of cumulative sums: - current implementation: cumulative sums, inverse Fourier transform, subtraction of averages - needs to be tested (including units of D after Vay deposition) - needs to be shortened (too many loops over boxes and ParallelFors) * [skip CI] Clean up and fix units * Still fixing units * [skip CI] Remove temporarily averages of cumulative sums * [skip CI] Remove distinction between staggered and nodal * Vay and Esirkepov similar results on periodic single box: TODO: - debug (charge not conserved); - try using compute_shifted_shape_factor as in Esirkepov deposition; - clean up; - try on multiple boxes and with correction of mode at 0 frequency. * [skip CI] Clean up * Fix bug in 3D deposition * [skip CI] Clean up * Fix 2D and 3D implementation: - simulation results agree between direct and Vay deposition in both 2D and 3D - Travis CI tests should pass except for check of charge conservation (debug) * Small clean-up * Fix bug when compiling in RZ geometry * Add benchmark json files (will be reset later) * Do not set zero current at zero frequency * [skip CI] Revert last commit and clean up * Fix small bug after reverting commit * Set nodal test first on Travis * Fix benchmark for nodal test in 3D * Fix particle output for nodal test in 3D * Fix bugs due to staggering * Rename current nodal Travis tests * Add Travis tests staggered in 2D and 3D * Further clean-up after bug fix * Abort when using Vay deposition with domain decomposition * Add optional argument of index type to forward FFT * Fourier shifts can be private members as before * Small clean-up * Clean up and improve Doxygen documentation * Fix small bug in analysis script for 2D tests * Fix tests (remove E and B fields from particle diags) * Add option to fill guard cells and docs * Fix value of last guard cell by enforcing periodicity * Revert changes merged from #1121 * Clean up style * Improve docs * Fix forgotten alignment * Improve docs * Make base class functions VayDeposition pure Co-authored-by: Dave Grote --- Source/Particles/WarpXParticleContainer.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'Source/Particles/WarpXParticleContainer.cpp') diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp index 90772129b..a708ca8e1 100644 --- a/Source/Particles/WarpXParticleContainer.cpp +++ b/Source/Particles/WarpXParticleContainer.cpp @@ -336,6 +336,26 @@ WarpXParticleContainer::DepositCurrent(WarpXParIter& pti, jx_arr, jy_arr, jz_arr, np_to_depose, dt, dx, xyzmin, lo, q, WarpX::n_rz_azimuthal_modes); } + } else if (WarpX::current_deposition_algo == CurrentDepositionAlgo::Vay) { + if (WarpX::nox == 1){ + doVayDepositionShapeN<1>( + GetPosition, wp.dataPtr() + offset, uxp.dataPtr() + offset, + uyp.dataPtr() + offset, uzp.dataPtr() + offset, ion_lev, + jx_fab, jy_fab, jz_fab, np_to_depose, dt, dx, xyzmin, lo, q, + WarpX::n_rz_azimuthal_modes ); + } else if (WarpX::nox == 2){ + doVayDepositionShapeN<2>( + GetPosition, wp.dataPtr() + offset, uxp.dataPtr() + offset, + uyp.dataPtr() + offset, uzp.dataPtr() + offset, ion_lev, + jx_fab, jy_fab, jz_fab, np_to_depose, dt, dx, xyzmin, lo, q, + WarpX::n_rz_azimuthal_modes ); + } else if (WarpX::nox == 3){ + doVayDepositionShapeN<3>( + GetPosition, wp.dataPtr() + offset, uxp.dataPtr() + offset, + uyp.dataPtr() + offset, uzp.dataPtr() + offset, ion_lev, + jx_fab, jy_fab, jz_fab, np_to_depose, dt, dx, xyzmin, lo, q, + WarpX::n_rz_azimuthal_modes ); + } } else { if (WarpX::nox == 1){ doDepositionShapeN<1>( -- cgit v1.2.3