SimVascular / SimVascular/svMultiPhysics
Refactor the time iteration loop
@Eleven7825 is already working on this.
Since Jun 29, 2026.
- 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 ontorun_simulation(main.cpp#L558) that bypasses
iterate_solutionentirely (partitioned_fsi->run()vsiterate_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.cppcalls only the polymorphic entry, so no scheme-specific branching remains there (therun_simulationpartitioned-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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.