pyrokinetics.local_geometry.fourier_cgyro.LocalGeometryFourierCGYRO

Contents

pyrokinetics.local_geometry.fourier_cgyro.LocalGeometryFourierCGYRO#

class pyrokinetics.local_geometry.fourier_cgyro.LocalGeometryFourierCGYRO(*args, **kwargs)[source]#

Bases: LocalGeometry

Local equilibrium representation defined as in: PPCF 51 (2009) 105009 J Candy

FourierCGYRO

\[\begin{split}\begin{align} R(r, \theta) &= 0.5 aR_0(r) + \sum_{n=1}^N [aR_n(r) \cos(n \theta) + bR_n(r) \sin(n \theta)] \\ Z(r, \theta) &= 0.5 aZ_0(r) + \sum_{n=1}^N [aZ_n(r) \cos(n \theta) + bZ_n(r) \sin(n \theta)] \\ r = (\max(R) - \min(R)) / 2 \end{align}\end{split}\]

Data stored in a CleverDict Object

psi_n#

Normalised Psi

Type:

Float

rho#

r/a

Type:

Float

r_minor#

Minor radius of flux surface

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#

\(\frac{\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

aR#

cosine moments of R

Type:

ArrayLike

aZ#

cosine moments of Z

Type:

ArrayLike

bR#

sine moments of R

Type:

ArrayLike

bZ#

sine moments of Z

Type:

ArrayLike

daRdr#

Derivative of aR w.r.t r

Type:

ArrayLike

daZdr#

Derivative of aZ w.r.t r

Type:

ArrayLike

dbRdr#

Derivative of bR w.r.t r

Type:

ArrayLike

dbZdr#

Derivative of bZ w.r.t r

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, \theta)\) and \(Z(r, \theta)\) w.r.t \(r\) and \(\theta\), used in B_poloidal calc

get_RZ_second_derivatives(theta)

Calculates the second derivatives of \(R(r, \theta)\) and \(Z(r, \theta)\) w.r.t \(r\) and \(\theta\), used in geometry terms

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, daRdr, dbRdr)

Calculate the second derivative of \(R(r, \theta)\) w.r.t \(r\) and \(\theta\)

get_d2Rdtheta2(theta)

Calculates the second derivative of \(R(r, \theta)\) w.r.t \(\theta\)

get_d2Zdrdtheta(theta, daZdr, dbZdr)

Calculates the second derivative of \(Z(r, \theta)\) w.r.t \(r\) and \(\theta\)

get_d2Zdtheta2(theta)

Calculates the second derivative of \(Z(r, theta)\) w.r.t \(\theta\)

get_dLdtheta(theta)

Returns dLdtheta used in loop integrals

get_dRdr(theta, daRdr, dbRdr)

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

get_dRdtheta(theta)

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

get_dZdr(theta, daZdr, dbZdr)

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

get_dZdtheta(theta)

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

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 FourierCGYRO 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, \theta)\) and \(Z(r, \theta)\) w.r.t \(r\) and \(\theta\), 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 = [daRdr[nmoments], daZdr[nmoments], dbRdr[nmoments], dbZdr[nmoments] ] when calculating derivatives, otherwise will use object attributes

Return type:

ndarray

Returns:

  • dRdtheta (Array) – Derivative of \(R\) w.r.t \(\theta\)

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

  • dZdtheta (Array) – Derivative of \(Z\) w.r.t \(\theta\)

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

get_RZ_second_derivatives(theta)[source]#

Calculates the second derivatives of \(R(r, \theta)\) and \(Z(r, \theta)\) w.r.t \(r\) and \(\theta\), used in geometry terms

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

  • normalised (Boolean) – Control whether or not to return normalised values

Return type:

ndarray

Returns:

  • d2Rdtheta2 (Array) – Second derivative of \(R\) w.r.t \(\theta\)

  • d2Rdrdtheta (Array) – Second derivative of \(R\) w.r.t \(r\) and \(\theta\)

  • d2Zdtheta2 (Array) – Second derivative of \(Z\) w.r.t \(\theta\)

  • d2Zdrdtheta (Array) – Second derivative of \(Z\) w.r.t \(r\) and \(\theta\)

get_d2Rdrdtheta(theta, daRdr, dbRdr)[source]#

Calculate the second derivative of \(R(r, \theta)\) w.r.t \(r\) and \(\theta\)

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

  • daRdr (ArrayLike) – Derivative in aR w.r.t r

  • dbRdr (ArrayLike) – Derivative of bR w.r.t r

Returns:

d2Rdrdtheta – Second derivative of R w.r.t \(r\) and \(\theta\)

Return type:

Array

get_d2Rdtheta2(theta)[source]#

Calculates the second derivative of \(R(r, \theta)\) w.r.t \(\theta\)

Parameters:

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

Returns:

d2Rdtheta2 – Second derivative of \(R\) w.r.t \(\theta\)

Return type:

Array

get_d2Zdrdtheta(theta, daZdr, dbZdr)[source]#

Calculates the second derivative of \(Z(r, \theta)\) w.r.t \(r\) and \(\theta\)

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

  • daZdr (ArrayLike) – Derivative in aZ w.r.t r

  • dbZdr (ArrayLike) – Derivative of bZ w.r.t r

Returns:

d2Zdrdtheta – Second derivative of \(Z\) w.r.t \(r\) and \(\theta\)

Return type:

Array

get_d2Zdtheta2(theta)[source]#

Calculates the second derivative of \(Z(r, theta)\) w.r.t \(\theta\)

Parameters:

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

Returns:

d2Zdtheta2 – Second derivative of \(Z\) w.r.t \(\theta\)

Return type:

Array

get_dRdr(theta, daRdr, dbRdr)[source]#

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

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

  • daRdr (ArrayLike) – Derivative in aR w.r.t r

  • dbRdr (ArrayLike) – Derivative of bR w.r.t r

Returns:

dRdr – Derivative of \(R\) w.r.t \(r\)

Return type:

Array

get_dRdtheta(theta)[source]#

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

Parameters:

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

Returns:

dRdtheta – Derivative of \(R\) w.r.t \(\theta\)

Return type:

Array

get_dZdr(theta, daZdr, dbZdr)[source]#

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

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

  • daZdr (ArrayLike) – Derivative in aZ w.r.t r

  • dbZdr (ArrayLike) – Derivative of bZ w.r.t r

Returns:

dZdr – Derivative of \(Z\) w.r.t \(r\)

Return type:

Array

get_dZdtheta(theta)[source]#

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

Parameters:

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

Returns:

dZdtheta – Derivative of \(Z\) w.r.t \(\theta\)

Return type:

Array

get_flux_surface(theta)[source]#

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

Parameters:
  • theta (Array) – Values of theta to evaluate flux surface

  • normalised (Boolean) – Control whether or not to return normalised flux surface

Return type:

Tuple[ndarray, ndarray]

Returns:

  • R (Array) – R values for this flux surface (if not normalised then in [m])

  • Z (Array) – Z Values for this flux surface (if not normalised then in [m])

property n#
property n_moments#