Repository navigation
Test the ExodusII, CGNS and Triangle mesh readers, and load Triangle meshes without a facet file - #5751
Test the ExodusII, CGNS and Triangle mesh readers, and load Triangle meshes without a facet file#5751pbrubeck wants to merge 8 commits into
Conversation
connorjward
left a comment
There was a problem hiding this comment.
This should go in release
1fa82c0 to
acecfef
Compare
Done |
|
|
||
|
|
||
| @pytest.fixture | ||
| def triangle_mesh(triangle_mesh_files): |
There was a problem hiding this comment.
not a helpful fixture name
There was a problem hiding this comment.
Triangle is another mesh format. It's like saying exodus_mesh
There was a problem hiding this comment.
It is very confusing having triangle_mesh_files and triangle_mesh, where the latter also modifies the former.
| if [ ${{ inputs.os }} = 'linux' ]; then | ||
| NPROCS=8 | ||
| # Use Ubuntu's parallel HDF5 prefix and the NetCDF that PETSc builds. | ||
| hdf5_prefix="/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/hdf5/openmpi" |
There was a problem hiding this comment.
We know the OS. This doesn't have to be this confusing. Also we use the apt netcdf and pnetcdf. We should not be overwriting those here.
There was a problem hiding this comment.
The issue is that ExodusII needs netcdf (not pnetcdf) with parallel I/O, and the one from apt does not have parallel I/O.
| --with-make-np=$NPROCS \ | ||
| --download-slepc | ||
| --download-slepc \ | ||
| --download-exodusii \ |
There was a problem hiding this comment.
So this flag works on macOS just fine? Otherwise I don't know why it wouldn't be in EXTRA_CONFIGURE_OPTIONS
|
|
||
| tolerance = kwargs.get("tolerance", 0.5) | ||
| if coordinates is not None: | ||
| return make_mesh_from_coordinates(coordinates, name, tolerance=tolerance) |
There was a problem hiding this comment.
no idea why this change is in this PR
b59d7d2 to
15a5ca6
Compare
562e94a to
649bd7f
Compare
connorjward
left a comment
There was a problem hiding this comment.
I am not happy by the significant deviations this introduces between what users are getting with firedrake-configure, and what we are actually testing in CI.
|
|
||
| if [ ${{ inputs.os }} = 'linux' ]; then | ||
| NPROCS=8 | ||
| : # ExodusII needs a NetCDF with parallel I/O, and the NetCDF of apt has none. |
There was a problem hiding this comment.
I can see a libnetcdf-mpi apt package, why can't we use that?
There was a problem hiding this comment.
I found libnetcdf-pnetcdf-dev, which seems to include parallel I/O in netcdf
There was a problem hiding this comment.
I appended it to the system packages
| libdir=/usr/lib/x86_64-linux-gnu | ||
| EXTRA_CONFIGURE_OPTIONS+=( | ||
| --download-netcdf | ||
| --with-pnetcdf-dir=/usr |
There was a problem hiding this comment.
why do we suddenly need to pass this?
There was a problem hiding this comment.
| --download-netcdf | ||
| --with-pnetcdf-dir=/usr | ||
| "--download-cgns-cmake-arguments=-DHDF5_ROOT:PATH=$libdir/hdf5/openmpi" | ||
| "--download-exodusii-cmake-arguments=-DHDF5_ROOT:PATH=$libdir/hdf5/openmpi -DPnetcdf_LIBRARY_DIRS:PATH=$libdir" |
There was a problem hiding this comment.
I would have expected these to work without since we are telling PETSc which HDF5 we are using. I can imagine that that wouldn't be the case though.
Do you want |
Unsure. Do they take a long time to build? And what about macOS/complex? |
The message of the ValueError was not an f-string, so it printed
'{dependency = }' instead of the name of the dependency.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
86efe0d to
dbf80c3
Compare
CI built PETSc without ExodusII, so the fixture in test_exodus_mesh.py skipped every ExodusII test. Add --download-exodusii and --download-cgns to the official configurations of firedrake-configure, which CI uses, and mark the tests with skipexodusii, which never skips on CI. On Ubuntu, ExodusII needs a NetCDF with parallel I/O, so install the PnetCDF build of NetCDF from apt (libnetcdf-pnetcdf-dev). PETSc v3.26.0 needs the PnetCDF directory to configure ExodusII (https://gitlab.com/petsc/petsc/-/work_items/2019), and the CMake builds of CGNS and ExodusII need the paths to the HDF5 and NetCDF libraries from apt, because CMake does not search them. Co-authored-by: Codex <codex@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
np.loadtxt returns a one-dimensional array for a file with one row, so the reader took the number of vertices of the only cell for the number of cells, and failed its check of the cell count. Read the cells and the facets as two-dimensional arrays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reader found each boundary facet as the join of its vertices with DMPlex.getJoin, which only looks one level up, at the edges. The three vertices of a face of a tetrahedron share no edge, so the join was empty and the reader failed. Use DMPlex.getFullJoin, which finds the face. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No test read a Triangle, a TetGen or a CGNS mesh file. Check the volume and the boundary ids of a Triangle mesh of the unit square and of a TetGen mesh of one tetrahedron, and the volume of a unit square that PETSc writes to a CGNS file. Co-authored-by: Codex <codex@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Triangle reader took the topological dimension from the facet file that it found. Without a .edge or .face file it assumed an interval mesh, so a triangle mesh failed to load. Take the topological dimension from the number of vertices of each cell in the .ele file, and read boundary ids only if the facet file exists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Apply https://gitlab.com/petsc/petsc/-/merge_requests/9901 to the PETSc that CI builds, and remove --with-pnetcdf-dir=/usr, to check that ExodusII configures with the PnetCDF that PETSc finds on its own. Drop this commit before merge. The PETSc v3.26.0 that release builds does not have the fix, so firedrake-configure on release needs --with-pnetcdf-dir=/usr. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dbf80c3 to
cdaa721
Compare
They don't take long.
|
| "-DHDF5_ROOT:PATH=/usr/lib/x86_64-linux-gnu/hdf5/openmpi " | ||
| "-DPnetcdf_LIBRARY_DIRS:PATH=/usr/lib/x86_64-linux-gnu " | ||
| "-DnetCDF_DIR:PATH=/usr/lib/x86_64-linux-gnu/cmake/netCDF_pnetcdf'", | ||
| "--with-ptscotch", |
There was a problem hiding this comment.
This can go away by fixing https://gitlab.com/petsc/petsc/-/work_items/2020
|
I will have to retarget this PR to main, because the PETSc fixes will have to land on main. https://gitlab.com/petsc/petsc/-/merge_requests/9904#note_4388123655 |
Summary
CI builds PETSc without ExodusII, so the fixture in
test_exodus_mesh.pyskipped every ExodusII test. No test read a CGNS or a Triangle mesh file.Default installs from
firedrake-configuredo not change. The new markersskipexodusiiandskipcgnsnever skip on CI, because CI setsFIREDRAKE_CI=1. If a package drops out of the CI build, its tests fail instead of being skipped._skip_test_dependencychecksexodusiiandcgnsin the same way as MUMPS and hypre.New tests in
test_load_mesh.py:.node/.ele/.edgemesh of the unit square totmp_path, then checks the volume and the length of the boundary with each id..node/.ele/.facemesh of one tetrahedron, then checks the volume and the area of the face with each id.DMPlexof two triangles with the PETSc CGNS viewer, then checks the volume of the mesh thatMeshreads.Fix: Triangle meshes without a facet file
The reader took the topological dimension from the facet file that it found, so a triangle mesh without a
.edgefile was read as an interval mesh and failed to load.Fix: TetGen meshes and files with one entry
The TetGen tests found two more bugs in the same reader:
.elefile with one cell, or a facet file with one facet, failed the count check, becausenp.loadtxtreturns a one-dimensional array for a file with one row.DMPlex.getJoinof its vertices, which only looks onelevel up. For the three vertices of a face of a tetrahedron the join was empty, so a TetGen mesh
with a
.facefile failed to load. The reader now usesDMPlex.getFullJoin.Evidence
mainCI,test_exodus_mesh.py::test_sidesets SKIPPED,test_exodus_mesh.py::test_create_from_file SKIPPED(run 46448051614). There were no CGNS or Triangle tests.test_load_triangle_mesh_without_edge_filefails without the fix (assert nodedim == dim).6 passed), includingtest_load_triangle_mesh_without_edge_file.Merge Danger
Door: two-way
Blast Radius: CI-only
CI builds PETSc with two more packages, which makes the build a little longer. The only library change is in the Triangle reader, which now loads meshes that it failed to load before.
AI tool: Claude Code (Claude Opus 5.5).
🤖 Generated with Claude Code