Skip to content

Valve: the open mitral input closes end to end and agrees with FEBio - #14

Merged
mattjolley merged 3 commits into
mainfrom
mattjolley/mitral-closure
Nov 28, 2026
Merged

mattjolley merged 3 commits into
mainfrom
mattjolley/mitral-closure

Conversation

@mattjolley

Copy link
Copy Markdown
Contributor

What does this change, and why?

The open mitral input now runs end to end, through leaflet closure, and agrees with the FEBio results stored for it. This pull request adds the example that runs it and makes the comparison, two small pieces it needed, and the contact note with what was tried and the plan from here. Design note: contact_in_run.md (v0.4).

Merged by the author so the work can continue; comments afterwards are welcome.

Commit What
Output: keep FEBio's contact area, the pair count and the contact energy per state FEBio's contact area for the contact potential (area of the integration points with a nonzero force), in the results of every state
Solvers: give cuDSS its threading layer for the analysis Contact repeats the analysis when the pairs change; without the threading layer that part ran on one thread and warned every time
Valve: the open mitral input closes end to end and agrees with FEBio examples/valve/mitral_closure.py, and the notes

What made the valve close. Nothing new: FEBio's line search (pull request 11) and FEBio's default for excluding neighboring elements from contact (pull request 10). The note has the table of what each ingredient did on its own. A projected contact tangent, a step limit and tangent_scale were not needed for this input and stay as options for harder ones.

Agreement with FEBio (input: P2Prolapse_Mitral.feb, FEBio model repository project 134; reference: the stored FEBio 4.9.0 run, which itself ends in an error termination at time 0.0135 of 0.02, so the comparison covers times up to there):

  • contact starts at time 0.00304 in both;
  • contact area at FEBio's last output time: 90.2 here, 89.6 in FEBio;
  • first principal stress of every element of the six leaflet regions, at FEBio's 394 output times: 0.5 percent median difference (root mean square over elements, relative to the root mean square stress);
  • this run continues to time 0.02 (286 steps, 1252 Newton iterations, 8 minutes on a Quadro RTX 8000 with the optional cudss solve).

FEBio ran the input with BFGS and tangent_scale 10 and takes other time steps, so the run is interpolated in time for the comparison and the agreement is at the level those differences allow, not to round-off.

For gradients: a smooth alternative to the normal test. w_tol switches pairs by the solution, which is what a gradient through closure cannot have. The note measures a variant that excludes pairs by reference distance instead, as the original formulation does (Kamensky et al. 2018): contact starts when FEBio's does, the stresses agree as well, the run takes a third of the time, and the contact area is 17 percent lower for a reason not yet separated (decision K6). Nothing of that variant is in the code as a setting yet; it is piece 5 of the plan.

The plan from here is in the note as ten pieces by package, each with what it will be checked against, and four new decision points (K6 to K9), among them a question for the FEBio team: FEBio 4.13.0 does not read this input as written (it rejects <laugon>PENALTY</laugon>), and whether a current build completes it is not known.

Validation

  • Tests added or changed: tests/test_contact_in_run.py (contact outputs per state).
  • FEBio reference (input file, quantity compared, tolerance, FEBio version), or N/A: references/febio/originals/cardiofem/valve_pressurization/mitral_p2prolapse.feb against the element data and contact area files in febio_results/ (FEBio 4.9.0), as above. This comparison is an example and not a test: it needs a GPU and the optional cudss solve to finish in minutes.
  • Devices the full tier ran on (CPU, and the GPU model if CUDA; say so clearly if no GPU was used): quick tier on CPU (235 tests); contact tests in the full tier on a Quadro RTX 8000 (cuda:0); the example on the same GPU from an environment with nvmath-python. The full tier as a whole was not rerun for this change.

Checklist

  • I have read the contributing guide.
  • uvx pre-commit run --all-files passes.
  • The full tier passes. (Quick tier on CPU and the contact tests on a GPU; the CI job runs the full tier on CPU.)
  • If this changes what a design note says, the note is updated; open design questions are in its decision points, not only in this pull request.
  • The change is focused, and every commit is signed off (git commit -s).

🤖 Generated with Claude Code

mattjolley and others added 3 commits November 28, 2026 11:01
…rgy per state

A contact interface's outputs are kept in the results of every state
under the interface's name. "contact area" is FEBio's surface data of
that name for the contact potential: the area of the integration points
with a nonzero force (the rule of Wu et al. 2022). On the open mitral
input it is 90.2 where FEBio's is 89.6 at FEBio's last output time. It
is a sum of step functions of the state, so it is an output and not an
objective.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
cuDSS does the host part of its analysis (reordering) on one thread
unless it is given a threading layer, and nvmath-python warns at every
analysis. Contact repeats the analysis whenever the pairs change, so
both the time and the noise added up. The OpenMP layer that the cuDSS
wheel ships is now passed when it is found.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
examples/valve/mitral_closure.py runs the open mitral input (FEBio
model repository project 134: 7,200 quad4 shells, 100 chord springs,
pressure, mass damping, leaflet self-contact, dynamic) and compares it
in time with the FEBio results kept beside the input. With FEBio's
line search and FEBio's exclusion of neighboring elements the run goes
through leaflet closure to the end (286 steps, 1252 Newton iterations,
8 minutes on a Quadro RTX 8000 with the cudss solve). Against the
stored FEBio 4.9.0 run, which ends in an error at time 0.0135 of 0.02:
contact starts at the same time (0.00304); the closed contact area is
90.2 against 89.6; and the first principal stress of the elements of
the six leaflet regions, at FEBio's 394 output times, differs by 0.5
percent in the median. FEBio used BFGS and tangent_scale and takes
other time steps, so this is agreement at the level those differences
allow, not to round-off.

docs/design/contact_in_run.md (v0.4) records what was tried to get
there and what each change did; a smooth alternative to the normal
test w_tol for gradients (exclusion by reference distance, as the
original formulation does), with its measurements; the plan from here
in ten pieces by package; and four new decision points (K6 to K9).
README, the design overview, the work plan, the deviations note and
the README of the reference input are brought up to date.

The example needs a GPU and the optional cudss solve to finish in
minutes, so it is not a test.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Matthew Jolley <12954190+mattjolley@users.noreply.github.com>
@mattjolley
mattjolley merged commit 6235a85 into main Nov 28, 2026
2 checks passed
@mattjolley
mattjolley deleted the mattjolley/mitral-closure branch November 28, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant