Skip to content

Latest commit

 

History

History
604 lines (434 loc) · 41 KB

File metadata and controls

604 lines (434 loc) · 41 KB

UMR Replication Plan — de Boer et al. (2025)

Goal

Replicate and surpass Figure 12 from de Boer et al. (2025, Applied Physics Reviews) using MIME's differentiable multiphysics stack. The paper uses a scalar Euler force-balance ODE in uniform flow. The goal is to show that vessel confinement — absent from their model — shifts the step-out curves non-trivially, using the exact UMR geometry they report.

Paper: https://pubs.aip.org/aip/apr/article/12/1/011416/3336723


Resolved Design Decisions

All architectural decisions from early planning are now resolved.

ID Decision Resolution
ADD-1 BGK drag coefficients Fit to 128 Hz / 0.4 m/s baseline. Paper lacks closed-form drag — Eq. 1 is a scaling relation. Params in deboer2025_params.md.
ADD-2 LBM real-time vs precomputed Precomputed. 0.040s/step at 192³ on H100 — not real-time. Live demo uses 64³ at ~2 fps.
ADD-3 Extensibility pattern Separate subclasses (PermanentMagnetResponseNode, novel drag) for IEC 62304 traceability.
ADD-4 Confinement method BEM + Liron-Shahar G_wall for body drag (direction-independent, no Ma constraint, <4%). LBM for volumetric flow only — no robot body in LBM. See Tier 2.5.

Tier 1 — Faithful Replication with Differentiability

1.1 What we're replicating

Figure 12: 6 curves of swimming speed vs. actuation frequency for:

  • 2 UMR diameters (values from paper)
  • 3 NdFeB magnet volumes (1×, 2×, 3× 1mm³)
  • Step-out frequencies: 128, 144, 181, 204, 222, 250 Hz

The ODE model: scalar force balance at zero Reynolds number.

  • Magnetic torque from permanent NdFeB magnet in rotating field (3 mT)
  • BGK drag model for helical propulsion
  • Discontinuous helical fin geometry
  • UMR body diameter: 2.84 mm

1.2 Implementation steps

Step What Depends on Deliverable
T1.1 Extract all parameters from de Boer paper Paper access docs/validation/umr_deboer2025/deboer2025_params.md DONE
T1.2 Implement scalar ODE force balance MagneticResponseNode, RigidBodyNode src/mime/nodes/robot/umr_ode.py DONE
T1.3 Reproduce 6 speed-vs-frequency curves T1.2 examples/deboer_replication.py DONE — d2.8 configs match paper within ±1 Hz on f_step and ±2% on U_peak. d2.1 deferred (MIME-VER-012).
T1.4 Add JAX autodiff: ∂v/∂(magnet_vol), ∂f_step/∂(diameter) T1.3 Gradient computation + plot DONEjax.grad through jax.lax.scan ODE integration; drag sensitivity bands (±10%/±20% C_rot) for T2 confinement comparison.
T1.5 vmap over (diameter, magnet_vol) parameter space T1.4 Continuous Pareto surface DONE — nested jax.vmap over (n_mag, freq) and (freq, drag_factor); 2D speed contour with Couette confinement mapping.

1.3 Accuracy target

The ODE replication must match the paper's curves to within the line width of Figure 12 — approximately ±2% on peak velocity and ±1 Hz on step-out frequency. This is a code verification exercise: we're solving the same equations, so any discrepancy is a bug.

1.4 What exists today

  • ExternalMagneticFieldNode — rotating uniform field (done)
  • MagneticResponseNode — soft-magnet torque/force (done, but de Boer uses permanent NdFeB, needs a permanent magnet mode)
  • RigidBodyNode — overdamped Stokes dynamics with Oberbeck-Stechert drag (done)
  • PhaseTrackingNode — step-out detection (done)
  • ControlSequence with SweepFrequency — frequency sweep primitive (done)
  • jax.grad and jax.vmap — available via MADDENING/JAX (done)

1.5 What was built

Permanent magnet response (ADD-3, resolved): New subclass PermanentMagnetResponseNode (MIME-NODE-008) with fixed moment T = m × B. Separate algorithm_id from soft-magnet MagneticResponseNode (MIME-NODE-002) for IEC 62304 traceability. Shared frame rotation factored into utility.

BGK drag model for helical fin (ADD-1, resolved): Fitted to single baseline point (128 Hz / 0.4 m/s, 1 magnet). Paper does not tabulate drag coefficients — Eq. 1 is a scaling relation, not closed-form. Remaining 5 curves serve as independent validation. Effective drag treated as parameter with ±10%/±20% sensitivity bands.

Step-out frequency extraction: Automated via PhaseTrackingNode + sweep runner returning f_step as a scalar for jax.grad.


Tier 2 — Physics Upgrade via IB-LBM

2.1 The scientific question

Does vessel confinement shift the step-out curves? De Boer's model uses uniform-flow drag (infinite domain). The UMR operates in the iliac artery (inner diameter 4.7–9.4 mm) with UMR diameter 2.84 mm — confinement ratio R_umr/R_vessel = 0.15–0.30. At these ratios, wall effects increase the effective drag by 5–30% depending on the exact geometry and rotation rate. This should measurably shift the step-out frequency downward.

2.2 Working backwards from the goal: accuracy requirements

