species Module

FIXME : Add documentation



Contents


Variables

Type Visibility Attributes Name Initial
integer, private, parameter :: ion_species = 1
integer, private, parameter :: electron_species = 2
integer, public, parameter :: tracer_species = 3
integer, private, parameter :: hybrid_electron_species = 4
integer, private, parameter, dimension(*) :: electron_like_species = [electron_species, hybrid_electron_species]
integer, public, parameter :: f0_maxwellian = 1

Regular Maxwellian species f0 determined from table in external input file Analytic Gaffey slowing-down distribution

integer, private, parameter :: f0_tabulated = 2

Regular Maxwellian species f0 determined from table in external input file Analytic Gaffey slowing-down distribution

integer, public, parameter :: f0_sdanalytic = 3

Regular Maxwellian species f0 determined from table in external input file Analytic Gaffey slowing-down distribution

real, private :: me

Various quantities needed in the calculation of the slowing-down distribution in case electrons are adiabatic

real, private :: ZI_fac

Various quantities needed in the calculation of the slowing-down distribution in case electrons are adiabatic

integer, private :: is_global = -1

Defines a working species so that eval_f0 only needs to take one argument (needed for genquad)

integer, public :: nspec
type(specie), public, dimension (:), allocatable :: spec
real, public, dimension (:,:), allocatable :: nonmaxw_corr
real, public, dimension (:,:), allocatable :: f0_values
real, public, dimension (:,:), allocatable :: dlnf0drho
logical, private :: initialized = .false.
logical, private :: exist
type(species_config_type), private :: species_config
type(species_element_config_type), private, dimension(:), allocatable :: species_element_config

Derived Types

type, private ::  specie

FIXME : Add documentation

Components

Type Visibility Attributes Name Initial
real, public :: z

Main physical properties of the species, see namelist documentation.

real, public :: mass

Main physical properties of the species, see namelist documentation.

real, public :: dens

Main physical properties of the species, see namelist documentation.

real, public :: temp

Main physical properties of the species, see namelist documentation.

real, public :: tprim

Main physical properties of the species, see namelist documentation.

real, public :: fprim

Main physical properties of the species, see namelist documentation.

real, public :: vnewk

Main physical properties of the species, see namelist documentation.

real, public :: stm

Common combinations of species properties

real, public :: zstm

Common combinations of species properties

real, public :: tz

Common combinations of species properties

real, public :: smz

Common combinations of species properties

real, public :: zt

Common combinations of species properties

real, public :: uprim

Provides offsets to parallel flow shear drive term

real, public :: uprim2

Provides offsets to parallel flow shear drive term

real, public :: dens0

Parameters associated with a few initialisation options, including Orszag-Tang.

real, public :: u0

Parameters associated with a few initialisation options, including Orszag-Tang.

real, public :: tpar0

Parameters associated with a few initialisation options, including Orszag-Tang.

real, public :: tperp0

Parameters associated with a few initialisation options, including Orszag-Tang.

real, public :: nu_h

nu_h controls a hyperviscous term embedded in the collision operator

real, public :: bess_fac

Artificial factor multiplying the Bessel function argument

real, public :: vcrit

Parameters associated with analytic slowing-down distribution

real, public :: vcprim

Parameters associated with analytic slowing-down distribution

integer, public :: type

Flags to identify the species type and the background distribution treatment

integer, public :: f0type

Flags to identify the species type and the background distribution treatment

type, public, extends(abstract_config_type) ::  species_config_type

Used to represent the input configuration of species

Components

Type Visibility Attributes Name Initial
logical, public :: exist = .false.

Does the related namelist exist in the target input file?

integer, public :: index = 0

Used to hold the specific index of numbered namelists

logical, public :: skip_read = .false.

Do we want to skip the read step in init?

logical, public :: skip_broadcast = .false.

Do we want to skip the broadcast step in init?

real, public :: me = -1.0

Specifies the electron mass used in calculating the slowing down parameters in simulations without kinetic electrons.

integer, public :: nspec = 2

Number of kinetic species to evolve.

real, public :: zi_fac = -1.0

Specify the ion charge factor used in calculating the slowing down parameters. If not specified that will attempt to calculate from the kinetic ion species.

Type-Bound Procedures

procedure , public , :: is_initialised => is_initialised_generic Function
procedure , public , :: init => init_generic Subroutine
procedure , public , :: setup => setup_generic Subroutine
procedure , public , :: write_namelist_header Subroutine
procedure , public , :: get_name => get_name_generic Function
procedure , public , :: get_requires_index => get_requires_index_generic Function
procedure , public , nopass :: write_namelist_footer Subroutine
generic, public , :: write_key_val => write_key_val_string, write_key_val_real, write_key_val_complex, write_key_val_integer, write_key_val_logical, write_key_val_real_array, write_key_val_complex_array, write_key_val_integer_array
procedure , public :: read => read_species_config Subroutine
procedure , public :: write => write_species_config Subroutine
procedure , public :: reset => reset_species_config Subroutine
procedure , public :: broadcast => broadcast_species_config Subroutine
procedure , public , nopass :: get_default_name => get_default_name_species_config Function
procedure , public , nopass :: get_default_requires_index => get_default_requires_index_species_config Function

