gs2_program_state_type Derived Type

type, public :: gs2_program_state_type

The object which specifies and records the gs2 program state. Some attributes of the object, like mp_comm_external, are designed to be directly manipulated by the user, and some are designed to store program state information and be manipulated internally, like init%level.


Contents


Components

Type Visibility Attributes Name Initial
type(init_type), public :: init

A type for keeping track of the current initialization level of gs2, as well as storing all the overrides. See gs2_init::init_type for more information.

logical, public :: included = .true.

Do not set manually. If fewer than the available number of processors are being used, this is true for the processors that are active and false for those that lie idle.

type(gs2_timers_type), public :: timers

Derived type gs2_timers_type holding some of the timer data for this run.

logical, public :: exit = .false.

The exit flag is set to true by any part of the main timestep loop that wants to cause the loop to exit

logical, public :: converged = .false.

Whether the run has converged to a stationary state

logical, public :: do_eigsolve = .false.

Whether to run the eigenvalue solver or not. Set equal to the input value in intialize_equations. Typically only important for the standalone gs2 program

integer, public :: nstep

This parameter is set equal to run_parameters::nstep in initialize_equations and is the maximum number of timesteps that can be run without reinitalising the diagnostics. Do not modify. We should make this private but it is used in testing currently so we don't.

integer, public :: istep_end = 0

Gets set to the final value of istep in evolve equations. Any future calls to evolve_equations will increment this further. A call to finalize_diagnostics will set it back to 0. Note that setting this manually is NOT advised.

integer, public :: verb = 3

Verbosity at which we print out debug messages

integer, public :: external_job_id = -1

Parameters pertaining to cases when gs2 is being used as a library. external_job_id is not to be confused with the parameter job in mp, which identifies the subjob if running in list mode or with nensembles > 1

logical, public :: is_external_job = .false.

is_external_job should be set to true when GS2 is being used as a library. Perhaps this could just check external_job_id instead?

logical, public :: is_trinity_job = .false.

Set true if using trinity. This does several things: * it forces the calculation of the fluxes * it causes the species and theta_grid name lists to use parameters provided by trinity Setting this flag true automatically sets is_external_job to true

logical, public :: trinity_linear_fluxes = .false.

If true and running linearly, return linear diffusive flux estimates to Trinity.

logical, public :: trinity_ql_fluxes = .false.

If true and running linearly, return a QL flux estimate to Trinity.

logical, public :: print_full_timers = .true.

If true, print full timing breakdown.

logical, public :: print_times = .true.

If true, print run time or full timing breakdown, depending on the value of print_full_timers

integer, public :: mp_comm = mp_comm_null

1 communicator. This MUST be set.

integer, public :: nproc_actual = -1

This is set in initialize_gs2 to the number of procs actually used

logical, public :: run_name_external = .false.

If true then we end up passing run_name as the base file name.

character(len=run_name_size), public :: run_name = 'gs'

The run name to pass to init_file_utils if run_name_external is set to true. GS2 then uses this in place of any input file name passed at the command line.

logical, public :: skip_diagnostics = .false.

If true then skip the call to diagnostics calculations in evolve_equations (main loop and after main loop)

logical, public :: dont_change_timestep = .false.

If true then ignore any requests to change the time step in evolve_equations as a part of the time advance algorithm

logical, public :: list = .false.

Whether this is a list mode run

integer, public :: nensembles = 1

The number of identical runs happening simultaneously (used for ensemble averaging). Cannot be used in conjunction with list mode.

type(gs2_outputs_type), public :: outputs

Holds some outputs of interest (e.g. for Trinity)

logical, public :: set_outputs = .false.

If true, calculate and set outputs

type(optimisation_type), public :: optim

Optimisation configuration

type(exit_code), public :: exit_reason = EXIT_NOT_REQUESTED

Reason for end of simulation


