libfida Module

Main FIDASIM library


Uses

  • module~~libfida~~UsesGraph module~libfida libfida iso_c_binding iso_c_binding module~libfida->iso_c_binding module~eigensystem eigensystem module~libfida->module~eigensystem module~mpi_utils mpi_utils module~libfida->module~mpi_utils module~utilities utilities module~libfida->module~utilities HDF5 HDF5 module~libfida->HDF5 module~hdf5_utils hdf5_utils module~libfida->module~hdf5_utils H5LT H5LT module~libfida->H5LT module~utilities->iso_c_binding omp_lib omp_lib module~utilities->omp_lib module~hdf5_utils->HDF5 module~hdf5_utils->H5LT

Used by

  • module~~libfida~~UsedByGraph module~libfida libfida program~fidasim fidasim program~fidasim->module~libfida

Contents

print_banner fast_ion_assign npa_part_assign birth_part_assign neutral_part_assign npr_assign np_assign pp_assign lpp_assign plp_assign lplp_assign ff_assign lff_assign flf_assign lflf_assign oo_assign read_inputs identify_transition make_beam_grid make_passive_grid make_diagnostic_grids read_beam read_chords read_npa read_cfpd read_plasma read_equilibrium read_f read_mc read_distribution quasineutrality_check read_atomic_cross read_atomic_rate read_atomic_transitions read_nuclear_rates read_tables write_beam_grid write_birth_profile write_neutral_population write_neutrals write_npa write_spectra write_neutrons write_cfpd_weights write_fida_weights write_npa_weights read_neutral_population read_neutrals tb_zyx line_basis plane_basis line_plane_intersect line_cylinder_intersect boundary_edge gyro_surface line_gyro_surface_intersect gyro_surface_coordinates gyro_trajectory gyro_range npa_gyro_range hit_npa_detector xyz_to_uvw xyz_to_cyl uvw_to_xyz cyl_to_uvw cyl_to_xyz uvw_to_cyl convert_sightline_to_xyz grid_intersect circle_grid_intersect get_indices get_passive_grid_indices get_interpolation_grid_indices get_plasma_extrema get_position track track_cylindrical in_plasma get_plasma calc_perp_vectors get_fields get_distribution get_ep_denf init_reservoir update_reservoir merge_reservoirs init_neutral_population free_neutral_population update_neutrals store_neutrals merge_neutral_populations parallel_merge_reservoirs parallel_merge_populations store_births store_npa bb_cx_rates bt_cx_rates get_dd_rate get_ddpt_anisotropy get_pgyro neutral_cx_rate get_total_cx_rate get_rate_matrix colrad attenuate doppler_stark spectrum store_photons store_nbi_photons store_fida_photons store_photon_birth store_neutrons store_fw_photons_at_chan store_fw_photons get_nlaunch get_nlaunch_pass_grid pitch_to_vec gyro_step gyro_correction mc_beam_grid mc_passive_grid mc_fastion mc_fastion_pass_grid mc_halo mc_nbi mc_nbi_cell ndmc dcx halo nbi_spec dcx_spec halo_spec cold_spec bremsstrahlung fida_f pfida_f fida_mc pfida_mc npa_f pnpa_f npa_mc pnpa_mc neutron_f cfpd_f neutron_mc fida_weights_mc fida_weights_los npa_weights

Variables

TypeVisibilityAttributesNameInitial
character(len=30), public :: version =''

FIDASIM version number

integer, public, dimension(8):: time_start

Start time

integer, public, parameter:: charlim =150

Defines character limit for files and directories

character, public :: namelist_file

Input namelist file

integer, public, parameter:: nbif_type =1

Identifier for full energy NBI neutral interaction

integer, public, parameter:: nbih_type =2

Identifier for half energy NBI neutral interaction

integer, public, parameter:: nbit_type =3

Identifier for third energy NBI neutral interaction

integer, public, parameter:: dcx_type =4

Identifier for dcx neutral interaction

integer, public, parameter:: halo_type =5

Identifier for halo neutral interaction

integer, public, parameter:: fida_type =6

Identifier for fida neutral interaction

integer, public, parameter:: brems_type =7

Identifier for bremsstrahlung interaction. Acts as dummy type

integer, public, parameter:: ntypes =7

Number of different types of neutrals

real(kind=Float64), public, parameter:: e_amu =5.48579909070d-4

Atomic mass of an electron [amu]

real(kind=Float64), public, parameter:: H1_amu =1.007276466879d0

Atomic mass of Hydrogen-1 (protium) [amu]

real(kind=Float64), public, parameter:: H2_amu =2.013553212745d0

Atomic mass of Hydrogen-2 (deuterium) [amu]

real(kind=Float64), public, parameter:: H3_amu =3.01550071632d0

Atomic mass of Hydrogen-3 (tritium) [amu]

real(kind=Float64), public, parameter:: He3_amu =3.01602931914d0

Atomic mass of Helium-3 [amu]

real(kind=Float64), public, parameter:: B5_amu =10.81d0

Atomic mass of Boron [amu]

real(kind=Float64), public, parameter:: C6_amu =12.011d0

Atomic mass of Carbon [amu]

real(kind=Float64), public, parameter:: mass_u =1.660539040d-27

Atomic mass unit [kg]

real(kind=Float64), public, parameter:: e0 =1.60217733d-19

Electron charge [C]

real(kind=Float64), public, parameter:: pi =3.14159265358979323846264d0

Pi

real(kind=Float64), public, parameter:: c0 =2.99792458d+08

Speed of light [m/s]

real(kind=Float64), public, parameter:: h_planck =4.135667516d-15

Planck's constant [eV*s]

real(kind=Float64), public, parameter:: v2_to_E_per_amu =mass_u/(2.*e0*1.d3)*1.d-4

to keV conversion factor

real(kind=Float64), public, parameter:: log_10 =log(10.d0)

Natural log of 10.0

real(kind=Float64), public, parameter:: a_0 =5.29177210903d-11

bohr radius in [m]

real(kind=Float64), public :: line_lambda0(3) =[0.00000d0, 0.00000d0, 0.00000d0]

H/D/T emission lines [nm]

integer, public :: n_stark =0

Number of Stark lines

real(kind=Float64), public, dimension(:), allocatable:: stark_wavel

Stark wavelengths [nm*m/V]

real(kind=Float64), public, dimension(:), allocatable:: stark_intens

Stark Intensities

integer, public, dimension(:), allocatable:: stark_pi

Pi line indicators

integer, public, dimension(:), allocatable:: stark_sigma

Sigma line indicators

integer, public :: initial_state =0

intial state energy level of transition

integer, public :: final_state =0

final state energy level of transition

integer, public, parameter:: nlevs =6

Number of atomic energy levels

integer, public :: nbi_outside =0

Keeps track of how many beam neutrals do not hit the beam_grid

integer, public, parameter:: reservoir_size =50

Size of Neutral Particle Reservoir

integer, public :: istart =1

Starting loop counter (1 if OpenMP, processor number if MPI)

integer, public :: istep =1

Loop step size (1 if OpenMP, number of processes if MPI)

integer, public, parameter:: max_species =3

Maximum number of thermal isotopes

real(kind=Float64), public, parameter:: supported_masses(max_species) =[H1_amu, H2_amu, H3_amu]

Supported Hydrogen isotopes masses [amu]

integer, public :: n_thermal =1

Number of thermal hydrogen species/isotopes

real(kind=Float64), public :: thermal_mass(max_species) =0.d0

Thermal ion species mass [amu]

real(kind=Float64), public :: thermal_lambda0(max_species) =0.d0

Reference wavelengths for thermal species/isotopes [nm]

integer, public :: impurity_charge =1

Charge of main impurity (boron=5, carbon=6,...)

real(kind=Float64), public :: impurity_mass =0.d0

Impurity species mass [amu]

real(kind=Float64), public :: beam_mass =0.d0

Beam species mass [amu]

real(kind=Float64), public :: beam_lambda0 =0.d0

Reference wavelength for beam species

type(BeamGrid), public, save:: beam_grid

Variable containing beam grid definition

type(InterpolationGrid), public, save:: inter_grid

Variable containing interpolation grid definition

type(InterpolationGrid), public, save:: pass_grid

Variable containing passive neutral grid definition

type(FastIonDistribution), public, save:: fbm

Variable containing the fast-ion distribution function

type(FastIonParticles), public, save:: particles

Variable containing a MC fast-ion distribution

type(Equilibrium), public, save:: equil

Variable containing the plasma parameters and fields

type(NeutralBeam), public, save:: nbi

Variable containing the neutral beam geometry and settings

type(AtomicTables), public, save:: tables

Variable containing the atomic tables

type(NPAResults), public, save:: npa

Variable for storing the calculated active NPA results

type(NPAResults), public, save:: pnpa

Variable for storing the calculated passive NPA results

type(SpectralChords), public, save:: spec_chords

Variable containing the spectral system definition

type(NPAChords), public, save:: npa_chords

Variable containing the NPA system definition

type(SimulationInputs), public, save:: inputs

Variable containing the simulation inputs

type(BirthProfile), public, save:: birth

Variable for storing the calculated birth profile

type(Neutrals), public, save:: neut

Variable for storing the calculated beam density

type(Spectra), public, save:: spec

Variable for storing the calculated spectra

type(NeutronRate), public, save:: neutron

Variable for storing the neutron rate

type(CFPDRate), public, save:: cfpd

Variable for storing the Charged Fusion Product rate

type(FIDAWeights), public, save:: fweight

Variable for storing the calculated FIDA weights

type(NPAWeights), public, save:: nweight

Variable for storing the calculated NPA weights

type(CFPDTable), public, save:: ctable

Variable for storing the calculated Charged Fusion Product orbits

type(SpatialSpectra), public, save:: spatres

Variable for storing birth neutral for spatial resolution


Interfaces

public interface assignment(=)

public interface operator(+)

Allows for adding Profiles,LocalProfiles, EMFields, and LocalEMFields

public interface operator(-)

Allows for subtracting Profiles,LocalProfiles, EMFields, and LocalEMFields

public interface operator(*)

Allows for multiplying Profiles,LocalProfiles, EMFields, and LocalEMFields by scalars

  • public elemental function sp_multiply(real_scalar, p1) result(p3)

    Defines how to multiply Profiles types by a scalar

    Arguments

    TypeIntentOptionalAttributesName
    real(kind=Float64), intent(in) :: real_scalar
    type(Profiles), intent(in) :: p1

    Return Value type(Profiles)

  • public elemental function ps_multiply(p1, real_scalar) result(p3)

    Defines how to multiply Profiles types by a scalar

    Arguments

    TypeIntentOptionalAttributesName
    type(Profiles), intent(in) :: p1
    real(kind=Float64), intent(in) :: real_scalar

    Return Value type(Profiles)

  • public elemental function lps_multiply(p1, real_scalar) result(p3)

    Defines how to multiply LocalProfiles types by a scalar

    Arguments

    TypeIntentOptionalAttributesName
    type(LocalProfiles), intent(in) :: p1
    real(kind=Float64), intent(in) :: real_scalar

    Return Value type(LocalProfiles)

  • public elemental function slp_multiply(real_scalar, p1) result(p3)

    Defines how to multiply LocalProfiles types by a scalar

    Arguments

    TypeIntentOptionalAttributesName
    real(kind=Float64), intent(in) :: real_scalar
    type(LocalProfiles), intent(in) :: p1

    Return Value type(LocalProfiles)

  • public elemental function sf_multiply(real_scalar, p1) result(p3)

    Defines how to multiply EMFields types by a scalar

    Arguments

    TypeIntentOptionalAttributesName
    real(kind=Float64), intent(in) :: real_scalar
    type(EMFields), intent(in) :: p1

    Return Value type(EMFields)

  • public elemental function fs_multiply(p1, real_scalar) result(p3)

    Defines how to multiply EMFields types by a scalar

    Arguments

    TypeIntentOptionalAttributesName
    type(EMFields), intent(in) :: p1
    real(kind=Float64), intent(in) :: real_scalar

    Return Value type(EMFields)

  • public elemental function lfs_multiply(p1, real_scalar) result(p3)

    Defines how to multiply LocalEMFields types by a scalar

    Arguments

    TypeIntentOptionalAttributesName
    type(LocalEMFields), intent(in) :: p1
    real(kind=Float64), intent(in) :: real_scalar

    Return Value type(LocalEMFields)

  • public elemental function slf_multiply(real_scalar, p1) result(p3)

    Defines how to multiply LocalEMFields types by a scalar

    Arguments

    TypeIntentOptionalAttributesName
    real(kind=Float64), intent(in) :: real_scalar
    type(LocalEMFields), intent(in) :: p1

    Return Value type(LocalEMFields)

public interface operator(/)

Allows for dividing Profiles,LocalProfiles, EMFields, and LocalEMFields by scalars

  • public elemental function ps_divide(p1, real_scalar) result(p3)

    Defines how to divide Profiles types by a scalar

    Arguments

    TypeIntentOptionalAttributesName
    type(Profiles), intent(in) :: p1
    real(kind=Float64), intent(in) :: real_scalar

    Return Value type(Profiles)

  • public elemental function lps_divide(p1, real_scalar) result(p3)

    Defines how to divide LocalProfiles types by a scalar

    Arguments

    TypeIntentOptionalAttributesName
    type(LocalProfiles), intent(in) :: p1
    real(kind=Float64), intent(in) :: real_scalar

    Return Value type(LocalProfiles)

  • public elemental function fs_divide(p1, real_scalar) result(p3)

    Defines how to divide EMFields types by a scalar

    Arguments

    TypeIntentOptionalAttributesName
    type(EMFields), intent(in) :: p1
    real(kind=Float64), intent(in) :: real_scalar

    Return Value type(EMFields)

  • public elemental function lfs_divide(p1, real_scalar) result(p3)

    Defines how to divide LocalEMFields types by a scalar

    Arguments

    TypeIntentOptionalAttributesName
    type(LocalEMFields), intent(in) :: p1
    real(kind=Float64), intent(in) :: real_scalar

    Return Value type(LocalEMFields)


Derived Types

type, public :: BeamGrid

Defines a 3D grid for neutral beam calculations

Components

TypeVisibilityAttributesNameInitial
integer(kind=Int32), public :: nx

Number of cells in the x direction

integer(kind=Int32), public :: ny

Number of cells in the y direction

integer(kind=Int32), public :: nz

Number of cells in the z direction

real(kind=Float64), public :: xmin

Minimum x value

real(kind=Float64), public :: xmax

Maximum x value

real(kind=Float64), public :: ymin

Minimum y value

real(kind=Float64), public :: ymax

Maximum y value

real(kind=Float64), public :: zmin

