XGCa
Modules | Macros | Functions/Subroutines | Variables
f0module.F90 File Reference
#include "adios_macro.h"
#include "mom_module.F90"
Include dependency graph for f0module.F90:

Modules

module  f0_module
 

Macros

#define OMP_ATOMIC   !$omp atomic
 

Functions/Subroutines

real(8) function f0_module::exp_ad (x)
 adjusted exponential function for adiabatic response More...
 
subroutine f0_module::set_f0_f0g_ptr (f0_inode1_new, f0_inode2_new, f0_f0g_cpp)
 
subroutine f0_module::f0_init_decomposed_ptrs (f0_T_ev_cpp, f0_fg_T_ev_cpp, f0_inv_grid_vol_cpp, f0_grid_vol_cpp, f0_grid_vol_vonly_cpp, f0_den_cpp, f0_flow_cpp)
 
subroutine f0_module::f0_get_f0g (grid, isp, itr, p, phi, mu_n_in, vp_n, f0g, err)
 Interpolates the grid distribution function to real space, velocity space location given by node, mu_n,vp_n. In poloidal plane it uses nearest neighbor and velocity space linear interpolation. More...
 
subroutine f0_module::f0_set_ptrs (nnode, f0_delta_n_cpp, f0_delta_u_cpp, f0_delta_T_cpp)
 Sets pointers to cpp arrays for f0 arrays. More...
 
real(8) function f0_module::f0_mu_vol_fac (ivr)
 Returns the v_perp/mu boundary factor for velocity integration Boundary vertices have only half the volume of an interior vertex. More...
 
real(8) function f0_module::f0_vp_vol_fac (ivz)
 Returns the v_parallel boundary factor for velocity integration Boundary vertices have only half the volume of an interior vertex. More...
 
subroutine f_heat_torque_2 (isp, mass, f0_f, f0_df0g, dt)
 Applies heat and torque sources Uses functionalities from mom_module and diffusion.F90 The modification df of the distribution function is evaluated with a set of orthonormal basis polynomials in v-space The following logic is applied: Toroidal rotation and torque source are treated as rigid body rotation. The time derivative of the angular velocity is dw/dt = T/I_tot, where T is the external torque and I_tot is the total moment of inertia of each source region. From dw/dt one obtains the time derivative of the local mean flow as du_para/dt = R B/B_phi * dw/dt * S(psi). S(psi) is the shape function of the source region. The change of the total energy in each region is given by delta_E_tot=P*delta_t, where P is the input power. The change of the energy at each node is proportional to the energy at the node delta_E_loc = delta_E_tot/E_tot * S(psi) E_loc. This makes sure that sum(delta_E_loc*S(psi_loc))=delta_E_tot. The change of the local temperature is the difference between delta_E_loc and the change of the kinetic energy of the mean flow: delta_T_loc = 2/(3*e*n*vol) * [delta_E_loc - m/2 n vol (2 u*delta_u + delta_u^2)]. More...
 
subroutine poly_basis_setup (grid, isp, f0_f, n_poly, polynom, polynom_norm)
 Sets up a moment matrix of the current plasma distribution function and computes orthonormal polynomial basis for scaling of the plasma distribution function Polynomials: lambda_i = sum_[j=1]^4 c_[i,j] gamma_j where gamma_1 = 1, gamma_2 = v_||, gamma_3 = v_||^2, gamma_4 = v_pe^2, Inner product <lambda_i,lambda_j> = int[lambda_i lambda_j f d^3 v] Moment matrix defined by inner products <gamma_i,gamma_j> Gamma = | <1,1> <1 ,v_||> <1 ,v_||^2> <1 ,v_pe^2> | | <v_||,v_||> <v_|| ,v_||^2> <v_|| ,v_pe^2> | | <v_||^2,v_||^2> <v_||^2,v_pe^2> | | <v_pe^2,v_pe^2> |. More...
 
subroutine eval_scaling_polynom (grid, den0, den, u_para, T_para, T_perp, isp, f0_f, delta_f, n_poly, polynom, polynom_norm)
 Computes the new distribution function after a diffusion time step by evaluating the scaling polynomials with the precomputed basis polynomials and the new moments (n,v_||,mu,v_||^2) More...
 
subroutine f_heat_torque_org (isp, mass, c_m, t_ev, f0_f, f0_df0g, dt)
 
subroutine get_radial_factor (psi, dr, dz, pi, po, bdi, bdo, over_w, special_mode, ishape, factor)
 sub-subroutine to get radial (psi) factor trapezoid or gaussian More...
 
subroutine check_inside_source_region (special_mode, rgn, dr, dz, psi, bdi, bdo, rad_sqr, is_affected)
 

Variables

integer f0_module::f0_nmu
 
integer f0_module::f0_nvp
 
real(8), dimension(:,:,:,:), pointer f0_module::f0_f0g => NULL()
 Stores the slow varying grid part of the distribution function. More...
 
real(8) f0_module::f0_smu_max
 