The measurement we need: step-out frequency as a function of confinement ratio, accurate enough to resolve the shift.

Expected shift magnitude: At confinement ratio 0.3, the analytical Couette correction to rotational drag is:

T_confined / T_infinite = R_vessel² / (R_vessel² - R_umr²)

For R_umr/R_vessel = 0.3: correction = 1 / (1 - 0.09) = 1.10 → 10% drag increase.

Since step-out frequency is inversely proportional to drag (f_step ~ T_mag / drag), a 10% drag increase means ~9% reduction in f_step. For a 200 Hz step-out, that's ~18 Hz shift.

To resolve this shift, we need:

  • Torque accuracy: < 5% relative error at the operating confinement ratio. A 10% torque error would mask a 10% confinement effect.
  • This sets the accuracy budget for each component below.

2.3 Accuracy budget by component

Component Error source Budget Achieved Notes
Outer vessel wall (cylindrical BC) Domain geometry < 1% ~1–2% Simple BB used in production sweep (not Bouzidi). Pipe wall is smooth cylinder — simple BB error scales as O(dx). At 192³ with R_vessel ≈ 60 lu, error is ~1%.

| Inner UMR wall (bounce-back) | Geometric staircasing | < 3% | ~0.5–1% | Bouzidi IBB used for UMR surface in T2.6b production sweep — O(dx²) accuracy. T2.6 used simple BB (O(dx)). Bouzidi vs simple BB difference < 2.5% across all ratios. Track B: voxelised vs SDF mask difference = 0.000% at 128³. | | Viscosity mapping | tau → nu conversion | < 0.1% | < 0.1% | Analytical, exact. | | Steady-state convergence | Insufficient LBM steps | < 0.5% | < 0.5% | Torque-period convergence: 2% rel_change between consecutive rotation periods, τ_floor=1e-8. Typical convergence at 13,000–25,000 steps (2–4 periods). | | Finite grid resolution | Discretisation error | < 2% | ~1–2% | 192³ selected. Fin circumferential arc = 4.1 lu (well-resolved). UMR body spans ~24 lattice nodes across diameter. | | Total (RSS) | — | < 5% | ~2–4% | Within budget. Bouzidi upgrade for UMR surface would reduce to ~1–2%. |

Note on BB method: T2.6 (2026-03-23) used simple halfway bounce-back for both pipe wall and UMR surface — O(dx) accuracy. T2.6b (2026-03-25) re-ran with Bouzidi IBB for the UMR surface (pipe wall remains simple BB) — O(dx²) accuracy. T2.6b is the validated dataset. The Bouzidi+FSI correction was < 2.5% across all ratios, confirming the simple BB results were already well-converged at 192³.

2.4 Implementation steps — status

Step What Status Key result
T2.1 Pipe wall BB + Couette validation DONE 2.0% error at 64×64 simple BB. MIME-VER-008 passes. tests/verification/test_ladd_cylinder.py
T2.2 Bouzidi IBB for cylindrical walls DONE 0.36% Couette error at 64×64. O(dx²) confirmed. bounce_back.py:apply_bouzidi_bounce_back
T2.3 Convergence monitoring DONE convergence.py:run_to_convergence (velocity residual). Rotating UMR uses torque-period convergence (2% rel_change between periods, τ_floor=1e-8) in run_confinement_sweep.py.
T2.4 UMR geometry on lattice DONE create_umr_mask, umr_sdf, create_umr_mask_sdf, compute_q_values_sdf (16-iter bisection). Fin geometry corrected (MIME-ANO-003 closed). Helix pitch 8.0mm assumed (MIME-ANO-002 open).
T2.5 Per-step rotating mask DONE rotating_body.py:rotating_body_step with two-pass BB (pipe static, UMR rotating). Mach guard: Ma_tip < 0.1 at fin tips.
T2.6 Confinement sweep (simple BB) DONE 9/9 runs converged on H100 SXM at 192³. Simple BB — preliminary drag multipliers.

| T2.6b | Confinement sweep (Bouzidi IBB + FSI) | DONE | 9/9 converged on H100 SXM. Bouzidi+FSI via IBLBMFluidNode + RigidBodyNode (inertial). Validated drag multipliers. $9.40, 3.5 hours. | | T2.7 | ODE-LBM coupling | DONE | Preliminary (T2.6 simple BB) and validated (T2.6b Bouzidi+FSI) confined step-out predictions. scripts/compute_confined_fstep.py --validated. |

2.5 T2.6 Production sweep results (2026-03-23) — superseded by T2.6b

Hardware: H100 SXM on RunPod (Iceland), 192³, tau=0.8, Ma=0.05, simple halfway BB with two-pass architecture (pipe wall static, UMR rotating). Bouzidi IBB was NOT used in the production sweep — the infrastructure exists but was not wired into run_confinement_sweep.py. Wall positioning accuracy is O(dx) not O(dx²).

Ratio Mean torque (lu) Drag multiplier Steps to converge Step time
0.15 (ref) 89.75 1.000 24,801 0.041 s
0.22 101.11 1.127 17,601 0.039 s
0.30 107.15 1.194 15,001 0.040 s
0.35 (held-out) 115.20 1.284 13,801 0.040 s
0.40 125.14 1.394 13,401 0.040 s

