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 () |
void | cce_send_receive_density (double *density, int x) |
void | cce_send_receive_current (double *jpar, int x) |
void | cce_varpi_grid (double *field_rho_ff) |
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, View< double **, CLayout, HostType > &field) |
void | average_with_neighbor_planes (const Grid< DeviceType > &grid, const DomainDecomposition< DeviceType > &pol_decomp, View< double **, CLayout, HostType > &field) |
void | reduce_over_planes (const Grid< DeviceType > &grid, const DomainDecomposition< DeviceType > &pol_decomp, const View< double **, CLayout, HostType > &field) |
void | calculate_density_field (const Grid< DeviceType > &grid, const DomainDecomposition< DeviceType > &pol_decomp, const FieldFollowingCoordinates &ff, const GyroAverageMatrices< DeviceType > &gyro_avg_matrices, bool is_axisymmetric, const View< double ***, CLayout, DeviceType > &field_rho, View< double **, CLayout, HostType > &field) |
void | calculate_density0_field (const Grid< DeviceType > &grid, const DomainDecomposition< DeviceType > &pol_decomp, bool is_axisymmetric, 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 | ( | 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, | ||
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] | 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< DeviceType > & | gyro_avg_matrices, | ||
bool | is_axisymmetric, | ||
const View< double ***, CLayout, DeviceType > & | 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,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 | ( | double * | jpar, |
int | x | ||
) |
void cce_send_receive_density | ( | double * | 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, | ||
View< double **, CLayout, HostType > & | field | ||
) |
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,out] | field | is the input and output field |
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_psi_surf_map_loc | ( | ) |
void reduce_over_planes | ( | const Grid< DeviceType > & | grid, |
const DomainDecomposition< DeviceType > & | pol_decomp, | ||
const View< double **, CLayout, HostType > & | field | ||
) |
Does a normalized reduction over planes of the fields, and broadcasts the result.
[in] | grid | is the grid object |
[in] | pol_decomp | is the domain decomposition |
[in,out] | field | is the output field |