From 57e338608d07aa6f75084f8cc521ab08ba1b57b7 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Sat, 23 Dec 2023 23:01:23 +0100 Subject: [PATCH] Fix: `shift_in` Position Update --- src/particles/elements/Aperture.H | 6 +++--- src/particles/elements/Buncher.H | 6 +++--- src/particles/elements/CFbend.H | 7 ++++--- src/particles/elements/ChrDrift.H | 5 +++-- src/particles/elements/ChrQuad.H | 5 +++-- src/particles/elements/ChrUniformAcc.H | 5 +++-- src/particles/elements/ConstF.H | 5 +++-- src/particles/elements/DipEdge.H | 6 +++--- src/particles/elements/Drift.H | 6 +++--- src/particles/elements/ExactDrift.H | 5 +++-- src/particles/elements/ExactSbend.H | 5 +++-- src/particles/elements/Kicker.H | 5 +++-- src/particles/elements/Multipole.H | 6 +++--- src/particles/elements/NonlinearLens.H | 6 +++--- src/particles/elements/Quad.H | 6 +++--- src/particles/elements/RFCavity.H | 6 +++--- src/particles/elements/Sbend.H | 6 +++--- src/particles/elements/ShortRF.H | 6 +++--- src/particles/elements/SoftQuad.H | 6 +++--- src/particles/elements/SoftSol.H | 6 +++--- src/particles/elements/Sol.H | 6 +++--- src/particles/elements/ThinDipole.H | 6 +++--- 22 files changed, 67 insertions(+), 59 deletions(-) diff --git a/src/particles/elements/Aperture.H b/src/particles/elements/Aperture.H index f6924f531..2f7e65f5d 100644 --- a/src/particles/elements/Aperture.H +++ b/src/particles/elements/Aperture.H @@ -85,14 +85,14 @@ namespace impactx { using namespace amrex::literals; // for _rt and _prt + // shift due to alignment errors of the element + shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py); + // access AoS data such as positions and cpu/id amrex::ParticleReal x = p.pos(RealAoS::x); amrex::ParticleReal y = p.pos(RealAoS::y); auto const id = p.id(); - // shift due to alignment errors of the element - shift_in(x, y, px, py); - // scale horizontal and vertical coordinates amrex::ParticleReal const u = x / m_xmax; amrex::ParticleReal const v = y / m_ymax; diff --git a/src/particles/elements/Buncher.H b/src/particles/elements/Buncher.H index 2a23f0983..fdc1d732f 100644 --- a/src/particles/elements/Buncher.H +++ b/src/particles/elements/Buncher.H @@ -75,14 +75,14 @@ namespace impactx using namespace amrex::literals; // for _rt and _prt + // shift due to alignment errors of the element + shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py); + // access AoS data such as positions and cpu/id amrex::ParticleReal x = p.pos(RealAoS::x); amrex::ParticleReal y = p.pos(RealAoS::y); amrex::ParticleReal const t = p.pos(RealAoS::t); - // shift due to alignment errors of the element - shift_in(x, y, px, py); - // access reference particle values to find (beta*gamma)^2 amrex::ParticleReal const pt_ref = refpart.pt; amrex::ParticleReal const betgam2 = pow(pt_ref, 2) - 1.0_prt; diff --git a/src/particles/elements/CFbend.H b/src/particles/elements/CFbend.H index 168379b08..05b5f455a 100644 --- a/src/particles/elements/CFbend.H +++ b/src/particles/elements/CFbend.H @@ -83,14 +83,15 @@ namespace impactx { using namespace amrex::literals; // for _rt and _prt + // shift due to alignment errors of the element + shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py); + + // access AoS data such as positions and cpu/id amrex::ParticleReal x = p.pos(RealAoS::x); amrex::ParticleReal y = p.pos(RealAoS::y); amrex::ParticleReal const t = p.pos(RealAoS::t); - // shift due to alignment errors of the element - shift_in(x, y, px, py); - // initialize output values of momenta amrex::ParticleReal pxout = px; amrex::ParticleReal pyout = py; diff --git a/src/particles/elements/ChrDrift.H b/src/particles/elements/ChrDrift.H index 480039404..b0bd9b0b4 100644 --- a/src/particles/elements/ChrDrift.H +++ b/src/particles/elements/ChrDrift.H @@ -77,13 +77,14 @@ namespace impactx using namespace amrex::literals; // for _rt and _prt + // shift due to alignment errors of the element + shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py); + // access AoS data such as positions and cpu/id amrex::ParticleReal x = p.pos(RealAoS::x); amrex::ParticleReal y = p.pos(RealAoS::y); amrex::ParticleReal const t = p.pos(RealAoS::t); - // shift due to alignment errors of the element - shift_in(x, y, px, py); // initialize output values of momenta amrex::ParticleReal const pxout = px; diff --git a/src/particles/elements/ChrQuad.H b/src/particles/elements/ChrQuad.H index 6e4e7f673..1532caeb7 100644 --- a/src/particles/elements/ChrQuad.H +++ b/src/particles/elements/ChrQuad.H @@ -89,13 +89,14 @@ namespace impactx using namespace amrex::literals; // for _rt and _prt + // shift due to alignment errors of the element + shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py); + // access AoS data such as positions and cpu/id amrex::ParticleReal x = p.pos(RealAoS::x); amrex::ParticleReal y = p.pos(RealAoS::y); amrex::ParticleReal const t = p.pos(RealAoS::t); - // shift due to alignment errors of the element - shift_in(x, y, px, py); // length of the current slice amrex::ParticleReal const slice_ds = m_ds / nslice(); diff --git a/src/particles/elements/ChrUniformAcc.H b/src/particles/elements/ChrUniformAcc.H index 5df706c15..c038c7328 100644 --- a/src/particles/elements/ChrUniformAcc.H +++ b/src/particles/elements/ChrUniformAcc.H @@ -84,13 +84,14 @@ namespace impactx using namespace amrex::literals; // for _rt and _prt + // shift due to alignment errors of the element + shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py); + // access AoS data such as positions and cpu/id amrex::ParticleReal x = p.pos(RealAoS::x); amrex::ParticleReal y = p.pos(RealAoS::y); amrex::ParticleReal const t = p.pos(RealAoS::t); - // shift due to alignment errors of the element - shift_in(x, y, px, py); // length of the current slice amrex::ParticleReal const slice_ds = m_ds / nslice(); diff --git a/src/particles/elements/ConstF.H b/src/particles/elements/ConstF.H index f8bb9fe19..79dcef179 100644 --- a/src/particles/elements/ConstF.H +++ b/src/particles/elements/ConstF.H @@ -81,13 +81,14 @@ namespace impactx using namespace amrex::literals; // for _rt and _prt + // shift due to alignment errors of the element + shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py); + // access AoS data such as positions and cpu/id amrex::ParticleReal x = p.pos(RealAoS::x); amrex::ParticleReal y = p.pos(RealAoS::y); amrex::ParticleReal const t = p.pos(RealAoS::t); - // shift due to alignment errors of the element - shift_in(x, y, px, py); // access reference particle values to find beta*gamma^2 amrex::ParticleReal const pt_ref = refpart.pt; diff --git a/src/particles/elements/DipEdge.H b/src/particles/elements/DipEdge.H index 8f905746a..c9c2994cf 100644 --- a/src/particles/elements/DipEdge.H +++ b/src/particles/elements/DipEdge.H @@ -86,13 +86,13 @@ namespace impactx using namespace amrex::literals; // for _rt and _prt + // shift due to alignment errors of the element + shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py); + // access AoS data such as positions and cpu/id amrex::ParticleReal x = p.pos(RealAoS::x); amrex::ParticleReal y = p.pos(RealAoS::y); - // shift due to alignment errors of the element - shift_in(x, y, px, py); - // access reference particle values if needed // edge focusing matrix elements (zero gap) diff --git a/src/particles/elements/Drift.H b/src/particles/elements/Drift.H index 824b92f02..2e3e7ddc6 100644 --- a/src/particles/elements/Drift.H +++ b/src/particles/elements/Drift.H @@ -74,14 +74,14 @@ namespace impactx using namespace amrex::literals; // for _rt and _prt + // shift due to alignment errors of the element + shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py); + // access AoS data such as positions and cpu/id amrex::ParticleReal x = p.pos(RealAoS::x); amrex::ParticleReal y = p.pos(RealAoS::y); amrex::ParticleReal const t = p.pos(RealAoS::t); - // shift due to alignment errors of the element - shift_in(x, y, px, py); - // initialize output values of momenta amrex::ParticleReal const pxout = px; amrex::ParticleReal const pyout = py; diff --git a/src/particles/elements/ExactDrift.H b/src/particles/elements/ExactDrift.H index b7149dc1e..9a46c57d6 100644 --- a/src/particles/elements/ExactDrift.H +++ b/src/particles/elements/ExactDrift.H @@ -75,13 +75,14 @@ namespace impactx using namespace amrex::literals; // for _rt and _prt + // shift due to alignment errors of the element + shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py); + // access AoS data such as positions and cpu/id amrex::ParticleReal x = p.pos(RealAoS::x); amrex::ParticleReal y = p.pos(RealAoS::y); amrex::ParticleReal const t = p.pos(RealAoS::t); - // shift due to alignment errors of the element - shift_in(x, y, px, py); // initialize output values of momenta amrex::ParticleReal const pxout = px; diff --git a/src/particles/elements/ExactSbend.H b/src/particles/elements/ExactSbend.H index 247f8e7d9..e90e95550 100644 --- a/src/particles/elements/ExactSbend.H +++ b/src/particles/elements/ExactSbend.H @@ -91,13 +91,14 @@ namespace impactx using namespace amrex::literals; // for _rt and _prt + // shift due to alignment errors of the element + shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py); + // access AoS data such as positions and cpu/id amrex::ParticleReal x = p.pos(RealAoS::x); amrex::ParticleReal y = p.pos(RealAoS::y); amrex::ParticleReal const t = p.pos(RealAoS::t); - // shift due to alignment errors of the element - shift_in(x, y, px, py); // angle of arc for the current slice amrex::ParticleReal const slice_phi = m_phi / nslice(); diff --git a/src/particles/elements/Kicker.H b/src/particles/elements/Kicker.H index 66c32028c..48ee7008c 100644 --- a/src/particles/elements/Kicker.H +++ b/src/particles/elements/Kicker.H @@ -84,13 +84,14 @@ namespace impactx { using namespace amrex::literals; // for _rt and _prt + // shift due to alignment errors of the element + shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py); + // access AoS data such as positions and cpu/id amrex::ParticleReal x = p.pos(RealAoS::x); amrex::ParticleReal y = p.pos(RealAoS::y); amrex::ParticleReal const t = p.pos(RealAoS::t); - // shift due to alignment errors of the element - shift_in(x, y, px, py); // normalize quad units to MAD-X convention if needed amrex::ParticleReal dpx = m_xkick; diff --git a/src/particles/elements/Multipole.H b/src/particles/elements/Multipole.H index da634664a..1351ac3c2 100644 --- a/src/particles/elements/Multipole.H +++ b/src/particles/elements/Multipole.H @@ -83,6 +83,9 @@ namespace impactx using namespace amrex::literals; // for _rt and _prt + // shift due to alignment errors of the element + shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py); + // a complex type with two amrex::ParticleReal using Complex = amrex::GpuComplex; @@ -91,9 +94,6 @@ namespace impactx amrex::ParticleReal y = p.pos(RealAoS::y); amrex::ParticleReal const t = p.pos(RealAoS::t); - // shift due to alignment errors of the element - shift_in(x, y, px, py); - // access reference particle values to find (beta*gamma)^2 //amrex::ParticleReal const pt_ref = refpart.pt; //amrex::ParticleReal const betgam2 = pow(pt_ref, 2) - 1.0_prt; diff --git a/src/particles/elements/NonlinearLens.H b/src/particles/elements/NonlinearLens.H index f4a5d692e..d3513f5f6 100644 --- a/src/particles/elements/NonlinearLens.H +++ b/src/particles/elements/NonlinearLens.H @@ -83,14 +83,14 @@ namespace impactx // a complex type with two amrex::ParticleReal using Complex = amrex::GpuComplex; + // shift due to alignment errors of the element + shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py); + // access AoS data such as positions and cpu/id amrex::ParticleReal x = p.pos(RealAoS::x); amrex::ParticleReal y = p.pos(RealAoS::y); amrex::ParticleReal const t = p.pos(RealAoS::t); - // shift due to alignment errors of the element - shift_in(x, y, px, py); - // access reference particle values to find (beta*gamma)^2 //amrex::ParticleReal const pt_ref = refpart.pt; //amrex::ParticleReal const betgam2 = pow(pt_ref, 2) - 1.0_prt; diff --git a/src/particles/elements/Quad.H b/src/particles/elements/Quad.H index e595a2738..b931368ba 100644 --- a/src/particles/elements/Quad.H +++ b/src/particles/elements/Quad.H @@ -81,14 +81,14 @@ namespace impactx { using namespace amrex::literals; // for _rt and _prt + // shift due to alignment errors of the element + shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py); + // access AoS data such as positions and cpu/id amrex::ParticleReal x = p.pos(RealAoS::x); amrex::ParticleReal y = p.pos(RealAoS::y); amrex::ParticleReal const t = p.pos(RealAoS::t); - // shift due to alignment errors of the element - shift_in(x, y, px, py); - // length of the current slice amrex::ParticleReal const slice_ds = m_ds / nslice(); diff --git a/src/particles/elements/RFCavity.H b/src/particles/elements/RFCavity.H index 8cc20e16d..01320b1ee 100644 --- a/src/particles/elements/RFCavity.H +++ b/src/particles/elements/RFCavity.H @@ -194,14 +194,14 @@ namespace RFCavityData { using namespace amrex::literals; // for _rt and _prt + // shift due to alignment errors of the element + shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py); + // access AoS data such as positions and cpu/id amrex::ParticleReal x = p.pos(RealAoS::x); amrex::ParticleReal y = p.pos(RealAoS::y); amrex::ParticleReal const t = p.pos(RealAoS::t); - // shift due to alignment errors of the element - shift_in(x, y, px, py); - // initialize output values of momenta amrex::ParticleReal pxout = px; amrex::ParticleReal pyout = py; diff --git a/src/particles/elements/Sbend.H b/src/particles/elements/Sbend.H index 2c8fdd184..0048256ae 100644 --- a/src/particles/elements/Sbend.H +++ b/src/particles/elements/Sbend.H @@ -77,14 +77,14 @@ namespace impactx using namespace amrex::literals; // for _rt and _prt + // shift due to alignment errors of the element + shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py); + // access AoS data such as positions and cpu/id amrex::ParticleReal x = p.pos(RealAoS::x); amrex::ParticleReal y = p.pos(RealAoS::y); amrex::ParticleReal const t = p.pos(RealAoS::t); - // shift due to alignment errors of the element - shift_in(x, y, px, py); - // initialize output values of momenta amrex::ParticleReal pxout = px; amrex::ParticleReal const pyout = py; diff --git a/src/particles/elements/ShortRF.H b/src/particles/elements/ShortRF.H index 022ef75ba..3931de751 100644 --- a/src/particles/elements/ShortRF.H +++ b/src/particles/elements/ShortRF.H @@ -80,14 +80,14 @@ namespace impactx using namespace amrex::literals; // for _rt and _prt + // shift due to alignment errors of the element + shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py); + // access AoS data such as positions and cpu/id amrex::ParticleReal x = p.pos(RealAoS::x); amrex::ParticleReal y = p.pos(RealAoS::y); amrex::ParticleReal const t = p.pos(RealAoS::t); - // shift due to alignment errors of the element - shift_in(x, y, px, py); - // Define parameters and intermediate constants using ablastr::constant::math::pi; using ablastr::constant::SI::c; diff --git a/src/particles/elements/SoftQuad.H b/src/particles/elements/SoftQuad.H index 047c4e110..32f4f9b03 100644 --- a/src/particles/elements/SoftQuad.H +++ b/src/particles/elements/SoftQuad.H @@ -199,14 +199,14 @@ namespace SoftQuadrupoleData { using namespace amrex::literals; // for _rt and _prt + // shift due to alignment errors of the element + shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py); + // access AoS data such as positions and cpu/id amrex::ParticleReal x = p.pos(RealAoS::x); amrex::ParticleReal y = p.pos(RealAoS::y); amrex::ParticleReal const t = p.pos(RealAoS::t); - // shift due to alignment errors of the element - shift_in(x, y, px, py); - // initialize output values of momenta amrex::ParticleReal pxout = px; amrex::ParticleReal pyout = py; diff --git a/src/particles/elements/SoftSol.H b/src/particles/elements/SoftSol.H index 289ea319f..1cd7ee246 100644 --- a/src/particles/elements/SoftSol.H +++ b/src/particles/elements/SoftSol.H @@ -204,14 +204,14 @@ namespace SoftSolenoidData { using namespace amrex::literals; // for _rt and _prt + // shift due to alignment errors of the element + shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py); + // access AoS data such as positions and cpu/id amrex::ParticleReal x = p.pos(RealAoS::x); amrex::ParticleReal y = p.pos(RealAoS::y); amrex::ParticleReal const t = p.pos(RealAoS::t); - // shift due to alignment errors of the element - shift_in(x, y, px, py); - // initialize output values of momenta amrex::ParticleReal pxout = px; amrex::ParticleReal pyout = py; diff --git a/src/particles/elements/Sol.H b/src/particles/elements/Sol.H index b5ac29cd7..79d85660a 100644 --- a/src/particles/elements/Sol.H +++ b/src/particles/elements/Sol.H @@ -78,14 +78,14 @@ namespace impactx using namespace amrex::literals; // for _rt and _prt + // shift due to alignment errors of the element + shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py); + // access AoS data such as positions and cpu/id amrex::ParticleReal x = p.pos(RealAoS::x); amrex::ParticleReal y = p.pos(RealAoS::y); amrex::ParticleReal const t = p.pos(RealAoS::t); - // shift due to alignment errors of the element - shift_in(x, y, px, py); - // length of the current slice amrex::ParticleReal const slice_ds = m_ds / nslice(); diff --git a/src/particles/elements/ThinDipole.H b/src/particles/elements/ThinDipole.H index 0c6d322af..c29d748ad 100644 --- a/src/particles/elements/ThinDipole.H +++ b/src/particles/elements/ThinDipole.H @@ -80,14 +80,14 @@ namespace impactx using namespace amrex::literals; // for _rt and _prt + // shift due to alignment errors of the element + shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py); + // access AoS data such as positions and cpu/id amrex::ParticleReal x = p.pos(RealAoS::x); amrex::ParticleReal y = p.pos(RealAoS::y); amrex::ParticleReal const t = p.pos(RealAoS::t); - // shift due to alignment errors of the element - shift_in(x, y, px, py); - // access reference particle to find relativistic beta amrex::ParticleReal const beta_ref = refpart.beta();