type, public, extends(abstract_config_type) ::  species_element_config_type

Used to represent the input configuration of species

Components

Type Visibility Attributes Name Initial
logical, public :: exist = .false.

Does the related namelist exist in the target input file?

integer, public :: index = 0

Used to hold the specific index of numbered namelists

logical, public :: skip_read = .false.

Do we want to skip the read step in init?

logical, public :: skip_broadcast = .false.

Do we want to skip the broadcast step in init?

real, public :: bess_fac = 1.0

Multiplies the argument of the Bessel function for this species. Useful for exploring the effect of the Bessel functions.

real, public :: dens = 1.0

Set the normalised density for this species

real, public :: dens0 = 1.0

Parameter used for a few specific initial condition types.

Read more…
character(len=20), public :: f0type = "default"

Select which type of background distribution should be assumed for this species. Must be one of:

Read more…
real, public :: fprim = 2.2

Normalised inverse density gradient: (Note here is the normalised radius .

real, public :: mass = 1.0

Normalised mass of this species

real, public :: nu_h = 0.0

Set the species hyper collision frequency used in the pitch angle scattering collision operator if [[collision_knobs::hypermult]] is true.

real, public :: temp = 1.0

Set the normalised species temperature

real, public :: tpar0 = 0.

Parameter used for a few specific initial condition types.

Read more…
real, public :: tperp0 = 0.

Parameter used for a few specific initial condition types.

Read more…
real, public :: tprim = 6.9

Normalised inverse temperature gradient: (Note here is the normalised radius .

character(len=20), public :: type = "default"

Sets the characterisation of the species. Should be one of

Read more…
real, public :: u0 = 1.0

Parameter used for a few specific initial condition types.

Read more…
real, public :: uprim = 0.0

Controls an energy independent part of a source term.

Read more…
real, public :: uprim2 = 0.0

Controls an energy dependent part of a source term.

Read more…
real, public :: vcprim = -999.9

Part of the sdanalytic slowing down model. See G. Wilkie thesis.

real, public :: vcrit = -1.0

Part of the sdanalytic slowing down model. See G. Wilkie thesis.

real, public :: vnewk = 0.0

Sets the normalised species-species collisionality frequency. For species s, vnewk = nu_ss Lref/vref where Lref is the reference length, vref is the reference thermal speed (not the thermal speed of species s!), is a dimensional collision frequency, e is the proton charge, is the Coloumb logarithm, and are the (charge, temperature, density, mass) of species s. (The dimensional collision frequency given here is in Gaussian units. For SI units, include an extra factor in the denominator of the definition of .

real, public :: z = 1.0

Normalised species charge

Type-Bound Procedures

procedure , public , :: is_initialised => is_initialised_generic Function
procedure , public , :: init => init_generic Subroutine
procedure , public , :: setup => setup_generic Subroutine
procedure , public , :: write_namelist_header Subroutine
procedure , public , :: get_name => get_name_generic Function
procedure , public , :: get_requires_index => get_requires_index_generic Function
procedure , public , nopass :: write_namelist_footer Subroutine
generic, public , :: write_key_val => write_key_val_string, write_key_val_real, write_key_val_complex, write_key_val_integer, write_key_val_logical, write_key_val_real_array, write_key_val_complex_array, write_key_val_integer_array
procedure , public :: read => read_species_element_config Subroutine
procedure , public :: write => write_species_element_config Subroutine
procedure , public :: reset => reset_species_element_config Subroutine
procedure , public :: broadcast => broadcast_species_element_config Subroutine
procedure , public , nopass :: get_default_name => get_default_name_species_element_config Function
procedure , public , nopass :: get_default_requires_index => get_default_requires_index_species_element_config Function

Functions

public function eval_f0(v)

FIXME : Add documentation

Read more…

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: v

Return Value real

public pure function has_electron_species(spec)

Determine if any of the known species are electron like

Read more…

Arguments

Type IntentOptional Attributes Name
type(specie), intent(in), dimension (:) :: spec

Return Value logical

public pure function has_hybrid_electron_species(spec)

Determine if any of the known species are hybrid electrons

Read more…

Arguments

Type IntentOptional Attributes Name
type(specie), intent(in), dimension (:) :: spec

Return Value logical

public pure function has_ion_species(spec)

Determine if any of the known species are ion like

Read more…

Arguments

Type IntentOptional Attributes Name
type(specie), intent(in), dimension (:) :: spec

Return Value logical

public elemental function is_electron_species(spec)

Determine if the passed species instance is considered electron like. In other words if spec%type matches any of the recognised electron like types (electron, hybrid_electron)

Arguments

Type IntentOptional Attributes Name
type(specie), intent(in) :: spec

Return Value logical

public elemental function is_hybrid_electron_species(spec)

Determine if the passed species instance corresponds to hybrid electrons

Arguments

Type IntentOptional Attributes Name
type(specie), intent(in) :: spec

Return Value logical

private elemental function is_ion_species(spec)

Determine if the passed species instance corresponds to ions

Arguments

Type IntentOptional Attributes Name
type(specie), intent(in) :: spec

Return Value logical

private pure function has_nonmaxw_species(spec)

Determine if any of the known species are non-Maxwellian

Arguments

Type IntentOptional Attributes Name
type(specie), intent(in), dimension (:) :: spec

Return Value logical

public function get_species_config()

Get the module level config instance

Arguments

None

Return Value type(species_config_type)

public function get_species_element_config()

Get the module level config instance

Arguments

None

Return Value type(species_element_config_type), allocatable, (:)

Gets the default name for this namelist

Arguments

None

Return Value character(len=CONFIG_MAX_NAME_LEN)

Gets the default requires index for this namelist

Arguments

None

Return Value logical

Gets the default name for this namelist

Arguments

None

Return Value character(len=CONFIG_MAX_NAME_LEN)

Gets the default requires index for this namelist

Arguments

None

Return Value logical


Subroutines

public subroutine check_species(report_unit, beta, tite, alne, dbetadrho_spec)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: report_unit
real, intent(in) :: beta
real, intent(in) :: tite
real, intent(out) :: alne
real, intent(out) :: dbetadrho_spec

public subroutine wnml_species(unit)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: unit

public subroutine init_species(species_config_in, species_elements_config_in)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
type(species_config_type), intent(in), optional :: species_config_in
type(species_element_config_type), intent(in), optional, dimension(:), allocatable :: species_elements_config_in

private subroutine read_parameters(species_config_in, species_elements_config_in)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
type(species_config_type), intent(in), optional :: species_config_in
type(species_element_config_type), intent(in), optional, dimension(:), allocatable :: species_elements_config_in

private subroutine calculate_slowingdown_parameters(alpha_index, vc, vcprim)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: alpha_index
real, intent(out) :: vc
real, intent(out) :: vcprim

public subroutine calculate_f0_arrays(egrid)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(in), dimension (:,:) :: egrid

public subroutine set_current_f0_species(is)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: is

private subroutine eval_f0_sdanalytic(is, v, f0, df0dE_out, f0prim)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: is
real, intent(in) :: v
real, intent(out) :: f0
real, intent(out) :: df0dE_out
real, intent(out) :: f0prim

private subroutine calculate_f0_arrays_tabulated(is, egrid)

This subroutine calculates f0 on the grid from an external input file. The grid on the input file can differ from that of gs2. A cubic spline is used to interpolate between the two. The user can either specify df0/dE or it can be estimated internally. The radial derivative of f0 as a function of energy should also be given.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: is
real, intent(in), dimension(:,:) :: egrid

public subroutine finish_species()

FIXME : Add documentation

Arguments

None

public subroutine set_overrides(prof_ov)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
type(profiles_overrides_type), intent(in) :: prof_ov

FIXME : Add documentation

Arguments

None

public subroutine set_species_config(species_config_in, species_element_config_in)

Set the module level config types Will abort if the module has already been initialised to avoid inconsistencies.

Arguments

Type IntentOptional Attributes Name
type(species_config_type), intent(in), optional :: species_config_in
type(species_element_config_type), intent(in), optional, dimension(:), allocatable :: species_element_config_in

private subroutine read_species_config(self)

Reads in the species_knobs namelist and populates the member variables

Arguments

Type IntentOptional Attributes Name
class(species_config_type), intent(inout) :: self

private subroutine write_species_config(self, unit)

Writes out a namelist representing the current state of the config object

Arguments

Type IntentOptional Attributes Name
class(species_config_type), intent(in) :: self
integer, intent(in), optional :: unit

private subroutine reset_species_config(self)

Resets the config object to the initial empty state

Arguments

Type IntentOptional Attributes Name
class(species_config_type), intent(inout) :: self

private subroutine broadcast_species_config(self)

Broadcasts all config parameters so object is populated identically on all processors

Arguments

Type IntentOptional Attributes Name
class(species_config_type), intent(inout) :: self

private subroutine read_species_element_config(self)

Reads in the species_parameters namelist and populates the member variables

Arguments

Type IntentOptional Attributes Name
class(species_element_config_type), intent(inout) :: self

private subroutine write_species_element_config(self, unit)

Writes out a namelist representing the current state of the config object

Arguments

Type IntentOptional Attributes Name
class(species_element_config_type), intent(in) :: self
integer, intent(in), optional :: unit

private subroutine reset_species_element_config(self)

Resets the config object to the initial empty state

Arguments

Type IntentOptional Attributes Name
class(species_element_config_type), intent(inout) :: self

private subroutine broadcast_species_element_config(self)

Broadcasts all config parameters so object is populated identically on all processors

Arguments

Type IntentOptional Attributes Name
class(species_element_config_type), intent(inout) :: self