dipoleq.core

Python bindings for DipolEq core C++ library

class dipoleq.core.CPlasmaModel

Plasma model base class

model_input

Set a model input parameter

update_model

Update the plasma model

class dipoleq.core.CircleType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Circle measurement sub-type

class dipoleq.core.Coil

Coil data and sub-coil management

property CoilCurrent

(self) -> float

property Enabled

(self) -> int

property Name

Name of the coil

property NumSubCoils

Number of subcoils, setting will erase old subcoils

property R

Coil centroid R

property SubCoils

Return vector of SubCoils

property Z

Coil centroid Z

compute_SubCoils

Generate subcoils from coil parameters and grid

property dR

Coil radial width, > 0 for automatic subcoil generation

property dZ

Coil vertical width

class dipoleq.core.Coils

Sequence view of Coil objects

new_Coil

Create a new Coil (must be inserted via __setitem__)

class dipoleq.core.Limiter

Limiter line-segment definition

property Enabled

1=outer limiter, 0=disabled, -1=inner limiter

property Name

Name of the limiter

property PsiLim

Psi at limiting point

property R1

First point R coordinate

property R2

Second point R coordinate

property RLim

R at limiting point

property Z1

First point Z coordinate

property Z2

Second point Z coordinate

property ZLim

Z at limiting point

class dipoleq.core.Limiters

Sequence view of Limiter objects

ilim_outline()

Get the inner limiter outline, if it exists return as a 2D array of R, Z points and arranged in a counter-clockwise fashion.

Parameters:

lims (Limiters)

Return type:

ndarray[tuple[Any, ...], dtype[generic]]

new_limiter

Add a new limiter

olim_outline()

Get the outer limiter outline, if it exists return as a 2D array of R, Z points and arranged in a clockwise fashion.

Parameters:

lims (Limiters)

Return type:

ndarray[tuple[Any, ...], dtype[generic]]

class dipoleq.core.Machine(*args, **kwargs)

Top-level DipolEq machine object with proper RAII lifetime management

property Coils

Array of COILS

property Confidence

(self) -> float

property Iname

Input name

property Info

Info about the machine

property IterFixed

(self) -> int

property IterFree

(self) -> int

property LHGreenStatus

(self) -> int

property LHname

LH name

property Limiters

Get the limiters

property MGname

MG name

property MGreenStatus

(self) -> int

property MaxIterFixed

(self) -> int

property MaxIterFree

(self) -> int

property MaxIterMCarlo

(self) -> int

property Measures

Get the measurements

property Name

Set the name

property NumCoils

Number of coils, setting will erase old coils

property NumEqualEq

(self) -> int

property NumLimiters

Number of limiters, setting will erase old limiters

property NumMCarloData

(self) -> int

property NumMCarloEq

(self) -> int

property NumMeasures

Number of measurements, setting will erase old measurements

property NumSeps

Number of separatrixes, setting will erase old separatrixes

property NumShells

Number of shells, setting will erase old shells

property Oname

Output name

property Plasma

The Plasma object

property PsiGrid

The PsiGrid object

property RSname

RS name

property RestartStatus

(self) -> int

property RestartUnkns

(self) -> int

property SGname

SG name

property SGreenStatus

(self) -> int

property SInductStatus

(self) -> int

property SMname

SM name

property Seps

Get the separatrixes

property Shells

Get the shells

property Start

(self) -> str

property Stop

(self) -> str

property VacuumOnly

(self) -> int

add_coil_J

Add Coil currents

add_shell_J

Add Shell currents

find_J

Find J

find_plasma_boundary

Find plasma boundary

find_shell_current

Find shell current

free_bndry_greens

Free boundary greens

free_meas_greens

Free measurement greens

get_inner_limiter_contact_point()

Get the inner limiter contact point

Parameters:

m (Machine)

Return type:

tuple[float, float] | None

get_outer_limiter_contact_point()

Get the outer limiter contact point

Parameters:

m (Machine)

Return type:

tuple[float, float] | None

get_plasma_parameters

Get plasma parameters

get_x_points()

Get the X-points (separatrices)

Parameters:

m (Machine)

Return type:

list[Separatrix]

init

Initialize Machine

is_diverted()

Check if the equilibrium is diverted.

Parameters:

m (Machine)

Return type:

bool

is_outer_limited()

Check if the equilibrium is diverted

Parameters:

m (Machine)

Return type:

bool

least_squares

Least squares

load_bndry_greens

