kt_grids_box Module

Set the perpendicular box size and resolution for linear or nonlinear runs.



Contents


Variables

Type Visibility Attributes Name Initial
real, private :: ly
real, public :: y0
real, public :: x0
real, private :: rtwist
real, private :: rhostar_box
integer, private :: naky_private
integer, private :: ntheta0_private
integer, private :: nx_private
integer, private :: ny_private
integer, private :: n0
integer, public :: jtwist
integer, private :: naky
integer, private :: ntheta0
integer, private :: nx
integer, private :: ny
logical, private :: parameters_read = .false.
logical, private :: initialized = .false.
type(kt_grids_box_config_type), private :: kt_grids_box_config

Derived Types

type, public, extends(abstract_config_type) ::  kt_grids_box_config_type

Used to represent the input configuration of kt_grids_box

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?

integer, public :: jtwist = 1

For finite magnetic shear determines the box size in the x direction according to . This also affects the number of connections at each ky when linked boundary conditions are selected in the dist_fn_knobs namelist.

Read more…
real, public :: ly = 0.0

Sets the box size in the y direction. If set to 0 (the default) then we set ly=2*pi*y0.

integer, public :: n0 = 0

If set greater than zero (the default) then this sets the toroidal mode number of the first non-zero ky by overriding the value given for y0 through y0 = 1.0/(n0*rhostar_box*drhodpsi) where drhodpsi is determined during geometry setup.

integer, public :: naky = 0

The actual number of ky modes. For nonlinear runs it is generally recommended to use ny instead. If set to 0 (the default) this will be automatically set to 1 + (ny-1)/3. If both ny and naky are set then GS2 will check that ny is sufficiently high to ensure de-aliasing. It can be larger than this minimum value. Setting both values can be useful to allow values to be selected which are performant for the FFTs and provide a good range of sweetspots.

integer, public :: ntheta0 = 0

The actual number of theta0 modes. For nonlinear runs it is generally recommended to use nx instead. If set to 0 (the default) this will be automatically set to 1 + 2*(nx-1)/3. If both nx and ntheta0 are set then GS2 will check that nx is sufficiently high to ensure de-aliasing. It can be larger than this minimum value. Setting both values can be useful to allow values to be selected which are performant for the FFTs and provide a good range of sweetspots.

integer, public :: nx = 0

The number of kx points in inputs to the fft routines, and hence the number of radial points used in real space calculations. This differs from the actual number of kx points simulated in the rest of the code due to the need to prevent aliasing. The number of kx modes actually simulated (ntheta0) is, by default, equal to 1 + 2*(nx - 1)/3.

integer, public :: ny = 0

The number of ky points in inputs to the fft routines, and hence the number of binormal points used in real space calculations. This differs from the actual number of ky points simulated in the rest of the code due to the need to prevent aliasing. The number of ky modes actually simulated (naky) is, by default, equal to 1 + (ny - 1)/3.

real, public :: rhostar_box = 0.0

The rhostar (rhoref/Lref) to use. Only used if n0 also set greater than zero. If rhostar_box and n0 are greater than zero then y0=1.0/(n0*rhostar_box*drhodpsi), which effectively sets the minimum non-zero ky used in the simulation.

real, public :: rtwist = 0.0

Expert usage only -- more documentation required.

Read more…
real, public :: x0 = 0.

Controls the box length in the x direction (measured in the reference Larmour radius) if the magnetic shear is small (). The box size in the x direction is given by . See rtwist for an alternative.

real, public :: y0 = 2.0

Controls the box length in the y direction (measured in the reference Larmour radius). The box size in the y direction is given by . Note if y0 is set negative then, it is replaced with -1/y0 and Effectively sets the minimum wavelength captured by the box.

Type-Bound Procedures

procedure , public , :: is_initialised => is_initialised_generic Function
procedure , public , :: init => init_generic Subroutine
procedure , public , :: setup => setup_generic Subroutine
procedure , public , :: write_namelist_header Subroutine
procedure , public , :: get_name => get_name_generic Function
procedure , public , :: get_requires_index => get_requires_index_generic Function
procedure , public , nopass :: write_namelist_footer Subroutine
generic, public , :: write_key_val => write_key_val_string, write_key_val_real, write_key_val_complex, write_key_val_integer, write_key_val_logical, write_key_val_real_array, write_key_val_complex_array, write_key_val_integer_array
procedure , public :: read => read_kt_grids_box_config Subroutine
procedure , public :: write => write_kt_grids_box_config Subroutine
procedure , public :: reset => reset_kt_grids_box_config Subroutine
procedure , public :: broadcast => broadcast_kt_grids_box_config Subroutine
procedure , public , nopass :: get_default_name => get_default_name_kt_grids_box_config Function
procedure , public , nopass :: get_default_requires_index => get_default_requires_index_kt_grids_box_config Function

Functions

public function get_kt_grids_box_config()

Get the module level config instance

Arguments

None

Return Value type(kt_grids_box_config_type)

Gets the default name for this namelist

Arguments

None

Return Value character(len=CONFIG_MAX_NAME_LEN)

Gets the default requires index for this namelist

Arguments

None

Return Value logical


Subroutines

public subroutine read_parameters_box(kt_grids_box_config_in)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
type(kt_grids_box_config_type), intent(in), optional :: kt_grids_box_config_in

public subroutine finish_parameters_box()

FIXME : Add documentation

Arguments

None

public subroutine init_kt_grids_box(kt_grids_box_config_in)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
type(kt_grids_box_config_type), intent(in), optional :: kt_grids_box_config_in

public subroutine wnml_kt_grids_box(unit)

Write namelist for kt_grids_box

Arguments

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

public subroutine box_get_sizes(naky, ntheta0, nx, ny)

Get the various grid sizes

Arguments

Type IntentOptional Attributes Name
integer, intent(out) :: naky

Number of modes. See [[kt_grids_box_parameters::naky]]

integer, intent(out) :: ntheta0

Number of points. See [[kt_grids_box_parameters::ntheta0]]

integer, intent(out) :: nx

Number of x points in real space. See [[kt_grids_box_parameters::nx]]

integer, intent(out) :: ny

Number of y points in real space. See [[kt_grids_box_parameters::ny]]

public subroutine box_set_overrides(grids_ov)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
type(kt_grids_overrides_type), intent(in) :: grids_ov

public subroutine box_get_grids(aky, theta0, akx, ikx)

Calculate the grid of wavenumbers for box mode

Arguments

Type IntentOptional Attributes Name
real, intent(out), dimension (:) :: aky

The grid

real, intent(out), dimension (:,:) :: theta0

The grid

real, intent(out), dimension (:) :: akx

The grid

integer, intent(out), dimension (:) :: ikx

Discrete kx wavenumber grid indices

public subroutine check_kt_grids_box(report_unit)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: report_unit

public subroutine set_kt_grids_box_config(kt_grids_box_config_in)

Set the module level config type Will abort if the module has already been initialised to avoid inconsistencies.

Arguments

Type IntentOptional Attributes Name
type(kt_grids_box_config_type), intent(in), optional :: kt_grids_box_config_in

private subroutine read_kt_grids_box_config(self)

Reads in the kt_grids_box_parameters namelist and populates the member variables

Arguments

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

private subroutine write_kt_grids_box_config(self, unit)

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

Arguments

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

private subroutine reset_kt_grids_box_config(self)

Resets the config object to the initial empty state

Arguments

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

private subroutine broadcast_kt_grids_box_config(self)

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

Arguments

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