Minimum z value

real(kind=Float64), public :: zmax

Maximum z value

real(kind=Float64), public :: alpha

Tait-Bryan angle for a rotation about z [radians]

real(kind=Float64), public :: beta

Tait-Bryan angle for a rotation about y' [radians]

real(kind=Float64), public :: gamma

Tait-Bryan angle for a rotation about x" [radians]

real(kind=Float64), public :: drmin

Minimum cell spacing: min(dx,dy,dz)

real(kind=Float64), public :: dv

Cell volume []

real(kind=Float64), public :: volume

Grid volume []

integer(kind=Int32), public :: ntrack

Maximum number of cell for particle tracking

integer(kind=Int32), public :: ngrid

Number of cells

integer(kind=Int32), public, dimension(3):: dims

Dimensions of beam grid

real(kind=Float64), public, dimension(3):: origin

Origin of beam grid in machine coordinates

real(kind=Float64), public, dimension(3):: center

Center of beam grid in beam coordinates

real(kind=Float64), public, dimension(3):: dr

Cell spacings [dx, dy, dz]

real(kind=Float64), public, dimension(3):: lwh

Grid [length(x), width(y), height(z)]

real(kind=Float64), public, dimension(3,3):: basis

Beam grid basis for converting from beam coordinates(xyz) to machine coordinates(uvw): (\uvw = B*xyz + origin)

real(kind=Float64), public, dimension(3,3):: inv_basis

Inverse basis for reverse transformation: (\xyz = B^{-1}*(uvw - origin))

real(kind=Float64), public, dimension(:), allocatable:: xc

x positions of cell centers

real(kind=Float64), public, dimension(:), allocatable:: yc

y positions of cell centers

real(kind=Float64), public, dimension(:), allocatable:: zc

z positions of cell centers

type, public :: InterpolationGrid

Defines a 3D R-Z-phi grid for interpolating plasma parameters and fields

Components

TypeVisibilityAttributesNameInitial
integer(kind=Int32), public :: nr

Number of Radii

integer(kind=Int32), public :: nz

Number of Z values

integer(kind=Int32), public :: nphi

Number of phi values

real(kind=Float64), public :: dr

Radial spacing [cm]

real(kind=Float64), public :: dz

Vertical spacing [cm]

real(kind=Float64), public :: dphi

Angular spacing [rad]

real(kind=Float64), public :: da

Grid element area []

real(kind=Float64), public :: dv

drdzdphi []

integer(kind=Int32), public :: dims(3)

Dimension of the interpolation grid

real(kind=Float64), public, dimension(:), allocatable:: r

Radii values [cm]

real(kind=Float64), public, dimension(:), allocatable:: z

Z values [cm]

real(kind=Float64), public, dimension(:), allocatable:: phi

Angular values [rad]

integer(kind=Int32), public :: ntrack

Maximum number of cells for particle tracking

integer(kind=Int32), public :: ngrid

Number of cells

type, public :: Profiles

Torodial symmetric plasma parameters at a given R-Z

Components

TypeVisibilityAttributesNameInitial
real(kind=Float64), public :: dene =0.d0

Electron density []

real(kind=Float64), public :: deni(max_species) =0.d0

Ion density []

real(kind=Float64), public :: denimp =0.d0

Impurity density []

real(kind=Float64), public :: denf =0.d0

Fast-ion density []

real(kind=Float64), public :: te =0.d0

Electron temperature [kev]

real(kind=Float64), public :: ti =0.d0

Ion temperature [kev]

real(kind=Float64), public :: zeff =0.d0

Effective Nuclear Charge

real(kind=Float64), public :: vr =0.d0

Plasma rotation in radial direction

real(kind=Float64), public :: vt =0.d0

Plasma rotation in torodial/phi direction

real(kind=Float64), public :: vz =0.d0

Plasma rotation in z direction

real(kind=Float64), public :: denn(nlevs,max_species) =0.d0

Cold neutral densities []

type, public, extends(Profiles) :: LocalProfiles

Plasma parameters at given position

Components

TypeVisibilityAttributesNameInitial
real(kind=Float64), public :: dene =0.d0

Electron density []

real(kind=Float64), public :: deni(max_species) =0.d0

Ion density []

real(kind=Float64), public :: denimp =0.d0

Impurity density []

real(kind=Float64), public :: denf =0.d0

Fast-ion density []

real(kind=Float64), public :: te =0.d0

Electron temperature [kev]

real(kind=Float64), public :: ti =0.d0

Ion temperature [kev]

real(kind=Float64), public :: zeff =0.d0

Effective Nuclear Charge

real(kind=Float64), public :: vr =0.d0

Plasma rotation in radial direction

real(kind=Float64), public :: vt =0.d0

Plasma rotation in torodial/phi direction

real(kind=Float64), public :: vz =0.d0

Plasma rotation in z direction

real(kind=Float64), public :: denn(nlevs,max_species) =0.d0

Cold neutral densities []

logical, public :: in_plasma =.False.

Indicates whether plasma parameters are valid/known

integer, public :: coords =0

Indicates coordinate system of vectors. Beam grid (0), machine (1) and cylindrical (2)

real(kind=Float64), public, dimension(3):: pos =0.d0

Position in beam grid coordinates

real(kind=Float64), public, dimension(3):: uvw =0.d0

Position in machine coordinates

real(kind=Float64), public, dimension(3):: vrot =0.d0

Plasma rotation in beam grid coordinates

real(kind=Float64), public, dimension(3):: vrot_uvw =0.d0

Plasma rotation in machine coordinates

type(InterpolCoeffs3D), public :: b

Cylindrical Interpolation Coefficients and indicies for interpolation at pos

type, public :: EMFields

Torodial symmetric electro-magnetic fields at given R-Z

Components

TypeVisibilityAttributesNameInitial
real(kind=Float64), public :: br =0.d0

Radial magnetic field [T]

real(kind=Float64), public :: bt =0.d0

Torodial magnetic field [T]

real(kind=Float64), public :: bz =0.d0

Vertical magnetic field [T]

real(kind=Float64), public :: er =0.d0

Radial electric field [V/m]

real(kind=Float64), public :: et =0.d0

Torodial electric field [V/m]

real(kind=Float64), public :: ez =0.d0

Vertical electric field [V/m]

real(kind=Float64), public :: dbr_dr =0.d0

Radial derivative of the radial magnetic field [T/m]

real(kind=Float64), public :: dbr_dphi =0.d0

Angular derivative of the radial magnetic field [T/m]

real(kind=Float64), public :: dbr_dz =0.d0

Vertical derivative of the radial magnetic field [T/m]

real(kind=Float64), public :: dbt_dr =0.d0

Radial derivative of the torodial magnetic field [T/m]

real(kind=Float64), public :: dbt_dphi =0.d0

Angular derivative of the torodial magnetic field [T/m]

real(kind=Float64), public :: dbt_dz =0.d0

Vertical derivative of the torodial magnetic field [T/m]

real(kind=Float64), public :: dbz_dr =0.d0

Radial derivative of the radial magnetic field [T/m]

real(kind=Float64), public :: dbz_dphi =0.d0

Angular derivative of the radial magnetic field [T/m]

real(kind=Float64), public :: dbz_dz =0.d0

Vertical derivative of the vertical magnetic field [T/m]

type, public, extends(EMFields) :: LocalEMFields

Electro-magnetic fields at given position

Components

TypeVisibilityAttributesNameInitial
real(kind=Float64), public :: br =0.d0

Radial magnetic field [T]

real(kind=Float64), public :: bt =0.d0

Torodial magnetic field [T]

real(kind=Float64), public :: bz =0.d0

Vertical magnetic field [T]

real(kind=Float64), public :: er =0.d0

Radial electric field [V/m]

real(kind=Float64), public :: et =0.d0

Torodial electric field [V/m]

real(kind=Float64), public :: ez =0.d0

Vertical electric field [V/m]

real(kind=Float64), public :: dbr_dr =0.d0

Radial derivative of the radial magnetic field [T/m]

real(kind=Float64), public :: dbr_dphi =0.d0

Angular derivative of the radial magnetic field [T/m]

real(kind=Float64), public :: dbr_dz =0.d0

Vertical derivative of the radial magnetic field [T/m]

real(kind=Float64), public :: dbt_dr =0.d0

Radial derivative of the torodial magnetic field [T/m]

real(kind=Float64), public :: dbt_dphi =0.d0

Angular derivative of the torodial magnetic field [T/m]

real(kind=Float64), public :: dbt_dz =0.d0

Vertical derivative of the torodial magnetic field [T/m]

real(kind=Float64), public :: dbz_dr =0.d0

Radial derivative of the radial magnetic field [T/m]

real(kind=Float64), public :: dbz_dphi =0.d0

Angular derivative of the radial magnetic field [T/m]

real(kind=Float64), public :: dbz_dz =0.d0

Vertical derivative of the vertical magnetic field [T/m]

logical, public :: in_plasma =.False.

Indicates whether fields are valid/known

integer, public :: coords =0

Indicates coordinate system of vectors. Beam grid (0), machine (1) and cylindrical (2)

real(kind=Float64), public :: b_abs =0.d0

Magnitude of magnetic field

real(kind=Float64), public :: e_abs =0.d0

Magnitude of electrin field

real(kind=Float64), public, dimension(3):: pos =0.d0

Position in beam grid coordinates

real(kind=Float64), public, dimension(3):: uvw =0.d0

Position in machine coordinates

real(kind=Float64), public, dimension(3):: b_norm =0.d0

Direction of magnetic field in beam grid coordinates

real(kind=Float64), public, dimension(3):: a_norm =0.d0

Vector perpendicular to b_norm and c_norm

real(kind=Float64), public, dimension(3):: c_norm =0.d0

Vector perpendicular to b_norm and a_norm

real(kind=Float64), public, dimension(3):: e_norm =0.d0

Direction of electric field in beam grid coordinates

type(InterpolCoeffs3D), public :: b

Cylindrical Interpolation Coefficients and indicies for interpolation at pos

type, public :: Equilibrium

MHD Equilbrium

Components

TypeVisibilityAttributesNameInitial
type(EMFields), public, dimension(:,:,:), allocatable:: fields

Electro-magnetic fields at points defined in inter_grid

type(Profiles), public, dimension(:,:,:), allocatable:: plasma

Plasma parameters at points defined in inter_grid

real(kind=Float64), public, dimension(:,:,:), allocatable:: mask

Indicates whether fields and plasma are well-defined at points defined in inter_grid

type, public :: FastIonDistribution

Defines a Guiding Center Fast-ion Distribution Function: F(E,p,R,Z,Phi)

Components

TypeVisibilityAttributesNameInitial
real(kind=Float64), public :: A =H2_amu

Atomic Mass

integer(kind=Int32), public :: nenergy

Number of energies

integer(kind=Int32), public :: npitch

Number of pitches

integer(kind=Int32), public :: nr

Number of radii

integer(kind=Int32), public :: nz

Number of z values

integer(kind=Int32), public :: nphi

Number of phi values

real(kind=Float64), public :: dE

Energy spacing [keV]

real(kind=Float64), public :: dp

Pitch spacing

real(kind=Float64), public :: dr

Radial spacing [cm]

real(kind=Float64), public :: dz

Z spacing [cm]

real(kind=Float64), public :: dphi

Angular spacing [rad]

real(kind=Float64), public :: emin

Minimum energy [keV]

real(kind=Float64), public :: emax

Maximum energy [keV]

real(kind=Float64), public :: e_range

Energy interval length [keV]

real(kind=Float64), public :: pmin

Minimum pitch

real(kind=Float64), public :: pmax

Maximum pitch

real(kind=Float64), public :: p_range

Pitch interval length

real(kind=Float64), public :: rmin

Minimum radius [cm]

real(kind=Float64), public :: rmax

Maximum radius [cm]

real(kind=Float64), public :: r_range

Radius interval length [cm]

real(kind=Float64), public :: zmin

Minimum Z [cm]

real(kind=Float64), public :: zmax

Maximum Z [cm]

real(kind=Float64), public :: z_range

Z interval length [cm]

real(kind=Float64), public :: phimin

Minimum Phi [rad]

real(kind=Float64), public :: phimax

Maximum Phi [rad]

real(kind=Float64), public :: phi_range

Phi interval length [rad]

real(kind=Float64), public :: n_tot =0.d0

Total Number of fast-ions

real(kind=Float64), public, dimension(:), allocatable:: energy

Energy values [keV]

real(kind=Float64), public, dimension(:), allocatable:: pitch

Pitch w.r.t. the magnetic field

real(kind=Float64), public, dimension(:), allocatable:: r

Radius [cm]

real(kind=Float64), public, dimension(:), allocatable:: z

Z [cm]

real(kind=Float64), public, dimension(:), allocatable:: phi

Angles [rad]

real(kind=Float64), public, dimension(:,:,:), allocatable:: denf

Fast-ion density defined on the inter_grid: denf(R,Z,Phi)

real(kind=Float64), public, dimension(:,:,:,:,:), allocatable:: f

Fast-ion distribution function defined on the inter_grid: F(E,p,R,Z,Phi)

type, public :: FastIon

Defines a fast-ion

Components

TypeVisibilityAttributesNameInitial
real(kind=Float64), public :: A =H2_amu

Fast-ion atomic mass

logical, public :: beam_grid_cross_grid =.False.

Indicates whether the fast-ion crosses the beam_grid

real(kind=Float64), public :: r =0.d0

Radial position of fast-ion [cm]

real(kind=Float64), public :: phi =0.d0

Angular position of fast-ion [rad]

real(kind=Float64), public :: z =0.d0

Vertical position of fast-ion [cm]

real(kind=Float64), public :: beam_grid_phi_enter =0.d0

Torodial/phi position where fast-ion enters the beam_grid [radians]

real(kind=Float64), public :: delta_phi =2*pi

Angle subtended by the beam_grid at (r,z)

real(kind=Float64), public :: energy =0.d0

Energy [keV]

real(kind=Float64), public :: pitch =0.d0

Pitch w.r.t. the magnetic field

real(kind=Float64), public :: vabs =0.d0

Speed [cm/s]

real(kind=Float64), public :: vr =0.d0

Radial velocity [cm/s]

real(kind=Float64), public :: vt =0.d0

Torodial velocity [cm/s]

real(kind=Float64), public :: vz =0.d0

Z velocity [cm/s]

real(kind=Float64), public :: weight =0.d0

Particle weight: How many fast-ions does particle represent.

integer(kind=Int32), public :: class =0

Orbit class id

type, public :: FastIonParticles

Collection of fast-ion particles

Components

TypeVisibilityAttributesNameInitial
integer(kind=Int32), public :: nparticle =0

