divertor_equilibrium_m Module



Variables

Type Visibility Attributes Name Initial
integer, public :: max_polygon_N_pts = 100

How many points can be manually supplied as polygon points in the parameter file


Abstract Interfaces

abstract interface

  • public function psi(self, x, y, phi)

    Poloidal flux (in Weber)

    Arguments

    Type IntentOptional Attributes Name
    class(divertor_equilibrium_t), intent(in) :: self
    real(kind=FP), intent(in) :: x

    3D position (x and y normalized)

    real(kind=FP), intent(in) :: y

    3D position (x and y normalized)

    real(kind=FP), intent(in) :: phi

    3D position (x and y normalized)

    Return Value real(kind=fp)

abstract interface

  • public subroutine check_privflux_regions(self, x, y, phi, local_rhomin, local_rhomin_exists, local_rhomax, local_rhomax_exists)

    Returns the flux limits to be applied at (x, y, phi), taking into account region-specific limits

    Arguments

    Type IntentOptional Attributes Name
    class(divertor_equilibrium_t), intent(in) :: self
    real(kind=FP), intent(in) :: x

    3D position (x and y normalized)

    real(kind=FP), intent(in) :: y

    3D position (x and y normalized)

    real(kind=FP), intent(in) :: phi

    3D position (x and y normalized)

    real(kind=FP), intent(inout) :: local_rhomin

    rhomin to be applied at (x, y, phi). Pass in global rhomin: the most restrictive limit is used

    logical, intent(out) :: local_rhomin_exists

    flags to mark whether a local limit is used, as opposed to the global limits passed in This denotes the "private flux"

    real(kind=FP), intent(inout) :: local_rhomax

    rhomax to be applied at (x, y, phi). Pass in global rhomax: the most restrictive limit is used

    logical, intent(out) :: local_rhomax_exists

    flags to mark whether a local limit is used, as opposed to the global limits passed in This denotes the "private flux"


Derived Types

type, public, abstract, extends(equilibrium_t) ::  divertor_equilibrium_t

Components

Type Visibility Attributes Name Initial
logical, public :: initialized = .false.
real(kind=FP), public :: x0

Magnetic axis x = R/R0 (in normalised units)

real(kind=FP), public :: y0

Magnetic axis y = Z/R0 (in normalised units)

real(kind=FP), public :: phi0 = 0.0_FP

Magnetic axis phi

real(kind=FP), public :: xmin

Box limits

real(kind=FP), public :: xmax

Box limits

real(kind=FP), public :: ymin

Box limits

real(kind=FP), public :: ymax

Box limits

real(kind=FP), public :: rhomax

Global limits for rho (rho = normalised psi, n.b. there may also be region-specific limits defined in equi)

real(kind=FP), public :: rhomin

Global limits for rho (rho = normalised psi, n.b. there may also be region-specific limits defined in equi)

logical, public :: flip_Z = .false.

Inverts the Z direction, which is equivalent to reversing the field direction Default false, use true to flip the equilibrium vertically (magnetic axis position unchanged).

real(kind=FP), public :: poloidal_field_factor = 1.0_FP

Poloidal field factor, which can be used to reverse the helicity

type(closed_polygon2d_t), public :: divertor_polygon

Closed polygon which defines the divertor

type(closed_polygon2d_t), public :: exclusion_polygon

Closed polygon which marks points as being off the grid

Read more…
logical, public :: invert_divertor_polygon

Flips the divertor polygon from being assumed concave to convex.

logical, public :: invert_exclusion_polygon

Flips the exclusion polygon from being assumed concave to convex.

real(kind=FP), public :: axis_Btor

Toroidal field at the the magnetic axis -- used to normalise magnetic field

real(kind=FP), public :: O_point_psi

Poloidal flux of the magnetic axis -- used to define the 0-point of rho

real(kind=FP), public :: X_point_psi

Poloidal flux of the (primary) seperatrix -- used to define the 1-point of rho

character(len=:), public, allocatable :: district_definition

Indicates, how districts are defined 'flux': Based on the limiting flux surface rho_max (default) 'wall': Based on divertor and exclusion polygons

Type-Bound Procedures

procedure, public, pass(self) :: absb
procedure, public, pass(self) :: bpol
procedure(init), public, deferred, pass(self) :: init
procedure(display), public, deferred, pass(self) :: display
procedure(debug), public, deferred, pass(self) :: debug
procedure(bx), public, deferred, pass(self) :: bx
procedure(by), public, deferred, pass(self) :: by
procedure(btor), public, deferred, pass(self) :: btor
procedure, public :: is_axisymmetric
procedure, public :: rho
procedure, public :: jacobian
procedure, public :: epol
procedure, public :: erad
procedure, public, nopass :: make_polygon
procedure, public :: make_polygon_from_params
procedure, public :: polygon_projection
procedure, public :: in_vessel
procedure, public :: mag_axis_loc
procedure, public :: on_grid
procedure, public :: district
procedure(psi), public, deferred, pass(self) :: psi
procedure(check_privflux_regions), public, deferred, pass(self) :: check_privflux_regions

Functions

public function is_axisymmetric(self)

Arguments

Type IntentOptional Attributes Name
class(divertor_equilibrium_t), intent(in) :: self

Return Value logical

public function rho(self, x, y, phi)

Flux surface label normalised such that rho = 0 at the magnetic axis, and rho = 1 at the seperatrix

Arguments

Type IntentOptional Attributes Name
class(divertor_equilibrium_t), intent(in) :: self
real(kind=FP), intent(in) :: x
real(kind=FP), intent(in) :: y
real(kind=FP), intent(in) :: phi

