mymesh.primitives.Grid#
- mymesh.primitives.Grid(bounds, h, exact_h=False, ElemType='hex')[source]#
Generate a 3D rectangular grid mesh.
- Parameters:
bounds (list) – Six element list, of bounds [xmin,xmax,ymin,ymax,zmin,zmax].
h (float, tuple) – Element size. If provided as a three element tuple, indicates anisotropic element sizes in each direction.
exact_h (bool, optional) – If true, will make a mesh where the element size is exactly equal to what is specified, but the upper bounds may vary slightly. Otherwise, the bounds will be strictly enforced, but element size may deviate from the specified h. This may result in non-cubic elements. By default False.
ElemType (str, optional) – Specify the element type of the grid mesh. This can either be ‘hex’ for a hexahedral mesh or ‘tet’ for a tetrahedral mesh, by default ‘hex’.
- Returns:
Grid – Mesh object containing the grid mesh.
- Return type:
Note
Due to the ability to unpack the mesh object to NodeCoords and NodeConn, the NodeCoords and NodeConn array can be returned directly (instead of the mesh object) by running:
NodeCoords, NodeConn = primitives.Grid(...)
box = primitives.Grid([0,1,0,1,0,1], 0.05) box.plot(bgcolor='w', show_edges=True)