pencil.math.derivatives
This is a wrapper for the actual derivatives, currently 6th order with ghost zones included (pencil-code style).
4th Order derivatives. Currently only equidistant grids are supported.
Compute the 3rd order derivative in x.
call signature:
xder3_4th(f, dx)
Compute the 3rd order derivative in y.
call signature:
yder3_4th(f, dy)
Compute the 3rd order derivative in z.
call signature:
zder3_4th(f, dz)
6th Order derivatives. Currently only equidistant grids are supported.
FAG: added 5th derivative and filled derivative ghosts (except corners)
with periodic boundary values. TODO: include proper boundary conditions
for non-internal ghosts. Add separate get_ghosts routine to handle this.
Compute the 2nd order derivative in x.
call signature:
xder2_6th(f, dx)
Compute the 5th order derivative in x.
call signature:
xder5_6th(f, dx)
Compute the 6th order derivative in x.
call signature:
xder6_6th(f, dx)
Compute the 1st order derivative in x.
call signature:
xder_6th(f, dx)
Compute the 2nd order derivative in y.
call signature:
yder2_6th(f, dy)
Compute the 5th order derivative in y.
call signature:
yder5_5th(f, dy)
Compute the 6th order derivative in y.
call signature:
yder6_6th(f, dy)
Compute the 1st order derivative in y.
call signature:
yder_6th(f, dy)
Compute the 2nd order derivative in z.
call signature:
zder2_6th(f, dz)
Compute the 5th order derivative in z.
call signature:
zder5_6th(f, dz)
Compute the 6th order derivative in z.
call signature:
zder6_6th(f, dz)
Compute the 1st order derivative in z.
call signature:
zder_6th(f, dz, run2D=False)
Compute the divergence, gradient and curl.
pencil.math.derivatives.div_grad_curl.curl(f, dx, dy, dz, x=None, y=None, run2D=False, coordinate_system='cartesian')
Take the curl of a pencil code vector array f in various coordinate systems.
Keyword arguments:
f:
Pencil code scalar array f.
dx, dy, dz:
Grid spacing in the three dimensions.
x, y:
Radial (x) and polar (y) coordinates, 1d arrays.
run2D:
Deals with pure 2-D snapshots (solved the (x,z)-plane pb).
!Only for Cartesian grids at the moment!
coordinate_system:
Coordinate system under which to take the divergence.
Takes ‘cartesian’, ‘cylindrical’ and ‘spherical’.
!Does not work for 2d runs yet!
pencil.math.derivatives.div_grad_curl.curl2(f, dx, dy, dz, x=None, y=None, coordinate_system='cartesian')
Take the double curl of a pencil code vector array f.
x, y:
Radial (x) and polar (y) coordinates, 1d arrays.
run2D:
Deals with pure 2-D snapshots (solved the (x,z)-plane pb).
!Only for Cartesian grids at the moment!
coordinate_system:
Coordinate system under which to take the divergence.
Takes ‘cartesian’, ‘cylindrical’ and ‘spherical’.
pencil.math.derivatives.div_grad_curl.curl3(f, dx, dy, dz, x=None, y=None, coordinate_system='cartesian')
Take the triple curl of a pencil code vector array f.
x, y:
Radial (x) and polar (y) coordinates, 1d arrays.
run2D:
Deals with pure 2-D snapshots (solved the (x,z)-plane pb).
!Only for Cartesian grids at the moment!
coordinate_system:
Coordinate system under which to take the divergence.
Takes ‘cartesian’ and ‘cylindrical’.
pencil.math.derivatives.div_grad_curl.del2(f, dx, dy, dz, x=None, y=None, coordinate_system='cartesian')
Calculate del2, the Laplacian of a scalar field f.
x, y:
Radial (x) and polar (y) coordinates, 1d arrays.
run2D:
Deals with pure 2-D snapshots (solved the (x,z)-plane pb).
!Only for Cartesian grids at the moment!
coordinate_system:
Coordinate system under which to take the divergence.
Takes ‘cartesian’, ‘cylindrical’ and ‘spherical’.
pencil.math.derivatives.div_grad_curl.del2v(f, dx, dy, dz, x=None, y=None, coordinate_system='cartesian')
Calculate del2, the Laplacian of a vector field f.
x, y:
Radial (x) and polar (y) coordinates, 1d arrays.
run2D:
Deals with pure 2-D snapshots (solved the (x,z)-plane pb).
!Only for Cartesian grids at the moment!
coordinate_system:
Coordinate system under which to take the divergence.
Takes ‘cartesian’, ‘cylindrical’ and ‘spherical’.
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.
pencil.math.derivatives.div_grad_curl.div(f, dx, dy, dz, x=None, y=None, coordinate_system='cartesian')
Take divervenge of pencil code vector array f in various coordinate systems.
Keyword arguments:
f:
Pencil code vector array f.
dx, dy, dz:
Grid spacing in the three dimensions.
x, y:
Radial (x) and polar (y) coordinates, 1d arrays.
coordinate_system:
Coordinate system under which to take the divergence.
Takes ‘cartesian’, ‘cylindrical’ and ‘spherical’.
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.
pencil.math.derivatives.div_grad_curl.grad(f, dx, dy, dz, x=None, y=None, coordinate_system='cartesian')
Take the gradient of a pencil code scalar array f in various coordinate systems.
Keyword arguments:
f:
Pencil code scalar array f.
dx, dy, dz:
Grid spacing in the three dimensions.
x, y:
Radial (x) and polar (y) coordinates, 1d arrays.
coordinate_system:
Coordinate system under which to take the divergence.
Takes ‘cartesian’, ‘cylindrical’ and ‘spherical’.
pencil.math.derivatives.div_grad_curl.traceless_strain(f, dx, dy, dz, x=None, y=None, z=None, coordinate_system='cartesian')
Contains simple centered differential operators.
Calculate dy by center differencing using array slices
Differential operators in different coordinate systems.