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

Clean up code for Formulation in advance of Coastal introduction #815

Merged

Conversation

PhilMiller
Copy link
Contributor

@PhilMiller PhilMiller commented May 5, 2024

I want to slot in new code for Coastal total water level (TWL) functionality as cleanly as possible with the existing code base. In particular, it seems like CoastalFormulation should be a natural analog to the existing CatchmentFormulation. A lot of stuff there in the baseFormulation interface right now is specific to the existing lumped catchment models, or is just defunct. I try to clean out what's gotten in my way so far, to make the subsequent additions easier.

Additions

None

Removals

  • Nexus Manager class stub that was added years ago and never fleshed out or used
  • Scalar overload of Formulation::get_var_value_as_double, which was papering over an assumption of single element arrays that we agreed should be made more explicit

Changes

  • Move various functionality that's largely specific to our implementation of lumped catchments down from the Formulation base class to the CatchmentFormulation intermediate class
  • Move functionality duplicated across the several Bmi_{C,Cpp,Fortran,Py}_Formulation up to their common base Bmi_Module_Formulation class
  • Move arrays of variable names describing required parameters to BMI modules to class static members, to avoid duplicate allocation per instance.

Testing

  1. Local testing on macOS
  2. CI

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 ➡️

@PhilMiller PhilMiller requested a review from hellkite500 May 5, 2024 00:55
@PhilMiller PhilMiller changed the title Clean up code for Formulation et al in advance of Coastal introduction Clean up code for Formulation in advance of Coastal introduction May 5, 2024
Copy link
Contributor

@donaldwj donaldwj left a comment

Choose a reason for hiding this comment

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

I dont see any major issues. I am curious on some of the instances of removing virtual from functions that are now implemented but those are not an actual problem. I do think fully implementing get_value would make sense here.

@PhilMiller
Copy link
Contributor Author

I think this is mostly in shape to clear the path for Coastal needs. I'm still uncertain about create_formulation, but that could be addressed in a subsequent PR.

@PhilMiller PhilMiller marked this pull request as ready for review May 7, 2024 16:17
@PhilMiller PhilMiller force-pushed the PhilMiller/formulation-cleanup-pre-coastal branch from dd6f033 to d5318a5 Compare May 8, 2024 15:04
@donaldwj donaldwj merged commit feb0af0 into NOAA-OWP:master May 10, 2024
19 checks passed
@PhilMiller PhilMiller deleted the PhilMiller/formulation-cleanup-pre-coastal branch May 10, 2024 15:21
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.

2 participants