Repository navigation
Conversation
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Nov 1, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
pytta.mesh, meshes forpytta.fem(#122) andpytta.bem(#123) in three ways, with the boundary extraction that connects the two solvers:delaunay_mesh(points, fd=None, tol=0): tetrahedra (triangles in 2D) of the Delaunay triangulation of a point cloud withscipy.spatial.Delaunay, optionally cut to a non-convex domain by its signed distance function (simplices whose centroid lies outside are dropped). Points in degenerate position, four or more on a sphere as on a regular grid, make Qhull return simplices of zero volume. Those on the convex hull are dropped, which leaves a valid mesh. One inside the mesh would leave two faces that do not match, so a warning asks to perturb the points or to use a structured mesh (pytta.fem.box_mesh).distmesh(fd, h0, bbox, fixed=None, fh=None, maxiter=500): the mesh generator of Persson and Strang, "A simple mesh generator in MATLAB", SIAM Review 46(2), 2004, written from the paper in 2D and 3D. A truss on a regular grid relaxes toward bars of the target length, the Delaunay triangulation is redone after large moves, and points outside are projected back onto the boundary. Signed distance functionssphere,box,union,intersectionanddifferencedescribe the geometry. The MATLAB code that comes with the paper was not used.read_mesh(filename, cell='tetra'): nodes and cells from the files of Gmsh, COMSOL, Abaqus, VTK and the other formats of meshio, an optional dependency imported on call, for meshes made with dedicated generators.boundary(nodes, simplices): the faces that belong to one simplex only, with their normals pointing out, which are the trianglespytta.bemtakes.quality(nodes, simplices): the radius ratio, dim r_in / r_out, which is eq. 7.1 of the paper in 2D.Choices and limits, stated in the docstrings:
quality()finds them, and a dedicated generator can be read withread_meshwhen they matter.The tests in
tests/test_mesh.pyprint the measured values:pytta.fem([FEATURE] add pytta.fem, finite elements for the Helmholtz equation #122), the rigid unit ball meshed with h0 = 0.25 and 0.125 gives the eigenvalues ka = 2.0816 (three modes), 3.3421 (five) and 4.4934 (one) with the right multiplicities. The errors fall from 2.14, 3.90 and 6.87 % to 0.45, 0.85 and 1.63 %, as h0², with the slivers of the finer mesh left in.pytta.bem([FEATURE] add pytta.bem, boundary elements for radiation into free field #123), the pulsating sphere at ka = 1 on the boundary of the finer ball gives the analytic field within 4.0e-3.Tests 6 and 7 are skipped until #122 and #123 are merged. On a branch that holds them, all eight pass. Checked with Python 3.12, numpy 1.26, scipy 1.17 and meshio 5.3.5. The 7 failures of
development(3 intest_h5io.py, 4 intest_pyttasave.py) are the same with and without this change.Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com