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