XGCa
|
#include "timer_macro.hpp"
#include "my_subview.hpp"
#include "field_following_coordinates.hpp"
#include "gyro_avg_mat.hpp"
#include "gradient_matrices.hpp"
#include "linear_1d_interpolation.hpp"
#include "charge_sum_and_gyroaverage.hpp"
Functions | |
int * | get_grid_psi_surf_map_loc () |
int | get_grid_npsi_surf () |
void | cce_send_receive_density (int x) |
void | cce_send_receive_current (int x) |
void | cce_varpi_grid (double *field_rho_ff) |
void | convert_grid_2_001d_wrap (double *input, double *output) |
void | smooth_r_wrap (double *input, double *output) |
void | ensure_density_above_zero (const Grid< DeviceType > &grid, Plasma &plasma, bool checking_electrons, View< double **, CLayout, HostType > &field, View< double *, CLayout, HostType > &field0) |
void | convert_density_field_coordinates (const Grid< DeviceType > &grid, const FieldFollowingCoordinates &ff, const View< double **, CLayout, HostType > &input_h, View< double **, CLayout, HostType > &output_h) |
void | reduce_and_normalize_rho0_field (const Grid< DeviceType > &grid, const DomainDecomposition< DeviceType > &pol_decomp, bool use_global_reduction, View< double ***, CLayout, HostType > &field_rho) |
void | average_with_neighbor_planes_and_broadcast (const Grid< DeviceType > &grid, const DomainDecomposition< DeviceType > &pol_decomp, View< double **, CLayout, HostType > &field) |
void | reduce_over_planes_and_broadcast (const Grid< DeviceType > &grid, const DomainDecomposition< DeviceType > &pol_decomp, bool use_global_reduction, const View< double **, CLayout, HostType > &field_in, View< double **, CLayout, HostType > &field) |
void | calculate_density_field (const Grid< DeviceType > &grid, const DomainDecomposition< DeviceType > &pol_decomp, const FieldFollowingCoordinates &ff, const GyroAverageMatrices< HostType > &gyro_avg_matrices, bool is_axisymmetric, bool use_global_reduction, View< double ***, CLayout, HostType > &field_rho, View< double **, CLayout, HostType > &field) |
void | calculate_density0_field (const Grid< DeviceType > &grid, const DomainDecomposition< DeviceType > &pol_decomp, bool is_axisymmetric, bool smooth_results, const View< double **, CLayout, HostType > &field, View< double *, CLayout, HostType > &field0) |
void | calculate_den00_1d (const Grid< DeviceType > &grid, const View< double *, CLayout, HostType > density0, View< double *, CLayout, HostType > den00_1d) |
template<KinType KT> | |
void | add_f0_charge_contribution (const Grid< DeviceType > &grid, bool compute_electrons, Charge< DeviceType, KT > &charge) |
template<KinType KT> | |
void | cce_all_varpi_grid (bool compute_electrons, const Charge< DeviceType, KT > &charge) |
template<KinType KT> | |
void | charge_sum_and_gyroaverage (const Simulation< DeviceType > &sml, const Grid< DeviceType > &grid, const DomainDecomposition< DeviceType > &pol_decomp, Charge< DeviceType, KT > &charge, Plasma &plasma, bool compute_electrons) |
template void | charge_sum_and_gyroaverage< GyroKin > (const Simulation< DeviceType > &sml, const Grid< DeviceType > &grid, const DomainDecomposition< DeviceType > &pol_decomp, Charge< DeviceType, GyroKin > &charge, Plasma &plasma, bool compute_electrons) |
template void | charge_sum_and_gyroaverage< DriftKin > (const Simulation< DeviceType > &sml, const Grid< DeviceType > &grid, const DomainDecomposition< DeviceType > &pol_decomp, Charge< DeviceType, DriftKin > &charge, Plasma &plasma, bool compute_electrons) |
void add_f0_charge_contribution | ( | const Grid< DeviceType > & | grid, |
bool | compute_electrons, | ||
Charge< DeviceType, KT > & | charge | ||
) |
Adds the grid-based component of the density field to the charge density
[in] | grid | is the grid object |
[in] | compute_electrons | is whether the operation is on electrons or ions |
[in,out] | charge | contains the computed charge/current densities and the processed charge/current densities |
void average_with_neighbor_planes_and_broadcast | ( | const Grid< DeviceType > & | grid, |
const DomainDecomposition< DeviceType > & | pol_decomp, | ||
View< double **, CLayout, HostType > & | field | ||
) |
Averages the field with the neighboring plane
[in] | grid | is the grid object |
[in] | pol_decomp | is the domain decomposition |
[in,out] | field | is the density field |
void calculate_den00_1d | ( | const Grid< DeviceType > & | grid, |
const View< double *, CLayout, HostType > | density0, | ||
View< double *, CLayout, HostType > | den00_1d | ||
) |
Averages axisymmetric field over flux surfaces and interpolates into flux surface coordinates
[in] | grid | is the grid object |
[in] | density0 | is the axisymmetric component of the field |
[out] | den00_1d | is the resulting field |
void calculate_density0_field | ( | const Grid< DeviceType > & | grid, |
const DomainDecomposition< DeviceType > & | pol_decomp, | ||
bool | is_axisymmetric, | ||
bool | smooth_results, | ||
const View< double **, CLayout, HostType > & | field, | ||
View< double *, CLayout, HostType > & | field0 | ||
) |
Calculates the axisymmetric component of the field "field0" from the input field "field"
[in] | grid | is the grid object |
[in] | pol_decomp | is the domain decomposition |
[in] | is_axisymmetric | is whether the planes can be reduced |
[in] | smooth_results | is an option to call a smoothing function |
[in] | field | is the input field |
[out] | field0 | is the output field |
void calculate_density_field | ( | const Grid< DeviceType > & | grid, |
const DomainDecomposition< DeviceType > & | pol_decomp, | ||
const FieldFollowingCoordinates & | ff, | ||
const GyroAverageMatrices< HostType > & | gyro_avg_matrices, | ||
bool | is_axisymmetric, | ||
bool | use_global_reduction, | ||
View< double ***, CLayout, HostType > & | field_rho, | ||
View< double **, CLayout, HostType > & | field | ||
) |
Takes the field resulting from the scatter, which may have a gyroradius dimension and may be in field-following coordinates. Gyroaverages this field and converts coordinates as needed, and does a reduction on planes if planar data is not needed. Results are written to "field"
[in] | grid | is the grid object |
[in] | pol_decomp | is the domain decomposition |
[in] | ff | contains the field following coordinate conversion matrices |
[in] | gyro_avg_matrices | is the vector of precomputed gyroradius matrices |
[in] | is_axisymmetric | is whether the planes can be reduced |
[in] | use_global_reduction | is an algorithm option that can be used if the field can be reduced and there is no gyroaveraging |
[in,out] | field_rho | is the density field of size (nrho+1, nphi, nnode) |
[in,out] | field | is the resulting density field |
void cce_all_varpi_grid | ( | bool | compute_electrons, |
const Charge< DeviceType, KT > & | charge | ||
) |
Core-edge coupling calls fortran routine and provides non-gyroaveraged fields
[in] | compute_electrons | is whether the operation is on electrons or ions |
[in] | charge | contains the computed charge/current densities and the processed charge/current densities |
void cce_send_receive_current | ( | int | x | ) |
void cce_send_receive_density | ( | int | x | ) |
void cce_varpi_grid | ( | double * | field_rho_ff | ) |
void charge_sum_and_gyroaverage | ( | const Simulation< DeviceType > & | sml, |
const Grid< DeviceType > & | grid, | ||
const DomainDecomposition< DeviceType > & | pol_decomp, | ||
Charge< DeviceType, KT > & | charge, | ||
Plasma & | plasma, | ||
bool | compute_electrons | ||
) |
Takes the field resulting from the scatter, which may have a gyroradius dimension and may be in field-following coordinates. Gyroaverages this field and converts coordinates as needed, and does a reduction on planes if planar data is not needed. Results are written to "field"
[in] | sml | contains simulation control parameters |
[in] | grid | is the grid object |
[in] | pol_decomp | is the domain decomposition |
[in,out] | charge | contains the computed charge/current densities and the processed charge/current densities |
[in] | plasma | is needed for the species profile data |
[in] | compute_electrons | is whether the operation is on electrons or ions |
template void charge_sum_and_gyroaverage< DriftKin > | ( | const Simulation< DeviceType > & | sml, |
const Grid< DeviceType > & | grid, | ||
const DomainDecomposition< DeviceType > & | pol_decomp, | ||
Charge< DeviceType, DriftKin > & | charge, | ||
Plasma & | plasma, | ||
bool | compute_electrons | ||
) |
template void charge_sum_and_gyroaverage< GyroKin > | ( | const Simulation< DeviceType > & | sml, |
const Grid< DeviceType > & | grid, | ||
const DomainDecomposition< DeviceType > & | pol_decomp, | ||
Charge< DeviceType, GyroKin > & | charge, | ||
Plasma & | plasma, | ||
bool | compute_electrons | ||
) |
void convert_density_field_coordinates | ( | const Grid< DeviceType > & | grid, |
const FieldFollowingCoordinates & | ff, | ||
const View< double **, CLayout, HostType > & | input_h, | ||
View< double **, CLayout, HostType > & | output_h | ||
) |
Converts from field-following coordinates to toroidal coordinates. The computation is done on device, so the input/output are copied from/to host
[in] | grid | is the grid object |
[in] | ff | contains the field following coordinate conversion matrices |
[in] | input_h | is the input field, in field-following coordinates |
[out] | output_h | is the output field, in toroidal coordinates |
void convert_grid_2_001d_wrap | ( | double * | input, |
double * | output | ||
) |
void ensure_density_above_zero | ( | const Grid< DeviceType > & | grid, |
Plasma & | plasma, | ||
bool | checking_electrons, | ||
View< double **, CLayout, HostType > & | field, | ||
View< double *, CLayout, HostType > & | field0 | ||
) |
Ensures that the total density (calculated density plus the background profile) of [electrons,ions] is not [positive,negative], by adjusting the calculated density to meet this criterion. The axisymmetric field, field0, is checked independently, so the two resulting fields may no longer be consistent.
[in] | grid | is the grid object |
[in] | plasma | contains the species profile data |
[in] | checking_electrons | is whether this is checking electron density or ion density |
[in,out] | field | is the density field |
[in,out] | field0 | is the axisymmetric density field |
int get_grid_npsi_surf | ( | ) |
int* get_grid_psi_surf_map_loc | ( | ) |
void reduce_and_normalize_rho0_field | ( | const Grid< DeviceType > & | grid, |
const DomainDecomposition< DeviceType > & | pol_decomp, | ||
bool | use_global_reduction, | ||
View< double ***, CLayout, HostType > & | field_rho | ||
) |
Does a normalized intraplane reduction of the fields. If using the "use_global_reduction" algorithm, the reduction is full-domain (i.e. interplane as well)
[in] | grid | is the grid object |
[in] | pol_decomp | is the domain decomposition |
[in] | use_global_reduction | is an algorithm option that can be used if the field can be reduced and there is no gyroaveraging |
[in,out] | field_rho | is the density field of size (nrho+1, nphi, nnode) |
void reduce_over_planes_and_broadcast | ( | const Grid< DeviceType > & | grid, |
const DomainDecomposition< DeviceType > & | pol_decomp, | ||
bool | use_global_reduction, | ||
const View< double **, CLayout, HostType > & | field_in, | ||
View< double **, CLayout, HostType > & | field | ||
) |
Does a normalized reduction over planes of the fields, and broadcasts the result. If using the "use_global_reduction" algorithm, no reduction or broadcast is needed here since this was done earlier.
[in] | grid | is the grid object |
[in] | pol_decomp | is the domain decomposition |
[in] | use_global_reduction | is an algorithm option that can be used if the field can be reduced and there is no gyroaveraging |
[in] | field_in | is the input field |
[in] | field | is the output field |
void smooth_r_wrap | ( | double * | input, |
double * | output | ||
) |