Unify geometry IDs for Immersed Boundaries and ICPP Fixes #1543#1547
Unify geometry IDs for Immersed Boundaries and ICPP Fixes #1543#1547Riship749 wants to merge 5 commits into
Conversation
sbryngelson
left a comment
There was a problem hiding this comment.
Nice dedup direction — collapsing the near-identical 2D/3D check subroutines is worthwhile. But the unification is applied to the validation layer only, while patch generation (m_icpp_patches.fpp, IB equivalent) still dispatches on the original IDs (2/3/8/9/10/11). That mismatch turns several of the simplified checks into silent validation gaps:
- 3D IDs no longer rejected in lower-D runs — the original
p == 0prohibits on sphere/cuboid/cylinder/3D-airfoil are gone, so e.g.geometry = 8in a 2D case passes validation but hits the 3D generator. - ICPP circle dropped its
n == 0guard — a circle in a 1D run is now accepted (IB + rectangle checks still keep this guard, so it looks accidental). - Cylinder length validation weakened — gating "exactly one length" behind "any length > 0" lets a no-length or negative-length cylinder through.
Details inline. The "compiles + ./mfc.sh test passes" result is expected — these are all gaps in rejecting bad input, which a suite of valid cases won't exercise. Worth adding (or confirming) a case that feeds a 3D ID into a 2D run.
Smaller nits (typos / missing space in messages) also inline.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1547 +/- ##
==========================================
+ Coverage 60.57% 60.87% +0.30%
==========================================
Files 73 73
Lines 20264 20176 -88
Branches 2949 2946 -3
==========================================
+ Hits 12275 12283 +8
+ Misses 6000 5891 -109
- Partials 1989 2002 +13 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
The generation dispatchers in m_icpp_patches and m_ib_patches are now fully unified and handle the legacy IDs natively based on the p > 0 and n > 0 dimensional blocks. I also added the count and n==0 validator checks you requested. |
There was a problem hiding this comment.
Pull request overview
This PR unifies 2D/3D patch geometry IDs for ICPP and immersed boundary (IB) patches in the pre-processor, routing legacy 3D IDs to the unified implementations and reducing duplicated geometry handling.
Changes:
- Unified geometry-ID dispatch for sphere/cylinder/circle (2/8/10), cuboid/rectangle (3/9), and swept patches (4/11) in ICPP patch application.
- Updated patch-geometry validation logic to accept unified/legacy IDs and apply 3D-only constraints when
p > 0. - Removed now-redundant 3D-specific geometry-check subroutines for ICPP and IB.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/pre_process/m_icpp_patches.fpp | Updates ICPP geometry dispatch to accept unified + legacy IDs and route to unified shape routines. |
| src/pre_process/m_check_patches.fpp | Updates ICPP geometry validation dispatch/constraints for unified + legacy IDs, with 3D checks gated by p > 0. |
| src/pre_process/m_check_ib_patches.fpp | Updates IB geometry validation dispatch/constraints for unified + legacy IDs, with 3D checks gated by p > 0. |
| else if (patch_icpp(i)%geometry == 3 .or. patch_icpp(i)%geometry == 9) then | ||
| call s_check_rectangle_patch_geometry(i) | ||
| else if (patch_icpp(i)%geometry == 4) then | ||
| call s_check_line_sweep_patch_geometry(i) | ||
| else if (patch_icpp(i)%geometry == 5) then |
|
Thanks for taking this on, @Riship749 — the direction here was right, and I've pushed a follow-up commit (e91aa2b) onto your branch that builds on it. A summary of what changed and why: The main issue was that the unification only existed in the pre-processor's checkers. The simulation side ( Rather than teaching every downstream dispatch site about the new IDs, the follow-up collapses unified/legacy IDs to one canonical ID per dimensionality at a single point —
Net effect vs master is −41 source LOC with the docs tables updated to match. Full test suite passes locally apart from a few chemistry cases that failed for environmental reasons unrelated to this PR; CI will confirm. |
…der checks The unified/legacy geometry IDs are now collapsed to one canonical ID per dimensionality (f_canonical_geometry) right after the case file is read, in both pre_process and simulation. This makes the unification hold across the whole pipeline (checks, ICPP application, IB markers, levelsets, moments of inertia) instead of only in the pre-process checkers, and extends it to the airfoil (4/11) and STL model (5/12) IB pairs from MFlowCode#1543. - Revert the m_icpp_patches dispatch changes: with canonical IDs the original dispatch is already correct, and the icpp 4/11 (line/plane sweep) merge was unreachable since the checkers still enforce their dimensionality. - Restore the cylinder strictness lost in the previous commit: geometry 10 requires exactly one positive length again (a cylinder with no or negative lengths is a hard error, not a silent sphere), keyed on the canonical ID. - Extend the toolchain bounding-box z-check to unified ID 3 and update the patch-type tables in the docs. - Add two golden tests: a 3D IB sphere and cylinder declared via unified geometry 2 (the sphere golden is bit-identical to the legacy geometry-8 sphere case).
|
@Riship749 heads up — your force-push earlier today removed the follow-up commit I had pushed onto this branch (see the comment above). I've re-applied it on top of your amended commit (now On your amendments: the tightened two-step cylinder length check is covered by the re-applied commit (equivalent pair of checks, keyed on the canonical ID so that a cylinder with no lengths is also an error). I deliberately did not keep the line-sweep checker relaxation (allowing |
| | 2 | Circle | 2 & 3 | Y | Requires `[x,y]_centroid` and `radius`. In 3D, equivalent to 10 (cylinder) if a `length_[x,y,z]` is set and to 8 (sphere) otherwise. | | ||
| | 3 | Rectangle | 2 & 3 | N | Coordinate-aligned. Requires `[x,y]_centroid` and `length_[x,y]`. In 3D, equivalent to 9 (cuboid). | |
This PR unifies the redundant 2D and 3D geometry integers into single, dimension-agnostic IDs within the pre-processor for both
patch_ibandpatch_icpp.Changes:
The unified subroutines now dynamically check for 3D constraints (e.g., Z-centroids and Z-lengths) using the
p > 0condition. Legacy compatibility is maintained by routing the old 3D IDs directly to the newly unified subroutines. Obsolete 3D-specific subroutines have been removed to reduce code duplication.Testing:
Compiled successfully locally and passed the full
./mfc.sh testregression suite.Fixes #1543