knobs_config_type Derived Type

type, public, extends(abstract_config_type) :: knobs_config_type

Used to represent the input configuration of run_parameters through "knobs"


Contents

Source Code


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?

logical, public :: skip_smart_defaults = .false.

Do we want to skip the smaart defaults in init?

real, public :: avail_cpu_time = 1.0e10

The maximum wall clock time available to GS2

real, public :: beta = 0.0

is the ratio of the reference pressure to the reference magnetic energy density, .

real, public :: delt = 0.1

Initial timestep

character(len=20), public :: delt_option = 'default'

Determines how initial timestep is set. Possible options are:

  • "default" or "set_by_hand": use timestep from input file
  • "check_restart": read timestep(s) from restart file

If "check_restart" is used but the restart files aren't present for any reason (for instance, the current run is not a restart), GS2 will error when trying to read the timesteps. You can run the ingen tool on your input file to check this issue before running your job

logical, public :: do_eigsolve = .false.

If true then use eigensolver instead of initial value solver.

character(len=20), public :: eqzip_option = 'none'

Advanced option to freeze evolution of certain modes. Possible values are:

  • "secondary": don't evolve ik == 2, it == 1;
  • "tertiary": dont' evolve ik == 1, it == 2 or ntheta0;
  • "harris": don't evolve ik == 1.

Only used in dist_fn, should be moved to dist_fn_knobs.

real, public :: fapar = 0.0

Multiplies throughout.

real, public :: fbpar = -1.0

Multiplies throughout.

real, public :: fphi = 1.0

Multiplies throughout.

logical, public :: immediate_reset = .true.

Determines the behaviour when the CFL condition is broken in the nonlinear term:

real, public :: margin_cpu_time = 300.0

How close to avail_cpu_time can we go before trying to stop the run cleanly

real, public :: max_sim_time = 1.0e6

The simulation time after which the run should stop.

integer, public :: ncheck_stop = 5

Sets the time step interval at which check for the existence of the .stop file.

integer, public :: nstep = 100

Maximum number of steps to take

integer, public :: progress_frequency = 0

How frequently, in integer steps, do we display a progress message. If <= 0 then no progress messages are displayed

real, public :: rhostar = 3.0e-3

Normalised gyro-radius, only used for low flow builds

logical, public :: save_init_times = .false.

If true then save init timer information to .init_times.

logical, public :: save_timer_statistics = .true.

If true then save some extra timer information to .timing_stats giving min/max/mean values.

integer, public :: seed = 0

Used to set the random seed used in the random number generators provided by ran. If this input is 0 (the default) then we don't set the seed and use the system default instead.

real, public :: tite = 1.0

Only used when there is an adiabatic species. Sets n q ^2 / T of the adiabatic species, normalised to the reference values.

logical, public :: use_old_diagnostics = .false.

If true use original diagnostics rather than new form

character(len=65000), public :: user_comments = ''

Custom description of run to be added to netcdf output (new diagnostics only)

logical, public :: wstar_units = .false.

If true makes timestep proportional to ky*rho. Only sensible for linear runs.

real, public :: zeff = 1.0

Effective ionic charge appearing in electron collision frequency


Type-Bound Procedures

procedure, public, :: is_initialised => is_initialised_generic

procedure, public, :: init => init_generic

  • private subroutine init_generic(self, name, requires_index, index, skip_smart_defaults, skip_read, skip_broadcast)

    Fully initialise the config object

    Arguments

    Type IntentOptional 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

procedure, public, :: setup => setup_generic

  • private subroutine setup_generic(self, name, requires_index, index)

    Do some standard setup/checking

    Arguments

    Type IntentOptional 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

procedure, public, :: write_namelist_header

  • private subroutine write_namelist_header(self, unit)

    Write the namelist header for this instance

    Arguments

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

procedure, public, :: get_name => get_name_generic

  • private function get_name_generic(self)

    Returns the namelist name. Not very useful at the moment but may want to do more interesting things in the future

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_config_type), intent(in) :: self

    Return Value character(len=CONFIG_MAX_NAME_LEN)

procedure, public, :: get_requires_index => get_requires_index_generic

  • private function get_requires_index_generic(self)

    Returns the requires_index value. Allows access whilst keeping the variable private

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_config_type), intent(in) :: self

    Return Value logical

procedure, public, :: set_smart_defaults => set_smart_defaults_null

  • private subroutine set_smart_defaults_null(self)

    An no-op implementation of the set_smart_defaults method. Unless over-ridden the specific config instance will have no smart defaults applied.

    Arguments

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

    Has to be intent in out as over-riding procedures need to change self

procedure, public, nopass :: write_namelist_footer

  • private subroutine write_namelist_footer(unit)

    Write the namelist footer

    Arguments

    Type IntentOptional Attributes Name
    integer, intent(in) :: unit
  • private subroutine write_key_val_string(key, val, unit)

    Writes a {key,val} pair where the value is of type character

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: key
    character(len=*), intent(in) :: val
    integer, intent(in) :: unit
  • private subroutine write_key_val_real(key, val, unit)

    Writes a {key,val} pair where the value is of type real

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: key
    real, intent(in) :: val
    integer, intent(in) :: unit
  • private subroutine write_key_val_complex(key, val, unit)

    Writes a {key,val} pair where the value is of type complex

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: key
    complex, intent(in) :: val
    integer, intent(in) :: unit
  • private subroutine write_key_val_integer(key, val, unit)

    Writes a {key,val} pair where the value is of type integer

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: key
    integer, intent(in) :: val
    integer, intent(in) :: unit
  • private subroutine write_key_val_logical(key, val, unit)

    Writes a {key,val} pair where the value is of type logical

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: key
    logical, intent(in) :: val
    integer, intent(in) :: unit
  • private subroutine write_key_val_real_array(self, key, val, unit)

    Writes a {key,val} pair where the value is of type real array

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_config_type), intent(in) :: self
    character(len=*), intent(in) :: key
    real, intent(in), dimension(:) :: val
    integer, intent(in) :: unit
  • private subroutine write_key_val_complex_array(self, key, val, unit)

    Writes a {key,val} pair where the value is of type complex array

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_config_type), intent(in) :: self
    character(len=*), intent(in) :: key
    complex, intent(in), dimension(:) :: val
    integer, intent(in) :: unit
  • private subroutine write_key_val_integer_array(self, key, val, unit)

    Writes a {key,val} pair where the value is of type integer array

    Arguments

    Type IntentOptional Attributes Name
    class(abstract_config_type), intent(in) :: self
    character(len=*), intent(in) :: key
    integer, intent(in), dimension(:) :: val
    integer, intent(in) :: unit

