1 #ifndef GYRO_RADIUS_HPP
2 #define GYRO_RADIUS_HPP
10 template<
class Device>
17 double B = sqrt( br*br + bz*bz + bphi*bphi );
26 #if defined(XGC1) && defined(NEWGYROMATRIX)
40 template<
class Device>
50 for (
int i_simd = 0; i_simd<SIMD_SIZE; i_simd++){
52 phimax[i_simd] = phimin[i_simd] + grid.
delta_phi;
58 for (
int iphi=0; iphi<2; iphi++){
60 magnetic_field.
get_psi(xp[iphi], iphi=0 ? phimin : phimax, psip);
62 for (
int i_simd = 0; i_simd<SIMD_SIZE; i_simd++){
63 double r = xp[iphi].
r[i_simd];
64 double z = xp[iphi].
z[i_simd];
65 double ti=species.
eq_temp.
value(magnetic_field, psip[i_simd],r,z);
68 double B = sqrt( br*br + bz*bz + bphi*bphi );
69 rho[i_simd]=sqrt(2.0*B*mu[i_simd]/(ti*
EV_2_J));
76 KOKKOS_INLINE_FUNCTION
int irho(
int i_simd)
const{
78 return rho_wts[0].i[i_simd];
96 template<
class Device>
100 for (
int i_simd = 0; i_simd<SIMD_SIZE; i_simd++){
101 rho[i_simd]=
gyro_radius(magnetic_field,v.
r[i_simd],v.
z[i_simd],mu[i_simd],species.
c2_2m);
107 KOKKOS_INLINE_FUNCTION
int irho(
int i_simd)
const{
108 return rho_wts.i[i_simd];
121 template<
class Device>
124 KOKKOS_INLINE_FUNCTION
int irho(
int i_simd)
const{
Simd< double > r
Definition: simd.hpp:150
KOKKOS_INLINE_FUNCTION void bvec_interpol(double r, double z, double phi, double &br, double &bz, double &bphi) const
Definition: magnetic_field.tpp:262
KOKKOS_INLINE_FUNCTION void get_psi(const SimdVector &v, Simd< double > &psi_out) const
Definition: magnetic_field.tpp:46
KOKKOS_INLINE_FUNCTION void follow_field(const SimdVector2D &x_org, const Simd< double > &phi_org, const Simd< double > &phi_dest, SimdVector2D &x_dest) const
Definition: magnetic_field.tpp:344
Definition: linear_weights.hpp:46
double c2_2m
c2/2m
Definition: species.hpp:87
KOKKOS_INLINE_FUNCTION int irho(int i_simd) const
Definition: gyro_radius.hpp:107
constexpr double EV_2_J
Conversion rate ev to J.
Definition: constants.hpp:5
Definition: globals.hpp:89
Definition: magnetic_field.hpp:12
KOKKOS_INLINE_FUNCTION SimdGyroWeights(const Grid< Device > &grid, const MagneticField< Device > &magnetic_field, const Species< DeviceType > &species, const SimdVector &v, Simd< double > &mu)
Definition: gyro_radius.hpp:97
KOKKOS_INLINE_FUNCTION SimdGyroWeights(const Grid< Device > &grid, const MagneticField< Device > &magnetic_field, const Species< DeviceType > &species, const SimdVector &v, Simd< double > &mu)
Definition: gyro_radius.hpp:122
int nrho
Definition: gyro_avg_mat.hpp:23
KOKKOS_INLINE_FUNCTION SimdVector2D & x()
Definition: simd.hpp:156
SimdLinearWeights rho_wts
Definition: gyro_radius.hpp:87
KOKKOS_INLINE_FUNCTION SimdGyroWeights()
Definition: gyro_radius.hpp:118
Definition: gyro_radius.hpp:24
Simd< double > z
Definition: simd.hpp:141
Definition: globals.hpp:90
double inv_drho
Definition: gyro_avg_mat.hpp:25
KOKKOS_INLINE_FUNCTION int get_plane_index(double phi) const
Definition: grid.tpp:133
KOKKOS_INLINE_FUNCTION void wedge_modulo_phi(Simd< double > &phi_mod) const
Definition: grid.tpp:86
Simd< double > phi
Definition: simd.hpp:152
Simd< double > z
Definition: simd.hpp:151
Simd< double > r
Definition: simd.hpp:140
Definition: magnetic_field.F90:1
KOKKOS_INLINE_FUNCTION double value(const MagneticField< DeviceType > &b_field, double psi_in, double r, double z) const
Definition: profile.hpp:319
Definition: species.hpp:75
GyroAverageMatrices< Device > gyro_avg_matrices
Definition: species.hpp:147
Eq::Profile< Device > eq_temp
Definition: species.hpp:132
double delta_phi
Distance between planes.
Definition: grid.hpp:162
KOKKOS_INLINE_FUNCTION int irho(int i_simd) const
Definition: gyro_radius.hpp:124