Number of particles

integer(kind=Int32), public :: nclass =1

Number of orbit classes

logical, public :: axisym =.True.

Indicates whether distribution function is axisymmetric

type(FastIon), public, dimension(:), allocatable:: fast_ion

Fast-ion particles

type, public :: NeutralBeam

Defines a neutral beam with +x defined to be into the plasma

Components

TypeVisibilityAttributesNameInitial
character(len=25), public :: name =''

Beam name

integer, public :: shape

Beam source shape 1="rectangular", 2="circular"

real(kind=Float64), public :: widy

Half width of source in y direction

real(kind=Float64), public :: widz

Half height of source in z direction

real(kind=Float64), public :: focy

Focal length in y direction

real(kind=Float64), public :: focz

Focal length in z direction

real(kind=Float64), public :: einj

NBI voltage [kV]

real(kind=Float64), public :: pinj

NBI power [MW]

real(kind=Float64), public :: vinj

NBI velocity [cm/s]

real(kind=Float64), public :: alpha

Z rotation not same as beam_grid alpha

real(kind=Float64), public :: beta

Tilt rotation not same as beam_grid beta

real(kind=Float64), public, dimension(3):: divy

Energy dependent divergence in y direction

real(kind=Float64), public, dimension(3):: divz

Energy dependent divergence in z direction

real(kind=Float64), public, dimension(3):: current_fractions

Fractions of full, half, and third energy neutrals

real(kind=Float64), public, dimension(3):: src

Position of source in beam grid coordinates [cm]

real(kind=Float64), public, dimension(3):: axis

Beam centerline

integer, public :: naperture

Number of beam apertures

integer, public, dimension(:), allocatable:: ashape

Aperture shape 1="rectangular", 2="circular"

real(kind=Float64), public, dimension(:), allocatable:: awidy

Half width of the aperture(s) in y direction

real(kind=Float64), public, dimension(:), allocatable:: awidz

Half height of the aperture(s) in z direction

real(kind=Float64), public, dimension(:), allocatable:: aoffy

Horizontal (y) offset of the aperture(s) relative to the beam centerline [cm]

real(kind=Float64), public, dimension(:), allocatable:: aoffz

Vertical (z) offset of the aperture(s) relative to the beam centerline [cm]

real(kind=Float64), public, dimension(:), allocatable:: adist

Distance from the center of the beam source grid to the aperture(s) plane [cm]

real(kind=Float64), public, dimension(3,3):: basis

Beam basis for converting from centerline coordinates to beam grid coordinates

real(kind=Float64), public, dimension(3,3):: inv_basis

Inverse basis for reverse transfomation

type, public :: AtomicCrossSection

Defines a n/m-resolved atomic cross section table

Components

TypeVisibilityAttributesNameInitial
integer, public :: nenergy =1

Number of beam energies

real(kind=Float64), public :: logemin =0.d0

Log-10 minimum energy

real(kind=Float64), public :: logemax =0.d0

Log-10 maximum energy

integer, public :: n_max =nlevs

Number of initial atomic energy levels

integer, public :: m_max =nlevs

Number of final atomic energy levels

real(kind=Float64), public :: dlogE =0.d0

Log-10 energy spacing

real(kind=Float64), public :: minlog_cross

Log-10 minimum cross section

real(kind=Float64), public, dimension(:,:,:), allocatable:: log_cross

Log-10 cross sections

type, public :: AtomicRates

Defines a n/m-resolved atomic cross section table

Components

TypeVisibilityAttributesNameInitial
integer, public :: nenergy =1

Number of beam energies/amu

real(kind=Float64), public :: logemin =0.d0

Log-10 minimum energy/amu

real(kind=Float64), public :: logemax =0.d0

Log-10 maximum energy/amu

integer, public :: ntemp =1

Number of target temperatures

real(kind=Float64), public :: logtmin =0.d0

Log-10 minimum temperature

real(kind=Float64), public :: logtmax =0.d0

Log-10 maximum temperature

integer, public :: n_max =nlevs

Number of initial atomic energy levels

integer, public :: m_max =nlevs

Number of final atomic energy levels

real(kind=Float64), public :: dlogE =0.d0

Log-10 energy spacing

real(kind=Float64), public :: dlogT =0.d0

Log-10 temperature spacing

real(kind=Float64), public :: minlog_rate =0.d0

Log-10 minimum reaction rate

real(kind=Float64), public, dimension(:,:,:,:), allocatable:: log_rate

Log-10 beam-target rates

type, public :: AtomicTransitions

Defines an atomic table for populating and de-populating reaction rates

Components

TypeVisibilityAttributesNameInitial
integer, public :: nenergy =1

Number of beam energies/amu

real(kind=Float64), public :: logemin =0.d0

Log-10 minimum energy/amu

real(kind=Float64), public :: logemax =0.d0

Log-10 maximum energy/amu

integer, public :: ntemp =1

Number of target temperatures

real(kind=Float64), public :: logtmin =0.d0

Log-10 minimum temperature

real(kind=Float64), public :: logtmax =0.d0

Log-10 maximum temperature

integer, public :: n_max =nlevs

Number of initial atomic energy levels

integer, public :: m_max =nlevs

Number of final atomic energy levels

real(kind=Float64), public :: dlogE =0.d0

Log-10 energy spacing

real(kind=Float64), public :: dlogT =0.d0

Log-10 temperature spacing

real(kind=Float64), public :: minlog_pop =0.d0

Log-10 minimum reaction rates for populating transistions

real(kind=Float64), public :: minlog_depop =0.d0

Log-10 minimum reaction rates for de-populating transistions

real(kind=Float64), public, dimension(:,:,:,:), allocatable:: log_pop

Log-10 reaction rates for populating transistions

real(kind=Float64), public, dimension(:,:,:), allocatable:: log_depop

Log-10 reaction rates for de-populating transistions

type, public :: NuclearRates

Nuclear reaction rates

Components

TypeVisibilityAttributesNameInitial
integer, public :: nbranch =1

Number of reaction branches

integer, public :: nenergy =1

Number of beam energies

real(kind=Float64), public :: logemin =0.d0

Log-10 minimum energy

real(kind=Float64), public :: logemax =0.d0

Log-10 maximum energy

integer, public :: ntemp =1

Number of target temperatures

real(kind=Float64), public :: logtmin =0.d0

Log-10 minimum temperature

real(kind=Float64), public :: logtmax =0.d0

Log-10 maximum temperature

real(kind=Float64), public :: dlogE =0.d0

Log-10 energy spacing

real(kind=Float64), public :: dlogT =0.d0

Log-10 temperature spacing

real(kind=Float64), public :: minlog_rate =0.d0

Log-10 minimum reaction rate

real(kind=Float64), public, dimension(2):: bt_amu =0.d0

Isotope mass of beam and thermal ions respectively [amu]

real(kind=Float64), public, dimension(:,:,:), allocatable:: log_rate

Log-10 reaction rates: log_rate(energy, temperature, branch)

type, public :: AtomicTables

Atomic tables for various types of interactions

Components

TypeVisibilityAttributesNameInitial
type(AtomicCrossSection), public :: H_H_cx_cross

Hydrogen-Hydrogen charge exchange n/m-resolved cross sections

type(AtomicRates), public :: H_H_cx_rate

Hydrogen-Hydrogen charge exchange n/m-resolved beam-target rates

type(AtomicTransitions), public :: H_H

Hydrogen-Hydrogen atomic transitions

type(AtomicTransitions), public :: H_e

Hydrogen-Electron atomic transitions

type(AtomicTransitions), public :: H_Aq

Hydrogen-Impurity atomic transitions

real(kind=Float64), public, dimension(nlevs,nlevs):: einstein

Einstein coefficients for spontaneous emission

type(NuclearRates), public :: D_D

Deuterium-Deuterium reaction rates

type, public :: LineOfSight

Defines a line of sight

Components

TypeVisibilityAttributesNameInitial
real(kind=Float64), public :: sigma_pi =1.d0

Ratio of sigma to pi line intensity

real(kind=Float64), public :: spot_size =0.d0

Radius of spot size [cm]

real(kind=Float64), public, dimension(3):: lens =0.d0

Lens location in beam grid coordinates

real(kind=Float64), public, dimension(3):: axis =0.d0

Optical axis in beam grid coordinates

real(kind=Float64), public, dimension(3):: lens_uvw =0.d0

Lens location in machine coordinates

real(kind=Float64), public, dimension(3):: axis_uvw =0.d0

Optical axis in machine coordinates

type, public :: LOSElement

Defines a element of a line of sight and cell intersection

Components

TypeVisibilityAttributesNameInitial
integer, public :: id

Line of sight index

real(kind=Float64), public :: length

Length of crossing

type, public :: LOSInters

Defines the channels that intersect a cell

Components

TypeVisibilityAttributesNameInitial
integer, public :: nchan =0

Number of channels that intersect

type(LOSElement), public, dimension(:), allocatable:: los_elem

Array of crossing

type, public :: SpectralChords

Defines an spectral diagnostic system

Components

TypeVisibilityAttributesNameInitial
integer, public :: nchan =0

Number of channels

integer, public :: ncell =0

Number of beam_grid cells with intersections

integer, public :: cyl_ncell =0

Number of pass_grid cells with intersections

type(LineOfSight), public, dimension(:), allocatable:: los

Line of sight array

real(kind=Float64), public, dimension(:), allocatable:: radius

Radius of each line of sight

type(LOSInters), public, dimension(:,:,:), allocatable:: inter

Array of LOS intersections with beam_grid

type(LOSInters), public, dimension(:,:,:), allocatable:: cyl_inter

Array of LOS intersections with pass_grid

integer, public, dimension(:), allocatable:: cell

Linear indices of beam_grid that have intersections

integer, public, dimension(:), allocatable:: cyl_cell

Linear indices of pass_grid that have intersections

type, public :: BoundedPlane

Defines a plane with a circular or rectangular boundary

Components

TypeVisibilityAttributesNameInitial
integer, public :: shape =0

Boundary shape 1="Rectangular", 2="circular"

real(kind=Float64), public :: hh =0.d0

Half height of boundary [cm]

real(kind=Float64), public :: hw =0.d0

Half width of boundary [cm]

real(kind=Float64), public, dimension(3):: origin =0.d0

Origin of plane in machine coordinates

real(kind=Float64), public, dimension(3,3):: basis =0.d0

Basis vectors basis(:,1) = u_1 is plane normal

real(kind=Float64), public, dimension(3,3):: inv_basis =0.d0

Inverse basis

type, public :: NPADetector

Defines a NPA detector

Components

TypeVisibilityAttributesNameInitial
type(BoundedPlane), public :: detector

Detecting plane of NPA detector

type(BoundedPlane), public :: aperture

Aperture plane of NPA detector

type, public :: NPAProbability

Type to contain the probability of hitting a NPA detector

Components

TypeVisibilityAttributesNameInitial
real(kind=Float64), public :: p =0.d0

Hit probability

real(kind=Float64), public :: pitch =-2.d0

Pitch

real(kind=Float64), public, dimension(3):: eff_rd =0.d0

Effective position of detector

real(kind=Float64), public, dimension(3):: dir =0.d0

Trajectory direction

type, public :: NPAChords

Defines a NPA system

Components

TypeVisibilityAttributesNameInitial
integer, public :: nchan =0

Number of channels

type(NPADetector), public, dimension(:), allocatable:: det

NPA detector array

real(kind=Float64), public, dimension(:), allocatable:: radius

Radius [cm]

logical, public, dimension(:,:,:), allocatable:: hit

Indicates whether a particle can hit any NPA detector from a grid cell: hit(x,y,z)

type(NPAProbability), public, dimension(:,:,:,:), allocatable:: phit

Probability of hitting a detector from a grid cell: phit(x,y,z,chan)

type, public :: NPAParticle

Defines a NPA particle

Components

TypeVisibilityAttributesNameInitial
integer, public :: detector =0

Detector NPA particle hit

integer(kind=Int32), public :: class =0

Orbit class id

real(kind=Float64), public :: A

Atomic Mass

real(kind=Float64), public :: xi =0.d0

Initial x position

real(kind=Float64), public :: yi =0.d0

Initial y position

real(kind=Float64), public :: zi =0.d0

Initial z position

real(kind=Float64), public :: xf =0.d0

Final x position

real(kind=Float64), public :: yf =0.d0

Final y position

real(kind=Float64), public :: zf =0.d0

Final z position

real(kind=Float64), public :: weight =0.d0

NPA particle weight

real(kind=Float64), public :: energy =0.d0

Birth Energy [keV]

real(kind=Float64), public :: pitch =0.d0

Birth Pitch

type, public :: NPAResults

MC NPA result structure

Components

TypeVisibilityAttributesNameInitial
integer(kind=Int32), public :: nchan =0

Number of NPA channels

integer(kind=Int32), public :: npart =0

Number of particles that hit a detector

integer(kind=Int32), public :: nmax =1000000

Maximum allowed number of particles grows if necessary

integer(kind=Int32), public :: nenergy =122

Number of energy values

type(NPAParticle), public, dimension(:), allocatable:: part

Array of NPA particles

real(kind=Float64), public, dimension(:), allocatable:: energy

Energy array [keV]

real(kind=Float64), public, dimension(:,:,:), allocatable:: flux

Neutral particle flux: flux(energy,chan, orbit_type) [neutrals/(s*dE)]

type, public :: BirthParticle

Defines a Birth particle

Components

TypeVisibilityAttributesNameInitial
integer, public :: neut_type =0

Birth type (1=Full, 2=Half, 3=Third)

integer(kind=Int32), public, dimension(3):: ind =0

Initial beam_grid indices

real(kind=Float64), public, dimension(3):: ri =0.d0

Initial position in beam grid coordinates [cm]

real(kind=Float64), public, dimension(3):: vi =0.d0

Initial velocity in beam grid coordinates [cm/s]

real(kind=Float64), public, dimension(3):: ri_gc =0.d0

Initial guiding-center position in beam grid coordinates [cm]

real(kind=Float64), public :: weight =0.d0

NPA particle weight [fast-ions/s]

real(kind=Float64), public :: energy =0.d0

Birth Energy [keV]

real(kind=Float64), public :: pitch =0.d0

Birth Pitch w.r.t. the magnetic field

type, public :: BirthProfile

Birth profile structure

Components

TypeVisibilityAttributesNameInitial
integer, public :: cnt =1

Particle counter

type(BirthParticle), public, dimension(:), allocatable:: part

Array of birth particles

real(kind=Float64), public, dimension(:,:,:,:), allocatable:: dens

Birth density: dens(neutral_type,x,y,z) [fast-ions/(s*cm^3)]

type, public :: Spectra