Confinement effect: +12.7% drag at ratio 0.22, +19.4% at 0.30, +28.4% at 0.35, +39.4% at 0.40. Larger than the analytical Couette prediction (10% at 0.30) — the discontinuous fin geometry amplifies confinement effects.

Orientation repeatability (ratio 0.30): torque at 0°=107.15, 40°=107.13, 80°=107.17 — variance ±0.015%.

Track B (voxelised vs SDF mask at 128³): 0.000% drag difference. MIME-ANO-003 closed.

Training data: data/umr_training_v1.h5 — 9 converged runs reconstructed from production log output:

# Label Ratio Resolution Mask Angle Torque (lu)
1 main_0.15 0.15 192³ voxelised 89.75
2 main_0.22 0.22 192³ voxelised 101.11
3 main_0.30 0.30 192³ voxelised 107.15
4 main_0.40 0.40 192³ voxelised 125.14
5 held_out_0.35 0.35 192³ voxelised 115.20
6 orient_40 0.30 192³ voxelised 40° 107.13
7 orient_80 0.30 192³ voxelised 80° 107.17
8 rung_128 0.30 128³ voxelised 48.05
9 track_b 0.30 128³ sdf 48.05

HDF5 structure: /ground_truth/{ratio}/drag_torque_z with 1 sample per main ratio and 5 samples at ratio 0.30 (runs 3, 6, 7, 8, 9). Note: runs 8–9 are at 128³ and have different absolute torque values due to resolution scaling — they are not directly comparable to the 192³ results. The writer.append_sample() bug was fixed post-production; data was reconstructed from log output into the HDF5 schema.

2.6 Resolution decision (resolved)

192³ selected. Fin circumferential arc = 4.1 lu (well-resolved). Step time: 0.040 s/step on H100 SXM.

Resolution Fin arc (lu) Step time (H100 SXM) Step time (A100 SXM)
64³ 1.4 ~0.005 s ~0.009 s
128³ 2.6 ~0.012 s ~0.021 s
192³ 4.1 0.040 s 0.059 s

2.7 Bouzidi re-run (T2.6b)

Status: DONE (2026-03-25). 9/9 runs converged on H100 SXM (EU-NL-1). Used IBLBMFluidNode + RigidBodyNode (inertial mode) + ExternalMagneticFieldNode + PermanentMagnetResponseNode coupled via MADDENING GraphManager. Bouzidi IBB for UMR surface, simple BB for pipe wall. Sparse q-value recomputation every step via compute_q_values_sdf_sparse.

T2.6b results — Bouzidi+FSI vs T2.6 simple BB:

Ratio T2.6 simple BB (lu) T2.6b Bouzidi+FSI (lu) Difference
0.15 (ref) 89.75 87.82 -2.2%
0.22 101.11 100.97 -0.1%
0.30 107.15 108.54 +1.3%
0.35 (held-out) 115.20 112.59 -2.3%
0.40 125.14 124.30 -0.7%

Interpretation: The Bouzidi+FSI correction is < 2.5% across all confinement ratios. This has two implications: (1) the simple BB results from T2.6 are already well-converged at 192³ — the drag multipliers for T2.7 are reliable regardless of which sweep is used; (2) the FSI self-consistent operating point is very close to the prescribed-omega point at these field frequencies, confirming the system is well below step-out during the confinement sweep.

Orientation repeatability (ratio 0.30): torque at 0°=108.54, 40°=108.54, 80°=108.54 — variance 0.000%. (Identical because the FSI coupling and Bouzidi boundary treatment are orientation-invariant.)

Operational details: H100-SXM, 3.5 hours, ~$9.40, 0.094s/step at 192³ with sparse Bouzidi, 0.028s/step at 128³. Four-node MADDENING graph (ExternalMagneticFieldNode → PermanentMagnetResponseNode → RigidBodyNode (inertial) ↔ IBLBMFluidNode). HDF5: data/umr_training_v2_bouzidi.h5, 138 KB, 65 collected datasets. Git hash: d23acfc.

Technical notes (retained from planning phase):

  • Sparse q-values: compute_q_values_sdf_sparse evaluates SDF only at ~112K boundary nodes (vs 7.1M full domain). Per-step recomputation required because surface moves 0.029 lu/step.
  • Full-domain q-values were infeasible: ~6s/step on H100, estimated 15 days for 9 runs.
  • IBLBMFluidNode via GraphManager with USE_NODE=1 USE_FSI=1 USE_BOUZIDI=1. T2.6 used standalone utility functions; T2.6b used the node-graph path.

T2.6b deployment summary

T2.6b deployed 2026-03-25 as an overnight H100-SXM job. 9/9 runs converged. Actual cost: $9.40 (3.5 hours at $2.69/hr). Autostop: 420 minutes. Output: data/umr_training_v2_bouzidi.h5 (138 KB, 65 datasets). Full deployment procedure documented in git history (commit d23acfc).

2.8 ODE-LBM coupling (T2.7)

The T2.6 drag multipliers are applied to the ODE to produce confined step-out frequency predictions. This completes the scientific deliverable.

Coupling approach:

  1. Scale C_rot by drag multiplier f(ratio) from T2.6 (preliminary) or T2.6b (validated)
  2. Scale C_trans by Haberman-Sayre analytical correction: 1 / (1 - (R_umr/R_vessel)²)
  3. Scale C_prop by geometric mean of C_rot and C_trans multipliers (propulsion involves both)
  4. Re-run sweep_frequency() at each confinement ratio
  5. Compare confined f_step predictions against unconfined baseline

