eigval_config_type Derived Type

type, public, extends(abstract_config_type) :: eigval_config_type

Used to represent the input configuration of eigval. Several of these options are controlling SLEPc settings, which can also be set using the SLEPc command line flags.


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?

logical, public :: analyse_ddt_operator = .false.

Determines which operator SLEPc is finding eigenvalues of. If .false. then SLEPc analyses the time advance operator, so internally works with the eigenvalue exp(-i*omega*nadv*dt). If .true. then SLEPc analyses a time derivative operator, so internally works with the eigenvalue -i*omega. Note we form a first order one sided approximation of the time derivative (e.g. (g_{n+nadv}-g_{n})/(nadv*code_dt)) to be analysed.

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

Sets the extraction technique, must be one of:

  • 'default' (use SLEPC default)
  • 'slepc_default' (use SLEPC default)
  • 'ritz'
  • 'harmonic'
  • 'harmonic_relative'
  • 'harmonic_right'
  • 'harmonic_largest'
  • 'refined'
  • 'refined_harmonic'
integer, public :: max_iter = 0

Sets the maximum number of SLEPC iterations used. If not set (recommended) then let SLEPC decide what to use (varies with different options).

integer, public :: n_eig = 1

The number of eigenmodes to search for. The actual number of modes found may be larger than this.

integer, public :: nadv = 1

How many GS2 timesteps to take each time SLEPc wants to advance the distribution function. Useful to separate closely spaced eigenvalues without changing delt.

logical, public :: save_restarts = .false.

If true then we save a set of restart files for each eigenmode found. These are named as the standard restart file (i.e. influenced by the restart_file input), but have eig_<id> appended near the end, where <id> is an integer representing the eigenmode id. If save_distfn of gs2_diagnostics_knobs is true then will also save the distribution function files.

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

Sets the type of solver to use, must be one of:

  • 'default' (Krylov-Schur)
  • 'slepc_default' (Krylov-Schur)
  • 'power'
  • 'subspace'
  • 'arnoldi'
  • 'lanczos'
  • 'krylov'
  • 'GD'
  • 'JD'
  • 'RQCG'
  • 'CISS'
  • 'lapack'
  • 'arpack'
  • 'blzpack'
  • 'trlan'
  • 'blopex'
  • 'primme'
  • 'feast'

Not all solver types are compatible with other eigenvalue options, some options may not be supported in older SLEPC versions and some may require certain flags to be set when SLEPC is compiled.

real, public :: targ_im = 0.5

Imaginary part of the eigenvalue target. Often beneficial to set this fairly large (e.g. 10) when looking for unstable modes. Used with the target_* which_option mode.

real, public :: targ_re = 0.5

Real part of the eigenvalue target. Often beneficial to set this fairly small (e.g. ~0). Used with the target_* which_option mode.

real, public :: tolerance = 1.0d-6

Sets tolerance on SLEPC eigenmode search. Used to determine when an eigenmode has been found. Note this is the tolerance based on the SLEPc eigenvalue, which is the time advance eigenvalue rather than the GS2 eigenvalue, .

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

Sets the type of spectral transform to be used. This can help extract interior eigenvalues. Must be one of

  • 'default' (let SLEPC decide)
  • 'slepc_default' (let SLEPC decide)
  • 'shell'
  • 'shift'
  • 'invert'
  • 'cayley'
  • 'fold'
  • 'precond' (not implemented)

Not all options are available in all versions of the library.

logical, public :: use_ginit = .false.

If true then provide an initial guess for the eigenmode based on using init_g routines to initialise g. Can be helpful in accelerating initial phase of eigensolver. Can also be quite useful with ginit_option='many' (etc.) to start an eigenvalue search from a previously obtained solution, allowing both eigenmode refinement and sub-dominant mode detection.

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