procedure, public :: read => read_knobs_config

  • private subroutine read_knobs_config(self)

    Reads in the knobs namelist and populates the member variables

    Arguments

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

procedure, public :: write => write_knobs_config

  • private subroutine write_knobs_config(self, unit)

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

    Arguments

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

procedure, public :: reset => reset_knobs_config

  • private subroutine reset_knobs_config(self)

    Resets the config object to the initial empty state

    Arguments

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

procedure, public :: broadcast => broadcast_knobs_config

  • private subroutine broadcast_knobs_config(self)

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

    Arguments

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

procedure, public, nopass :: get_default_name => get_default_name_knobs_config

  • private function get_default_name_knobs_config()

    Gets the default name for this namelist

    Arguments

    None

    Return Value character(len=CONFIG_MAX_NAME_LEN)

procedure, public, nopass :: get_default_requires_index => get_default_requires_index_knobs_config

Source Code

  type, extends(abstract_config_type) :: knobs_config_type
     ! namelist : knobs
     ! indexed : false     
     !> The maximum wall clock time available to GS2
     real :: avail_cpu_time = 1.0e10
     !> \(\beta\) is the ratio of the reference pressure to the reference
     !> magnetic energy density, \(\beta=2\mu_0n_{ref}T_{ref}/B^2_{ref}\).
     real :: beta = 0.0
     !> Initial timestep
     real :: delt = 0.1
     !> Determines how initial timestep is set. Possible options are:
     !>
     !>  - "default" or "set_by_hand": use timestep from input file
     !>  - "check_restart": read timestep(s) from restart file
     !>
     !> If "check_restart" is used but the restart files aren't
     !> present for any reason (for instance, the current run is not a
     !> restart), GS2 will error when trying to read the
     !> timesteps. You can run the [[ingen]] tool on your input file
     !> to check this issue before running your job
     character(len = 20) :: delt_option = 'default'
     !> If true then use eigensolver instead of initial value solver.
     logical :: do_eigsolve = .false.
     !> Advanced option to freeze evolution of certain modes. Possible values are:
     !>
     !> - "secondary": don't evolve `ik == 2, it == 1`;
     !> - "tertiary": dont' evolve `ik == 1, it == 2 or ntheta0`;
     !> - "harris": don't evolve `ik == 1`.
     !>
     !> Only used in [[dist_fn]], should be moved to [[dist_fn_knobs]].
     character(len = 20) :: eqzip_option = 'none'
     !> Multiplies \(A_\|\) throughout.
     real :: fapar = 0.0
     !> Multiplies \(B_\|\) throughout.
     real :: fbpar = -1.0
     !> Multiplies \(\phi\) throughout.
     real :: fphi = 1.0
     !> Determines the behaviour when the CFL condition is broken in the nonlinear term:
     logical :: immediate_reset = .true.
     !> How close to avail_cpu_time can we go before trying to stop the run cleanly
     real :: margin_cpu_time = 300.0
     !> The simulation time after which the run should stop.
     real :: max_sim_time = 1.0e6
     !> Sets the time step interval at which check for the existence
     !> of the <runname>.stop file.
     integer :: ncheck_stop = 5
     !> Maximum number of steps to take
     integer :: nstep = 100
     !> How frequently, in integer steps, do we display a progress message.
     !> If <= 0 then no progress messages are displayed
     integer :: progress_frequency = 0
     !> Normalised gyro-radius, only used for low flow builds
     real :: rhostar = 3.0e-3
     !> If true then save init timer information to
     !> <run_name>.init_times.
     logical :: save_init_times = .false.
     !> If true then save some extra timer information to
     !> <run_name>.timing_stats giving min/max/mean values.
     logical :: save_timer_statistics = .true.
     !> Used to set the random seed used in the random number
     !> generators provided by [[ran]]. If this input is 0 (the
     !> default) then we don't set the seed and use the system default
     !> instead.
     integer :: seed = 0
     !> Only used when there is an adiabatic species. Sets `n q ^2 / T` of the adiabatic
     !> species, normalised to the reference values.
     real :: tite = 1.0
     !> If true use original diagnostics rather than new form
     logical :: use_old_diagnostics = .false.
     !> Custom description of run to be added to netcdf output (new diagnostics only)
     character(len = 65000) :: user_comments = ''
     !> If true makes timestep proportional to ky*rho. Only sensible for linear runs.
     logical :: wstar_units = .false.
     !> Effective ionic charge appearing in electron collision frequency
     real :: zeff = 1.0
   contains
     procedure, public :: read => read_knobs_config
     procedure, public :: write => write_knobs_config
     procedure, public :: reset => reset_knobs_config
     procedure, public :: broadcast => broadcast_knobs_config
     procedure, public, nopass :: get_default_name => get_default_name_knobs_config
     procedure, public, nopass :: get_default_requires_index => get_default_requires_index_knobs_config
  end type knobs_config_type