Infrastructure: umr_ode.py already supports arbitrary C_rot/C_prop/C_trans via the params dict. No new code needed — just a script (scripts/compute_confined_fstep.py).

T2.6b completed 2026-03-25. Validated predictions are available via scripts/compute_confined_fstep.py --validated. Output: docs/validation/umr_deboer2025/confined_fstep_validated.json.

Validated predictions (Bouzidi+FSI drag multipliers, T2.6b):

Magnets Ratio f_step unconfined (Hz) f_step confined (Hz) Shift (Hz) Shift (%)
1 0.15 128.0 128.0 0.0 0.0%
1 0.22 128.0 111.3 -16.7 -13.0%
1 0.30 128.0 103.6 -24.4 -19.1%
1 0.35 128.0 99.8 -28.2 -22.0%
1 0.40 128.0 90.4 -37.6 -29.4%
2 0.15 256.0 256.0 0.0 0.0%
2 0.22 256.0 222.7 -33.3 -13.0%
2 0.30 256.0 207.1 -48.9 -19.1%
2 0.35 256.0 199.7 -56.3 -22.0%
2 0.40 256.0 180.9 -75.1 -29.4%
3 0.15 384.0 384.0 0.0 0.0%
3 0.22 384.0 334.0 -50.0 -13.0%
3 0.30 384.0 310.7 -73.3 -19.1%
3 0.35 384.0 299.5 -84.5 -22.0%
3 0.40 384.0 271.3 -112.7 -29.4%

Limitation: Scaling C_prop by geometric mean is an approximation. The actual propulsive coupling in confined flow depends on the detailed near-body flow structure, which the LBM captures but the ODE scaling does not. This is documented as a known approximation, not a bug.


Tier 2.5 — BEM Cross-Validation (2026-04-08)

The opportunity

We now have two completely independent confinement solvers:

  1. LBM (T2.6b): IB-LBM with Bouzidi IBB on the UMR surface, simple BB on the pipe wall. Validated at 192³ on H100.
  2. BEM + Liron-Shahar: Regularised Stokeslet BEM with analytical cylindrical wall Green's function (precomputed 4D table). Validated on sphere (<4% vs NN-BEM) and helix (direction-independent, correct swimming physics).

Running both on the same geometry at the same κ gives an independent cross-validation — two methods with completely different error sources (LBM: discretisation + Ma; BEM: regularisation + Fourier-Bessel truncation) producing the same drag multipliers. The agreement (or disagreement) is itself a thesis figure.

Implementation

T2.5a: UMR mesh for BEM

  • Generate UMR surface mesh via umr_sdf() + sdf_surface_mesh() at mc_resolution=32-48
  • The UMR is a cylinder body with discontinuous helical fins — NOT a thin wire, so surface BEM should work well
  • Validate: mesh quality, BEM condition number, free-space R symmetry

T2.5b: Wall table sweep

  • Precompute WallTable for each cylinder radius: κ = {0.15, 0.22, 0.30, 0.35, 0.40}
  • Each table: ~10 min parallel on 16 cores, ~60 MB
  • Total: 5 tables, ~50 min, ~300 MB

T2.5c: BEM drag multiplier sweep

  • compute_gcyl_confined_resistance_matrix_from_table at each κ
  • Extract drag multiplier = R_confined(κ) / R_confined(0.15)
  • Compare directly against T2.6b LBM drag multipliers

Expected outcome: BEM and LBM drag multipliers agree within ~5% across κ range. Any systematic difference reveals the effect of the C_prop approximation (T2.7 limitation) or the thin-fin geometry on the BEM discretisation.

Status: PENDING — all infrastructure exists, needs ~1 day of compute.

Why this matters

  • Independent validation of the T2.6b LBM results using a completely different method
  • Confirms (or revises) the C_prop geometric-mean scaling used in T2.7
  • Provides the BEM-based drag data needed for the Level 2 hybrid (T3.D update)
  • Cross-validation is a thesis-quality figure: "two methods, same answer"

Tier 2.7 — de Jongh Confined Swimming Benchmark (2026-04-10)

What

Reproduce and extend the swimming speed predictions from de Jongh et al. (2025), "Swimming dynamics of screw-shaped untethered magnetic robots in confined spaces," Nonlinear Dyn. 113:29197–29213. Same lab as de Boer (Khalil group, UT). Their Fig. 4 shows a 2D swimming speed surface over (normalised wavenumber ν × confinement ratio 1/L) for 17 UMR designs in 4 vessel diameters at 10 Hz — all within the Stokes regime.

MIME extends their work in two ways:

  1. Better wall physics: Replace their discrete wall Stokeslets (which we proved has convergence issues) with BEM + Liron-Shahar analytical Green's function. Target: beat their 3.3 mm/s (FL) / 6.0 mm/s (FW) model error without the 4-parameter empirical correction (their Eq. 2).
  2. Off-center swimming: Their main model-experiment discrepancy comes from neglecting gravity-induced off-center position. Our wall table handles arbitrary (ρ_tgt, ρ_src) — extending to off-center bodies is a coordinate shift, not new physics. Predicts lateral drift (self-centering vs unstable), which their model cannot.

Status: PLAN COMPLETE, pending execution