Load boundary greens

load_meas_greens

Load measurement greens

psi_boundary

Calculate psi boundary

read_restart

Read the restart file

set_NumSubShells

Reallocate sub-shells for Shells[i]

set_NumSubcoils
set_coil_NumSubCoils

Replace coil[i] with a new Coil having n sub-coils

set_start_time

Set the start time

set_stop_time

Set the end time

write_GS2_geo

Write GS2 geometry file

write_restart

Write the restart file

zero_J

Zero J

class dipoleq.core.MeasType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Measurement type

class dipoleq.core.Measure

Diagnostic measurement data

property Angle
property CircleType
property CoilNum
property Fit

(self) -> float

property Name

Name of the measurement

property Now

(self) -> float

property Number
property R

(self) -> float

property R1

Saddle Loop R1

property R2

Saddle Loop R2

property Radius
property StdDev

(self) -> float

property Type

Type of the measurement

property Value

(self) -> float

property Z

(self) -> float

property Z1

Saddle Loop Z1

property Z2

Saddle Loop Z2

class dipoleq.core.Measures

Sequence view of Measure objects

new_meas

Create a new Measure of the given MeasType

class dipoleq.core.ModelType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Plasma model type

class dipoleq.core.Plasma

Plasma data and profile results

property Alpha

Alpha = \(\mu_0*(p_\parallel - p_\perp)/B^2\) on grid

property B0

Vacuum magnetic field at R0, Z0

property B0R0

\(B_0 * R_0\)

property B2

B^2 on grid

property B2_pr

<B^2> flux tube averaged profile

property BBetaMax_pr

B of max(β) profile

property BMax_pr

max(B) on flux tube profile

property BetaMax_pr

max(β) on flux tube profile

property Beta_pr

<β> flux tube averaged profile

property Bt

B_toroidal on grid

property ChiSqr

Chi squared

property CrossSection

Cross section

property Diamag

Diamagnetism

property Elongation
property G

\(G = F/(B_0 R_0)\) on grid

property G2p

G^2’ polynomial terms

property G2pTerms

Number of G^2’ terms in polynomial plasma models

property G2p_pr

G^2’ profile

property G_pr

G = (F = B_t R)/(B_0 R_0) profile

property GradPsi2

\(|d\psi/dR|^2 + |d\psi/dZ|^2\) on grid

property GradPsiR

\(\del\psi/\delR\) on grid

property GradPsiZ

∂Psi/∂Z on grid

property H

H polynomial terms

property HTerms

Number of H terms in polynomial plasma models

property HalfWidth

Half width

property Ip

Plasma current

property Ip0

initial plasma current

property J_pr

<J> flux tube averaged current density profile

property Jedge

Edge current density

property Ltotal

Total inductance

property Model

The plasma model object

property ModelType

Plasma model type, see ModelType enum

property Nsize

Size of grid -1, should be factor of 2

property NumBndMomts

Number of moments of boundary to calculate

property NumPsiPts

Number of normalized psi points to calculate

property P_pr

Pressure profile

property Perimeter
property Piso

Isotropic pressure on grid

property Pp

p’ polynomial terms

property PpTerms

Number of p’ terms in polynomial plasma models

property Pp_pr

p’ profile

property Ppar

Anisotropic p_parallel pressure on grid

property Pper

Anistropic p_perpendicular pressure on grid

property PsiAxis

Psi at axis or inner separatrix

property PsiFCFS

Psi at axis or inner separatrix

property PsiLCFS

Psi at outer separatrix

property PsiLim

Psi at plasma/vacuum boundary

property PsiMagAxis

Psi at magnetic axis

property PsiX_pr

Normalized Psi ordinate

property PsiXmax

Outermost normalized Psi from 0.0 to 1.0 (say 0.995)

property Psi_pr

Psi on normalized profile

property R0

Reference major radius

property RBMax_pr

R of max(B) profile

property RBetaMax_pr

R of max(β) profile

property RMagAxis

Magnetic axis R

property RRMax_pr

Max R of flux tube contour profile

property Rho

Rho on grid

property Rot

Rotational flow terms

property RotTerms

Number of Rot terms in flow polynomial plasma models

property S_pr

S = global shear of q profile

property Siso

Isotropic S polynomial terms

property SisoTerms

Number of Siso terms in isotropic polynomial plasma models

property Spar

Anisotropic S parallel terms

property SparTerms

Number of Spar terms in anisotropic polynomial plasma models

