diff options
author | 2021-12-06 20:21:43 -0800 | |
---|---|---|
committer | 2021-12-07 04:21:43 +0000 | |
commit | 9830a8246ec7c060f5f6690a717bd465514c9bd2 (patch) | |
tree | 0f7241d5bc36c8cc5718c9ae1d36b0463ca4b5c1 /Source/Particles/MultiParticleContainer.cpp | |
parent | 749a4c0d8bce01df5bd886f5c452a76c607a850d (diff) | |
download | WarpX-9830a8246ec7c060f5f6690a717bd465514c9bd2.tar.gz WarpX-9830a8246ec7c060f5f6690a717bd465514c9bd2.tar.zst WarpX-9830a8246ec7c060f5f6690a717bd465514c9bd2.zip |
Transform the external fields into the boosted frame (#2610)
They should be specified in the lab frame
Diffstat (limited to 'Source/Particles/MultiParticleContainer.cpp')
-rw-r--r-- | Source/Particles/MultiParticleContainer.cpp | 46 |
1 files changed, 15 insertions, 31 deletions
diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp index 8f4adcbcd..86ff22257 100644 --- a/Source/Particles/MultiParticleContainer.cpp +++ b/Source/Particles/MultiParticleContainer.cpp @@ -229,7 +229,9 @@ MultiParticleContainer::ReadParameters () // must be provided in the input file. 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); + getWithParser(pp_particles, "repeated_plasma_lens_period", m_repeated_plasma_lens_period); + AMREX_ALWAYS_ASSERT_WITH_MESSAGE(m_repeated_plasma_lens_period > 0._rt, + "The period of the repeated plasma lens must be greater than zero"); getArrWithParser(pp_particles, "repeated_plasma_lens_starts", h_repeated_plasma_lens_starts); getArrWithParser(pp_particles, "repeated_plasma_lens_lengths", h_repeated_plasma_lens_lengths); @@ -243,43 +245,25 @@ MultiParticleContainer::ReadParameters () h_repeated_plasma_lens_lengths.begin(), h_repeated_plasma_lens_lengths.end(), d_repeated_plasma_lens_lengths.begin()); + h_repeated_plasma_lens_strengths_E.resize(n_lenses); + h_repeated_plasma_lens_strengths_B.resize(n_lenses); + if (m_E_ext_particle_s == "repeated_plasma_lens") { getArrWithParser(pp_particles, "repeated_plasma_lens_strengths_E", h_repeated_plasma_lens_strengths_E); } if (m_B_ext_particle_s == "repeated_plasma_lens") { getArrWithParser(pp_particles, "repeated_plasma_lens_strengths_B", h_repeated_plasma_lens_strengths_B); } - if (WarpX::gamma_boost > 1._rt) { - AMREX_ALWAYS_ASSERT_WITH_MESSAGE( - m_E_ext_particle_s == "repeated_plasma_lens" || m_E_ext_particle_s == "default", - "With gamma_boost > 1, E_ext_particle_init_style and B_ext_particle_init_style" - "must be either repeated_plasma_lens or unspecified"); - AMREX_ALWAYS_ASSERT_WITH_MESSAGE( - m_B_ext_particle_s == "repeated_plasma_lens" || m_B_ext_particle_s == "default", - "With gamma_boost > 1, E_ext_particle_init_style and B_ext_particle_init_style" - "must be either repeated_plasma_lens or unspecified"); - if (m_E_ext_particle_s == "default") { - m_E_ext_particle_s = "repeated_plasma_lens"; - h_repeated_plasma_lens_strengths_E.resize(n_lenses); - } - if (m_B_ext_particle_s == "default") { - m_B_ext_particle_s = "repeated_plasma_lens"; - h_repeated_plasma_lens_strengths_B.resize(n_lenses); - } - } - if (m_E_ext_particle_s == "repeated_plasma_lens") { - 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") { - 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()); - } + d_repeated_plasma_lens_strengths_E.resize(n_lenses); + d_repeated_plasma_lens_strengths_B.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()); + 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(); } |