Source Code

  type gs2_program_state_type

     !> A type for keeping track of the current initialization level
     !> of gs2, as well as storing all the overrides. See
     !> gs2_init::init_type for more information.
     type(init_type) :: init

     !> Do not set manually. If fewer than the available number of
     !> processors are being used, this is true for the processors that
     !> are active and false for those that lie idle.
     logical :: included = .true.

     !> Derived type [[gs2_timers_type]] holding some of the
     !> timer data for this run.
     type(gs2_timers_type) :: timers

     !> The exit flag is set to true by any part of the main timestep
     !> loop that wants to cause the loop to exit
     logical :: exit = .false.

     !> Whether the run has converged to a stationary state
     logical :: converged = .false.

     !> Whether to run the eigenvalue solver or not. Set equal to the
     !> input value in intialize_equations. Typically only important
     !> for the standalone gs2 program
     logical :: do_eigsolve = .false.

     !> This parameter is set equal to run_parameters::nstep in
     !> initialize_equations and is the maximum number of timesteps
     !> that can be run without reinitalising the diagnostics.  Do not
     !> modify. We should make this private but it is used in testing
     !> currently so we don't.
     integer :: nstep

     !> Gets set to the final value of istep in evolve equations. Any
     !> future calls to evolve_equations will increment this
     !> further. A call to finalize_diagnostics will set it back to
     !> 0. Note that setting this manually is NOT advised.
     integer :: istep_end = 0

     !> Verbosity at which we print out debug messages
     integer :: verb = 3

     !> Parameters pertaining to cases when gs2 is being used as a
     !> library. external_job_id is not to be confused with the parameter
     !> job in mp, which identifies the subjob if running in list mode
     !> or with nensembles > 1
     integer :: external_job_id = -1

     !> is_external_job should be set to true when GS2 is being used
     !> as a library. Perhaps this could just check external_job_id instead?
     logical :: is_external_job = .false.

     !> Set true if using trinity. This does several things:
     !>  * it forces the calculation of the fluxes
     !>  * it causes the species and theta_grid name lists to use parameters
     !>     provided by trinity
     !> Setting this flag true automatically sets is_external_job to true
     logical :: is_trinity_job = .false.
     !> If true and running linearly, return linear diffusive flux estimates to Trinity.
     logical :: trinity_linear_fluxes = .false.
     !> If true and running linearly, return a QL flux estimate to Trinity.
     logical :: trinity_ql_fluxes = .false.

     !> If true, print full timing breakdown.
     logical :: print_full_timers = .true.

     !> If true, print run time or full timing breakdown, depending on
     !> the value of print_full_timers
     logical :: print_times = .true.

     !> MPI communicator. This MUST be set.
     integer :: mp_comm = mp_comm_null

     !> This is set in initialize_gs2 to the number of procs actually used
     integer :: nproc_actual = -1

     !> If true then we end up passing [[gs2_program_state_type:run_name]]
     !> as the base file name.
     logical :: run_name_external = .false.
     !> The run name to pass to [[init_file_utils]] if `run_name_external` is
     !> set to true. GS2 then uses this in place of any input file name passed
     !> at the command line.
     character(run_name_size) :: run_name = 'gs'

     !> If true then skip the call to diagnostics calculations in
     !> evolve_equations (main loop and after main loop)
     logical :: skip_diagnostics = .false.
     !> If true then ignore any requests to change the time step in
     !> evolve_equations as a part of the time advance algorithm
     logical :: dont_change_timestep = .false.

     !> Whether this is a list mode run
     logical :: list = .false.
     !> The number of identical runs happening simultaneously (used
     !> for ensemble averaging). Cannot be used in conjunction with
     !> list mode.
     integer :: nensembles = 1

     !> Holds some outputs of interest (e.g. for Trinity)
     type(gs2_outputs_type) :: outputs

     !> If true, calculate and set [[outputs]]
     logical :: set_outputs = .false.

     !> Optimisation configuration
     type(optimisation_type) :: optim

     !> Reason for end of simulation
     type(exit_code) :: exit_reason = EXIT_NOT_REQUESTED
  end type gs2_program_state_type