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

Wflow ZMQ Server #356

Merged
merged 54 commits into from
Feb 27, 2024
Merged

Wflow ZMQ Server #356

merged 54 commits into from
Feb 27, 2024

Conversation

verseve
Copy link
Contributor

@verseve verseve commented Feb 12, 2024

Issue addressed

Fixes #93

Explanation

See also issue #93. We decided to use ZeroMQ instead of Thrift (used in the wflow Python version, Thrift Julia version seems not very active), with JSON messaging to run Wflow functions exposed through BMI and three additional Wflow functions related to state handling and Unix time. The Wflow ZMQ Server can be used to couple external software packages (other programming language than Julia), for example with the data-assimilation software OpenDA (Java). The Wflow ZMQ Server is not part of the Wflow.jl project (src\), and is located in directory server\, including a README.md with instructions how to start the server.

Checklist

  • Updated tests or added new tests
  • Branch is up to date with master
  • Tests & pre-commit hooks pass
  • Updated documentation if needed
  • Updated changelog.md if needed

Additional Notes (optional)

The server is tested against the Master branch of Wflow.jl.

vers-w added 26 commits January 16, 2024 11:54
initialization of Wflow model
also changed the `ModelHandler` so the same `wflow_bmi` function can be used for initialization and other BMI functions.
should have been part of previous 2 commits...
Move set states functionality from initialization function to a separate `set_states` function for each Model type. It also makes coupling to OpenDA more convenient (load and save states from OpenDA).
- fix list of exchange variables, if a model does not include reservoirs or lakes, these variables should be left out.
- add grid types "scalar" (for uniform/constant variables) and "none" (for variables not related to a model grid)
- add "flextopo" model
SurfaceFlow is used for both kinematic wave river and overland flow. This is now split into structs SurfaceFlowRiver and SurfaceFlowLand. It simplifies the orginal update function (split into two, logic easier to follow), and dispatching on these types is easier (e.g. for BMI to extract relevant properties as grid type).
- use simulation starttime as t = 0 (not 1970).
- BMI.get_time_units: return "s" (instead of "seconds since 1970-01-01T00:00:00").
- BMI.get_time_units now gets called on the model rather than the type.
to get a reference datetime. Model start time (BMI) returns always 0.0.
ZMQ port number can be provided as command line argument (default = 5555).
change of `starttime` definition
File was not up-to-date with Master.
Scalar variables are not exposed through BMI.
Also update docs Wflow.jl (mention possibilty to run Wflow as a server).
@verseve verseve linked an issue Feb 12, 2024 that may be closed by this pull request
@verseve verseve requested review from visr and evetion February 12, 2024 15:16
@verseve verseve self-assigned this Feb 12, 2024
vers-w and others added 5 commits February 19, 2024 13:10
@verseve
Copy link
Contributor Author

verseve commented Feb 19, 2024

Left some comments. This looks good overall. There are tests added, but I see no changes to CI. Can this run on GitHub Actions as well?

Thanks for the useful comments. I did address all comments except about changes to CI (I agree and will also change this).

@verseve verseve requested a review from visr February 21, 2024 10:31
Copy link
Member

@visr visr left a comment

Choose a reason for hiding this comment

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

Looks good!

@verseve verseve merged commit eef3d1f into master Feb 27, 2024
16 checks passed
@verseve verseve deleted the zmq_server branch February 27, 2024 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
coupling For coupling Wflow to other models/software
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenDA coupling
3 participants