Used to represent the input configuration of dist_fn
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? |
|
logical, | public | :: | skip_smart_defaults | = | .false. |
Do we want to skip the smaart defaults in init? |
|
character(len=30), | public | :: | adiabatic_option | = | 'default' |
The form of the adiabatic response (if a species is being modeled as adiabatic). Ignored if there are electrons in the species list.
TodoRemove 'iphi00=3' |
|
real, | public | :: | afilter | = | 0.0 |
For debugging only. TodoImprove documentation |
|
real, | public | :: | apfac | = | 1.0 |
Leave as unity. For debugging. TodoImprove documentation |
|
logical, | public | :: | boundary_off_grid | = | .false. |
If true then attempt to enforce gnew == 0 at a half grid point past the end of the grid rather than on the last grid point. This is an experimental feature which has been seen to help suppress grid scale oscillations near the boundary. |
|
character(len=20), | public | :: | boundary_option | = | 'default' |
Sets the boundary condition along the field line (i.e. the boundary conditions at in flux-tube simulations or in ballooning space). Possible values are:
See also nonad_zero |
|
real, | public | :: | btor_slab | = | 0.0 |
Overrides the itor_over_B internal parameter, meant only for slab runs where it sets the angle between the magnetic field and the toroidal flow. |
|
logical, | public | :: | def_parity | = | .false. |
True only allows solutions of single parity as determined by the input even. |
|
real, | public | :: | driftknob | = | 1.0 |
Leave as unity for physical runs can be used for debugging. Multiplies the passing particle drifts (also see tpdriftknob). |
|
logical, | public | :: | esv | = | .false. |
If |
|
logical, | public | :: | even | = | .true. |
If |
|
logical, | public | :: | exponential_boundary | = | .false. |
If true then attempt to enforce an exponential decay boundary condition on gnew or hnew (depending on nonad_zero). Decay rate scaled by exponential_boundary_factor |
|
real, | public | :: | exponential_boundary_factor | = | 1.0 |
Factor scaling the exponential decay boundary condition |
|
real, | public | :: | g_exb | = | 0.0 |
where is toroidal angular velocity normalised to the reference frequency and is the normalised flux label which has value on the local surface. |
|
real, | public | :: | g_exb_start_time | = | -1 |
Flow shear switched on when simulation time exceeds this time. |
|
integer, | public | :: | g_exb_start_timestep | = | -1 |
Flow shear switched on when simulation timestep exceeds this timestep. |
|
real, | public | :: | g_exbfac | = | 1.0 |
Multiplies |
|
logical, | public | :: | gf_lo_integrate | = | .false. |
Perform velocity space integration using TodoConsider if this should be a field input. |
|
logical, | public | :: | hyper_in_initialisation | = | .true. |
Determines if we include the hyperviscosity term during the initialisation of the response matrix or not. |
|
real, | public | :: | mach | = | 0.0 |
Number multiplying the coriolis drift. TodoExpand documentation |
|
logical, | public | :: | mult_imp | = | .false. |
Allow different species to have different values of |
|
logical, | public | :: | nonad_zero | = | .true. |
If true switches on "new" parallel boundary condition where h=0 at incoming boundary instead of g=0. This is considered the correct boundary condition but old behaviour retained for experimentation. |
|
real, | public | :: | omprimfac | = | 1.0 |
Factor multiplying the parallel shearing drive term when running with non-zero g_exb |
|
logical, | public | :: | opt_source | = | .false. |
If true then use an optimised linear source calculation which
uses pre-calculated coefficients, calculates both sigma
together and skips work associated with empty fields. Can
contribute at least 10-25% savings for linear electrostatic
collisionless simulations. For more complicated runs the
savings may be less. If enabled memory usage will
increase due to using an additional array of size 2-4 times
|
|
real, | public | :: | poisfac | = | 0.0 |
If non-zero, quasineutrality is not enforced,
|
|
logical, | public | :: | start_from_previous_solution | = | .false. |
Determines if we set gnew = 0 (if flag is false) or gnew = g in invert_rhs_1 or not. This is currently considered experimental, but the intention is to change the default to true. |
|
real, | public | :: | tpdriftknob | = | -9.9e9 |
For debugging only. Multiplies the trapped particle drifts (also see driftknob). |
|
real, | public | :: | vparknob | = | 1.0 |
For debugging only. Scales the calculated vparallel. NoteIf set to zero then the homogeneous contribution, |
|
real, | public | :: | wfb | = | 1.0 |
For debugging only. Sets the boundary value for the barely trapped/passing particle. |
|
logical, | public | :: | zero_forbid | = | .false. |
If true then force |
Is this instance initialised?
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(abstract_config_type), | intent(in) | :: | self |
Fully initialise the config object
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(abstract_config_type), | intent(inout) | :: | self | |||
character(len=*), | intent(in), | optional | :: | name | ||
logical, | intent(in), | optional | :: | requires_index | ||
integer, | intent(in), | optional | :: | index | ||
logical, | intent(in), | optional | :: | skip_smart_defaults | ||
logical, | intent(in), | optional | :: | skip_read | ||
logical, | intent(in), | optional | :: | skip_broadcast |
Do some standard setup/checking
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(abstract_config_type), | intent(inout) | :: | self | |||
character(len=*), | intent(in), | optional | :: | name | ||
logical, | intent(in), | optional | :: | requires_index | ||
integer, | intent(in), | optional | :: | index |
Write the namelist header for this instance
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(abstract_config_type), | intent(in) | :: | self | |||
integer, | intent(in) | :: | unit |
Returns the namelist name. Not very useful at the moment but may want to do more interesting things in the future
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(abstract_config_type), | intent(in) | :: | self |
Returns the requires_index value. Allows access whilst keeping the variable private
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(abstract_config_type), | intent(in) | :: | self |
An no-op implementation of the set_smart_defaults method. Unless over-ridden the specific config instance will have no smart defaults applied.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(abstract_config_type), | intent(inout) | :: | self |
Has to be intent in out as over-riding procedures need to change self |
Write the namelist footer
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | unit |
Writes a {key,val} pair where the value is of type character
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | key | |||
character(len=*), | intent(in) | :: | val | |||
integer, | intent(in) | :: | unit |
Writes a {key,val} pair where the value is of type real
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | key | |||
real, | intent(in) | :: | val | |||
integer, | intent(in) | :: | unit |
Writes a {key,val} pair where the value is of type complex
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | key | |||
complex, | intent(in) | :: | val | |||
integer, | intent(in) | :: | unit |
Writes a {key,val} pair where the value is of type integer
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | key | |||
integer, | intent(in) | :: | val | |||
integer, | intent(in) | :: | unit |
Writes a {key,val} pair where the value is of type logical
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | key | |||
logical, | intent(in) | :: | val | |||
integer, | intent(in) | :: | unit |
Writes a {key,val} pair where the value is of type real array
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(abstract_config_type), | intent(in) | :: | self | |||
character(len=*), | intent(in) | :: | key | |||
real, | intent(in), | dimension(:) | :: | val | ||
integer, | intent(in) | :: | unit |
Writes a {key,val} pair where the value is of type complex array
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(abstract_config_type), | intent(in) | :: | self | |||
character(len=*), | intent(in) | :: | key | |||
complex, | intent(in), | dimension(:) | :: | val | ||
integer, | intent(in) | :: | unit |
Writes a {key,val} pair where the value is of type integer array
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(abstract_config_type), | intent(in) | :: | self | |||
character(len=*), | intent(in) | :: | key | |||
integer, | intent(in), | dimension(:) | :: | val | ||
integer, | intent(in) | :: | unit |
Reads in the dist_fn_knobs namelist and populates the member variables
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dist_fn_config_type), | intent(inout) | :: | self |
Writes out a namelist representing the current state of the config object
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dist_fn_config_type), | intent(in) | :: | self | |||
integer, | intent(in), | optional | :: | unit |
Resets the config object to the initial empty state
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dist_fn_config_type), | intent(inout) | :: | self |
Broadcasts all config parameters so object is populated identically on all processors
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(dist_fn_config_type), | intent(inout) | :: | self |
Gets the default name for this namelist
Gets the default requires index for this namelist
type, extends(abstract_config_type) :: dist_fn_config_type
! namelist : dist_fn_knobs
! indexed : false
!> The form of the adiabatic response (if a species is being modeled as adiabatic). Ignored if there are electrons in the species list.
!>
!> - 'no-field-line-average-term' Adiabatic species has n = Phi. Appropriate for single-species ETG simulations.
!> - 'default' Same as 'no-field-line-average-term'
!> - 'iphi00=0' Same as 'no-field-line-average-term'
!> - 'iphi00=1' Same as 'no-field-line-average-term'
!> - 'field-line-average-term' Adiabatic species has n=Phi-< Phi >. Appropriate for single-species ITG simulations.
!> - 'iphi00=2' Same as field-line-average-term'
!> - 'iphi00=3' Adiabatic species has n=Phi-< Phi >_y. Incorrect implementation of field-line-average-term.
!>
!> @todo Remove 'iphi00=3'
character(len = 30) :: adiabatic_option = 'default'
!> For debugging only.
!>
!> @todo Improve documentation
real :: afilter = 0.0
!> Leave as unity. For debugging.
!>
!> @todo Improve documentation
real :: apfac = 1.0
!> If true then attempt to enforce gnew == 0 at a half grid point
!> past the end of the grid rather than on the last grid point. This
!> is an experimental feature which has been seen to help suppress
!> grid scale oscillations near the boundary.
logical :: boundary_off_grid = .false.
!> Sets the boundary condition along the field line (i.e. the
!> boundary conditions at \(\theta = \pm \pi\) in flux-tube
!> simulations or \(\theta = \pm (2*\textrm{nperiod}-1)*\pi\) in
!> ballooning space). Possible values are:
!>
!> - 'default' - "Smart" default -- equivalent to 'zero' except if
!> kt_grids:grid_option='box' in which case equivalent to 'linked'.
!> In simulations with suffifienctly small shear default boundaries correspond
!> to 'periodic'.
!> - 'zero', 'unconnected' - Use Kotschenreuther boundary condition at endpoints
!> of theta grid
!> - 'self-periodic', 'periodic', 'kperiod=1' - Each mode is periodic in theta with
!> itself.
!> - 'linked' - Twist and shift boundary conditions (used for kt_grids:grid_option='box')
!>
!> See also [[dist_fn_knobs:nonad_zero]]
character(len = 20) :: boundary_option = 'default'
!> Overrides the [[theta_grid:itor_over_B]] internal parameter,
!> meant only for slab runs where it sets the angle between the
!> magnetic field and the toroidal flow.
real :: btor_slab = 0.0
!> True only allows solutions of single parity as determined by
!> the input [[dist_fn_knobs:even]].
logical :: def_parity = .false.
!> Leave as unity for physical runs can be used for
!> debugging. Multiplies the passing particle drifts (also see
!> [[dist_fn_knobs:tpdriftknob]]).
real :: driftknob = 1.0
!> If `esv=.true.` and `boundary_option='linked'` (i.e. flux tube
!> simulation) then at every time step we ensure the fields are
!> exactly single valued by replacing the field at one of the
!> repeated boundary points with the value at the other boundary
!> (i.e. of the two array locations which should be storing the
!> field at the same point in space we pick one and set the other
!> equal to the one we picked). This can be important in
!> correctly tracking the amplitude of damped modes to very small
!> values. Also see [[init_g_knobs:clean_init]].
logical :: esv = .false.
!> If `def_parity` is true, determines allowed parity.
logical :: even = .true.
!> If true then attempt to enforce an exponential decay boundary condition
!> on gnew or hnew (depending on [[nonad_zero]]). Decay rate scaled by
!> [[exponential_boundary_factor]]
logical :: exponential_boundary = .false.
!> Factor scaling the exponential decay boundary condition
real :: exponential_boundary_factor = 1.0
!> \(\frac{\rho}{q} \frac{d\Omega^{\rm GS2}}{d\rho_n}\) where
!> \(\Omega^{\rm GS2}\) is toroidal angular velocity normalised
!> to the reference frequency \(v_{t}^{\rm ref}/a\) and
!> \(\rho_n\) is the normalised flux label which has value
!> \(\rho\) on the local surface.
real :: g_exb = 0.0
!> Flow shear switched on when simulation time exceeds this time.
real :: g_exb_start_time = -1
!> Flow shear switched on when simulation timestep exceeds this timestep.
integer :: g_exb_start_timestep = -1
!> Multiplies `g_exb` in the perpendicular shearing term *but
!> not* in the parallel drive term. Can be used to construct simulations with
!> purely parallel flow.
real :: g_exbfac = 1.0
!> Perform velocity space integration using `gf_lo`, rather than
!> `g_lo`, data decomposition if true. If used without
!> `field_option = 'gf_local'` in [[fields_knobs]] it is likely to give
!> poor performance. If `field_option = 'gf_local'` in
!> [[fields_knobs]] then this needs to be present and set to `.true.`.
!>
!> @todo Consider if this should be a field input.
logical :: gf_lo_integrate = .false.
!> Determines if we include the hyperviscosity term during the
!> initialisation of the response matrix or not.
logical :: hyper_in_initialisation = .true.
!> Number multiplying the coriolis drift.
!>
!> @todo Expand documentation
real :: mach = 0.0
!> Allow different species to have different values of `bakdif`.
!> Forced false for nonlinear runs.
logical :: mult_imp = .false.
!> If true switches on "new" parallel boundary condition where h=0 at incoming boundary instead of g=0.
!> This is considered the correct boundary condition but old behaviour retained for experimentation.
logical :: nonad_zero = .true.
!> Factor multiplying the parallel shearing drive term when
!> running with non-zero [[dist_fn_knobs:g_exb]]
real :: omprimfac = 1.0
!> If true then use an optimised linear source calculation which
!> uses pre-calculated coefficients, calculates both sigma
!> together and skips work associated with empty fields. Can
!> contribute at least 10-25% savings for linear electrostatic
!> collisionless simulations. For more complicated runs the
!> savings may be less. If enabled memory usage will
!> increase due to using an additional array of size 2-4 times
!> `gnew`.
logical :: opt_source = .false.
!> If non-zero, quasineutrality is not enforced,
!> `poisfac`= \((\lambda_\textrm{Debye}/\rho)^2\)
real :: poisfac = 0.0
!> Determines if we set gnew = 0 (if flag is false) or gnew = g
!> in [[invert_rhs_1]] or not. This is currently considered
!> experimental, but the intention is to change the default to true.
logical :: start_from_previous_solution = .false.
!> For debugging only. Multiplies the trapped particle drifts
!> (also see [[dist_fn_knobs:driftknob]]).
real :: tpdriftknob = -9.9e9
!> For debugging only. Scales the calculated vparallel.
!>
!> @note If set to zero then the homogeneous contribution, `g1`, will be
!> exactly 1 everywhere it is defined. This can lead to a divide by zero
!> in the trapped particle continuity calculation in [[invert_rhs_1]],
!> leading to NaNs appearing in the solution.
real :: vparknob = 1.0
!> For debugging only. Sets the boundary value for the barely trapped/passing particle.
real :: wfb = 1.0
!> If true then force `gnew=0` in the forbidden region at the end
!> of [[invert_rhs_1]] (this is the original behaviour).
!> Nothing should depend on the forbidden region so `g` should be 0 here
!> and if it is not for some reason then it shouldn't impact on
!> results. If the results of your simulation depend upon this
!> flag then something has likely gone wrong somewhere.
logical :: zero_forbid = .false.
contains
procedure, public :: read => read_dist_fn_config
procedure, public :: write => write_dist_fn_config
procedure, public :: reset => reset_dist_fn_config
procedure, public :: broadcast => broadcast_dist_fn_config
procedure, public, nopass :: get_default_name => get_default_name_dist_fn_config
procedure, public, nopass :: get_default_requires_index => get_default_requires_index_dist_fn_config
end type dist_fn_config_type