pyrokinetics.local_geometry.fourier_gene.LocalGeometryFourierGENE

Contents

pyrokinetics.local_geometry.fourier_gene.LocalGeometryFourierGENE#

class pyrokinetics.local_geometry.fourier_gene.LocalGeometryFourierGENE(*args, **kwargs)[source]#

Bases: LocalGeometry

Local equilibrium representation defined as in: Fourier representation used in GENE https://gitlab.mpcdf.mpg.de/GENE/gene/-/blob/release-2.0/doc/gene.tex FourierGENE

aN(r, theta) = sqrt( (R(r, theta) - R_0)**2 - (Z(r, theta) - Z_0)**2 ) / Lref

= sum_n=0^N [cn(r) * cos(n*theta) + sn(r) * sin(n*theta)]

r = (max(R) - min(R)) / 2

Data stored in a CleverDict Object

psi_n#

Normalised Psi

Type:

Float

rho#

r/a

Type:

Float

a_minor#

Minor radius of LCFS [m]

Type:

Float

Rmaj#

Normalised Major radius (Rmajor/a_minor)

Type:

Float

Rgeo#

Normalisd major radius of normalising field (Rreference/a)

Type:

Float

Z0#

Normalised vertical position of midpoint (Zmid / a_minor)

Type:

Float

f_psi#

Torodial field function

Type:

Float

B0#

Toroidal field at major radius (Fpsi / Rmajor) [T]

Type:

Float

bunit_over_b0#

Ratio of GACODE normalising field = \(q/r \partial \psi/\partial r\) [T] to B0

Type:

Float

dpsidr#
Math:

partial psi / partial r

Type:

Float

q#

Safety factor

Type:

Float

shat#

Magnetic shear

Type:

Float

beta_prime#

\(\beta' = \beta * a/L_p\)

Type:

Float

cN#

cosine moments of aN

Type:

ArrayLike

sN#

sine moments of aN

Type:

ArrayLike

dcNdr#

Derivative of cosine moments w.r.t r

Type:

ArrayLike

dsNdr#

Derivative of sine moments w.r.t r

Type:

ArrayLike

aN#

aN values at theta

Type:

ArrayLike

daNdtheta#

Derivative of aN w.r.t theta at theta

Type:

ArrayLike

daNdr#

Derivative of aN w.r.t r at theta

Type:

ArrayLike

R_eq#

Equilibrium R data used for fitting

Type:

Array

Z_eq#

Equilibrium Z data used for fitting

Type:

Array

b_poloidal_eq#

Equilibrium B_poloidal data used for fitting

Type:

Array

theta_eq#

theta values for equilibrium data

Type:

Float

R#

Fitted R data

Type:

Array

Z#

Fitted Z data

Type:

Array

b_poloidal#

Fitted B_poloidal data

Type:

Array

theta#

Fitted theta data

Type:

Float

dRdtheta#

Derivative of fitted R w.r.t theta

Type:

Array

dRdr#

Derivative of fitted R w.r.t r

Type:

Array

dZdtheta#

Derivative of fitted Z w.r.t theta

Type:

Array

dZdr#

Derivative of fitted Z w.r.t r

Type:

Array

__init__(*args, **kwargs)[source]#

Methods

__init__(*args, **kwargs)

convert_physical_units(norms)

Convert physical-unit attributes to generic simulation units of norms.

default()

Default parameters for geometry Same as GA-STD case

from_gk_data(params)

Initialise from data gathered from GKCode object, and additionally set bunit_over_b0

from_global_eq(eq, psi_n, norms[, show_fit, ...])

Loads LocalGeometry object from an Equilibrium Object

from_local_geometry(local_geometry[, ...])

Loads LocalGeometry object of one type from a LocalGeometry Object of a different type

get_RZ_derivatives(theta[, params])

Calculates the derivatives of R(r,     heta) and Z(r,        heta) w.r.t r and ` heta`, used in B_poloidal calc

get_RZ_second_derivatives(theta)

get_b_poloidal(theta[, params])

Returns Miller prediction for get_b_poloidal given flux surface parameters

get_bunit_over_b0()

Get Bunit/B0 using q and loop integral of Bp

get_d2Rdrdtheta(theta, daNdr, d2aNdrdtheta)

get_d2Rdtheta2(theta, aN, daNdtheta, d2aNdtheta2)

get_d2Zdrdtheta(theta, daNdr, d2aNdrdtheta)

get_d2Zdtheta2(theta, aN, daNdtheta, d2aNdtheta2)

get_dLdtheta(theta)

Returns dLdtheta used in loop integrals

get_dRdr(theta, daNdr)

Calculates the derivatives of R(r,     heta) w.r.t r

get_dRdtheta(theta, aN, daNdtheta)

Calculates the derivatives of R(r, theta) w.r.t ` heta`

get_dZdr(theta, daNdr)

Calculates the derivatives of Z(r,     heta) w.r.t r

get_dZdtheta(theta, aN, daNdtheta)

Calculates the derivatives of Z(r, theta) w.r.t ` heta`

get_f_prime([ntheta])

Calculate F' from and other geometry terms

get_f_psi()

Calculate safety factor from b poloidal field, R, Z and q \(f = \frac{2\pi q}{\oint \frac{dl}{R^2 B_{\theta}}}\)

get_flux_surface(theta)

Generates (R,Z) of a flux surface given a set of FourierGENE fits

get_flux_surface_area_volume()

Calculate the poloidal and toroidal area of the flux surface and the toroidal volume in units of lref

get_flux_surface_area_volume_derivatives()

Calculate the derivative of the poloidal and toroidal area of the flux surface and the toroidal volume with respect to r

get_grad_r(theta[, params])

MXH definition of grad r from MXH, R.

get_s_hat([Fprime, ntheta])

Calculate magnetic shear from F' and other geometry terms

keys()

minimise_b_poloidal(params[, even_space_theta])

Function for least squares minimisation of poloidal field

normalise(norms[, context])

Convert LocalGeometry Parameters to current NormalisationConvention Note this creates the attribute unit_mapping which is used to apply units to the LocalGeometry object :type norms: :param norms: Normalisation convention to convert to :type norms: SimulationNormalisation

plot_equilibrium_to_local_geometry_fit([...])

test_safety_factor()

Calculate safety factor from LocalGeometry object b poloidal field \(q = \frac{1}{2\pi} \oint \frac{f dl}{R^2 B_{\theta}}\)

to(norms[, context])

Thin wrapper for normalise

Attributes

default()[source]#

Default parameters for geometry Same as GA-STD case

get_RZ_derivatives(theta, params=None)[source]#

Calculates the derivatives of R(r,     heta) and Z(r,        heta) w.r.t r and ` heta`, used in B_poloidal calc

Parameters:
  • theta (ArrayLike) – Array of theta points to evaluate grad_r on

  • params (Array [Optional]) – If given then will use params = [dcNdr[nmoments], dsNdr[nmoments] ] when calculating derivatives, otherwise will use object attributes

Return type:

ndarray

Returns:

  • dRdtheta (Array) – Derivative of R w.r.t ` heta`

  • dRdr (Array) – Derivative of R w.r.t r

  • dZdtheta (Array) – Derivative of Z w.r.t ` heta`

  • dZdr (Array) – Derivative of Z w.r.t r

get_RZ_second_derivatives(theta)[source]#
Return type:

ndarray

Parameters:

theta (_SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes])

