SimVascular / SimVascular/svMultiPhysics

Refactor the time iteration loop

Open
#576 9 comments 1 reaction 1 assignee View on GitHub

@Eleven7825 is already working on this.

Since Jun 29, 2026.

enhancement
Dominant language
C++
Stars
45
Forks
60
Avg merge
5d 23h
Merged PRs (30d)
11

Description

Problem

The main time-stepping loop lives in the free function iterate_solution
(Code/Source/solver/main.cpp#L159). It hard-codes a single solution strategy: each time step runs the nonlinear (Newton) solve once. There is no extension point for schemes that need a different per-step structure, e.g.:

  • Load stepping for G&R problems (apply the load in increments, with a
    nonlinear solve per increment).
  • Alternative coupling drivers — the partitioned FSI work already had to bolt a
    branch onto run_simulation (main.cpp#L558) that bypasses
    iterate_solution entirely (partitioned_fsi->run() vs iterate_solution()).

As more schemes are added, this pushes scheme-specific control flow into main.cpp instead of behind a clean interface. This refactor is also a prerequisite for #554.

Solution

Replace the free iterate_solution with a polymorphic time-stepping abstraction — e.g. a virtual Simulation::run() (or a TimeIntegrator /strategy object) — where:

  • the default implementation is today's loop (one nonlinear solve per step), preserving current behavior;
  • subclasses / strategies override the per-step behavior — G&R load stepping, partitioned FSI coupling, etc.;
  • main.cpp calls only the polymorphic entry, so no scheme-specific branching remains there (the run_simulation partitioned-FSI branch is subsumed).

This gives G&R a natural entry point for load steps and lets #554 plug in without touching main.cpp.

Additional context

No response

Code of Conduct
  • I agree to follow this project's Code of Conduct and Contributing Guidelines

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.