10#ifndef IMPACTX_INVARIANTS_H
11#define IMPACTX_INVARIANTS_H
41 amrex::ParticleReal
H;
42 amrex::ParticleReal
I;
55 amrex::ParticleReal
const alpha,
56 amrex::ParticleReal
const beta,
57 amrex::ParticleReal
const tn,
58 amrex::ParticleReal
const cn )
73 amrex::ParticleReal
const x,
74 amrex::ParticleReal
const y,
75 amrex::ParticleReal
const px,
76 amrex::ParticleReal
const py
79 using namespace amrex::literals;
86 amrex::ParticleReal
const xn = x/(
m_cn*std::sqrt(
m_beta));
87 amrex::ParticleReal
const yn = y/(
m_cn*std::sqrt(
m_beta));
93 Complex const zetaconj(xn, -yn);
94 Complex const re1(1.0_prt, 0.0_prt);
95 Complex const im1(0.0_prt, 1.0_prt);
103 Complex carcsin = im1*zeta + croot;
107 Complex Hpotential = zeta/croot;
108 Hpotential = Hpotential*carcsin;
111 Complex Ipotential = (zeta+zetaconj)/croot;
112 Ipotential = Ipotential*carcsin;
115 amrex::ParticleReal Hinv = Hpotential.
m_real;
116 amrex::ParticleReal Iinv = Ipotential.
m_real;
119 amrex::ParticleReal
const Jz = xn*pyn - yn*pxn;
120 Hinv = (powi<2>(xn) + powi<2>(yn) + powi<2>(pxn) + powi<2>(pyn))/2
122 Iinv = powi<2>(Jz) + powi<2>(pxn) + powi<2>(xn) +
m_tn*Iinv;
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
amrex::GpuComplex< amrex::Real > Complex
T_ParticleType ParticleType
constexpr T powi(T x) noexcept
__host__ __device__ GpuComplex< T > log(const GpuComplex< T > &a_z) noexcept
__host__ __device__ GpuComplex< T > sqrt(const GpuComplex< T > &a_z) noexcept
Definition CovarianceMatrixMath.H:25
Definition NonlinearLensInvariants.H:40
amrex::ParticleReal I
second phase space function ("second invariant")
Definition NonlinearLensInvariants.H:42
amrex::ParticleReal H
first phase space function (Hamiltonian)
Definition NonlinearLensInvariants.H:41
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Data operator()(amrex::ParticleReal const x, amrex::ParticleReal const y, amrex::ParticleReal const px, amrex::ParticleReal const py) const
Definition NonlinearLensInvariants.H:72
ImpactXParticleContainer::ParticleType PType
Definition NonlinearLensInvariants.H:33
amrex::ParticleReal m_beta
Twiss alpha.
Definition NonlinearLensInvariants.H:130
NonlinearLensInvariants(amrex::ParticleReal const alpha, amrex::ParticleReal const beta, amrex::ParticleReal const tn, amrex::ParticleReal const cn)
Definition NonlinearLensInvariants.H:54
amrex::ParticleReal m_tn
Twiss beta (m)
Definition NonlinearLensInvariants.H:131
amrex::ParticleReal m_cn
dimensionless strength of the nonlinear insert
Definition NonlinearLensInvariants.H:132
amrex::ParticleReal m_alpha
Definition NonlinearLensInvariants.H:129