Sets SLEPC mode of operation (i.e. what sort of eigenvalues it looks for). Note that this refers to the SLEPc eigenvalue, i.e. the time advance eigenvalue . In other words one should select 'largest_real' to search for modes with the largest growth rate. Must be one of

  • 'default' (equivalent to 'target_magnitude')
  • 'slepc_default' (let SLEPC decide)
  • 'largest_magnitude'
  • 'smallest_magnitude'
  • 'largest_real'
  • 'smallest_real'
  • 'largest_imaginary'
  • 'smallest_imaginary'
  • 'target_magnitude' (complex eigenvalue magnitude closest to magnitude of target)
  • 'target_real'
  • 'target_imaginary'
  • 'all' (only some solver types, e.g. lapack) -- not supported
  • 'user' (will use a user specified function to pick between eigenmodes, note not currently implemented)

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_eigval_config

  • private subroutine read_eigval_config(self)

    Reads in the eigval_knobs namelist and populates the member variables

    Arguments

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

procedure, public :: write => write_eigval_config

  • private subroutine write_eigval_config(self, unit)

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

    Arguments

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

procedure, public :: reset => reset_eigval_config

  • private subroutine reset_eigval_config(self)

    Resets the config object to the initial empty state

    Arguments

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

procedure, public :: broadcast => broadcast_eigval_config

  • private subroutine broadcast_eigval_config(self)

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

    Arguments

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

procedure, public, nopass :: get_default_name => get_default_name_eigval_config

  • private function get_default_name_eigval_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_eigval_config

