Skip to content

Commit

Permalink
Broke vector into separate reals
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgrote committed Oct 3, 2023
1 parent f1b0799 commit d1c2a70
Show file tree
Hide file tree
Showing 11 changed files with 126 additions and 78 deletions.
20 changes: 12 additions & 8 deletions Source/Diagnostics/ReducedDiags/ColliderRelevant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,12 @@ void ColliderRelevant::ComputeDiags (int step)
// declare external fields
const int offset = 0;
const auto getExternalEB = GetExternalEBField(pti, offset);
const amrex::Vector<amrex::ParticleReal> E_external_particle = myspc.m_E_external_particle;
const amrex::Vector<amrex::ParticleReal> B_external_particle = myspc.m_B_external_particle;
const amrex::ParticleReal Ex_external_particle = myspc.m_E_external_particle[0];
const amrex::ParticleReal Ey_external_particle = myspc.m_E_external_particle[0];
const amrex::ParticleReal Ez_external_particle = myspc.m_E_external_particle[0];
const amrex::ParticleReal Bx_external_particle = myspc.m_B_external_particle[0];
const amrex::ParticleReal By_external_particle = myspc.m_B_external_particle[0];
const amrex::ParticleReal Bz_external_particle = myspc.m_B_external_particle[0];

// define variables in preparation for field gathering
amrex::Box box = pti.tilebox();
Expand Down Expand Up @@ -494,12 +498,12 @@ void ColliderRelevant::ComputeDiags (int step)
// get external fields
amrex::ParticleReal xp, yp, zp;
GetPosition(i, xp, yp, zp);
amrex::ParticleReal ex = E_external_particle[0];
amrex::ParticleReal ey = E_external_particle[1];
amrex::ParticleReal ez = E_external_particle[2];
amrex::ParticleReal bx = B_external_particle[0];
amrex::ParticleReal by = B_external_particle[1];
amrex::ParticleReal bz = B_external_particle[2];
amrex::ParticleReal ex = Ex_external_particle;
amrex::ParticleReal ey = Ey_external_particle;
amrex::ParticleReal ez = Ez_external_particle;
amrex::ParticleReal bx = Bx_external_particle;
amrex::ParticleReal by = By_external_particle;
amrex::ParticleReal bz = Bz_external_particle;

getExternalEB(i, ex, ey, ez, bx, by, bz);

Expand Down
20 changes: 12 additions & 8 deletions Source/Diagnostics/ReducedDiags/ParticleExtrema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,12 @@ void ParticleExtrema::ComputeDiags (int step)
// declare external fields
const int offset = 0;
const auto getExternalEB = GetExternalEBField(pti, offset);
const amrex::Vector<amrex::ParticleReal> E_external_particle = myspc.m_E_external_particle;
const amrex::Vector<amrex::ParticleReal> B_external_particle = myspc.m_B_external_particle;
const amrex::ParticleReal Ex_external_particle = myspc.m_E_external_particle[0];
const amrex::ParticleReal Ey_external_particle = myspc.m_E_external_particle[0];
const amrex::ParticleReal Ez_external_particle = myspc.m_E_external_particle[0];
const amrex::ParticleReal Bx_external_particle = myspc.m_B_external_particle[0];
const amrex::ParticleReal By_external_particle = myspc.m_B_external_particle[0];
const amrex::ParticleReal Bz_external_particle = myspc.m_B_external_particle[0];

// define variables in preparation for field gathering
amrex::Box box = pti.tilebox();
Expand Down Expand Up @@ -425,12 +429,12 @@ void ParticleExtrema::ComputeDiags (int step)
// get external fields
ParticleReal xp, yp, zp;
GetPosition(i, xp, yp, zp);
amrex::ParticleReal ex = E_external_particle[0];
amrex::ParticleReal ey = E_external_particle[1];
amrex::ParticleReal ez = E_external_particle[2];
amrex::ParticleReal bx = B_external_particle[0];
amrex::ParticleReal by = B_external_particle[1];
amrex::ParticleReal bz = B_external_particle[2];
amrex::ParticleReal ex = Ex_external_particle;
amrex::ParticleReal ey = Ey_external_particle;
amrex::ParticleReal ez = Ez_external_particle;
amrex::ParticleReal bx = Bx_external_particle;
amrex::ParticleReal by = By_external_particle;
amrex::ParticleReal bz = Bz_external_particle;

