Unify ICPP STL onto the shared IB model path#1546
Conversation
ICPP STL/OBJ patches (geometry 21) now resolve their model via patch_icpp%model_id into the shared stl_models table and use the GPU-offloadable winding-number test f_model_is_inside_flat, matching the IB path. The model is loaded once in pre_process by s_instantiate_STL_models (its guard widened to #ifndef MFC_POST_PROCESS), and a per-cell bounding-box check skips the winding test outside the model. Deletes the now-unused ray-casting inside-test from m_model (f_model_is_inside, f_intersects_triangle, f_model_random_number, and the t_ray type). Adds patch_icpp%model_id with its default/broadcast/namelist/validator wiring, and rewrites the ICPP model-file check to validate the stl_models reference instead of the old inline path. Part of MFlowCode#1478.
With ICPP STL patches resolving their model via patch_icpp%model_id into the shared stl_models table, the old per-patch inline fields (model_filepath, model_scale, model_translate, model_rotate, model_spc, model_threshold) have no remaining readers. Removes them from the type, defaults, MPI broadcast, namelist registration, and docs, so ICPP STL is configured identically to IB STL. ICPP STL no longer applies a per-patch model_rotate; no in-repo case used the inline style. Part of MFlowCode#1478.
gpu_total_vertices and its source field t_model_array%total_vertices are write-only: the loader allocates, zeroes, fills, and GPU-uploads gpu_total_vertices every run, but no path (IB markers, ICPP, or levelset distance) ever reads it. total_vertices is never assigned anywhere, so the copy reads an indeterminate value into the array before the device upload. Removing it deletes a read of uninitialized memory and a dead host-to-device transfer. Surfaced while unifying ICPP onto these shared flat-model arrays. Part of MFlowCode#1478.
Adds examples/3D_icpp_stl_cube (Cube_IBM.stl imported as a geometry-21 ICPP patch via model_id -> stl_models) and a '3D -> ICPP -> STL' golden test; foreach_example additionally covers it as '3D -> Example -> icpp_stl_cube' (serial-IO path, shrunk mesh), matching how the IB STL examples are handled. This gives CI coverage for the unified s_icpp_model flat-array winding-number path, which the suite previously lacked (only IB STL cases existed). Part of MFlowCode#1478.
|
@kokomoor this is good and will get my more full attention today sometime. |
|
AI Review:
Lower-confidence findings (filtered out)
My take This is a clean, well-motivated refactor (dedup ICPP onto the shared IB path). The only thing I'd genuinely push on before merge is #1 — |
|
@sbryngelson Thank you! and sounds good to me. I'm investigating your agents findings now. If you concur with them, I'll add a 2D test as well. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1546 +/- ##
==========================================
+ Coverage 60.57% 60.90% +0.33%
==========================================
Files 73 73
Lines 20264 20186 -78
Branches 2949 2939 -10
==========================================
+ Hits 12275 12295 +20
+ Misses 6000 5896 -104
- Partials 1989 1995 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
You correctly removed the old subroutines/functions. There are other subroutines that mimic those functinoalities that end |
|
i think a test makes sense (a small/short one) for 2D. and i guess the other issue is like a two character change so no big deal. thanks @kokomoor |
|
No problem. I'll add the 2D test, fix the error message, and remove the I had some fun testing out the STL ICPP functionality as well. I call him "Mach Lion" |
Nice work @kokomoor. This is paraview, I take it? What kind of workstations/clusters do you have access to? You should be able to run some pretty big cases on a single GPU if the Re and Ma are not setup poorly (normal Ma, high Re / no viscous) |
- 2D ICPP STL golden test (circle, geometry 21); only had a 3D case before - rename f_model_is_inside_flat to f_model_is_inside now the ray-cast version is gone - fix the model_id check message spacing and set iStr locally
|
Thank you again @sbryngelson . I used paraview for interactive viewing per Dan's recommendation, but I got Claude to walk me through a pyvista recording implementation that wound up working really well. I have it in a scratch dir on my local if you're interested. All of this work was done on my linux box with a Blackwell 5070. I have a 5090 sitting on a shelf that I'll be swapping the 5070 for in the coming weeks, no cluster access at present. I'll want to take the 5090 through its paces once I have it installed, so I'll definitely be looking for/making some bigger sims to test on it. All discussed edits are pushed up on my branch, 2D test is showing green, it should be all set. |
|
very cool. a lot of work can get done on a 5070, but only at ~6M grid points or so due to limited DRAM (12gb i think). also if it only computes in single precision then it emulates double prec. (slows things down some). |
|
also using pyvista is good. if you try |
Description
Unifies the ICPP STL/OBJ patch path onto the shared immersed-boundary (IB) model machinery.
ICPP model patches (geometry 21) now resolve their model via
patch_icpp(i)%model_idinto theshared
stl_modelstable and use the GPU-offloadable winding-number testf_model_is_inside_flat,identical to IB STL patches. The model is loaded once in pre_process by
s_instantiate_STL_models(guard widened to
#ifndef MFC_POST_PROCESS), with a per-cell bounding-box check that skips thewinding test outside the model.
Removes the duplicated STL machinery the issue targets:
f_model_is_inside,f_intersects_triangle,f_model_random_number,t_ray);patch_icpp%model_*params (model_filepath/scale/translate/rotate/spc/threshold);gpu_total_verticesarray (GPU-uploaded every run but never read; its source field was never initialized).Behavior/API change: ICPP STL cases are now configured like IB STL cases, with a set
num_stl_models,stl_models(k)%, andpatch_icpp(i)%model_idinstead of the old inlinepatch_icpp%model_*fields. Per-patch
model_rotateis no longer applied to ICPP STL patches. No example or regressioncase used the old inline style.
Closes #1478.
Type of change
Testing
3D -> ICPP -> STLgolden test (examples/3D_icpp_stl_cube: aCube_IBM.stlimported as ageometry-21 ICPP patch); also covered by
foreach_exampleas3D -> Example -> icpp_stl_cube(serial-IO path, reduced mesh). Both goldens were independently verified to contain a centered
solid cube (fill ratio 1.0, density contrast 1.19 air / 5.95 model).
2D/3D -> IBM -> STL) pass unchanged../mfc.sh precheckclean. Rebased onto currentmaster.