theta_grid_gridgen Module

FIXME : Add documentation



Contents


Variables

Type Visibility Attributes Name Initial
integer, private :: npadd
real, private :: alknob
real, private :: epsknob
real, private :: bpknob
real, private :: extrknob
real, private :: regrid_tension
real, private :: tension
real, private :: thetamax
real, private :: deltaw
real, private :: widthw
logical, private :: skip_gridgen
logical, private :: exist
logical, private :: initialized = .false.
type(theta_grid_gridgen_config_type), private :: theta_grid_gridgen_config

Derived Types

Used to represent the input configuration of theta_grid_gridgen

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

Relative weighting of pitch-angle metric to metric

real, public :: bpknob = 1.e-8

Consider when the right grid point is equal to the target bmag.

Read more…
real, public :: deltaw = 0.0

Parameter for weighted resolution in theta. Each theta grid point contributes to the resolution metric according to the function which has peaks at theta = +/- thetamax and deltaw controls the relative weighting of the theta dependent contribution.

real, public :: epsknob = 1e-5

Maximum difference between neighbouring points for determining if a point is an extremum.

real, public :: extrknob = 0.0

Used to set a "bonus" contribtion to resolution at B extrema with an even number of theta grid points. Those with an odd number of points and the assumed extrema at -pi have a metric of 1e20. Here extrknob can be used to bias the algorithm towards keeping extrema with an even number of points.

integer, public :: npadd = 2

Number of points between original grid points to oversample by

real, public :: regrid_tension = -1.0

Tension to use in interpolating splines for regrid of geometrical quantities Defaults to tension if not set.

logical, public :: skip_gridgen = .false.

If true then skip gridgen call and instead just use the existing grid.

Read more…
real, public :: tension = 1.0

Tension for spline

real, public :: thetamax = 0.0

Parameter for weighted resolution in theta. Each theta grid point contributes to the resolution metric according to the function which has peaks at theta = +/- thetamax.

real, public :: widthw = 1.0

Parameter for weighted resolution in theta. Each theta grid point contributes to the resolution metric according to the function which has peaks at theta = +/- thetamax and widthw controls the scale length of the peaks.

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_theta_grid_gridgen_config Subroutine
procedure , public :: write => write_theta_grid_gridgen_config Subroutine
procedure , public :: reset => reset_theta_grid_gridgen_config Subroutine
procedure , public :: broadcast => broadcast_theta_grid_gridgen_config Subroutine
procedure , public , nopass :: get_default_name => get_default_name_theta_grid_gridgen_config Function
procedure , public , nopass :: get_default_requires_index => get_default_requires_index_theta_grid_gridgen_config Function

Functions

Get the module level config instance

Arguments

None

Return Value type(theta_grid_gridgen_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 wnml_theta_grid_gridgen(unit)

FIXME : Add documentation

Arguments

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

public subroutine theta_grid_gridgen_init(theta_grid_gridgen_config_in)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
type(theta_grid_gridgen_config_type), intent(in), optional :: theta_grid_gridgen_config_in

public subroutine finish_theta_grid_gridgen()

FIXME : Add documentation

Arguments

None

private subroutine read_parameters(theta_grid_gridgen_config_in)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
type(theta_grid_gridgen_config_type), intent(in), optional :: theta_grid_gridgen_config_in

public subroutine gridgen_get_grids(nperiod, ntheta, ntgrid, nbset, theta, bset, bmag, gradpar, gbdrift, gbdrift0, cvdrift, cvdrift0, cdrift, cdrift0, gds2, gds21, gds22, gds23, gds24, gds24_noq, grho, Rplot, Zplot, Rprime, Zprime, aplot, aprime, Bpol)

FIXME : Add documentation DD>NOTE: Regrid assumes nnew<nold but doesn't check it. Do we need to?

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nperiod
integer, intent(inout) :: ntheta
integer, intent(inout) :: ntgrid
integer, intent(inout) :: nbset
real, intent(inout), dimension (-ntgrid:ntgrid) :: theta
real, intent(inout), dimension (nbset) :: bset
real, intent(inout), dimension (-ntgrid:ntgrid) :: bmag
real, intent(inout), dimension (-ntgrid:ntgrid) :: gradpar
real, intent(inout), dimension (-ntgrid:ntgrid) :: gbdrift
real, intent(inout), dimension (-ntgrid:ntgrid) :: gbdrift0
real, intent(inout), dimension (-ntgrid:ntgrid) :: cvdrift
real, intent(inout), dimension (-ntgrid:ntgrid) :: cvdrift0
real, intent(inout), dimension (-ntgrid:ntgrid) :: cdrift
real, intent(inout), dimension (-ntgrid:ntgrid) :: cdrift0
real, intent(inout), dimension (-ntgrid:ntgrid) :: gds2
real, intent(inout), dimension (-ntgrid:ntgrid) :: gds21
real, intent(inout), dimension (-ntgrid:ntgrid) :: gds22
real, intent(inout), dimension (-ntgrid:ntgrid) :: gds23
real, intent(inout), dimension (-ntgrid:ntgrid) :: gds24
real, intent(inout), dimension (-ntgrid:ntgrid) :: gds24_noq
real, intent(inout), dimension (-ntgrid:ntgrid) :: grho
real, intent(inout), dimension (-ntgrid:ntgrid) :: Rplot
real, intent(inout), dimension (-ntgrid:ntgrid) :: Zplot
real, intent(inout), dimension (-ntgrid:ntgrid) :: Rprime
real, intent(inout), dimension (-ntgrid:ntgrid) :: Zprime
real, intent(inout), dimension (-ntgrid:ntgrid) :: aplot
real, intent(inout), dimension (-ntgrid:ntgrid) :: aprime
real, intent(inout), dimension (-ntgrid:ntgrid) :: Bpol

private subroutine regrid(nold, x, y, nnew, xnew)

FIXME : Add documentation

Read more…

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nold
real, intent(in), dimension (-nold:nold) :: x
real, intent(inout), dimension (-nold:nold) :: y
integer, intent(in) :: nnew
real, intent(in), dimension (-nnew:nnew) :: xnew

public subroutine set_theta_grid_gridgen_config(theta_grid_gridgen_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(theta_grid_gridgen_config_type), intent(in), optional :: theta_grid_gridgen_config_in

private subroutine read_theta_grid_gridgen_config(self)

Reads in the parameters and knobs namelists and populates the member variables

Arguments

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

private subroutine write_theta_grid_gridgen_config(self, unit)

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

Arguments

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

private subroutine reset_theta_grid_gridgen_config(self)

Resets the config object to the initial empty state

Arguments

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

private subroutine broadcast_theta_grid_gridgen_config(self)

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

Arguments

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