Load.reshape_cartesian#

pyPLUTO.Load.reshape_cartesian(self, *args: Any, **kwargs: Any) tuple[ndarray[tuple[Any, ...], dtype[_ScalarT]], ...][source]#

Function that reshapes a variable from a cylindrical or spherical grid into a cartesian grid. Zones not covered by the original domain (e.g. the very inner radial regions) are also interpolated. At the current stage, the transformation is only in 2D.

Parameters:
- nx1: int, default len(x1)

The number of grid points in the first direction.

- nx2: int, default len(x2)

The number of grid points in the second direction.

- transpose: bool, default False

If True, the variable is transposed.

- var: np.ndarray

The variable to convert.

- x1: int

The first index of the variable.

- x2: int

The second index of the variable.

—-
Returns:
  • newvar: tuple(np.ndarray)

    The converted variable.

Examples

  • Example #1: Convert the vector from spherical to cartesian components

    >>> Bx, By, Bz = cartesian_vector(var="B")
    
  • Example #2: Convert the vector from polar to cartesian components

    >>> Bx, By = cartesian_vector(var1=D.Bx1, var2=D.Bx2)