Skip to content

Refactor the time iteration loop #576

Description

@Eleven7825

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions