ceq Module

Reads in the geometry using a CHEASE output file. The CHEASE output file is read using the helper module read_chease.


Uses


Contents


Variables

Type Visibility Attributes Name Initial
logical, private :: skip_file_read = .false.

Derived Types

type, public, extends(abstract_eqfile_geo_type) ::  ceq_type

Components

Type Visibility Attributes Name Initial
character(len=:), public, allocatable :: type_name

Name of the specific implementation

logical, public :: initialised = .false.

Has this instance been initialised

logical, public :: has_full_theta_range = .false.

Does this implementation have the full or half theta grid? If only half then we assume up-down symmetry and use this to set gradients etc.

integer, public :: nr

Typically the number of radial and theta grid points.

integer, public :: nt

Typically the number of radial and theta grid points.

real, public :: psi_0
real, public :: psi_a
real, public :: B_T
real, public :: beta_0
real, public :: R_mag
real, public :: Z_mag
real, public :: aminor
real, public, allocatable, dimension(:,:) :: R_psi

2D map of co-ordinates to R, Z or B

real, public, allocatable, dimension(:,:) :: Z_psi

2D map of co-ordinates to R, Z or B

real, public, allocatable, dimension(:,:) :: B_psi

2D map of co-ordinates to R, Z or B

real, public, allocatable, dimension(:,:) :: eqth

2D maps of theta and eqpsi

real, public, allocatable, dimension(:,:) :: eqpsi_2d

2D maps of theta and eqpsi

real, public, allocatable, dimension (:,:,:) :: dpcart

Minor radius gradient in cylindrical coordinates

real, public, allocatable, dimension (:,:,:) :: dtcart

Theta gradient in cylindrical coordinates

real, public, allocatable, dimension (:,:,:) :: dbcart

B gradient in cylindrical coordinates

real, public, allocatable, dimension (:,:,:) :: dpbish

Minor radius gradient in Bishop coordinates

real, public, allocatable, dimension (:,:,:) :: dtbish

Theta gradient in Bishop coordinates

real, public, allocatable, dimension (:,:,:) :: dbbish

B gradient in Bishop coordinates

real, public, allocatable, dimension(:) :: eqpsi

Equilibrium psi (not normalised) and pressure grids

real, public, allocatable, dimension(:) :: pressure

Equilibrium psi (not normalised) and pressure grids

real, public, allocatable, dimension(:) :: psi_bar

Normalised psi, fp, q, beta, diameter and R_centre values on grid

real, public, allocatable, dimension(:) :: fp

Normalised psi, fp, q, beta, diameter and R_centre values on grid

real, public, allocatable, dimension(:) :: qsf

Normalised psi, fp, q, beta, diameter and R_centre values on grid

real, public, allocatable, dimension(:) :: beta

Normalised psi, fp, q, beta, diameter and R_centre values on grid

real, public, allocatable, dimension(:) :: diam

Normalised psi, fp, q, beta, diameter and R_centre values on grid

real, public, allocatable, dimension(:) :: rc

Normalised psi, fp, q, beta, diameter and R_centre values on grid

character(len=EQFILE_LENGTH), public :: filename
type(spline), public :: btori_spl
type(spline), public :: qsf_spl
type(spline), public :: pressure_spl
type(spline), public :: beta_spl
type(spline), public :: diam_spl
type(spline), public :: rcenter_spl

Type-Bound Procedures

procedure , public , :: initialise Subroutine
procedure , public , :: gradient Subroutine

Calculate the derivative of rp w.r.t. R and Z and return the modulus sqrt(drp/dR ^ 2 + drp/dZ^2). I.e. return |grad rp|. Parameters are: - rgrid: Submodule radial grid (r_circ for EFIT, rp otherwise) - theta: grid of theta - gradf(:,1): |grad psi| - gradf(:,2): 0.0 - char: if char = 'R', return |grad pressure| instead - char: if char = 'T', then return theta gradient in bishop form - gradf(:,1): (dtheta/dZ d rp/dR - dtheta/dR drp/dZ)/ |grad rp| - gradf(:,2): (dtheta/dR d rp/dR + dtheta/dZ drp/dZ)/ |grad rp| - rp: value of rp on the flux surface where we want the grad - nth: number of theta points - ntgrid: lower index of theta array is -ntgrid

procedure , public , :: calculate_gradients Subroutine
procedure , public , :: rhofun => rhofun_null Function
procedure , public , :: derm Subroutine
procedure , public , :: invR Function
procedure , public , :: eqdbish Subroutine
procedure , public , :: eqdcart Subroutine
procedure , public , :: dealloc_common_arrays Subroutine
procedure , public , :: alloc_common_arrays Subroutine
procedure , public , :: hahm_burrell Subroutine
procedure , public , :: dealloc_arrays Subroutine
procedure , public , :: alloc_arrays Subroutine
procedure , public , :: alloc_special_arrays => alloc_special_arrays_null Subroutine
procedure , public , :: dealloc_special_arrays => dealloc_special_arrays_null Subroutine
procedure , public , :: finalise => finalise_eqfile Subroutine
procedure , public , :: finish_setup => finish_setup_eqfile Subroutine
procedure , public , :: setup_special_splines => setup_special_splines_eqfile_null Subroutine
procedure , public , :: delete_special_splines => delete_special_splines_eqfile_null Subroutine
procedure , public , :: setup_splines => setup_splines_eqfile Subroutine
procedure , public , :: delete_splines => delete_splines_eqfile Subroutine
procedure , public , :: dbtori => dbtori_eqfile Function
procedure , public , :: btori => btori_eqfile Function
procedure , public , :: betafun => betafun_eqfile Function
procedure , public , :: qfun => qfun_eqfile Function
procedure , public , :: dpfun => dpfun_eqfile Function
procedure , public , :: pfun => pfun_eqfile Function
procedure , public , :: rcenter => rcenter_eqfile Function
procedure , public , :: diameter => diameter_eqfile Function
procedure , public , :: rfun => psi_eqfile Function
procedure , public , :: psi => psi_eqfile Function
procedure , public , :: zpos => zpos_eqfile Function
procedure , public , :: rpos => rpos_eqfile Function
procedure , public , :: eqitem => eqitem_eqfile Function
procedure , public , :: set_ceq_from_chease Subroutine
procedure , public , :: read_and_set Subroutine

Functions

public elemental function chease_chi_index(nchi, itheta)

Convert from theta-index which is -pi to pi, to chi-index, which is 0 to 2*pi. Assumes nchi is even?

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nchi
integer, intent(in) :: itheta

Return Value integer


Subroutines

private subroutine read_and_set(self, inputs)

Arguments

Type IntentOptional Attributes Name
class(ceq_type), intent(inout) :: self
type(geo_input_type), intent(in) :: inputs

private pure subroutine set_ceq_from_chease(self)

Set the ceq module-level variables from the read_chease module variables.

Read more…

Arguments

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