XGC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends 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 // Pack of LinearWeights
10 // Contains the linear weights needed for a particular templated configuration
11 // Constructor populates the weights
12 template<KinType T, PhiInterpType PIT>
13 struct FieldWeights;
14 
15 // Weights for gyrokinetic species in XGC1
16 # ifdef NEWGYROMATRIX
17 template<>
19 {
20  LinearWeights phi;
21  LinearWeights rho[2];
22 
23  template<class Device>
24  KOKKOS_INLINE_FUNCTION FieldWeights(const Grid<Device>& grid, double phi_in, int i_simd, SimdGyroRadius<GyroKin>& rho_in, double inv_drho, int nrho)
25  {
26  phi.set(phi_in, grid.inv_delta_phi, grid.nplanes);
27  rho[0].set(rho_in[0][i_simd], inv_drho, nrho);
28  rho[1].set(rho_in[1][i_simd], inv_drho, nrho);
29  }
30 };
31 # else
32 template<>
34 {
37 
38  template<class Device>
39  KOKKOS_INLINE_FUNCTION FieldWeights(const Grid<Device>& grid, double phi_in, int i_simd, SimdGyroRadius<GyroKin>& rho_in, double inv_drho, int nrho)
40  {
41  phi.set(phi_in, grid.inv_delta_phi, grid.nplanes);
42  rho.set(rho_in[i_simd], inv_drho, nrho);
43  }
44 };
45 # endif
46 
47 // Weights for drift kinetic species in XGC1
48 template<>
50 {
52 
53  template<class Device>
54  KOKKOS_INLINE_FUNCTION FieldWeights(const Grid<Device>& grid, double phi_in, int i_simd, SimdGyroRadius<DriftKin>& rho_in, double inv_drho, int nrho)
55  {
56  phi.set(phi_in, grid.inv_delta_phi, grid.nplanes);
57  }
58 };
59 
60 // Weights for XGCa
61 template<>
63 {
65 
66  template<class Device>
67  KOKKOS_INLINE_FUNCTION FieldWeights(const Grid<Device>& grid, double phi_in, int i_simd, SimdGyroRadius<GyroKin>& rho_in, double inv_drho, int nrho)
68  {
69  rho.set(rho_in[i_simd], inv_drho, nrho);
70  }
71 };
72 
73 template<>
75 {
76  // Empty
77  template<class Device>
78  KOKKOS_INLINE_FUNCTION FieldWeights(const Grid<Device>& grid, double phi_in, int i_simd, SimdGyroRadius<DriftKin>& rho_in, double inv_drho, int nrho) {}
79 };
80 
81 
82 #endif
KOKKOS_INLINE_FUNCTION FieldWeights(const Grid< Device > &grid, double phi_in, int i_simd, SimdGyroRadius< DriftKin > &rho_in, double inv_drho, int nrho)
Definition: field_weights.hpp:78
double inv_delta_phi
1/delta_phi
Definition: grid.hpp:275
Definition: linear_weights.hpp:7
Definition: field_weights.hpp:13
Definition: globals.hpp:89
LinearWeights phi
Definition: field_weights.hpp:35
Definition: grid.hpp:67
int nplanes
Number of planes.
Definition: grid.hpp:272
KOKKOS_INLINE_FUNCTION FieldWeights(const Grid< Device > &grid, double phi_in, int i_simd, SimdGyroRadius< GyroKin > &rho_in, double inv_drho, int nrho)
Definition: field_weights.hpp:67
PhiInterpType
Definition: globals.hpp:95
LinearWeights rho
Definition: field_weights.hpp:36
Definition: globals.hpp:90
KOKKOS_INLINE_FUNCTION FieldWeights(const Grid< Device > &grid, double phi_in, int i_simd, SimdGyroRadius< DriftKin > &rho_in, double inv_drho, int nrho)
Definition: field_weights.hpp:54
LinearWeights phi
Definition: field_weights.hpp:51
Definition: gyro_radius.hpp:96
LinearWeights rho
Definition: field_weights.hpp:64
Definition: gyro_radius.hpp:74
KOKKOS_INLINE_FUNCTION FieldWeights(const Grid< Device > &grid, double phi_in, int i_simd, SimdGyroRadius< GyroKin > &rho_in, double inv_drho, int nrho)
Definition: field_weights.hpp:39