getExternalEB(i, ex, ey, ez, bx, by, bz);

Expand Down
20 changes: 12 additions & 8 deletions Source/Particles/ElementaryProcess/Ionization.H
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ struct IonizationFilterFunc

GetParticlePosition m_get_position;
GetExternalEBField m_get_externalEB;
amrex::Vector<amrex::ParticleReal> m_E_external_particle;
amrex::Vector<amrex::ParticleReal> m_B_external_particle;
amrex::ParticleReal m_Ex_external_particle;
amrex::ParticleReal m_Ey_external_particle;
amrex::ParticleReal m_Ez_external_particle;
amrex::ParticleReal m_Bx_external_particle;
amrex::ParticleReal m_By_external_particle;
amrex::ParticleReal m_Bz_external_particle;

amrex::Array4<const amrex::Real> m_ex_arr;
amrex::Array4<const amrex::Real> m_ey_arr;
Expand Down Expand Up @@ -98,12 +102,12 @@ struct IonizationFilterFunc
amrex::ParticleReal xp, yp, zp;
m_get_position(i, xp, yp, zp);

amrex::ParticleReal ex = m_E_external_particle[0];
amrex::ParticleReal ey = m_E_external_particle[1];
amrex::ParticleReal ez = m_E_external_particle[2];
amrex::ParticleReal bx = m_B_external_particle[0];
amrex::ParticleReal by = m_B_external_particle[1];
amrex::ParticleReal bz = m_B_external_particle[2];
amrex::ParticleReal ex = m_Ex_external_particle;
amrex::ParticleReal ey = m_Ey_external_particle;
amrex::ParticleReal ez = m_Ez_external_particle;
amrex::ParticleReal bx = m_Bx_external_particle;
amrex::ParticleReal by = m_By_external_particle;
amrex::ParticleReal bz = m_Bz_external_particle;
m_get_externalEB(i, ex, ey, ez, bx, by, bz);

