zoomy_core.mesh.base_mesh#
BaseMesh: topology-only mesh (cells, faces, one ghost cell per boundary face) read from .msh
via meshio or built from arrays, with geometry computed on the fly. The root of the BaseMesh ->
FVMMesh -> LSQMesh hierarchy that every backend shares.
Module Contents#
Classes#
Topology-only mesh with geometry computed on the fly. |
API#
- class zoomy_core.mesh.base_mesh.BaseMesh(**kwargs)#
Bases:
param.ParameterizedTopology-only mesh with geometry computed on the fly.
Initialization
Create the mesh from its topology arrays and normalise boundary faces so
face_cells[0]is the inner cell.- dimension#
‘Integer(…)’
- type#
‘String(…)’
- n_cells#
‘Integer(…)’
- n_inner_cells#
‘Integer(…)’
- n_faces#
‘Integer(…)’
- n_vertices#
‘Integer(…)’
- n_boundary_faces#
‘Integer(…)’
- n_faces_per_cell#
‘Integer(…)’
- vertex_coordinates#
‘Array(…)’
- cell_vertices#
‘Array(…)’
- cell_faces#
‘Array(…)’
- face_cells#
‘Array(…)’
- cell_neighbors#
‘Array(…)’
- boundary_face_cells#
‘Array(…)’
- boundary_face_ghosts#
‘Array(…)’
- boundary_face_function_numbers#
‘Array(…)’
- boundary_face_physical_tags#
‘Array(…)’
- boundary_face_face_indices#
‘Array(…)’
- boundary_conditions_sorted_physical_tags#
‘Array(…)’
- boundary_conditions_sorted_names#
‘List(…)’
- z_ordering#
‘Array(…)’
- node_data#
‘Dict(…)’
- cell_data#
‘Dict(…)’
- cell_centers_computed() numpy.ndarray#
Cell centres
(3, n_cells); ghost centres are the inner centres mirrored across the boundary face.
- cell_volumes_computed() numpy.ndarray#
Cell volumes
(n_cells,); a ghost takes its inner cell’s volume.
- cell_inradius_computed() numpy.ndarray#
Cell inradii
(n_cells,): the minimum distance from the centre to the face planes (half the length in 1D).
- face_normals_computed() numpy.ndarray#
Unit face normals
(3, n_faces)pointing fromface_cells[0]toface_cells[1](a sign in 1D).
- face_volumes_computed() numpy.ndarray#
Face areas (lengths in 2D)
(n_faces,); 1.0 in 1D.
- face_centers_computed() numpy.ndarray#
Face centres
(n_faces, 3).
- face_subvolumes_computed() numpy.ndarray#
Per face and side, the simplex (2D) or pyramid (3D) volume between the face and the cell centre,
(n_faces, 2); a boundary face carries its inner side twice.
- compute_derivatives(u: numpy.ndarray, degree: int = 1, derivatives_multi_index=None, *, u_boundary_face) numpy.ndarray#
Derivatives of
ufrom an LSQ stencil built on the fly (the cached variant lives onLSQMesh).Args
u_boundary_face:(n_boundary_faces,)face values, or'extrapolation'for Neumann-zero.
References
Mavriplis 2003, https://doi.org/10.2514/6.2003-3986
- classmethod from_msh(filepath: str) zoomy_core.mesh.base_mesh.BaseMesh#
Load a gmsh
.mshfile via meshio and build the topology, keeping node and cell data formesh_ic.
- classmethod from_arrays(vertex_coordinates, cell_vertices, mesh_type, *, face_tags=None, cell_face_tags=None, tag_names=None, default_tag=0, node_data=None, cell_data=None) zoomy_core.mesh.base_mesh.BaseMesh#
Build a mesh from raw arrays of one cell type.
Args
vertex_coordinates:(dim, n_vertices).cell_vertices:(verts_per_cell, n_cells).face_tags: maps a boundary face (sorted vertex tuple) to its physical tag.cell_face_tags:(faces_per_cell, n_cells)tag per local face (< 0: none), instead offace_tags.tag_names:{tag: name}, defaulttag_<t>.default_tag: tag of boundary faces without one.
- classmethod create_1d(domain: tuple, n_inner_cells: int) zoomy_core.mesh.base_mesh.BaseMesh#
Uniform 1D interval mesh on
domainwith two ghost cells; boundariesleftandright.
- classmethod create_2d(domain: tuple, nx: int, ny: int) zoomy_core.mesh.base_mesh.BaseMesh#
Uniform quad mesh with boundaries
left,right,bottom,top.Args
domain:(x_min, x_max, y_min, y_max).nx: inner cells in x;nyin y.
- classmethod create_3d(domain: tuple, nx: int, ny: int, nz: int) zoomy_core.mesh.base_mesh.BaseMesh#
Uniform hexahedral mesh with boundaries
left,right,front,back,bottom,top.Args
domain:(x_min, x_max, y_min, y_max, z_min, z_max).nx: inner cells in x;ny,nzlikewise.
- classmethod extrude_2d(mesh2d, n_layers: int, height: float = 1.0) zoomy_core.mesh.base_mesh.BaseMesh#
Extrude a 2D quad mesh into 3D hexahedra; shadowed by the later
extrude_2dof this class, which is the one called.
- write_to_hdf5(filepath: str)#
Write the topology fields to an HDF5 file (format version 2).
- classmethod from_hdf5(filepath: str) zoomy_core.mesh.base_mesh.BaseMesh#
Load a mesh written by
write_to_hdf5.
- resolve_periodic_bcs(bcs)#
Patch
boundary_face_cellssoPeriodicboundaries read their partner’s cells. Idempotent: the remap source isface_cells[0](never modified), not the possibly already patched array.