XGCa
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
charge_sum_and_gyroaverage.cpp File Reference
#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"
Include dependency graph for charge_sum_and_gyroaverage.cpp:

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)
 

Function Documentation

template<KinType KT>
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

Parameters
[in]gridis the grid object
[in]compute_electronsis whether the operation is on electrons or ions
[in,out]chargecontains the computed charge/current densities and the processed charge/current densities
Returns
void

Here is the call graph for this function:

Here is the caller graph for this function:

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

Parameters
[in]gridis the grid object
[in]pol_decompis the domain decomposition
[in,out]fieldis the density field
Returns
void

Here is the call graph for this function:

Here is the caller graph for this function:

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

Parameters
[in]gridis the grid object
[in]density0is the axisymmetric component of the field
[out]den00_1dis the resulting field
Returns
void

Here is the call graph for this function:

Here is the caller graph for this function:

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"

Parameters
[in]gridis the grid object
[in]pol_decompis the domain decomposition
[in]is_axisymmetricis whether the planes can be reduced
[in]smooth_resultsis an option to call a smoothing function
[in]fieldis the input field
[out]field0is the output field
Returns
void

Here is the call graph for this function:

Here is the caller graph for this function:

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"

Parameters
[in]gridis the grid object
[in]pol_decompis the domain decomposition
[in]ffcontains the field following coordinate conversion matrices
[in]gyro_avg_matricesis the vector of precomputed gyroradius matrices
[in]is_axisymmetricis whether the planes can be reduced
[in]use_global_reductionis an algorithm option that can be used if the field can be reduced and there is no gyroaveraging
[in,out]field_rhois the density field of size (nrho+1, nphi, nnode)
[in,out]fieldis the resulting density field
Returns
void

Here is the call graph for this function:

Here is the caller graph for this function:

template<KinType KT>
void cce_all_varpi_grid ( bool  compute_electrons,
const Charge< DeviceType, KT > &  charge 
)

Core-edge coupling calls fortran routine and provides non-gyroaveraged fields

Parameters
[in]compute_electronsis whether the operation is on electrons or ions
[in]chargecontains the computed charge/current densities and the processed charge/current densities
Returns
void

Here is the call graph for this function:

Here is the caller graph for this function:

void cce_send_receive_current ( int  x)

Here is the caller graph for this function:

void cce_send_receive_density ( int  x)

Here is the caller graph for this function:

void cce_varpi_grid ( double *  field_rho_ff)

Here is the caller graph for this function:

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 
)

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"

Parameters
[in]smlcontains simulation control parameters
[in]gridis the grid object
[in]pol_decompis the domain decomposition
[in,out]chargecontains the computed charge/current densities and the processed charge/current densities
[in]plasmais needed for the species profile data
[in]compute_electronsis whether the operation is on electrons or ions
Returns
void

Here is the call graph for this function:

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

Parameters
[in]gridis the grid object
[in]ffcontains the field following coordinate conversion matrices
[in]input_his the input field, in field-following coordinates
[out]output_his the output field, in toroidal coordinates
Returns
void

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
[in]gridis the grid object
[in]plasmacontains the species profile data
[in]checking_electronsis whether this is checking electron density or ion density
[in,out]fieldis the density field
[in,out]field0is the axisymmetric density field
Returns
void

Here is the call graph for this function:

Here is the caller graph for this function:

int get_grid_npsi_surf ( )

Here is the caller graph for this function:

int* get_grid_psi_surf_map_loc ( )

Here is the caller graph for this function:

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)

Parameters
[in]gridis the grid object
[in]pol_decompis the domain decomposition
[in]use_global_reductionis an algorithm option that can be used if the field can be reduced and there is no gyroaveraging
[in,out]field_rhois the density field of size (nrho+1, nphi, nnode)
Returns
void

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
[in]gridis the grid object
[in]pol_decompis the domain decomposition
[in]use_global_reductionis an algorithm option that can be used if the field can be reduced and there is no gyroaveraging
[in]field_inis the input field
[in]fieldis the output field
Returns
void

Here is the call graph for this function:

Here is the caller graph for this function:

void smooth_r_wrap ( double *  input,
double *  output 
)