theta_grid_eik_config_type Derived Type

type, public, extends(abstract_config_type) :: theta_grid_eik_config_type

Used to represent the input configuration of theta_grid


Contents


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 :: alpha_input = 0.0

Used in calculation of dp_new = -alpha_input/qval**2/rmaj*drhodpsi

real, public :: beta_prime_input = 0.0

The gradient of the pressure. Strictly speaking this parameter is not but : in other words, the gradient of the magnetic field is ignored. Used only if bishop = 4 or 9.

integer, public :: bishop = 5

Use Bishop relations to generate metric coefficients.

  • 0: Use high-aspect ratio coefficients (only for debugging)
  • 1: Use actual equilibrium values of shat, p' recommended
  • 2: Use numerical equilibrium + s_hat_input and p_prime_input
  • 3: Use numerical equilibrium + s_hat_input and inv_Lp_input
  • 4: Use numerical equilibrium + s_hat_input and beta_prime_input
  • 5: Use numerical equilibrium + s_hat_input and alpha_input
  • 6: Use numerical equilibrium + beta_prime_input
  • 7: Use numerical equilibrium and multiply pressure gradient by dp_mult
  • 8: Use numerical equilibrium + s_hat_input and multiply pressure gradient by dp_mult
  • 9: Use numerical equilibrium + s_hat_input and beta_prime_input
  • Otherwise: Use magnetic shear and pressure gradient as set elsewhere.
logical, public :: chs_eq = .false.

Use equilbrium data from the CHEASE file ogyropsi.dat

real, public :: delrho = 1e-3

Step size for radial derivatives, . Should be "small enough", typically 0.001.

logical, public :: dfit_eq = .false.

Vacuum magnetic dipole geometry

real, public :: dp_mult = 1.0

Used to scale the pressure gradient, only if bishop = 7 or 8.

logical, public :: efit_eq = .false.

Use EFIT equilibrium (EFIT, codes with eqdsk format)

character(len=EQFILE_LENGTH), public :: eqfile = "default_unset_value"

Name of file with numerical equilibrium data (if required)

character(len=EQFILE_LENGTH), public :: eqnormfile = "default_unset_value"

Name of file with numerical equilibrium normalization data (if required) currently, only used for dipole equilibrium (deq)

logical, public :: equal_arc = .true.

Change field-line coordinate. Recommended value: F

logical, public :: force_sym = .false.

If true then forces up-down symmetry in some geometrical quantities

logical, public :: gen_eq = .false.

Use Toq-style NetCDF equilibrium (TOQ)

logical, public :: gs2d_eq = .false.

Read Colin Roach's GS2D equilibrium file

logical, public :: idfit_eq = .false.

Unknown equilibrium file. You probably don't want this. FIXME: Add documentation

integer, public :: iflux = -1

Deprecated -- redundant information.

real, public :: invlp_input = 0.

Used with bishop == 3: controls pressure length scale by multiplying

integer, public :: irho = 2

Choose definition of flux surface coordinate

  • 1: rho == sqrt(toroidal flux)/sqrt(toroidal flux of LCFS)
  • 2: rho == midplane diameter/LCFS diameter - Recommended
  • 3: rho == poloidal flux/poloidal flux of LCFS
  • 4: rho == rho_mid (vacuum ring dipole, dfit_eq = T, only)

NB For consistency fprim, tprim, shat, uprim, g_exb etc must be computed using same radial variable, i.e. depend on choice of irho!

integer, public :: isym = -1

Deprecated, see force_sym instead

integer, public :: itor = -1

Deprecated, see use_large_aspect instead

logical, public :: local_eq = .true.

If .true. use Miller-style local equilibrium else use other numerical equilibrium types

integer, public :: ntheta_geometry = -1

The number of theta grid points to use in eikcoefs calls. Currently may not have an effect for all equilibrium types. If not set then defaults to ntheta

logical, public :: ppl_eq = .false.

Use Menard-style NetCDF equilibrium (JSOLVER)

real, public :: s_hat_input = 0.0

Used to overrides s_hat prescribed by the numerical equilibrium, but only if bishop=2,3,4,5,8, or 9.

logical, public :: transp_eq = .false.

Use PPL NetCDF equilibrium (psipqgrz equilibrium from TRANSP/TRXPL)

logical, public :: use_large_aspect = .false.

If true use large aspect ratio expansions in eik geometry to get ~s-alpha

logical, public :: writelots = .false.

Write a little extra about geometry to the screen.


Type-Bound Procedures

procedure, public, :: is_initialised => is_initialised_generic

procedure, public, :: init => init_generic

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

    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

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, 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_theta_grid_eik_config

procedure, public :: write => write_theta_grid_eik_config

  • private subroutine write_theta_grid_eik_config(self, unit)

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

    Arguments

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

procedure, public :: reset => reset_theta_grid_eik_config

procedure, public :: broadcast => broadcast_theta_grid_eik_config

procedure, public, nopass :: get_default_name => get_default_name_theta_grid_eik_config

procedure, public, nopass :: get_default_requires_index => get_default_requires_index_theta_grid_eik_config

