XGC1
equil.hpp
Go to the documentation of this file.
1 #ifndef EQUIL_HPP
2 #define EQUIL_HPP
3 #include "space_settings.hpp"
4 #include "simd.hpp"
6 #include "rz_bounds.hpp"
8
9 // Options for generating analytic equilibrium for testing
10 enum PsiOption{
11  NoXPoints = 0,
14 };
15
16 namespace Equil{
17 class XPoint{
18  public:
19
20  double r;
21  double z;
22  double psi;
23  double slope;
24 };
25 }
26
27
28 class Equilibrium {
29
30  public:
31
33
34  inline Equilibrium(double eq_min_r, double eq_max_r, double eq_min_z, double eq_max_z,
35  double eq_x_psi, double epsil_psi_in, double eq_x_r, double eq_x_slope, double eq_x_z,
36  double eq_x2_r, double eq_x2_slope, double eq_x2_z, double eq_x2_psi, double eq_axis_r,
37  double eq_axis_z, int eq_mpsi);
38
39  // Constructor for tests
41  : bounds(0.5, 2.5, -1.0, 1.0),
42
43  // Axis
44  axis_r(1.5),
45  axis_z(0.1),
46
47  epsil_psi(1.0e-05),
48
49  // Xpt1
50  // XGC simulates circular case by putting the xpoint outside the model
51  // Place xpoint below min_z if no X-points
52  // Circular case still uses xpt_psi as a reference, but it's far away; so increase it
53  xpt_r(1.6),
54  xpt_z((psi_opt == NoXPoints) ? (bounds.min_z - 1.0) : -0.8),
55  xpt_slope(-0.5),
56  xpt_psi((psi_opt == NoXPoints) ? 5.0 : .8),
57
58  // Xpt2
59  xpt2_r(1.4),
60  xpt2_z(0.7),
61  xpt2_slope(-0.5),
62  xpt2_psi(1.0),
63  set_xpt2(psi_opt == TwoXPoints),
64
65  // Used by profile testing
66  out_decay_factor(0.25),
67  out_decay_width(2.0),
70  {}
71
72  // Default constructor
74
75  KOKKOS_INLINE_FUNCTION bool is_in_region_1_or_2(double r,double z,double psi) const;
76  KOKKOS_INLINE_FUNCTION bool is_in_region_1(double r,double z,double psi) const;
77  KOKKOS_INLINE_FUNCTION void check_boundaries(const SimdVector2D& x, Simd<bool>& rz_outside) const;
78  KOKKOS_INLINE_FUNCTION void get_theta(const SimdVector2D& x, Simd<double>& theta) const;
79
80  inline void set_decay_factors(double out_decay_factor_in, double priv_flux_decay_factor_in, double out_decay_width_in, double priv_flux_decay_width_in, bool set_xpt2_in);
81
82  // Equil variables
84  double xpt_psi;
85  double epsil_psi = 1.0e-05;
86  double xpt_r;
87  double xpt_slope;
88  double xpt_z;
89  bool set_xpt2;
90  double xpt2_r;
91  double xpt2_slope;
92  double xpt2_z;
93  double xpt2_psi;
94  double axis_r;
95  double axis_z;
96
97  // Use in eq profile calculations
102 };
103
104 #include "equil.tpp"
105
106 #endif
Definition: equil.hpp:12
double xpt2_z
z coordinate at 2nd X-point
Definition: equil.hpp:92
Definition: magnetic_equil_files.hpp:16
PsiOption
Definition: equil.hpp:10
KOKKOS_INLINE_FUNCTION bool is_in_region_1(double r, double z, double psi) const
Definition: equil.tpp:125
Definition: equil.hpp:17
Equilibrium()
Definition: equil.hpp:73
Definition: rz_bounds.hpp:4
double z
Definition: equil.hpp:21
double out_decay_width
width for exponential decay for psi&gt;sml_outpsi
Definition: equil.hpp:100
void set_decay_factors(double out_decay_factor_in, double priv_flux_decay_factor_in, double out_decay_width_in, double priv_flux_decay_width_in, bool set_xpt2_in)
Definition: equil.tpp:89
double axis_z
z coordinate of axis
Definition: equil.hpp:95
bool set_xpt2
Whether to use a 2nd X-point.
Definition: equil.hpp:89
double xpt2_r
r coordinate of 2nd X-point
Definition: equil.hpp:90
double out_decay_factor
profiles decay exponentially to f(sml_outpsi)/decay_factor for psi&gt;sml_outpsi
Definition: equil.hpp:98
double axis_r
r coordinate of axis
Definition: equil.hpp:94
double priv_flux_decay_factor
profiles decay exponentially to f(sml_outpsi)/decay_factor in priv. flux region
Definition: equil.hpp:99
RZBounds bounds
Min and max for r and z.
Definition: equil.hpp:83
double xpt2_psi
psi coordinate at 2nd X-point
Definition: equil.hpp:93
double xpt_slope
Slope (which slope?) at 1st X-point.
Definition: equil.hpp:87
double xpt2_slope
Slope (which slope?) at 2nd X-point.
Definition: equil.hpp:91
KOKKOS_INLINE_FUNCTION void check_boundaries(const SimdVector2D &x, Simd< bool > &rz_outside) const
Definition: equil.tpp:139
double xpt_r
r coordinate of 1st X-point
Definition: equil.hpp:86
double psi
Definition: equil.hpp:22
KOKKOS_INLINE_FUNCTION void get_theta(const SimdVector2D &x, Simd< double > &theta) const
Definition: equil.tpp:149
Definition: simd.hpp:18
Definition: equil.hpp:13
Definition: simd.hpp:139
double xpt_z
z coordinate of 1st X-point
Definition: equil.hpp:88
Equilibrium(PsiOption psi_opt)
Definition: equil.hpp:40
double epsil_psi
Not sure?
Definition: equil.hpp:85
double r
Definition: equil.hpp:20
Definition: equil.hpp:11
double slope
Definition: equil.hpp:23
Definition: equil.hpp:28
KOKKOS_INLINE_FUNCTION bool is_in_region_1_or_2(double r, double z, double psi) const
Definition: equil.tpp:102
double priv_flux_decay_width
width for exponential decay in private flux region
Definition: equil.hpp:101
double xpt_psi
Psi coordinate of 1st X-point.
Definition: equil.hpp:84