bluemira.equilibria.grid
Grid object and operations for equilibria.
Classes
A rectangular Grid object with regular rectangular cells for use in finite |
Functions
|
Get the double-integral of a function over the space. |
|
Calculate the volume integral of a field in quasi-cylindrical coordinates. |
|
Calculate the revolved volume of a set of x, z coordinates. Revolution about |
Module Contents
- class bluemira.equilibria.grid.Grid(x_min: float, x_max: float, z_min: float, z_max: float, nx: int, nz: int)
A rectangular Grid object with regular rectangular cells for use in finite difference calculations.
- Parameters:
x_min (float) – Minimum x grid coordinate (>0) [m]
x_max (float) – Maximum x grid coordinate [m]
z_min (float) – Minimum z grid coordinate [m]
z_max (float) – Maximum z grid coordinate [m]
nx (int) – Number of x grid points
nz (int) – Number of z grid points
- __slots__ = ('bounds', 'dx', 'dz', 'edges', 'nx', 'nz', 'step', 'x', 'x_1d', 'x_max', 'x_mid', 'x_min',...
- x_min
- x_max
- x_size
- x_mid
- z_min
- z_max
- z_size
- z_mid
- x_1d
- z_1d
- dx: float
- dz: float
- bounds
- edges
- step
- regrid(nx: int, nz: int) Grid
Reinitialise the grid with different x and z discretisation
- Parameters:
nx (int) – number of x grid points
nz (int) – number of z grid points
- Returns:
New grid object
- Return type:
- classmethod from_eqdict(e) Grid
Initialise a Grid object from an EQDSK dictionary.
- Parameters:
e (dict) – EQDSK dictionary
- Return type:
- classmethod from_eqdsk(e: eqdsk.EQDSKInterface) Grid
Initialise a Grid object from an EQDSKInterface.
- Parameters:
e (eqdsk.EQDSKInterface)
- Return type:
- point_inside(x: float | collections.abc.Iterable[float], z: float | None = None) bool
Determine if a point is inside the rectangular grid (includes edges).
- Parameters:
x (float | collections.abc.Iterable[float]) – The x coordinate of the point. Or the 2-D point.
z (float | None) – The z coordinate of the point
- Returns:
inside – Whether or not the point is inside the grid
- Return type:
bool
- distance_to(x: float | collections.abc.Iterable[float], z: float | None = None) numpy.typing.NDArray[numpy.float64]
Get the distances of a point to the edges of the Grid.
- Parameters:
x (float | collections.abc.Iterable[float]) – The x coordinate of the point. Or the 2-D point.
z (float | None) – The z coordinate of the point
- Returns:
Distances to the edges of the Grid.
- Return type:
distances
- plot(ax=None, **kwargs)
Plot the Grid object onto an ax.
- Returns:
The plot axis
- bluemira.equilibria.grid.integrate_dx_dz(func, d_x, d_z)
Get the double-integral of a function over the space.
\(\int_Z\int_X f(x, z) dXdZ\)
- Parameters:
func (np.array(N, M)) – A 2-D function map
d_x (float) – The discretisation size in the X coordinate
d_z (float) – The discretisation size in the Z coordinate
- Returns:
integral – The integral value of the field in 2-D
- Return type:
float
- bluemira.equilibria.grid.volume_integral(func, x, d_x, d_z)
Calculate the volume integral of a field in quasi-cylindrical coordinates.
- Parameters:
func (2-D np.array) – Field to volume integrate
x (2-D np.array) – X coordinate grid
d_x (float) – Grid X cell size
d_z (float) – Grid Z cell size
- Returns:
integral – The integral value of the field in 3-D space
- Return type:
float
- bluemira.equilibria.grid.revolved_volume(x, z)
Calculate the revolved volume of a set of x, z coordinates. Revolution about [0, 0, 1].
- Parameters:
x (np.array) – The x coordinates
z (np.array) – The z coordinates
- Returns:
volume – The volume of the revolved x, z coordinates
- Return type:
float