discretize.CurvilinearMesh#

- class discretize.CurvilinearMesh(node_list, **kwargs)[source]#
Curvilinear mesh class.
Curvilinear meshes are numerical grids whose cells are general quadrilaterals (2D) or cuboid (3D); unlike tensor meshes (see
TensorMesh
) whose cells are rectangles or rectangular prisms. That being said, the combinatorial structure (i.e. connectivity of mesh cells) of curvilinear meshes is the same as tensor meshes.- Parameters
- node_list
list
of
array_like List
array_like
containing the gridded x, y (and z) node locations.For a 2D curvilinear mesh, node_list = [X, Y] where X and Y have shape (
n_nodes_x
,n_nodes_y
)For a 3D curvilinear mesh, node_list = [X, Y, Z] where X, Y and Z have shape (
n_nodes_x
,n_nodes_y
,n_nodes_z
)
- node_list
Examples
Using the
example_curvilinear_grid()
utility, we provide an example of a curvilinear mesh.>>> from discretize import CurvilinearMesh >>> from discretize.utils import example_curvilinear_grid >>> import matplotlib.pyplot as plt
The example grid slightly rotates the nodes in the center of the mesh,
>>> x, y = example_curvilinear_grid([10, 10], "rotate") >>> x.shape (11, 11) >>> y.shape (11, 11) >>> curvilinear_mesh = CurvilinearMesh([x, y]) >>> curvilinear_mesh.shape_nodes (11, 11)
>>> fig = plt.figure(figsize=(5,5)) >>> ax = fig.add_subplot(111) >>> curvilinear_mesh.plot_grid(ax=ax) >>> plt.show()
(Source code, png, pdf)
Attributes
area has been deprecated.
Averaging operator from x-edges to cell centers (scalar quantities).
Averaging operator from y-edges to cell centers (scalar quantities).
Averaging operator from z-edges to cell centers (scalar quantities).
Averaging operator from x-faces to cell centers (scalar quantities).
Averaging operator from y-faces to cell centers (scalar quantities).
Averaging operator from z-faces to cell centers (scalar quantities).
Deprecated since version 0.7.0.
Deprecated since version 0.7.0.
Deprecated since version 0.7.0.
Represents the operation of integrating a vector function on the boundary
Boundary edge locations
Outward normal vectors of boundary faces
Boundary face locations
Represents the operation of integrating a vector function dotted with the boundary normal
Boundary node locations
cellGrad has been deprecated.
cellGradBC has been deprecated.
cellGradx has been deprecated.
cellGrady has been deprecated.
cellGradz has been deprecated.
Return gridded cell center locations
Cell gradient operator (cell centers to faces)
Boundary conditions matrix for the cell gradient operator (Deprecated)
X-derivative operator (cell centers to x-faces)
Y-derivative operator (cell centers to y-faces)
Z-derivative operator (cell centers to z-faces)
Return cell volumes
The dimension of the mesh (1, 2, or 3).
edge has been deprecated.
edgeCurl has been deprecated.
Returns the lengths of all edges in the mesh
Unit tangent vectors for all mesh edges
Gridded edge locations
Gridded x-edge locations (staggered grid)
Gridded y-edge locations (staggered grid)
Gridded z-edge locations (staggered grid)
faceDiv has been deprecated.
faceDivx has been deprecated.
faceDivy has been deprecated.
faceDivz has been deprecated.
Returns the areas of all faces in the mesh
Unit normal vectors for all mesh faces
X-derivative operator (x-faces to cell-centres)
Y-derivative operator (y-faces to cell-centres)
Z-derivative operator (z-faces to cell-centres)
Gridded face locations
Gridded x-face locations (staggered grid)
Gridded y-face locations (staggered grid)
Gridded z-face locations (staggered grid)
Number of cells in the x direction
Number of cells in the y direction
Number of cells in the z direction
Number of nodes in the x-direction
Number of nodes in the y-direction
Number of nodes in the z-direction
Total number of cells in the mesh.
Total number of edges in the mesh
The number of edges in each direction
Number of x-edges in the mesh
Number of y-edges in the mesh
Number of z-edges in the mesh
Total number of faces in the mesh
The number of faces in each axis direction
Number of x-faces in the mesh
Number of y-faces in the mesh
Number of z-faces in the mesh
Total number of nodes in the mesh
nodalGrad has been deprecated.
nodalLaplacian has been deprecated.
Returns the gridded x, y (and z) node locations used to create the mesh.
Return gridded node locations
normals has been deprecated.
Rotation matrix defining mesh axes relative to Cartesian
Origin or 'anchor point' of the mesh
Indicates whether mesh uses standard coordinate axes
Coordinate reference system
Alias for
orientation
The number of cells in each coordinate direction.
Number of x-edges along each axis direction
Number of y-edges along each axis direction
Number of z-edges along each axis direction
Number of x-faces along each axis direction
Number of y-faces along each axis direction
Number of z-faces along each axis direction
Returns the number of nodes along each axis direction
Differencing operator along x-direction (cell centers to x-faces)
Differencing operator along y-direction (cell centers to y-faces)
Differencing operator along z-direction (cell centers to z-faces)
tangents has been deprecated.
vol has been deprecated.
An alias for the
origin
average_cell_to_edge
average_cell_to_face
average_cell_vector_to_face
average_edge_to_cell
average_edge_to_cell_vector
average_edge_to_face_vector
average_face_to_cell
average_face_to_cell_vector
average_node_to_cell
average_node_to_edge
average_node_to_face
boundary_face_scalar_integral
edge_curl
face_divergence
nodal_gradient
nodal_laplacian
project_edge_to_boundary_edge
project_face_to_boundary_face
project_node_to_boundary_node
stencil_cell_gradient
Methods
cell_gradient_weak_form_robin
([alpha, beta, ...])Robin conditions for weak form of the cell gradient operator (cell centers to faces)
closest_points_index
(locations[, grid_loc, ...])Find the indicies for the nearest grid location for a set of points.
copy
()Make a copy of the current mesh
deserialize
(value, **kwargs)Create this mesh from a dictionary of attributes
edge_divergence_weak_form_robin
([alpha, ...])Robin conditions for weak form of the edge divergence operator (edges to nodes)
equals
(other_mesh)Compares current mesh with another mesh to determine if they are identical
from_omf
(element)Convert an OMF element to it's proper
discretize
type.getBCProjWF
(*args, **kwargs)getBCProjWF has been deprecated.
getBCProjWF_simple
(*args, **kwargs)getBCProjWF_simple has been deprecated.
getEdgeInnerProduct
(*args, **kwargs)getEdgeInnerProduct has been deprecated.
getEdgeInnerProductDeriv
(*args, **kwargs)getEdgeInnerProductDeriv has been deprecated.
getFaceInnerProduct
(*args, **kwargs)getFaceInnerProduct has been deprecated.
getFaceInnerProductDeriv
(*args, **kwargs)getFaceInnerProductDeriv has been deprecated.
getInterpolationMat
(*args, **kwargs)getInterpolationMat 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
get_interpolation_matrix
(loc[, ...])Construct linear interpolation matrix from mesh
plotGrid
(*args, **kwargs)plotGrid has been deprecated.
plotImage
(*args, **kwargs)plotImage has been deprecated.
plotSlice
(*args, **kwargs)plotSlice has been deprecated.
plot_3d_slicer
(v[, xslice, yslice, zslice, ...])Plot slices of a 3D volume, interactively (scroll wheel).
plot_grid
([ax, nodes, faces, centers, ...])Plot the grid for nodal, cell-centered and staggered grids.
plot_image
(v[, v_type, grid, view, ax, ...])Plots quantities defined on a given mesh.
plot_slice
(v[, v_type, normal, ind, ...])Plots slice of fields on the given 3D mesh.
point2index
(locs)Finds cells that contain the given points.
projectEdgeVector
(*args, **kwargs)projectEdgeVector has been deprecated.
projectFaceVector
(*args, **kwargs)projectFaceVector has been deprecated.
project_edge_vector
(edge_vectors)Project vectors to the edges of the mesh.
project_face_vector
(face_vectors)Project vectors onto the faces of the mesh.
r
(*args, **kwargs)r has been deprecated.
reshape
(x[, x_type, out_type, format])General reshape method for tensor quantities
save
([file_name, verbose])Save the mesh to json
An alias for
to_dict()
setCellGradBC
(*args, **kwargs)setCellGradBC has been deprecated.
Set zero Dirichlet/Neumann boundary conditions for derivative operators acting on cell-centered quantities.
toVTK
([models])toVTK has been deprecated and replaced by to_vtk
to_dict
()Representation of the mesh's attributes as a dictionary
to_omf
([models])Convert this mesh object to it's proper
omf
data object with the given model dictionary as the cell data of that dataset.to_vtk
([models])Convert mesh (and models) to corresponding VTK or PyVista data object
validate
()Return the validation state of the mesh
writeVTK
(file_name[, models, directory])writeVTK has been deprecated and replaced by write_vtk
write_vtk
(file_name[, models, directory])Convert mesh (and models) to corresponding VTK or PyVista data object then writes to file
get_edge_inner_product
get_edge_inner_product_deriv
get_face_inner_product
get_face_inner_product_deriv