Skip to content

FT runtime scheme selection design and implementation - #72

Open
HendrikTolman-NOAA wants to merge 91 commits into
NOAA-EMC:developfrom
HendrikTolman-NOAA:FT-Runtime-Scheme-Selection-Design
Open

HendrikTolman-NOAA wants to merge 91 commits into
NOAA-EMC:developfrom
HendrikTolman-NOAA:FT-Runtime-Scheme-Selection-Design

Conversation

@HendrikTolman-NOAA

Copy link
Copy Markdown
Contributor

Description

This PR implements a Factory Pattern based method after we settled on this architecture in previous discussion and issues. It provides

  • The full core implementation of the Factory Pattern Approach
  • A directory structure to cleanly manage and separate code for individual solvers and physics options
  • A YAML based setup for run-time selection of options

It does not provide

  • Grid descriptions
  • General Data structures
  • Any solver or physics code

Note that we have only limited experience with Factory Patterns. As we add grids and data structures, and after that model input and output as well as science code, we will assure that the Factory Patterns approach works as intended, i.e., “compile once, load only what you use”.

Issue(s) addressed

Commit Message

Implements the core Factory Pattern based run-time selection of user requests for major model options. The includes placeholder files for the three major grid-numerics-solver options, and an initial set of source term options, but no codes for physical parameterizations or numerical solvers. The user selection of these options is added to the run time configuration YAML file.

Check list

  • Branch is up to date with the authoritative repository (NOAA-EMC) develop branch.

Testing

The branch passes all testing in the GitHub workflow, as well as testing with Jules as outlined in the AGENTS.md file. It has been compiled and run successfully on NOAA’s Ursa supercomputer, and on Hendrik’s Macbook Air.

google-labs-jules Bot and others added 30 commits June 23, 2026 20:05
- Define IPropagationScheme and ISourceTerm abstract interfaces.
- Implement SchemeFactory for runtime instantiation of model schemes.
- Implement PropagationPr3 and SourceSt4 concrete placeholder classes.
- Implement WaveModel for simulation orchestration.
- Update CMakeLists.txt to include the ww4_core library and tests.
- Add unit and integration tests for factory and model orchestration.

This transition from compile-time switches to runtime selection enables
greater flexibility and modularity in WAVEWATCH IV while maintaining
high-performance through the use of std::span and high-granularity
interfaces.

Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
- Define IPropagationScheme and ISourceTerm abstract interfaces.
- Implement SchemeFactory for runtime instantiation of model schemes.
- Implement PropagationPr3 and SourceSt4 concrete placeholder classes.
- Implement WaveModel for simulation orchestration.
- Update CMakeLists.txt to include the ww4_core library and tests.
- Add unit and integration tests for factory and model orchestration.
- Address CI failures by ensuring full clang-format compliance.

This transition from compile-time switches to runtime selection enables
greater flexibility and modularity in WAVEWATCH IV while maintaining
high-performance through the use of std::span and high-granularity
interfaces.

Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
- Define IPropagationScheme and ISourceTerm abstract interfaces.
- Implement SchemeFactory for runtime instantiation of model schemes.
- Implement PropagationPr3 and SourceSt4 concrete placeholder classes.
- Implement WaveModel for simulation orchestration.
- Update CMakeLists.txt to include the ww4_core library and tests.
- Add unit and integration tests for factory and model orchestration.
- Provide ARCHITECTURE.md with Mermaid diagrams for design patterns.
- Ensure full clang-format compliance and all 40 tests passing.

Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
- Refactor IPropagationScheme to manage and call source terms internally.
- Update WaveModel to orchestrate the model through propagation schemes.
- Provide ARCHITECTURE.md with diagrams reflecting the integrated architecture.
- Update unit and integration tests to verify the integrated execution flow.
- Ensure C++20 compliance and Doxygen standards throughout.

Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
- Refactor IPropagationScheme to manage and call source terms internally.
- Update WaveModel to orchestrate the model through propagation schemes.
- Provide ARCHITECTURE.md with diagrams reflecting the integrated architecture.
- Update unit and integration tests to verify the integrated execution flow.
- Ensure C++20 compliance and full clang-format compliance.

Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
- Rename "Propagation Scheme" to "Solver" to better reflect its role in
  integrating dynamics and physics.
- Update ISolver interface and SolverPr3 implementation to manage and call
  source terms internally.