Return Value real(kind=fp)

public function jacobian(self, x, y, phi)

Arguments

Type IntentOptional Attributes Name
class(divertor_equilibrium_t), intent(in) :: self
real(kind=FP), intent(in) :: x
real(kind=FP), intent(in) :: y
real(kind=FP), intent(in) :: phi

Return Value real(kind=fp)

public function in_vessel(self, x, y, phi)

Returns whether a point (x, y, phi) lies inside the divertor vessel Not especially performant, would be better to check if the point is outside of flux limits rather than checking the full district routine

Arguments

Type IntentOptional Attributes Name
class(divertor_equilibrium_t), intent(in) :: self
real(kind=FP), intent(in) :: x

3D position (x and y normalized)

real(kind=FP), intent(in) :: y

3D position (x and y normalized)

real(kind=FP), intent(in) :: phi

3D position (x and y normalized)

Return Value logical

public function on_grid(self, x, y, phi)

Returns whether a point (x, y, phi) lies on the computational grid

Arguments

Type IntentOptional Attributes Name
class(divertor_equilibrium_t), intent(in) :: self
real(kind=FP), intent(in) :: x

3D position (x and y normalized)

real(kind=FP), intent(in) :: y

3D position (x and y normalized)

real(kind=FP), intent(in) :: phi

3D position (x and y normalized)

Return Value logical

public function district(self, x, y, phi)

Arguments

Type IntentOptional Attributes Name
class(divertor_equilibrium_t), intent(in) :: self
real(kind=FP), intent(in) :: x
real(kind=FP), intent(in) :: y
real(kind=FP), intent(in) :: phi

Return Value integer

public function district_flux_defined(self, x, y, phi)

Returns a descriptor for a given point, where outer boundary is based on limiting flux surface(s)

Arguments

Type IntentOptional Attributes Name
class(divertor_equilibrium_t), intent(in) :: self

Instance of type

real(kind=FP), intent(in) :: x

x-coordinate

real(kind=FP), intent(in) :: y

y-coordinate

real(kind=FP), intent(in) :: phi

Toroidal angle

Return Value integer

public function district_wall_defined(self, x, y, phi)

Returns a descriptor for a given point, where outer boundary is based on divertor and exclusion polygons

Arguments

Type IntentOptional Attributes Name
class(divertor_equilibrium_t), intent(in) :: self

Instance of type

real(kind=FP), intent(in) :: x

x-coordinate

real(kind=FP), intent(in) :: y

y-coordinate

real(kind=FP), intent(in) :: phi

Toroidal angle

Return Value integer


Subroutines

public subroutine epol(self, x, y, phi, epolx, epoly)

Arguments

Type IntentOptional Attributes Name
class(divertor_equilibrium_t), intent(in) :: self
real(kind=FP), intent(in) :: x
real(kind=FP), intent(in) :: y
real(kind=FP), intent(in) :: phi
real(kind=FP), intent(out) :: epolx
real(kind=FP), intent(out) :: epoly

public subroutine erad(self, x, y, phi, eradx, erady)

Arguments

Type IntentOptional Attributes Name
class(divertor_equilibrium_t), intent(in) :: self
real(kind=FP), intent(in) :: x
real(kind=FP), intent(in) :: y
real(kind=FP), intent(in) :: phi
real(kind=FP), intent(out) :: eradx
real(kind=FP), intent(out) :: erady

public subroutine make_polygon(N_points, X_points, Y_points, polygon, local_min, local_max, use_local_min, use_local_max)

Initialises a polygon object "polygon" with points {X_points, Y_points} If local_min and local_max are given, a limiting_polygon2d_t is created, which stores these limits for later recall N.b. X_points and Y_points should be given normalised

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: N_points
real(kind=FP), intent(in), dimension(N_points) :: X_points
real(kind=FP), intent(in), dimension(N_points) :: Y_points
class(polygon2d_t), intent(out) :: polygon
real(kind=FP), intent(in), optional :: local_min
real(kind=FP), intent(in), optional :: local_max
logical, intent(in), optional :: use_local_min
logical, intent(in), optional :: use_local_max

public subroutine make_polygon_from_params(self, N_points, X_points, Y_points, polygon)

Makes polygon from

Arguments

Type IntentOptional Attributes Name
class(divertor_equilibrium_t), intent(in) :: self
integer, intent(in) :: N_points
real(kind=FP), intent(in), dimension(N_points) :: X_points
real(kind=FP), intent(in), dimension(N_points) :: Y_points
class(polygon2d_t), intent(out) :: polygon

public subroutine polygon_projection(self, x, y, phi, projection_x, projection_y)

Find the x and y components of a unit vector along the nearest polygon edge The polygon boundary dV is expected to have positive (counterclockwise) orientation Can check this with signed_area (in initialisation)

Arguments

Type IntentOptional Attributes Name
class(divertor_equilibrium_t), intent(in) :: self
real(kind=FP), intent(in) :: x
real(kind=FP), intent(in) :: y
real(kind=FP), intent(in) :: phi
real(kind=FP), intent(out) :: projection_x
real(kind=FP), intent(out) :: projection_y

public subroutine mag_axis_loc(self, phi, axis_x, axis_y)

Returns the coordinates of magnetic axis

Arguments

Type IntentOptional Attributes Name
class(divertor_equilibrium_t), intent(in) :: self

Instance of class

real(kind=FP), intent(in) :: phi

Toroidal angle

real(kind=FP), intent(out) :: axis_x

x-coordinate of the magnetic axis

real(kind=FP), intent(out) :: axis_y

y-coordinate of the magnetic axis