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

BMI: bug fixes and updates #306

Merged
merged 22 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/src/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Documentation: add leakage term to the wflow\_sbm figure, document external input
parameter `ksathorfrac` and fix description of adding external `inflow` to the kinematic
wave.
- Fixed BMI functions (e.g. `BMI.get_value`) that deviated from BMI specifications
(BasicModelInterface.jl), including function arguments, return types and the BMI
specification that arrays are always flattened (this was not the case for variables stored
as 2-dimensional arrays or as vector of SVectors).

### Changed
- For cyclic parameters different cyclic time inputs are supported (only one common cyclic
time (for example daily or monthly) was allowed).
- BMI: 1) added grid information (type and location) and whether a variable can be exchanged
to metadata Structs, 2) extend model grid functions for Wflow components that store
variables on `edges` (local inertial model) with `get_grid_edge_count` and
`get_grid_edge_nodes`.

### Added
- Functions for loading and saving states and getting the `starttime` in Unix time format.
This is convenient for coupling with OpenDA (and other external) software. The set states
functionality from the initialization function has been moved to a separate `set_states`
function for each `Model` type, to support loading states independent of initialization.

## v0.7.2 - 2023-09-27

Expand Down
14 changes: 10 additions & 4 deletions docs/src/user_guide/additional_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ in the [Julia programming language](https://julialang.org/), makes use of the fo
version.

For the BMI implementation of Wflow all grids are defined as [unstructured
grids](https://bmi-spec.readthedocs.io/en/latest/model_grids.html#unstructured-grids). While
the input (forcing and model parameters) is structured (uniform rectilinear), internally
wflow works with one dimensional arrays based on the active grid cells of the 2D model
domain.
grids](https://bmi-spec.readthedocs.io/en/latest/model_grids.html#unstructured-grids),
including the special cases `scalar` and `points`. While the input (forcing and model
parameters) is structured (uniform rectilinear), internally wflow works with one dimensional
arrays based on the active grid cells of the 2D model domain.

### Configuration
The variables that Wflow can exchange through BMI are based on the different model
Expand All @@ -219,6 +219,12 @@ Wflow.BMI.initialize
Wflow.BMI.get_input_var_names
```

Variables with a third dimension, for example `layer` as part of the vertical `SBM` concept,
are exposed as two-dimensional grids through the Wflow BMI implementation. For these
variables the index of this third dimension is required, by adding `[k]` to the variable
name (`k` refers to the index of the third dimension). For example, the variable
`vertical.vwc[1]` refers to the first soil layer of the vertical `SBM` concept.

### Couple to a groundwater model
For the coupling of wflow\_sbm (SBM + kinematic wave) with a groundwater model (e.g.
MODFLOW) it is possible to run:
Expand Down
6 changes: 5 additions & 1 deletion src/Wflow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ using Polyester
using LoopVectorization
using IfElse

@metadata get_units "mm Δt-1"
@metadata get_units "mm Δt-1" String
# metadata for BMI grid
@metadata exchange 1 Integer
@metadata grid_type "unstructured" String
@metadata grid_location "node" String

const BMI = BasicModelInterface
const Float = Float64
Expand Down
Loading
Loading