Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 26, 2023
1 parent fbebf68 commit cbbca0b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/initialization/InitElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ namespace detail
int nslice = nslice_default;
pp_element.get("ds", ds);
pp_element.get("rc", rc);
pp_element.get("k", k);
pp_element.get("k", k);
pp_element.queryAdd("nslice", nslice);
m_lattice.emplace_back( CFbend(ds, rc, k, nslice) );
} else if (element_type == "dipedge") {
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/All.H
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace impactx
using KnownElements = std::variant<
None, /* must be first, so KnownElements creates a default constructor */
CFbend,
ChrAcc,
ChrAcc,
ChrDrift,
ChrQuad,
ConstF,
Expand Down
28 changes: 14 additions & 14 deletions src/particles/elements/CFbend.H
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace impactx
using PType = ImpactXParticleContainer::ParticleType;

/** An combined-function bend, consisting of an ideal sector bend with
* an upright quadrupole focusing component.
* an upright quadrupole focusing component.
*
* @param ds Segment length in m.
* @param rc Radius of curvature in m.
Expand Down Expand Up @@ -91,43 +91,43 @@ namespace impactx
amrex::ParticleReal const gx = m_k + pow(m_rc,-2);
amrex::ParticleReal const omegax = sqrt(std::abs(gx));

if(gx > 0.0) {
if(gx > 0.0) {
// calculate expensive terms once
amrex::ParticleReal const sinx = sin(omegax * slice_ds);
amrex::ParticleReal const cosx = cos(omegax * slice_ds);
amrex::ParticleReal const r56 = slice_ds/betgam2
+ (sinx - omegax*slice_ds)/(gx*omegax*pow(bet,2)*pow(m_rc,2));
amrex::ParticleReal const r56 = slice_ds/betgam2
+ (sinx - omegax*slice_ds)/(gx*omegax*pow(bet,2)*pow(m_rc,2));

// advance position and momentum (focusing)
p.pos(RealAoS::x) = cosx*x + sinx/omegax*px - (1.0_prt - cosx)/(gx*bet*m_rc)*pt;
p.pos(RealAoS::x) = cosx*x + sinx/omegax*px - (1.0_prt - cosx)/(gx*bet*m_rc)*pt;
pxout = -omegax*sinx*x + cosx*px - sinx/(omegax*bet*m_rc)*pt;

p.pos(RealAoS::t) = sinx/(omegax*bet*m_rc)*x + (1.0_prt - cosx)/(gx*bet*m_rc)*px
p.pos(RealAoS::t) = sinx/(omegax*bet*m_rc)*x + (1.0_prt - cosx)/(gx*bet*m_rc)*px
+ t + r56*pt;
ptout = pt;
ptout = pt;

} else {
// calculate expensive terms once
amrex::ParticleReal const sinhx = sinh(omegax * slice_ds);
amrex::ParticleReal const coshx = cosh(omegax * slice_ds);
amrex::ParticleReal const r56 = slice_ds/betgam2
amrex::ParticleReal const r56 = slice_ds/betgam2
+ (sinhx - omegax*slice_ds)/(gx*omegax*pow(bet,2)*pow(m_rc,2));

// advance position and momentum (defocusing)
// advance position and momentum (defocusing)
p.pos(RealAoS::x) = coshx*x + sinhx/omegax*px - (1.0_prt - coshx)/(gx*bet*m_rc)*pt;
pxout = omegax*sinhx*x + coshx*px - sinhx/(omegax*bet*m_rc)*pt;
p.pos(RealAoS::t) = sinhx/(omegax*bet*m_rc)*x + (1.0_prt - coshx)/(gx*bet*m_rc)*px

p.pos(RealAoS::t) = sinhx/(omegax*bet*m_rc)*x + (1.0_prt - coshx)/(gx*bet*m_rc)*px
+ t + r56*pt;
ptout = pt;

}
}

// update vertical phase space variables
amrex::ParticleReal const gy = -m_k;
amrex::ParticleReal const omegay = sqrt(std::abs(gy));

if(gy > 0.0) {
if(gy > 0.0) {
// calculate expensive terms once
amrex::ParticleReal const siny = sin(omegay * slice_ds);
amrex::ParticleReal const cosy = cos(omegay * slice_ds);
Expand Down

0 comments on commit cbbca0b

Please sign in to comment.