neofoam.framework.initialization

Populate a Context before any operation runs.

NeoFOAM solvers can’t start their main loop until fields, operators, models, and the mesh are constructed and wired together. This package owns that pre-run work and splits it into three layers:

  • Steps & helpers — the unit of deferred initialization is an InitStep: a name, its dependencies, and a factory callable. The four helpers (field(), operator(), model(), lazy()) apply the canonical name prefix and category; InitializerBuilder collects them via a fluent API.

  • Executionexecute_initialization() validates the step graph, sorts topologically, runs each step in order, and routes the results into the Context. See execution.

  • Three-stage pipeline — for solvers that need to LOAD → RESOLVE → BUILD, StagedInitSpec (decorator-driven registration) plus StagedInitRunner (execution) orchestrate the three stages and hand off to execute_initialization() at the end. See staged.

Dependency injection of resolved values into solver callbacks is expressed with Depends; routing is open for extension via CategoryRouter (register a custom handler, pass it to execute_initialization()).

See Three-stage initialization for the design rationale and stage semantics.