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