zoomy_core.mesh.lsq_reconstruction module

zoomy_core.mesh.lsq_reconstruction module#

Least-squares polynomial reconstruction for FVM derivative estimation.

Pure-numpy utilities: monomial construction, Vandermonde matrices, weighted least-squares stencils, and cell-wise derivative computation.

zoomy_core.mesh.lsq_reconstruction.build_monomial_indices(degree, dim)#

Build monomial multi-indices up to total degree (excluding constant).

Parameters:
  • degree (int) –

  • dim (int) –

zoomy_core.mesh.lsq_reconstruction.scale_lsq_derivative(mon_indices)#

Factorial scaling so LSQ coefficients equal derivatives.

zoomy_core.mesh.lsq_reconstruction.find_derivative_indices(full_monomials_arr, requested_derivs_arr)#

Map requested derivative multi-indices to positions in monomial list.

Returns shape (M,) array; -1 where a requested derivative is not found.

zoomy_core.mesh.lsq_reconstruction.get_polynomial_degree(mon_indices)#
zoomy_core.mesh.lsq_reconstruction.get_required_monomials_count(degree, dim)#
zoomy_core.mesh.lsq_reconstruction.build_vandermonde(cell_diffs, mon_indices)#
zoomy_core.mesh.lsq_reconstruction.expand_neighbors(neighbors_list, initial_neighbors, n_valid=None)#

Expand neighbor set by one ring. Skips sentinel/invalid indices.

zoomy_core.mesh.lsq_reconstruction.compute_gaussian_weights(dX, sigma=1.0)#
zoomy_core.mesh.lsq_reconstruction.least_squares_reconstruction_local(n_cells, dim, neighbors_list, cell_centers, lsq_degree, n_inner_cells=None)#

Build per-cell LSQ gradient operators.

Only interior cells (index < n_inner_cells) are used as neighbors. Boundary cells grow their stencil inward automatically.

Returns:

  • A_glob ((n_cells, max_neighbors, n_monomials))

  • neighbors_array ((n_cells, max_neighbors) int)

  • mon_indices (list of tuples)

zoomy_core.mesh.lsq_reconstruction.compute_derivatives(u, mesh, derivatives_multi_index=None)#

Cell-wise derivative estimates using the mesh LSQ stencil.

zoomy_core.mesh.lsq_reconstruction.get_physical_boundary_labels(filepath)#

Extract physical boundary labels from a .msh file via meshio.

zoomy_core.mesh.lsq_reconstruction.compute_inradius_generic(cell_center, face_centers, face_normals)#

Inradius of a cell: shortest normal distance from center to any face.