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
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.:nonlinear solve per increment).
branch onto
run_simulation(main.cpp#L558) that bypassesiterate_solutionentirely (partitioned_fsi->run()vsiterate_solution()).As more schemes are added, this pushes scheme-specific control flow into
main.cppinstead of behind a clean interface. This refactor is also a prerequisite for #554.Solution
Replace the free
iterate_solutionwith a polymorphic time-stepping abstraction — e.g. a virtualSimulation::run()(or aTimeIntegrator/strategy object) — where: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