Skip to content

Commit

Permalink
Fix: shift_in Position Update
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed Dec 23, 2023
1 parent a90c64f commit 57e3386
Show file tree
Hide file tree
Showing 22 changed files with 67 additions and 59 deletions.
6 changes: 3 additions & 3 deletions src/particles/elements/Aperture.H
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/particles/elements/Buncher.H
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions src/particles/elements/CFbend.H
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions src/particles/elements/ChrDrift.H
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions src/particles/elements/ChrQuad.H
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 3 additions & 2 deletions src/particles/elements/ChrUniformAcc.H
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 3 additions & 2 deletions src/particles/elements/ConstF.H
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/particles/elements/DipEdge.H
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/particles/elements/Drift.H
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions src/particles/elements/ExactDrift.H
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions src/particles/elements/ExactSbend.H
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 3 additions & 2 deletions src/particles/elements/Kicker.H
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/particles/elements/Multipole.H
Original file line number Diff line number Diff line change
Expand Up @@ -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<amrex::ParticleReal>;

Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/particles/elements/NonlinearLens.H
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ namespace impactx
// a complex type with two amrex::ParticleReal
using Complex = amrex::GpuComplex<amrex::ParticleReal>;

// 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;
Expand Down
6 changes: 3 additions & 3 deletions src/particles/elements/Quad.H
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
6 changes: 3 additions & 3 deletions src/particles/elements/RFCavity.H
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/particles/elements/Sbend.H
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/particles/elements/ShortRF.H
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/particles/elements/SoftQuad.H
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/particles/elements/SoftSol.H
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/particles/elements/Sol.H
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
6 changes: 3 additions & 3 deletions src/particles/elements/ThinDipole.H
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 57e3386

Please sign in to comment.