Curvilinear Mesh

class discretize.CurvilinearMesh(nodes=None, **kwargs)[source]

Bases: discretize.BaseMesh.BaseRectangularMesh, discretize.DiffOperators.DiffOperators, discretize.InnerProducts.InnerProducts, discretize.View.CurviView

CurvilinearMesh is a mesh class that deals with curvilinear meshes.

Example of a curvilinear mesh:

import discretize
X, Y = discretize.utils.exampleLrmGrid([3,3],'rotate')
M = discretize.CurvilinearMesh([X, Y])
M.plotGrid(showIt=True)

(Source code, png, hires.png, pdf)

../_images/mesh_curvilinear-1.png

Required Properties:

  • nodes (a list of Array): List of arrays describing the node locations, a list (each item is a list or numpy array of <class ‘float’>, <class ‘int’> with shape (*, *, *) or (*, *)) with length between 2 and 3
  • x0 (Array): origin of the mesh (dim, ), a list or numpy array of <class ‘float’> with shape (*)
nodes

nodes (a list of Array): List of arrays describing the node locations, a list (each item is a list or numpy array of <class ‘float’>, <class ‘int’> with shape (*, *, *) or (*, *)) with length between 2 and 3

check_nodes(change)[source]
gridCC

Cell-centered grid

gridN

Nodal grid.

gridFx

Face staggered grid in the x direction.

gridFy

Face staggered grid in the y direction.

gridFz

Face staggered grid in the y direction.

gridEx

Edge staggered grid in the x direction.

gridEy

Edge staggered grid in the y direction.

gridEz

Edge staggered grid in the z direction.

vol

Construct cell volumes of the 3D model as 1d array

area
normals

Face normals: calling this will average the computed normals so that there is one per face. This is especially relevant in 3D, as there are up to 4 different normals for each face that will be different.

To reshape the normals into a matrix and get the y component:

NyX, NyY, NyZ = M.r(M.normals, 'F', 'Fy', 'M')
edge

Edge lengths

tangents

Edge tangents

Mesh Viewing

class discretize.View.CurviView[source]

Bases: object

Provides viewing functions for CurvilinearMesh

This class is inherited by CurvilinearMesh

plotGrid(ax=None, nodes=False, faces=False, centers=False, edges=False, lines=True, showIt=False)[source]

Plot the nodal, cell-centered and staggered grids for 1, 2 and 3 dimensions.

import discretize
X, Y = discretize.utils.exampleLrmGrid([3, 3], 'rotate')
M = discretize.CurvilinearMesh([X, Y])
M.plotGrid(showIt=True)

(Source code, png, hires.png, pdf)

../_images/mesh_curvilinear-2.png
plotImage(I, ax=None, showIt=False, grid=False, clim=None)[source]