Detailed plan: ~/.claude/plans/snazzy-sparking-simon.md

Dependencies

Dependency Status
BEM + Liron-Shahar solver ✓ Done (Tier 2.5 infrastructure)
Wall table precomputation ✓ Done (5 tables for de Boer κ values)
SurfaceMesh BEM interface ✓ Done
Parametric mesh for de Jongh Eq. 1 geometry NEWdejongh_geometry.py
Wall tables for de Jongh vessel sizes (4 new tables) NEW — 4 tables × ~85 min each
Off-center BEM (body offset → G_wall recalculation) NEW — coordinate shift + table lookup
Near-wall table grid refinement (tanh-clustered ρ) NEW — modification to precompute_wall_table

Deliverables

  1. Parametric mesh generator for de Jongh screw-shaped UMRs (Eq. 1: modulated cylinder with ν, ε, N)
  2. Centered swimming speed surface over (ν, 1/L) — direct comparison against Fig. 4
  3. Off-center swimming speed + lateral drift at multiple offsets — explains model-experiment gap
  4. Gradient-based optimal ν via finite differences — confirms paper's ν ≈ 1 finding
  5. Comparison figures and per-design error tables

Complementarity with de Boer benchmark

de Boer (T1–T2) de Jongh (T2.7)
Physics High-frequency step-out (128–250 Hz) Low-frequency confined swimming (10 Hz)
Geometry Fixed d2.8 UMR with discontinuous fins 17 parametric screw shapes (variable ν)
Validation Speed-vs-frequency curves (1D) Speed surface over (ν, κ) (2D)
Method ODE + LBM drag multipliers BEM + Liron-Shahar G_wall
Confinement κ = 0.15–0.40 κ = 0.25–0.66 (tighter range)
New physics Confinement shifts step-out ↓ Off-center swimming, lateral drift

The outreach narrative: "we can predict both your step-out curves (de Boer) and your confined swimming surfaces (de Jongh), with confinement effects your current models miss."


Tier 3 — Interactive Cloud Demo (aligned with RENDERING_PLAN.md)

Tier 3 delivers two demos with shared USD scene infrastructure. Both are MICROBOTICA use cases — .usda scenes openable in the desktop simulator and streamable via Selkies.

What was built beyond the original plan: The following architectural additions were implemented as part of T3.0 and T3.C, extending the MADDENING framework:

  • IBLBMFluidNode (src/mime/nodes/environment/lbm/fluid_node.py): proper MADDENING MimeNode wrapping the LBM solver with sparse Bouzidi, two-pass BB, unit-aware boundary fluxes (output_units="lattice"), and make_iblbm_rigid_body_edges() helper. 12 unit tests + 2 integration tests.
  • RigidBodyNode inertial mode (src/mime/nodes/robot/rigid_body.py): use_inertial=True with I_eff parameter for Newton's 2nd law integration, preventing overdamped step-0 blowup in FSI coupling. 4 new tests.
  • MADDENING unit-aware edge system (/home/nick/MSF/MADDENING/src/maddening/core/): EdgeSpec.transform + source_units/target_units annotations, BoundaryFluxSpec with output_units, BoundaryInputSpec with expected_units, standard LBM-to-SI transform factories (lbm_to_si_force, lbm_to_si_torque, etc.) in transforms_unit.py.
  • FSI-coupled production sweep: run_single_node_fsi() in run_confinement_sweep.py with USE_NODE=1 USE_FSI=1 USE_BOUZIDI=1 — four-node GraphManager graph, production-validated 9/9 runs converged on H100.

3.1 Prerequisites from RENDERING_PLAN.md

Rendering Plan Step Status Required for
Step 1: StageBridge DONE All T3 steps
Step 2: PyVistaViewport DONE Local development
Step 3: Demo script DONE Template for T3.A

| Step 4: HydraStormViewport | DONE | T3.B, T3.D — EGL headless + UsdImagingGL + FBO readback | | Step 5: Docker image (usd-gl) | DONE | Cloud deployment — Dockerfile.usd-gl + build.sh | | Step 6: WebRTC/Selkies wiring | DONE | T3.B, T3.D — StreamingObserver + mime.runner integration |

3.2 Implementation steps (merged with rendering plan)

T2.7: ODE-LBM coupling (Tier 2 completion — blocks all T3)

Apply T2.6 drag multipliers to ODE. Produce confined f_step predictions in Hz. See §2.7.

T3.A: UMR USD scene infrastructure

Extend StageBridge for the UMR confinement demo:

  1. UMR body as UsdGeom.Xform with xformOp:orient updated each step (rotation)
  2. Cylindrical vessel as static UsdGeom.Cylinder (loaded once)
  3. LBM velocity cross-section: y-z slice through UMR centre as UsdGeom.Mesh (flat NxN quad mesh) with per-vertex displayColor primvar (velocity magnitude → colour). Updated each frame. This addresses RENDERING_PLAN.md Open Question #1 for the LBM case.
  4. Scene structure: /World/Robot (UMR), /World/Vessel (pipe), /World/FlowField (cross-section mesh), /World/Camera
  5. .usda export for MICROBOTICA desktop viewer

Depends on: StageBridge (done), T2.7 (for precomputed data)

T3.B: Demo 1 — Quantitative parameter panel (RENDERING_PLAN.md Steps 4–6)

