ImpactX
Toggle main menu visibility
Loading...
Searching...
No Matches
src
particles
transformation
ToFixedS.H
Go to the documentation of this file.
1
/* Copyright 2022-2026 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_S_H
11
#define IMPACTX_TO_FIXED_S_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::transformation
23
{
24
struct
ToFixedS
25
{
26
using
PType
=
ImpactXParticleContainer::ParticleType
;
27
35
ToFixedS
(
amrex::ParticleReal
const
pzd)
36
:
m_pzd
(pzd)
37
{
38
}
39
50
AMREX_GPU_HOST_DEVICE
AMREX_FORCE_INLINE
51
void
operator()
(
52
amrex::ParticleReal
& x,
53
amrex::ParticleReal
& y,
54
amrex::ParticleReal
& z,
55
amrex::ParticleReal
& px,
56
amrex::ParticleReal
& py,
57
amrex::ParticleReal
& pz)
const
58
{
59
using namespace
amrex::literals
;
60
using
amrex::Math::powi
;
61
62
// compute value of reference ptd = -gamma
63
amrex::ParticleReal
const
argd = 1.0_prt + powi<2>(
m_pzd
);
64
AMREX_ASSERT_WITH_MESSAGE
(argd > 0.0_prt,
"invalid ptd arg (<=0)"
);
65
amrex::ParticleReal
const
ptdf = argd > 0.0_prt ? -std::sqrt(argd) : -1.0_prt;
66
67
// transform momenta to dynamic units (e.g., so that momenta are
68
// normalized by mc):
69
px = px *
m_pzd
;
70
py = py *
m_pzd
;
71
pz = pz *
m_pzd
;
72
73
// compute value of particle pt = -gamma
74
amrex::ParticleReal
const
arg
= 1.0_prt + powi<2>(
m_pzd
+ pz) + powi<2>(px) + powi<2>(py);
75
AMREX_ASSERT_WITH_MESSAGE
(
arg
> 0.0_prt,
"invalid pt arg (<=0)"
);
76
amrex::ParticleReal
const
ptf =
arg
> 0.0_prt ? -std::sqrt(
arg
) : -1.0_prt;
77
78
// transform position and momentum (from fixed t to fixed s)
79
x = x - px * z / (
m_pzd
+ pz);
80
// px = px;
81
y = y - py * z / (
m_pzd
+ pz);
82
// py = py;
83
auto
&
t
= z;
// We store t in the same memory slot as z.
84
t
= ptf * z / (
m_pzd
+ pz);
85
auto
& pt = pz;
// We store pt in the same memory slot as pz.
86
pt = ptf - ptdf;
87
88
// transform momenta to static units (eg, so that momenta are
89
// normalized by pzd):
90
px = px /
m_pzd
;
91
py = py /
m_pzd
;
92
pt = pz /
m_pzd
;
93
}
94
95
private
:
96
amrex::ParticleReal
m_pzd
;
97
};
98
99
}
// namespace impactx::transformation
100
101
#endif
// IMPACTX_TO_FIXED_S_H
AMREX_ASSERT_WITH_MESSAGE
#define AMREX_ASSERT_WITH_MESSAGE(EX, MSG)
AMREX_FORCE_INLINE
#define AMREX_FORCE_INLINE
AMReX_GpuQualifiers.H
AMREX_GPU_HOST_DEVICE
#define AMREX_GPU_HOST_DEVICE
AMReX_Math.H
AMReX_REAL.H
ImpactXParticleContainer.H
amrex::ParticleContainer_impl< SoAParticle< T_NArrayReal, T_NArrayInt >, T_NArrayReal, T_NArrayInt, Allocator, CellAssignor >::ParticleType
T_ParticleType ParticleType
amrex::ParticleReal
amrex_particle_real ParticleReal
amrex::Math::powi
constexpr T powi(T x) noexcept
amrex::literals
amrex::arg
__host__ __device__ T arg(const GpuComplex< T > &a_z) noexcept
impactx::transformation
Definition
CoordinateTransformation.cpp:24
impactx::CoordSystem::t
@ t
fixed t as the independent variable
Definition
ImpactXParticleContainer.H:38
impactx::transformation::ToFixedS::ToFixedS
ToFixedS(amrex::ParticleReal const pzd)
Definition
ToFixedS.H:35
impactx::transformation::ToFixedS::operator()
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void operator()(amrex::ParticleReal &x, amrex::ParticleReal &y, amrex::ParticleReal &z, amrex::ParticleReal &px, amrex::ParticleReal &py, amrex::ParticleReal &pz) const
Definition
ToFixedS.H:51
impactx::transformation::ToFixedS::PType
ImpactXParticleContainer::ParticleType PType
Definition
ToFixedS.H:26
impactx::transformation::ToFixedS::m_pzd
amrex::ParticleReal m_pzd
Design value of pz/mc = beta*gamma.
Definition
ToFixedS.H:96
Generated by
1.17.0