Repository navigation
Mesh coordinates are degree 1: a mesh refuses any other degree (#978) - #1088
Conversation
The degree argument of Mesh and of the uw.meshing constructors set the degree of the coordinate field. Particle location, cell sizes, boundary normals, mesh motion and the multigrid hierarchy all read the coordinates as straight-sided cells, and a degree-2 mesh failed in each. It did not curve a boundary either: the edge nodes sat on the chords. - Mesh._require_straight_sided_cells raises ValueError unless degree is the integer 1. Mesh.__init__ calls it first, and each of the 20 uw.meshing constructors calls it before generating anything, so every rank refuses together and rank 0 never starts gmsh. - mesh.degree is a read-only property returning 1. - Removed what existed only for degree-2 coordinates: the quadrature cell sizer petsc_fem_get_local_cell_sizes and its PETSc declarations (#983), the degree guard in _compute_geometry_fvm, and the _finest_level_takes_moved_coordinates guard in _deform_mesh (#1044). - Docstrings of all constructors and docs/developer/subsystems/meshing.md say that the mesh degree is 1 and the variable carries the order. - Tests: test_0782 (serial and parallel) now hold the refusal for every constructor found by signature, the strict check, the read-only property, and the degree-1 cell sizes that the degree-2 tests carried (manifold facets, empty rank, extracted region). The estimate_dt accuracy step keeps its closed-form baseline on a degree-1 mesh. Underworld development team with AI support from Claude Code
Underworld development team with AI support from Claude Code
…sal survives a replaced Mesh name (#978) - Mesh(plex) accepted a plex that already carried a degree-2 coordinate space and left X.coords with 25 nodes over a dm with 9. The refusal now also reads the plex's coordinate space, a property every rank holds alike. - The uw.meshing constructors call the refusal through uw.discretisation.Mesh, not their module's Mesh name: test_0502's files-only test replaces that name with a function and the call failed with AttributeError. - test_0782: a constructor that starts gmsh fails the test, not only one that reaches Mesh; a plex with degree-2 or degree-3 coordinates is refused and one with degree-1 coordinates builds. - Wording that still described degree-2 coordinates as a live case. Underworld development team with AI support from Claude Code
Adversarial review, round 1 (fresh reviewer, before the PR opened)Reviewed at the pre-commit working tree; fixes are in da43d75. No blocker. Fixed in this branch
Not changed, with the reason
Checked and sound
Issue state
Adversarial review, round 2 (fresh reviewer, at 77bbbdb)No blocker. Fixes are in 326ae83. Fixed in this branch
Found by the serial suite after round 1's fixes
Not changed, with the reason
Checked and sound
Underworld development team with AI support from Claude Code |
PR #1088 (#978, mesh coordinates are degree 1): adversarial pass on what it removesREADY for 326ae83. No blocking finding. There are three non-blocking follow-ups, listed at the end. Scope: only what the PR removes. That is the deform guard 1. The deform guard (#1044)What the guard checked. [read] It did not check the degree at all. It checked one thing: if Where
Measured. After each path I compared the finest level with These paths behave identically on the branch and the base, at np 1 and np 2:
The errors of 1e-5 on the refined meshes are the iterative solver's tolerance: base and branch match bit for bit, and stale geometry would give 0.3. No non-mmg public path leaves a finest level of a different size, so none is left unguarded. The mmg route, with the stand-in adapter. I used
So the stale hierarchy is a pre-existing bug, and the guard only made the move fail cleanly. I also called 2. #983's cell sizer and the FVM degree guard#908's collective error-code check holds. The parallel tests ran on the branch at np 2, 3 and 4, every rank, with no hangs: Empty-rank cell sizes and FVM setup at np 4. Cells per rank were [6, 5, 5, 0]. I called The degree-1 path is unchanged. [read] On the base, 3. The refusal
Blocking findingsNone. Non-blocking follow-ups
Not covered: a real mmg build (stand-in only); np 3 and 4 for the Q1 scenarios (np 1 and 2 as asked); 3-D submeshes. Underworld development team with AI support from Claude Code |
…1088 lists Underworld development team with AI support from Claude Code
Records Louis's ruling of 2026-11-12 (underworldcode#1088, underworldcode#978 not planned) in the Charter's "Things to Remember", with the reason: particle location is exact only on planar faces, and links the UWTN article that explains it. Underworld development team with AI support from Claude Code
What this does
Mesh coordinates are degree 1, and a mesh now says so.
Meshand everyuw.meshingconstructor raiseValueErrorfor anydegreeother than the integer 1. The order of a field is set on the variable (MeshVariable(..., degree=2)), as it always was.This is the ruling on #978: degree-2 coordinate meshes were never supported, and supporting them would be a campaign across particle location, cell geometry, boundary normals, mesh motion and the multigrid hierarchy. #978 is closed as not planned, with a link here.
Why refuse instead of fixing
boundary_normalraised,estimate_dtraised, anddeformbroadcast the vertex coordinates into the larger degree-2 coordinate vector.cellSize=0.2the outer-wall edge nodes were at r = 0.995 between vertices at r = 1.Changes
Mesh._require_straight_sided_cells(degree)raises unlessdegreeis the integer 1 (1.0,Trueand"1"are refused too;1.0andTruepreviously failed in PETSc's option parser with error 63).Mesh.__init__calls it first. Each of the 20uw.meshingconstructors calls it before generating anything, so every rank refuses together and rank 0 never starts gmsh.Mesh(plex)on a plex that already carried a degree-2 coordinate space built a mesh whoseX.coordsheld 25 nodes over admwith 9.Meshnow reads the plex's coordinate space, which every rank holds alike, and refuses a degree other than 1.mesh.degreeis a read-only property returning 1. It was a plain attribute that drove the coordinate rebuild.petsc_fem_get_local_cell_sizesand its PETSc declarations (from A degree-2 mesh builds with a rank holding no cells, and its cells have true sizes #983);_compute_geometry_fvm;_finest_level_takes_moved_coordinatesand its raise in_deform_mesh(from A solve after a move of a refined mesh runs on the moved geometry (#1037) #1044).degreeentry ofMeshand of every constructor now says what the argument is and that only 1 is accepted.docs/developer/subsystems/meshing.mdhas a section on it.estimate_dtreading the coordinate DM's nodes (from Timestep estimates read model units; timestep setters keep or refuse their input (#891, #1031, #978 part) #1049; at degree 1 those are the vertices), and the within-plex coordinate-space helper from custom_mg at np 32 and 52: the nested interpolation fails on preallocation, the FMG build falls back and the ranks deadlock #902, which at degree 1 takes its copy branch.Tests
tests/test_0782_mesh_coordinates_are_degree_one.py(level 1, tier B) replacestest_0782_degree2_cell_size.py:uw.meshingconstructor found by signature refusesdegree=2before it starts gmsh or reachesMesh;Mesh(plex, degree=d)refuses0, 2, 3, 1.0, True, "1", None;mesh.degreecannot be assigned;tests/parallel/test_0782_mesh_degree_refused_on_every_rank.py(level 2, tier B) replacestest_0782_degree2_mesh_empty_rank.py: cell sizes with an empty rank, the refusal fromMeshand from a constructor on every rank, the collective error-code check, and the extracted-region area.test_1153: the Eulerian accuracy step keeps its closed-form baseline0.02/pi, now on a degree-1 mesh at 3 %.test_1107: the degree-2 mesh case is removed; the degree-1 cases stay.Mutants: with the call removed from
SphericalShelland fromMesh.__init__, exactly theSphericalShellcase and the seven argument cases fail (8 failed, 23 passed). With the plex check disabled and the call removed fromAnnulus, exactly the two plex cases and theAnnuluscase ("Annulus started gmsh") fail (3 failed, 31 passed).Serial on macOS:
pytest tests -m "level_1 and (tier_a or tier_b)"at 326ae83: 1965 passed, 65 skipped. A level-2 tier A/B subset on mesh-building routes (-k "submesh or extract or extrude or periodic or adapt or refine or checkpoint or manifold"): 102 passed, 49 skipped. Parallel on hyperion (Linux) at 326ae83, np 2, 3 and 4, every rank:test_0782_mesh_degree_refused_on_every_rank.py5 passed,test_1107_interpolation_rank_owning_nothing_parallel.py11 passed,test_0781_empty_rank_mesh_sequence.py4 passed; no hangs. The empty-rank and submesh files 0774, 0779, 0783, 0768 and 0690 pass.test_0770_submesh_extract_mpifails 2 tests at np 3 only, and fails the same 2 on development (5ce73fd).Issues
Underworld development team with AI support from Claude Code