- Refactor WaveModel to orchestrate the simulation step via the Solver.
- Update ARCHITECTURE.md with diagrams and documentation for the integrated
  solver architecture.
- Standardize all new headers to use #pragma once guards.
- Update unit and integration tests to verify the integrated solver flow.

Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
- Rename "Propagation Scheme" to "Solver" to better reflect its role in
  integrating dynamics and physics.
- Update ISolver interface and SolverPr3 implementation to manage and call
  source terms internally.
- Refactor WaveModel to orchestrate the simulation step via the Solver.
- Update ARCHITECTURE.md with diagrams and documentation for the integrated
  solver architecture.
- Ensure full clang-format compliance and 40/40 tests passing.

Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
- Refactor propagation schemes to an integrated "Solver" architecture.
- Update WaveModel to orchestrate the model through the Solver interface.
- Standardize all doxygen dates to June 24, 2026.
- Provide ARCHITECTURE.md with Mermaid diagrams for the new architecture.
- Ensure C++20 standards, performance optimizations (std::span), and full test coverage.

Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
Fixes duplicate ww4_core target definitions in CMakeLists.txt.
Consolidates all tests under tests_L1_L2/ to resolve merge
conflicts between tests/ and tests_L1_L2/ directories. All 117
tests compile and pass successfully.

Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
Resolves duplicate target definitions in CMakeLists.txt and
consolidates the unit and integration tests into the upstream-consistent
'tests/' directory, applying proper prefix naming conventions.
All 117 tests compiled and passed successfully.

Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
Resolves duplicate target definitions in CMakeLists.txt and
consolidates the unit and integration tests into the upstream-consistent
'tests/' directory, applying proper prefix naming conventions.
All 117 tests compiled and passed successfully.

Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
…58095-5826f240

Fix CMake configuration and consolidate test suite
…ries

- Add SolverType enum (UQ, Triangular, SMC) and mandatory physics.solver config parsing
- Create solver_uq, solver_triangular, solver_smc, and ww4_source_terms directories in ww4_core with stub files
- Remove solver_pr3 and source_st4 stub files
- Add solver call routines (w4core_wave_uq, w4core_wave_triangular, w4core_wave_smc) and dispatch in w4core_wave.cpp
- Update SchemeFactory, CMakeLists.txt, and unit/integration tests

Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
Update solver call routines in w4core_wave.cpp to log solver execution when screen output level is full, satisfying cppcheck constParameterReference style checks.

Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
…c-16863559296188978301

Add numerical solver selection logic and restructure ww4_core solver directories
…utines

- Rename source_terms_stub.hpp/.cpp and SourceTermsStub to compute_all_sources.hpp/.cpp and ComputeAllSources.
- Add virtual init() method to ISolver interface.
- Add w4core_init_uq, w4core_init_triangular, and w4core_init_smc solver initialization routines.
- Dispatch solver initialization in w4core_init based on configured solver type.
- Add unit tests for ComputeAllSources and solver initialization routines.

Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
…s names

- Rename source_terms_stub files and class to compute_all_sources and ComputeAllSources.
- Add virtual init() method to ISolver interface.
- Add w4core_init_uq, w4core_init_triangular, and w4core_init_smc solver initialization routines dispatched from w4core_init.
- Rename SolverUQ to SolverRectangularGrid, SolverTriangular to SolverTriangularGrid, and SolverSMC to SolverSMCGrid per user request.
- Update SchemeFactory and test suite to support updated solver names and ComputeAllSources.

Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
…s names and dates

- Rename source_terms_stub files and class to compute_all_sources and ComputeAllSources.
- Add virtual init() method to ISolver interface.
- Add w4core_init_uq, w4core_init_triangular, and w4core_init_smc solver initialization routines dispatched from w4core_init.
- Rename SolverUQ to SolverRectangularGrid, SolverTriangular to SolverTriangularGrid, and SolverSMC to SolverSMCGrid per user request.
- Update header last update dates to 2026-09-22.
- Update SchemeFactory and test suite to support updated solver names and ComputeAllSources.

Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
…nd-add-solver-init-1251910215315944101

Rename source_term_stub to compute_all_sources and add solver init routines
Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
…nsion

Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
…to WaveModelSolver

Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
…re documentation

Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
…-ww4-core-to-src-15845788654555195373

