diff options
author | 2021-03-18 15:56:00 -0700 | |
---|---|---|
committer | 2021-03-18 15:56:00 -0700 | |
commit | f2136795785b551ad5f450da070aa54fedc2630c (patch) | |
tree | b95214470f07339c7cc9a1469ff2cfe5fd77a6c4 /Source/Particles/WarpXParticleContainer.cpp | |
parent | 588ef1dad873efef664687adb913ae1302dec6e5 (diff) | |
download | WarpX-f2136795785b551ad5f450da070aa54fedc2630c.tar.gz WarpX-f2136795785b551ad5f450da070aa54fedc2630c.tar.zst WarpX-f2136795785b551ad5f450da070aa54fedc2630c.zip |
Add option to deposit current at arbitrary time (#1810)
* Introduce relative_time for deposition
* Deposit current at arbitrary time
* Update documentation
* Combine parameters in DepositCurrent
* Explicitly show the time at which the current is deposited
Diffstat (limited to 'Source/Particles/WarpXParticleContainer.cpp')
-rw-r--r-- | Source/Particles/WarpXParticleContainer.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp index 304a0aa41..d838704a2 100644 --- a/Source/Particles/WarpXParticleContainer.cpp +++ b/Source/Particles/WarpXParticleContainer.cpp @@ -226,6 +226,11 @@ WarpXParticleContainer::AddNParticles (int /*lev*/, * \param lev : Level of box that contains particles * \param depos_lev : Level on which particles deposit (if buffers are used) * \param dt : Time step for particle level + * \param relative_time: Time at which to deposit J, relative to the time of + * the current positions of the particles (expressed as + * a fraction of dt). When different than 0, the particle + * position will be temporarily modified to match the + * time of the deposition. */ void WarpXParticleContainer::DepositCurrent(WarpXParIter& pti, @@ -235,7 +240,7 @@ WarpXParticleContainer::DepositCurrent(WarpXParIter& pti, MultiFab* jx, MultiFab* jy, MultiFab* jz, const long offset, const long np_to_depose, int thread_num, int lev, int depos_lev, - Real dt) + Real dt, Real relative_time) { AMREX_ALWAYS_ASSERT_WITH_MESSAGE((depos_lev==(lev-1)) || (depos_lev==(lev )), @@ -360,6 +365,14 @@ WarpXParticleContainer::DepositCurrent(WarpXParIter& pti, if ( (m_v_galilean[0]!=0) or (m_v_galilean[1]!=0) or (m_v_galilean[2]!=0)){ amrex::Abort("The Esirkepov algorithm cannot be used with the Galilean algorithm."); } + if ( relative_time != -0.5_rt ) { + amrex::Abort("The Esirkepov deposition cannot be performed at another time then -0.5 dt."); + } + } + if (WarpX::current_deposition_algo == CurrentDepositionAlgo::Vay) { + if ( relative_time != -0.5_rt ) { + amrex::Abort("The Esirkepov deposition cannot be performed at another time then -0.5 dt."); + } } WARPX_PROFILE_VAR_START(blp_deposit); @@ -417,21 +430,21 @@ WarpXParticleContainer::DepositCurrent(WarpXParIter& pti, doDepositionShapeN<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, + jx_fab, jy_fab, jz_fab, np_to_depose, dt*relative_time, dx, xyzmin, lo, q, WarpX::n_rz_azimuthal_modes, cost, WarpX::load_balance_costs_update_algo); } else if (WarpX::nox == 2){ doDepositionShapeN<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, + jx_fab, jy_fab, jz_fab, np_to_depose, dt*relative_time, dx, xyzmin, lo, q, WarpX::n_rz_azimuthal_modes, cost, WarpX::load_balance_costs_update_algo); } else if (WarpX::nox == 3){ doDepositionShapeN<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, + jx_fab, jy_fab, jz_fab, np_to_depose, dt*relative_time, dx, xyzmin, lo, q, WarpX::n_rz_azimuthal_modes, cost, WarpX::load_balance_costs_update_algo); } |