Spectra storage structure

Components

TypeVisibilityAttributesNameInitial
real(kind=Float64), public, dimension(:,:), allocatable:: brems

Bremsstruhlung: brems(lambda,chan)

real(kind=Float64), public, dimension(:,:,:), allocatable:: full

Full energy beam emission stark components: full(n_stark,lambda,chan)

real(kind=Float64), public, dimension(:,:,:), allocatable:: half

Half energy beam emission stark components: half(n_stark,lambda,chan)

real(kind=Float64), public, dimension(:,:,:), allocatable:: third

Third energy beam emission stark components: thirdstokes(n_stark,lambda,chan)

real(kind=Float64), public, dimension(:,:,:,:), allocatable:: fullstokes

Full energy beam emission stark components: fullstokes(n_stark,4,lambda,chan)

real(kind=Float64), public, dimension(:,:,:,:), allocatable:: halfstokes

Half energy beam emission stark components: halfstokes(n_stark,4,lambda,chan)

real(kind=Float64), public, dimension(:,:,:,:), allocatable:: thirdstokes

Third energy beam emission stark components: thirdstokes(n_stark,4,lambda,chan)

real(kind=Float64), public, dimension(:,:,:,:), allocatable:: dcx

Direct CX emission stark components: dcx(n_stark,lambda,chan,species)

real(kind=Float64), public, dimension(:,:,:,:,:), allocatable:: dcxstokes

Direct CX emission stark components: dcxstokes(n_stark,4,lambda,chan,species)

real(kind=Float64), public, dimension(:,:,:,:), allocatable:: halo

Thermal halo emission stark components: halo(n_stark,lambda,chan,species)

real(kind=Float64), public, dimension(:,:,:,:,:), allocatable:: halostokes

Thermal halo emission stark components: halo(n_stark,4,lambda,chan,species)

real(kind=Float64), public, dimension(:,:,:,:), allocatable:: cold

Cold D-alpha emission stark components: cold(n_stark,lambda,chan,species)

real(kind=Float64), public, dimension(:,:,:,:,:), allocatable:: coldstokes

Cold D-alpha emission stark components: coldstokes(n_stark,4,lambda,chan,species)

real(kind=Float64), public, dimension(:,:,:,:), allocatable:: fida

Active FIDA emission stark components: fida(n_stark,lambda,chan,orbit_type)

real(kind=Float64), public, dimension(:,:,:,:,:), allocatable:: fidastokes

Active FIDA emission stark components: fidastokes(n_stark,4,lambda,chan,orbit_type)

real(kind=Float64), public, dimension(:,:,:,:), allocatable:: pfida

Passive FIDA emission stark components: pfida(n_stark,lambda,chan,orbit_type)

real(kind=Float64), public, dimension(:,:,:,:,:), allocatable:: pfidastokes

Passive FIDA emission stark components: pfidastokes(n_stark,4,lambda,chan,orbit_type)

type, public :: NeutronRate

Neutron storage structure

Components

TypeVisibilityAttributesNameInitial
real(kind=Float64), public, dimension(:), allocatable:: rate

Neutron rate: rate(orbit_type) [neutrons/sec]

real(kind=Float64), public, dimension(:,:,:,:,:), allocatable:: weight

Neutron rate weight: weight(E,p,R,Z,Phi)

real(kind=Float64), public, dimension(:,:,:), allocatable:: emis

Neutron emissivity: emis(R,Z,Phi)

type, public :: CFPDRate

Charged Fusion Product (CFPD) storage structure

Components

TypeVisibilityAttributesNameInitial
real(kind=Float64), public, dimension(:,:,:,:), allocatable:: weight

CFPD rate weight: weight(Ep,Ch,E,p)

real(kind=Float64), public, dimension(:,:), allocatable:: flux

CFPD flux: flux(E3,chan) [kHz]

real(kind=Float64), public, dimension(:,:), allocatable:: prob

CFPD flux: probability_gyro(E3,chan) [unity]

real(kind=Float64), public, dimension(:,:), allocatable:: gam

CFPD flux: gyro(E3,chan) [rad]

type, public :: NeutralParticle

Components

TypeVisibilityAttributesNameInitial
real(kind=Float64), public :: w =1.d0

Neutral particle weight

real(kind=Float64), public, dimension(3):: v =0.d0

Neutral particle position/velocity

type, public :: NeutralParticleReservoir

Neutral Particle Reservoir

Read more…

Components

TypeVisibilityAttributesNameInitial
integer(kind=Int32), public :: n =0

Number of neutral particles seen by the reservoir

integer(kind=Int32), public :: i =0

Number of the next particle that will be stored in the reservoir

integer(kind=Int32), public :: k =0

Size of the reservoir

real(kind=Float64), public :: W =0.d0

Sampling weight

type(NeutralParticle), public, dimension(reservoir_size):: R

Neutral Particle Reservoir

type, public :: NeutralPopulation

Components

TypeVisibilityAttributesNameInitial
real(kind=Float64), public, dimension(:,:,:,:), allocatable:: dens

Neutral density: dens(lev,x,y,z)

type(NeutralParticleReservoir), public, dimension(:,:,:), allocatable:: res

Neutral particle reservoir

type, public :: Neutrals

Neutral density structure

Components

TypeVisibilityAttributesNameInitial
type(NeutralPopulation), public :: full

Full energy neutral population

type(NeutralPopulation), public :: half

Half energy neutral population

type(NeutralPopulation), public :: third

Third energy neutral population

type(NeutralPopulation), public :: dcx

DCX neutral population

type(NeutralPopulation), public :: halo

Halo neutral population

type, public :: SpatialSpectra

Spatial Storage of photon neutral birth

Components

TypeVisibilityAttributesNameInitial
type(NeutralParticleReservoir), public, dimension(:), allocatable:: dcx
type(NeutralParticleReservoir), public, dimension(:), allocatable:: halo
type(NeutralParticleReservoir), public, dimension(:), allocatable:: fida
type(NeutralParticleReservoir), public, dimension(:), allocatable:: pfida

type, public :: FIDAWeights

FIDA weights structure

Components

TypeVisibilityAttributesNameInitial
real(kind=Float64), public, dimension(:,:,:), allocatable:: mean_f

Estimate of mean fast-ion distribution function "seen" by LOS: mean_f(E,p,chan)

real(kind=Float64), public, dimension(:,:,:,:), allocatable:: weight

FIDA weight function: weight(lambda,E,p,chan)

type, public :: NPAWeights

NPA weights structure

Components

TypeVisibilityAttributesNameInitial
real(kind=Float64), public, dimension(:,:,:,:,:), allocatable:: attenuation

Attenuation fraction: attenuation(E,x,y,z,chan)

real(kind=Float64), public, dimension(:,:,:,:,:), allocatable:: cx

Charge Exchange reaction rates: cx(E,x,y,z,chan)

real(kind=Float64), public, dimension(:,:,:,:), allocatable:: emissivity

Emissivity: emissivity(x,y,z,chan) [neutrals/(s*dV)]

real(kind=Float64), public, dimension(:,:,:), allocatable:: weight

NPA weight function: weight(E,p,chan) [neutrals/(sfast-iondE*dP)]

real(kind=Float64), public, dimension(:,:), allocatable:: flux

Neutral particle flux: flux(E,chan) [neutrals/(s*dE)]

type, public :: SimulationInputs

Simulation settings structure

Components

TypeVisibilityAttributesNameInitial
integer(kind=Int32), public :: shot_number

Shot Number

real(kind=Float64), public :: time

Shot time [s]

character, public :: runid =''

FIDASIM run ID

character, public :: result_dir =''

Result directory

character, public :: tables_file =''

Atomic tables file

character, public :: geometry_file =''

FIDASIM input file containing geometric quantities

character, public :: equilibrium_file =''

FIDASIM input file containing the plasma parameters and fields

character, public :: distribution_file =''

FIDASIM input file containing the fast-ion distribution

character, public :: neutrals_file =''

FIDASIM output/input file containing beam neutral density. Used when load_neutrals is set.

integer, public :: seed

Random number generator seed

integer(kind=Int64), public :: n_fida

Number of Active FIDA mc markers

integer(kind=Int64), public :: n_pfida

Number of Passive FIDA mc markers

integer(kind=Int64), public :: n_npa

Number of Passiv NPA mc markers

integer(kind=Int64), public :: n_pnpa

Number of Passive NPA mc markers

integer(kind=Int64), public :: n_nbi

Number of neutral beam mc markers

integer(kind=Int64), public :: n_dcx

Number of direct charge exchange (DCX) mc markers

integer(kind=Int64), public :: n_halo

Number of halo mc markers

integer(kind=Int64), public :: n_birth

Number of birth particles per n_nbi

integer(kind=Int32), public :: calc_spec

Calculate spectra: 0 = off, 1=on

integer(kind=Int32), public :: calc_beam

Calculate beam densities: 0 = off, 1=on

integer(kind=Int32), public :: calc_nbi_dens

Calculate neutral beam density: 0 = off, 1=on

integer(kind=Int32), public :: calc_dcx_dens

Calculate Direct Charge Exchange (DCX) density: 0 = off, 1=on

integer(kind=Int32), public :: calc_halo_dens

Calculate Thermal Halo density: 0 = off, 1=on

integer(kind=Int32), public :: calc_brems

Calculate bremmstruhlung: 0 = off, 1=on

integer(kind=Int32), public :: calc_bes

Calculate NBI: 0 = off, 1=on

integer(kind=Int32), public :: calc_dcx

Calculate DCX: 0 = off, 1=on

integer(kind=Int32), public :: calc_halo

Calculate Halo: 0 = off, 1=on

integer(kind=Int32), public :: calc_cold

Calculate Cold D-alpha: 0 = off, 1=on

integer(kind=Int32), public :: calc_fida

Calculate Active FIDA: 0 = off, 1=on

integer(kind=Int32), public :: calc_pfida

Calculate Passive FIDA: 0 = off, 1=on

integer(kind=Int32), public :: tot_spectra

Total number of spectral switches on

integer(kind=Int32), public :: load_neutrals

Load neutrals from file: 0 = off, 1=on

integer(kind=Int32), public :: output_neutral_reservoir

Output neutral reservoir: 0 = off, 1=on

integer(kind=Int32), public :: calc_npa

Calculate Active NPA: 0 = off, 1=on, 2=on++

integer(kind=Int32), public :: calc_pnpa

Calculate Passive NPA: 0 = off, 1=on, 2=on++

integer(kind=Int32), public :: calc_fida_wght

Calculate FIDA weight: 0 = off, 1=on, 2=on++

integer(kind=Int32), public :: calc_npa_wght

Calculate NPA weights: 0 = off, 1=on, 2=on++

integer(kind=Int32), public :: calc_birth

Calculate birth profile: 0 = off, 1=on

integer(kind=Int32), public :: calc_neutron

Calculate neutron flux: 0 = off, 1=on, 2=on++

integer(kind=Int32), public :: calc_cfpd

Calculate Charged Fusion Product flux: 0 = off, 1=on

integer(kind=Int32), public :: calc_res

Calculate spatial resolution of LOS

integer(kind=Int32), public :: flr

FLR correction: 0=off, 1=1st order(vxb/omega), 2=2nd order correction

integer(kind=Int32), public :: split

Split signals by fast ion class: 0=off, 1=on

integer(kind=Int32), public :: verbose

Verbosity: <0 = off++, 0 = off, 1=on, 2=on++

integer(kind=Int32), public :: stark_components

Output spectral stark components : 0=off, 1=on

integer(kind=Int32), public :: dist_type

Type of fast-ion distribution

integer(kind=Int32), public :: nlambda

Number of wavelength to calculate

real(kind=Float64), public :: dlambda

Wavelength spacing [nm]

real(kind=Float64), public :: lambdamin

Minimum wavelength [nm]

real(kind=Float64), public :: lambdamax

Maximum wavelength [nm]

integer(kind=Int32), public :: ne_wght

Number of energies in weight functions

integer(kind=Int32), public :: np_wght

Number of pitches in weight functions

integer(kind=Int32), public :: nphi_wght

Number of gyro-angles to average over in weight functions

integer(kind=Int32), public :: nlambda_wght

Number of wavelength to calculate in weight functions

real(kind=Float64), public :: emax_wght

Maximum energy in weight functions [keV]

real(kind=Float64), public :: lambdamin_wght

Minimum wavelength in weight functions [nm]

real(kind=Float64), public :: lambdamax_wght

Maximum wavelength in weight functions [nm]

integer(kind=Int32), public :: adaptive

Simulation switch for adaptive time step, 0:split off, 1:dene, 2:avg(denn(1,:)), 3:denf, 4:avg(deni), 5:denimp, 6:te, 7:ti

integer(kind=Int32), public :: max_cell_splits

Maximum number of times a cell can be split

real(kind=Float64), public :: split_tol

Tolerance level for splitting cells

type, public :: ParticleTrack

Stores properties seen when traveling through a 3D grid

Components

TypeVisibilityAttributesNameInitial
real(kind=Float64), public :: time =0.d0

Time/distance/... in cell

real(kind=Float64), public :: flux =0.d0

Flux/density/... in cell

integer(kind=Int32), public, dimension(3):: ind =0

Indices of cell

real(kind=Float64), public, dimension(3):: pos =0.d0

Midpoint of track in cell [cm]

type, public :: GyroSurface

Surface containing the fast-ion velocity vectors for all values of the gyro-angle. It takes the form of a hyperboloid where is the gyro-angle, is the ion gyro-frequency and

Components

TypeVisibilityAttributesNameInitial
real(kind=Float64), public :: v =0.d0

Particle speed

real(kind=Float64), public :: omega =0.d0

Ion gyro-frequency

real(kind=Float64), public, dimension(3):: axes =0.d0

Semi-axes of the hyperboloid, i.e. a, b, c coefficients

real(kind=Float64), public, dimension(3):: center =0.d0

Center of the gyrosurface

real(kind=Float64), public, dimension(3,3):: A =0.d0

Coefficients of quartic surface i.e. basis*diagm(1/a^2,1/b^2,1/c^2)*basis'

real(kind=Float64), public, dimension(3,3):: basis =0.d0

Basis of coordinate system of gyrosurface

type, public :: CFPDTable

Defines Charged Fusion Product orbit trajectories

Components

TypeVisibilityAttributesNameInitial
integer, public :: nenergy =0

Number of cfpd energies

integer, public :: nrays =0

Number of "rays"

integer, public :: nsteps =0

Number of total steps

integer, public :: nchan =0

Number of channels

real(kind=Float64), public :: dl

Step length [cm]

real(kind=Float64), public :: dE

CFPD energy bin width [keV]

