XGC1
plane.hpp
Go to the documentation of this file.
1 #ifndef PLANE_HPP
2 #define PLANE_HPP
3 
4 #include "xgc_io.hpp"
5 #include "magnetic_field.hpp"
6 #include "grid_structs.hpp"
7 #include "grid_weights.hpp"
8 #include "grid_files.hpp"
9 #include "guess_table.hpp"
10 #include "uniform_range.hpp"
11 #include "guess_list_1d.hpp"
12 #include "gradient_matrices.hpp"
13 
14 
15 // Plane class
16 template<class Device>
17 class Plane {
18  // This line enables private access between the host and device implementations of this class
19  // i.e. Makes the copy from host to device more straightforward
20  template<class Device2> friend class Plane;
21 
22  public:
23 
24  // Constructor from namelist
25  Plane(NLReader::NamelistReader& nlr, const PlaneFilesInterface& plane_files, const MagneticField<DeviceType>& magnetic_field, double plane_index_dbl, bool use_as_fortran_grid=false);
26 
27  // Default constructor
28  Plane(){}
29 
30  // Create a mirror with a different device type
31  template<class Device2>
32  inline Plane<Device2> mirror() const{
34 
35  m.ntriangle = ntriangle;
36  m.nnode = nnode;
37  m.nplanes = nplanes;
38  m.plane_phi = plane_phi;
40  m.delta_phi = delta_phi;
42 
43  m.psi = my_mirror_view(psi, Device2());
44  mirror_copy(m.psi, psi);
45  m.bfield = my_mirror_view(bfield, Device2());
47  m.basis = my_mirror_view(basis, Device2());
49  m.nodes = my_mirror_view(nodes, Device2());
51  m.mapping = my_mirror_view(mapping, Device2());
53 
54  m.guess = guess.template mirror<Device2>();
55 
56  m.psi_surf = my_mirror_view(psi_surf, Device2());
58  m.psi_surf_h = psi_surf_h; // Shallow copy since this stays on host
62  m.psi_surf2 = my_mirror_view(psi_surf2, Device2());
68 
69  m.psi00 = psi00;
70  m.psi_guess = psi_guess.template mirror<Device2>();
71 
72  m.rgn = my_mirror_view(rgn, Device2());
73  mirror_copy(m.rgn, rgn);
74  m.gx = my_mirror_view(gx, Device2());
75  mirror_copy(m.gx, gx);
76  // This isn't used on GPU right now
77  //m.adj = my_mirror_view(adj, Device2());
78  //mirror_copy(m.adj, adj);
79 
80  m.nwall = nwall;
81  m.wall_nodes = my_mirror_view(wall_nodes, Device2());
85 
87 
88 #ifdef NO_FORTRAN_MODULES
89  m.gradient_matrices_h = gradient_matrices_h;
90 #endif
91 
92  return m;
93  }
94 
96 
97  KOKKOS_INLINE_FUNCTION void t_coeff(const SimdVector2D &x, const Simd<int>& itr, SimdGridVec &p) const;
98 
99  KOKKOS_INLINE_FUNCTION void t_coeff_mod(const MagneticField<Device> &magnetic_field, const double r, const double z, const double psiin, const int itr, double (&p)[3] ) const;
100 
101  KOKKOS_INLINE_FUNCTION void t_coeff_mod(const MagneticField<Device> &magnetic_field, const SimdVector2D &xy, const Simd<double>& psiin, const Simd<int>& itr, SimdGridVec &p ) const;
102 
103  KOKKOS_INLINE_FUNCTION void search_tr2_no_precheck(const double r, const double z, int& itr, double (&p)[3]) const;
104 
105  KOKKOS_INLINE_FUNCTION void search_tr2( const SimdVector2D &xy, Simd<int>& itr, SimdGridVec &pout ) const;
106 
107  KOKKOS_INLINE_FUNCTION void search_tr_check_guess(const SimdVector2D &x, const Simd<int>& old_itr,Simd<int>& itr,SimdGridVec &p ) const;
108 
109  KOKKOS_INLINE_FUNCTION void psi_search(double psi,double &wp,int &ip) const;
110 
111  KOKKOS_INLINE_FUNCTION void follow_field_to_nearest_midplane(const MagneticField<Device> &magnetic_field, const SimdVector2D &x, const Simd<double>& phi, SimdVector2D &xff) const;
112 
113  KOKKOS_INLINE_FUNCTION void follow_field_to_plane(const MagneticField<Device> &magnetic_field, const SimdVector2D &x, const Simd<double>& phi, SimdVector2D &xff) const;
114 
115  KOKKOS_INLINE_FUNCTION void get_grid_weights_ff(const MagneticField<Device> &magnetic_field, const SimdVector &v, const Simd<double>& psi_in,SimdVector2D &xff,SimdGridWeights<Order::One, PhiInterpType::Planes>& grid_wts) const;
116 
117  KOKKOS_INLINE_FUNCTION void get_grid_weights_plane_ff(const MagneticField<Device> &magnetic_field, const SimdVector &v, double phi_plane, SimdGridWeights<Order::One, PhiInterpType::Planes>& grid_wts) const;
118 
119  KOKKOS_INLINE_FUNCTION void get_grid_weights_no_ff(const MagneticField<Device> &magnetic_field, const SimdVector2D &x, const Simd<double>& psi_in,SimdGridWeights<Order::One, PhiInterpType::None>& grid_wts) const;
120 
121  template<PhiInterpType PIT>
122  KOKKOS_INLINE_FUNCTION void nearest_node(const SimdGridWeights<Order::One, PIT>& grid_wts, SimdGridWeights<Order::Zero, PIT>& grid_wts0) const;
123 
124  template<PhiInterpType PIT>
125  KOKKOS_INLINE_FUNCTION void get_grid_weights(const MagneticField<Device> &magnetic_field, const SimdVector &v, const Simd<double>& psi, SimdVector2D &xff,SimdGridWeights<Order::One, PIT>& grid_wts) const;
126 
127  template<PhiInterpType PIT>
128  KOKKOS_INLINE_FUNCTION void get_grid_weights(const MagneticField<Device> &magnetic_field, const SimdVector &v, SimdVector2D &xff, SimdGridWeights<Order::One, PIT>& grid_wts) const;
129 
130  template<PhiInterpType PIT>
131  KOKKOS_INLINE_FUNCTION void get_grid_weights(const MagneticField<Device> &magnetic_field, const SimdVector &v, const Simd<double>& psi_in, SimdGridWeights<Order::Zero, PIT>& grid_wts) const;
132 
133  template<PhiInterpType PIT>
134  KOKKOS_INLINE_FUNCTION void get_grid_weights(const MagneticField<Device> &magnetic_field, const SimdVector &v, const Simd<double>& psi_in, SimdGridWeights<Order::Zero, PIT>& grid_wts, const Simd<int>& itr_hint) const;
135 
136  template<PhiInterpType PIT>
137  KOKKOS_INLINE_FUNCTION void get_grid_weights(const MagneticField<Device> &magnetic_field, const SimdVector &v, const Simd<double>& psi_in, SimdGridWeights<Order::One, PIT>& grid_wts) const;
138 
139  template<PhiInterpType PIT>
140  KOKKOS_INLINE_FUNCTION void get_grid_weights(const MagneticField<Device> &magnetic_field, const SimdVector &v, SimdGridWeights<Order::Zero, PIT>& grid_wts) const;
141 
142  template<PhiInterpType PIT>
143  KOKKOS_INLINE_FUNCTION void get_grid_weights(const MagneticField<Device> &magnetic_field, const SimdVector &v, SimdGridWeights<Order::Zero, PIT>& grid_wts, const Simd<int>& itr_hint) const;
144 
145  template<PhiInterpType PIT>
146  KOKKOS_INLINE_FUNCTION void get_grid_weights(const MagneticField<Device> &magnetic_field, const SimdVector &v, SimdGridWeights<Order::One, PIT>& grid_wts) const;
147 
148  KOKKOS_INLINE_FUNCTION void get_wall_index(const Simd<bool>& just_left_the_grid,const SimdVector2D &x, const SimdGridWeights<Order::One, PIT_GLOBAL>& grid_wts, Simd<int>& widx) const;
149 
150  KOKKOS_INLINE_FUNCTION void wedge_modulo_phi(Simd<double>& phi_mod) const;
151 
152  KOKKOS_INLINE_FUNCTION double wedge_modulo_phi(double phi) const;
153 
154  KOKKOS_INLINE_FUNCTION bool node_is_inside_psi_range(const MagneticField<Device> &magnetic_field, const int node) const;
155 
156  KOKKOS_INLINE_FUNCTION int get_plane_index(double phi) const;
157 
158  KOKKOS_INLINE_FUNCTION int get_node_index(int triangle_index, int tri_vertex_index) const;
159 
160  KOKKOS_INLINE_FUNCTION double node_area_to_volume(const MagneticField<Device> &magnetic_field, double area, int node_index) const;
161 
162  KOKKOS_INLINE_FUNCTION void get_triangle_area_and_volume(const MagneticField<Device> &magnetic_field, int i, double& area, double& volume) const;
163 
164  KOKKOS_INLINE_FUNCTION double get_r_center_of_mass(int itr) const;
165 
166  KOKKOS_INLINE_FUNCTION bool node_is_in_region_1_or_2_no_wall(const int inode) const;
167 
168  KOKKOS_INLINE_FUNCTION bool node_is_in_region_2_or_3_no_wall(const int inode) const;
169 
170  KOKKOS_INLINE_FUNCTION bool node_is_in_private_region_no_wall(const int inode) const;
171 
172  KOKKOS_INLINE_FUNCTION bool node_is_in_included_region(const int inode, const bool exclude_private_region) const;
173 
174  template<class Device2>
175  KOKKOS_INLINE_FUNCTION bool node_is_in_region_1_or_2(const MagneticField<Device2> &magnetic_field, const int inode) const;
176 
177  template<class Device2>
178  KOKKOS_INLINE_FUNCTION bool node_is_in_region_3b(const MagneticField<Device2> &magnetic_field, const int inode) const;
179 
180  KOKKOS_INLINE_FUNCTION int node_region_3_index(const MagneticField<Device> &magnetic_field, const int inode) const;
181 
182  KOKKOS_INLINE_FUNCTION bool node_is_on_wall(const int inode) const;
183 
184  template<class Device2>
185  KOKKOS_INLINE_FUNCTION bool node_is_in_region_3a_no_wall(const MagneticField<Device2> &magnetic_field, const int inode) const;
186 
187  template<class Device2>
188  KOKKOS_INLINE_FUNCTION bool node_is_in_region_3b_no_wall(const MagneticField<Device2> &magnetic_field, const int inode) const;
189 
190  KOKKOS_INLINE_FUNCTION bool node_is_on_separatrix_leg(const MagneticField<Device> &magnetic_field, const int inode) const;
191 
192  KOKKOS_INLINE_FUNCTION int uses_rz_basis(const int inode) const;
193 
194  KOKKOS_INLINE_FUNCTION double get_r(const int inode) const;
195 
196  KOKKOS_INLINE_FUNCTION double get_dist2_from_node(const int inode, const RZPair x) const;
197  KOKKOS_INLINE_FUNCTION double get_dist2_from_node(const int inode, const double r, const double z) const;
198 
199  KOKKOS_INLINE_FUNCTION double get_dist_from_node(const int inode, const RZPair x) const;
200 
201  KOKKOS_INLINE_FUNCTION void get_rz_coordinates(const int inode, double& r, double& z) const;
202 
203  KOKKOS_INLINE_FUNCTION void get_rz_coordinates(const Simd<int>& grid_inds, SimdVector2D& x) const;
204 
205  KOKKOS_INLINE_FUNCTION void get_rz_coordinates(const int itr, const double (&p)[3], double& r, double& z) const;
206 
207  KOKKOS_INLINE_FUNCTION void get_rz_coordinates(const Simd<int>& itr, const SimdGridVec& p, SimdVector2D& x) const;
208 
209  KOKKOS_INLINE_FUNCTION int get_nearest_node(const Simd<int>& itr, const SimdGridVec& p, int i_simd) const;
210 
211  KOKKOS_INLINE_FUNCTION int get_nearest_node(const int itr, const double (&p)[3]) const;
212 
213  KOKKOS_INLINE_FUNCTION double get_nearest_midplane(double phi) const;
214 
215  KOKKOS_INLINE_FUNCTION void set_gradient_mat_triangle(const View<int*,CLayout,DeviceType>& num_t_node,
216  const View<int**,CLayout,DeviceType>& tr_node, const View<double*,CLayout,DeviceType>& tr_area,
217  const View<double***, CLayout, DeviceType>& unit_vecs,
218  const int i, const GradientMatrices<Device>& gradient_matrices) const;
219 
220  KOKKOS_INLINE_FUNCTION int get_characteristic_length(const View<int*,CLayout,DeviceType>& num_t_node,
221  const View<int**,CLayout,DeviceType>& tr_node, const int i,
222  double& dist_triangle, double& dist_psi, double& dist_theta) const;
223 
224  KOKKOS_INLINE_FUNCTION void set_grad_matrix_from_psi_theta(bool is_psi_dir, int itr_pos, int itr_neg, double (&p_pos)[3], double (&p_neg)[3], double dl_pos, double dl_neg, int inode, const Matrix<Device>& matrix) const;
225 
226  KOKKOS_INLINE_FUNCTION RZPair get_wall_rz(int i_wall) const;
227 
228  void write_to_file(const XGC_IO_Stream& stream, const DomainDecomposition<DeviceType>& pol_decomp, bool is_stellarator, const std::string& prefix) const;
229 
230  void draw_ascii_grid(MagneticField<Device> magnetic_field, double rmin, double rmax, double dr, double zmin, double zmax, double dz){
231  printf("\n\n******** PLOT OF GRID ******* \n");
232  Kokkos::View<int*,HostType> save_vert("save_vert", 1+((rmax-rmin)/dr));
233  for (double zplot = zmax; zplot>=zmin; zplot-=dz){
234  printf("\n");
235  int save_num = 0;
236  int rsave_ind = -1;
237  for (double rplot = rmin; rplot<=rmax; rplot+=dr){
238  rsave_ind++;
239  SimdVector v;
240  v.r = rplot;
241  v.z = zplot;
242  v.phi = 0.001;
243 
244  // Get itr (triangle index)
245  SimdGridVec p;
246  Simd<int> itr = -1;
247  get_grid_weights(magnetic_field, v, itr, p);
248  if(itr[0]!=save_num || itr[0]!=save_vert[rsave_ind]){
249  if(itr[0]<10 && itr[0]>=0) printf("%d ",itr[0]);
250  else printf("%d ",itr[0]);
251  save_num = itr[0];
252  save_vert[rsave_ind] = itr[0];
253  } else {printf(" ");}
254  }
255  }
256  }
257 
258  int ntriangle;
259  int nnode;
260  int nplanes;
261  double plane_phi;
262  double wedge_angle;
263  double delta_phi;
264  double inv_delta_phi;
265 
266  Kokkos::View<double*,Kokkos::LayoutRight,Device> psi;
267  Kokkos::View<double*,Kokkos::LayoutRight,Device> bfield;
268 
269  private:
270  Kokkos::View<int*, Kokkos::LayoutRight,Device> basis;
271  Kokkos::View<Vertex*,Kokkos::LayoutRight,Device> nodes;
272  Kokkos::View<VertexMap*,Kokkos::LayoutRight,Device> mapping;
273  Kokkos::View<int*,Kokkos::LayoutRight,Device> rgn;
274  Kokkos::View<RZPair*,Kokkos::LayoutRight,Device> gx;
276 
277  public:
281  Kokkos::View<double*,Kokkos::LayoutRight,Device> psi_surf;
282  Kokkos::View<double*,Kokkos::LayoutRight,HostType> psi_surf_h;
283  Kokkos::View<double*,Kokkos::LayoutRight,Device> psi_surf2;
284  View<int*, CLayout, Device> psi_map_surf_to_surf2;
285  View<int*, CLayout, Device> psi_map_surf2_to_surf;
287 
288  private:
290 
291  View<int**,CLayout,Device> adj;
292 
293  public:
294  int nwall;
295 
296  //private:
297  Kokkos::View<int*,Kokkos::LayoutRight,Device> wall_nodes;
298  Kokkos::View<int*,Kokkos::LayoutRight,Device> node_to_wall;
299 
301 
302 #ifdef NO_FORTRAN_MODULES
303  GradientMatrices<HostType> gradient_matrices_h;
304 #endif
305 };
306 
307 #include "plane.tpp"
308 #endif
Definition: magnetic_field.hpp:12
Definition: matrix.hpp:11
Definition: NamelistReader.hpp:193
Definition: grid_files.hpp:13
Definition: plane.hpp:17
KOKKOS_INLINE_FUNCTION void set_grad_matrix_from_psi_theta(bool is_psi_dir, int itr_pos, int itr_neg, double(&p_pos)[3], double(&p_neg)[3], double dl_pos, double dl_neg, int inode, const Matrix< Device > &matrix) const
Definition: plane.tpp:1290
Kokkos::View< int *, Kokkos::LayoutRight, Device > basis
0 for Psi-theta, 1 for R-Z ; should be enum (and bool/char?)
Definition: plane.hpp:270
KOKKOS_INLINE_FUNCTION double get_dist_from_node(const int inode, const RZPair x) const
Definition: plane.tpp:978
KOKKOS_INLINE_FUNCTION int get_node_index(int triangle_index, int tri_vertex_index) const
Definition: plane.tpp:702
Kokkos::View< int *, Kokkos::LayoutRight, Device > wall_nodes
Definition: plane.hpp:297
KOKKOS_INLINE_FUNCTION int get_nearest_node(const Simd< int > &itr, const SimdGridVec &p, int i_simd) const
Definition: plane.tpp:1060
Plane< Device2 > mirror() const
Definition: plane.hpp:32
KOKKOS_INLINE_FUNCTION void search_tr2(const SimdVector2D &xy, Simd< int > &itr, SimdGridVec &pout) const
Definition: plane.tpp:64
KOKKOS_INLINE_FUNCTION void get_grid_weights_plane_ff(const MagneticField< Device > &magnetic_field, const SimdVector &v, double phi_plane, SimdGridWeights< Order::One, PhiInterpType::Planes > &grid_wts) const
Definition: plane.tpp:461
GuessList1D< Device > psi_guess
Definition: plane.hpp:289
double eps_flux_surface
The minimum difference in psi that counts as being on two different flux surfaces.
Definition: plane.hpp:300
KOKKOS_INLINE_FUNCTION double get_nearest_midplane(double phi) const
Definition: plane.tpp:1088
UniformRange psi00
Definition: plane.hpp:286
KOKKOS_INLINE_FUNCTION int get_plane_index(double phi) const
Definition: plane.tpp:689
KOKKOS_INLINE_FUNCTION void search_tr_check_guess(const SimdVector2D &x, const Simd< int > &old_itr, Simd< int > &itr, SimdGridVec &p) const
Definition: plane.tpp:278
KOKKOS_INLINE_FUNCTION void get_triangle_area_and_volume(const MagneticField< Device > &magnetic_field, int i, double &area, double &volume) const
Definition: plane.tpp:733
KOKKOS_INLINE_FUNCTION double get_dist2_from_node(const int inode, const RZPair x) const
Definition: plane.tpp:964
KOKKOS_INLINE_FUNCTION bool node_is_on_wall(const int inode) const
Definition: plane.tpp:866
KOKKOS_INLINE_FUNCTION void get_grid_weights(const MagneticField< Device > &magnetic_field, const SimdVector &v, const Simd< double > &psi, SimdVector2D &xff, SimdGridWeights< Order::One, PIT > &grid_wts) const
Definition: plane.tpp:480
KOKKOS_INLINE_FUNCTION double get_r(const int inode) const
Definition: plane.tpp:935
KOKKOS_INLINE_FUNCTION bool node_is_inside_psi_range(const MagneticField< Device > &magnetic_field, const int node) const
Definition: plane.tpp:676
Kokkos::View< int *, Kokkos::LayoutRight, Device > rgn
Definition: plane.hpp:273
Kokkos::View< double *, Kokkos::LayoutRight, Device > bfield
Magnetic field magnitude at nodes.
Definition: plane.hpp:267
KOKKOS_INLINE_FUNCTION bool node_is_in_included_region(const int inode, const bool exclude_private_region) const
Definition: plane.tpp:812
KOKKOS_INLINE_FUNCTION void nearest_node(const SimdGridWeights< Order::One, PIT > &grid_wts, SimdGridWeights< Order::Zero, PIT > &grid_wts0) const
Definition: plane.tpp:525
KOKKOS_INLINE_FUNCTION void search_tr2_no_precheck(const double r, const double z, int &itr, double(&p)[3]) const
Definition: plane.tpp:13
void setup_1d_flux_surface_grid(const PlaneFilesInterface &plane_files, const MagneticField< DeviceType > &magnetic_field)
Kokkos::View< Vertex *, Kokkos::LayoutRight, Device > nodes
Definition: plane.hpp:271
KOKKOS_INLINE_FUNCTION void psi_search(double psi, double &wp, int &ip) const
Definition: plane.tpp:322
View< int *, CLayout, Device > psi_map_surf_to_surf2
Definition: plane.hpp:284
KOKKOS_INLINE_FUNCTION int node_region_3_index(const MagneticField< Device > &magnetic_field, const int inode) const
Definition: plane.tpp:854
KOKKOS_INLINE_FUNCTION void follow_field_to_nearest_midplane(const MagneticField< Device > &magnetic_field, const SimdVector2D &x, const Simd< double > &phi, SimdVector2D &xff) const
Definition: plane.tpp:369
Kokkos::View< double *, Kokkos::LayoutRight, Device > psi_surf2
Definition: plane.hpp:283
KOKKOS_INLINE_FUNCTION int uses_rz_basis(const int inode) const
Definition: plane.tpp:923
double plane_phi
phi coordinate of this plane
Definition: plane.hpp:261
void draw_ascii_grid(MagneticField< Device > magnetic_field, double rmin, double rmax, double dr, double zmin, double zmax, double dz)
Definition: plane.hpp:230
KOKKOS_INLINE_FUNCTION void follow_field_to_plane(const MagneticField< Device > &magnetic_field, const SimdVector2D &x, const Simd< double > &phi, SimdVector2D &xff) const
Definition: plane.tpp:396
int nnode
Number of grid nodes.
Definition: plane.hpp:259
double delta_phi
Distance between planes.
Definition: plane.hpp:263
KOKKOS_INLINE_FUNCTION RZPair get_wall_rz(int i_wall) const
Definition: plane.tpp:1334
KOKKOS_INLINE_FUNCTION void t_coeff(const SimdVector2D &x, const Simd< int > &itr, SimdGridVec &p) const
Definition: plane.tpp:260
Plane()
Definition: plane.hpp:28
KOKKOS_INLINE_FUNCTION bool node_is_in_region_3b(const MagneticField< Device2 > &magnetic_field, const int inode) const
Definition: plane.tpp:841
KOKKOS_INLINE_FUNCTION void t_coeff_mod(const MagneticField< Device > &magnetic_field, const double r, const double z, const double psiin, const int itr, double(&p)[3]) const
Definition: plane.tpp:139
Kokkos::View< double *, Kokkos::LayoutRight, Device > psi_surf
Definition: plane.hpp:281
KOKKOS_INLINE_FUNCTION void get_grid_weights(const MagneticField< Device > &magnetic_field, const SimdVector &v, SimdVector2D &xff, SimdGridWeights< Order::One, PIT > &grid_wts) const
KOKKOS_INLINE_FUNCTION void get_wall_index(const Simd< bool > &just_left_the_grid, const SimdVector2D &x, const SimdGridWeights< Order::One, PIT_GLOBAL > &grid_wts, Simd< int > &widx) const
Definition: plane.tpp:614
KOKKOS_INLINE_FUNCTION void get_grid_weights_ff(const MagneticField< Device > &magnetic_field, const SimdVector &v, const Simd< double > &psi_in, SimdVector2D &xff, SimdGridWeights< Order::One, PhiInterpType::Planes > &grid_wts) const
Definition: plane.tpp:429
KOKKOS_INLINE_FUNCTION bool node_is_in_region_1_or_2(const MagneticField< Device2 > &magnetic_field, const int inode) const
Definition: plane.tpp:827
KOKKOS_INLINE_FUNCTION bool node_is_in_region_3b_no_wall(const MagneticField< Device2 > &magnetic_field, const int inode) const
Definition: plane.tpp:895
double inv_delta_phi
1/delta_phi
Definition: plane.hpp:264
KOKKOS_INLINE_FUNCTION void get_grid_weights_no_ff(const MagneticField< Device > &magnetic_field, const SimdVector2D &x, const Simd< double > &psi_in, SimdGridWeights< Order::One, PhiInterpType::None > &grid_wts) const
Definition: plane.tpp:410
Kokkos::View< RZPair *, Kokkos::LayoutRight, Device > gx
Definition: plane.hpp:274
KOKKOS_INLINE_FUNCTION bool node_is_in_private_region_no_wall(const int inode) const
Definition: plane.tpp:799
Kokkos::View< double *, Kokkos::LayoutRight, HostType > psi_surf_h
Definition: plane.hpp:282
double wedge_angle
The size of the wedge (the model is periodic in phi, a angle of e.g. pi means half the tokamak is mod...
Definition: plane.hpp:262
int nwall
Definition: plane.hpp:294
Plane(NLReader::NamelistReader &nlr, const PlaneFilesInterface &plane_files, const MagneticField< DeviceType > &magnetic_field, double plane_index_dbl, bool use_as_fortran_grid=false)
double minval_psi_surf2
Definition: plane.hpp:279
void write_to_file(const XGC_IO_Stream &stream, const DomainDecomposition< DeviceType > &pol_decomp, bool is_stellarator, const std::string &prefix) const
KOKKOS_INLINE_FUNCTION void wedge_modulo_phi(Simd< double > &phi_mod) const
Definition: plane.tpp:585
KOKKOS_INLINE_FUNCTION bool node_is_in_region_3a_no_wall(const MagneticField< Device2 > &magnetic_field, const int inode) const
Definition: plane.tpp:880
View< int *, CLayout, Device > psi_map_surf2_to_surf
Definition: plane.hpp:285
KOKKOS_INLINE_FUNCTION double get_r_center_of_mass(int itr) const
Definition: plane.tpp:759
KOKKOS_INLINE_FUNCTION bool node_is_on_separatrix_leg(const MagneticField< Device > &magnetic_field, const int inode) const
Definition: plane.tpp:910
Kokkos::View< double *, Kokkos::LayoutRight, Device > psi
An array of psi coordinates.
Definition: plane.hpp:266
KOKKOS_INLINE_FUNCTION void get_rz_coordinates(const int inode, double &r, double &z) const
Definition: plane.tpp:1003
int npsi_surf2
Definition: plane.hpp:278
Kokkos::View< VertexMap *, Kokkos::LayoutRight, Device > mapping
Definition: plane.hpp:272
int nplanes
Number of planes.
Definition: plane.hpp:260
double maxval_psi_surf2
Definition: plane.hpp:280
Kokkos::View< int *, Kokkos::LayoutRight, Device > node_to_wall
Definition: plane.hpp:298
GuessTable< Device > guess
Definition: plane.hpp:275
KOKKOS_INLINE_FUNCTION double node_area_to_volume(const MagneticField< Device > &magnetic_field, double area, int node_index) const
Definition: plane.tpp:718
int ntriangle
Number of grid triangles.
Definition: plane.hpp:258
KOKKOS_INLINE_FUNCTION bool node_is_in_region_1_or_2_no_wall(const int inode) const
Definition: plane.tpp:775
KOKKOS_INLINE_FUNCTION bool node_is_in_region_2_or_3_no_wall(const int inode) const
Definition: plane.tpp:787
View< int **, CLayout, Device > adj
The indices of the three adjacent triangles for each triangle.
Definition: plane.hpp:291
KOKKOS_INLINE_FUNCTION int get_characteristic_length(const View< int *, CLayout, DeviceType > &num_t_node, const View< int **, CLayout, DeviceType > &tr_node, const int i, double &dist_triangle, double &dist_psi, double &dist_theta) const
Definition: plane.tpp:1165
KOKKOS_INLINE_FUNCTION void set_gradient_mat_triangle(const View< int *, CLayout, DeviceType > &num_t_node, const View< int **, CLayout, DeviceType > &tr_node, const View< double *, CLayout, DeviceType > &tr_area, const View< double ***, CLayout, DeviceType > &unit_vecs, const int i, const GradientMatrices< Device > &gradient_matrices) const
Definition: plane.tpp:1103
Definition: xgc_io.hpp:24
void mirror_copy(T1 &view_dest, const T2 &view_src)
Definition: my_mirror_view.hpp:122
View< T *, CLayout, Device > my_mirror_view(const View< T *, CLayout, Device > &view, Device nd)
Definition: my_mirror_view.hpp:14
real(8), parameter phi
Definition: load_balance_constraint_mod.F90:18
Definition: magnetic_field.F90:1
Definition: gradient_matrices.hpp:9
Definition: guess_list_1d.hpp:7
Definition: guess_table.hpp:8
Definition: grid_structs.hpp:28
Definition: grid_structs.hpp:7
Definition: grid_weights.hpp:73
Definition: grid_weights.hpp:52
Definition: grid_weights.hpp:47
Definition: simd.hpp:139
Definition: simd.hpp:149
Simd< double > z
Definition: simd.hpp:151
Simd< double > r
Definition: simd.hpp:150
Simd< double > phi
Definition: simd.hpp:152
Definition: uniform_range.hpp:8