1 #ifndef VELOCITY_GRID_HPP
2 #define VELOCITY_GRID_HPP
31 nvp = nlr.
get<
int>(
"f0_nvp", 15);
32 nmu = nlr.
get<
int>(
"f0_nmu", 31);
33 vp_max = nlr.
get<
double>(
"f0_vp_max", 3.0);
47 exit_XGC(
"\nError: Cannot run with f0_velocity_interp_use_pseudo_inv = true without using PETSc.\n");
50 exit_XGC(
"\nError: f0_velocity_interp_pseudo_inv_order must be 0 or larger.\n");
53 std::string msg =
"\nError: Cannot use f0_velocity_interp_pseudo_inv_order larger than ";
55 msg +=
", if you really want to use that large order then modify LAGRANGE_MAX_ORDER in the code.\n";
60 exit_XGC(
"\nError: f0_nmu must be divisible by f0_velocity_interp_pseudo_inv_order when f0_velocity_interp_use_pseudo_inv = true.\n");
63 exit_XGC(
"\nError: 2*f0_nvp must be divisible by f0_velocity_interp_pseudo_inv_order when f0_velocity_interp_use_pseudo_inv = true.\n");
80 KOKKOS_INLINE_FUNCTION
double vpar_n(
int ivz)
const{
93 KOKKOS_INLINE_FUNCTION
double vperp_n(
int ivr)
const{
107 return (ivr==0 || ivr==
nvr-1) ? 0.5 : 1.0;
120 return (ivz==0 || ivz==
nvz-1) ? 0.5 : 1.0;
144 if(vr_wt.
i>=
nmu || vz_wt.
i>=2*
nvp || vz_wt.
i<0){
165 vgrid_wts.
w_00 *= inv_smu0;
166 vgrid_wts.
w_01 *= inv_smu0;
167 vgrid_wts.
w_10 *= inv_smu1;
168 vgrid_wts.
w_11 *= inv_smu1;
182 double vol00 = vol*(vgrid_wts.
i_vr==0 ? 0.5 : 1.0)*(vgrid_wts.
i_vz==0 ? 0.5 : 1.0);
183 double vol01 = vol*(vgrid_wts.
i_vr==0 ? 0.5 : 1.0)*(vgrid_wts.
i_vz==
nvz-2 ? 0.5 : 1.0);
184 double vol10 = vol*(vgrid_wts.
i_vr==
nvr-2 ? 0.5 : 1.0)*(vgrid_wts.
i_vz==0 ? 0.5 : 1.0);
185 double vol11 = vol*(vgrid_wts.
i_vr==
nvr-2 ? 0.5 : 1.0)*(vgrid_wts.
i_vz==
nvz-2 ? 0.5 : 1.0);
187 vgrid_wts.
w_00 *= vol00;
188 vgrid_wts.
w_01 *= vol01;
189 vgrid_wts.
w_10 *= vol10;
190 vgrid_wts.
w_11 *= vol11;
204 double inv_vol00 = inv_vol*(vgrid_wts.
i_vr==0 ? 2.0 : 1.0)*(vgrid_wts.
i_vz==0 ? 2.0 : 1.0);
205 double inv_vol01 = inv_vol*(vgrid_wts.
i_vr==0 ? 2.0 : 1.0)*(vgrid_wts.
i_vz==
nvz-2 ? 2.0 : 1.0);
206 double inv_vol10 = inv_vol*(vgrid_wts.
i_vr==
nvr-2 ? 2.0 : 1.0)*(vgrid_wts.
i_vz==0 ? 2.0 : 1.0);
207 double inv_vol11 = inv_vol*(vgrid_wts.
i_vr==
nvr-2 ? 2.0 : 1.0)*(vgrid_wts.
i_vz==
nvz-2 ? 2.0 : 1.0);
209 vgrid_wts.
w_00 *= inv_vol00;
210 vgrid_wts.
w_01 *= inv_vol01;
211 vgrid_wts.
w_10 *= inv_vol10;
212 vgrid_wts.
w_11 *= inv_vol11;
int element_order
velocity grid finite element order (0 = nearest neighbor), (1 = linear), (2 = quadratic), (3 = cubic), ....
Definition: velocity_grid.hpp:22
double smu_max
max mu
Definition: velocity_grid.hpp:14
int nmu
n points in mu (not including zero)
Definition: velocity_grid.hpp:13
int nvp
n points in parallel velocity (not including zero)
Definition: velocity_grid.hpp:9
T get(const string ¶m, const T default_val, int val_ind=0)
Definition: NamelistReader.hpp:373
bool pseudo_inv_on
whether pseudo-inverse interpolation is used in velocity space
Definition: velocity_grid.hpp:24
double w_00
Definition: vgrid_weights.hpp:10
Definition: linear_weights.hpp:8
Definition: velocity_grid.hpp:8
KOKKOS_INLINE_FUNCTION void weight_by_inv_vol(double inv_vol, VGridWeights &vgrid_wts) const
Adjusts velocity grid weights by dividing by the inverse volume factor, considering edge effects...
Definition: velocity_grid.hpp:203
Definition: NamelistReader.hpp:193
int nvr
full grid size (including zero)
Definition: velocity_grid.hpp:19
double w_01
Definition: vgrid_weights.hpp:11
KOKKOS_INLINE_FUNCTION double vpar_n(int ivz) const
Returns the parallel velocity corresponding to a given grid index.
Definition: velocity_grid.hpp:80
double w_11
Definition: vgrid_weights.hpp:13
KOKKOS_INLINE_FUNCTION double mu_vol_fac(int ivr) const
Returns a volume factor to account for edge effects in the perpendicular velocity grid...
Definition: velocity_grid.hpp:106
void use_namelist(const string &namelist)
Definition: NamelistReader.hpp:355
KOKKOS_INLINE_FUNCTION double vp_vol_fac(int ivz) const
Returns a volume factor to account for edge effects in the parallel velocity grid.
Definition: velocity_grid.hpp:119
#define LAGRANGE_MAX_ORDER
Definition: lagrange_weights.hpp:18
int i
Definition: linear_weights.hpp:9
double vp_max
max parallel velocity
Definition: velocity_grid.hpp:10
int i_vr
Definition: vgrid_weights.hpp:8
int i_vz
Definition: vgrid_weights.hpp:9
KOKKOS_INLINE_FUNCTION void weight_by_vol(double vol, VGridWeights &vgrid_wts) const
Adjusts velocity grid weights by multiplying with a volume factor, considering edge effects...
Definition: velocity_grid.hpp:181
void exit_XGC(std::string msg)
Definition: globals.hpp:37
VelocityGrid(NLReader::NamelistReader &nlr)
Definition: velocity_grid.hpp:28
Definition: vgrid_weights.hpp:7
double dsmu
grid spacing in mu
Definition: velocity_grid.hpp:15
double inv_mu0_factor
Set value of lowest mu in grid –> 1/mu0_factor.
Definition: velocity_grid.hpp:17
int nvz
full grid size (including negative and zero)
Definition: velocity_grid.hpp:20
KOKKOS_INLINE_FUNCTION VGridWeights get_weights(double smu, double vp) const
Determines velocity grid weights based on input values of smu and vp.
Definition: velocity_grid.hpp:135
double dvp
grid spacing in parallel velocity
Definition: velocity_grid.hpp:11
double w_10
Definition: vgrid_weights.hpp:12
KOKKOS_INLINE_FUNCTION void weight_by_inv_dsmu(VGridWeights &vgrid_wts) const
Adjusts the perpendicular velocity grid weights by dividing by the dsmu value, considering edge effec...
Definition: velocity_grid.hpp:161
KOKKOS_INLINE_FUNCTION double vperp_n(int ivr) const
Returns the perpendicular velocity corresponding to a given grid index.
Definition: velocity_grid.hpp:93