Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layer and DomainLayer Formulation Management #752

Merged
merged 13 commits into from
Apr 8, 2024

Conversation

hellkite500
Copy link
Member

@hellkite500 hellkite500 commented Mar 1, 2024

Supporting model layers which don't have a 1-1 model -> catchment association requires additional configuration and management. This PR addresses 3 key components for supporting model layers.

  1. Refactoring of layer configuration parsing
  2. Creation of layer formulation attaching a model formulation to the layer
  3. A DomainLayer abstraction which associates a single formulation with the entire simulation domain (hydrofabric) instead of a subset of catchment features.

Additions

  • DomainLayer subclass of the Layer abstraction
  • ngen::config::Layer for parsing layer configurations
  • Formulation_Manager attribute and functions for managing "Domain Layer" formulations.

Removals

Changes

  • Refactored parsing in Formulation_Manager using the ngen::config::Layer structure
  • Refactored main in Ngen.cpp to support creation of DomainLayers and

Testing

  1. This work was used in testing the initial NOM gridded model runs via ngen. Additional unit/integration testing should be added.

Todos

  • A couple of TODO's and FIXME's are noted in the code. The FIXME particularly in the case of parsing Layer configurations with invalid configurations should likely be addressed before merging. This should likely throw a std::runtime error as used in some other config parsing when required missing keys are not found. I'll try to get this added ASAP while the other components are being reviewed. FIXME addressed in 88f3d23

  • Need to add some unit test code as well.

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows project standards (link if applicable)
  • Passes all existing automated tests
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future todos are captured in comments
  • Project documentation has been updated (including the "Unreleased" section of the CHANGELOG)
  • Reviewers requested with the Reviewers tool ➡️

Target Environment support

  • Linux
  • MacOS

@hellkite500 hellkite500 changed the title Layer formulation Layer and DomainLayer Formulation Management Mar 1, 2024
src/NGen.cpp Show resolved Hide resolved
include/realizations/config/layer.hpp Outdated Show resolved Hide resolved
include/realizations/catchment/Formulation_Manager.hpp Outdated Show resolved Hide resolved
include/realizations/catchment/Formulation_Manager.hpp Outdated Show resolved Hide resolved
include/core/DomainLayer.hpp Outdated Show resolved Hide resolved
include/core/DomainLayer.hpp Outdated Show resolved Hide resolved
* @brief Run one simulation timestep for this model associated with the domain
*/
void update_models() override{
formulation->get_response(output_time_index, simulation_time.get_output_interval_seconds());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its for sure worth noting here and in the constructor description a DomainLayer's relationship with NextGen's concept of a nexus.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in 291900e

}

/**
* @brief Determins if the layer has a valid configured formulation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo 'Determines'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 88f3d23

Comment on lines +115 to +108
construct_formulation_from_config(simulation_time_config,
"layer-"+std::to_string(layer_desc.id),
layer.formulation,
output_stream
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is duplicated from formulation initialized just above on line 104

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed duplicate in 581e8e5

@hellkite500
Copy link
Member Author

Would be beneficial to have this merged before #744 is ready for review/merge. After talking with @donaldwj about the netcdf semantics, we are going to tie those to the Layer abstraction and hook into the Formulation to get variable meta data. With these, we should have enough information to create the netcdf dimensions needed and look to efficient array writes to the output files based on the feature sets of a given layer.

Copy link
Contributor

@program-- program-- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few typos, but once those are fixed it looks good to me.

include/core/DomainLayer.hpp Outdated Show resolved Hide resolved
include/core/Layer.hpp Outdated Show resolved Hide resolved
Co-authored-by: Justin Singh-M. - NOAA <[email protected]>
@hellkite500 hellkite500 merged commit 7dd3ad1 into NOAA-OWP:master Apr 8, 2024
19 checks passed
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.

4 participants