diff options
author | 2021-08-05 17:22:45 -0700 | |
---|---|---|
committer | 2021-08-05 17:22:45 -0700 | |
commit | 48fa50a7d92a01061e6563fe2c52f55a0de76bb7 (patch) | |
tree | 2843da7183a4c1f0c14cd8e44d485897ab8b7ae6 /Source/Particles/MultiParticleContainer.cpp | |
parent | dc4a2026aae0cc282e09906bfbd621b5bcbfdf7e (diff) | |
download | WarpX-48fa50a7d92a01061e6563fe2c52f55a0de76bb7.tar.gz WarpX-48fa50a7d92a01061e6563fe2c52f55a0de76bb7.tar.zst WarpX-48fa50a7d92a01061e6563fe2c52f55a0de76bb7.zip |
Added B field to plasma lens (#2163)
* Added B field to plasma lens
* Fix B field and updated CI test to include the B field
* Updated benchmark
Diffstat (limited to '')
-rw-r--r-- | Source/Particles/MultiParticleContainer.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp index ba8825522..ec4ffe8e1 100644 --- a/Source/Particles/MultiParticleContainer.cpp +++ b/Source/Particles/MultiParticleContainer.cpp @@ -223,28 +223,39 @@ MultiParticleContainer::ReadParameters () } - // if the input string for E_ext_particle_s is + // if the input string for E_ext_particle_s or B_ext_particle_s is // "repeated_plasma_lens" then the plasma lens properties // must be provided in the input file. - if (m_E_ext_particle_s == "repeated_plasma_lens") { + if (m_E_ext_particle_s == "repeated_plasma_lens" || + m_B_ext_particle_s == "repeated_plasma_lens") { queryWithParser(pp_particles, "repeated_plasma_lens_period", m_repeated_plasma_lens_period); getArrWithParser(pp_particles, "repeated_plasma_lens_starts", h_repeated_plasma_lens_starts); getArrWithParser(pp_particles, "repeated_plasma_lens_lengths", h_repeated_plasma_lens_lengths); - getArrWithParser(pp_particles, "repeated_plasma_lens_strengths", h_repeated_plasma_lens_strengths); int n_lenses = static_cast<int>(h_repeated_plasma_lens_starts.size()); d_repeated_plasma_lens_starts.resize(n_lenses); d_repeated_plasma_lens_lengths.resize(n_lenses); - d_repeated_plasma_lens_strengths.resize(n_lenses); amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice, h_repeated_plasma_lens_starts.begin(), h_repeated_plasma_lens_starts.end(), d_repeated_plasma_lens_starts.begin()); amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice, h_repeated_plasma_lens_lengths.begin(), h_repeated_plasma_lens_lengths.end(), d_repeated_plasma_lens_lengths.begin()); - amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice, - h_repeated_plasma_lens_strengths.begin(), h_repeated_plasma_lens_strengths.end(), - d_repeated_plasma_lens_strengths.begin()); + + if (m_E_ext_particle_s == "repeated_plasma_lens") { + getArrWithParser(pp_particles, "repeated_plasma_lens_strengths_E", h_repeated_plasma_lens_strengths_E); + d_repeated_plasma_lens_strengths_E.resize(n_lenses); + amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice, + h_repeated_plasma_lens_strengths_E.begin(), h_repeated_plasma_lens_strengths_E.end(), + d_repeated_plasma_lens_strengths_E.begin()); + } + if (m_B_ext_particle_s == "repeated_plasma_lens") { + getArrWithParser(pp_particles, "repeated_plasma_lens_strengths_B", h_repeated_plasma_lens_strengths_B); + d_repeated_plasma_lens_strengths_B.resize(n_lenses); + amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice, + h_repeated_plasma_lens_strengths_B.begin(), h_repeated_plasma_lens_strengths_B.end(), + d_repeated_plasma_lens_strengths_B.begin()); + } amrex::Gpu::synchronize(); } |