real(kind=Float64), public, dimension(:), allocatable:: earray

Energies of cfpd orbits [keV]: earray(E3)

real(kind=Float64), public, dimension(:,:,:), allocatable:: nactual

Number of spatial steps: nactual(E3,ray,channel)

real(kind=Float64), public, dimension(:,:,:), allocatable:: daomega

Differntial area times solid angle [cm^2]: daomega(E3,ray,channel)

real(kind=Float64), public, dimension(:,:,:,:,:), allocatable:: sightline

Velocity [cm/s] and position [cm] in cylindrical (R,Phi,Z) coordinates: sightline(E3,:,step,ray,channel)


Functions

public elemental function pp_add(p1, p2) result(p3)

Defines how to add two Profiles types

Arguments

TypeIntentOptionalAttributesName
type(Profiles), intent(in) :: p1
type(Profiles), intent(in) :: p2

Return Value type(Profiles)

public elemental function pp_subtract(p1, p2) result(p3)

Defines how to subtract two Profiles types

Arguments

TypeIntentOptionalAttributesName
type(Profiles), intent(in) :: p1
type(Profiles), intent(in) :: p2

Return Value type(Profiles)

public elemental function lplp_add(p1, p2) result(p3)

Defines how to add two LocalProfiles types

Arguments

TypeIntentOptionalAttributesName
type(LocalProfiles), intent(in) :: p1
type(LocalProfiles), intent(in) :: p2

Return Value type(LocalProfiles)

public elemental function lplp_subtract(p1, p2) result(p3)

Defines how to subtract two LocalProfiles types

Arguments

TypeIntentOptionalAttributesName
type(LocalProfiles), intent(in) :: p1
type(LocalProfiles), intent(in) :: p2

Return Value type(LocalProfiles)

public elemental function ps_multiply(p1, real_scalar) result(p3)

Defines how to multiply Profiles types by a scalar

Arguments

TypeIntentOptionalAttributesName
type(Profiles), intent(in) :: p1
real(kind=Float64), intent(in) :: real_scalar

Return Value type(Profiles)

public elemental function sp_multiply(real_scalar, p1) result(p3)

Defines how to multiply Profiles types by a scalar

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in) :: real_scalar
type(Profiles), intent(in) :: p1

Return Value type(Profiles)

public elemental function ps_divide(p1, real_scalar) result(p3)

Defines how to divide Profiles types by a scalar

Arguments

TypeIntentOptionalAttributesName
type(Profiles), intent(in) :: p1
real(kind=Float64), intent(in) :: real_scalar

Return Value type(Profiles)

public elemental function lps_multiply(p1, real_scalar) result(p3)

Defines how to multiply LocalProfiles types by a scalar

Arguments

TypeIntentOptionalAttributesName
type(LocalProfiles), intent(in) :: p1
real(kind=Float64), intent(in) :: real_scalar

Return Value type(LocalProfiles)

public elemental function slp_multiply(real_scalar, p1) result(p3)

Defines how to multiply LocalProfiles types by a scalar

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in) :: real_scalar
type(LocalProfiles), intent(in) :: p1

Return Value type(LocalProfiles)

public elemental function lps_divide(p1, real_scalar) result(p3)

Defines how to divide LocalProfiles types by a scalar

Arguments

TypeIntentOptionalAttributesName
type(LocalProfiles), intent(in) :: p1
real(kind=Float64), intent(in) :: real_scalar

Return Value type(LocalProfiles)

public elemental function ff_add(p1, p2) result(p3)

Defines how to add two EMFields types

Arguments

TypeIntentOptionalAttributesName
type(EMFields), intent(in) :: p1
type(EMFields), intent(in) :: p2

Return Value type(EMFields)

public elemental function ff_subtract(p1, p2) result(p3)

Defines how to subtract two EMFields types

Arguments

TypeIntentOptionalAttributesName
type(EMFields), intent(in) :: p1
type(EMFields), intent(in) :: p2

Return Value type(EMFields)

public elemental function fs_multiply(p1, real_scalar) result(p3)

Defines how to multiply EMFields types by a scalar

Arguments

TypeIntentOptionalAttributesName
type(EMFields), intent(in) :: p1
real(kind=Float64), intent(in) :: real_scalar

Return Value type(EMFields)

public elemental function sf_multiply(real_scalar, p1) result(p3)

Defines how to multiply EMFields types by a scalar

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in) :: real_scalar
type(EMFields), intent(in) :: p1

Return Value type(EMFields)

public elemental function fs_divide(p1, real_scalar) result(p3)

Defines how to divide EMFields types by a scalar

Arguments

TypeIntentOptionalAttributesName
type(EMFields), intent(in) :: p1
real(kind=Float64), intent(in) :: real_scalar

Return Value type(EMFields)

public elemental function lflf_add(p1, p2) result(p3)

Defines how to add two LocalEMFields types

Arguments

TypeIntentOptionalAttributesName
type(LocalEMFields), intent(in) :: p1
type(LocalEMFields), intent(in) :: p2

Return Value type(LocalEMFields)

public elemental function lflf_subtract(p1, p2) result(p3)

Defines how to subtract two LocalEMFields types

Arguments

TypeIntentOptionalAttributesName
type(LocalEMFields), intent(in) :: p1
type(LocalEMFields), intent(in) :: p2

Return Value type(LocalEMFields)

public elemental function lfs_multiply(p1, real_scalar) result(p3)

Defines how to multiply LocalEMFields types by a scalar

Arguments

TypeIntentOptionalAttributesName
type(LocalEMFields), intent(in) :: p1
real(kind=Float64), intent(in) :: real_scalar

Return Value type(LocalEMFields)

public elemental function slf_multiply(real_scalar, p1) result(p3)

Defines how to multiply LocalEMFields types by a scalar

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in) :: real_scalar
type(LocalEMFields), intent(in) :: p1

Return Value type(LocalEMFields)

public elemental function lfs_divide(p1, real_scalar) result(p3)

Defines how to divide LocalEMFields types by a scalar

Arguments

TypeIntentOptionalAttributesName
type(LocalEMFields), intent(in) :: p1
real(kind=Float64), intent(in) :: real_scalar

Return Value type(LocalEMFields)

public function approx_eq(x, y, tol) result(a)

Inexact equality comparison: x ~= y true if abs(x-y) <= tol else false

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in) :: x

First value in comparison

real(kind=Float64), intent(in) :: y

Second value in comparison

real(kind=Float64), intent(in) :: tol

Equality tolerance

Return Value logical

public function approx_ge(x, y, tol) result(a)

Inexact greater than or equal to comparison: x >~= y

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in) :: x

First value in comparison

real(kind=Float64), intent(in) :: y

Second value in comparison

real(kind=Float64), intent(in) :: tol

Equality tolerance

Return Value logical

public function approx_le(x, y, tol) result(a)

Inexact less then or equal to comparison: x <~= y

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in) :: x

First value in comparison

real(kind=Float64), intent(in) :: y

Second value in comparison

real(kind=Float64), intent(in) :: tol

Equality tolerance

Return Value logical

public function cross_product(u, v) result(s)

Calculates the cross product of two vectors: uxv

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: u
real(kind=Float64), intent(in), dimension(3):: v

Return Value real(kind=Float64),dimension(3)

public function in_boundary(bplane, p) result(in_b)

Indicator function for determining if a point on a plane is within the plane boundary

Arguments

TypeIntentOptionalAttributesName
type(BoundedPlane), intent(in) :: bplane

Plane with boundary

real(kind=Float64), intent(in), dimension(3):: p

Point on plane

Return Value logical

public function in_gyro_surface(gs, p) result(in_gs)

Indicator function for determining if a point is inside the gyro_surface

Arguments

TypeIntentOptionalAttributesName
type(GyroSurface), intent(in) :: gs

Gyro-surface

real(kind=Float64), intent(in), dimension(3):: p

Point

Return Value logical

public function in_grid(xyz) result(ing)

Determines if a position pos is in the beam_grid

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: xyz

Position in beam grid coordinates [cm]

Return Value logical

Indicates whether the position is in the beam grid

public function in_passive_grid(uvw) result(ing)

Determines if a position pos is in the pass_grid

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: uvw

Position in machine coordinates [cm]

Return Value logical

Indicates whether the position is in the passive neutral grid

public function gyro_radius(fields, energy, pitch, Ai) result(gyro_rad)

Calculates mean gyro-radius

Arguments

TypeIntentOptionalAttributesName
type(LocalEMFields), intent(in) :: fields

Electromagnetic fields at guiding center

real(kind=Float64), intent(in) :: energy

Energy of particle

real(kind=Float64), intent(in) :: pitch

Particle pitch w.r.t the magnetic field

real(kind=Float64), intent(in) :: Ai

Atomic Mass of ion

Return Value real(kind=Float64)

Mean gyro-radius


Subroutines

public subroutine print_banner()

Prints FIDASIM banner

Arguments

None

public subroutine fast_ion_assign(p1, p2)

Defines how to assign FastIon types to eachother

Arguments

TypeIntentOptionalAttributesName
type(FastIon), intent(out) :: p1
type(FastIon), intent(in) :: p2

public subroutine npa_part_assign(p1, p2)

Defines how to assign NPAParticle types to eachother

Arguments

TypeIntentOptionalAttributesName
type(NPAParticle), intent(out) :: p1
type(NPAParticle), intent(in) :: p2

public subroutine birth_part_assign(p1, p2)

Defines how to assign BirthParticle types to eachother

Arguments

TypeIntentOptionalAttributesName
type(BirthParticle), intent(out) :: p1
type(BirthParticle), intent(in) :: p2

public subroutine neutral_part_assign(p1, p2)

Defines how to assign NeutralParticle types to eachother

Arguments

TypeIntentOptionalAttributesName
type(NeutralParticle), intent(out) :: p1
type(NeutralParticle), intent(in) :: p2

public subroutine npr_assign(r1, r2)

Defines how to assign NeutralParticleReservoir to eachother

Arguments

TypeIntentOptionalAttributesName
type(NeutralParticleReservoir), intent(inout) :: r1
type(NeutralParticleReservoir), intent(in) :: r2

public subroutine np_assign(n1, n2)

Defines how to assign NeutralPopulation to eachother

Arguments

TypeIntentOptionalAttributesName
type(NeutralPopulation), intent(inout) :: n1
type(NeutralPopulation), intent(in) :: n2

public pure subroutine pp_assign(p1, p2)

Defines how to assign Profiles types to eachother

Arguments

TypeIntentOptionalAttributesName
type(Profiles), intent(inout) :: p1
type(Profiles), intent(in) :: p2

public pure subroutine lpp_assign(p1, p2)

Defines how to assign a Profiles type to a LocalProfiles type

Arguments

TypeIntentOptionalAttributesName
type(LocalProfiles), intent(inout) :: p1
type(Profiles), intent(in) :: p2

public pure subroutine plp_assign(p1, p2)

Defines how to assign a LocalProfiles type to a Profiles type

Arguments

TypeIntentOptionalAttributesName
type(Profiles), intent(inout) :: p1
type(LocalProfiles), intent(in) :: p2

public pure subroutine lplp_assign(p1, p2)

Defines how to assign LocalProfiles types to eachother

Arguments

TypeIntentOptionalAttributesName
type(LocalProfiles), intent(inout) :: p1
type(LocalProfiles), intent(in) :: p2

public pure subroutine ff_assign(p1, p2)

Defines how to assign EMFields types to eachother

Arguments

TypeIntentOptionalAttributesName
type(EMFields), intent(inout) :: p1
type(EMFields), intent(in) :: p2

public pure subroutine lff_assign(p1, p2)

Defines how to assign a EMFields type to a LocalEMFields type

Arguments

TypeIntentOptionalAttributesName
type(LocalEMFields), intent(inout) :: p1
type(EMFields), intent(in) :: p2

public pure subroutine flf_assign(p1, p2)

Defines how to assign a LocalEMFields type to a EMFields type

Arguments

TypeIntentOptionalAttributesName
type(EMFields), intent(inout) :: p1
type(LocalEMFields), intent(in) :: p2

public pure subroutine lflf_assign(p1, p2)

Defines how to assign LocalEMFields types to eachother

Arguments

TypeIntentOptionalAttributesName
type(LocalEMFields), intent(inout) :: p1
type(LocalEMFields), intent(in) :: p2

public pure subroutine oo_assign(p1, p2)

Defines how to assign CFPDTable types to eachother

Arguments

TypeIntentOptionalAttributesName
type(CFPDTable), intent(out) :: p1
type(CFPDTable), intent(in) :: p2

public subroutine read_inputs()

Reads input namelist file and stores the results into inputs, nbi, and beam_grid 20 for suffixes and seperators e.g. /, _npa.h5, ...

Arguments

None

public subroutine identify_transition(n_stark, stark_pi, stark_sigma, stark_intens, stark_wavel, line_lambda0)

Arguments

TypeIntentOptionalAttributesName
integer, intent(out) :: n_stark
integer, intent(out), dimension(:), allocatable:: stark_pi
integer, intent(out), dimension(:), allocatable:: stark_sigma
real(kind=FLoat64), intent(out), dimension(:), allocatable:: stark_intens
real(kind=FLoat64), intent(out), dimension(:), allocatable:: stark_wavel
real(kind=Float64), intent(out), dimension(3):: line_lambda0

public subroutine make_beam_grid()

