# discretize.operators.DiffOperators¶

class discretize.operators.DiffOperators[source]

Bases: object

Class creates the differential operators that you need!

Attributes
average_cell_to_face

Construct the averaging operator on cell centers to faces.

average_cell_vector_to_face

Construct the averaging operator on cell centers to faces as a vector.

average_edge_to_cell

Construct the averaging operator on cell edges to cell centers.

average_edge_to_cell_vector

Construct the averaging operator on cell edges to cell centers.

average_edge_x_to_cell

Construct the averaging operator on cell edges in the x direction to cell centers.

average_edge_y_to_cell

Construct the averaging operator on cell edges in the y direction to cell centers.

average_edge_z_to_cell

Construct the averaging operator on cell edges in the z direction to cell centers.

average_face_to_cell

Construct the averaging operator on cell faces to cell centers.

average_face_to_cell_vector

Construct the averaging operator on cell faces to cell centers.

average_face_x_to_cell

Construct the averaging operator on cell faces in the x direction to cell centers.

average_face_y_to_cell

Construct the averaging operator on cell faces in the y direction to cell centers.

average_face_z_to_cell

Construct the averaging operator on cell faces in the z direction to cell centers.

average_node_to_cell

Construct the averaging operator on cell nodes to cell centers.

average_node_to_edge

Construct the averaging operator on cell nodes to cell edges, keeping each dimension separate.

average_node_to_face

Construct the averaging operator on cell nodes to cell faces, keeping each dimension separate.

cellGrad

cellGradBC

cellGradx

cellGrady

cellGradz

cell_gradient

The cell centered Gradient, takes you to cell faces.

cell_gradient_BC

The cell centered Gradient boundary condition matrix

cell_gradient_x

Cell centered Gradient in the x dimension.

cell_gradient_z

Cell centered Gradient in the x dimension.

edgeCurl

edgeCurl has been deprecated. See edge_curl for documentation

edge_curl

Construct the 3D curl operator.

faceDiv

faceDiv has been deprecated. See face_divergence for documentation

faceDivx

faceDivx has been deprecated. See face_x_divergence for documentation

faceDivy

faceDivy has been deprecated. See face_y_divergence for documentation

faceDivz

faceDivz has been deprecated. See face_z_divergence for documentation

face_divergence

Construct divergence operator (face-stg to cell-centres).

face_x_divergence

Construct divergence operator in the x component (face-stg to cell-centres).

face_y_divergence
face_z_divergence

Construct divergence operator in the z component (face-stg to cell-centers).

nodalGrad

nodalLaplacian

nodalLaplacian has been deprecated. See nodal_laplacian for documentation

nodal_gradient

Construct gradient operator (nodes to edges).

nodal_laplacian

Construct laplacian operator (nodes to edges).

Methods

 getBCProjWF(*args, **kwargs) getBCProjWF has been deprecated. getBCProjWF_simple(*args, **kwargs) getBCProjWF_simple has been deprecated. get_BC_projections(BC[, discretization]) The weak form boundary condition projection matrices. get_BC_projections_simple([discretization]) The weak form boundary condition projection matrices when mixed boundary condition is used setCellGradBC(*args, **kwargs) setCellGradBC has been deprecated. Function that sets the boundary conditions for cell-centred derivative operators.

## Attributes¶

DiffOperators.average_cell_to_face

Construct the averaging operator on cell centers to faces.

DiffOperators.average_cell_vector_to_face

Construct the averaging operator on cell centers to faces as a vector.

DiffOperators.average_edge_to_cell

Construct the averaging operator on cell edges to cell centers.

DiffOperators.average_edge_to_cell_vector

Construct the averaging operator on cell edges to cell centers.

DiffOperators.average_edge_x_to_cell

Construct the averaging operator on cell edges in the x direction to cell centers.

DiffOperators.average_edge_y_to_cell

Construct the averaging operator on cell edges in the y direction to cell centers.

DiffOperators.average_edge_z_to_cell

Construct the averaging operator on cell edges in the z direction to cell centers.

DiffOperators.average_face_to_cell

Construct the averaging operator on cell faces to cell centers.

DiffOperators.average_face_to_cell_vector

