From 48fa50a7d92a01061e6563fe2c52f55a0de76bb7 Mon Sep 17 00:00:00 2001 From: David Grote Date: Thu, 5 Aug 2021 17:22:45 -0700 Subject: 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 --- Source/Particles/Gather/GetExternalFields.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'Source/Particles/Gather/GetExternalFields.cpp') diff --git a/Source/Particles/Gather/GetExternalFields.cpp b/Source/Particles/Gather/GetExternalFields.cpp index 03c4dc2b8..d97a69985 100644 --- a/Source/Particles/Gather/GetExternalFields.cpp +++ b/Source/Particles/Gather/GetExternalFields.cpp @@ -32,6 +32,7 @@ GetExternalEField::GetExternalEField (const WarpXParIter& a_pti, int a_offset) n else if (mypc.m_E_ext_particle_s=="repeated_plasma_lens") { m_type = RepeatedPlasmaLens; + m_lens_is_electric = 1; m_dt = warpx.getdt(a_pti.GetLevel()); m_get_position = GetParticlePosition(a_pti, a_offset); auto& attribs = a_pti.GetAttribs(); @@ -42,7 +43,7 @@ GetExternalEField::GetExternalEField (const WarpXParIter& a_pti, int a_offset) n m_n_lenses = static_cast(mypc.h_repeated_plasma_lens_starts.size()); m_repeated_plasma_lens_starts = mypc.d_repeated_plasma_lens_starts.data(); m_repeated_plasma_lens_lengths = mypc.d_repeated_plasma_lens_lengths.data(); - m_repeated_plasma_lens_strengths = mypc.d_repeated_plasma_lens_strengths.data(); + m_repeated_plasma_lens_strengths = mypc.d_repeated_plasma_lens_strengths_E.data(); } } @@ -66,4 +67,20 @@ GetExternalBField::GetExternalBField (const WarpXParIter& a_pti, int a_offset) n m_yfield_partparser = mypc.m_By_particle_parser->compile<4>(); m_zfield_partparser = mypc.m_Bz_particle_parser->compile<4>(); } + else if (mypc.m_B_ext_particle_s=="repeated_plasma_lens") + { + m_type = RepeatedPlasmaLens; + m_lens_is_electric = 0; + m_dt = warpx.getdt(a_pti.GetLevel()); + m_get_position = GetParticlePosition(a_pti, a_offset); + auto& attribs = a_pti.GetAttribs(); + m_ux = attribs[PIdx::ux].dataPtr() + a_offset; + m_uy = attribs[PIdx::uy].dataPtr() + a_offset; + m_uz = attribs[PIdx::uz].dataPtr() + a_offset; + m_repeated_plasma_lens_period = mypc.m_repeated_plasma_lens_period; + m_n_lenses = static_cast(mypc.h_repeated_plasma_lens_starts.size()); + m_repeated_plasma_lens_starts = mypc.d_repeated_plasma_lens_starts.data(); + m_repeated_plasma_lens_lengths = mypc.d_repeated_plasma_lens_lengths.data(); + m_repeated_plasma_lens_strengths = mypc.d_repeated_plasma_lens_strengths_B.data(); + } } -- cgit v1.2.3