Incremental development of option selection implementation. This one has the solver selection relatively clean, but needs more work on the source term selection.
Centralize source term execution within ComputeAllSources, which dynamically
creates and invokes selected input/dissipation (ST1, ST4, DoNotUse) and
nonlinear interaction (NL1, NL3, DoNotUse) source terms via SchemeFactory.
Add mandatory input_dissipation and nonlinear_interactions configuration
options to ww4_run_config.yaml.

Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
HendrikTolman-NOAA and others added 10 commits September 30, 2026 11:34
Format src/ww4_utils/ww4_run_config.cpp with clang-format to satisfy
C++ linting standards. Update unit test expected string assertions in
L1_test_ww4_run_config.cpp and L2_test_w4core_hom_input.cpp to match
the updated column 31 report output formatting.

Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
…42903-91eed339

Fix code compliance and update report formatting test expectations
Updated configuration options for simulation settings, including enabling standard output, log file production, and various propagation options. Adjusted output request settings for fields, points, and restart files.
@HendrikTolman-NOAA

HendrikTolman-NOAA commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author

@ardhuin, @mickaelaccensi, @ukmo-ccbunney, @ukmo-juan-castillo, @ukmo-jianguo-li, @ukmo-kitstokes, @ukmo-daisybrown, @thesser1, @benoitp-cmc, @aronroland, @jcwarner-usgs, @sbrus89, @ErickRogers, @OceanYu2022

@JessicaMeixner-NOAA, @kestonsmith-noaa, @mingchen-NOAA, @sbanihash, @EJRainville-NOAA, @DeniseWorthen, @aerorahul, @mwilliswave

Hi Folks,

I just put in a PR #72 with some significant code updates, that is, using YAML and Factory Patterns to do run-time option selection (compile once, load only what you use, no more switch file), a corresponding directory structure, and placeholders for three grid-scheme-solver options as well as the first 10 source term options. You can see a graphic representation in the architecture in https://github.com/HendrikTolman-NOAA/WW4_HLT/blob/FT-Runtime-Scheme-Selection-Design/ARCHITECTURE.md, and documentation on the YAML input in https://github.com/HendrikTolman-NOAA/WW4_HLT/blob/FT-Runtime-Scheme-Selection-Design/templates/ww4_run_config.yaml

I hope to merge this PR next Friday (Oct 9), but no later than the week after (Oct 16). I am not asking for a formal review from any of you other than those already identified in the PR, but I would love to have some eyes-on earlier rather than later. Thanks for all your input so far!

@JessicaMeixner-NOAA

Copy link
Copy Markdown
Contributor

I just put in a PR #71 with some significant code updates, that is, using YAML and Factory Patterns to do run-time option

Do you have a typo here @HendrikTolman-NOAA ? PR #71 is updating the documentation. PR #72 (this PR) I believe is what you are describing.

@HendrikTolman-NOAA

Copy link
Copy Markdown
Contributor Author

@jcwarner-usgs

jcwarner-usgs commented Sep 30, 2026 via email

Copy link
Copy Markdown

@ardhuin

ardhuin commented Sep 30, 2026 via email

Copy link
Copy Markdown

google-labs-jules Bot and others added 5 commits October 1, 2026 17:04
Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
…1208-26048c29

Synch branch with upstream develop
…910876568821208-26048c29

Revert "Synch branch with upstream develop"
@HendrikTolman-NOAA

Copy link
Copy Markdown
Contributor Author

I am presently synching the branch to be merged with the upstream after a PR was merged.

google-labs-jules Bot and others added 2 commits October 1, 2026 18:06
Fix conflict markers in src/ww4_core/w4core_finalize.cpp and
src/ww4_utils/ww4_run_config.cpp, correcting function calls and
updating documentation dates to ensure build and test conformity.

Co-authored-by: HendrikTolman-NOAA <237313876+HendrikTolman-NOAA@users.noreply.github.com>
…7760-6b015869

Resolve git conflict markers and check code conformity
@HendrikTolman-NOAA

Copy link
Copy Markdown
Contributor Author

@jcwarner-usgs

For now, I just picked 10 general source terms to have enough to set up the architecture. This was not intended as a definite list, and we will add many more, at least covering the topics of depth-limited breaking, triad interactions, reflections and wave-ice interactions. Sorry for the confusion!

@HendrikTolman-NOAA HendrikTolman-NOAA linked an issue Oct 5, 2026 that may be closed by this pull request

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement model option processing Settle standard for in-line comment-line documentation, including numbering of comments

4 participants