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)
Required Properties:
- axis_u (
Vector3
): Vector orientation of u-direction. For more details see the docs for therotation_matrix
property., a 3D Vector of <class ‘float’> with shape (3), Default: X - axis_v (
Vector3
): Vector orientation of v-direction. For more details see the docs for therotation_matrix
property., a 3D Vector of <class ‘float’> with shape (3), Default: Y - axis_w (
Vector3
): Vector orientation of w-direction. For more details see the docs for therotation_matrix
property., a 3D Vector of <class ‘float’> with shape (3), Default: Z - 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 - reference_system (
String
): The type of coordinate reference frame. Can take on the values cartesian, cylindrical, or spherical. Abbreviations of these are allowed., a unicode string, Default: cartesian - 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
-
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
- axis_u (
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, **kwargs)[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)
-