XGCa
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
species.hpp
Go to the documentation of this file.
1 #ifndef SPECIES_HPP
2 #define SPECIES_HPP
3 #include <Cabana_AoSoA.hpp>
4 #include <Cabana_DeepCopy.hpp>
5 #include <Kokkos_Core.hpp>
6 #include "particles.hpp"
7 #include "space_settings.hpp"
8 #include "distribution.hpp"
9 #include "profile.hpp"
10 
11 // Species class
12 template<class Device>
13 class Species{
14  public:
15 
16  int idx;
17  bool is_electron;
18  bool is_adiabatic;
20  double mass;
21  double charge;
22  double charge_eu;
23  double c_m;
24  double c2_2m;
25 
26  bool is_deltaf;
27 
28  int ncycles;
30 
31  Cabana::AoSoA<ParticleDataTypes,HostType,VEC_LEN> backup_particles;
32 
34 
35  Eq::Profile<Device> eq_temp; // Equilibrium temperature
36  Eq::Profile<Device> eq_den; // Equilibrium density
37  Eq::Profile<Device> eq_flow; // Equilibrium flow
38 
39  Species(int idx_in, bool is_electron_in, bool is_adiabatic_in, bool is_gyrokinetic_in, double mass_in, double charge_in, double charge_eu_in, bool is_deltaf_in,
40  int ncycles_in);
41 
42  // Default constructor
43  Species(){}
44 };
45 
46 template<class Device>
47 class TmpSpecies{
48  public:
49 
50  int n_ptl;
51  int n_tmp;
52  double charge; // add charge and mass paramters in case it is required.
53  double mass;
54 
55  TmpSpecies(int n_ptl_in);
57 
58  void resize(int n_ptl_in);
59 
60  Cabana::AoSoA<ParticleDataTypes,Device,VEC_LEN> particles;
61  VecParticles* ptl; // Pointer to the particles
62  Kokkos::View<long long int*,Kokkos::LayoutRight,Device> tmp_gid;
63  Kokkos::View<double**,Kokkos::LayoutRight,Device> tmp_const;
64  Kokkos::View<int*,Kokkos::LayoutRight,Device> iperm;
65  Kokkos::View<int*,Kokkos::LayoutRight,Device> current_tr;
66 #ifdef NEWGYROMATRIX
67  Kokkos::View<double**,Kokkos::LayoutRight,Device> rhon;
68 
69  void copy_rhon_to_fortran(double* rhon_fortran_array) const;
70 #endif
71 
72  // For ions
73  Kokkos::View<double**,Kokkos::LayoutRight,Device> phase0;
74 };
75 
76 #include "species.tpp"
77 #endif
Distribution< Device > f0
Species distribution in velocity space on local mesh nodes.
Definition: species.hpp:33
Cabana::AoSoA< ParticleDataTypes, HostType, VEC_LEN > backup_particles
Copy of particles to be restored for RK2.
Definition: species.hpp:31
bool is_electron
Whether this species is the electrons.
Definition: species.hpp:17
double mass
Definition: species.hpp:53
double c2_2m
c2/2m
Definition: species.hpp:24
Kokkos::View< double **, Kokkos::LayoutRight, Device > tmp_const
Definition: species.hpp:63
double c_m
c/m
Definition: species.hpp:23
Eq::Profile< Device > eq_den
Definition: species.hpp:36
int idx
Index in all_species.
Definition: species.hpp:16
TmpSpecies()
Definition: species.hpp:56
double charge
Definition: species.hpp:52
bool is_gyrokinetic
Whether the species is gyrokinetic or drift kinetic.
Definition: species.hpp:19
Definition: distribution.hpp:20
Definition: particles.hpp:52
int n_ptl
Number of particles.
Definition: species.hpp:50
Kokkos::View< int *, Kokkos::LayoutRight, Device > iperm
Definition: species.hpp:64
double charge_eu
Particle charge in eu.
Definition: species.hpp:22
double mass
Particle mass.
Definition: species.hpp:20
void resize(int n_ptl_in)
Definition: species.tpp:57
Kokkos::View< long long int *, Kokkos::LayoutRight, Device > tmp_gid
Definition: species.hpp:62
double charge
Particle charge.
Definition: species.hpp:21
int ncycles_between_sorts
Number of subcycles between sorts.
Definition: species.hpp:29
bool is_deltaf
Whether this species is deltaf.
Definition: species.hpp:26
Cabana::AoSoA< ParticleDataTypes, Device, VEC_LEN > particles
Definition: species.hpp:60
Kokkos::View< double **, Kokkos::LayoutRight, Device > phase0
Definition: species.hpp:73
bool is_adiabatic
Whether this species is adiabatic.
Definition: species.hpp:18
Eq::Profile< Device > eq_flow
Definition: species.hpp:37
Kokkos::View< int *, Kokkos::LayoutRight, Device > current_tr
Definition: species.hpp:65
Definition: species.hpp:13
Eq::Profile< Device > eq_temp
Definition: species.hpp:35
Definition: species.hpp:47
VecParticles * ptl
Definition: species.hpp:61
Species()
Definition: species.hpp:43
int ncycles
Number of subcycles.
Definition: species.hpp:28
Definition: profile.hpp:65
int n_tmp
Size of the temporary particle arrays (bigger than n_ptl at the moment)
Definition: species.hpp:51