real(8) f0_module::f0_vp_max
 
real(8) f0_module::f0_dsmu
 
real(8) f0_module::f0_dvp
 
real(8), dimension(:,:), pointer f0_module::f0_inv_grid_vol
 
real(8), dimension(:,:), pointer f0_module::f0_grid_vol
 
real(8), dimension(:,:), pointer f0_module::f0_grid_vol_vonly
 
real(8), dimension(:,:), pointer f0_module::f0_den
 
real(8), dimension(:,:), pointer f0_module::f0_t_ev
 
real(8), dimension(:,:), pointer f0_module::f0_flow
 
real(8), dimension(:,:), pointer f0_module::f0_fg_t_ev
 
real(8), dimension(:,:), pointer f0_module::f0_delta_n
 Flux-surface averaged change of density. More...
 
real(8), dimension(:,:), pointer f0_module::f0_delta_u
 Flux-surface averaged change of parallel flow. More...
 
real(8), dimension(:,:), pointer f0_module::f0_delta_t
 Flux-surface averaged change of temperature. More...
 
real(kind=8), parameter f0_module::f0_mu0_factor =3D0
 Set value of lowest mu in grid --> 1/f0_mu0_factor. More...
 
logical f0_module::f0_use_linear_adiabatic = .false.
 
real(8), parameter f0_module::f0_linear_adiabatic_bd =0.7
 

Macro Definition Documentation

◆ OMP_ATOMIC

#define OMP_ATOMIC   !$omp atomic

Function/Subroutine Documentation

◆ check_inside_source_region()

subroutine check_inside_source_region ( integer, intent(in)  special_mode,
integer, intent(in)  rgn,
real (8), intent(in)  dr,
real (8), intent(in)  dz,
real (8), intent(in)  psi,
real (8), intent(in)  bdi,
real (8), intent(in)  bdo,
real (8), intent(in)  rad_sqr,
logical, intent(out)  is_affected 
)
Here is the caller graph for this function:

◆ eval_scaling_polynom()

subroutine eval_scaling_polynom ( type(grid_type), intent(in)  grid,
real (kind=8), dimension(f0_inode1:f0_inode2), intent(in)  den0,
real (kind=8), dimension(f0_inode1:f0_inode2), intent(in)  den,
real (kind=8), dimension(f0_inode1:f0_inode2), intent(in)  u_para,
real (kind=8), dimension(f0_inode1:f0_inode2), intent(in)  T_para,
real (kind=8), dimension(f0_inode1:f0_inode2), intent(in)  T_perp,
integer, intent(in)  isp,
real (8), dimension(-f0_nvp:f0_nvp, f0_inode1:f0_inode2, 0:f0_nmu, ptl_isp:ptl_nsp), intent(in)  f0_f,
real (kind=8), dimension(-f0_nvp:f0_nvp,f0_inode1:f0_inode2,0:f0_nmu), intent(out)  delta_f,
integer, intent(in)  n_poly,
real (8), dimension(n_poly,n_poly,f0_inode1:f0_inode2), intent(inout)  polynom,
real (8), dimension(n_poly,f0_inode1:f0_inode2), intent(inout)  polynom_norm 
)

Computes the new distribution function after a diffusion time step by evaluating the scaling polynomials with the precomputed basis polynomials and the new moments (n,v_||,mu,v_||^2)

