XGC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
particle_stream.hpp
Go to the documentation of this file.
1 #ifndef PARTICLE_STREAM_HPP
2 #define PARTICLE_STREAM_HPP
3 #include "magnetic_field.hpp"
4 
5 // ParticleStream class
7  public:
8 
9  // Used in diag_1d_port1 (in pushe)
11  double pin, pout; // psi range of selected particles
12 
13  //constructor
14  //ParticleStream(NLReader::NamelistReader& nlr, const MagneticField<DeviceType>& magnetic_field);
17  {
18  nlr.use_namelist("diag_param");
19  reset_period = nlr.get<int>("diag_ps_reset_period",10);
20  pin = nlr.get<double>("diag_ps_pin", 0.80);
21  pout = nlr.get<double>("diag_ps_pout",0.81);
22 
23  // need to convert SI unit
24  pin*= magnetic_field.psi_norm();
25  pout*= magnetic_field.psi_norm();
26  }
27 
28  // Null constructor
30 };
31 
32 KOKKOS_INLINE_FUNCTION void flag_set(long long int &flags, const bool tf, const long long int flag_loc);
33 KOKKOS_INLINE_FUNCTION bool flag_check(const long long int flags, const long long int flag_loc);
34 
35 // Explicitly set length to 64 bits to keep same length as double
36 constexpr long long int ps_is_to_write{1}; // need to write
37 constexpr long long int ps_is_in_init{2}; // inside of separatrix initially -- Not used here
38 constexpr long long int ps_is_written{4}; // inside of separatrix before push -- Not used here
39 constexpr long long int ps_is_escaped{8}; // True: Particle crossed the separatrix into the SOL during particle push.
40  // False: Particle did not cross separatrix during particle push
41 constexpr long long int ps_is_divertor{16}; // why write - just hit the divertor
42 constexpr long long int ps_is_outboard{32}; // when write - is this outboard?
43 constexpr long long int ps_was_inside{64}; // aux flag to indicate if the particle was inside before push
44 constexpr long long int ps_is_tracked{128}; // True: Particle contributes to diffusion analysis
45 
46 // dw can use 38 bits. dw * 2^nb1 will be saved as integer value.
47 // Let dw be between min_dw and max_dw
48 // This should not exceed 2^(63-nb1-nb2)
49 constexpr int ps_flag_bits = 8;
50 constexpr int ps_step_bits = 17;
52 constexpr int ps_dw_factor_bits = 28; // should not exceed 31. bits to make dw flot to integer
53 
54 constexpr long long int ps_flag_step_mask{(1u<<ps_flag_step_bits)-1}; // 8 bits are used for flag. 17 bits integer is used for esc_step. Above it will be used for dw
55 constexpr long long int ps_flag_mask{(1u<<ps_flag_bits)-1}; // mask for zero out above 8 bits - '<<8' makes 8 zeros and '-1' makes them 8 ones.
56 #include "particle_stream.tpp"
57 
58 #endif
double pout
Definition: particle_stream.hpp:11
constexpr int ps_flag_bits
Definition: particle_stream.hpp:49
double pin
Definition: particle_stream.hpp:11
constexpr long long int ps_is_escaped
Definition: particle_stream.hpp:39
T get(const string &param, const T default_val, int val_ind=0)
Definition: NamelistReader.hpp:373
constexpr int ps_dw_factor_bits
Definition: particle_stream.hpp:52
constexpr int ps_step_bits
Definition: particle_stream.hpp:50
constexpr int ps_flag_step_bits
Definition: particle_stream.hpp:51
KOKKOS_INLINE_FUNCTION void flag_set(long long int &flags, const bool tf, const long long int flag_loc)
Definition: particle_stream.tpp:9
constexpr long long int ps_is_to_write
Definition: particle_stream.hpp:36
Definition: NamelistReader.hpp:193
Definition: magnetic_field.hpp:12
KOKKOS_INLINE_FUNCTION double psi_norm() const
Definition: magnetic_field.tpp:3
constexpr long long int ps_is_in_init
Definition: particle_stream.hpp:37
constexpr long long int ps_flag_mask
Definition: particle_stream.hpp:55
KOKKOS_INLINE_FUNCTION bool flag_check(const long long int flags, const long long int flag_loc)
Definition: particle_stream.tpp:15
int reset_period
steps between diag recording
Definition: particle_stream.hpp:10
constexpr long long int ps_is_outboard
Definition: particle_stream.hpp:42
ParticleStream()
Definition: particle_stream.hpp:29
void use_namelist(const string &namelist)
Definition: NamelistReader.hpp:355
constexpr long long int ps_is_divertor
Definition: particle_stream.hpp:41
constexpr long long int ps_flag_step_mask
Definition: particle_stream.hpp:54
ParticleStream(NLReader::NamelistReader &nlr, const MagneticField< DeviceType > &magnetic_field)
Definition: particle_stream.hpp:16
constexpr long long int ps_was_inside
Definition: particle_stream.hpp:43
Definition: magnetic_field.F90:1
Definition: particle_stream.hpp:6
constexpr long long int ps_is_tracked
Definition: particle_stream.hpp:44
constexpr long long int ps_is_written
Definition: particle_stream.hpp:38