Makes [[libfida:beam_grid] from user defined inputs

Arguments

None

public subroutine make_passive_grid()

Makes [[libfida:pass_grid] from user defined inputs

Arguments

None

public subroutine make_diagnostic_grids()

Makes [[libfida:pass_grid] from user defined inputs, and stores the quantities in spec_chords and npa_chords

Arguments

None

public subroutine read_beam()

Reads neutral beam geometry and stores the quantities in nbi

Arguments

None

public subroutine read_chords()

Reads the spectral geometry and stores the quantities in spec_chords

Arguments

None

public subroutine read_npa()

Reads the NPA geometry and stores the quantities in npa_chords

Arguments

None

public subroutine read_cfpd()

Reads the CFPD geometry and stores the quantities in ctable

Arguments

None

public subroutine read_plasma()

Reads in Plasma composition e.g. the thermal, fast-ion, and impurity species

Arguments

None

public subroutine read_equilibrium()

Reads in the interpolation grid, plasma parameters, and fields and stores the quantities in inter_grid and equil

Arguments

None

public subroutine read_f(fid, error)

Reads in the fast-ion distribution function and stores the quantities in fbm

Arguments

TypeIntentOptionalAttributesName
integer(kind=HID_T), intent(inout) :: fid

HDF5 file ID

integer, intent(out) :: error

Error code

public subroutine read_mc(fid, error)

Reads in a MC particle fast-ion distribution and puts them in particles

Arguments

TypeIntentOptionalAttributesName
integer(kind=HID_T), intent(inout) :: fid

HDF5 file ID

integer, intent(out) :: error

Error code

public subroutine read_distribution()

Reads in the fast-ion distribution

Arguments

None

public subroutine quasineutrality_check()

Checks whether quasi-neutrality is satisfied to some tol

Arguments

None

public subroutine read_atomic_cross(fid, grp, cross)

Reads in a cross section table from file and puts it into a AtomicCrossSection type

Arguments

TypeIntentOptionalAttributesName
integer(kind=HID_T), intent(in) :: fid

HDF5 file ID

character(len=*), intent(in) :: grp

HDF5 group to read from

type(AtomicCrossSection), intent(inout) :: cross

Atomic cross section

public subroutine read_atomic_rate(fid, grp, rates)

Reads in a atomic rate table from file and puts it into a AtomicRates type

Arguments

TypeIntentOptionalAttributesName
integer(kind=HID_T), intent(in) :: fid

HDF5 file ID

character(len=*), intent(in) :: grp

HDF5 group to read from

type(AtomicRates), intent(inout) :: rates

Atomic reaction rates

public subroutine read_atomic_transitions(fid, grp, rates)

Reads in a atomic transitions table from file and puts it into a AtomicTransitions type

Arguments

TypeIntentOptionalAttributesName
integer(kind=HID_T), intent(in) :: fid

HDF5 file ID

character(len=*), intent(in) :: grp

HDF5 group to read from

type(AtomicTransitions), intent(inout) :: rates

Atomic transitions

public subroutine read_nuclear_rates(fid, grp, rates)

Reads in a nuclear reaction rates table from file and puts it into a NuclearRates type

Arguments

TypeIntentOptionalAttributesName
integer(kind=HID_T), intent(in) :: fid

HDF5 file ID

character(len=*), intent(in) :: grp

HDF5 group to read from

type(NuclearRates), intent(inout) :: rates

Atomic reaction rates

public subroutine read_tables()

Reads in atomic tables from file and stores them in tables

Arguments

None

public subroutine write_beam_grid(id, error)

Write beam_grid to an HDF5 file

Arguments

TypeIntentOptionalAttributesName
integer(kind=HID_T), intent(inout) :: id

HDF5 file ID

integer, intent(out) :: error

Error code

public subroutine write_birth_profile()

Writes birth to a HDF5 file

Arguments

None

public subroutine write_neutral_population(id, pop, error)

Writes Neutral Population to HDF5 group

Arguments

TypeIntentOptionalAttributesName
integer(kind=HID_T), intent(inout) :: id

HDF5 group ID

type(NeutralPopulation), intent(in) :: pop

Neutral Population to write

integer, intent(out) :: error

Error code

public subroutine write_neutrals()

Writes neut to a HDF5 file

Arguments

None

public subroutine write_npa()

Writes npa to a HDF5 file

Arguments

None

public subroutine write_spectra()

Writes Spectra to a HDF5 file

Arguments

None

public subroutine write_neutrons()

Writes neutron to a HDF5 file

Arguments

None

public subroutine write_cfpd_weights()

Writes cfpd to a HDF5 file

Arguments

None

public subroutine write_fida_weights()

Writes fweight to a HDF5 file

Arguments

None

public subroutine write_npa_weights()

Writes nweight to a HDF5 file

Arguments

None

public subroutine read_neutral_population(id, pop, error)

Reads neutral population from file

Arguments

TypeIntentOptionalAttributesName
integer(kind=HID_T), intent(in) :: id

HDF5 id

type(NeutralPopulation), intent(inout) :: pop

Neutral Population to populate

integer, intent(out) :: error

Error code

public subroutine read_neutrals()

Reads neutral populations from file and puts it in neut

Arguments

None

public subroutine tb_zyx(alpha, beta, gamma, basis, inv_basis)

Creates active rotation matrix for z-y'-x" rotation given Tait-Bryan angles

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in) :: alpha

Angle of rotation about z

real(kind=Float64), intent(in) :: beta

Angle of rotation about y'

real(kind=Float64), intent(in) :: gamma

Angle of rotation about x"

real(kind=Float64), intent(out), dimension(3,3):: basis

Rotation matrix/basis for transforming from rotated to non-rotated coordinates

real(kind=Float64), intent(out), optional dimension(3,3):: inv_basis

Inverse basis for reverse transformation

public subroutine line_basis(r0, v0, basis, inv_basis)

Calculates basis from a line with +x in the direction of line

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: r0

Starting point of line [cm]

real(kind=Float64), intent(in), dimension(3):: v0

Direction of line

real(kind=Float64), intent(out), dimension(3,3):: basis

Basis for transforming from line coordinates to cartesian

real(kind=Float64), intent(out), optional dimension(3,3):: inv_basis

Inverse basis for the reverse transformation cartesian to line

public subroutine plane_basis(center, redge, tedge, basis, inv_basis)

Calculates basis from 3 points on a plane with +z being the plane normal

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: center

Plane origin

real(kind=Float64), intent(in), dimension(3):: redge

Right edge of plane

real(kind=Float64), intent(in), dimension(3):: tedge

Top edge of plane

real(kind=Float64), intent(out), dimension(3,3):: basis

Basis for transforming from plane to cartesian coordinates

real(kind=Float64), intent(out), optional dimension(3,3):: inv_basis

Inverse basis for the reverse transformation cartesian to plane

public subroutine line_plane_intersect(l0, l, p0, n, p, t)

Calculates the intersection of a line and a plane

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: l0

Point on line

real(kind=Float64), intent(in), dimension(3):: l

Ray of line

real(kind=Float64), intent(in), dimension(3):: p0

Point on plane

real(kind=Float64), intent(in), dimension(3):: n

Normal vector of plane

real(kind=Float64), intent(out), dimension(3):: p

Line-plane intersect point

real(kind=Float64), intent(out) :: t

"time" to intersect

public subroutine line_cylinder_intersect(l0, l, p0, p, t)

Calculates the intersection of a line and a cylinder

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: l0

Point on line

real(kind=Float64), intent(in), dimension(3):: l

Ray of line

real(kind=Float64), intent(in), dimension(3):: p0

Point on cylinder

real(kind=Float64), intent(out), dimension(3):: p

Line-cylinder intersect point

real(kind=Float64), intent(out) :: t

"time" to intersect

public subroutine boundary_edge(bplane, bedge, nb)

Returns 3 x nb array containing points along the BoundedPlane's boundary edge

Arguments

TypeIntentOptionalAttributesName
type(BoundedPlane), intent(in) :: bplane

Bounded plane

real(kind=Float64), intent(out), dimension(:,:):: bedge

Boundary edge points of bounded plane

integer, intent(out) :: nb

Number of points in boundary edge

public subroutine gyro_surface(fields, energy, pitch, Ai, gs)

Calculates the surface of all possible trajectories

Arguments

TypeIntentOptionalAttributesName
type(LocalEMFields), intent(in) :: fields

Electromagnetic fields at guiding center

real(kind=Float64), intent(in) :: energy

Energy of particle

real(kind=Float64), intent(in) :: pitch

Particle pitch w.r.t the magnetic field

real(kind=Float64), intent(in) :: Ai

Ion atomic mass

type(GyroSurface), intent(out) :: gs

Gyro-surface

public subroutine line_gyro_surface_intersect(r0, v0, gs, t)

Calculates the times of intersection of a line and a gyro-surface

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: r0

Point on line

real(kind=Float64), intent(in), dimension(3):: v0

Direction of line

type(GyroSurface), intent(in) :: gs

Gyro-surface

real(kind=Float64), intent(out), dimension(2):: t

"time" to intersect

public subroutine gyro_surface_coordinates(gs, p, u)

Calculates the parametric coordinates, u, of point p on the gyro_surface

Arguments

TypeIntentOptionalAttributesName
type(GyroSurface), intent(in) :: gs

Gyro_surface

real(kind=Float64), intent(in), dimension(3):: p

Point on gyro_surface

real(kind=Float64), intent(out), dimension(2):: u

Parametric coordinates (gyro-angle, t)

public subroutine gyro_trajectory(gs, theta, ri, vi)

Calculate particle trajectory for a given gyro-angle and gyro-surface

Arguments

TypeIntentOptionalAttributesName
type(GyroSurface), intent(in) :: gs

Gyro-Surface

real(kind=Float64), intent(in) :: theta

Gyro-angle

real(kind=Float64), dimension(3):: ri

Particle position

real(kind=Float64), dimension(3):: vi

Particle Velocity

public subroutine gyro_range(b, gs, gyrange, nrange)

Calculates the range(s) of gyro-angles that would land within a bounded plane

Arguments

TypeIntentOptionalAttributesName
type(BoundedPlane), intent(in) :: b

Bounded Plane

type(GyroSurface), intent(in) :: gs

Gyro-surface

real(kind=Float64), intent(out), dimension(2,4):: gyrange

(theta, dtheta) values

integer, intent(out) :: nrange

Number of ranges. 1 <= nrange <= 4

public subroutine npa_gyro_range(ichan, gs, gyrange, nrange)

Calculates range of gyro-angles that would hit the NPA detector

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: ichan

Index of NPA detector

type(GyroSurface), intent(in) :: gs
real(kind=Float64), intent(out), dimension(2,4):: gyrange
integer, intent(out) :: nrange

public subroutine hit_npa_detector(r0, v0, d_index, rd, det)

Routine to check if a particle will hit a NPA detector

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: r0

Starting point of particle

real(kind=Float64), intent(in), dimension(3):: v0

Particle velocity

integer, intent(out) :: d_index

Index of NPA detector. Zero if particle doesn't hit

real(kind=Float64), intent(out), optional dimension(3):: rd

Point where particle hit detector

integer, intent(in), optional :: det

Index of NPA detector to check

public subroutine xyz_to_uvw(xyz, uvw)

Convert beam coordinate xyz to machine coordinate uvw

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: xyz
real(kind=Float64), intent(out), dimension(3):: uvw

public subroutine xyz_to_cyl(xyz, cyl)

Convert beam coordinate xyz to cylindrical coordinate cyl

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: xyz
real(kind=Float64), intent(out), dimension(3):: cyl

public subroutine uvw_to_xyz(uvw, xyz)

Convert machine coordinate uvw to beam coordinate xyz

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: uvw
real(kind=Float64), intent(out), dimension(3):: xyz

public subroutine cyl_to_uvw(cyl, uvw)

Convert cylindrical coordinate cyl to machine coordinate uvw

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: cyl
real(kind=Float64), intent(out), dimension(3):: uvw

public subroutine cyl_to_xyz(cyl, xyz)

Convert cylindrical coordinate cyl to beam coordinate xyz

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: cyl
real(kind=Float64), intent(out), dimension(3):: xyz

public subroutine uvw_to_cyl(uvw, cyl)

Convert machine coordinate uvw to cylindrical coordinate cyl

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: uvw
real(kind=Float64), intent(out), dimension(3):: cyl

public subroutine convert_sightline_to_xyz(ie3, ist, iray, ich, xyz, v3_xyz)

Convert sightline position and velocity from cylindrical coordinate rpz to beam coordinate xyz

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: ie3

CFPD energy index

integer, intent(in) :: ist

Step index

integer, intent(in) :: iray

"Ray" index

integer, intent(in) :: ich

Detector channel

real(kind=Float64), intent(out), dimension(3):: xyz

Sightline position in beam coordinates

real(kind=Float64), intent(out), dimension(3):: v3_xyz

Sightline velocity in beam coordinates

public subroutine grid_intersect(r0, v0, length, r_enter, r_exit, center_in, lwh_in, passive)

Calculates a particles intersection length with the beam_grid

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: r0

Initial position of particle [cm]

real(kind=Float64), intent(in), dimension(3):: v0

Velocity of particle [cm/s]

real(kind=Float64), intent(out) :: length

Intersection length [cm]

real(kind=Float64), intent(out), dimension(3):: r_enter

Point where particle enters

real(kind=Float64), intent(out), dimension(3):: r_exit

Point where particle exits

real(kind=Float64), intent(in), optional dimension(3):: center_in

Alternative grid center

real(kind=Float64), intent(in), optional dimension(3):: lwh_in

Alternative grid [length,width,height]

logical, intent(in), optional :: passive

Calculates a particles intersection length with the pass_grid

public subroutine circle_grid_intersect(r0, e1, e2, radius, beam_grid_phi_enter, beam_grid_phi_exit)

Calculates the intersection arclength of a circle with the beam_grid

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: r0

Position of center enter of the circle in beam grid coordinates [cm]

real(kind=Float64), intent(in), dimension(3):: e1

Unit vector pointing towards (R, 0) (r,phi) position of the circle in beam grid coordinates

real(kind=Float64), intent(in), dimension(3):: e2

Unit vector pointing towards (R, pi/2) (r,phi) position of the circle in beam grid coordinates

real(kind=Float64), intent(in) :: radius

Radius of circle [cm]

real(kind=Float64), intent(out) :: beam_grid_phi_enter

Phi value where the circle entered the beam_grid [rad]

real(kind=Float64), intent(out) :: beam_grid_phi_exit

Phi value where the circle exits the beam_grid [rad]

public subroutine get_indices(pos, ind)

Find closests beam_grid indices ind to position pos

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: pos

Position [cm]

integer(kind=Int32), intent(out), dimension(3):: ind

Closest indices to position

public subroutine get_passive_grid_indices(pos, ind, input_coords)

Find closest pass_grid indices ind to position pos

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: pos

Position [cm]

integer(kind=Int32), intent(out), dimension(3):: ind

Closest indices to position

integer, intent(in), optional :: input_coords

Indicates coordinate system of pos. Beam grid (0), machine (1) and cylindrical (2)

public subroutine get_interpolation_grid_indices(pos, ind, input_coords)

Find closest inter_grid indices ind to position pos

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: pos

Position [cm]

integer(kind=Int32), intent(out), dimension(3):: ind

Closest indices to position

integer, intent(in), optional :: input_coords

Indicates coordinate system of pos. Beam grid (0), machine (1) and cylindrical (2)

public subroutine get_plasma_extrema(r0, v0, extrema, x0, y0)

Returns extrema points where line(s) parametrized by r0 and v0 intersect the plasma boudnary

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(:,:):: r0

Arrays the define line(s) in machine coordinates

real(kind=Float64), intent(in), dimension(:,:):: v0

Arrays the define line(s) in machine coordinates

real(kind=Float64), intent(out), dimension(2,3):: extrema

Minimum and maximumm R, Z, and Phi points

real(kind=Float64), intent(in), optional dimension(:):: x0

Additional x and y points to consider

real(kind=Float64), intent(in), optional dimension(:):: y0

Additional x and y points to consider

public subroutine get_position(ind, pos, input_coords)

Get position pos given indices ind

Arguments

TypeIntentOptionalAttributesName
integer(kind=Int32), intent(in), dimension(3):: ind

Indices

real(kind=Float64), intent(out), dimension(3):: pos

Position in beam_grid coordinates [cm]

integer, intent(in), optional :: input_coords

Indicates coordinate system of ind. Beam grid (0) and cylindrical (2)

public subroutine track(rin, vin, tracks, ntrack, los_intersect)

Computes the path of a neutral through the beam_grid

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: rin

Initial position of particle

real(kind=Float64), intent(in), dimension(3):: vin

Initial velocity of particle

type(ParticleTrack), intent(inout), dimension(:):: tracks

Array of ParticleTrack type

integer(kind=Int32), intent(out) :: ntrack

Number of cells that a particle crosses

logical, intent(out), optional :: los_intersect

Indicator whether particle intersects a LOS in spec_chords

public subroutine track_cylindrical(rin, vin, tracks, ntrack, los_intersect)

Computes the path of a neutral through the pass_grid

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: rin

Initial position of particle

real(kind=Float64), intent(in), dimension(3):: vin

Initial velocity of particle

type(ParticleTrack), intent(inout), dimension(:):: tracks

Array of ParticleTrack type

integer(kind=Int32), intent(out) :: ntrack

Number of cells that a particle crosses

logical, intent(out), optional :: los_intersect

Indicator whether particle intersects a LOS in spec_chords

public subroutine in_plasma(xyz, inp, input_coords, coeffs, uvw_out)

Indicator subroutine to determine if a position is in a region where the plasma parameter and fields are valid/known

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: xyz

Position in beam coordinates

logical, intent(out) :: inp

Indicates whether plasma parameters and fields are valid/known

integer, intent(in), optional :: input_coords

Indicates coordinate system of xyz. Beam grid (0), machine (1) and cylindrical (2)

type(InterpolCoeffs3D), intent(out), optional :: coeffs

Interpolation coefficients used in calculation

real(kind=Float64), intent(out), optional dimension(3):: uvw_out

Position in machine coordinates

public subroutine get_plasma(plasma, pos, ind, input_coords, output_coords)

Gets plasma parameters at position pos or beam_grid indices ind

Arguments

TypeIntentOptionalAttributesName
type(LocalProfiles), intent(out) :: plasma

Plasma parameters at pos/ind

real(kind=Float64), intent(in), optional dimension(3):: pos

Position in beam grid coordinates

integer(kind=Int32), intent(in), optional dimension(3):: ind

beam_grid indices

integer(kind=Int32), intent(in), optional :: input_coords

Indicates coordinate system of inputs. Beam grid (0), machine (1) and cylindrical (2)

integer(kind=Int32), intent(in), optional :: output_coords

Indicates coordinate system of outputs. Beam grid (0), machine (1) and cylindrical (2)

public pure subroutine calc_perp_vectors(b, a, c)

Calculates normalized vectors that are perpendicular to b such that a x c = b_norm

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: b
real(kind=Float64), intent(out), dimension(3):: a
real(kind=Float64), intent(out), dimension(3):: c

public subroutine get_fields(fields, pos, ind, input_coords, output_coords)

Gets electro-magnetic fields at position pos or beam_grid indices ind

Arguments

TypeIntentOptionalAttributesName
type(LocalEMFields), intent(out) :: fields

Electro-magnetic fields at pos/ind

real(kind=Float64), intent(in), optional dimension(3):: pos

Position in beam grid coordinates

integer(kind=Int32), intent(in), optional dimension(3):: ind

beam_grid indices

integer(kind=Int32), intent(in), optional :: input_coords

Indicates coordinate system of inputs. Beam grid (0), machine (1) and cylindrical (2)

integer(kind=Int32), intent(in), optional :: output_coords

Indicates coordinate system of outputs. Beam grid (0), machine (1) and cylindrical (2)

public subroutine get_distribution(fbeam, denf, pos, ind, coeffs)

Gets Guiding Center distribution at position pos or beam_grid indices ind

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(out), dimension(:,:):: fbeam

Guiding Center Fast-ion distribution at pos/ind: F(E,p)

real(kind=Float64), intent(out) :: denf

Guiding Center Fast-ion density at pos/ind [fast-ions/cm^3]

real(kind=Float64), intent(in), optional dimension(3):: pos

Position in beam grid coordinates

integer(kind=Int32), intent(in), optional dimension(3):: ind

beam_grid indices

type(InterpolCoeffs3D), intent(in), optional :: coeffs

Precomputed interpolation coefficients

public subroutine get_ep_denf(energy, pitch, denf, pos, ind, coeffs)

Get guiding center fast-ion density at given energy and pitch at position pos or beam_grid indices ind

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in) :: energy

Energy [keV]

real(kind=Float64), intent(in) :: pitch

Pitch

real(kind=Float64), intent(out) :: denf

Fast-ion density [fast-ions/(cm^3dEdp)]

real(kind=Float64), intent(in), optional dimension(3):: pos

Position in beam grid coordinates

integer(kind=Int32), intent(in), optional dimension(3):: ind

beam_grid indices

type(InterpolCoeffs3D), intent(in), optional :: coeffs

Precomputed interpolation coefficients

public subroutine init_reservoir(res)

Initialize reservoir

Arguments

TypeIntentOptionalAttributesName
type(NeutralParticleReservoir), intent(inout) :: res

Neutral Particle Reservoir

Size of reservoir

public subroutine update_reservoir(res, vn, wght)

Store neutrals in reservoir

Arguments

TypeIntentOptionalAttributesName
type(NeutralParticleReservoir), intent(inout) :: res

beam_grid indices

real(kind=Float64), intent(in), dimension(3):: vn

Neutral particle velocity [cm/s]

real(kind=Float64), intent(in) :: wght

Neutral weight

public subroutine merge_reservoirs(res1, res2)

Merge reservoir 2 into reservoir 1

Arguments

TypeIntentOptionalAttributesName
type(NeutralParticleReservoir), intent(inout) :: res1

Reservoir 1

type(NeutralParticleReservoir), intent(inout) :: res2

Reservoir 2

public subroutine init_neutral_population(pop)

Initialize NeutralPopulation

Arguments

TypeIntentOptionalAttributesName
type(NeutralPopulation), intent(inout) :: pop

Neutral Population to initialize

public subroutine free_neutral_population(pop)

Initialize NeutralPopulation

Arguments

TypeIntentOptionalAttributesName
type(NeutralPopulation), intent(inout) :: pop

Neutral Population to initialize

public subroutine update_neutrals(pop, ind, vn, dens)

Update [NeutralPopulation]] pop at ind