property Sper

Anisotropic S perpendicular terms

property SperTerms

Number of Sper terms in anisotropic polynomial plasma models

property Vol_pr

V profile

property Volp_pr

dV/dPsi profile

property Volume
property Well_pr

Magnetic well profile

property Z0

Reference vertical position

property ZBMax_pr

Z of max(B) profile

property ZBetaMax_pr

Z of max(β) profile

property ZMagAxis

Magnetic axis Z

property ZRMax_pr

Z at Max R of flux tube contour profile

property beta

Average toroidal beta

property beta0

Vacuum toroidal beta at R0

property betap

Poloidal beta

init

Initialize Plasma

property li

Normalized internal inductance

property mu

Normalized diamagnetism

plasmaG

Calculate plasma G

plasmaG2p

Calculate plasma G2prime

plasmaP

Calculate plasma pressure

plasmaPp

Calculate plasma Pprime

property q0

Central safety factor

property qCircular
property qStar
property q_pr

q profile

property totKinEnergy

Total kinetic energy

property totMagEnergy

Total magnetic energy

class dipoleq.core.PsiGrid

Magnetic flux grid data and PDE solver

property BoundError

(self) -> float

property BoundThreshold

(self) -> float

property Current

Current density on grid * μ_0

property DelPsi

Change in psi across plasma

property IsPlasma

grid point is considered inside the plasma.

property MaxRes

(self) -> float

property Nsize

Size of grid -1, should be factor of 2

property PastMaxRes

(self) -> float

property Psi

Magnetic flux on grid

property PsiAxis

Psi at FCFS or Magnetic Axis

property PsiFCFS

Psi at axis or inner separatrix

property PsiLCFS

Psi at outer separatrix

property PsiLim

Psi at plasma/vacuum boundary

property PsiMagAxis

Psi at Magnetic Axis

property R

R grid

property RMagAxis

Magnetic axis R

property ResThreshold

(self) -> float

property Residual

Current density residual on grid

property Rmax

Maximum R of computational grid

property Rmin

Minimum R of computational grid

property Symmetric

Is the grid symmetric

property UnderRelax1

(self) -> float

property UnderRelax2

(self) -> float

property Z

Z grid

property ZMagAxis

Magnetic axis Z

property Zmax

Maximum Z of computational grid

property Zmin

Minimum Z of computational grid

property dr

R grid spacing

property dz

Z grid spacing

get_IsPlasma

Get IsPlasma indicator at (R, Z)

get_Psi

Get Psi at (R, Z)

get_contour

Get flux contour at normalised psi; returns (r, z) numpy arrays

get_new_residual

Get new residual

go_PDE

Solve the PDE on the PsiGrid

init

Initialize PsiGrid

init_J

Initialize J

make_psi_symmetric

Make Psi symmetric

new_M_solution

Get new M solution

new_solution

Get new solution

class dipoleq.core.Separatrices

Sequence view of Separatrix objects

new_separatrix

Add a new separatrix

class dipoleq.core.Separatrix

Separatrix search definition

property Enabled

(self) -> int

property IsSeparatrix

(self) -> int

property Name

(self) -> str

property Psi

Value of Psi at separatrix

property R1

Box to search for separatrix

property R2

Box to search for separatrix

property RC

Center of plasma from Sep

property Rs

R of separatrix

property Z1

Box to search for separatrix

property Z2

Box to search for separatrix

property ZC

Center of plasma from Sep

property Zs

Z of separatrix

class dipoleq.core.Shell

Conducting shell data

property Enabled

(self) -> int

property Name

(self) -> str

property NumSubShells

(self) -> int

property SubShells

Return view of SubShells

set_NumSubShells

Reallocate sub-shells (requires parent machine for Nsize/NumCoils)

class dipoleq.core.Shells

Sequence view of Shell objects

new_shell

Add a new shell

class dipoleq.core.SubCoil

Individual coil element

property Fraction

Fraction of current

property Name

Name of the subcoil

property R

(self) -> float

property Z

(self) -> float

class dipoleq.core.SubCoils

Sequence view of SubCoil objects

new_subcoil

Create a new SubCoil (must be inserted into Coil)

class dipoleq.core.SubShell

Conducting shell segment

property Current

(self) -> float

property Name

Name of the subshell

property R

(self) -> float

property Radius

(self) -> float

property Z

(self) -> float

class dipoleq.core.SubShells

Sequence view of SubShell objects