From 30a7f5ef5a561f59c70d127b54c17b5bcd82ede8 Mon Sep 17 00:00:00 2001 From: David Grote Date: Tue, 20 Jul 2021 20:59:28 -0700 Subject: Implements a periodically repeating plasma lenses (#2080) * Implements a periodically repeating plasma lens * Added documentation for plasma lenses * Added m_n_lenses to avoid use of size in device code * Change arrays to device arrays * Put DeviceVectors in the MultiParticleContainer * Update Source/Particles/MultiParticleContainer.cpp Co-authored-by: Axel Huebl * Update Source/Particles/Gather/GetExternalFields.cpp Co-authored-by: Axel Huebl * Added CI test * Updated CI test * LGTM clean up * Moved literal namespace inside the routine Co-authored-by: Axel Huebl --- Source/Particles/MultiParticleContainer.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'Source/Particles/MultiParticleContainer.cpp') diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp index 5e59d6eaa..b0a1d211f 100644 --- a/Source/Particles/MultiParticleContainer.cpp +++ b/Source/Particles/MultiParticleContainer.cpp @@ -223,6 +223,31 @@ MultiParticleContainer::ReadParameters () } + // if the input string for E_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") { + 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(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()); + amrex::Gpu::synchronize(); + } + // particle species pp_particles.queryarr("species_names", species_names); -- cgit v1.2.3