XGCa
|
#include "timer_macro.hpp"
#include "update_ptl_weights.hpp"
#include "toroidal_average.hpp"
#include "poly_basis.hpp"
#include "moments.hpp"
#include "loadable_buffer.hpp"
#include "flux_surface_average.hpp"
#include "diffusion.hpp"
#include "basic_physics.hpp"
Functions | |
void | smooth_pol_wrap (double *input_array, double *output_array) |
void | fourier_filter_update_analytic (double *alpha) |
void | diffusion_solve (int n, double *buffer, double dt) |
int | get_grid_npsi_surf () |
void | transpose_moments (Plasma &plasma, const Moments &moments_h, View< double *, CLayout, DeviceType > &den, View< double **, CLayout, DeviceType > &u_para, View< double **, CLayout, DeviceType > &T_para, View< double **, CLayout, DeviceType > &T_perp) |
void | smooth_and_filter (const View< double *, CLayout, DeviceType > &view) |
void | smooth_moments (const DomainDecomposition< DeviceType > &pol_decomp, View< double *, CLayout, DeviceType > &den, View< double **, CLayout, DeviceType > &u_para, View< double **, CLayout, DeviceType > &T_para, View< double **, CLayout, DeviceType > &T_perp, bool is_XGCa) |
void | pack_solve_unpack (View< double *, CLayout, DeviceType > &den, View< double **, CLayout, DeviceType > &u_para, View< double **, CLayout, DeviceType > &T_para, View< double **, CLayout, DeviceType > &T_perp, double dt, bool electron_on) |
void | calculate_df_one_sp (const DomainDecomposition< DeviceType > &pol_decomp, const Species< DeviceType > &species, const PolynomialBasis< DeviceType > &polynomial_basis, const VGridDistribution< DeviceType > &f0_f, const View< double *, CLayout, DeviceType > &den, const View< double *, CLayout, DeviceType > &den_old, const View< double **, CLayout, DeviceType > &u_para, const View< double **, CLayout, DeviceType > &T_para, const View< double **, CLayout, DeviceType > &T_perp, const View< bool *, CLayout, DeviceType > &is_in_bounds, VGridDistribution< DeviceType > &delta_f) |
VGridDistribution< DeviceType > | calculate_df (Plasma &plasma, const DomainDecomposition< DeviceType > &pol_decomp, const VelocityGrid &vgrid, const VGridDistribution< DeviceType > &f0_f, const View< double *, CLayout, DeviceType > &den, const View< double *, CLayout, DeviceType > &den_old, const View< double **, CLayout, DeviceType > &u_para, const View< double **, CLayout, DeviceType > &T_para, const View< double **, CLayout, DeviceType > &T_perp, const View< bool *, CLayout, DeviceType > &is_in_bounds) |
void | calculate_flux_surface_averaged_diffs (const View< double *, CLayout, DeviceType > &den_old, const View< double *, CLayout, DeviceType > &den, const View< double **, CLayout, DeviceType > &u_para_old, const View< double **, CLayout, DeviceType > &u_para, const View< double **, CLayout, DeviceType > &T_old, const View< double **, CLayout, DeviceType > &T, View< double *, CLayout, DeviceType > &delta_den00, View< double **, CLayout, DeviceType > &delta_u_para00, View< double **, CLayout, DeviceType > &delta_T00) |
void | calculate_dfM (const DomainDecomposition< DeviceType > &pol_decomp, Plasma &plasma, const View< bool *, CLayout, DeviceType > &is_in_bounds, const View< double *, CLayout, DeviceType > &delta_den00, const View< double **, CLayout, DeviceType > &delta_u_para00, const View< double **, CLayout, DeviceType > &delta_T00, VGridDistribution< DeviceType > &dfM) |
void | update_analytic (const DomainDecomposition< DeviceType > &pol_decomp, Plasma &plasma, const ElectricField< DeviceType > &electric_field, const View< bool *, CLayout, DeviceType > &is_in_bounds, const View< double *, CLayout, DeviceType > &delta_den00, const View< double **, CLayout, DeviceType > &delta_u_para00, const View< double **, CLayout, DeviceType > &delta_T00, bool electron_on, bool is_XGCa, double dpot_te_limit) |
void | add_delta_f_to_f0_df0g (VGridDistribution< DeviceType > &f0_df0g, VGridDistribution< DeviceType > &delta_f) |
void | remove_dfM_from_f0_df0g (VGridDistribution< DeviceType > &f0_df0g, VGridDistribution< DeviceType > &dfM) |
View< bool *, CLayout, DeviceType > | check_is_in_bounds (const Grid< DeviceType > &grid, const DomainDecomposition< DeviceType > &pol_decomp, double inner_psi_bound, double outer_psi_bound) |
void | calculate_full_T (const View< double **, CLayout, DeviceType > &T_perp, const View< double **, CLayout, DeviceType > &T_para, const View< double **, CLayout, DeviceType > &T) |
void add_delta_f_to_f0_df0g | ( | VGridDistribution< DeviceType > & | f0_df0g, |
VGridDistribution< DeviceType > & | delta_f | ||
) |
Adds delta_f to f0_df0g
[in,out] | f0_df0g | Overall change to distribution function |
[in] | delta_f | The change in distribution function inferred from evolution of the moments |
VGridDistribution<DeviceType> calculate_df | ( | Plasma & | plasma, |
const DomainDecomposition< DeviceType > & | pol_decomp, | ||
const VelocityGrid & | vgrid, | ||
const VGridDistribution< DeviceType > & | f0_f, | ||
const View< double *, CLayout, DeviceType > & | den, | ||
const View< double *, CLayout, DeviceType > & | den_old, | ||
const View< double **, CLayout, DeviceType > & | u_para, | ||
const View< double **, CLayout, DeviceType > & | T_para, | ||
const View< double **, CLayout, DeviceType > & | T_perp, | ||
const View< bool *, CLayout, DeviceType > & | is_in_bounds | ||
) |
Calculates delta_f of each species inferred from evolution of the moments
[in] | plasma | Plasma object used to loop over species |
[in] | pol_decomp | Domain decomposition object |
[in] | vgrid | Velocity grid information |
[in] | f0_f | Initial distribution function |
[out] | den | Density moment |
[out] | den_old | Density moment before diffusion |
[out] | u_para | Parallel velocity moment |
[out] | T_para | Parallel temperature moment |
[out] | T_perp | Perpendicular temperature moment |
[in] | is_in_bounds | Whether each mesh node is in bounds return The change in distribution function inferred from evolution of the moments |
void calculate_df_one_sp | ( | const DomainDecomposition< DeviceType > & | pol_decomp, |
const Species< DeviceType > & | species, | ||
const PolynomialBasis< DeviceType > & | polynomial_basis, | ||
const VGridDistribution< DeviceType > & | f0_f, | ||
const View< double *, CLayout, DeviceType > & | den, | ||
const View< double *, CLayout, DeviceType > & | den_old, | ||
const View< double **, CLayout, DeviceType > & | u_para, | ||
const View< double **, CLayout, DeviceType > & | T_para, | ||
const View< double **, CLayout, DeviceType > & | T_perp, | ||
const View< bool *, CLayout, DeviceType > & | is_in_bounds, | ||
VGridDistribution< DeviceType > & | delta_f | ||
) |
Calculates delta_f of one species inferred from evolution of the moments
[in] | pol_decomp | Domain decomposition object |
[in] | species | Species object |
[in] | polynomial_basis | Basis functions to represent distribution with polynomials |
[in] | f0_f | Initial distribution function |
[out] | den | Density moment |
[out] | den_old | Density moment before diffusion |
[out] | u_para | Parallel velocity moment |
[out] | T_para | Parallel temperature moment |
[out] | T_perp | Perpendicular temperature moment |
[in] | is_in_bounds | Whether each mesh node is in bounds |
[in,out] | delta_f | The change in distribution function inferred from evolution of the moments |
void calculate_dfM | ( | const DomainDecomposition< DeviceType > & | pol_decomp, |
Plasma & | plasma, | ||
const View< bool *, CLayout, DeviceType > & | is_in_bounds, | ||
const View< double *, CLayout, DeviceType > & | delta_den00, | ||
const View< double **, CLayout, DeviceType > & | delta_u_para00, | ||
const View< double **, CLayout, DeviceType > & | delta_T00, | ||
VGridDistribution< DeviceType > & | dfM | ||
) |
Calculates the change to the distribution function that was transferred to f0_delta_n etc
[in] | pol_decomp | Domain decomposition object |
[in] | plasma | Plasma object used to loop over species and for analytic moments |
[in] | is_in_bounds | Whether each mesh node is in bounds |
[in] | delta_den00 | Flux surface averaged change in density moment |
[in] | delta_u_para00 | Flux surface averaged change in parallel velocity moment |
[in] | delta_T00 | Flux surface averaged change in temperature moment |
[out] | dfM | The change to the distribution function that was transferred to f0_delta_n etc |
void calculate_flux_surface_averaged_diffs | ( | const View< double *, CLayout, DeviceType > & | den_old, |
const View< double *, CLayout, DeviceType > & | den, | ||
const View< double **, CLayout, DeviceType > & | u_para_old, | ||
const View< double **, CLayout, DeviceType > & | u_para, | ||
const View< double **, CLayout, DeviceType > & | T_old, | ||
const View< double **, CLayout, DeviceType > & | T, | ||
View< double *, CLayout, DeviceType > & | delta_den00, | ||
View< double **, CLayout, DeviceType > & | delta_u_para00, | ||
View< double **, CLayout, DeviceType > & | delta_T00 | ||
) |
Returns the flux surface average of the difference between the old moments and the updated moments. Most of the code is to copy the moments to CPU and the results back to GPU. This can be streamlined when the flux surface average function is moved to C++.
[in] | den_old | Density moment before diffusion |
[in] | den | Density moment |
[in] | u_para_old | Parallel velocity moment before diffusion |
[in] | u_para | Parallel velocity moment |
[in] | T_old | Temperature moments before diffusion |
[in] | T | Temperature moment |
[out] | delta_den00 | Flux surface averaged change in density moment |
[out] | delta_u_para00 | Flux surface averaged change in parallel velocity moment |
[out] | delta_T00 | Flux surface averaged change in temperature moment |
void calculate_full_T | ( | const View< double **, CLayout, DeviceType > & | T_perp, |
const View< double **, CLayout, DeviceType > & | T_para, | ||
const View< double **, CLayout, DeviceType > & | T | ||
) |
View<bool*, CLayout, DeviceType> check_is_in_bounds | ( | const Grid< DeviceType > & | grid, |
const DomainDecomposition< DeviceType > & | pol_decomp, | ||
double | inner_psi_bound, | ||
double | outer_psi_bound | ||
) |
Returns a view marking whether each mesh node is in bounds
[in] | grid | The grid object |
[in] | pol_decomp | The domain decomposition |
[in] | inner_psi_bound | The minimum psi value to be in bounds |
[in] | outer_psi_bound | The maximum psi value to be in bounds return View marking whether each mesh node is in bounds |
void diffusion_solve | ( | int | n, |
double * | buffer, | ||
double | dt | ||
) |
void fourier_filter_update_analytic | ( | double * | alpha | ) |
int get_grid_npsi_surf | ( | ) |
void pack_solve_unpack | ( | View< double *, CLayout, DeviceType > & | den, |
View< double **, CLayout, DeviceType > & | u_para, | ||
View< double **, CLayout, DeviceType > & | T_para, | ||
View< double **, CLayout, DeviceType > & | T_perp, | ||
double | dt, | ||
bool | electron_on | ||
) |
Packs the moments into a buffer formatted for the diffusion solve, calls the solve and unpacks back into the original format. This also transfers the moments from device to host and back
[in,out] | den | Density moment |
[in,out] | u_para | Parallel velocity moment |
[in,out] | T_para | Parallel temperature moment |
[in,out] | T_perp | Perpendicular temperature moment |
[in] | dt | Time step |
[in] | electron_on | Whether kinetic electrons also need to be solved |
void remove_dfM_from_f0_df0g | ( | VGridDistribution< DeviceType > & | f0_df0g, |
VGridDistribution< DeviceType > & | dfM | ||
) |
Subtracts dfM to f0_df0g since this part of the distribution function has been transferred to the analytic f0 representation (f0_delta_n etc)
[in,out] | f0_df0g | Overall change to distribution function |
[in] | dfM | The change to the distribution function that was transferred to f0_delta_n etc |
void smooth_and_filter | ( | const View< double *, CLayout, DeviceType > & | view | ) |
void smooth_moments | ( | const DomainDecomposition< DeviceType > & | pol_decomp, |
View< double *, CLayout, DeviceType > & | den, | ||
View< double **, CLayout, DeviceType > & | u_para, | ||
View< double **, CLayout, DeviceType > & | T_para, | ||
View< double **, CLayout, DeviceType > & | T_perp, | ||
bool | is_XGCa | ||
) |
Toroidally average, smooth and filter the input moments
[in] | pol_decomp | Domain decomposition object for toroidal averaging |
[in,out] | den | Density moment |
[in,out] | u_para | Parallel velocity moment |
[in,out] | T_para | Parallel temperature moment |
[in,out] | T_perp | Perpendicular temperature moment |
void smooth_pol_wrap | ( | double * | input_array, |
double * | output_array | ||
) |
void transpose_moments | ( | Plasma & | plasma, |
const Moments & | moments_h, | ||
View< double *, CLayout, DeviceType > & | den, | ||
View< double **, CLayout, DeviceType > & | u_para, | ||
View< double **, CLayout, DeviceType > & | T_para, | ||
View< double **, CLayout, DeviceType > & | T_perp | ||
) |
Transposes the moments and sends to device. The moments in the Moments class have species as the contiguous index, while the functions in diffusion expect those reversed. The moments class is also only for nonadiabatic species, so adiabatic electrons are handled separately here.
[in] | plasma | Plasma object used to loop over species |
[in] | moments_h | Moments |
[out] | den | Density moment |
[out] | u_para | Parallel velocity moment |
[out] | T_para | Parallel temperature moment |
[out] | T_perp | Perpendicular temperature moment |
void update_analytic | ( | const DomainDecomposition< DeviceType > & | pol_decomp, |
Plasma & | plasma, | ||
const ElectricField< DeviceType > & | electric_field, | ||
const View< bool *, CLayout, DeviceType > & | is_in_bounds, | ||
const View< double *, CLayout, DeviceType > & | delta_den00, | ||
const View< double **, CLayout, DeviceType > & | delta_u_para00, | ||
const View< double **, CLayout, DeviceType > & | delta_T00, | ||
bool | electron_on, | ||
bool | is_XGCa, | ||
double | dpot_te_limit | ||
) |
Updates delta_n, delta_u, and delta_T for each species, based on the flux surface averaged moment changes
[in] | pol_decomp | Domain decomposition object |
[in,out] | plasma | Plasma object to be updated |
[in] | electric_field | Used for dpot to remove adiabatic response |
[in] | is_in_bounds | Whether each mesh node is in bounds |
[in] | delta_den00 | Flux surface averaged change in density moment |
[in] | delta_u_para00 | Flux surface averaged change in parallel velocity moment |
[in] | delta_T00 | Flux surface averaged change in temperature moment |
[in] | electron_on | Whether electrons are kinetic |
[in] | is_XGCa | Whether simulation is XGCa. dpot is toroidally averaged but this is not needed for XGCa due to axisymmetry |
[in] | dpot_te_limit | Limit for dpot. This should be removed eventually (it should be a member variable of a dpot class) |