Fix geometric consistency during T1 remodelling to prevent divergence#25
Draft
Fix geometric consistency during T1 remodelling to prevent divergence#25
Conversation
…_converge Co-authored-by: Pablo1990 <1974224+Pablo1990@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix remodelling that creates unrealistic geometries
Fix remodelling divergence: detect inf values and growing gradients in convergence check
Mar 17, 2026
… mean of edge vertices Co-authored-by: Pablo1990 <1974224+Pablo1990@users.noreply.github.com>
Copilot
AI
changed the title
Fix remodelling divergence: detect inf values and growing gradients in convergence check
Fix T1 remodelling geometric consistency: prevent energy spikes from invalid face centres
Mar 17, 2026
…es, collinear point guard Co-authored-by: Pablo1990 <1974224+Pablo1990@users.noreply.github.com>
Copilot
AI
changed the title
Fix T1 remodelling geometric consistency: prevent energy spikes from invalid face centres
Fix geometric consistency during T1 remodelling to prevent divergence
Mar 17, 2026
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.
T1 mesh transitions (apical/basal intercalations) produced geometrically broken states that caused volume calculation errors, explosive energy gradients, and Newton-Raphson divergence. Two sessions of fixes address 9 distinct root causes.
Session 1: Face centre validity after intercalation
move_vertices_closer_to_ref_point()— replaced linear interpolation toward a reference point (centre = ref*(1-w) + old*w, w as small as 0.01) withmean(Y[edge_vertices]), which is always inside the convex polygonpost_intercalation()— after all smoothing/Z-snapping, reset every face centre tomean(Y[edge_vertices])for all intercalated cells; Laplacian smoothing and Z-snapping both invalidate face centres but this was previously uncheckedpost_intercalation()— wrappedupdate_measures()+ convergence check in try/except; a negative-volume exception now returnshas_converged=Falseinstead of crashingcheck_if_will_converge()— replaced 4× repeatedg[Dofs.Free]indexing with local variables; unified NaN/Inf detection withnp.isfinite()Session 2: Flip operation robustness
do_flip32()— added guard for collinear input vertices: raisesValueErrorwhen‖cross(v0−v1, v2−v1)‖ < 1e-10instead of silently producing NaN vertex positionspost_flip()— wrappedadd_and_rebuild_cells()in try/except; previously always returnedhas_converged=Trueregardless of failureflip_nm()— wrappedy_flip_nm()in try/except so degenerate flip configurations don't propagate through the full call stackget_best_new_tets_combination()— addednew_volumes <= 0rejection before the existing> 100×meancheck; catches collapsed cells whose degenerate triangles were all silently skipped (volume summed to 0 without raising)is_degenerated()— changednp.all(y1 == y2)tonp.linalg.norm(y1 - y2) < 1e-10to catch near-degenerate edges, not just bit-for-bit duplicatescompute_volume_fraction()— replacedprint()withlogger.warning()for degenerate triangle warningsOriginal prompt
📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.