get_d2Rdrdtheta(theta, daNdr, d2aNdrdtheta)[source]#
get_d2Rdtheta2(theta, aN, daNdtheta, d2aNdtheta2)[source]#
get_d2Zdrdtheta(theta, daNdr, d2aNdrdtheta)[source]#
get_d2Zdtheta2(theta, aN, daNdtheta, d2aNdtheta2)[source]#
get_dRdr(theta, daNdr)[source]#

Calculates the derivatives of R(r,     heta) w.r.t r

Parameters:
  • theta (ArrayLike) – Array of theta points to evaluate dZdr on

  • daNdr (ArrayLike) – Derivative of aN w.r.t r

Returns:

dRdr – Derivative of R w.r.t r

Return type:

Array

get_dRdtheta(theta, aN, daNdtheta)[source]#

Calculates the derivatives of R(r, theta) w.r.t ` heta`

Parameters:
  • theta (ArrayLike) – Array of theta points to evaluate dRdtheta on

  • aN (ArrayLike) – aN for those theta points

  • daNdtheta (ArrayLike) – Derivative of aN at theta w.r.t theta

Returns:

dRdtheta – Derivative of Z w.r.t ` heta`

Return type:

Array

get_dZdr(theta, daNdr)[source]#

Calculates the derivatives of Z(r,     heta) w.r.t r

Parameters:
  • theta (ArrayLike) – Array of theta points to evaluate dZdr on

  • daNdr (ArrayLike) – Derivative of aN w.r.t r

Returns:

dZdr – Derivative of Z w.r.t r

Return type:

Array

get_dZdtheta(theta, aN, daNdtheta)[source]#

Calculates the derivatives of Z(r, theta) w.r.t ` heta`

Parameters:
  • theta (ArrayLike) – Array of theta points to evaluate dZdtheta on

  • aN (ArrayLike) – aN for those theta points

  • daNdtheta (ArrayLike) – Derivative of aN at theta w.r.t theta

Returns:

dZdtheta – Derivative of Z w.r.t ` heta`

Return type:

Array

get_flux_surface(theta)[source]#

Generates (R,Z) of a flux surface given a set of FourierGENE fits

Parameters:

theta (Array) – Values of theta to evaluate flux surface

Return type:

Tuple[ndarray, ndarray]

Returns:

  • R (Array) – R values for this flux surface ([m])

  • Z (Array) – Z Values for this flux surface ([m])

property n#
property n_moments#