XGCa
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
field_weights.hpp
Go to the documentation of this file.
1 #ifndef FIELD_WEIGHTS_HPP
2 #define FIELD_WEIGHTS_HPP
3 
4 #include "globals.hpp"
5 #include "linear_weights.hpp"
6 #include "grid.hpp"
7 #include "gyro_radius.hpp"
8 
9 
10 // Pack of LinearWeights
11 // Contains the linear weights needed for a particular templated configuration
12 // Constructor populates the weights
13 template<KinType T>
14 struct FieldWeights;
15 
16 #ifdef XGC1
17 // Weights for gyrokinetic species in XGC1
18 # ifdef NEWGYROMATRIX
19 template<>
20 struct FieldWeights<GyroKin>
21 {
22  LinearWeights phi;
23  LinearWeights rho[2];
24 
25  template<class Device>
26  KOKKOS_INLINE_FUNCTION FieldWeights(const Grid<Device>& grid, double phi_in, int i_simd, SimdGyroRadius<GyroKin>& rho_in)
27  {
28  phi.set(phi_in, grid.inv_delta_phi);
29  rho[0].set(rho_in[0][i_simd], grid.nrho/grid.rhomax, grid.nrho);
30  rho[1].set(rho_in[1][i_simd], grid.nrho/grid.rhomax, grid.nrho);
31  }
32 };
33 # else
34 template<>
35 struct FieldWeights<GyroKin>
36 {
37  LinearWeights phi;
38  LinearWeights rho;
39 
40  template<class Device>
41  KOKKOS_INLINE_FUNCTION FieldWeights(const Grid<Device>& grid, double phi_in, int i_simd, SimdGyroRadius<GyroKin>& rho_in)
42  {
43  phi.set(phi_in, grid.inv_delta_phi);
44  rho.set(rho_in[i_simd], grid.nrho/grid.rhomax, grid.nrho);
45  }
46 };
47 # endif
48 
49 // Weights for drift kinetic species in XGC1
50 template<>
51 struct FieldWeights<DriftKin>
52 {
53  LinearWeights phi;
54 
55  template<class Device>
56  KOKKOS_INLINE_FUNCTION FieldWeights(const Grid<Device>& grid, double phi_in, int i_simd, SimdGyroRadius<DriftKin>& rho_in)
57  {
58  phi.set(phi_in, grid.inv_delta_phi);
59  }
60 };
61 #else
62 
63 // Weights for XGCa
64 template<>
66 {
68 
69  template<class Device>
70  KOKKOS_INLINE_FUNCTION FieldWeights(const Grid<Device>& grid, double phi_in, int i_simd, SimdGyroRadius<GyroKin>& rho_in)
71  {
72  rho.set(rho_in[i_simd], grid.nrho/grid.rhomax, grid.nrho);
73  }
74 };
75 
76 template<>
78 {
79  // Empty
80  template<class Device>
81  KOKKOS_INLINE_FUNCTION FieldWeights(const Grid<Device>& grid, double phi_in, int i_simd, SimdGyroRadius<DriftKin>& rho_in) {}
82 };
83 #endif
84 
85 
86 #endif
double inv_delta_phi
1/delta_phi
Definition: grid.hpp:86
Definition: linear_weights.hpp:7
Definition: field_weights.hpp:14
Definition: globals.hpp:14
Definition: grid.hpp:10
int nrho
Definition: grid.hpp:127
KOKKOS_INLINE_FUNCTION FieldWeights(const Grid< Device > &grid, double phi_in, int i_simd, SimdGyroRadius< GyroKin > &rho_in)
Definition: field_weights.hpp:70
LinearWeights rho
Definition: field_weights.hpp:67
KOKKOS_INLINE_FUNCTION FieldWeights(const Grid< Device > &grid, double phi_in, int i_simd, SimdGyroRadius< DriftKin > &rho_in)
Definition: field_weights.hpp:81
Definition: globals.hpp:15
double rhomax
Definition: grid.hpp:128
Definition: gyro_radius.hpp:95
Definition: gyro_radius.hpp:73