Construct the averaging operator on cell faces to cell centers.

DiffOperators.average_face_x_to_cell

Construct the averaging operator on cell faces in the x direction to cell centers.

DiffOperators.average_face_y_to_cell

Construct the averaging operator on cell faces in the y direction to cell centers.

DiffOperators.average_face_z_to_cell

Construct the averaging operator on cell faces in the z direction to cell centers.

DiffOperators.average_node_to_cell

Construct the averaging operator on cell nodes to cell centers.

DiffOperators.average_node_to_edge

Construct the averaging operator on cell nodes to cell edges, keeping each dimension separate.

DiffOperators.average_node_to_face

Construct the averaging operator on cell nodes to cell faces, keeping each dimension separate.

DiffOperators.cellGrad

DiffOperators.cellGradBC

DiffOperators.cellGradx

DiffOperators.cellGrady

DiffOperators.cellGradz

DiffOperators.cell_gradient

The cell centered Gradient, takes you to cell faces.

DiffOperators.cell_gradient_BC

The cell centered Gradient boundary condition matrix

DiffOperators.cell_gradient_x

Cell centered Gradient in the x dimension. Has neumann boundary conditions.

DiffOperators.cell_gradient_y
DiffOperators.cell_gradient_z

Cell centered Gradient in the x dimension. Has neumann boundary conditions.

DiffOperators.edgeCurl

edgeCurl has been deprecated. See edge_curl for documentation

DiffOperators.edge_curl

Construct the 3D curl operator.

DiffOperators.faceDiv

faceDiv has been deprecated. See face_divergence for documentation

DiffOperators.faceDivx

faceDivx has been deprecated. See face_x_divergence for documentation

DiffOperators.faceDivy

faceDivy has been deprecated. See face_y_divergence for documentation

DiffOperators.faceDivz

faceDivz has been deprecated. See face_z_divergence for documentation

DiffOperators.face_divergence

Construct divergence operator (face-stg to cell-centres).

DiffOperators.face_x_divergence

Construct divergence operator in the x component (face-stg to cell-centres).

DiffOperators.face_y_divergence
DiffOperators.face_z_divergence

Construct divergence operator in the z component (face-stg to cell-centers).

DiffOperators.nodalGrad

DiffOperators.nodalLaplacian

nodalLaplacian has been deprecated. See nodal_laplacian for documentation

DiffOperators.nodal_gradient

Construct gradient operator (nodes to edges).

DiffOperators.nodal_laplacian

Construct laplacian operator (nodes to edges).

DiffOperators.stencil_cell_gradient
DiffOperators.stencil_cell_gradient_x
DiffOperators.stencil_cell_gradient_y
DiffOperators.stencil_cell_gradient_z

## Methods¶

DiffOperators.getBCProjWF(*args, **kwargs)

getBCProjWF has been deprecated. See get_BC_projections for documentation

DiffOperators.getBCProjWF_simple(*args, **kwargs)

getBCProjWF_simple has been deprecated. See get_BC_projections_simple for documentation

DiffOperators.get_BC_projections(BC, discretization='CC')[source]

The weak form boundary condition projection matrices.

Examples

# Neumann in all directions
BC = 'neumann'

# 3D, Dirichlet in y Neumann else
BC = ['neumann', 'dirichlet', 'neumann']

# 3D, Neumann in x on bottom of domain, Dirichlet else
BC = [['neumann', 'dirichlet'], 'dirichlet', 'dirichlet']

DiffOperators.get_BC_projections_simple(discretization='CC')[source]

The weak form boundary condition projection matrices when mixed boundary condition is used

DiffOperators.setCellGradBC(*args, **kwargs)

DiffOperators.set_cell_gradient_BC(BC)[source]

Function that sets the boundary conditions for cell-centred derivative operators.

Examples

..code:: python

# Neumann in all directions BC = ‘neumann’

# 3D, Dirichlet in y Neumann else BC = [‘neumann’, ‘dirichlet’, ‘neumann’]

# 3D, Neumann in x on bottom of domain, Dirichlet else BC = [[‘neumann’, ‘dirichlet’], ‘dirichlet’, ‘dirichlet’]