Skip to content

pencil.math.derivatives

Illa edited this page Feb 24, 2021 · 1 revision

pencil.math.derivatives package

Submodules

pencil.math.derivatives.der module

This is a wrapper for the actual derivatives, currently 6th order with ghost zones included (pencil-code style).

pencil.math.derivatives.der_4th_order_w_ghosts module

4th Order derivatives. Currently only equidistant grids are supported.

pencil.math.derivatives.der_4th_order_w_ghosts.xder3_4th(f, dx)

Compute the 3rd order derivative in x.

call signature:

xder3_4th(f, dx)

pencil.math.derivatives.der_4th_order_w_ghosts.yder3_4th(f, dy)

Compute the 3rd order derivative in y.

call signature:

yder3_4th(f, dy)

pencil.math.derivatives.der_4th_order_w_ghosts.zder3_4th(f, dz)

Compute the 3rd order derivative in z.

call signature:

zder3_4th(f, dz)

pencil.math.derivatives.der_6th_order_w_ghosts module

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.

pencil.math.derivatives.der_6th_order_w_ghosts.xder2_6th(f, dx)

Compute the 2nd order derivative in x.

call signature:

xder2_6th(f, dx)

pencil.math.derivatives.der_6th_order_w_ghosts.xder5_6th(f, dx)

Compute the 5th order derivative in x.

call signature:

xder5_6th(f, dx)

pencil.math.derivatives.der_6th_order_w_ghosts.xder6_6th(f, dx)

Compute the 6th order derivative in x.

call signature:

xder6_6th(f, dx)

pencil.math.derivatives.der_6th_order_w_ghosts.xder_6th(f, dx)

Compute the 1st order derivative in x.

call signature:

xder_6th(f, dx)

pencil.math.derivatives.der_6th_order_w_ghosts.yder2_6th(f, dy)

Compute the 2nd order derivative in y.

call signature:

yder2_6th(f, dy)

pencil.math.derivatives.der_6th_order_w_ghosts.yder5_6th(f, dy)

Compute the 5th order derivative in y.

call signature:

yder5_5th(f, dy)

pencil.math.derivatives.der_6th_order_w_ghosts.yder6_6th(f, dy)

Compute the 6th order derivative in y.

call signature:

yder6_6th(f, dy)

pencil.math.derivatives.der_6th_order_w_ghosts.yder_6th(f, dy)

Compute the 1st order derivative in y.

call signature:

yder_6th(f, dy)

pencil.math.derivatives.der_6th_order_w_ghosts.zder2_6th(f, dz)

Compute the 2nd order derivative in z.

call signature:

zder2_6th(f, dz)

pencil.math.derivatives.der_6th_order_w_ghosts.zder5_6th(f, dz)

Compute the 5th order derivative in z.

call signature:

zder5_6th(f, dz)

pencil.math.derivatives.der_6th_order_w_ghosts.zder6_6th(f, dz)

Compute the 6th order derivative in z.

call signature:

zder6_6th(f, dz)

pencil.math.derivatives.der_6th_order_w_ghosts.zder_6th(f, dz, run2D=False)

Compute the 1st order derivative in z.

call signature:

zder_6th(f, dz, run2D=False)

pencil.math.derivatives.div_grad_curl module

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’.

pencil.math.derivatives.div_grad_curl.del6(f, dx, dy, dz)

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’.

pencil.math.derivatives.div_grad_curl.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.

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')

pencil.math.derivatives.simple_centered module

Contains simple centered differential operators.

pencil.math.derivatives.simple_centered.simple_centered(x, y)

Calculate dy by center differencing using array slices

Module contents

Differential operators in different coordinate systems.

Clone this wiki locally