diff options
author | 2020-07-02 16:02:38 -0700 | |
---|---|---|
committer | 2020-07-02 16:02:38 -0700 | |
commit | 81dd5a670799b72d0e99f04cb5028566ad767b18 (patch) | |
tree | 22038fd47ca042cd76e86e7b9535121149431211 /Source/Evolve/WarpXEvolve.cpp | |
parent | 8d3f260ab158ca1ca9834b3517b7ea1441cf1225 (diff) | |
download | WarpX-81dd5a670799b72d0e99f04cb5028566ad767b18.tar.gz WarpX-81dd5a670799b72d0e99f04cb5028566ad767b18.tar.zst WarpX-81dd5a670799b72d0e99f04cb5028566ad767b18.zip |
PSATD: current correction works only with global FFTs (#1131)
* Clean up implementation of current correction:
- abort when current correction runs with psatd.periodic_single_box_fft=0
- rename input parameter from psatd.do_current_correction to psatd.current_correction
- add nodal tests in 2D and 3D (using direct current deposition)
- change 2D test: use Esirkepov deposition, instead of direct, as in 3D test
- add/update relevant checksum benchmarks
* Small clean-up
Diffstat (limited to 'Source/Evolve/WarpXEvolve.cpp')
-rw-r--r-- | Source/Evolve/WarpXEvolve.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/Source/Evolve/WarpXEvolve.cpp b/Source/Evolve/WarpXEvolve.cpp index 72621e52c..d53c5ea5b 100644 --- a/Source/Evolve/WarpXEvolve.cpp +++ b/Source/Evolve/WarpXEvolve.cpp @@ -288,14 +288,13 @@ WarpX::OneStep_nosub (Real cur_time) if (warpx_py_afterdeposition) warpx_py_afterdeposition(); #endif +// TODO +// Apply current correction in Fourier space: for domain decomposition with local +// FFTs over guard cells, apply this before calling SyncCurrent #ifdef WARPX_USE_PSATD - // Apply current correction in Fourier space - // (equation (19) of https://doi.org/10.1016/j.jcp.2013.03.010) - if ( fft_periodic_single_box == false ) { - // For domain decomposition with local FFT over guard cells, - // apply this before `SyncCurrent`, i.e. before exchanging guard cells for J - if ( do_current_correction ) CurrentCorrection(); - } + if ( !fft_periodic_single_box && current_correction ) + amrex::Abort("\nCurrent correction does not guarantee charge conservation with local FFTs over guard cells:\n" + "set psatd.periodic_single_box_fft=1 too, in order to guarantee charge conservation"); #endif #ifdef WARPX_QED @@ -306,14 +305,10 @@ WarpX::OneStep_nosub (Real cur_time) SyncCurrent(); SyncRho(); +// Apply current correction in Fourier space: for periodic single-box global FFTs +// without guard cells, apply this after calling SyncCurrent #ifdef WARPX_USE_PSATD - // Apply current correction in Fourier space - // (equation (19) of https://doi.org/10.1016/j.jcp.2013.03.010) - if ( fft_periodic_single_box == true ) { - // For periodic, single-box FFT (FFT without guard cells) - // apply this after `SyncCurrent`, i.e. after exchanging guard cells for J - if ( do_current_correction ) CurrentCorrection(); - } + if ( fft_periodic_single_box && current_correction ) CurrentCorrection(); #endif |