Ansatz: g = sum_[i=1]^4 d_i lambda_i f ==> d_i = int(lambda_i g d^3v) / <lambda_i,lambda_i> = sum_[j=1]^4 c_[i,j] int(gamma_j g d^3v) / <lambda_i,lambda_i> After some manipulation —> g = f sum_[k=1]^4 D_k gamma_k with D_k = sum_[i,j=1]^4 int(gamma_j g d^3v * c_[i,j]*c_[i,k] / <lambda_i,lambda_i>

Parameters
[in]gridGrid data, type(gridtype)
[in]den0Density prior to diffusion step, real(8)
[in]denDensity after diffusion step, real(8)
[in]u_paraParallel flow after diffusion step, real(8)
[in]T_paraPara. Temperature after diffusion step, real(8)
[in]T_perpPerp. Temperature after diffusion step, real(8)
[in]alphaRatio of parallel to perp temperature prior to diffusion step, real(8)
[in]ispSpecies index, integer
[in]f0_fFull distribution function, real(8)
[out]delta_fChange of the distribution function due to anomalous diffusion, real(8)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ f_heat_torque_2()

subroutine f_heat_torque_2 ( integer, intent(in), value  isp,
real(8), intent(in), value  mass,
real (8), dimension(-f0_nvp:f0_nvp, f0_inode1:f0_inode2, 0:f0_nmu, ptl_isp:ptl_nsp), intent(in)  f0_f,
real (8), dimension(-f0_nvp:f0_nvp, f0_inode1:f0_inode2, 0:f0_nmu, ptl_isp:ptl_nsp), intent(inout)  f0_df0g,
real(8), intent(in), value  dt 
)

Applies heat and torque sources Uses functionalities from mom_module and diffusion.F90 The modification df of the distribution function is evaluated with a set of orthonormal basis polynomials in v-space The following logic is applied: Toroidal rotation and torque source are treated as rigid body rotation. The time derivative of the angular velocity is dw/dt = T/I_tot, where T is the external torque and I_tot is the total moment of inertia of each source region. From dw/dt one obtains the time derivative of the local mean flow as du_para/dt = R B/B_phi * dw/dt * S(psi). S(psi) is the shape function of the source region. The change of the total energy in each region is given by delta_E_tot=P*delta_t, where P is the input power. The change of the energy at each node is proportional to the energy at the node delta_E_loc = delta_E_tot/E_tot * S(psi) E_loc. This makes sure that sum(delta_E_loc*S(psi_loc))=delta_E_tot. The change of the local temperature is the difference between delta_E_loc and the change of the kinetic energy of the mean flow: delta_T_loc = 2/(3*e*n*vol) * [delta_E_loc - m/2 n vol (2 u*delta_u + delta_u^2)].

Parameters
[in]ispSpecies index (integer)
[in]massSpecies particle mass (real(8))
[in]nareaNumber of source areas (integer)
[in]f0_fFull distribution function
[in,out]f0_df0gDistribution function
Here is the call graph for this function:

◆ f_heat_torque_org()

subroutine f_heat_torque_org ( integer, intent(in), value  isp,
real(8), intent(in), value  mass,
real(8), intent(in), value  c_m,
real(8), dimension(grid%nnode), intent(in)  t_ev,
real (8), dimension(-f0_nvp:f0_nvp, f0_inode1:f0_inode2, 0:f0_nmu, ptl_isp:ptl_nsp), intent(in)  f0_f,
real (8), dimension(-f0_nvp:f0_nvp, f0_inode1:f0_inode2, 0:f0_nmu, ptl_isp:ptl_nsp), intent(inout)  f0_df0g,
real(8), intent(in), value  dt 
)
Here is the call graph for this function:

◆ get_radial_factor()

subroutine get_radial_factor ( real (8), intent(in)  psi,
real (8), intent(in)  dr,
real (8), intent(in)  dz,
real (8), intent(in)  pi,
real (8), intent(in)  po,
real (8), intent(in)  bdi,
real (8), intent(in)  bdo,
real (8), intent(in)  over_w,
integer, intent(in)  special_mode,
integer, intent(in)  ishape,
real (8), intent(out)  factor 
)

sub-subroutine to get radial (psi) factor trapezoid or gaussian

Here is the caller graph for this function:

◆ poly_basis_setup()

subroutine poly_basis_setup ( type(grid_type), intent(in)  grid,
integer, intent(in)  isp,
real (8), dimension(-f0_nvp:f0_nvp, f0_inode1:f0_inode2, 0:f0_nmu, ptl_isp:ptl_nsp), intent(in)  f0_f,
integer, intent(in)  n_poly,
real (8), dimension(n_poly,n_poly,f0_inode1:f0_inode2), intent(inout)  polynom,
real (8), dimension(n_poly,f0_inode1:f0_inode2), intent(inout)  polynom_norm 
)

Sets up a moment matrix of the current plasma distribution function and computes orthonormal polynomial basis for scaling of the plasma distribution function Polynomials: lambda_i = sum_[j=1]^4 c_[i,j] gamma_j where gamma_1 = 1, gamma_2 = v_||, gamma_3 = v_||^2, gamma_4 = v_pe^2, Inner product <lambda_i,lambda_j> = int[lambda_i lambda_j f d^3 v] Moment matrix defined by inner products <gamma_i,gamma_j> Gamma = | <1,1> <1 ,v_||> <1 ,v_||^2> <1 ,v_pe^2> | | <v_||,v_||> <v_|| ,v_||^2> <v_|| ,v_pe^2> | | <v_||^2,v_||^2> <v_||^2,v_pe^2> | | <v_pe^2,v_pe^2> |.

===> <lambda_i,lambda_j> = sum_[k,l=1]^4 c_[i,k] Gamma_[k,l] c_[j,l] ==> lambda_i^T.A.lambda_k The coefficients c_[i,l] are calculated with Gram-Schmidt process lambda_i = gamma_i - sum_[j=1]^[i-1] <gamma_i,lambda_j>/<lambda_j,lambda_j> lambda_j

The coefficients of the basis polynomials are stored in a 4x4 matrix, The inner products in the matrix A are stored in a 10-element vector starting with the main diagonal, then going through the upper side diagonals.

The moments in the matrix Gamma are evaluated from the global variable storing the distribution function --> f0_f

The coefficients c_[i,j] of the basis polynomials are stored in "diff_polynom" and the norms <lambda_i,lambda_i> are stored in "polynom_norm"

Parameters
[in]gridGrid data, type(grid_type)
[in]ispSpecies index, integer
[in]f0_ffull distribution function, real(8)
Here is the call graph for this function:
Here is the caller graph for this function: