pyrokinetics.local_geometry.metric.MetricTerms#

class pyrokinetics.local_geometry.metric.MetricTerms(local_geometry, ntheta=None, theta=None)[source]#

Bases: object

General geometry Object representing local LocalGeometry fit parameters

Data stored in a ordered dictionary

The following methods are used to access the metric tensor terms via the following

Examples

>>> g_r_r = MetricTerms.toroidal_covariant_metric("r", "r")
Parameters:

local_geometry (LocalGeometry)

regulartheta#

Evenly spaced theta grid

Type:

Array

R#

Flux surface R (normalised to a_minor)

Type:

Array

Z#

Flux surface Z (normalised to a_minor)

Type:

Array

dRdtheta#

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

Type:

Array

dRdr#

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

Type:

Array

dZdtheta#

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

Type:

Array

dZdr#

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

Type:

Array

d2Rdtheta2Array

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

d2RdrdthetaArray

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

d2Zdtheta2Array

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

d2ZdrdthetaArray

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

JacobianArray

Jacobian of flux surface

qFloat

Safety factor

dqdrFloat

Derivative of \(q\) w.r.t \(r\)

dpsidrFloat

\(\partial \psi / \partial r\)

d2psidr2Float

Second derivative of \(psi\) w.r.t \(r\) - arbitrary to set to 0

mu0dPdrFloat

\(mu_0 \partial p \partial r\)

sigma_alphaInteger

Sign to select if (r, alpha, theta) or (r, theta, alpha) is a RHS system

field_coordsList

List of field-aligned co-ordinates

toroidal_coordsList

List of toroidal co-ordinates

dg_r_theta_dthetaArray

Derivative of toroidal covariant metric term g_r_theta w.r.t \(theta\)

dg_theta_theta_drArray

Derivative of toroidal covariant metric term g_theta_theta w.r.t \(r\)

dg_zeta_zeta_drArray

Derivative of toroidal covariant metric term g_zeta_zeta w.r.t \(r\)

dg_zeta_zeta_dthetaArray

Derivative of toroidal covariant metric term g_zeta_zeta w.r.t \(theta\)

__init__(local_geometry, ntheta=None, theta=None)[source]#
Parameters:

local_geometry (LocalGeometry)

Methods

__init__(local_geometry[, ntheta, theta])

convert_physical_units(norms)

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

field_aligned_contravariant_metric(coord1, ...)

Field aligned contravariant metric tensor at requested co-ordinate

field_aligned_covariant_metric(coord1, coord2)

Field aligned covariant metric tensor at requested co-ordinate

k_perp(ky, theta0, nperiod)

Equation 155

set_field_aligned_contravariant_metric()

Sets up field-aligned contravariant metric tensor

set_field_aligned_covariant_metric()

Sets up field-aligned covariant metric tensor

set_toroidal_contravariant_metric()

Sets contravariant metric components of toroidal system using covariant components

set_toroidal_covariant_metric()

Sets up toroidal covariant metric tensor

set_toroidal_covariant_metric_derivatives()

Sets up required terms of derivative of toroidal covariant metric tensor

to(norms[, context])

Thin wrapper for normalise

toroidal_contravariant_metric(coord1, coord2)

Toroidal contravariant metric tensor at requested co-ordinate

toroidal_covariant_metric(coord1, coord2)

Toroidal contravariant metric tensor at requested co-ordinate

Attributes

B_magnitude

B_theta

B_zeta

alpha

inherits correct \(\sigma_\alpha\) from dalpha_dtheta integrate over theta

d2alpha_drdtheta

dB_magnitude_dr

dB_magnitude_dtheta

dB_theta_drho

dB_theta_dtheta

dB_zeta_dr

dJacobian_dr

dJacobian_dtheta

Differentiate eq 9 w.r.t theta

dalpha_dr

Equation 39 inherits correct \(\sigma_\alpha\) from d2alpha_drdtheta integrate over theta

dalpha_dtheta

property B_magnitude#
Returns:

B_magnitude – Magntiude of total field

Return type:

Array

property B_theta#
Returns:

B_theta – Poloidal field in toroidal coordinates

Return type:

Array

property B_zeta#
Returns:

B_zeta – B_zeta which is the current function (I or f) (equation 16)

Return type:

Array

property alpha#

inherits correct \(\sigma_\alpha\) from dalpha_dtheta integrate over theta

Returns:

alpha – Field following coordinate in field alligned system

Return type:

Array

convert_physical_units(norms)[source]#

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

property d2alpha_drdtheta#
Returns:

d2alpha_drdtheta – Second derivative of alpha w.r.t \(\theta\) and \(r\) (equation 38)

Return type:

Array

property dB_magnitude_dr#
Returns:

dB_magnitude_dr – Derivative of magntiude of total field w.r.t r

Return type:

Array

property dB_magnitude_dtheta#
Returns:

dB_magnitude_dr – Derivative of magntiude of total field w.r.t theta

Return type:

Array

property dB_theta_drho#
Returns:

dB_theta_drho – Derivative of B_theta w.r.t \(r\)

Return type:

Array

property dB_theta_dtheta#
Returns:

dB_theta_drho – Derivative of B_theta w.r.t \(r\)

Return type:

Array

property dB_zeta_dr#
Returns:

dB_zeta_dr – Radial derivative of \(B_\zeta\) w.r.t \(r\) (equation 19)

Return type:

Array

property dJacobian_dr#
Returns:

dJacobian_dr – Derivative of Jacobian w.r.t \(r\) (equation 21)

Return type:

Array

property dJacobian_dtheta#

Differentiate eq 9 w.r.t theta

Returns:

dJacobian_dtheta – Derivative of Jacobian w.r.t :math:` heta`

Return type:

Array

property dalpha_dr#

Equation 39 inherits correct \(\sigma_\alpha\) from d2alpha_drdtheta integrate over theta

Returns:

dalpha_dr – Derivative of alpha w.r.t \(r\)

Return type:

Array

property dalpha_dtheta#
Returns:

dalpha_dtheta – Derivative of alpha w.r.t \(\theta\) (equation 37)

Return type:

Array

field_aligned_contravariant_metric(coord1, coord2)[source]#

Field aligned contravariant metric tensor at requested co-ordinate

Parameters:
  • coord1 (str) – Co-ordinate of first index in metric tensor. Can be r, alpha, theta

  • coord2 (str) – Co-ordinate of second index in metric tensor. Can be r, alpha, theta

field_aligned_covariant_metric(coord1, coord2)[source]#

Field aligned covariant metric tensor at requested co-ordinate

Parameters:
  • coord1 (str) – Co-ordinate of first index in metric tensor. Can be r, alpha, theta

  • coord2 (str) – Co-ordinate of second index in metric tensor. Can be r, alpha, theta

k_perp(ky, theta0, nperiod)[source]#

Equation 155

Returns:

k_perp – Perpendicular wavevector along the field line

Return type:

Array

Parameters:
set_field_aligned_contravariant_metric()[source]#

Sets up field-aligned contravariant metric tensor

set_field_aligned_covariant_metric()[source]#

Sets up field-aligned covariant metric tensor

set_toroidal_contravariant_metric()[source]#

Sets contravariant metric components of toroidal system using covariant components

set_toroidal_covariant_metric()[source]#

Sets up toroidal covariant metric tensor

set_toroidal_covariant_metric_derivatives()[source]#

Sets up required terms of derivative of toroidal covariant metric tensor

to(norms, context=None)[source]#

Thin wrapper for normalise

toroidal_contravariant_metric(coord1, coord2)[source]#

Toroidal contravariant metric tensor at requested co-ordinate

Parameters:
  • coord1 (str) – Co-ordinate of first index in metric tensor. Can be r, theta, zeta

  • coord2 (str) – Co-ordinate of second index in metric tensor. Can be r, theta, zeta

toroidal_covariant_metric(coord1, coord2)[source]#

Toroidal contravariant metric tensor at requested co-ordinate

Todo

Make type hints literals

Parameters:
  • coord1 (str) – Co-ordinate of first index in metric tensor. Can be r, theta, zeta

  • coord2 (str) – Co-ordinate of second index in metric tensor. Can be r, theta, zeta