Skip to content

Commit 65e2b09

Browse files
authored
Merge pull request #306 from Deltares/BMI
BMI: bug fixes and updates
2 parents 91a8572 + 0c93da7 commit 65e2b09

18 files changed

+725
-465
lines changed

docs/src/changelog.md

+14
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
- Documentation: add leakage term to the wflow\_sbm figure, document external input
1212
parameter `ksathorfrac` and fix description of adding external `inflow` to the kinematic
1313
wave.
14+
- Fixed BMI functions (e.g. `BMI.get_value`) that deviated from BMI specifications
15+
(BasicModelInterface.jl), including function arguments, return types and the BMI
16+
specification that arrays are always flattened (this was not the case for variables stored
17+
as 2-dimensional arrays or as vector of SVectors).
1418
- Bump compat for NCDatasets to 0.13.
1519

1620
### Changed
1721
- For cyclic parameters different cyclic time inputs are supported (only one common cyclic
1822
time (for example daily or monthly) was allowed).
23+
- BMI: 1) added grid information (type and location) and whether a variable can be exchanged
24+
to metadata Structs, 2) extend model grid functions for Wflow components that store
25+
variables on `edges` (local inertial model) with `get_grid_edge_count` and
26+
`get_grid_edge_nodes`.
27+
28+
### Added
29+
- Functions for loading and saving states and getting the `starttime` in Unix time format.
30+
This is convenient for coupling with OpenDA (and other external) software. The set states
31+
functionality from the initialization function has been moved to a separate `set_states`
32+
function for each `Model` type, to support loading states independent of initialization.
1933

2034
## v0.7.2 - 2023-09-27
2135

docs/src/user_guide/additional_options.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,10 @@ in the [Julia programming language](https://julialang.org/), makes use of the fo
191191
version.
192192

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

199199
### Configuration
200200
The variables that Wflow can exchange through BMI are based on the different model
@@ -219,6 +219,12 @@ Wflow.BMI.initialize
219219
Wflow.BMI.get_input_var_names
220220
```
221221

222+
Variables with a third dimension, for example `layer` as part of the vertical `SBM` concept,
223+
are exposed as two-dimensional grids through the Wflow BMI implementation. For these
224+
variables the index of this third dimension is required, by adding `[k]` to the variable
225+
name (`k` refers to the index of the third dimension). For example, the variable
226+
`vertical.vwc[1]` refers to the first soil layer of the vertical `SBM` concept.
227+
222228
### Couple to a groundwater model
223229
For the coupling of wflow\_sbm (SBM + kinematic wave) with a groundwater model (e.g.
224230
MODFLOW) it is possible to run:

src/Wflow.jl

+5-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ using Polyester
2222
using LoopVectorization
2323
using IfElse
2424

25-
@metadata get_units "mm Δt-1"
25+
@metadata get_units "mm Δt-1" String
26+
# metadata for BMI grid
27+
@metadata exchange 1 Integer
28+
@metadata grid_type "unstructured" String
29+
@metadata grid_location "node" String
2630

2731
const BMI = BasicModelInterface
2832
const Float = Float64

0 commit comments

Comments
 (0)