Efield Objects¶
dexter.EfieldObject: TypeAlias = NoEfield | GaussianEfield
module-attribute
¶
Available Efield objects.
NoEfield: No electric field.GaussianEfield: Radial-Gaussian electric field.
dexter.NoEfield()
¶
Bases: MachineObject, Efield
No electric field.
You shouldn't have to use this type; It is created when no efield parameter is passed to
Machine.
No $\psi$ bounds checks are performed in evaluations.
dexter.GaussianEfield(strength: PlainQuantity[float] | float, mean: MagneticFlux, width: float)
¶
Bases: MachineObject, Efield
Radial-Gaussian electric field.
Parameters:
-
strength(PlainQuantity[float] | float) –The electric field strength at the curve's peak. If
floatthen it must be in Normalized Units. IfQuantitythen it must have the dimensionality of $[V/m]$. Defining it through an existingMachine'squantitymethod is necessary to properly convert to Normalized Units (see example). Themachine'sGeometryObjectmust be defined. -
mean(MagneticFlux) –The magnetic flux surface where the peak is located.
-
width(float) –The standard deviation or root mean square width of the 'bell'.
Attributes:
-
strength(float) –The electric field strength at the curve's peak, in Normalized Units.
-
mean(MagneticFlux) –The magnetic flux surface where the peak is located.
-
width(float) –The standard deviation or root mean square width of the 'bell'.
Example
>>> lcfs = dex.MagneticFlux.Toroidal(0.05)
>>>
>>> strength = 1e-4
>>> mean = lcfs / 2
>>> width = lcfs.value / 50
>>>
>>> efield = dex.GaussianEfield(strength, mean, width)
>>> geometry=dex.LarGeometry(baxis=2, raxis=2.75, rlast=0.5)
>>> lcfs = geometry.psit_last
>>> machine = dex.Machine(
... geometry=geometry,
... qfactor=dex.UnityQfactor(lcfs),
... current=dex.LarCurrent(),
... bfield=dex.LarBfield(),
... perturbation=dex.Perturbation(
... [
... dex.FluteMode(1e-5, lcfs, 2, 1, 0),
... dex.FluteMode(1e-5, lcfs, 3, 1, 0),
... ]
... ),
... )
>>>
>>> strength = machine.quantity(50, "kiloVolt / meter")
>>> mean = lcfs / 2
>>> width = lcfs.value / 50
>>>
>>> # Now we can set the machine's electric field
>>> machine.efield = dex.GaussianEfield(strength, mean, width)
The GaussianEfield's profile is described by the following formulas (with $\psi$ being either the toroidal or the poloidal flux):
$$ E(\psi) = E\cdot\exp \bigg[-\dfrac{(\psi-\mu)^2}{2\sigma^2}\bigg], $$
$$ \Phi(\psi) = -\int_0^\psi E(\psi)d\psi = E \sigma \sqrt{\dfrac{\pi}{2}} \bigg[\text{erf} \bigg( \dfrac{\sqrt{2}(\psi-\mu)}{2\sigma} \bigg) + \text{erf} \bigg( \dfrac{\mu}{\sigma\sqrt{2}} \bigg) \bigg], \qquad \text{with} \quad \Phi(0) = 0 $$
$$ \dfrac{d\Phi}{d\psi} = - E(\psi), $$
$$ \dfrac{d^2\Phi}{d\psi^2} = \dfrac{\psi - \mu}{\sigma^2}E(\psi) $$