XGC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends 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 #include "NamelistReader.hpp"
6 #include "rz_bounds.hpp"
7 #include "grid_structs.hpp"
9 
10 // Options for generating analytic equilibrium for testing
11 enum PsiOption{
12  NoXPoints = 0,
15 };
16 
17 namespace Equil{
18 class XPoint{
19  public:
20 
21  double r;
22  double z;
23  double psi;
24  double slope;
25 };
26 }
27 
28 
29 class Equilibrium {
30 
31  public:
32 
33  inline Equilibrium(NLReader::NamelistReader& nlr, const MagneticEquilFiles& equil_files, const View<Equil::XPoint*, HostType>& xpts);
34 
35  // Constructor for tests
37  : bounds(0.5, 2.5, -1.0, 1.0),
38 
39  // Axis
40  axis{1.5, 0.1},
41 
42  epsil_psi(1.0e-05),
43 
44  // Xpt1
45  // XGC simulates circular case by putting the xpoint outside the model
46  // Place xpoint below min_z if no X-points
47  // Circular case still uses xpt_psi as a reference, but it's far away; so increase it
48  xpt{1.6, (psi_opt == NoXPoints) ? (bounds.min_z - 1.0) : -0.8},
49  xpt_slope(-0.5),
50  xpt_psi((psi_opt == NoXPoints) ? 5.0 : .8),
51 
52  // Xpt2
53  xpt2{1.4, 0.7},
54  xpt2_slope(-0.5),
55  xpt2_psi(1.0),
56  set_xpt2(psi_opt == TwoXPoints),
57 
58  // Used by profile testing
59  out_decay_factor(0.25),
60  out_decay_width(2.0),
63  {}
64 
65  // Default constructor
67 
68  KOKKOS_INLINE_FUNCTION bool is_in_region_1_or_2(double r,double z,double psi) const;
69  KOKKOS_INLINE_FUNCTION bool is_in_region_1(double r,double z,double psi) const;
70  KOKKOS_INLINE_FUNCTION bool is_in_region_3b(double r, double z, double psi) const;
71  KOKKOS_INLINE_FUNCTION void check_boundaries(const SimdVector2D& x, Simd<bool>& rz_outside) const;
72  KOKKOS_INLINE_FUNCTION void get_theta(const SimdVector2D& x, Simd<double>& theta) const;
73 
74  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);
75 
76  // Equil variables
78  double xpt_psi;
79  double epsil_psi = 1.0e-05;
81  double xpt_slope;
82  bool set_xpt2;
84  double xpt2_slope;
85  double xpt2_psi;
86  RZPair axis; // coordinates of axis
87 
88  // Use in eq profile calculations
91  double out_decay_width;
93 };
94 
95 #include "equil.tpp"
96 
97 #endif
Definition: equil.hpp:13
Definition: magnetic_equil_files.hpp:16
PsiOption
Definition: equil.hpp:11
KOKKOS_INLINE_FUNCTION bool is_in_region_1(double r, double z, double psi) const
Definition: equil.tpp:105
Definition: equil.hpp:18
KOKKOS_INLINE_FUNCTION bool is_in_region_3b(double r, double z, double psi) const
Definition: equil.tpp:121
Equilibrium()
Definition: equil.hpp:66
Definition: rz_bounds.hpp:4
RZPair xpt2
coordinates of 2nd X-point
Definition: equil.hpp:83
Definition: NamelistReader.hpp:193
double z
Definition: equil.hpp:22
double out_decay_width
width for exponential decay for psi&gt;sml_outpsi
Definition: equil.hpp:91
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:69
Definition: grid_structs.hpp:28
bool set_xpt2
Whether to use a 2nd X-point.
Definition: equil.hpp:82
double out_decay_factor
profiles decay exponentially to f(sml_outpsi)/decay_factor for psi&gt;sml_outpsi
Definition: equil.hpp:89
double priv_flux_decay_factor
profiles decay exponentially to f(sml_outpsi)/decay_factor in priv. flux region
Definition: equil.hpp:90
RZBounds bounds
Min and max for r and z.
Definition: equil.hpp:77
double xpt2_psi
psi coordinate at 2nd X-point
Definition: equil.hpp:85
double xpt_slope
Slope (which slope?) at 1st X-point.
Definition: equil.hpp:81
double xpt2_slope
Slope (which slope?) at 2nd X-point.
Definition: equil.hpp:84
KOKKOS_INLINE_FUNCTION void check_boundaries(const SimdVector2D &x, Simd< bool > &rz_outside) const
Definition: equil.tpp:132
double psi
Definition: equil.hpp:23
RZPair xpt
coordinates of 1st X-point
Definition: equil.hpp:80
KOKKOS_INLINE_FUNCTION void get_theta(const SimdVector2D &x, Simd< double > &theta) const
Definition: equil.tpp:142
Definition: simd.hpp:18
Definition: equil.hpp:14
Definition: simd.hpp:139
Equilibrium(PsiOption psi_opt)
Definition: equil.hpp:36
double min_z
Definition: rz_bounds.hpp:7
double epsil_psi
Not sure?
Definition: equil.hpp:79
RZPair axis
Definition: equil.hpp:86
double r
Definition: equil.hpp:21
Definition: equil.hpp:12
double slope
Definition: equil.hpp:24
Definition: equil.hpp:29
KOKKOS_INLINE_FUNCTION bool is_in_region_1_or_2(double r, double z, double psi) const
Definition: equil.tpp:82
double priv_flux_decay_width
width for exponential decay in private flux region
Definition: equil.hpp:92
double xpt_psi
Psi coordinate of 1st X-point.
Definition: equil.hpp:78