XGC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sml.hpp
Go to the documentation of this file.
1 #ifndef SML_HPP
2 #define SML_HPP
3 #include "space_settings.hpp"
4 #include "NamelistReader.hpp"
5 
6 // Simulation class
7 template<class Device>
8 class Simulation {
9  public:
10 
11  // Constructor
12  // transit_time_in and psi_norm are 1.0 so that the regression tests pass. Update the
13  // reference data and remove these default values when possible. Or better, address the related TODO in xgc.cpp
14  Simulation(NLReader::NamelistReader& nlr, double transit_time_in=1.0, double psi_norm=1.0);
15 
16 #ifdef XGCA
17  static constexpr bool is_XGCa = true;
18 #else
19  static constexpr bool is_XGCa = false;
20 #endif
21 
22 #ifdef DELTAF_CONV
23  static constexpr bool reduced_deltaf = true;
24 #else
25  static constexpr bool reduced_deltaf = false;
26 #endif
27 
28 #if defined(DELTAF_CONV_SEPARATE_N0) || !defined(DELTAF_CONV)
29  static constexpr bool separate_n0 = true;
30 #else
31  static constexpr bool separate_n0 = false;
32 #endif
33 
34 #ifdef EXPLICIT_EM
35  static constexpr bool explicit_electromagnetic = true;
36 #else
37  static constexpr bool explicit_electromagnetic = false;
38 #endif
39 
40 #ifdef F0_UPDATE_ANALYTIC_OLD
41  static constexpr bool old_f0_update_analytic = true;
42 #else
43  static constexpr bool old_f0_update_analytic = false;
44 #endif
45 
46  static constexpr int nhybrid = 2;
47 
48  // Input parameters
49  int bounce;
51  double bounce_buffer;
52  double dt;
53  double transit_time;
56  bool ptb_3db_on;
57  bool drift_on;
58  bool neutrals;
59  bool diag_heat_on;
60  bool deltaf;
61  bool xz_00_up;
62  int mstep;
63  int nrk;
64  bool electron_on;
65  bool f0_grid;
67  int special;
68  int nthreads;
69 
70  bool field_solver_on=true;
71 
73  bool dwdt_fix_bg; // 1-w factor in dwdt
74  bool dwdt_exb_only; // excluding grad-b drift in dwdt
75 
84  bool em_control_variate_final_cv; // Should be local variable/argument
85  bool em_control_variate_flag; // Should be local variable/argument
88  bool em_es_step;
92  bool no_turb;
94 
96 
102  // Used in getf0
104  double dpot_te_limit;
105 
106  // Used in update_f0
107  bool no_fp_in_f;
109  double f0_grid_alpha;
122  bool ignore_f0g;
126  bool symmetric_f;
127 
128  // Diffusion
129  bool diff_on;
130 
131  // Resampling
132  bool resamp_on;
135 
136  // marker setup
151 
152  // Simulation variables
153  double time;
154  int gstep;
155 
157  int mr_factor;
159  double mr_psi_max;
160 
161  // RMP penetration calculation
167 
168  // Core-edge coupling
170 
171  // Push performance - could be elsewhere
173 
174  // Loop-voltage (for driving the equilibrium current)
176  double loop_voltage;
177  double loop_voltage_psimax;
180  //double current_drive_gamma; //!< Damping factor for heuristic current drive, 1.0 means plasma current is restored exactly each time step
182  double current_drive_p;
189 };
190 
191 #include "sml.tpp"
192 #endif
bool multirate_timestepping
Use multirate timestepping.
Definition: sml.hpp:156
double f0_update_analytic_damp_width
Definition: sml.hpp:117
bool em_dAsdt_filter_on
Switch for applying Fourier filters on RHS of dAs/dt equation (pullback mode 4)
Definition: sml.hpp:91
bool resamp_for_final_restart_write
Perform resampling before dumping the final restart file.
Definition: sml.hpp:133
double f0_grid_alpha
Definition: sml.hpp:109
double flat_marker_width2
Definition: sml.hpp:147
bool em_control_variate_flag
Definition: sml.hpp:85
double current_drive_p
Current drive PID controller: factor for proportional controller ( )
Definition: sml.hpp:186
double flat_marker_decay_start1
Definition: sml.hpp:142
static constexpr bool separate_n0
Equivalent to the preprocessor flag for now.
Definition: sml.hpp:29
bool em_mixed_variable
Switch for use of mixed-variable formulation.
Definition: sml.hpp:76
double current_drive_i
Current drive PID controller: factor for integral controller ( )
Definition: sml.hpp:187
double initial_deltaf_noise
Definition: sml.hpp:148
bool drift_on
Toggle for using drift.
Definition: sml.hpp:57
double current_drive_d
Current drive PID controller: factor for derivative controller ( )
Definition: sml.hpp:188
int nrk
Order of Runge-Kutta time integration of particles + fields.
Definition: sml.hpp:63
Definition: sml.hpp:8
static constexpr bool is_XGCa
Equivalent to the preprocessor flag for now.
Definition: sml.hpp:19
static constexpr bool explicit_electromagnetic
Equivalent to the preprocessor flag for now.
Definition: sml.hpp:37
static constexpr int nhybrid
Number of iterations in electrostatic electron weight evolution scheme.
Definition: sml.hpp:46
double low_mu_fill_population
Definition: sml.hpp:150
Definition: NamelistReader.hpp:193
int mstep_rmp_es
Definition: sml.hpp:162
bool exclude_private
Whether to exclude private region in ion charge deposition.
Definition: sml.hpp:95
int bounce_zero_weight
If ==1 and bounce&gt;0, set particle weights to zero after bouncing from the outer boundary.
Definition: sml.hpp:50
int mr_factor
Definition: sml.hpp:157
double flat_marker_decay_start2
Definition: sml.hpp:143
int gstep
Current time step.
Definition: sml.hpp:154
bool em_es_step
Definition: sml.hpp:88
bool split_weight_scheme
Whether to use the split-weight scheme.
Definition: sml.hpp:72
bool diag_heat_on
Use heat diagnostics in sheath.
Definition: sml.hpp:59
bool xz_00_up
Use upper region of xz when obtaining 00 mode.
Definition: sml.hpp:61
bool update_poisson_solver
Whether poisson solver is updated.
Definition: sml.hpp:103
static constexpr bool reduced_deltaf
Equivalent to the preprocessor flag for now.
Definition: sml.hpp:25
double loop_voltage_psimax
Inductive current drive: outer boundary (in pol. flux) of the loop voltage.
Definition: sml.hpp:179
double flat_marker_cutoff1
Definition: sml.hpp:144
bool field_solver_on
If false, charge deposition and field solve is skipped.
Definition: sml.hpp:70
int f0_grid_alpha_start
Definition: sml.hpp:119
double loop_voltage
Definition: sml.hpp:176
bool symmetric_f
Enforce axisymmetry of the total distribution function on the grid.
Definition: sml.hpp:126
double marker_temp_factor3
Definition: sml.hpp:141
bool cce_coupling_on
Core-edge coupling flag.
Definition: sml.hpp:169
int nthreads
Number of OMP threads on the host.
Definition: sml.hpp:68
double marker_temp_factor
Definition: sml.hpp:139
int em_pullback_mode
Definition: sml.hpp:78
bool grad_psitheta
Definition: sml.hpp:97
bool ignore_f0g
Definition: sml.hpp:122
double transit_time
Torodial transit time of an ion with the characteristic energy.
Definition: sml.hpp:53
bool deltaf
Whether some species is deltaf.
Definition: sml.hpp:60
bool use_unfused_electron_push_kernel
Definition: sml.hpp:172
bool flat_marker
Definition: sml.hpp:138
bool sheath_adjust
Whether to adjust the sheath.
Definition: sml.hpp:55
bool resamp_on
Do resampling.
Definition: sml.hpp:132
double marker_min_temp
Definition: sml.hpp:149
double flat_marker_width1
Definition: sml.hpp:146
bool dwdt_exb_only
Definition: sml.hpp:74
int special
Special run (eg single particle, poincare)
Definition: sml.hpp:67
bool em_dAsdt_hypvis
Use radial hyperviscosity in dA_s/dt (push_As)
Definition: sml.hpp:93
double time
Current simulation time.
Definition: sml.hpp:153
bool no_fp_in_f
Definition: sml.hpp:107
bool em_control_variate_final_cv
Definition: sml.hpp:84
bool no_turb
Set all non-axisymmetric field perturbations to zero (electromagnetic version only) ...
Definition: sml.hpp:92
int mstep_rmp_em
Definition: sml.hpp:164
bool f0_grid
Whether to use f0 grid.
Definition: sml.hpp:65
double flat_marker_cutoff2
Definition: sml.hpp:145
int sheath_mode
Type of sheath (0 is none)
Definition: sml.hpp:54
double dpot_te_limit
Max absolute value of dpot/temp in getf0.
Definition: sml.hpp:104
bool electron_on
Use kinetic electrons.
Definition: sml.hpp:64
double f0_update_analytic_alpha
Separate alpha from sml_f0_grid_alpha for Maxwellian contribution.
Definition: sml.hpp:116
int rmp_es_to_em_dt_ratio
Ratio of EM to ES time step size in RMP penetration calculation.
Definition: sml.hpp:166
double mr_psi_max
maximum normalized psi value of each multirate region
Definition: sml.hpp:159
bool em_b_para_eff
Effective dB_|| via a modified grad-B drift (Joiner et al., PoP, 2010)
Definition: sml.hpp:87
bool dwdt_fix_bg
Definition: sml.hpp:73
int mstep
Max number of time steps.
Definition: sml.hpp:62
bool field_aligned_initial
Definition: sml.hpp:137
bool limit_marker_den
Whether to limit marker density.
Definition: sml.hpp:66
bool f0_update_analytic
Definition: sml.hpp:113
bool current_drive_on
Definition: sml.hpp:181
double dt
Time step (s)
Definition: sml.hpp:52
int bounce
Bounce routine switch 0 for off, 1 for inner boundary, 2 for both boundaries.
Definition: sml.hpp:49
bool f0_update_analytic_local
If .false. –&gt; flux-surface average update, .true. –&gt; local.
Definition: sml.hpp:115
bool loop_voltage_on
Inductive current drive: loop voltage (from Faraday&#39;s law curl(E)=-dB/dt)
Definition: sml.hpp:175
bool neutrals
Toggle for using neutrals.
Definition: sml.hpp:58
double marker_temp_factor2
Definition: sml.hpp:140
int em_control_variate_niter
Number of iterations for Ampere solve with control-variate method.
Definition: sml.hpp:86
bool ptb_3db_on
Toggle for ptb_3db.
Definition: sml.hpp:56
double bounce_buffer
Buffer width between sml_outpsi and where the particle actually bounces (must be &gt;=0) ...
Definition: sml.hpp:51
bool em_control_variate
Switch for use of control variate method.
Definition: sml.hpp:77
bool resamp_restart_read
Whether to read a restart file written from a simulation with different grid.
Definition: sml.hpp:134
Simulation(NLReader::NamelistReader &nlr, double transit_time_in=1.0, double psi_norm=1.0)
Definition: sml.tpp:5
bool diff_on
Definition: sml.hpp:129
static constexpr bool old_f0_update_analytic
Equivalent to the preprocessor flag for now.
Definition: sml.hpp:43