discretize.CurvilinearMesh.faces_y

property CurvilinearMesh.faces_y

Gridded y-face locations (staggered grid)

This property returns a numpy array of shape (n_faces_y, dim) containing gridded locations for all y-faces in the mesh (staggered grid). For curvilinear meshes whose structure is minimally staggered, the y-faces are faces whose normal vectors are primarily along the y-direction. For highly irregular meshes however, this is not the case; see the examples below.

Returns
(n_faces_y, dim) numpy.ndarray of float

Gridded y-face locations (staggered grid)

Examples

Here, we provide an example of a minimally staggered curvilinear mesh. In this case, the y-faces have normal vectors that are primarily along the x-direction.

>>> from discretize import CurvilinearMesh
>>> from discretize.utils import example_curvilinear_grid, mkvc
>>> from matplotlib import pyplot as plt
>>> x, y = example_curvilinear_grid([10, 10], "rotate")
>>> mesh1 = CurvilinearMesh([x, y])
>>> y_faces = mesh1.faces_y
>>> fig1 = plt.figure(figsize=(5, 5))
>>> ax1 = fig1.add_subplot(111)
>>> mesh1.plot_grid(ax=ax1)
>>> ax1.scatter(y_faces[:, 0], y_faces[:, 1], 30, 'r')
>>> ax1.legend(['Mesh', 'Y-faces'], fontsize=16)
>>> plt.plot()

Here, we provide an example of a highly irregular curvilinear mesh. In this case, the y-faces are not defined by normal vectors along a particular direction.

>>> x, y = example_curvilinear_grid([10, 10], "sphere")
>>> mesh2 = CurvilinearMesh([x, y])
>>> y_faces = mesh2.faces_y
>>> fig2 = plt.figure(figsize=(5, 5))
>>> ax2 = fig2.add_subplot(111)
>>> mesh2.plot_grid(ax=ax2)
>>> ax2.scatter(y_faces[:, 0], y_faces[:, 1], 30, 'r')
>>> ax2.legend(['Mesh', 'Y-faces'], fontsize=16)
>>> plt.plot()

(Source code)

../../_images/discretize-CurvilinearMesh-faces_y-1_00.png

(png, pdf)

../../_images/discretize-CurvilinearMesh-faces_y-1_01.png

(png, pdf)