Arguments

TypeIntentOptionalAttributesName
type(NeutralPopulation), intent(inout) :: pop

Neutral Population

integer(kind=Int32), intent(in), dimension(3):: ind

beam_grid indices

real(kind=Float64), intent(in), dimension(3):: vn

Neutral particle velocity [cm/s]

real(kind=Float64), intent(in), dimension(:):: dens

Neutral density [neutrals/cm^3]

public subroutine store_neutrals(ind, pos, vn, neut_type, dens)

Arguments

TypeIntentOptionalAttributesName
integer(kind=Int32), intent(in), dimension(3):: ind

beam_grid indices

real(kind=Float64), intent(in), dimension(3):: pos

Neutral particle position [cm]

real(kind=Float64), intent(in), dimension(3):: vn

Neutral particle velocity [cm/s]

integer, intent(in) :: neut_type

Neutral type

real(kind=Float64), intent(in), dimension(nlevs):: dens

Neutral density [neutrals/cm^3]

public subroutine merge_neutral_populations(pop1, pop2)

Merge NeutralPopulations

Arguments

TypeIntentOptionalAttributesName
type(NeutralPopulation), intent(inout) :: pop1

Neutral Population target

type(NeutralPopulation), intent(inout) :: pop2

Neutral Population to merge into target

public subroutine parallel_merge_reservoirs(res)

Merge neutral particle reservoirs across MPI processes

Arguments

TypeIntentOptionalAttributesName
type(NeutralParticleReservoir), intent(inout) :: res

Neutral Particle Reservoir

public subroutine parallel_merge_populations(pop)

Update neutral population

Arguments

TypeIntentOptionalAttributesName
type(NeutralPopulation), intent(inout) :: pop

Neutral Population

public subroutine store_births(ind, neut_type, dflux)

Store birth particles/density in birth

Arguments

TypeIntentOptionalAttributesName
integer(kind=Int32), intent(in), dimension(3):: ind

beam_grid indices

integer(kind=Int32), intent(in) :: neut_type

Neutral type

real(kind=Float64), intent(in) :: dflux

Deposited flux

public subroutine store_npa(det, ri, rf, vn, flux, orbit_class, passive)

Store NPA particles in npa

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: det

Detector/Channel Number

real(kind=Float64), intent(in), dimension(3):: ri

Birth position in beam coordinates [cm]

real(kind=Float64), intent(in), dimension(3):: rf

Detector position in beam coordinates [cm]

real(kind=Float64), intent(in), dimension(3):: vn

Particle velocity [cm/s]

real(kind=Float64), intent(in) :: flux

Neutral flux [neutrals/s]

integer, intent(in), optional :: orbit_class

Orbit class ID

logical, intent(in), optional :: passive

Indicates whether npa particle is passive

public subroutine bb_cx_rates(denn, vn, vi, rates)

Get beam-beam neutralization/cx rates

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(nlevs):: denn

Neutral density [cm^-3]

real(kind=Float64), intent(in), dimension(3):: vn

Neutral velocity [cm/s]

real(kind=Float64), intent(in), dimension(3):: vi

Ion velocity [cm/s]

real(kind=Float64), intent(out), dimension(nlevs):: rates

Reaction rates [1/s]

public subroutine bt_cx_rates(plasma, denn, an, vi, rates)

Get beam-target neutralization/cx rates

Arguments

TypeIntentOptionalAttributesName
type(LocalProfiles), intent(in) :: plasma

Plasma parameters (for neutral temperature and vrot)

real(kind=Float64), intent(in), dimension(nlevs):: denn

Neutral density [cm^-3]

real(kind=Float64), intent(in) :: an

Neutral mass [amu]

real(kind=Float64), intent(in), dimension(3):: vi

Ion velocity [cm/s]

real(kind=Float64), intent(out), dimension(nlevs):: rates

Reaction rates [1/s]

public subroutine get_dd_rate(plasma, eb, rate, branch)

Gets d(d,p)T rate for a beam with energy eb interacting with a target plasma

Arguments

TypeIntentOptionalAttributesName
type(LocalProfiles), intent(in) :: plasma

Plasma Paramters

real(kind=Float64), intent(in) :: eb

Beam energy [keV]

real(kind=Float64), intent(out) :: rate

Neutron reaction rate [1/s]

integer, intent(in), optional :: branch

Indicates 1 for cfpd rate and 2 for neutron rate

public subroutine get_ddpt_anisotropy(plasma, v1, v3, kappa)

Gets d(d,p)T anisotropy defecit/enhancement factor for a beam interacting with a target plasma

Arguments

TypeIntentOptionalAttributesName
type(LocalProfiles), intent(in) :: plasma

Plasma Paramters

real(kind=Float64), intent(in), dimension(3):: v1

Beam velocity [cm/s]

real(kind=Float64), intent(in), dimension(3):: v3

Charged Fusion Product velocity [cm/s]

real(kind=Float64), intent(out) :: kappa

Anisotropy factor Reference: Eq. (1) and (3) of NIM A236 (1985) 380

public subroutine get_pgyro(fields, E3, E1, pitch, plasma, v3_xyz, pgyro, gam0)

Returns fraction of gyroangles that can produce a reaction with given inputs

Arguments

TypeIntentOptionalAttributesName
type(LocalEMFields), intent(in) :: fields

Electromagneticfields in beam coordinates

real(kind=Float64), intent(in) :: E3

E3 charged fusion product energy [keV]

real(kind=Float64), intent(in) :: E1

E1 fast-ion energy [keV]

real(kind=Float64), intent(in) :: pitch

pitch fast ion pitch relative to the field

type(LocalProfiles), intent(in) :: plasma

Plasma Paramters in beam coordinates

real(kind=Float64), intent(in), dimension(3):: v3_xyz

Charged fusion product velocity in beam coorindates

real(kind=Float64), intent(out) :: pgyro

pgyro DeltaE_3*\partial\gam/\partial E_3/pi

real(kind=Float64), intent(out) :: gam0

Gyro angle of fast ion [rad]

public subroutine neutral_cx_rate(denn, res, v_ion, rates)

Get probability of a thermal ion charge exchanging with neutral population within cell

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(nlevs):: denn

Neutral density

type(NeutralParticleReservoir), intent(in) :: res

Neutral Particle Reservoir

real(kind=Float64), intent(in), dimension(3):: v_ion

Ion velocity [cm/s]

real(kind=Float64), intent(out), dimension(nlevs):: rates

Total charge exchange rate [1/s]

public subroutine get_total_cx_rate(ind, pos, v_ion, types, rate_tot)

Get probability of a thermal ion charge exchanging with types neutrals

Arguments

TypeIntentOptionalAttributesName
integer(kind=Int32), intent(in), dimension(3):: ind

beam_grid indices

real(kind=Float64), intent(in), dimension(3):: pos

Interaction position in beam grid coordinates

real(kind=Float64), intent(in), dimension(3):: v_ion

Ion velocity [cm/s]

integer(kind=Int32), intent(in), dimension(:):: types

Neutral types

real(kind=Float64), intent(out), dimension(nlevs):: rate_tot

Total charge exchange rate [1/s]

public subroutine get_rate_matrix(plasma, ab, eb, rmat)

Gets rate matrix for use in colrad

Arguments

TypeIntentOptionalAttributesName
type(LocalProfiles), intent(in) :: plasma

Plasma parameters

real(kind=Float64), intent(in) :: ab

"Beam" ion mass [amu]

real(kind=Float64), intent(in) :: eb

"Beam" ion energy [keV]

real(kind=Float64), intent(out), dimension(nlevs,nlevs):: rmat

Rate matrix

public subroutine colrad(plasma, ab, vn, dt, states, dens, photons)

Evolve density of states in time dt via collisional radiative model

Arguments

TypeIntentOptionalAttributesName
type(LocalProfiles), intent(in) :: plasma

Plasma parameters

real(kind=Float64), intent(in) :: ab

Ion/Neutral mass [amu]

real(kind=Float64), intent(in), dimension(:):: vn

Neutral velocitiy [cm/s]