doGatherShapeN(xp, yp, zp, ex, ey, ez, bx, by, bz,
Expand Down
8 changes: 6 additions & 2 deletions Source/Particles/ElementaryProcess/Ionization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ IonizationFilterFunc::IonizationFilterFunc (const WarpXParIter& a_pti, int lev,

m_get_position = GetParticlePosition(a_pti, a_offset);
m_get_externalEB = GetExternalEBField(a_pti, a_offset);
m_E_external_particle = E_external_particle;
m_B_external_particle = B_external_particle;
m_Ex_external_particle = E_external_particle[0];
m_Ey_external_particle = E_external_particle[1];
m_Ez_external_particle = E_external_particle[2];
m_Bx_external_particle = B_external_particle[0];
m_By_external_particle = B_external_particle[1];
m_Bz_external_particle = B_external_particle[2];

m_ex_arr = exfab.array();
m_ey_arr = eyfab.array();
Expand Down
20 changes: 12 additions & 8 deletions Source/Particles/ElementaryProcess/QEDPairGeneration.H
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ public:
amrex::ParticleReal xp, yp, zp;
m_get_position(i_src, xp, yp, zp);

amrex::ParticleReal ex = m_E_external_particle[0];
amrex::ParticleReal ey = m_E_external_particle[1];
amrex::ParticleReal ez = m_E_external_particle[2];
amrex::ParticleReal bx = m_B_external_particle[0];
amrex::ParticleReal by = m_B_external_particle[1];
amrex::ParticleReal bz = m_B_external_particle[2];
amrex::ParticleReal ex = m_Ex_external_particle;
amrex::ParticleReal ey = m_Ey_external_particle;
amrex::ParticleReal ez = m_Ez_external_particle;
amrex::ParticleReal bx = m_Bx_external_particle;
amrex::ParticleReal by = m_By_external_particle;
amrex::ParticleReal bz = m_Bz_external_particle;

m_get_externalEB(i_src, ex, ey, ez, bx, by, bz);

Expand Down Expand Up @@ -177,8 +177,12 @@ private:

GetParticlePosition m_get_position;
GetExternalEBField m_get_externalEB;
amrex::Vector<amrex::ParticleReal> m_E_external_particle;
amrex::Vector<amrex::ParticleReal> m_B_external_particle;
amrex::ParticleReal m_Ex_external_particle;
amrex::ParticleReal m_Ey_external_particle;
amrex::ParticleReal m_Ez_external_particle;
amrex::ParticleReal m_Bx_external_particle;
amrex::ParticleReal m_By_external_particle;
amrex::ParticleReal m_Bz_external_particle;

amrex::Array4<const amrex::Real> m_ex_arr;
amrex::Array4<const amrex::Real> m_ey_arr;
Expand Down
8 changes: 6 additions & 2 deletions Source/Particles/ElementaryProcess/QEDPairGeneration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ PairGenerationTransformFunc (BreitWheelerGeneratePairs const generate_functor,

m_get_position = GetParticlePosition(a_pti, a_offset);
m_get_externalEB = GetExternalEBField(a_pti, a_offset);
m_E_external_particle = E_external_particle;
m_B_external_particle = B_external_particle;
m_Ex_external_particle = E_external_particle[0];
m_Ey_external_particle = E_external_particle[1];
m_Ez_external_particle = E_external_particle[2];
m_Bx_external_particle = B_external_particle[0];
m_By_external_particle = B_external_particle[1];
m_Bz_external_particle = B_external_particle[2];

m_ex_arr = exfab.array();
m_ey_arr = eyfab.array();
Expand Down
20 changes: 12 additions & 8 deletions Source/Particles/ElementaryProcess/QEDPhotonEmission.H
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ public:
amrex::ParticleReal xp, yp, zp;
m_get_position(i_src, xp, yp, zp);

amrex::ParticleReal ex = m_E_external_particle[0];
amrex::ParticleReal ey = m_E_external_particle[1];
amrex::ParticleReal ez = m_E_external_particle[2];
amrex::ParticleReal bx = m_B_external_particle[0];
amrex::ParticleReal by = m_B_external_particle[1];
amrex::ParticleReal bz = m_B_external_particle[2];
amrex::ParticleReal ex = m_Ex_external_particle;
amrex::ParticleReal ey = m_Ey_external_particle;
amrex::ParticleReal ez = m_Ez_external_particle;
amrex::ParticleReal bx = m_Bx_external_particle;
amrex::ParticleReal by = m_By_external_particle;
amrex::ParticleReal bz = m_Bz_external_particle;

m_get_externalEB(i_src, ex, ey, ez, bx, by, bz);

Expand Down Expand Up @@ -187,8 +187,12 @@ private:

GetParticlePosition m_get_position;
GetExternalEBField m_get_externalEB;
amrex::Vector<amrex::ParticleReal> m_E_external_particle;
amrex::Vector<amrex::ParticleReal> m_B_external_particle;
amrex::ParticleReal m_Ex_external_particle;
amrex::ParticleReal m_Ey_external_particle;
amrex::ParticleReal m_Ez_external_particle;
amrex::ParticleReal m_Bx_external_particle;
amrex::ParticleReal m_By_external_particle;
amrex::ParticleReal m_Bz_external_particle;

amrex::Array4<const amrex::Real> m_ex_arr;
amrex::Array4<const amrex::Real> m_ey_arr;
Expand Down
8 changes: 6 additions & 2 deletions Source/Particles/ElementaryProcess/QEDPhotonEmission.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ PhotonEmissionTransformFunc (QuantumSynchrotronGetOpticalDepth opt_depth_functor

m_get_position = GetParticlePosition(a_pti, a_offset);
m_get_externalEB = GetExternalEBField(a_pti, a_offset);
m_E_external_particle = E_external_particle;
m_B_external_particle = B_external_particle;
m_Ex_external_particle = E_external_particle[0];
m_Ey_external_particle = E_external_particle[1];
m_Ez_external_particle = E_external_particle[2];
m_Bx_external_particle = B_external_particle[0];
m_By_external_particle = B_external_particle[1];
m_Bz_external_particle = B_external_particle[2];

m_ex_arr = exfab.array();
m_ey_arr = eyfab.array();
Expand Down
20 changes: 12 additions & 8 deletions Source/Particles/PhotonParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,12 @@ PhotonParticleContainer::PushPX (WarpXParIter& pti,

const auto getExternalEB = GetExternalEBField(pti, offset);

const amrex::Vector<amrex::ParticleReal> E_external_particle = m_E_external_particle;
const amrex::Vector<amrex::ParticleReal> B_external_particle = m_B_external_particle;
const amrex::ParticleReal Ex_external_particle = m_E_external_particle[0];
const amrex::ParticleReal Ey_external_particle = m_E_external_particle[1];
const amrex::ParticleReal Ez_external_particle = m_E_external_particle[2];
const amrex::ParticleReal Bx_external_particle = m_B_external_particle[0];
const amrex::ParticleReal By_external_particle = m_B_external_particle[1];
const amrex::ParticleReal Bz_external_particle = m_B_external_particle[2];

// Lower corner of tile box physical domain (take into account Galilean shift)
const std::array<amrex::Real, 3>& xyzmin = WarpX::LowerCorner(box, gather_lev, 0._rt);
Expand Down Expand Up @@ -185,12 +189,12 @@ PhotonParticleContainer::PushPX (WarpXParIter& pti,
ParticleReal x, y, z;
GetPosition(i, x, y, z);

amrex::ParticleReal Exp = E_external_particle[0];
amrex::ParticleReal Eyp = E_external_particle[1];
amrex::ParticleReal Ezp = E_external_particle[2];
amrex::ParticleReal Bxp = B_external_particle[0];
amrex::ParticleReal Byp = B_external_particle[1];
amrex::ParticleReal Bzp = B_external_particle[2];
amrex::ParticleReal Exp = Ex_external_particle;
amrex::ParticleReal Eyp = Ey_external_particle;
amrex::ParticleReal Ezp = Ez_external_particle;
amrex::ParticleReal Bxp = Bx_external_particle;
amrex::ParticleReal Byp = By_external_particle;
amrex::ParticleReal Bzp = Bz_external_particle;

if(!t_do_not_gather){
// first gather E and B to the particle positions
Expand Down
40 changes: 24 additions & 16 deletions Source/Particles/PhysicalParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2499,8 +2499,12 @@ PhysicalParticleContainer::PushP (int lev, Real dt,

const auto getExternalEB = GetExternalEBField(pti);

const amrex::Vector<amrex::ParticleReal> E_external_particle = m_E_external_particle;
const amrex::Vector<amrex::ParticleReal> B_external_particle = m_B_external_particle;
const amrex::ParticleReal Ex_external_particle = m_E_external_particle[0];
const amrex::ParticleReal Ey_external_particle = m_E_external_particle[1];
const amrex::ParticleReal Ez_external_particle = m_E_external_particle[2];
const amrex::ParticleReal Bx_external_particle = m_B_external_particle[0];
const amrex::ParticleReal By_external_particle = m_B_external_particle[1];
const amrex::ParticleReal Bz_external_particle = m_B_external_particle[2];

const std::array<amrex::Real,3>& xyzmin = WarpX::LowerCorner(box, lev, 0._rt);

Expand Down Expand Up @@ -2557,12 +2561,12 @@ PhysicalParticleContainer::PushP (int lev, Real dt,
amrex::ParticleReal xp, yp, zp;
getPosition(ip, xp, yp, zp);

amrex::ParticleReal Exp = E_external_particle[0];
amrex::ParticleReal Eyp = E_external_particle[1];
amrex::ParticleReal Ezp = E_external_particle[2];
amrex::ParticleReal Bxp = B_external_particle[0];
amrex::ParticleReal Byp = B_external_particle[1];
amrex::ParticleReal Bzp = B_external_particle[2];
amrex::ParticleReal Exp = Ex_external_particle;
amrex::ParticleReal Eyp = Ey_external_particle;
amrex::ParticleReal Ezp = Ez_external_particle;
amrex::ParticleReal Bxp = Bx_external_particle;
amrex::ParticleReal Byp = By_external_particle;
amrex::ParticleReal Bzp = Bz_external_particle;

if (!t_do_not_gather){
// first gather E and B to the particle positions
Expand Down Expand Up @@ -2683,8 +2687,12 @@ PhysicalParticleContainer::PushPX (WarpXParIter& pti,

const auto getExternalEB = GetExternalEBField(pti, offset);

const amrex::Vector<amrex::ParticleReal> E_external_particle = m_E_external_particle;
const amrex::Vector<amrex::ParticleReal> B_external_particle = m_B_external_particle;
const amrex::ParticleReal Ex_external_particle = m_E_external_particle[0];
const amrex::ParticleReal Ey_external_particle = m_E_external_particle[1];
const amrex::ParticleReal Ez_external_particle = m_E_external_particle[2];
const amrex::ParticleReal Bx_external_particle = m_B_external_particle[0];
const amrex::ParticleReal By_external_particle = m_B_external_particle[1];
const amrex::ParticleReal Bz_external_particle = m_B_external_particle[2];

// Lower corner of tile box physical domain (take into account Galilean shift)
const std::array<amrex::Real, 3>& xyzmin = WarpX::LowerCorner(box, gather_lev, 0._rt);
Expand Down Expand Up @@ -2800,12 +2808,12 @@ PhysicalParticleContainer::PushPX (WarpXParIter& pti,
z_old[ip] = zp;
}

amrex::ParticleReal Exp = E_external_particle[0];
amrex::ParticleReal Eyp = E_external_particle[1];
amrex::ParticleReal Ezp = E_external_particle[2];
amrex::ParticleReal Bxp = B_external_particle[0];
amrex::ParticleReal Byp = B_external_particle[1];
amrex::ParticleReal Bzp = B_external_particle[2];
amrex::ParticleReal Exp = Ex_external_particle;
amrex::ParticleReal Eyp = Ey_external_particle;
amrex::ParticleReal Ezp = Ez_external_particle;
amrex::ParticleReal Bxp = Bx_external_particle;
amrex::ParticleReal Byp = By_external_particle;
amrex::ParticleReal Bzp = Bz_external_particle;

if(!t_do_not_gather){
// first gather E and B to the particle positions
Expand Down
20 changes: 12 additions & 8 deletions Source/Particles/RigidInjectedParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,12 @@ RigidInjectedParticleContainer::PushP (int lev, Real dt,

const auto getExternalEB = GetExternalEBField(pti);

const amrex::Vector<amrex::ParticleReal> E_external_particle = m_E_external_particle;
const amrex::Vector<amrex::ParticleReal> B_external_particle = m_B_external_particle;
const amrex::ParticleReal Ex_external_particle = m_E_external_particle[0];
const amrex::ParticleReal Ey_external_particle = m_E_external_particle[1];
const amrex::ParticleReal Ez_external_particle = m_E_external_particle[2];
const amrex::ParticleReal Bx_external_particle = m_B_external_particle[0];
const amrex::ParticleReal By_external_particle = m_B_external_particle[1];
const amrex::ParticleReal Bz_external_particle = m_B_external_particle[2];

const std::array<amrex::Real,3>& xyzmin = WarpX::LowerCorner(box, lev, 0._rt);

Expand Down Expand Up @@ -429,12 +433,12 @@ RigidInjectedParticleContainer::PushP (int lev, Real dt,
amrex::ParticleReal xp, yp, zp;
getPosition(ip, xp, yp, zp);

amrex::ParticleReal Exp = E_external_particle[0];
amrex::ParticleReal Eyp = E_external_particle[1];
amrex::ParticleReal Ezp = E_external_particle[2];
amrex::ParticleReal Bxp = B_external_particle[0];
amrex::ParticleReal Byp = B_external_particle[1];
amrex::ParticleReal Bzp = B_external_particle[2];
amrex::ParticleReal Exp = Ex_external_particle;
amrex::ParticleReal Eyp = Ey_external_particle;
amrex::ParticleReal Ezp = Ez_external_particle;
amrex::ParticleReal Bxp = Bx_external_particle;
amrex::ParticleReal Byp = By_external_particle;
amrex::ParticleReal Bzp = Bz_external_particle;

// first gather E and B to the particle positions
doGatherShapeN(xp, yp, zp, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
Expand Down

0 comments on commit d1c2a70

Please sign in to comment.