Source Code

  type, extends(abstract_config_type) :: eigval_config_type
     ! namelist : eigval_knobs
     ! indexed : false
     !> Determines which operator SLEPc is finding eigenvalues of.  If
     !> .false. then SLEPc analyses the time advance operator, so
     !> internally works with the eigenvalue `exp(-i*omega*nadv*dt)`.
     !> If .true. then SLEPc analyses a time derivative operator, so
     !> internally works with the eigenvalue `-i*omega`. Note we form
     !> a first order one sided approximation of the time derivative
     !> (e.g. `(g_{n+nadv}-g_{n})/(nadv*code_dt)`) to be analysed.
     logical :: analyse_ddt_operator = .false.
     !> Sets the extraction technique, must be one of:
     !>
     !> - 'default' (use SLEPC default)
     !> - 'slepc_default' (use SLEPC default)
     !> - 'ritz'
     !> - 'harmonic'
     !> - 'harmonic_relative'
     !> - 'harmonic_right'
     !> - 'harmonic_largest'
     !> - 'refined'
     !> - 'refined_harmonic'
     !>
     character(len = 20) :: extraction_option = 'default'
     !> Sets the maximum number of SLEPC iterations used.  If not set
     !> (recommended) then let SLEPC decide what to use (varies with
     !> different options).
     integer :: max_iter = PETSC_DECIDE
     !> The number of eigenmodes to search for. The actual number of
     !> modes found may be larger than this.
     integer :: n_eig = 1
     !> How many GS2 timesteps to take each time SLEPc wants to
     !> advance the distribution function. Useful to separate closely
     !> spaced eigenvalues without changing [[knobs:delt]].
     integer :: nadv = 1
     !> If `true` then we save a set of restart files for each eigenmode
     !> found. These are named as the standard restart file
     !> (i.e. influenced by the restart_file input), but have `eig_<id>`
     !> appended near the end, where `<id>` is an integer representing the
     !> eigenmode id. If `save_distfn` of [[gs2_diagnostics_knobs]] is true
     !> then will also save the distribution function files.
     logical :: save_restarts = .false.
     !> Sets the type of solver to use, must be one of:
     !>
     !> - 'default' (Krylov-Schur)
     !> - 'slepc_default' (Krylov-Schur)
     !> - 'power'
     !> - 'subspace'
     !> - 'arnoldi'
     !> - 'lanczos'
     !> - 'krylov'
     !> - 'GD'
     !> - 'JD'
     !> - 'RQCG'
     !> - 'CISS'
     !> - 'lapack'
     !> - 'arpack'
     !> - 'blzpack'
     !> - 'trlan'
     !> - 'blopex'
     !> - 'primme'
     !> - 'feast'
     !>
     !> Not all solver types are compatible with other eigenvalue options,
     !> some options may not be supported in older SLEPC versions and some
     !> may require certain flags to be set when SLEPC is compiled.
     character(len = 20) :: solver_option = 'default'
     !> Imaginary part of the eigenvalue target. Often beneficial to
     !> set this fairly large (e.g. 10) when looking for unstable
     !> modes. Used with the `target_*` [[eigval_knobs:which_option]]
     !> mode.
     real :: targ_im = 0.5
     !> Real part of the eigenvalue target. Often beneficial to set
     !> this fairly small (e.g. ~0). Used with the `target_*`
     !> [[eigval_knobs:which_option]] mode.
     real :: targ_re = 0.5
     !> Sets tolerance on SLEPC eigenmode search. Used to determine
     !> when an eigenmode has been found. Note this is the tolerance
     !> based on the SLEPc eigenvalue, which is the time advance
     !> eigenvalue
     !> \(\exp{\left(-i\Omega\textrm{nadv delt}\right)}\)
     !> rather than the GS2 eigenvalue, \(\Omega\).
     real :: tolerance = 1.0d-6
     !> Sets the type of spectral transform to be used. This can help
     !> extract interior eigenvalues. Must be one of
     !>
     !> - 'default' (let SLEPC decide)
     !> - 'slepc_default' (let SLEPC decide)
     !> - 'shell'
     !> - 'shift'
     !> - 'invert'
     !> - 'cayley'
     !> - 'fold'
     !> - 'precond' (not implemented)
     !>
     !> Not all options are available in all versions of the library.
     character(len = 20) :: transform_option = 'default'
     !> If `true` then provide an initial guess for the eigenmode
     !> based on using [[init_g]] routines to initialise `g`. Can be
     !> helpful in accelerating initial phase of eigensolver. Can also
     !> be quite useful with `ginit_option='many'` (etc.)  to start an
     !> eigenvalue search from a previously obtained solution,
     !> allowing both eigenmode refinement and sub-dominant mode
     !> detection.
     logical :: use_ginit = .false.
     !> Sets SLEPC mode of operation (i.e. what sort of eigenvalues it
     !>looks for). Note that this refers to the SLEPc eigenvalue,
     !>i.e. the time advance eigenvalue
     !>\(\exp{\left(-i\Omega\textrm{nadv delt}\right)}\). In other
     !>words one should select `'largest_real'` to search for modes
     !>with the largest growth rate. Must be one of
     !>
     !> - 'default' (equivalent to 'target_magnitude')
     !> - 'slepc_default' (let SLEPC decide)
     !> - 'largest_magnitude'
     !> - 'smallest_magnitude'
     !> - 'largest_real'
     !> - 'smallest_real'
     !> - 'largest_imaginary'
     !> - 'smallest_imaginary'
     !> - 'target_magnitude' (complex eigenvalue magnitude closest to magnitude of target)
     !> - 'target_real'
     !> - 'target_imaginary'
     !> - 'all' (only some solver types, e.g. lapack) -- not supported
     !> - 'user' (will use a user specified function to pick between eigenmodes, note not currently implemented)
     !>
     character(len = 20) :: which_option = 'default'
   contains
     procedure, public :: read => read_eigval_config
     procedure, public :: write => write_eigval_config
     procedure, public :: reset => reset_eigval_config
     procedure, public :: broadcast => broadcast_eigval_config
     procedure, public, nopass :: get_default_name => get_default_name_eigval_config
     procedure, public, nopass :: get_default_requires_index => get_default_requires_index_eigval_config
  end type eigval_config_type