16 template<
class Device>
20 template<
class Device2>
friend class Plane;
31 template<
class Device2>
80 #ifdef NO_FORTRAN_MODULES
81 m.gradient_matrices_h = gradient_matrices_h;
95 KOKKOS_INLINE_FUNCTION
void search_tr2_no_precheck(
const double r,
const double z,
int& itr,
double (&p)[3])
const;
101 KOKKOS_INLINE_FUNCTION
void psi_search(
double psi,
double &wp,
int &ip)
const;
111 template<PhiInterpType PIT>
114 template<PhiInterpType PIT>
117 template<PhiInterpType PIT>
120 template<PhiInterpType PIT>
123 template<PhiInterpType PIT>
126 template<PhiInterpType PIT>
129 template<PhiInterpType PIT>
142 KOKKOS_INLINE_FUNCTION
int get_node_index(
int triangle_index,
int tri_vertex_index)
const;
158 template<
class Device2>
163 template<
class Device2>
166 template<
class Device2>
169 KOKKOS_INLINE_FUNCTION
int uses_rz_basis(
const int inode)
const;
171 KOKKOS_INLINE_FUNCTION
double get_r(
const int inode)
const;
173 KOKKOS_INLINE_FUNCTION
double get_dist2_from_node(
const int inode,
const double r,
const double z)
const;
175 KOKKOS_INLINE_FUNCTION
double get_dist_from_node(
const int inode,
const double r,
const double z)
const;
177 KOKKOS_INLINE_FUNCTION
void get_rz_coordinates(
const int inode,
double& r,
double& z)
const;
181 KOKKOS_INLINE_FUNCTION
void get_rz_coordinates(
const int itr,
const double (&p)[3],
double& r,
double& z)
const;
187 KOKKOS_INLINE_FUNCTION
int get_nearest_node(
const int itr,
const double (&p)[3])
const;
192 const View<int**,CLayout,DeviceType>& tr_node,
const View<double*,CLayout,DeviceType>& tr_area,
193 const View<double***, CLayout, DeviceType>& unit_vecs,
197 const View<int**,CLayout,DeviceType>& tr_node,
const int i,
198 double& dist_triangle,
double& dist_psi,
double& dist_theta)
const;
200 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;
207 printf(
"\n\n******** PLOT OF GRID ******* \n");
208 Kokkos::View<int*,HostType> save_vert(
"save_vert", 1+((rmax-rmin)/dr));
209 for (
double zplot = zmax; zplot>=zmin; zplot-=dz){
213 for (
double rplot = rmin; rplot<=rmax; rplot+=dr){
224 if(itr[0]!=save_num || itr[0]!=save_vert[rsave_ind]){
225 if(itr[0]<10 && itr[0]>=0) printf(
"%d ",itr[0]);
226 else printf(
"%d ",itr[0]);
228 save_vert[rsave_ind] = itr[0];
229 }
else {printf(
" ");}
241 Kokkos::View<double*,Kokkos::LayoutRight,Device>
psi;
242 Kokkos::View<double*,Kokkos::LayoutRight,Device>
bfield;
245 Kokkos::View<int*, Kokkos::LayoutRight,Device>
basis;
246 Kokkos::View<Vertex*,Kokkos::LayoutRight,Device>
nodes;
247 Kokkos::View<VertexMap*,Kokkos::LayoutRight,Device>
mapping;
248 Kokkos::View<int*,Kokkos::LayoutRight,Device>
rgn;
249 Kokkos::View<RZPair*,Kokkos::LayoutRight,Device>
gx;
256 Kokkos::View<double*,Kokkos::LayoutRight,Device>
psi_surf2;
262 View<int**,CLayout,Device>
adj;
273 #ifdef NO_FORTRAN_MODULES
KOKKOS_INLINE_FUNCTION bool node_is_in_private_region_no_wall(const int inode) const
Definition: plane.tpp:751
KOKKOS_INLINE_FUNCTION int get_nearest_node(const Simd< int > &itr, const SimdGridVec &p, int i_simd) const
Definition: plane.tpp:970
double minval_psi_surf2
Definition: plane.hpp:254
KOKKOS_INLINE_FUNCTION int get_plane_index(double phi) const
Definition: plane.tpp:654
Simd< double > r
Definition: simd.hpp:150
Definition: guess_list_1d.hpp:7
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:1013
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:401
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:467
KOKKOS_INLINE_FUNCTION bool node_is_in_region_1_or_2_no_wall(const int inode) const
Definition: plane.tpp:739
double eps_flux_surface
The minimum difference in psi that counts as being on two different flux surfaces.
Definition: plane.hpp:271
Definition: gradient_matrices.hpp:9
Kokkos::View< RZPair *, Kokkos::LayoutRight, Device > gx
Definition: plane.hpp:249
void mirror_copy(T1 &view_dest, const T2 &view_src)
Definition: my_mirror_view.hpp:122
KOKKOS_INLINE_FUNCTION double get_dist_from_node(const int inode, const double r, const double z) const
Definition: plane.tpp:888
UniformRange psi00
Definition: plane.hpp:257
Definition: grid_weights.hpp:73
double maxval_psi_surf2
Definition: plane.hpp:255
KOKKOS_INLINE_FUNCTION void get_triangle_area_and_volume(const MagneticField< Device > &magnetic_field, int i, double &area, double &volume) const
Definition: plane.tpp:698
KOKKOS_INLINE_FUNCTION double node_area_to_volume(const MagneticField< Device > &magnetic_field, double area, int node_index) const
Definition: plane.tpp:683
Definition: grid_weights.hpp:47
double delta_phi
Distance between planes.
Definition: plane.hpp:238
int ntriangle
Number of grid triangles.
Definition: plane.hpp:234
Definition: NamelistReader.hpp:193
Definition: magnetic_field.hpp:13
KOKKOS_INLINE_FUNCTION void search_tr2(const SimdVector2D &xy, Simd< int > &itr, SimdGridVec &pout) const
Definition: plane.tpp:64
KOKKOS_INLINE_FUNCTION double get_r_center_of_mass(int itr) const
Definition: plane.tpp:724
Kokkos::View< Vertex *, Kokkos::LayoutRight, Device > nodes
Definition: plane.hpp:246
GuessTable< Device > guess
Definition: plane.hpp:250
KOKKOS_INLINE_FUNCTION int get_node_index(int triangle_index, int tri_vertex_index) const
Definition: plane.tpp:667
int nwall
Definition: plane.hpp:265
KOKKOS_INLINE_FUNCTION bool node_is_in_region_3b_no_wall(const MagneticField< Device2 > &magnetic_field, const int inode) const
Definition: plane.tpp:834
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:579
KOKKOS_INLINE_FUNCTION double get_nearest_midplane(double phi) const
Definition: plane.tpp:998
KOKKOS_INLINE_FUNCTION void nearest_node(const SimdGridWeights< Order::One, PIT > &grid_wts, SimdGridWeights< Order::Zero, PIT > &grid_wts0) const
Definition: plane.tpp:512
void draw_ascii_grid(MagneticField< Device > magnetic_field, double rmin, double rmax, double dr, double zmin, double zmax, double dz)
Definition: plane.hpp:206
Plane()
Definition: plane.hpp:28
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_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::View< double *, Kokkos::LayoutRight, Device > psi_surf2
Definition: plane.hpp:256
KOKKOS_INLINE_FUNCTION double get_r(const int inode) const
Definition: plane.tpp:859
Definition: grid_structs.hpp:28
KOKKOS_INLINE_FUNCTION void get_rz_coordinates(const int inode, double &r, double &z) const
Definition: plane.tpp:913
KOKKOS_INLINE_FUNCTION void wedge_modulo_phi(Simd< double > &phi_mod) const
Definition: plane.tpp:550
void setup_1d_flux_surface_grid(const PlaneFiles &plane_files, const MagneticField< DeviceType > &magnetic_field, const View< double *, CLayout, HostType > &node_vol_h)
Definition: guess_table.hpp:8
int nnode
Number of grid nodes.
Definition: plane.hpp:235
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:1075
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_INLINE_FUNCTION RZPair get_wall_rz(int i_wall) const
Definition: plane.tpp:1244
KOKKOS_INLINE_FUNCTION bool node_is_on_wall(const int inode) const
Definition: plane.tpp:804
KOKKOS_INLINE_FUNCTION bool node_is_in_region_3a_no_wall(const MagneticField< Device2 > &magnetic_field, const int inode) const
Definition: plane.tpp:818
KOKKOS_INLINE_FUNCTION void search_tr2_no_precheck(const double r, const double z, int &itr, double(&p)[3]) const
Definition: plane.tpp:13
KOKKOS_INLINE_FUNCTION bool node_is_in_included_region(const int inode, const bool exclude_private_region) const
Definition: plane.tpp:764
Kokkos::View< double *, Kokkos::LayoutRight, Device > psi
An array of psi coordinates.
Definition: plane.hpp:241
Plane< Device2 > mirror() const
Definition: plane.hpp:32
int nplanes
Number of planes.
Definition: plane.hpp:236
Kokkos::View< int *, Kokkos::LayoutRight, Device > node_to_wall
Definition: plane.hpp:269
Simd< double > phi
Definition: simd.hpp:152
void write_to_file(const XGC_IO_Stream &stream) const
Definition: matrix.hpp:11
Simd< double > z
Definition: simd.hpp:151
Definition: xgc_io.hpp:24
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:1200
Definition: grid_structs.hpp:7
View< T *, CLayout, Device > my_mirror_view(const View< T *, CLayout, Device > &view, Device nd)
Definition: my_mirror_view.hpp:14
Definition: grid_weights.hpp:52
GuessList1D< Device > psi_guess
Definition: plane.hpp:260
KOKKOS_INLINE_FUNCTION void t_coeff(const SimdVector2D &x, const Simd< int > &itr, SimdGridVec &p) const
Definition: plane.tpp:260
double inv_delta_phi
1/delta_phi
Definition: plane.hpp:239
Definition: magnetic_field.F90:1
int npsi_surf2
Definition: plane.hpp:253
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:448
KOKKOS_INLINE_FUNCTION bool node_is_inside_psi_range(const MagneticField< Device > &magnetic_field, const int node) const
Definition: plane.tpp:641
Kokkos::View< VertexMap *, Kokkos::LayoutRight, Device > mapping
Definition: plane.hpp:247
Kokkos::View< int *, Kokkos::LayoutRight, Device > basis
0 for Psi-theta, 1 for R-Z ; should be enum (and bool/char?)
Definition: plane.hpp:245
Definition: grid_files.hpp:21
KOKKOS_INLINE_FUNCTION bool node_is_in_region_1_or_2(const MagneticField< Device > &magnetic_field, const int inode) const
Definition: plane.tpp:778
View< int **, CLayout, Device > adj
The indices of the three adjacent triangles for each triangle.
Definition: plane.hpp:262
KOKKOS_INLINE_FUNCTION bool node_is_in_region_3b(const MagneticField< Device2 > &magnetic_field, const int inode) const
Definition: plane.tpp:792
KOKKOS_INLINE_FUNCTION int uses_rz_basis(const int inode) const
Definition: plane.tpp:847
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:420
Kokkos::View< int *, Kokkos::LayoutRight, Device > wall_nodes
Definition: plane.hpp:268
Kokkos::View< int *, Kokkos::LayoutRight, Device > rgn
Definition: plane.hpp:248
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:237
KOKKOS_INLINE_FUNCTION double get_dist2_from_node(const int inode, const double r, const double z) const
Definition: plane.tpp:874
KOKKOS_INLINE_FUNCTION void psi_search(double psi, double &wp, int &ip) const
Definition: plane.tpp:322
Kokkos::View< double *, Kokkos::LayoutRight, Device > bfield
Magnetic field magnitude at nodes.
Definition: plane.hpp:242