1 #ifndef MAGNETIC_FIELD_HPP
2 #define MAGNETIC_FIELD_HPP
11 template<
class Device>
14 KOKKOS_INLINE_FUNCTION
void derivs(
const double (&x)[2],
double phi,
double (&dx)[2])
const;
37 template<
class Device2>
61 MagneticField(
PsiOption psi_opt,
double safety_factor_coeff=1.0,
int eq_mr_in=-1,
int eq_mz_in=-1,
int eq_mpsi_in=-1)
68 bounds(0.5, 2.5, -1.0, 1.0),
76 int eq_mr = (eq_mr_in==-1 ? 100 : eq_mr_in);
80 int eq_mz = (eq_mz_in==-1 ? eq_mr : eq_mz_in);
91 int eq_mpsi = (eq_mpsi_in==-1 ? eq_mr : eq_mpsi_in);
105 KOKKOS_INLINE_FUNCTION
double get_psi(
double r,
double z)
const;
109 KOKKOS_INLINE_FUNCTION
double I_value(
double psi_in,
int rgn3)
const;
111 KOKKOS_INLINE_FUNCTION
double I_deriv(
double psi_in,
int rgn3)
const;
113 KOKKOS_INLINE_FUNCTION
double geometry_r(
double r)
const;
118 KOKKOS_INLINE_FUNCTION
void bvec_interpol(
double r,
double z,
double phi,
double &br,
double &bz,
double &bphi)
const;
double inpsi
Boundary condition used in a few spots.
Definition: magnetic_field.hpp:25
CubInterp< Device > I_interp
The object for interpolating I (for deriving toroidal magnetic field)
Definition: magnetic_field.hpp:31
KOKKOS_INLINE_FUNCTION void bvec_interpol(double r, double z, double phi, double &br, double &bz, double &bphi) const
Definition: magnetic_field.tpp:204
Definition: magnetic_equil_files.hpp:16
PsiOption
Definition: equil.hpp:10
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:270
KOKKOS_INLINE_FUNCTION double geometry_r(double r) const
Definition: magnetic_field.tpp:117
Definition: rz_bounds.hpp:4
int ff_order
Order of RK scheme used for field following. Can be 1, 2, or 4.
Definition: magnetic_field.hpp:22
View< double *, HostType > create_range_view(std::string name, double x_min, double x_max, int n)
Definition: range_view.hpp:6
Definition: NamelistReader.hpp:193
Definition: magnetic_field.hpp:12
KOKKOS_INLINE_FUNCTION double I_deriv(double psi_in, int rgn3) const
Definition: magnetic_field.tpp:102
RZBounds bounds
Simulation boundary.
Definition: magnetic_field.hpp:23
MagneticField(PsiOption psi_opt, double safety_factor_coeff=1.0, int eq_mr_in=-1, int eq_mz_in=-1, int eq_mpsi_in=-1)
Definition: magnetic_field.hpp:61
Equilibrium equil
The object containing information about the magnetic equilibrium.
Definition: magnetic_field.hpp:32
KOKKOS_INLINE_FUNCTION void bmag_interpol(const SimdVector &v, Simd< double > &bmag) const
Definition: magnetic_field.tpp:239
Definition: cub_interp.hpp:12
MagneticField()
Definition: magnetic_field.hpp:101
KOKKOS_INLINE_FUNCTION double I_value(double psi_in, int rgn3) const
Definition: magnetic_field.tpp:91
KOKKOS_INLINE_FUNCTION void get_psi(const SimdVector2D &x, Simd< double > &psi_out) const
Definition: magnetic_field.tpp:57
double outpsi
Boundary condition used in a few spots.
Definition: magnetic_field.hpp:26
double max_z
Definition: rz_bounds.hpp:8
double bt_sign
Whether toroidal field is reversed?
Definition: magnetic_field.hpp:19
double min_r
Definition: rz_bounds.hpp:5
RZBounds bounds
Min and max for r and z.
Definition: equil.hpp:78
double bp_sign
Whether poloidal field is reversed?
Definition: magnetic_field.hpp:20
KOKKOS_INLINE_FUNCTION void field(const SimdVector2D &x, SimdVector &bvec, SimdVector(&jacb)[3], Simd< double > &psivec, SimdVector2D &gradpsi, SimdVector &tdb, Simd< bool > &rz_outside) const
Definition: magnetic_field.tpp:131
KOKKOS_INLINE_FUNCTION void get_psi_unit_vec(const SimdVector2D &x, Simd< double > &cosa, Simd< double > &sina) const
Definition: magnetic_field.tpp:76
double min_z
Definition: rz_bounds.hpp:7
Bicub< Device > psi_bicub
The object for interpolating psi (magnetic flux surfaces)
Definition: magnetic_field.hpp:30
int ff_step
Number of steps taken when projecting the particle location onto the midplane.
Definition: magnetic_field.hpp:21
KOKKOS_INLINE_FUNCTION void derivs(const double(&x)[2], double phi, double(&dx)[2]) const
Definition: magnetic_field.tpp:384
MagneticField< Device2 > mirror() const
Definition: magnetic_field.hpp:38
double max_r
Definition: rz_bounds.hpp:6