XGCa
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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"
5 
6 // Options for generating analytic equilibrium for testing
7 enum PsiOption{
8  NoXPoints = 0,
11 };
12 
13 template<class Device>
14 class Equilibrium {
15 
16  public:
17 
18  Equilibrium(double eq_min_r, double eq_max_r, double eq_min_z, double eq_max_z,
19  double eq_x_psi, double epsil_psi_in, double eq_x_r, double eq_x_slope, double eq_x_z,
20  double eq_x2_r, double eq_x2_slope, double eq_x2_z, double eq_x2_psi, double eq_axis_r,
21  double eq_axis_z, int eq_mpsi);
22 
23  // Constructor for tests
25  : min_r(0.5),
26  max_r(2.5),
27  min_z(-1.0),
28  max_z(1.0),
29 
30  // Axis
31  axis_r(1.5),
32  axis_z(0.1),
33 
34  epsil_psi(1.0e-05),
35 
36  // Xpt1
37  // XGC simulates circular case by putting the xpoint outside the model
38  // Place xpoint below min_z if no X-points
39  // Circular case still uses xpt_psi as a reference, but it's far away; so increase it
40  xpt_r(1.6),
41  xpt_z((psi_opt == NoXPoints) ? (min_z - 1.0) : -0.8),
42  xpt_slope(-0.5),
43  xpt_psi((psi_opt == NoXPoints) ? 5.0 : .8),
44 
45  // Xpt2
46  xpt2_r(1.4),
47  xpt2_z(0.7),
48  xpt2_slope(-0.5),
49  xpt2_psi(1.0),
50  set_xpt2(psi_opt == TwoXPoints),
51 
52  // Used by profile testing
53  out_decay_factor(0.25),
54  out_decay_width(2.0),
57  {}
58 
59  // Default constructor
61 
62  KOKKOS_INLINE_FUNCTION bool is_in_region_1_or_2(double r,double z,double psi) const;
63 
64  KOKKOS_INLINE_FUNCTION void check_boundaries(const Simd<double>& r, const Simd<double>& z, Simd<bool>& rz_outside) const;
65 
66  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);
67 
68  // Equil variables
69  double min_r;
70  double max_r;
71  double min_z;
72  double max_z;
73  double xpt_psi;
74  double epsil_psi;
75  double xpt_r;
76  double xpt_slope;
77  double xpt_z;
78  double xpt2_r;
79  double xpt2_slope;
80  double xpt2_z;
81  double xpt2_psi;
82  double axis_r;
83  double axis_z;
84  int mpsi;
85 
86  // Use in eq profile calculations
89  double out_decay_width;
91  bool set_xpt2;
92 };
93 
94 #include "equil.tpp"
95 
96 #endif
KOKKOS_INLINE_FUNCTION void check_boundaries(const Simd< double > &r, const Simd< double > &z, Simd< bool > &rz_outside) const
Definition: equil.tpp:66
Definition: equil.hpp:9
double xpt_psi
Psi coordinate of 1st X-point.
Definition: equil.hpp:73
PsiOption
Definition: equil.hpp:7
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:29
double min_r
Minimum r.
Definition: equil.hpp:69
KOKKOS_INLINE_FUNCTION bool is_in_region_1_or_2(double r, double z, double psi) const
Definition: equil.tpp:43
double min_z
Minimum z.
Definition: equil.hpp:71
double max_r
Maximum r.
Definition: equil.hpp:70
double xpt2_slope
Slope (which slope?) at 2nd X-point.
Definition: equil.hpp:79
double max_z
Maximum z.
Definition: equil.hpp:72
double xpt_slope
Slope (which slope?) at 1st X-point.
Definition: equil.hpp:76
double priv_flux_decay_width
width for exponential decay in private flux region
Definition: equil.hpp:90
int mpsi
Not sure?
Definition: equil.hpp:84
double xpt_r
r coordinate of 1st X-point
Definition: equil.hpp:75
double out_decay_width
width for exponential decay for psi&gt;sml_outpsi
Definition: equil.hpp:89
double epsil_psi
Not sure?
Definition: equil.hpp:74
double xpt2_psi
psi coordinate at 2nd X-point
Definition: equil.hpp:81
double axis_z
z coordinate of axis
Definition: equil.hpp:83
double axis_r
r coordinate of axis
Definition: equil.hpp:82
Equilibrium(PsiOption psi_opt)
Definition: equil.hpp:24
Definition: equil.hpp:10
double out_decay_factor
profiles decay exponentially to f(sml_outpsi)/decay_factor for psi&gt;sml_outpsi
Definition: equil.hpp:87
double xpt_z
z coordinate of 1st X-point
Definition: equil.hpp:77
double priv_flux_decay_factor
profiles decay exponentially to f(sml_outpsi)/decay_factor in priv. flux region
Definition: equil.hpp:88
bool set_xpt2
whether xpt2 is set
Definition: equil.hpp:91
Equilibrium()
Definition: equil.hpp:60
Definition: equil.hpp:8
double xpt2_r
r coordinate of 2nd X-point
Definition: equil.hpp:78
Definition: equil.hpp:14
double xpt2_z
z coordinate at 2nd X-point
Definition: equil.hpp:80