ImpactX
src
particles
transformation
ToFixedT.H
Go to the documentation of this file.
1
/* Copyright 2022 The Regents of the University of California, through Lawrence
2
* Berkeley National Laboratory (subject to receipt of any required
3
* approvals from the U.S. Dept. of Energy). All rights reserved.
4
*
5
* This file is part of ImpactX.
6
*
7
* Authors: Chad Mitchell, Axel Huebl
8
* License: BSD-3-Clause-LBNL
9
*/
10
#ifndef IMPACTX_TO_FIXED_T_H
11
#define IMPACTX_TO_FIXED_T_H
12
13
#include "
particles/ImpactXParticleContainer.H
"
14
15
#include <
AMReX_GpuQualifiers.H
>
16
#include <
AMReX_Math.H
>
17
#include <
AMReX_REAL.H
>
18
19
#include <cmath>
20
21
22
namespace
impactx
23
{
24
namespace
transformation
25
{
26
struct
ToFixedT
27
{
28
using
PType
=
ImpactXParticleContainer::ParticleType
;
29
37
ToFixedT
( amrex::ParticleReal
const
ptd )
38
:
m_ptd
(ptd)
39
{
40
}
41
50
AMREX_GPU_HOST_DEVICE
AMREX_FORCE_INLINE
51
void
operator()
(
52
PType
& p,
53
amrex::ParticleReal & px,
54
amrex::ParticleReal & py,
55
amrex::ParticleReal & pt)
const
56
{
57
using namespace
amrex::literals;
58
59
// access AoS data such as positions and cpu/id
60
amrex::ParticleReal
const
x = p.
pos
(0);
61
amrex::ParticleReal
const
y = p.
pos
(1);
62
amrex::ParticleReal
const
t = p.
pos
(2);
63
64
// compute value of reference pzd = beta*gamma
65
amrex::ParticleReal
const
argd = -1.0_prt +
pow
(
m_ptd
, 2);
66
AMREX_ASSERT_WITH_MESSAGE
(argd > 0.0_prt,
"invalid pzd arg (<=0)"
);
67
amrex::ParticleReal
const
pzd = argd > 0.0_prt ?
sqrt
(argd) : 0.0_prt;
68
69
// transform momenta to dynamic units (eg, so that momenta are
70
// normalized by mc):
71
px = px*pzd;
72
py = py*pzd;
73
pt = pt*pzd;
74
75
// compute value of particle pz = beta*gamma
76
amrex::ParticleReal
const
arg
= -1.0_prt +
pow
(
m_ptd
+pt, 2) -
pow
(px, 2) -
pow
(py, 2);
77
AMREX_ASSERT_WITH_MESSAGE
(arg > 0.0_prt,
"invalid pz arg (<=0)"
);
78
amrex::ParticleReal
const
pz = arg > 0.0_prt ?
sqrt
(arg) : 0.0_prt;
79
80
// transform position and momentum (from fixed s to fixed t)
81
82
p.
pos
(0) = x + px*t/(
m_ptd
+pt);
83
// px = px;
84
p.
pos
(1) = y + py*t/(
m_ptd
+pt);
85
// py = py;
86
p.
pos
(2) = pz*t/(
m_ptd
+pt);
// This now represents z.
87
pt = pz - pzd;
// This now represents pz.
88
89
// transform momenta to static units (eg, so that momenta are
90
// normalized by pzd):
91
px = px/pzd;
92
py = py/pzd;
93
pt = pt/pzd;
94
95
}
96
97
private
:
98
amrex::ParticleReal
m_ptd
;
99
};
100
101
}
// namespace transformation
102
}
// namespace impactx
103
104
#endif // IMPACTX_TO_FIXED_T_H
impactx::transformation::ToFixedT
Definition:
ToFixedT.H:26
amrex::Particle
impactx::transformation::ToFixedT::m_ptd
amrex::ParticleReal m_ptd
Definition:
ToFixedT.H:98
ImpactXParticleContainer.H
impactx
Definition:
ImpactX.cpp:31
arg
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T arg(const GpuComplex< T > &a_z) noexcept
AMREX_ASSERT_WITH_MESSAGE
#define AMREX_ASSERT_WITH_MESSAGE(EX, MSG)
AMReX_REAL.H
AMREX_FORCE_INLINE
#define AMREX_FORCE_INLINE
impactx::transformation::ToFixedT::operator()
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void operator()(PType &p, amrex::ParticleReal &px, amrex::ParticleReal &py, amrex::ParticleReal &pt) const
Definition:
ToFixedT.H:51
AMREX_GPU_HOST_DEVICE
#define AMREX_GPU_HOST_DEVICE
AMReX_Math.H
amrex::ParticleContainer< 0, 0, RealSoA::nattribs, IntSoA::nattribs >::ParticleType
Particle< NStructReal, NStructInt > ParticleType
amrex::Particle::pos
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE RealVect pos() const &
pow
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE GpuComplex< T > pow(const GpuComplex< T > &a_z, const T &a_y) noexcept
sqrt
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE GpuComplex< T > sqrt(const GpuComplex< T > &a_z) noexcept
impactx::transformation::ToFixedT::ToFixedT
ToFixedT(amrex::ParticleReal const ptd)
Definition:
ToFixedT.H:37
AMReX_GpuQualifiers.H
Generated by
1.8.13