Bfield Objects¶
dexter.BfieldObject: TypeAlias = LarBfield | NcBfield
module-attribute
¶
dexter.LarBfield()
¶
Bases: MachineObject, Bfield
Analytical Large Aspect Ratio magnetic field with $B(\psi_t,\theta) = 1-\sqrt{2\psi_t}\cos\theta$.
No $\psi_t$ bounds checks are performed in evaluations.
dexter.NcBfield(path: str, interp_type: Interpolation2dType, padding: int = 15)
¶
Bases: MachineObject, Bfield
Numerical magnetic field profile reconstructed from a netCDF file.
Related quantities are computed by interpolating over the data arrays.
Parameters:
-
path(str) –The path to the NetCDF file.
-
interp_type(Interpolation2dType) –The 2D interpolation type.
-
padding(int, default:15) –Sets the left-right $\theta$ padding width.
Magnetic field $\theta$ padding
At the grid edges, the interpolator’s higher derivatives are not well defined. By left-right padding the $B$ array with extra $\psi=const$ columns, we force the interpolator to take $\theta$’s periodicity into account and therefore calculate the correct derivative values. Note that in contrast to the one-dimensional cubic spline, in a bicubic interpolation 3 columns are not enough to ensure periodicity, since the spline coefficients depend on the values of the whole array.
According to this stack overflow thread, the effect of the $i$-th column at the $j$-th column of the spline scales as $r^{|i-j|}$, where $r=\sqrt{3}-2 \approx -0.26$. Therefore, with a padding of 10, the effect at the $\theta=0$ boundary would be of the order of $10^{-6}$.
Attributes:
-
path(str) –The path to the netCDF file.
-
netcdf_version(NetCDFVersion) –The netCDF file's version (SemVer).
-
interp_type(Interpolation2dType) –The 2D interpolation type.
-
baxis(float) –The magnetic field strength on the axis $B_0$ in $[T]$.
-
padding(int) –The number of $\theta$ padding columns (per side).
-
padding_theta(float) –The angle $\theta$ of the padding. This corresponds to the absolute value of the first element of the padded $\theta$ array, e.g the extends of the padding.
-
shape(ArrayShape) –Returns the $(\psi,\theta)$ shape of the initial 1D arrays (before the padding).
-
shape_padded(ArrayShape) –Returns the $(\psi,\theta)$ shape of the padded arrays that were used to create the interpolator.
-
psit_array(Array1 | None) –The toroidal flux' values.
-
psip_array(Array1 | None) –The poloidal flux' values.
-
theta_array(Array1) –The poloidal angle $\theta$ values.
-
theta_array_padded(Array1) –The padded $\theta$ values.
-
b_array(Array2) –The magnetic field $B$ values.
-
b_array_padded(Array2) –The padded $B$ values.