pencil.math.derivatives ======================= .. py:module:: pencil.math.derivatives .. autoapi-nested-parse:: Differential operators in different coordinate systems. Submodules ---------- .. toctree:: :maxdepth: 1 /code/sourcePython/pencil/math/derivatives/der/index /code/sourcePython/pencil/math/derivatives/der_4th_order_w_ghosts/index /code/sourcePython/pencil/math/derivatives/der_6th_order_w_ghosts/index /code/sourcePython/pencil/math/derivatives/der_nonequi/index /code/sourcePython/pencil/math/derivatives/div_grad_curl/index /code/sourcePython/pencil/math/derivatives/simple_centered/index Attributes ---------- .. autoapisummary:: pencil.math.derivatives.xder pencil.math.derivatives.yder pencil.math.derivatives.zder pencil.math.derivatives.xder2 pencil.math.derivatives.yder2 pencil.math.derivatives.zder2 pencil.math.derivatives.xder3 pencil.math.derivatives.yder3 pencil.math.derivatives.zder3 pencil.math.derivatives.xder5 pencil.math.derivatives.yder5 pencil.math.derivatives.zder5 pencil.math.derivatives.xder6 pencil.math.derivatives.yder6 pencil.math.derivatives.zder6 Functions --------- .. autoapisummary:: pencil.math.derivatives.div pencil.math.derivatives.curl pencil.math.derivatives.grad pencil.math.derivatives.curl2 pencil.math.derivatives.del2 pencil.math.derivatives.curl3 pencil.math.derivatives.del6 pencil.math.derivatives.gij pencil.math.derivatives.traceless_strain pencil.math.derivatives.simple_centered Package Contents ---------------- .. py:data:: xder .. py:data:: yder .. py:data:: zder .. py:data:: xder2 .. py:data:: yder2 .. py:data:: zder2 .. py:data:: xder3 .. py:data:: yder3 .. py:data:: zder3 .. py:data:: xder5 .. py:data:: yder5 .. py:data:: zder5 .. py:data:: xder6 .. py:data:: yder6 .. py:data:: zder6 .. py:function:: div(f, dx=None, dy=None, dz=None, x=None, y=None, coordinate_system='cartesian', grid=None) div(f, dx=None, dy=None, dz=None, x=None, y=None, coordinate_system="cartesian", grid=None) Take divergence of pencil code vector array f in various coordinate systems. :param f: Pencil code vector array f. :type f: ndarray :param grid: Pencil grid object. See pc.read.grid(). :type grid: pencil.read.grids.Grid :param coordinate_system: Coordinate system under which to take the divergence. Takes 'cartesian', 'cylindrical' and 'spherical'. :type coordinate_system: string :param Deprecated parameters (only for backwards compatibility): :param --------------------------------------------------------: :param dx: Grid spacing in the three dimensions. These will not have any effect if grid!=None :type dx: floats :param dy: Grid spacing in the three dimensions. These will not have any effect if grid!=None :type dy: floats :param dz: Grid spacing in the three dimensions. These will not have any effect if grid!=None :type dz: floats :param x: Radial (x) and polar (y) coordinates, 1d arrays. These will not have any effect if grid!=None :type x: ndarrays :param y: Radial (x) and polar (y) coordinates, 1d arrays. These will not have any effect if grid!=None :type y: ndarrays .. py:function:: curl(f, dx=None, dy=None, dz=None, x=None, y=None, run2D=False, coordinate_system='cartesian', grid=None) curl(f, dx=None, dy=None, dz=None, x=None, y=None, run2D=False, coordinate_system="cartesian", grid=None) Take the curl of a pencil code vector array f in various coordinate systems. :param f: Pencil code scalar array f. :type f: ndarray :param grid: Pencil grid object. See pc.read.grid(). :type grid: pencil.read.grids.Grid :param run2D: Deals with pure 2-D snapshots. !Only for Cartesian grids at the moment! Requires grid!=None. :type run2D: bool :param coordinate_system: Coordinate system under which to take the divergence. Takes 'cartesian', 'cylindrical' and 'spherical'. !Does not work for 2d runs yet! :type coordinate_system: string :param Deprecated parameters (only for backwards compatibility): :param --------------------------------------------------------: :param dx: Grid spacing in the three dimensions. These will not have any effect if grid!=None :type dx: floats :param dy: Grid spacing in the three dimensions. These will not have any effect if grid!=None :type dy: floats :param dz: Grid spacing in the three dimensions. These will not have any effect if grid!=None :type dz: floats :param x: Radial (x) and polar (y) coordinates, 1d arrays. These will not have any effect if grid!=None :type x: ndarrays :param y: Radial (x) and polar (y) coordinates, 1d arrays. These will not have any effect if grid!=None :type y: ndarrays .. py:function:: grad(f, dx=None, dy=None, dz=None, x=None, y=None, coordinate_system='cartesian', grid=None) grad(f, dx=None, dy=None, dz=None, x=None, y=None, coordinate_system="cartesian", grid=None) Take the gradient of a pencil code scalar array f in various coordinate systems. :param f: Pencil code scalar array f. :type f: ndarray :param grid: Pencil grid object. See pc.read.grid(). :type grid: pencil.read.grids.Grid :param coordinate_system: Coordinate system under which to take the divergence. Takes 'cartesian', 'cylindrical' and 'spherical'. :type coordinate_system: string :param Deprecated parameters (only for backwards compatibility): :param --------------------------------------------------------: :param dx: Grid spacing in the three dimensions. These will not have any effect if grid!=None :type dx: floats :param dy: Grid spacing in the three dimensions. These will not have any effect if grid!=None :type dy: floats :param dz: Grid spacing in the three dimensions. These will not have any effect if grid!=None :type dz: floats :param x: Radial (x) and polar (y) coordinates, 1d arrays. These will not have any effect if grid!=None :type x: ndarrays :param y: Radial (x) and polar (y) coordinates, 1d arrays. These will not have any effect if grid!=None :type y: ndarrays .. py:function:: curl2(f, dx=None, dy=None, dz=None, x=None, y=None, coordinate_system='cartesian', grid=None) curl2(f, dx=None, dy=None, dz=None, x=None, y=None, coordinate_system="cartesian", grid=None) Take the double curl of a pencil code vector array f. :param f: Pencil code vector array f. :type f: ndarray :param grid: Pencil grid object. See pc.read.grid(). :type grid: pencil.read.grids.Grid :param coordinate_system: Coordinate system under which to take the divergence. Takes 'cartesian', 'cylindrical' and 'spherical'. :type coordinate_system: string :param Deprecated parameters (only for backwards compatibility): :param --------------------------------------------------------: :param dx: Grid spacing in the three dimensions. These will not have any effect if grid!=None :type dx: floats :param dy: Grid spacing in the three dimensions. These will not have any effect if grid!=None :type dy: floats :param dz: Grid spacing in the three dimensions. These will not have any effect if grid!=None :type dz: floats :param x: Radial (x) and polar (y) coordinates, 1d arrays. These will not have any effect if grid!=None :type x: ndarrays :param y: Radial (x) and polar (y) coordinates, 1d arrays. These will not have any effect if grid!=None :type y: ndarrays .. py:function:: del2(f, dx=None, dy=None, dz=None, x=None, y=None, coordinate_system='cartesian', grid=None) del2(f, dx=None, dy=None, dz=None, x=None, y=None, coordinate_system="cartesian", grid=None) Calculate del2, the Laplacian of a scalar field f. :param f: Pencil code vector array f. :type f: ndarray :param grid: Pencil grid object. See pc.read.grid(). :type grid: pencil.read.grids.Grid :param coordinate_system: Coordinate system under which to take the divergence. Takes 'cartesian', 'cylindrical' and 'spherical'. :type coordinate_system: string :param Deprecated parameters (only for backwards compatibility): :param --------------------------------------------------------: :param dx: Grid spacing in the three dimensions. These will not have any effect if grid!=None :type dx: floats :param dy: Grid spacing in the three dimensions. These will not have any effect if grid!=None :type dy: floats :param dz: Grid spacing in the three dimensions. These will not have any effect if grid!=None :type dz: floats :param x: Radial (x) and polar (y) coordinates, 1d arrays. These will not have any effect if grid!=None :type x: ndarrays :param y: Radial (x) and polar (y) coordinates, 1d arrays. These will not have any effect if grid!=None :type y: ndarrays .. py:function:: curl3(f, dx, dy, dz, x=None, y=None, coordinate_system='cartesian') curl3(f, dx, dy, dz, x=None, y=None, coordinate_system="cartesian") Take the triple curl of a pencil code vector array f. Supports only equidistant grids. :param f: Pencil code vector array f. :type f: ndarray :param dx: Grid spacing in the three dimensions. :type dx: floats :param dy: Grid spacing in the three dimensions. :type dy: floats :param dz: Grid spacing in the three dimensions. :type dz: floats :param x: Radial (x) and polar (y) coordinates, 1d arrays. :type x: ndarrays :param y: Radial (x) and polar (y) coordinates, 1d arrays. :type y: ndarrays :param coordinate_system: Coordinate system under which to take the divergence. Takes 'cartesian' and 'cylindrical'. :type coordinate_system: string .. py:function:: del6(f, dx=None, dy=None, dz=None, grid=None) del6(f, dx=None, dy=None, dz=None, grid=None) Calculate del6 (defined here as d^6/dx^6 + d^6/dy^6 + d^6/dz^6, rather than del2^3) of a scalar f for hyperdiffusion. :param f: Pencil code scalar array f. :type f: ndarray :param grid: Pencil grid object. See pc.read.grid(). :type grid: pencil.read.grids.Grid :param Deprecated parameters (only for backwards compatibility): :param --------------------------------------------------------: :param dx: Grid spacing in the three dimensions. These will not have any effect if grid!=None :type dx: floats :param dy: Grid spacing in the three dimensions. These will not have any effect if grid!=None :type dy: floats :param dz: Grid spacing in the three dimensions. These will not have any effect if grid!=None :type dz: floats .. py:function:: gij(f, dx, dy, dz, nder=6) Calculate del6 (defined here as d^6/dx^6 + d^6/dy^6 + d^6/dz^6, rather than del2^3) of a scalar f for hyperdiffusion. .. py:function:: traceless_strain(f, dx, dy, dz, x=None, y=None, z=None, coordinate_system='cartesian') .. py:function:: simple_centered(x, y) Calculate dy by center differencing using array slices