6 #include <Kokkos_Core.hpp> 
    7 #include <Kokkos_DualView.hpp> 
   12 template<
class Device>
 
   22     View<double***,CLayout,Device> 
vol;
 
   23     View<double***,CLayout,HostType> 
vol_h;
 
   27     View<double**,Kokkos::LayoutLeft,HostType> 
mesh_dz_h;
 
   28     View<double**,Kokkos::LayoutLeft,HostType> 
mesh_dr_h;
 
   30     View<double**,Kokkos::LayoutLeft,Device> 
vpar_beg;
 
   31     View<double**,Kokkos::LayoutLeft,Device> 
mesh_dz;
 
   32     View<double**,Kokkos::LayoutLeft,Device> 
mesh_dr;
 
   38         Kokkos::DualView<int*,CLayout,Device> nspecies_in_grid_tmp(
"nspecies_in_grid", col_spall.
s.h_view.extent(0));
 
   40         for (
int isp = 0; isp < col_spall.
s.h_view.extent(0); isp++){
 
   42             nspecies_in_grid_tmp.h_view(gri)++;
 
   44         return nspecies_in_grid_tmp;
 
   63           nvz(col_spall.pdf.extent(2)),
 
   64           nvr(col_spall.pdf.extent(3)),
 
   82         for (
int isp = 0; isp < 
n_species; isp++){
 
  108         return (ivz==0 || ivz==(
nvz-1)) ? 0.5 : 1.0;
 
  115     void setup_one(
int isp, 
int mesh_ind, 
double vth, 
double dsmu, 
double dvp, 
double vp_max) {
 
  118         double pi4bb0vth3_dd = 
TWOPI*vth*vth*vth*dsmu*dvp;
 
  121         double smu_n = dsmu/3.0;
 
  122         vol_h(mesh_ind,isp,0) = 0.5*pi4bb0vth3_dd*smu_n;
 
  124         for (
int imu = 1; imu < 
nvr-1; imu++){
 
  126             vol_h(mesh_ind,isp,imu) = pi4bb0vth3_dd*smu_n;
 
  130         smu_n = dsmu*(
nvr-1);
 
  131         vol_h(mesh_ind,isp,
nvr-1) = 0.5*pi4bb0vth3_dd*smu_n;
 
  137         double vpar_beg_l = -vp_max*vth;
 
  138         double mesh_dz_l = dvp*vth;
 
  139         double mesh_dr_l = dsmu*vth;
 
  146         for (
int j = 0; j < 
nvr; j++){
 
  147             mesh_r_h(mesh_ind,isp,j) = mesh_dr_l*j;
 
  149         for (
int j = 0; j < 
nvz; j++){
 
  150             mesh_z_h(mesh_ind,isp,j) = vpar_beg_l + mesh_dz_l*j;
 
  154     KOKKOS_INLINE_FUNCTION 
double mesh_r(
int ibatch, 
int igrid, 
int j)
 const{
 
  155         return mesh_dr(ibatch, igrid)*j;
 
  158     KOKKOS_INLINE_FUNCTION 
double mesh_z(
int ibatch, 
int igrid, 
int j)
 const{
 
  162     KOKKOS_INLINE_FUNCTION 
double mesh_r_half(
int ibatch, 
int igrid, 
int j)
 const{
 
  163         return mesh_dr(ibatch, igrid)*(j+0.5);
 
  166     KOKKOS_INLINE_FUNCTION 
double mesh_z_half(
int ibatch, 
int igrid, 
int j)
 const{
 
  175         for (
int mesh_ind = 0; mesh_ind<
mb_n_nodes; mesh_ind++){
 
  176             for (
int gri = 0; gri < 
n; gri++){
 
  177                 const int FIRST_SPECIES_OF_GRID = 0; 
 
  181                 int inode = mesh_nodes(mesh_ind);
 
  183                 double vth = 
thermal_velocity(col_species.
s.h_view(isp,mesh_ind).mass, fg_temp_ev);
 
  195         View<double***,CLayout,Device> vol_tmp(
"vol_tmp",
vol_h.extent(0),
vol_h.extent(1),
vol_h.extent(2));
 
  197         Kokkos::deep_copy(vol_tmp, 
vol_h);
 
  200         View<double***,CLayout,Device> lvol = 
vol;
 
  205         Kokkos::parallel_for(
"transpose_vol", Kokkos::RangePolicy<ExSpace>( 0, n2*
vol_h.extent(0)), KOKKOS_LAMBDA (
const int idx){
 
  208             int i1 = rem/nvr_loc;
 
  209             int i2 = rem%nvr_loc; 
 
  210             lvol(i2,i1,i0) = vol_tmp(i0,i1,i2);
 
KOKKOS_INLINE_FUNCTION double thermal_velocity(double mass, double temp_ev)
Definition: basic_physics.hpp:75
 
Definition: col_species.hpp:105
 
View< int *, CLayout, HostType > moments_index
Definition: col_species.hpp:117
 
View< int *, CLayout, HostType > grid_index_h
Definition: col_species.hpp:113
 
const VGridDistribution< HostType > f
Definition: col_species.hpp:107
 
std::vector< View< double *, CLayout, HostType > > fg_temp_ev_all
Definition: col_species.hpp:123
 
Kokkos::DualView< CollisionSpeciesScalars **, Device > s
Definition: col_species.hpp:109
 
double vp_max
max parallel velocity
Definition: vgrid_distribution.hpp:31
 
double dsmu
grid spacing in mu
Definition: vgrid_distribution.hpp:34
 
double dvp
grid spacing in parallel velocity
Definition: vgrid_distribution.hpp:32
 
constexpr double TWOPI
Definition: constants.hpp:10
 
void parallel_for(const std::string name, int n_ptl, Function func, Option option, HostAoSoA aosoa_h, DeviceAoSoA aosoa_d)
Definition: streamed_parallel_for.hpp:252
 
Definition: col_vgrids.hpp:13
 
View< double ***, CLayout, HostType > mesh_r_h
Definition: col_vgrids.hpp:20
 
KOKKOS_INLINE_FUNCTION double mesh_r_half(int ibatch, int igrid, int j) const
Definition: col_vgrids.hpp:162
 
KOKKOS_INLINE_FUNCTION double vp_vol_fac(int ivz) const
Definition: col_vgrids.hpp:107
 
void setup_all(const CollisionSpecies< Device > &col_species, const View< int *, HostType > &mesh_nodes, int mb_n_nodes)
Definition: col_vgrids.hpp:174
 
KOKKOS_INLINE_FUNCTION double mesh_z(int ibatch, int igrid, int j) const
Definition: col_vgrids.hpp:158
 
Kokkos::DualView< int *, CLayout, Device > nspecies_in_grid
Definition: col_vgrids.hpp:14
 
KOKKOS_INLINE_FUNCTION double mesh_r(int ibatch, int igrid, int j) const
Definition: col_vgrids.hpp:154
 
const int mb_n_nodes
Batch size.
Definition: col_vgrids.hpp:16
 
const int nvz
grid points in z
Definition: col_vgrids.hpp:19
 
void setup_one(int isp, int mesh_ind, double vth, double dsmu, double dvp, double vp_max)
Definition: col_vgrids.hpp:115
 
View< double **, Kokkos::LayoutLeft, Device > mesh_dr
Definition: col_vgrids.hpp:32
 
Kokkos::DualView< int *, CLayout, Device > count_species_in_grid(const CollisionSpecies< Device > &col_spall) const
Definition: col_vgrids.hpp:37
 
const int n
Number of velocity grids.
Definition: col_vgrids.hpp:15
 
const int nvr
grid points in r
Definition: col_vgrids.hpp:18
 
View< double ****, Device > delta_z
Definition: col_vgrids.hpp:25
 
View< double **, Kokkos::LayoutLeft, HostType > vpar_beg_h
Definition: col_vgrids.hpp:26
 
View< double **, Kokkos::LayoutLeft, Device > vpar_beg
Definition: col_vgrids.hpp:30
 
View< double **, Kokkos::LayoutLeft, Device > mesh_dz
Definition: col_vgrids.hpp:31
 
View< double ***, CLayout, Device > vol
Definition: col_vgrids.hpp:22
 
View< double **, Kokkos::LayoutLeft, HostType > mesh_dz_h
Definition: col_vgrids.hpp:27
 
int count_grids() const
Definition: col_vgrids.hpp:48
 
View< double ***, CLayout, HostType > mesh_z_h
Definition: col_vgrids.hpp:21
 
KOKKOS_INLINE_FUNCTION double mesh_z_half(int ibatch, int igrid, int j) const
Definition: col_vgrids.hpp:166
 
View< double ****, Device > delta_r
Definition: col_vgrids.hpp:24
 
View< double **, Kokkos::LayoutLeft, HostType > mesh_dr_h
Definition: col_vgrids.hpp:28
 
Kokkos::DualView< int **, CLayout, Device > map_grid_to_species
Definition: col_vgrids.hpp:34
 
View< double ***, CLayout, HostType > vol_h
Definition: col_vgrids.hpp:23
 
const int n_species
Number of species total.
Definition: col_vgrids.hpp:17
 
KOKKOS_INLINE_FUNCTION double local_center_volume(int ibatch, int igrid, int j) const
Definition: col_vgrids.hpp:170