bluemira.magnetostatics.greens
Green’s functions mappings for psi, Bx, and Bz
Functions
|
Calculate poloidal flux at (x, z) due to a unit current at (xc, zc) |
|
Calculate the radial derivative of the poloidal flux at (x, z) |
|
Calculate \(\frac{dB_z}{dx}\) (= \(\frac{dB_x}{dz}\) for vacuum) |
|
Calculate the vertical derivative of the poloidal flux at (x, z) |
|
Calculate radial magnetic field at (x, z) due to unit current at (xc, zc) |
|
Calculate vertical magnetic field at (x, z) due to unit current at (xc, zc) |
|
Speed optimisation of Green's functions for psi, Bx, and Bz |
Module Contents
- bluemira.magnetostatics.greens.greens_psi(xc: float | numpy.ndarray, zc: float | numpy.ndarray, x: float | numpy.ndarray, z: float | numpy.ndarray, d_xc: float = 0, d_zc: float = 0) float | numpy.ndarray
Calculate poloidal flux at (x, z) due to a unit current at (xc, zc) using a Greens function.
- Parameters:
xc (float | numpy.ndarray) – Coil x coordinates [m]
zc (float | numpy.ndarray) – Coil z coordinates [m]
x (float | numpy.ndarray) – Calculation x locations
z (float | numpy.ndarray) – Calculation z locations
d_xc (float) – The coil half-width (overload argument)
d_zc (float) – The coil half-height (overload argument)
- Returns:
Poloidal magnetic flux per radian response at (x, z)
- Raises:
ZeroDivisionError – if xc <= 0
- Return type:
float | numpy.ndarray
Notes
\(G_{\psi}(x_{c}, z_{c}; x, z) = \dfrac{{\mu}_{0}}{2{\pi}}\) \(\dfrac{\sqrt{xx_{c}}}{k}\) \([(2-\mathbf{K}(k^2)-2\mathbf{E}(k^2)]\)
- Where:
\(k^{2}\equiv\dfrac{4xx_{c}}{(x+x_{c})^{2}+(z-z_{c})^{2}}\)
\(\mathbf{K} \equiv\) complete elliptic integral of the first kind
\(\mathbf{E} \equiv\) complete elliptic integral of the second kind
- bluemira.magnetostatics.greens.greens_dpsi_dx(xc: float | numpy.ndarray, zc: float | numpy.ndarray, x: float | numpy.ndarray, z: float | numpy.ndarray, d_xc: float = 0, d_zc: float = 0) float | numpy.ndarray
Calculate the radial derivative of the poloidal flux at (x, z) due to a unit current at (xc, zc) using a Greens function.
- Parameters:
xc (float | numpy.ndarray) – Coil x coordinates [m]
zc (float | numpy.ndarray) – Coil z coordinates [m]
x (float | numpy.ndarray) – Calculation x locations
z (float | numpy.ndarray) – Calculation z locations
d_xc (float) – The coil half-width (overload argument)
d_zc (float) – The coil half-height (overload argument)
- Returns:
Radial derivative of the poloidal flux response at (x, z)
- Return type:
float | numpy.ndarray
Notes
\(G_{\dfrac{\partial \psi}{\partial x}}(x_{c}, z_{c}; x, z) =\) \(\dfrac{\mu_0}{2\pi}\) \(\dfrac{1}{u}\) \([\dfrac{w^2}{d^2}\mathbf{E}(k^2)+\mathbf{K}(k^2)]\)
- Where:
\(h^{2}\equiv z_{c}-z\)
\(u^2\equiv(x+x_{c})^2+h^2\)
\(d^{2}\equiv (x - x_{c})^2 + h^2\)
\(w^{2}\equiv x^2 -x_{c}^2 - h^2\)
\(k^{2}\equiv\dfrac{4xx_{c}}{(x+x_{c})^{2}+(z-z_{c})^{2}}\)
\(\mathbf{K} \equiv\) complete elliptic integral of the first kind
\(\mathbf{E} \equiv\) complete elliptic integral of the second kind
The implementation used here refactors the above to avoid some zero divisions.
- bluemira.magnetostatics.greens.greens_dbz_dx(xc: float | numpy.ndarray, zc: float | numpy.ndarray, x: float | numpy.ndarray, z: float | numpy.ndarray) float | numpy.ndarray
Calculate \(\frac{dB_z}{dx}\) (= \(\frac{dB_x}{dz}\) for vacuum)
Get the radial gradient of the vertical magnetic field due to a circular filament.
unit: [N/A/m^2]
\[\frac{dB_z}{dx} = \frac{dB_x}{dz} = \frac{\mu_0 I}{2 \pi}\left( - \frac{(K+E\frac{g_1}{g_2}) g_{3r}}{2 g_3^{\frac{3}{2}}} + \frac{- E \frac{g_{1r}}{g_2} - E \frac{g_1 g_{2r}}{g_2^2} + \frac{dE}{dk} \frac{g_1}{g_2} \text{dkdr} + \frac{dK}{dk} \text{dkdr} }{\sqrt{g_3}} \right)\]where \(K = K(k^2), E = E(k^2)\).
- Returns:
the gradient to the magnetic field
- Parameters:
xc (float | numpy.ndarray)
zc (float | numpy.ndarray)
x (float | numpy.ndarray)
z (float | numpy.ndarray)
- Return type:
float | numpy.ndarray
- bluemira.magnetostatics.greens.greens_dpsi_dz(xc: float | numpy.ndarray, zc: float | numpy.ndarray, x: float | numpy.ndarray, z: float | numpy.ndarray, d_xc: float = 0, d_zc: float = 0) float | numpy.ndarray
Calculate the vertical derivative of the poloidal flux at (x, z) due to a unit current at (xc, zc) using a Greens function.
- Parameters:
xc (float | numpy.ndarray) – Coil x coordinates [m]
zc (float | numpy.ndarray) – Coil z coordinates [m]
x (float | numpy.ndarray) – Calculation x locations
z (float | numpy.ndarray) – Calculation z locations
d_xc (float) – The coil half-width (overload argument)
d_zc (float) – The coil half-height (overload argument)
- Returns:
Vertical derivative of the poloidal flux response at (x, z)
- Return type:
float | numpy.ndarray
Notes
\(G_{\dfrac{\partial \psi}{\partial z}}(x_{c}, z_{c}; x, z) =\) \(\dfrac{\mu_0}{2\pi}\) \(\dfrac{h}{u}\) \([\mathbf{K}(k^2) - \dfrac{v^2}{d^2}\mathbf{E}(k^2)]\)
- Where:
\(h^{2}\equiv z_{c}-z\)
\(u^2\equiv(x+x_{c})^2+h^2\)
\(d^{2}\equiv (x - x_{c})^2 + h^2\)
\(v^{2}\equiv x^2 +x_{c}^2 + h^2\)
\(k^{2}\equiv\dfrac{4xx_{c}}{(x+x_{c})^{2}+(z-z_{c})^{2}}\)
\(\mathbf{K} \equiv\) complete elliptic integral of the first kind
\(\mathbf{E} \equiv\) complete elliptic integral of the second kind
The implementation used here refactors the above to avoid some zero divisions.
- bluemira.magnetostatics.greens.greens_Bx(xc: float | numpy.ndarray, zc: float | numpy.ndarray, x: float | numpy.ndarray, z: float | numpy.ndarray, d_xc: float = 0, d_zc: float = 0) float | numpy.ndarray
Calculate radial magnetic field at (x, z) due to unit current at (xc, zc) using a Greens function.
- Parameters:
xc (float | numpy.ndarray) – Coil x coordinates [m]
zc (float | numpy.ndarray) – Coil z coordinates [m]
x (float | numpy.ndarray) – Calculation x locations
z (float | numpy.ndarray) – Calculation z locations
d_xc (float) – The coil half-width (overload argument)
d_zc (float) – The coil half-height (overload argument)
- Returns:
Radial magnetic field response at (x, z)
- Raises:
ZeroDivisionError – if x == 0
- Return type:
float | numpy.ndarray
Notes
\(G_{B_{x}}(x_{c}, z_{c}; x, z) = -\dfrac{1}{x}\) \(G_{\dfrac{\partial \psi}{\partial z}}\) \((x_{c}, z_{c}; x, z)\)
- bluemira.magnetostatics.greens.greens_Bz(xc: float | numpy.ndarray, zc: float | numpy.ndarray, x: float | numpy.ndarray, z: float | numpy.ndarray, d_xc: float = 0, d_zc: float = 0) float | numpy.ndarray
Calculate vertical magnetic field at (x, z) due to unit current at (xc, zc) using a Greens function.
- Parameters:
xc (float | numpy.ndarray) – Coil x coordinates [m]
zc (float | numpy.ndarray) – Coil z coordinates [m]
x (float | numpy.ndarray) – Calculation x locations
z (float | numpy.ndarray) – Calculation z locations
d_xc (float) – The coil half-width (overload argument)
d_zc (float) – The coil half-height (overload argument)
- Returns:
Vertical magnetic field response at (x, z)
- Raises:
ZeroDivisionError – if x == 0
- Return type:
float | numpy.ndarray
Notes
\(G_{B_{z}}(x_{c}, z_{c}; x, z) = \dfrac{1}{x}\) \(G_{\dfrac{\partial \psi}{\partial x}}\) \((x_{c}, z_{c}; x, z)\)
- bluemira.magnetostatics.greens.greens_all(xc: float | numpy.ndarray, zc: float | numpy.ndarray, x: float | numpy.ndarray, z: float | numpy.ndarray) tuple[float | numpy.ndarray, float | numpy.ndarray, float | numpy.ndarray]
Speed optimisation of Green’s functions for psi, Bx, and Bz
- Parameters:
xc (float | numpy.ndarray) – Coil x coordinates [m]
zc (float | numpy.ndarray) – Coil z coordinates [m]
x (float | numpy.ndarray) – Calculation x locations
z (float | numpy.ndarray) – Calculation z locations
- Returns:
psi – Poloidal magnetic flux per radian response at (x, z)
Bx – Radial magnetic field response at (x, z)
Bz – Vertical magnetic field response at (x, z)
- Raises:
ZeroDivisionError – if xc <= 0 if x <= 0
- Return type:
tuple[float | numpy.ndarray, float | numpy.ndarray, float | numpy.ndarray]