XGC1
 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 ()
 
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)
 

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 ( 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,
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]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< 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"

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,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 ( double *  jpar,
int  x 
)

Here is the caller graph for this function:

void cce_send_receive_density ( double *  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,
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

Parameters
[in]gridis the grid object
[in]ffcontains the field following coordinate conversion matrices
[in,out]fieldis the input and output field
Returns
void

Here is the call graph for this function:

Here is the caller graph for this function:

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_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.

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

Here is the call graph for this function:

Here is the caller graph for this function: