1 #ifndef MAGNETIC_FIELD_HPP
2 #define MAGNETIC_FIELD_HPP
11 template<
class Device>
17 KOKKOS_INLINE_FUNCTION
void derivs(
const double (&x)[2],
double phi,
double (&dx)[2])
const;
20 KOKKOS_INLINE_FUNCTION
double I_value(
double psi_in,
int rgn3)
const;
21 KOKKOS_INLINE_FUNCTION
double I_deriv(
double psi_in,
int rgn3)
const;
48 const RZPair& axis_in,
const RZPair& psi_ref_point,
const View<double*, HostType>& psiN);
53 template<
class Device2>
70 m.psi_tricub = psi_tricub.template mirror<Device2>();
71 m.Br_tricub = Br_tricub.template mirror<Device2>();
72 m.Bz_tricub = Bz_tricub.template mirror<Device2>();
73 m.Bphi_tricub = Bphi_tricub.template mirror<Device2>();
83 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);
89 KOKKOS_INLINE_FUNCTION
double psi_norm()
const;
91 KOKKOS_INLINE_FUNCTION
double xpt_psi()
const;
97 KOKKOS_INLINE_FUNCTION
double get_psi(
double r,
double z,
double phi)
const;
99 KOKKOS_INLINE_FUNCTION
void get_psi_and_derivs(
double r,
double z,
double phi,
double& psi,
double& dpsidr,
double& dpsidz,
double& dpsidphi)
const;
103 KOKKOS_INLINE_FUNCTION
double geometry_r(
double r)
const;
109 KOKKOS_INLINE_FUNCTION
bool is_in_region_1(
double r,
double z,
double psi)
const;
118 KOKKOS_INLINE_FUNCTION
void bvec_interpol(
double r,
double z,
double phi,
double &br,
double &bz,
double &bphi)
const;
Definition: cub_interp.hpp:12
Definition: magnetic_field.hpp:12
KOKKOS_INLINE_FUNCTION RZPair get_xpoint(int ixpt) const
Definition: magnetic_field.tpp:51
RZBounds bounds
Simulation boundary.
Definition: magnetic_field.hpp:41
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)
double inpsi
Boundary condition used in a few spots.
Definition: magnetic_field.hpp:42
MagneticField< Device2 > mirror() const
Definition: magnetic_field.hpp:54
KOKKOS_INLINE_FUNCTION double geometry_r(double r) const
Definition: magnetic_field.tpp:156
int ff_step
Number of steps taken when projecting the particle location onto the midplane.
Definition: magnetic_field.hpp:24
KOKKOS_INLINE_FUNCTION bool is_in_region_1_or_2(double r, double z, double psi) const
Definition: magnetic_field.tpp:29
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:358
KOKKOS_INLINE_FUNCTION void get_psi_and_derivs(double r, double z, double phi, double &psi, double &dpsidr, double &dpsidz, double &dpsidphi) const
Definition: magnetic_field.tpp:94
friend class MagneticField
Definition: magnetic_field.hpp:15
KOKKOS_INLINE_FUNCTION void check_boundaries(const SimdVector2D &x, Simd< bool > &rz_outside) const
Definition: magnetic_field.tpp:39
KOKKOS_INLINE_FUNCTION RZPair get_axis() const
Definition: magnetic_field.tpp:56
KOKKOS_INLINE_FUNCTION void bvec_interpol(double r, double z, double phi, double &br, double &bz, double &bphi) const
Definition: magnetic_field.tpp:284
double bp_sign
Whether poloidal field is reversed?
Definition: magnetic_field.hpp:40
KOKKOS_INLINE_FUNCTION void get_psi(const SimdVector &v, Simd< double > &psi_out) const
Definition: magnetic_field.tpp:78
MagneticField()
Definition: magnetic_field.hpp:87
KOKKOS_INLINE_FUNCTION bool is_in_region_1(double r, double z, double psi) const
Definition: magnetic_field.tpp:34
KOKKOS_INLINE_FUNCTION double xpt_psi() const
Definition: magnetic_field.tpp:8
CubInterp< Device > I_interp
The object for interpolating I (for deriving toroidal magnetic field)
Definition: magnetic_field.hpp:29
KOKKOS_INLINE_FUNCTION double psi_norm() const
Definition: magnetic_field.tpp:3
KOKKOS_INLINE_FUNCTION void field(const SimdVector &v, SimdVector &bvec, SimdVector(&jacb)[3], Simd< double > &psivec, SimdVector2D &gradpsi, Simd< bool > &rz_outside) const
Definition: magnetic_field.tpp:169
KOKKOS_INLINE_FUNCTION bool is_below_xpt_tangent(double r, double z) const
Definition: magnetic_field.tpp:13
int ff_order
Order of RK scheme used for field following. Can be 1, 2, or 4.
Definition: magnetic_field.hpp:25
double bt_sign
Whether toroidal field is reversed?
Definition: magnetic_field.hpp:39
MagneticField(NLReader::NamelistReader &nlr, const DomainDecomposition< DeviceType > &pol_decomp, const MagneticEquilFiles::Ptr &equil_files, const View< Equil::XPoint *, HostType > &xpts, const RZPair &axis_in, const RZPair &psi_ref_point, const View< double *, HostType > &psiN)
double outpsi
Boundary condition used in a few spots.
Definition: magnetic_field.hpp:43
KOKKOS_INLINE_FUNCTION bool is_above_xpt2_tangent(double r, double z) const
Definition: magnetic_field.tpp:18
KOKKOS_INLINE_FUNCTION double I_deriv(double psi_in, int rgn3) const
Definition: magnetic_field.tpp:140
KOKKOS_INLINE_FUNCTION double I_value(double psi_in, int rgn3) const
Definition: magnetic_field.tpp:129
KOKKOS_INLINE_FUNCTION void bmag_interpol(const SimdVector &v, Simd< double > &bmag) const
Definition: magnetic_field.tpp:327
KOKKOS_INLINE_FUNCTION bool is_in_region_3a_or_sep_leg(double r, double z, double psi) const
Definition: magnetic_field.tpp:23
Bicub< Device > psi_bicub
The object for interpolating psi (magnetic flux surfaces)
Definition: magnetic_field.hpp:28
KOKKOS_INLINE_FUNCTION void get_psi_unit_vec(const SimdVector2D &x, double phi, Simd< double > &cosa, Simd< double > &sina) const
Definition: magnetic_field.tpp:113
KOKKOS_INLINE_FUNCTION void get_theta(const SimdVector2D &x, Simd< double > &theta) const
Definition: magnetic_field.tpp:46
Equilibrium equil
The object containing information about the magnetic equilibrium.
Definition: magnetic_field.hpp:44
KOKKOS_INLINE_FUNCTION void derivs(const double(&x)[2], double phi, double(&dx)[2]) const
Definition: magnetic_field.tpp:472
Definition: NamelistReader.hpp:193
Definition: tricub.hpp:13
PsiOption
Definition: equil.hpp:12
real(8), parameter phi
Definition: load_balance_constraint_mod.F90:18
std::shared_ptr< MagneticEquilFiles > Ptr
Definition: magnetic_equil_files.hpp:11
Definition: rz_bounds.hpp:4
Definition: grid_structs.hpp:28