# discretize.DiffOperators.DiffOperators¶

class discretize.DiffOperators.DiffOperators[source]

Bases: object

Class creates the differential operators that you need!

Attributes
aveCC2F

Construct the averaging operator on cell centers to faces.

aveCCV2F

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

aveE2CC

Construct the averaging operator on cell edges to cell centers.

aveE2CCV

Construct the averaging operator on cell edges to cell centers.

aveEx2CC

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

aveEy2CC

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

aveEz2CC

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

aveF2CC

Construct the averaging operator on cell faces to cell centers.

aveF2CCV

Construct the averaging operator on cell faces to cell centers.

aveFx2CC

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

aveFy2CC

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

aveFz2CC

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

aveN2CC

Construct the averaging operator on cell nodes to cell centers.

aveN2E

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

aveN2F

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

cellGrad

The cell centered Gradient, takes you to cell faces.

cellGradBC

The cell centered Gradient boundary condition matrix

cellGradx

Cell centered Gradient in the x dimension.

cellGradz

Cell centered Gradient in the x dimension.

edgeCurl

Construct the 3D curl operator.

faceDiv

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

faceDivx

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

faceDivy
faceDivz

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

nodalGrad

Construct gradient operator (nodes to edges).

nodalLaplacian

Construct laplacian operator (nodes to edges).

Methods

 getBCProjWF(BC[, discretization]) The weak form boundary condition projection matrices. getBCProjWF_simple([discretization]) The weak form boundary condition projection matrices when mixed boundary condition is used Function that sets the boundary conditions for cell-centred derivative operators.

## Attributes¶

DiffOperators.aveCC2F

Construct the averaging operator on cell centers to faces.

DiffOperators.aveCCV2F

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

DiffOperators.aveE2CC

Construct the averaging operator on cell edges to cell centers.

DiffOperators.aveE2CCV

Construct the averaging operator on cell edges to cell centers.

DiffOperators.aveEx2CC

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

DiffOperators.aveEy2CC

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

DiffOperators.aveEz2CC

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

DiffOperators.aveF2CC

Construct the averaging operator on cell faces to cell centers.

DiffOperators.aveF2CCV

Construct the averaging operator on cell faces to cell centers.

DiffOperators.aveFx2CC

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

DiffOperators.aveFy2CC

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

DiffOperators.aveFz2CC

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

DiffOperators.aveN2CC

Construct the averaging operator on cell nodes to cell centers.

DiffOperators.aveN2E

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

DiffOperators.aveN2F

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

DiffOperators.cellGrad

The cell centered Gradient, takes you to cell faces.

DiffOperators.cellGradBC

The cell centered Gradient boundary condition matrix

DiffOperators.cellGradx

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

DiffOperators.cellGrady
DiffOperators.cellGradz

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

DiffOperators.edgeCurl

Construct the 3D curl operator.

DiffOperators.faceDiv

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

DiffOperators.faceDivx

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

DiffOperators.faceDivy
DiffOperators.faceDivz

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

DiffOperators.nodalGrad

Construct gradient operator (nodes to edges).

DiffOperators.nodalLaplacian

Construct laplacian operator (nodes to edges).

## Methods¶

DiffOperators.getBCProjWF(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.getBCProjWF_simple(discretization='CC')[source]

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

DiffOperators.setCellGradBC(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’]