zoomy_core.mesh.fvm_mesh module

zoomy_core.mesh.fvm_mesh module#

FVMMesh — BaseMesh with precomputed geometry for FVM solvers.

Caches cell centers, volumes, inradii, face normals, face volumes, and face centers so they are not recomputed every access.

class zoomy_core.mesh.fvm_mesh.FVMMesh(*, _cell_centers, _cell_inradius, _cell_volumes, _face_centers, _face_normals, _face_volumes, boundary_conditions_sorted_names, boundary_conditions_sorted_physical_tags, boundary_face_cells, boundary_face_face_indices, boundary_face_function_numbers, boundary_face_ghosts, boundary_face_physical_tags, cell_faces, cell_neighbors, cell_vertices, dimension, face_cells, n_boundary_faces, n_cells, n_faces, n_faces_per_cell, n_inner_cells, n_vertices, type, vertex_coordinates, z_ordering, name)#

Bases: BaseMesh

BaseMesh + precomputed cell/face geometry.

cell_centers_computed()#

Compute cell centers from vertex coordinates. Shape (3, n_cells).

Return type:

ndarray

cell_volumes_computed()#

Compute cell volumes. Shape (n_cells,).

Return type:

ndarray

cell_inradius_computed()#

Compute cell inradius (min distance from center to face plane).

Uses the same projection-based approach as PETSc’s computeCellGeometryFVM for consistency.

Return type:

ndarray

face_normals_computed()#

Compute face normals. Shape (3, n_faces).

For 1D meshes all normals point in the +x direction (convention).

Return type:

ndarray

face_volumes_computed()#

Compute face areas/lengths. Shape (n_faces,).

For 1D meshes, face ‘volumes’ are 1.0 (point has no area).

Return type:

ndarray

face_centers_computed()#

Compute face centers. Shape (n_faces, 3).

Return type:

ndarray

property cell_centers#
property cell_volumes#
property cell_inradius#
property face_normals#
property face_volumes#
property face_centers#
classmethod from_base(base)#

Build an FVMMesh by computing geometry from a BaseMesh.

Parameters:

base (BaseMesh) –

Return type:

FVMMesh

classmethod from_msh(filepath)#

Load .msh and build FVMMesh with precomputed geometry.

Parameters:

filepath (str) –

Return type:

FVMMesh

classmethod from_hdf5(filepath)#

Load BaseMesh from H5 and compute geometry.

Parameters:

filepath (str) –

Return type:

FVMMesh

classmethod create_1d(domain, n_inner_cells)#

Build a uniform 1D interval mesh.

Parameters:
  • domain (tuple) –

  • n_inner_cells (int) –

Return type:

FVMMesh

classmethod create_2d(domain, nx, ny)#

Build a uniform 2D quad mesh.

Parameters:
  • domain ((x_min, x_max, y_min, y_max)) –

  • nx (number of inner cells in x and y directions) –

  • ny (number of inner cells in x and y directions) –

Return type:

FVMMesh

classmethod create_3d(domain, nx, ny, nz)#

Build a uniform 3D hexahedral mesh.

Parameters:
  • domain ((x_min, x_max, y_min, y_max, z_min, z_max)) –

  • nx (number of inner cells in each direction) –

  • ny (number of inner cells in each direction) –

  • nz (number of inner cells in each direction) –

Return type:

FVMMesh

name = 'FVMMesh'#