real(kind=Float64), intent(in) :: dt

Time interval [s]

real(kind=Float64), intent(inout), dimension(:):: states

Density of states

real(kind=Float64), intent(out), dimension(nlevs):: dens

Density of neutrals

real(kind=Float64), intent(out) :: photons

Emitted photons

public subroutine attenuate(ri, rf, vi, states, dstep_in)

Attenuate states along a trajectory

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: ri

Initial position in beam grid coordinates

real(kind=Float64), intent(in), dimension(3):: rf

Final position in beam grid coordinates

real(kind=Float64), intent(in), dimension(3):: vi

Initial velocity of neutral

real(kind=Float64), intent(inout), dimension(nlevs):: states

Density of states

real(kind=Float64), intent(in), optional :: dstep_in

Step length [cm]

public subroutine doppler_stark(vecp, vi, fields, lambda0, lambda)

Calculates doppler shift and stark split wavelengths

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: vecp

Vector directing towards optical head

real(kind=Float64), intent(in), dimension(3):: vi

Particle velocity

type(LocalEMFields), intent(in) :: fields

Electro-magnetic fields

real(kind=Float64), intent(in) :: lambda0

Reference wavelength [nm]

real(kind=Float64), intent(out), dimension(n_stark):: lambda

Wavelengths [nm]

public subroutine spectrum(vecp, vi, fields, lambda0, sigma_pi, photons, dlength, lambda, intensity, stokes)

Calculates doppler shift, stark splitting, and intensities

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: vecp

Vector directing towards optical head

real(kind=Float64), intent(in), dimension(3):: vi

Particle velocity

type(LocalEMFields), intent(in) :: fields

Electro-magnetic fields

real(kind=Float64), intent(in) :: lambda0

Reference wavelength [nm]

real(kind=Float64), intent(in) :: sigma_pi

Sigma-pi ratio

real(kind=Float64), intent(in) :: photons

Photon density from colrad

real(kind=Float64), intent(in) :: dlength

LOS intersection length with beam_grid cell particle is in

real(kind=Float64), intent(out), dimension(n_stark):: lambda

Wavelengths [nm]

real(kind=Float64), intent(out), dimension(n_stark):: intensity
real(kind=Float64), intent(out), dimension(n_stark,4):: stokes

Spectra intensities [Ph/(s cm^2 starkline)]

public subroutine store_photons(pos, vi, lambda0, photons, spectra, stokevec, passive)

Store photons in spectra

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: pos

Position of neutral in beam coordinates [machine coordinates for passive case]

real(kind=Float64), intent(in), dimension(3):: vi

Velocitiy of neutral in beam coordinates [cm/s]

real(kind=Float64), intent(in) :: lambda0

Reference wavelength [nm]

real(kind=Float64), intent(in) :: photons

Photons from colrad [Ph/(s*cm^3)]

real(kind=Float64), intent(inout), dimension(:,:,:):: spectra

Stark split spectra

real(kind=Float64), intent(inout), dimension(:,:,:,:):: stokevec

Stark split stokes vector

logical, intent(in), optional :: passive

Indicates whether photon is passive FIDA

public subroutine store_nbi_photons(pos, vi, lambda0, photons, neut_type)

Store BES photons in Spectra

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: pos

Position of neutral in beam grid coordinates

real(kind=Float64), intent(in), dimension(3):: vi

Velocitiy of neutral [cm/s]

real(kind=Float64), intent(in) :: lambda0

Reference wavelength [nm]

real(kind=Float64), intent(in) :: photons

Photons from colrad [Ph/(s*cm^3)]

integer, intent(in) :: neut_type

Neutral type (full,half,third,halo)

public subroutine store_fida_photons(pos, vi, lambda0, photons, orbit_class, passive)

Store fida photons in Spectra

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: pos

Position of neutral in beam grid coordinates

real(kind=Float64), intent(in), dimension(3):: vi

Velocitiy of neutral [cm/s]

real(kind=Float64), intent(in) :: lambda0

Reference wavelength [nm]

real(kind=Float64), intent(in) :: photons

Photons from colrad [Ph/(s*cm^3)]

integer, intent(in), optional :: orbit_class

Orbit class ID

logical, intent(in), optional :: passive

Indicates whether photon is passive FIDA

public subroutine store_photon_birth(pos, photons, res, passive)

Store neutral birth location of the photon source

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: pos

Birth location of the photon source neutral

real(kind=Float64), intent(in) :: photons

Number of photons

type(NeutralParticleReservoir), intent(inout), dimension(:):: res

reservoir of neutral particles

logical, intent(in), optional :: passive

public subroutine store_neutrons(rate, orbit_class)

Store neutron rate in neutron

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in) :: rate

Neutron rate [neutrons/sec]

integer, intent(in), optional :: orbit_class

Orbit class ID

public subroutine store_fw_photons_at_chan(ichan, eind, pind, vp, vi, lambda0, fields, dlength, sigma_pi, denf, photons)

Store FIDA weight photons in fweight for a specific channel

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: ichan

Channel index

integer, intent(in) :: eind

Energy index

integer, intent(in) :: pind

Pitch index

real(kind=Float64), intent(in), dimension(3):: vp

Vector pointing toward optical head

real(kind=Float64), intent(in), dimension(3):: vi

Velocity of neutral [cm/s]

real(kind=Float64), intent(in) :: lambda0

Reference Wavelength [nm]

type(LocalEMFields), intent(in) :: fields

Electro-magnetic fields

real(kind=Float64), intent(in) :: dlength

LOS intersection length with beam_grid cell particle is in

real(kind=Float64), intent(in) :: sigma_pi

Sigma-pi ratio for channel

real(kind=Float64), intent(in) :: denf

Fast-ion density [cm^-3]

real(kind=Float64), intent(in) :: photons

Photons from colrad [Ph/(s*cm^3)]

public subroutine store_fw_photons(eind, pind, pos, vi, lambda0, denf, photons)

Store FIDA weight photons in fweight

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: eind

Energy index

integer, intent(in) :: pind

Pitch index

real(kind=Float64), intent(in), dimension(3):: pos

Position of neutral

real(kind=Float64), intent(in), dimension(3):: vi

Velocity of neutral [cm/s]

real(kind=Float64), intent(in) :: lambda0

Reference Wavelength [nm]

real(kind=Float64), intent(in) :: denf

Fast-ion density [cm^-3]

real(kind=Float64), intent(in) :: photons

Photons from colrad [Ph/(s*cm^3)]

public subroutine get_nlaunch(nr_markers, papprox, nlaunch)

Sets the number of MC markers launched from each beam_grid cell

Arguments

TypeIntentOptionalAttributesName
integer(kind=Int64), intent(in) :: nr_markers

Approximate total number of markers to launch

real(kind=Float64), intent(in), dimension(:,:,:), target:: papprox

beam_grid cell weights

integer(kind=Int32), intent(out), dimension(:,:,:):: nlaunch

Number of mc markers to launch for each cell: nlaunch(x,y,z)

public subroutine get_nlaunch_pass_grid(nr_markers, papprox, nlaunch)

Sets the number of MC markers launched from each pass_grid cell

Arguments

TypeIntentOptionalAttributesName
integer(kind=Int64), intent(in) :: nr_markers

Approximate total number of markers to launch

real(kind=Float64), intent(in), dimension(:,:,:):: papprox

pass_grid cell weights

integer(kind=Int32), intent(out), dimension(:,:,:):: nlaunch

Number of mc markers to launch for each cell: nlaunch(r,z,phi)

public subroutine pitch_to_vec(pitch, gyroangle, fields, vi_norm)

Calculates velocity vector from pitch, gyroangle and fields

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in) :: pitch

Pitch

real(kind=Float64), intent(in) :: gyroangle

Gyroangle [radians]

type(LocalEMFields), intent(in) :: fields

Electromagnetic fields

real(kind=Float64), intent(out), dimension(3):: vi_norm

Normalized velocity vector

public subroutine gyro_step(vi, fields, Ai, r_gyro)

Calculates gyro-step

Read more…

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(in), dimension(3):: vi

Ion velocity

type(LocalEMFields), intent(in) :: fields

Electro-magnetic fields

real(kind=Float64), intent(in) :: Ai

Atomic mass of ion

real(kind=Float64), intent(out), dimension(3):: r_gyro

Gyro-step Gyro-radius vector from particle position to guiding center

public subroutine gyro_correction(fields, energy, pitch, Ai, rp, vp, theta_in)

Calculates gyro correction for Guiding Center MC distribution calculation

Arguments

TypeIntentOptionalAttributesName
type(LocalEMFields), intent(in) :: fields

Electromagnetic fields at guiding center

real(kind=Float64), intent(in) :: energy

Energy of particle

real(kind=Float64), intent(in) :: pitch

Particle pitch w.r.t the magnetic field

real(kind=Float64), intent(in) :: Ai

Atomic mass of Ion

real(kind=Float64), intent(out), dimension(3):: rp

Particle position

real(kind=Float64), intent(out), dimension(3):: vp

Particle velocity

real(kind=Float64), intent(in), optional :: theta_in

Gyro-angle

public subroutine mc_beam_grid(ind, ri)

Sample uniformally in beam grid cell

Arguments

TypeIntentOptionalAttributesName
integer, intent(in), dimension(3):: ind

Cell index

real(kind=Float64), intent(out), dimension(3):: ri

Position in cell

public subroutine mc_passive_grid(ind, ri)

Sample uniformally in passive grid cell

Arguments

TypeIntentOptionalAttributesName
integer, intent(in), dimension(3):: ind

Cell index

real(kind=Float64), intent(out), dimension(3):: ri

Position in cell

public subroutine mc_fastion(ind, fields, eb, ptch, denf)

Samples a Guiding Center Fast-ion distribution function at a given beam_grid index

Arguments

TypeIntentOptionalAttributesName
integer, intent(in), dimension(3):: ind

beam_grid index

type(LocalEMFields), intent(out) :: fields

Electromagnetic fields at the guiding center

real(kind=Float64), intent(out) :: eb

Energy of the fast ion

real(kind=Float64), intent(out) :: ptch

Pitch of the fast ion

real(kind=Float64), intent(out) :: denf

Fast-ion density at guiding center

public subroutine mc_fastion_pass_grid(ind, fields, eb, ptch, denf, output_coords)

Samples a Guiding Center Fast-ion distribution function at a given pass_grid index

Arguments

TypeIntentOptionalAttributesName
integer, intent(in), dimension(3):: ind

pass_grid index

type(LocalEMFields), intent(out) :: fields

Electromagnetic fields at the guiding center

real(kind=Float64), intent(out) :: eb

Energy of the fast ion

real(kind=Float64), intent(out) :: ptch

Pitch of the fast ion

real(kind=Float64), intent(out) :: denf

Fast-ion density at guiding center

integer, intent(in), optional :: output_coords

Indicates coordinate system of fields. Beam grid (0), machine (1) and cylindrical (2)

public subroutine mc_halo(plasma, ai, vhalo)

Generate velocity vector from a thermal Maxwellian distribution

Arguments

TypeIntentOptionalAttributesName
type(LocalProfiles), intent(in) :: plasma

Plasma Parameters

real(kind=Float64), intent(in) :: ai

Ion mass [amu]

real(kind=Float64), intent(out), dimension(3):: vhalo

Velocity [cm/s]

public subroutine mc_nbi(vnbi, efrac, rnbi, err)

Generates a neutral beam particle trajectory

Arguments

TypeIntentOptionalAttributesName
real(kind=Float64), intent(out), dimension(3):: vnbi

Velocity [cm/s]

integer, intent(in) :: efrac

Beam neutral type (1,2,3)

real(kind=Float64), intent(out), dimension(3):: rnbi

Starting position on beam_grid

logical, intent(out) :: err

Error Code

public subroutine mc_nbi_cell(ind, neut_type, vnbi, weight)

Generates a neutral beam velocity vector that passes through cell at ind with weight weight

Arguments

TypeIntentOptionalAttributesName
integer, intent(in), dimension(3):: ind

Cell index

integer, intent(in) :: neut_type

Neutral Type (1=Full,2=Half,3=Third)

real(kind=Float64), intent(out), dimension(3):: vnbi

Normalized Velocity

real(kind=Float64), intent(out) :: weight

Weigth/probability of trajectory

public subroutine ndmc()

Calculates neutral beam deposition and spectra

Arguments

None

public subroutine dcx()

Calculates Direct Charge Exchange (DCX) neutral density and spectra

Arguments

None

public subroutine halo()

Calculates halo neutral density and spectra

Arguments

None

public subroutine nbi_spec()

Calculates approximate neutral beam emission (full, half, third) from user supplied neutrals file

Arguments

None

public subroutine dcx_spec()

Calculates DCX emission from user supplied neutrals file

Arguments

None

public subroutine halo_spec()

Calculates halo emission from user supplied neutrals file

Arguments

None

public subroutine cold_spec()

Calculates cold D-alpha emission

Arguments

None

public subroutine bremsstrahlung()

Calculates bremsstrahlung

Arguments

None

public subroutine fida_f()

Calculate Active FIDA emission using a Fast-ion distribution function F(E,p,r,z)

Arguments

None

public subroutine pfida_f()

Calculate Passive FIDA emission using a Fast-ion distribution function F(E,p,r,z)

Arguments

None

public subroutine fida_mc()

Calculate Active FIDA emission using a Monte Carlo Fast-ion distribution

Arguments

None

public subroutine pfida_mc()

Calculate Passive FIDA emission using a Monte Carlo Fast-ion distribution

Arguments

None

public subroutine npa_f()

Calculate Active NPA flux using a fast-ion distribution function F(E,p,r,z)

Arguments

None

public subroutine pnpa_f()

Calculate Passive NPA flux using a fast-ion distribution function F(E,p,r,z)

Arguments

None

public subroutine npa_mc()

Calculate Active NPA flux using a Monte Carlo fast-ion distribution

Arguments

None

public subroutine pnpa_mc()

Calculate Passive NPA flux using a Monte Carlo fast-ion distribution

Arguments

None

public subroutine neutron_f()

Calculate neutron emission rate using a fast-ion distribution function F(E,p,r,z)

Arguments

None

public subroutine cfpd_f()

Calculate charged fusion product count rate and weight function using a fast-ion distribution function F(E,p,r,z)

Arguments

None

public subroutine neutron_mc()

Calculate neutron flux using a Monte Carlo Fast-ion distribution

Arguments

None

public subroutine fida_weights_mc()

Calculates FIDA weights

Arguments

None

public subroutine fida_weights_los()

Calculates LOS averaged FIDA weights

Arguments

None

public subroutine npa_weights()

Calculates NPA weights

Arguments

None