Source Code

  type, extends(abstract_config_type) :: theta_grid_eik_config_type
     ! namelist : theta_grid_eik_knobs
     ! indexed : false
     !> Used in calculation of `dp_new = -alpha_input/qval**2/rmaj*drhodpsi`
     !> @note This gets a "smart" default.
     real :: alpha_input = 0.0
     !> The gradient of the pressure. Strictly speaking this parameter
     !> is not \(\frac{\partial \beta}{\partial \rho}\) but \(\beta
     !> \frac{1}{p}\frac{\partial p}{\partial \rho}\): in other words,
     !> the gradient of the magnetic field is ignored. Used only if
     !> `bishop` = 4 or 9.
     !> @note This gets a "smart" default.
     real :: beta_prime_input = 0.0
     !> Use Bishop relations to generate metric coefficients.
     !>
     !> -  0: Use high-aspect ratio coefficients (only for debugging)
     !> -  1: Use actual equilibrium values of shat, p' recommended
     !> -  2: Use numerical equilibrium + s_hat_input and p_prime_input
     !> -  3: Use numerical equilibrium + s_hat_input and inv_Lp_input
     !> -  4: Use numerical equilibrium + s_hat_input and beta_prime_input
     !> -  5: Use numerical equilibrium + s_hat_input and alpha_input
     !> -  6: Use numerical equilibrium + beta_prime_input
     !> -  7: Use numerical equilibrium and multiply pressure gradient by dp_mult
     !> -  8: Use numerical equilibrium + s_hat_input and multiply pressure gradient by dp_mult
     !> -  9: Use numerical equilibrium + s_hat_input and beta_prime_input
     !> -  Otherwise: Use magnetic shear and pressure gradient as set elsewhere.
     !>
     integer :: bishop = 5
     !> Use equilbrium data from the CHEASE file ogyropsi.dat
     logical :: chs_eq = .false.
     !> Step size for radial derivatives, \(\Delta r_{\psi N}\). Should be
     !> "small enough", typically 0.001.
     real :: delrho = 1e-3
     !> Vacuum magnetic dipole geometry
     logical :: dfit_eq = .false.
     !> Used to scale the pressure gradient, only if bishop = 7 or 8.
     real :: dp_mult = 1.0
     !> Use EFIT equilibrium (EFIT, codes with eqdsk format)
     logical :: efit_eq = .false.
     !> Name of file with numerical equilibrium data (if required)
     character(len = EQFILE_LENGTH) :: eqfile = "default_unset_value"
     !> Name of file with numerical equilibrium normalization data (if required)
     !> currently, only used for dipole equilibrium (deq)
     character(len = EQFILE_LENGTH) :: eqnormfile = "default_unset_value"
     !> Change field-line coordinate. Recommended value: F
     !> @note We recommend `.false.` but default to `.true.`. We should consider
     !> changing the default.
     logical :: equal_arc = .true.
     !> If true then forces up-down symmetry in some geometrical quantities
     logical :: force_sym = .false.
     !> Use Toq-style NetCDF equilibrium (TOQ)
     logical :: gen_eq = .false.
     !> Read Colin Roach's GS2D equilibrium file
     logical :: gs2d_eq = .false.
     !> Unknown equilibrium file. You probably don't want this.
     !> FIXME: Add documentation
     logical :: idfit_eq = .false.
     !> Deprecated -- redundant information.
     integer :: iflux = -1
     !> Used with [[theta_grid_eik_knobs:bishop]] == 3: controls pressure length
     !> scale by multiplying \(p \frac{d \rho}{d \psi}\)
     real :: invlp_input = 0.
     !> Choose definition of flux surface coordinate
     !>
     !> -  1: rho == sqrt(toroidal flux)/sqrt(toroidal flux of LCFS)
     !> -  2: rho == midplane diameter/LCFS diameter - Recommended
     !> -  3: rho == poloidal flux/poloidal flux of LCFS
     !> -  4: rho == rho_mid (vacuum ring dipole, `dfit_eq = T`, only)
     !>
     !> NB For consistency fprim, tprim, shat, uprim, g_exb etc
     !>  *must be computed using same radial variable*,
     !>  i.e. *depend on choice of irho*!
     integer :: irho = 2
     !> Deprecated, see force_sym instead
     integer :: isym = -1
     !> Deprecated, see use_large_aspect instead
     integer :: itor = -1
     !> If `.true.` use Miller-style local equilibrium else use other
     !> numerical equilibrium types
     logical :: local_eq = .true.
     !> The number of theta grid points to use in eikcoefs calls.
     !> Currently may not have an effect for all equilibrium types.
     !> If not set then defaults to [[theta_grid_parameters:ntheta]]
     integer :: ntheta_geometry = -1
     !> Use Menard-style NetCDF equilibrium (JSOLVER)
     logical :: ppl_eq = .false.
     !> Used to overrides s_hat prescribed by the numerical
     !> equilibrium, but _only_ if bishop=2,3,4,5,8, or 9.
     !> @note This gets a "smart" default.
     real :: s_hat_input = 0.0
     !> Use PPL NetCDF equilibrium (psipqgrz equilibrium from TRANSP/TRXPL)
     logical :: transp_eq = .false.
     !> If true use large aspect ratio expansions in eik geometry to get ~s-alpha
     logical :: use_large_aspect = .false.
     !> Write a little extra about geometry to the screen.
     logical :: writelots = .false.
   contains
     procedure, public :: read => read_theta_grid_eik_config
     procedure, public :: write => write_theta_grid_eik_config
     procedure, public :: reset => reset_theta_grid_eik_config
     procedure, public :: broadcast => broadcast_theta_grid_eik_config
     procedure, public, nopass :: get_default_name => get_default_name_theta_grid_eik_config
     procedure, public, nopass :: get_default_requires_index => get_default_requires_index_theta_grid_eik_config
  end type theta_grid_eik_config_type