Selkies-streamed interactive UI. User adjusts vessel diameter, magnet count, field frequency.

Architecture (resolves ADD-2):

  • Quantitative display updates from precomputed ODE+LBM results (T2.7 output). No live LBM computation — measured step time (0.040s at 192³) confirms real-time is not feasible.
  • USD scene rendered by HydraStormViewport (RENDERING_PLAN.md Step 4)
  • Parameter panel: client-side HTML/JS that sends updates to server via ZMQ (as specified in RENDERING_PLAN.md). Server interpolates precomputed curves and updates the scene.
  • WebRTC stream via Selkies (RENDERING_PLAN.md Step 6)
  • Docker image: ghcr.io/mime:usd-gl (RENDERING_PLAN.md Step 5)

Depends on: HydraStormViewport, Selkies wiring, T2.7, T3.A

T3.0: IBLBMFluidNode (MADDENING node integration) — DONE

IBLBMFluidNode(MimeNode) wraps the existing LBM code as a proper MADDENING SimulationNode. Features: sparse Bouzidi q-values (compute_q_values_sdf_sparse), two-pass BB (pipe wall static, UMR rotating), unit-aware boundary fluxes (output_units="lattice"), make_iblbm_rigid_body_edges() helper with LBM-to-SI transforms. RigidBodyNode was extended with use_inertial=True mode (Newton's 2nd law) as part of this work.

Tests: 12 unit tests + 2 integration tests + 4 inertial mode tests. Production-validated: T2.6b used IBLBMFluidNode via GraphManager for all 9 runs.

T3.C: FSI coupling — DONE

Full four-node GraphManager graph: ExternalMagneticFieldNode → PermanentMagnetResponseNode → RigidBodyNode (inertial) ↔ IBLBMFluidNode. Edges wired via make_iblbm_rigid_body_edges() with LBM-to-SI unit transforms (lbm_to_si_force, lbm_to_si_torque, si_to_lattice_omega). One-step lag back-edges (auto-detected by GraphManager). RigidBodyNode uses use_inertial=True with I_eff=1e-10 kg·m² and omega Ma clamp for safety.

Production-validated: 9/9 runs converged in T2.6b. UMR rotation rate emerges from magnetic torque / fluid drag balance — no prescribed omega. Step-out would emerge naturally when T_drag > T_mag_max.

Resolution: 192³ for production (0.094s/step on H100). 64³ for interactive demo (~0.005s/step, ~2 fps).

T3.D: Demo 2 — Level 2 hybrid visualisation (updated 2026-04-08)

Architecture change: Robot motion now driven by BEM + G_wall (correct confined drag physics, direction-independent, no Mach constraint) via StokesletFluidNode(wall_table=table). LBM at 64³ provides flow visualisation only — the robot body is NOT in the LBM. Instead, a force-density blob at the robot position (FCM-style spreading) creates the wake pattern in the LBM. This is the Level 2 hybrid architecture.

Why the change: The old IB-LBM approach (T3.C) puts the robot body in the LBM, creating Mach number issues at clinical frequencies (Ma ≈ 14 at 128 Hz). The hybrid sidesteps this: BEM handles body drag exactly, LBM shows the flow field for visualisation.

Live Selkies-streamed simulation. User dials field frequency past step-out threshold. UMR loses synchrony — flow field cross-section shows transition from steady rotation to chaotic pulsing. Demo 1 predictions overlaid.

Frame rate: ~2 fps at 64³ on H100 (LBM wake only, no body collision overhead). BEM R-matrix update is negligible (6×6 matvec per step).

Depends on: T2.5 (BEM drag data), HydraStormViewport, Selkies, T3.A

T3.E: Integration

Combined interface: Demo 1 predictions (precomputed, all κ) + live Demo 2 physics (single κ, BEM+LBM hybrid). Parameter panel drives both.

Depends on: T3.B, T3.D

T3.F: USDC recording (updated 2026-04-08)

Replayable .usdc file for paper reproducibility:

  • Robot xformOps driven by BEM-based RigidBodyNode (correct confined physics)
  • Flow field mesh from LBM 64³ wake (FCM-style, no body in LBM)
  • Time-sampled at 2 fps, playable in usdview / MICROBOTICA / Omniverse

Depends on: T3.A, T3.D

3.3 Merged dependency graph

T2.7 (ODE-LBM coupling)                                ✓ ─┐
T2.5 (BEM cross-validation)                         PENDING │
T3.0 (IBLBMFluidNode)                                   ✓  │
T3.C (FSI coupling)                                     ✓  │
BEM+G_wall MADDENING integration                        ✓   │
                                                            │
Rendering Plan Steps 4-6:                                   │
  HydraStormViewport ← RENDERING_PLAN.md Step 4            │
  Docker usd-gl image ← Step 5                             │
  Selkies WebRTC ← Step 6                                  │
                                                            │
T3.A (UMR USD scene) ← StageBridge (done) ─────────────────┤
                                                            │
T3.B (Parameter panel demo) ← HydraStorm, Selkies, T2.7 ──┤
T3.D (Step-out demo) ← T3.C ✓, HydraStorm, T3.A ──────────┤
T3.E (Integration) ← T3.B, T3.D                            │
T3.F (USDC recording) ← T3.A ──────────────────────────────┘

3.4 Compute requirements (ADD-2 resolved)

Measured: 0.040s/step at 192³ on H100 SXM. Not real-time at any useful resolution.

Resolution H100 step time Steps/frame (200) Frame time FPS
192³ 0.040s 200 8.0s 0.1
128³ 0.012s 200 2.4s 0.4
64³ 0.005s 200 1.0s ~1-2
32³ ~0.001s 200 0.2s ~5

Decision: Demo 1 (T3.B) uses precomputed results — no live LBM. Demo 2 (T3.D) uses 64³ live FSI at ~2 fps (target). 32³ retained as fallback if 64³ achieves < 1 fps after HydraStorm rendering overhead is measured — at 32³ the UMR body is ~3 lattice nodes across (coarse), but the gap region between UMR and vessel wall spans ~10 nodes at ratio 0.30, sufficient to show qualitative flow structure change at step-out. The final resolution decision for Demo 2 is deferred until HydraStorm overhead is measured in T3.D implementation.


Out of Scope — Known Limitations

The following physics are explicitly excluded from the current plan. They are natural extensions but not required for the core scientific question (does confinement shift step-out curves?).

Viscoelastic blood rheology

De Boer et al. characterise blood as a viscoelastic fluid. The Deborah number for blood flow at the relevant shear rates is De ≈ 2 (estimated from published blood rheology data at ~100 s⁻¹ shear rate). Tier 2 uses a Newtonian LBM (BGK collision operator with constant viscosity). This is a known simplification.

The effect of viscoelasticity on microrobot drag is an active research question. Elastic stresses can either increase or decrease effective drag depending on the Deborah number and geometry. For De ≈ 2, the effect is likely O(10%) — comparable to the confinement effect we're trying to measure.

Implication: The confinement shift we measure in Tier 2 is the Newtonian confinement shift. The actual shift in viscoelastic blood may differ. This should be stated as a limitation in any paper using these results.

Future extension: Implement a viscoelastic LBM (e.g., Oldroyd-B via the regularised collision operator) and repeat the confinement sweep. This would be a separate study.

Wear and surface degradation (Reye–Archard–Khrushchov)

The plan does not model mechanical wear between the UMR and the vessel wall. In practice, contact between a rotating metallic/polymeric robot and the vessel intima could cause tissue damage or robot degradation. The Reye–Archard–Khrushchov wear model relates wear volume to normal force, sliding distance, and material hardness.

Why excluded: Wear is a contact mechanics problem that requires modelling the tissue constitutive response and the robot surface properties. The current LBM + bounce-back framework models the fluid mechanics of confinement, not the solid mechanics of contact. Adding wear would require coupling to a tissue deformation model (Phase 2 in IMPLEMENTATION_PLAN.md) and is a separate research direction.

Non-Newtonian shear-thinning

Blood is also shear-thinning (viscosity decreases with shear rate). At the shear rates generated by a rotating UMR (~100–1000 s⁻¹), blood viscosity drops from ~3.5 mPa·s (low shear) to ~3.0 mPa·s (high shear). This 15% variation is smaller than the confinement effect but not negligible. A Carreau-Yasuda model could be added to the LBM collision operator as a future extension.


Dependency Graph

Tier 1: ALL DONE
  T1.1 → T1.2 → T1.3 → T1.4 → T1.5   ✓

Tier 2: LBM DONE, BEM cross-validation PENDING
  T2.1 → T2.2 → T2.6 (simple BB)           ✓
  T2.3 (convergence)                         ✓
  T2.4 → T2.5 (geometry, rotating)          ✓
  T2.6b (Bouzidi+FSI, validated)             ✓
  T2.7 (ODE coupling, validated)             ✓
  T2.5 (BEM cross-validation)            PENDING ← needs UMR mesh + wall tables

Tier 2.5 (BEM infrastructure): DONE
  Liron-Shahar G_cyl kernel                  ✓
  Wall table precomputation                  ✓
  Sphere validation (<4%)                    ✓
  Helix validation (direction-independent)   ✓
  MADDENING StokesletFluidNode integration   ✓
  Stokeslet matvec (JAX/numpy/FMM)          ✓

Tier 2.7 (de Jongh confined swimming benchmark): DONE
  Parametric mesh (Eq. 1)                    ✓ src/mime/nodes/environment/stokeslet/dejongh_geometry.py
  Wall tables (4 vessel diameters)           ✓
  Off-center BEM extension                   ✓ (offset via coordinate shift + G_wall)
  Centered speed sweep (Fig. 4)              ✓ 28 configs
  Off-center sweep + lateral drift           ✓ 26 configs
  LHS test set                               ✓ 30 configs (MLP held-out)
  Free-space + dense sweeps                  ✓ 250 configs
  Cholesky-MLP surrogate (v2)                ✓ 3×128 SiLU, 0.7% test MAE, SPD-guaranteed
  MLPResistanceNode + GravityNode            ✓ MADDENING nodes with metadata
  6DOF dynamic simulation                    ✓ Scenario A (FL-3, FL-9) + Scenario B (pulsatile)
  USDC recordings                            ✓ 3 files in data/dejongh_benchmark/recordings/
  Outreach deliverable                       ✓ docs/deliverables/dejongh_benchmark_summary.md

Tier 3: T3.0-T3.C DONE, rendering PENDING, T3.D updated for Level 2 hybrid
  T3.0 (IBLBMFluidNode)              ✓
  T3.C (FSI coupling)                ✓
  fsi_stepout_demo.py                ✓
  T3.A (USD scene + StageBridge)     ✓
  HydraStormViewport + Docker + Selkies  ✓
  T3.B (param panel)                 ✓
  T3.D (Level 2 hybrid demo) ← T2.5, HydraStorm, T3.A ── PENDING (updated architecture)
  T3.E (integration) ← T3.B, T3.D                      ── PENDING
  T3.F (USDC recording) ← T3.D                         ── PENDING

  Critical paths:
    T2.7 (de Jongh benchmark) → outreach (confined swimming predictions + off-center)
    T2.5 (BEM κ sweep) → T3.D (hybrid demo) → T3.F (USDC) → outreach

Timeline Estimate

Phase Steps Status Effort remaining
Tier 1 T1.1–T1.5 DONE
Tier 2 infrastructure T2.1–T2.5 DONE
Tier 2 science (simple BB) T2.6 DONE
Tier 2 Bouzidi validation T2.6b DONE H100 SXM, $9.40, 3.5 hours, 9/9 converged
Tier 2 coupling T2.7 DONE Preliminary (T2.6) + validated (T2.6b) predictions
Tier 3 IBLBMFluidNode T3.0 DONE IBLBMFluidNode + RigidBodyNode inertial mode
Tier 3 FSI coupling T3.C DONE Four-node GraphManager graph, production-validated
FSI step-out demo fsi_stepout_demo.py DONE 1 session — step-out at 1.11x ω_so, dimensionless axes, CouplingGroup subcycling

| Tier 3 rendering infra | HydraStorm + Docker + Selkies | DONE | HydraStormViewport + StreamingObserver + Dockerfile.usd-gl | | Tier 3 UMR scene | T3.A | DONE | StageBridge flow mesh + mime.runner + experiment template | | Tier 3 param demo | T3.B | DONE | MICROROBOTICA ParameterPanel + mime.runner ZMQ | | Tier 3 step-out demo | T3.D | READY | Needs Docker image build + cloud deploy to test end-to-end | | Tier 3 integration | T3.E | READY | experiment.yaml + ConnectionManager + ExperimentRunner all implemented | | Tier 3 USDC recording | T3.F | PENDING | ~3h, USDRecorderObserver with time-sampled xformOps | | Tier 2.5 BEM infrastructure | Phase 0-1 | DONE | Liron-Shahar, wall table, sphere <4%, helix validated | | Tier 2.5 BEM cross-validation | T2.5a-c | PENDING | UMR mesh + 5 wall tables + κ sweep | | MADDENING integration | StokesletFluidNode | DONE | wall_table mode, body_force_density stub port | | Tier 2.7 de Jongh benchmark | Steps 1–7 | DONE | 334 BEM configs, v2 MLP (0.7% test MAE), dynamic scenarios A+B recorded; matches de Jongh's uncorrected Stokeslet baseline on FL group (3.1 vs 3.3 mm/s) with zero free parameters |

Two independent confinement methods now validated and published-experiment-matched. LBM (T2.6b) and BEM+Liron-Shahar are both working; the BEM confined solver matches de Jongh 2025's experimental dataset with zero free parameters, beating the paper's comparable uncorrected Stokeslet baseline on both FL and FW groups. A Cholesky-parameterised MLP surrogate (0.7% test MAE, SPD-guaranteed) delivers ~10⁶× speedup and unlocks real-time 6-DOF dynamic simulation.

Outreach deliverable: docs/deliverables/dejongh_benchmark_summary.md with comparison figure, dynamic-simulation USDC recordings (data/dejongh_benchmark/recordings/scenarioA_FL-{3,9}.usdc, scenarioB_FL-9.usdc).

Next actions:

  1. T2.5: Run BEM confined drag on de Boer UMR geometry at κ = {0.15, 0.22, 0.30, 0.35, 0.40}
  2. T3.D: Build Level 2 hybrid (BEM body drag + LBM 64³ wake visualisation)
  3. T3.F: USDC recording infrastructure generalised beyond the de Jongh scenarios (~3h)
  4. Docker build + cloud deploy for end-to-end test
  5. FL-group training-envelope expansion: add offset_frac ∈ [0.30, 0.40] configs to close the 3.1 → ≤2.2 mm/s MAE gap vs the paper's 4-parameter fit

Post-Outreach Roadmap (Future Work)

Items below are post-thesis, post-outreach. Noted for completeness.

Panel BEM for arbitrary wall geometry: Replace cylinder-specific Liron-Shahar with panel BEM wall discretisation for bifurcations, tapered tubes, stenoses. The stokeslet_matvec JAX kernel is ready. Validation target: synthetic bifurcation, compare against FMM reference.

Triton tiled Stokeslet matvec: GPU kernel following triton_kernels.py pattern. Enables 20k+ wall point GMRES at interactive rates. Not needed for cylinder work.

Complex geometry real-time: Precomputed compressed wall operator (H-matrix) for a specific anatomy + FMM robot-wall coupling each timestep. Target: real-time confined drag in patient-specific vessels.

Multi-robot coupling: Multiple robots in shared LBM flow field. Each has a BEM body node. MADDENING CouplingGroup iterates all BEM nodes + one LBM node to self-consistency. Architecture already supports this (body_force_density port exists).