Load.curl#

pyPLUTO.Load.curl(self, v1: ndarray | None = None, v2: ndarray | None = None, v3: ndarray | None = None, x1slice: float | int | None = None, x2slice: float | int | None = None, x3slice: float | int | None = None, edge_order: int = 2) ndarray[source]#

Calculates the curl of a specified vector field (v1, v2, v3) using second-order accurate central differences via the NumPy gradient() function. Unlike in divergence(), all three vector components must be specified. The resulting array has its first index representing the 3 curl components, while the remaining indices correspond to the grid location. If ‘x1slice’, ‘x2slice’, or ‘x3slice’ are specified, the curl is only computed at the corresponding x1, x2, or x3 values.

Parameters:
- edge_order: int, default 2

The order of accuracy of derivatives at the domain boundaries.

- v1: np.ndarray | None

Field corresponding to the x1 vector component. Must have the same shape as self.rho.

- v2: np.ndarray | None

Field corresponding to the x2 vector component. Must have the same shape as self.rho.

- v3: np.ndarray | None

Field corresponding to the x3 vector component. Must have the same shape as self.rho.

- x1slice: float | None

If not None, specifies the constant value for the x1 axis.

- x2slice: float | None

If not None, specifies the constant value for the x2 axis.

- x3slice: float | None

If not None, specifies the constant value for the x3 axis.

—-
Returns:
  • np.ndarray

    Curl of the specified vector field (v1, v2, v3). In 3D, e.g., its shape is (3, self.nx1, self.nx2, self.nx3), while if INCLUDE_JDIR == NO (or if x2slice = constant), its shape is (3, self.nx1, self.nx3).

Examples

  • Example #1: Calculate the curl of a vector field

    >>> import pyPLUTO as pp
    >>> D = pp.Load()
    >>> D.curl(D.vx1, D.vx2, D.vx3)