XGCa
neutrals.hpp
Go to the documentation of this file.
1 #ifndef NEUTRALS_HPP
2 #define NEUTRALS_HPP
3 
4 #include "view_arithmetic.hpp"
5 #include "xgc_io.hpp"
6 #include "NamelistReader.hpp"
7 #include "grid.hpp"
8 #include "plasma.hpp"
9 #include "vgrid_distribution.hpp"
10 #include "diag_f0_df.hpp"
11 #include "step_trigger.hpp"
12 #include "source.hpp"
13 
14 // Struct to collect particle loss data at wall in push
15 struct WallLoss{
16  View<double**,CLayout,DeviceType> weight_wall_lost;
17 
18  bool ebin_log;
19  double ebin_min;
20  double ebin_delta;
21  View<double***,CLayout,DeviceType> weight_lost_ebin;
22 };
23 
24 
25 // Neutrals class
26 class Neutrals : public Source {
27 public:
28 
30 
31  // Neutrals variables
33 
34  // Step trigger for the neutral background update
36 
37  View<double*,CLayout,HostType> weight_sum_lost_h;
38  View<double*,CLayout,HostType> weight_wall_lost_h;
39  View<double**,CLayout,HostType> weight_lost_ebin_h;
40  View<double*,CLayout,HostType> node_dens_h;
41  View<double*,CLayout,HostType> node_temp_h;
42 
43  StepTrigger trigger_diag; // trigger for diagnostic
44 #ifndef NO_FORTRAN_MODULES
45  std::shared_ptr<XGC_IO_Stream> io_stream;
46 #endif
47 
48  // Constructor
49  Neutrals( int nthreads, int nbins, int nnode, NLReader::NamelistReader& nlr, double sml_dt, double transit_time);
50 
51  // "Null constructor"
53 
54  void diag(const DomainDecomposition<DeviceType>& pol_decomp, int gstep, const View<double*,CLayout,HostType>& n_neut, const View<double*,CLayout,HostType>& T_neut) const;
55 
56  void write_checkpoint_files(const XGC_IO_Stream& stream) const;
57 
58  void read_checkpoint_files(const XGC_IO_Stream& stream) const;
59 
60  void copy_to_host() const;
61 
62  void clear_device_views() const;
63 
64  void clear_host_views() const;
65 
66  void apply(const Grid<DeviceType>& grid, const DomainDecomposition<DeviceType>& pol_decomp, const VelocityGrid& vgrid, Plasma& plasma, const VGridDistribution<DeviceType>& f0_f, const VGridDistribution<HostType>& f0_f_h, VGridDistribution<DeviceType>& f0_df0g_cumul, const int axisym_parallelization_int, int gstep, DiagF0DF& diag_f0_df, double dt) const;
67 };
68 #endif
Definition: diag_f0_df.hpp:9
Definition: NamelistReader.hpp:193
Definition: neutrals.hpp:26
StepTrigger trigger_diag
Definition: neutrals.hpp:43
StepTrigger trigger_neutral_update
Definition: neutrals.hpp:35
View< double *, CLayout, HostType > weight_wall_lost_h
Array to store how much was lost at the sheath, binned by wall index.
Definition: neutrals.hpp:38
View< double *, CLayout, HostType > weight_sum_lost_h
Array to store how much was lost in total at the sheath.
Definition: neutrals.hpp:37
Neutrals()
Definition: neutrals.hpp:52
View< double *, CLayout, HostType > node_temp_h
Definition: neutrals.hpp:41
View< double *, CLayout, HostType > node_dens_h
Definition: neutrals.hpp:40
void clear_device_views() const
Definition: neutrals.cpp:116
void clear_host_views() const
Definition: neutrals.cpp:121
std::shared_ptr< XGC_IO_Stream > io_stream
Definition: neutrals.hpp:45
void write_checkpoint_files(const XGC_IO_Stream &stream) const
Definition: neutrals.cpp:59
void copy_to_host() const
Definition: neutrals.cpp:98
int background_period
Definition: neutrals.hpp:32
View< double **, CLayout, HostType > weight_lost_ebin_h
Array to store how much was lost at the sheath, binned by wall and energy index.
Definition: neutrals.hpp:39
WallLoss wall_loss
Definition: neutrals.hpp:29
void read_checkpoint_files(const XGC_IO_Stream &stream) const
Definition: neutrals.cpp:74
void apply(const Grid< DeviceType > &grid, const DomainDecomposition< DeviceType > &pol_decomp, const VelocityGrid &vgrid, Plasma &plasma, const VGridDistribution< DeviceType > &f0_f, const VGridDistribution< HostType > &f0_f_h, VGridDistribution< DeviceType > &f0_df0g_cumul, const int axisym_parallelization_int, int gstep, DiagF0DF &diag_f0_df, double dt) const
Definition: neutrals.cpp:159
void diag(const DomainDecomposition< DeviceType > &pol_decomp, int gstep, const View< double *, CLayout, HostType > &n_neut, const View< double *, CLayout, HostType > &T_neut) const
Definition: neutrals.cpp:127
Definition: plasma.hpp:13
Definition: step_trigger.hpp:4
Definition: vgrid_distribution.hpp:18
Definition: xgc_io.hpp:24
real(8) sml_dt
Definition: inputs_unused_in_fortran.F90:36
subroutine plasma(grid, itr, p, dene_out, deni_out, Te_out, Ti_out, Vparai_out, ignore_vacuum)
Calculate the plasma density, temperature, and parallel velocity for a point in triangle itr using pl...
Definition: neutral_totalf.F90:1541
Definition: source.hpp:7
Definition: velocity_grid.hpp:8
Definition: neutrals.hpp:15
bool ebin_log
Definition: neutrals.hpp:18
View< double ***, CLayout, DeviceType > weight_lost_ebin
Array to store how much was lost at the sheath, binned by wall index.
Definition: neutrals.hpp:21
double ebin_min
Definition: neutrals.hpp:19
View< double **, CLayout, DeviceType > weight_wall_lost
Array to store how much was lost at the sheath, binned by wall index.
Definition: neutrals.hpp:16
double ebin_delta
Definition: neutrals.hpp:20