minimum_separation — push collision bodies apart to a target separation
(AMIPS + fitting + Laplacian + GCP contact). Two outer-loop strategies via
cfg["strategy"]: "dhat" (default) ramps dhat multiplicatively from the
measured geometric gap (next dhat = dhat_growth * active) at fixed barrier
stiffness, binary-searching on overshoot; "stiffness" (experimental) pins
dhat at sep*(1+rtol) and raises the barrier stiffness until the separation
clears sep.
cfg reference: see spec.json here and the simwild.minimum_separation op.
Selections use the region/filter format from simwild.polyfem_ops.mesh_core.
Usage: python -m simwild.polyfem_ops.minimum_separation config.json
| None simwild.polyfem_ops.minimum_separation.run |
( |
dict |
cfg, |
|
|
|
out_dir = None |
|
) |
| |
Run the full minimum-separation pipeline: extract interface
constraints, reduce the mesh for polyfem, iterate the dhat line-search
solve, and write the deformed mesh. See the module docstring for cfg
fields. Writes the generated polyfem inputs (separation.json, constraint
hdf5s, collision proxy, reduced mesh) to out_dir/sep_input, polyfem
outputs (logs, solution.txt) to out_dir/sep_output, and the deformed
mesh to output_msh (default <stem>_separated.msh); out_dir defaults to
the mesh's folder.
| None simwild.polyfem_ops.minimum_separation.step_run_polyfem |
( |
str |
polyfem_bin, |
|
|
dict |
sep_json, |
|
|
Path |
sep_json_path, |
|
|
Path |
sim_out_dir, |
|
|
dict |
cfg |
|
) |
| |
Iterate polyfem solves, ramping dhat until `sep` is reached: each
solve's "active distance" is parsed from stdout; undershoot commits the
state (warm start) and sets the next dhat to dhat_growth * active
(default 1.9 — the measured gap then sits at x = active/dhat ~ 0.53,
i.e. on the exact (4/3)(1-x)^3 outer branch of the GCP barrier, and the
gap grows multiplicatively); overshoot rolls back and halves the step
(binary search between the last undershoot dhat and the overshooting
one). The smallest overshooting dhat is kept as a bracket upper bound:
later undershoots bisect toward it instead of letting the growth rule
jump past a dhat already known to overshoot. Unless cfg["init_dhat"] is given, the initial gap is measured by
a zero-stiffness probe solve (nothing moves; polyfem reports the gap as
"active distance") and the ramp starts at growth*gap0, with the
overshoot line search anchored at gap0 (where the barrier exerts no
force). Fixed-stiffness ceiling (progress stalls because the penalties
balance the barrier) is warned about once. Mutates sep_json per
iteration, logs each solve to sim_out_dir/polyfem_iter_<i>.log, and
leaves the accepted solve's solution.txt for the caller. Raises
RuntimeError if a solve fails.