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

MCT diffusive wave routing #179

Open
wants to merge 141 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
b7039ee
Initial commit for mct routing
Jan 25, 2023
0707df2
Refactored kinematic routing only
Mar 23, 2023
beab041
Refactored split routing
Mar 23, 2023
b8d98e3
Refactored InitLisflood
Mar 23, 2023
800b706
Init Kin and Split routing refactored and giving same results
Mar 24, 2023
55543a4
initialisation for MCT
Mar 24, 2023
7350d44
Wiring of MCT function
Mar 29, 2023
660e373
Added utility functions qdy, hdv and scalax (Newton-Raphson)
Mar 30, 2023
a27c8fc
Added core of the function for Muskingum-Cunge-Todini routing
Mar 31, 2023
d67b56e
Bugfix FORTRAN->Python3
Mar 31, 2023
1060c65
MCT inputs/outputs and bugfixes
Apr 5, 2023
0282a55
Added documentation for Kinematic routing
Apr 5, 2023
a779a7b
Calc average outflow for kinematic routing
Apr 14, 2023
375f647
Renaming functions
Apr 19, 2023
f9902c8
Fixed cold start initialization for MCT
Apr 19, 2023
2c1e9fb
Renamed scalax to hoq
Apr 26, 2023
9b7c49e
first outputs
Apr 26, 2023
6da7853
Introducing mctWave and mct_river_routing
Apr 27, 2023
290c0a0
found a way to loop over channel pixels
Apr 28, 2023
2f7c137
Adding comments to kinematic wave parallel
May 10, 2023
52553f3
Refactored MCT to work on a single pixel. Introduced looping on MCT p…
May 11, 2023
731de2b
Added lateral flow to MCT
May 15, 2023
2356810
First working version of MCT with lateral flow
May 16, 2023
b21a175
Code clean up
May 18, 2023
9942231
trying to calculate average discharge
May 19, 2023
8ab14cd
Using ChanQ and not the averege
May 19, 2023
90df095
Code clean up
May 31, 2023
de44f9e
Comments and Kinematic mass balance
Feb 2, 2024
95ad2ff
Uncommented mass balance error calculation
Feb 13, 2024
a84fa49
ChanQ and ChanM3 moved from dynamic to routing
Feb 13, 2024
93245bc
checking riverbed slope for MCT cells
Feb 16, 2024
9b2ed0e
cleaning up LddChan
Feb 16, 2024
820d254
added reservoirs and lakes to MCT routing
Feb 16, 2024
fd3c746
Cleaned up routing code (initial)
Feb 19, 2024
9255b4f
Cleaned up routing code (dynamic)
Feb 20, 2024
6389294
Restored check for riverbed slope in MCT grid cells
Feb 20, 2024
61db039
added inflows to mct routing
Feb 29, 2024
ef55bb8
Porting mct_routing from Lisflood version 4.1 to 4.3.1
Mar 20, 2024
3dfd192
water evaporating from total water volume in channel
Mar 22, 2024
5eb4d3a
water abstraction from total water volume in river channel
Mar 22, 2024
8432a7f
added variable to set maximum riverbed slope for mct routing grid cells
Mar 25, 2024
51f9f3c
using generic LddStructureChan and IsUpOfStructureChan
Mar 26, 2024
04914a4
added dynamic test for inflow
Mar 27, 2024
44660a1
Added dynamic test for inflow
Apr 3, 2024
08c4ae4
added comments
Apr 4, 2024
e94f979
Adding split routing and mct option
Apr 4, 2024
a64d1f1
fixed bug in PrevDm0
Apr 8, 2024
35108a6
running on catchment with single gridcell
Apr 10, 2024
624803b
modified init values for mct channels
Apr 12, 2024
36aecd5
mct using average discharge and closing water balance on single grid …
Apr 17, 2024
313d00c
mct using average discharge and closing water balance on catchment
Apr 18, 2024
b252216
trying to calculate the average discharge for kinematic routing
Apr 26, 2024
53446b7
using Qavg for channel mass balance
May 1, 2024
d68f42c
Testing amss balance MB on single kinematic cell
May 22, 2024
d88f6cd
Moved integration on control volume to inner loop in mct.
May 22, 2024
edb1788
Commenting ChanQAvgInDt
May 23, 2024
0f3d73c
Cleaning mct code
May 23, 2024
baf178d
Solving issue with numbe in discharge_avg in solve1pixel
May 24, 2024
58688fe
Comments
May 24, 2024
26037b3
Merge branch 'kinematic_parallel' into merging_kinematic_parallel_to_mct
May 24, 2024
228d1fd
Kinematic and mct routing both using Q from integration on control vo…
May 24, 2024
9fd40a4
commenting mass balance prints
May 31, 2024
0d932f0
avoid negative discharge
May 31, 2024
ef1dfc3
q1mm>eps to avoid instability and mass balance errors
May 31, 2024
a58d403
adjusting checks for small q values
May 31, 2024
928e5cf
using Q average for surface routing
Jun 4, 2024
a09bf96
added dummy variables to split routing
Jun 25, 2024
c613d31
going back to using self.var variables for kinematic routing
Jun 25, 2024
f9a33d5
commenting code in kinematic routing
Jun 25, 2024
26be348
using self.var variables for kinematic routing in MCT
Jun 25, 2024
cf8af65
cleaned up code for kinematic routing
Jun 26, 2024
d8fba60
cleaned up code for split routing
Jun 26, 2024
dea8b0d
cleaned up code for mct
Jun 26, 2024
3c4c517
fixed output for split routing + mct
Jun 26, 2024
fb3f4c6
comments and clean up for routing
Jun 27, 2024
c5e61bc
Calculating average outflow discharge in split routing
Jun 27, 2024
350b01f
removed workaround on ChanQAvgDt for split routing
Jun 28, 2024
47c31a3
Using chanman2 for MCT routing (same as split routing)
Jul 1, 2024
d9ffade
Fixed eror in split routing+MCT, now using ChanQKinOutAvgDtEnd as inp…
Jul 1, 2024
ee694fc
Added dynamic inflow test for MCT routing
Jul 2, 2024
92c07ea
Added test for MCT results
Jul 3, 2024
49e4ee2
refactored the test for MCT results
Jul 3, 2024
707fb51
fixed cleaning method and MCT tests can run
Jul 9, 2024
8869b44
preparing to add more tests
Jul 9, 2024
9ed1e2c
added reference data for mct+split kinematic split routing
Jul 9, 2024
ba7818b
added more tests for mct routing results
Jul 9, 2024
c1f758b
trying to make the on-line tests work
Jul 9, 2024
eeda068
optimising mct (NOT TESTED)
corentincarton Jul 10, 2024
c4cf459
bugfix (not tested)
Jul 10, 2024
43cdb90
bugfix swapped variables in return
Jul 11, 2024
85653e9
bug fixing
Jul 11, 2024
90272b5
Bugfix (passed MCT tests)
Jul 12, 2024
a2a4df4
Not checking mberror in mct tests
Jul 12, 2024
b0147ee
simplify mct loop
corentincarton Jul 15, 2024
830d38b
removing unsed loop
Jul 15, 2024
8ccecdd
ready to parallelise
Jul 15, 2024
521288b
refactor mct routing to allow parallelisation
corentincarton Jul 15, 2024
25269d8
bugfix
Jul 15, 2024
850d651
refactor mct routing to allow parallelisation
corentincarton Jul 15, 2024
202828b
refactor mct routing to allow parallelisation
corentincarton Jul 15, 2024
b1d180a
debug parallel mct routing
corentincarton Jul 15, 2024
cb50db5
debug parallel mct routing
corentincarton Jul 15, 2024
789bd2b
debug parallel mct routing
corentincarton Jul 15, 2024
a6533ea
debug parallel mct routing
corentincarton Jul 15, 2024
278938b
debug parallel mct routing
corentincarton Jul 15, 2024
122a5b6
adding some comments
corentincarton Jul 15, 2024
26b8385
minor interface change for mct
corentincarton Jul 16, 2024
1ed3adc
bugfix
Jul 16, 2024
b38a6a3
merge conflicts
Jul 16, 2024
1713fea
optimised mct code
Jul 16, 2024
a8bdbc7
updating mct tests after changing mct initialisation
Jul 16, 2024
6f12cfc
added MCT keys to template settings file
Jul 19, 2024
15b7531
added comments
Jul 19, 2024
77f0ff9
deleting files at the end of mct tests
Jul 24, 2024
d2556e7
cleaning files at the and of the dynamic inflow test
Jul 24, 2024
1a46d6c
debug cases with no mct pixels
corentincarton Jul 29, 2024
c2e8e15
Added riverbed roughness parameter for MCT
Sep 13, 2024
b00b771
split and optimization of the new solve1pixel function for the mct br…
doc78 Oct 17, 2024
73da888
minor optimisation
corentincarton Oct 17, 2024
ca77e35
Feature/channel param (#177)
ecCinziaMazzetti Nov 11, 2024
9b78aaa
Setting parameters of channels geometry to 1
Nov 11, 2024
db4ca30
updated mct tests
Nov 15, 2024
96e0d96
Merge pull request #173 from ec-jrc/feature/mct_optim_fix
ecCinziaMazzetti Nov 15, 2024
516f7df
Added warm start for MCT routing
Nov 20, 2024
c1b48b9
Added test for MCT warm start
Nov 20, 2024
7996e9e
restoring GDAL version in requirements
Nov 20, 2024
98c9b00
bugfix
Nov 21, 2024
55b6248
Updating settings files in tests
Nov 22, 2024
0bf3d02
Slow MCT warm start test for LF_ETRS89_UseCase
Nov 26, 2024
ee7373f
Slow MCT results test for LF_ETRS89_UseCase
Nov 26, 2024
c7ee44d
Slow MCT inflow test for LF_ETRS89_UseCase
Nov 28, 2024
e094ccd
organising fast anf slow tests
Nov 29, 2024
732b31b
bugfix for slow tests
Nov 29, 2024
3ebc502
updating model documentation
ecCinziaMazzetti Dec 2, 2024
d5f9e25
Merge branch 'development' into feature/mct_optim
doc78 Dec 4, 2024
0b7e1a5
Small fix in prerun xml file
doc78 Dec 4, 2024
65c113b
Updated mct tests reference results for LF_ETRS89
Dec 6, 2024
1cdb571
Updated mct tests reference results for LF_ETRS89
Dec 6, 2024
94d88ab
Changed tolerance in MCT and MCTS unit tests results slow
doc78 Dec 10, 2024
1834d9c
Merge pull request #180 from ec-jrc/feature/mct_optim_results_update
doc78 Dec 10, 2024
20aedc3
Small fixes for output folder creation
doc78 Dec 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.3.1
4.3.1 MCT
57 changes: 54 additions & 3 deletions docs/3_step3_preparing-setting-file/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,41 @@ These parameters are all related to the [routing of water in the channels](https



### Diffusive wave routing parameters

The following parameters are related to the [diffusive wave routing](https://ec-jrc.github.io/lisflood-model/3_14_optLISFLOOD_diffusive-wave/) in river channels. The multiplier *CalChanMan3* can be used to fine-tune the diffusive wave propagation when using the Muskingum-Cunge-Todini (MCT) routing, and it can be defined as either a single value or a map. The map *ChannelsMCT* is a Bolean map with the mask of rivers where MCT wave routing must be used. The parameter *ChanGradMaxMCT* defines the maximum riverbed slope for river grid cells using the MCT wave routing. The parameter is provided as a single number and it is recommended to set it to values < 0.001 and > *ChanGradMin*
```xml
<comment>
**************************************************************
MUSKINGUM-CUNGE-TODINI ROUTING PARAMETERS
**************************************************************
</comment>
<textvar name="CalChanMan3" value="$(PathParams)/params_CalChanMan3">
<comment>
default: 3.0 [-]
Multiplier [-] applied to Channel Manning's n for MCT routing
</comment>
</textvar>
<textvar name="ChannelsMCT" value="$(PathRoot)/maps/chanmct">
<comment>
Boolean map with value 1 at channel pixels where MCT is
used, and 0 at all other pixels
</comment>
</textvar>
<textvar name="ChanGradMaxMCT" value="0.001">
<comment>
Maximum channel gradient for channels using MCT routing [-] (for MCT wave: slope cannot be 0)
Default: 0.001
</comment>
</textvar>
```

- **CalChanMan3** is a multiplier that is applied to the Manning’s roughness map of the [channel system](https://ec-jrc.github.io/lisflood-model/2_16_stdLISFLOOD_channel-routing/) [-] for the grid cells where MCT routing is used
- **ChannelsMCT** is Bolean mask including the rivers grid cells using the MCT wave routing [-]
- **ChanGradMaxMCT** is a upper limit for the channel gradient used in the calculation of the MCT wave routing [m/m]



### Parameters related to numerics

This category only contains one parameter at the moment, which can only be a single value. We strongly recommend keeping this parameter at its default value.
Expand Down Expand Up @@ -530,8 +565,8 @@ Note that a couple of variables can be [initialized internally](https://ec-jrc.g
</comment>
</textvar>
<comment>
**************************************************************
The following variables can also be initialized in the model internally. if you want this to happen set them to bogus value of -9999
**************************************************************
The following variables can also be initialized in the model internally. If you want this to happen set them to bogus value of -9999
**************************************************************
</comment>
<textvar name="LZInitValue" value="-9999">
Expand Down Expand Up @@ -571,7 +606,19 @@ Note that a couple of variables can be [initialized internally](https://ec-jrc.g
only needed for lakes reservoirs and transmission loss
-9999: use discharge of half bankfull
</comment>
</textvar>
</textvar>
<textvar name="PrevCmMCTInitValue" value="-9999">
<comment>
Courant number at previous step for MCT routing
Cold start: -9999: use 1
</comment>
</textvar>
<textvar name="PrevDmMCTInitValue" value="-9999">
<comment>
Reynolds number at previous step for MCT routing
Cold start: -9999: use 0
</comment>
</textvar>
```

- **WaterDepthInitValue** is the initial amount of water on the soil surface $[mm]$
Expand Down Expand Up @@ -604,6 +651,10 @@ Note that a couple of variables can be [initialized internally](https://ec-jrc.g

- **PrevDischarge** is the initial discharge from previous run $[\frac{m^3} {s}]$ used for lakes, reservoirs and transmission loss (only needed if option is on for lakes or reservoirs or transmission loss). Note that PrevDischarge is discharge as an average over the time step (a flux) . A value of **-9999** sets the initial amount of discharge to equivalent of half bankfull.

- **PrevCmMCTInitValue** is the Courant number at the end of the previous step and it is only used for MCT wave routing [-]. A value of **-9999 ** sets the initial value to 1.

- **PrevDmMCTInitValue** is the Reynols number at the end of the previous step and it is only used for MCT wave routing [-]. A value of **-9999 ** sets the initial value to 0.

```xml
<comment>
**************************************************************
Expand Down
6 changes: 3 additions & 3 deletions docs/3_step4_preparing-input-files/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ The section [Static Maps](../4_Static-Maps-introduction) provides detailed guide
+ [land use maps](../4_Static-Maps_land-use/): fraction of forest; fraction of irrigated crops; fraction of rice crops; fraction of inland water; fraction of sealed surfaces; fraction of other land uses.
+ [land use depending](../4_Static-Maps_land-use-depending/):crop coefficient; crop group number; Manning/s's surface roughness; soil depth.
+ [soil hydraulic properties](../4_Static-Maps_soil-hydraulic-properties/): saturated hydraulic conductivity; soil water content at saturation; residual soil water content; parameters alpha and lambda of Van Genuchten's equations.
+ [channel geometry](../4_Static-Maps_channel-geometry/): channels mask; channels side slope; channels length; channels gradient; Manning's rougheness coefficient of the channels; channels bottom width; floodplain width; bankfull channels depth.
+ [channel geometry](../4_Static-Maps_channel-geometry/): channels mask; channels side slope; channels length; channels gradient; Manning's rougheness coefficient of the channels; channels bottom width; floodplain width; bankfull channels depth; MCT diffusive wave routing channels.
+ [leaf area index](../4_Static-Maps_leaf-area-index/): evolution of vegetation over time (leaf area index) for land covers forest, irrigated areas, others.
+ [reservoirs and lakes](../4_Static-Maps_reservoirs-lakes/): lake mask; lakes ID points; reservoirs ID points. These maps are required only upon activation of the [lakes module](https://ec-jrc.github.io/lisflood-model/3_02_optLISFLOOD_lakes/) and/or of the [reservoirs module](https://ec-jrc.github.io/lisflood-model/3_03_optLISFLOOD_reservoirs/).
+ [rice calendar](../4_Static-Maps_rice-calendar/): rice calendar for planting and harvesting seasons. These maps are required only when activating the [rice irrigation module](https://ec-jrc.github.io/lisflood-model/2_17_stdLISFLOOD_irrigation/)
+ inflow points: locations and IDs of the points in which LISFLOOD adds an inflow hydrograph, as explained [here](https://ec-jrc.github.io/lisflood-model/3_09_optLISFLOOD_inflow-hydrograph/)
+ water demand maps: domestic, energetic, livestock, industrial water use. These maps represent the time series of spatially distributed values of water demand for domestic, energetic, livestock, and industrial water use. These maps are required only when activating the [water use module](https://ec-jrc.github.io/lisflood-model/2_18_stdLISFLOOD_water-use/)
+ outlet points: locations and IDs of the points for which LISFLOOD provides the time series of discharge values.

#### Role of "mask" and "channels" maps
#### Role of "mask", "channels" ans "channelsMCT" maps

The mask map (i.e. "area.map") defines the model domain. In order to avoid unexpected results, **it is vital that all maps that are related to topography, land use and soil are defined** (i.e. don't contain a missing value) for each pixel that is "true" (has a Boolean 1 value) on the mask map. The same applies for all meteorological input and the Leaf Area Index maps. Similarly, all pixels that are "true" on the channels map must have some valid (non-missing) value on each of the channel parameter maps. Undefined pixels can lead to unexpected behaviour of the model, output that is full of missing values, loss of mass balance and possibly even model crashes. Some maps needs to have values in a defined range e.g. the gradient map has to be greater than 0.
The mask map (i.e. "area.map") defines the model domain. In order to avoid unexpected results, **it is vital that all maps that are related to topography, land use and soil are defined** (i.e. don't contain a missing value) for each pixel that is "true" (has a Boolean 1 value) on the mask map. The same applies for all meteorological input and the Leaf Area Index maps. Similarly, all pixels that are "true" on the channels map must have some valid (non-missing) value on each of the channel parameter maps. At the same time, all pixels that have value "true" in the MCT rivers mask must also belong to the "channels" map. Undefined pixels can lead to unexpected behaviour of the model, output that is full of missing values, loss of mass balance and possibly even model crashes. Some maps needs to have values in a defined range e.g. the gradient map has to be greater than 0.

#### Geometrical properties of the computational grid cell

Expand Down
5 changes: 5 additions & 0 deletions docs/4_Static-Maps_channel-geometry/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

In the LISFLOOD model flow through the channel is simulated using the kinematic wave equations. Channel maps describe the sub grid information of the channel geometry, i.e. the length, slope, width and depth of the main channel inside a grid-cell. <br/>
+ The **channel mask** map is the Boolean field with '1' for all grid-cells with channels and NoData for all grid-cells with no channels. <br/>
+ The **MCT channel mask** map is the Boolean field with '1' for all river grid-cells using MCT wave routing and '0' for other channel grid cells. <br/>
+ The **channel side slope** map (referred as 's' in Figure 41) defines the slope of the channel banks. <br/>
+ The **channel length** map is the length of the river in each grid-cell, and the value can exceed grid-size to account for meandering rivers. <br/>
+ The **channel gradient** (or channel slope) map is the average gradient of the main river inside a cell. <br/>
Expand All @@ -23,6 +24,7 @@ Channel characteristics, explained above, are shown in the Figure 41 below. <br
| Map name | File name;type | Units; range | Description |
| :---| :--- | :--- | :--- |
|Channel mask | chan.nc; <br> Type: Boolean | Units: -;<br> Range: NoData or 1 |Boolean map that identifies the channel grid-cells |
|MCT Channel mask | chanmct.nc; <br> Type: Boolean | Units: -;<br> Range: [0-1] |Boolean map that identifies the channel grid-cells using the MCT diffusive river routing |
|Side slope |chans.nc; <br> Type: Float32 | Units: m;<br> Range>0 |Channel side slope|
|Channel length |chanlength.nc; <br> Type: Float32 | Units: m;<br> Range>0 |Channel length (value can exceed grid size, to account for meandering rivers)|
|Channel gradient |changrad.nc; <br> Type: Float32 |Units: m/m;<br> Range: [0-1] |Channel longitudinal gradient|
Expand All @@ -45,6 +47,9 @@ Channel characteristics, explained above, are shown in the Figure 41 below. <br
### Channel mask (chan)
The channel mask map is used to identify the cells that have channels. The grid-cells that have a channel length (see chanlength map creation below) above zero are assigned to the Boolean field '1', the grid-cells that have a channel length below or equal to zero are assigned with NoData.

### MCT Channel mask (chanmct)
The MCT channel mask map is used to identify the cells using the Muskingum-Cunge-Todini diffusive wave routing. The grid-cells that have a riverbed slope < *ChanGradMaxMCT* (default value 0.001) and a set number of upstream grid cells also meeting the same condition are assigned to the mask. All downstream channel pixels of any of the pixels using MCT wave routing are also added to the mask.

### Side slope (chans)
The channel side slope map is calculated by dividing the horizontal distance (referred as 'dx' in Figure 42) by vertical distance (referred as 'dy' in Figure 42); here ‘1’ was assigned to all the grid cells, which correspond to a 45° angle of the side slope.

Expand Down
1 change: 1 addition & 0 deletions docs/4_annex_input-files/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ To this end a dedicated pre-processing application has been developed (LISVAP),
| Sat2 for forest and other | ksat2.map | U.: $\frac{mm} {day}$ <br> R.: map>0 | Saturated conductivity layer 2 |
| **CHANNEL GEOMETRY** | | | |
| Channels | chan.map | U.: [-] <br> R.: 0 or 1 | Map with Boolean 1 for all channel pixels, and Boolean 0 for all other pixels on MaskMap |
| MCT Channels | chanmct.map | U.: [-] <br> R.: 0 or 1 | Map with Boolean 1 for channel pixels using MCT diffusive wave routing, and Boolean 0 for all other pixels on MaskMap |
| ChanGrad | changrad.map | U.: $\frac{m} {m}$ <br> R.: map > 0 <br> !!! | Channel gradient |
| ChanMan | chanman.map | U.: $m^{-1/3} s$ <br> R.: map > 0 | Manning's roughness coefficient for channels |
| ChanLength | chanleng.map | U.: $m$ <br> R.: map > 0 | Channel length (can exceed grid size, to account for meandering rivers) |
Expand Down
3 changes: 2 additions & 1 deletion docs/4_annex_output-files/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ LISFLOOD can generate a wide variety of outputs. Output files can be time series
| Description | Units | File name |
| ------------------------------------------------------------ | ---------------- | --------------------- |
| **RATE VARIABLES AT GAUGES** | | |
| $^{1,2}$ channel discharge | $\frac{m^3} {s}$ | dis.tss |
| $^{1,2}$ average river discharge | $\frac{m^3} {s}$ | dis.tss |
| $^{1,2}$ instantaneous rivers discharge | $\frac{m^3} {s}$ | chanq.tss |
| **NUMERICAL CHECKS** | | |
| $^2$ cumulative mass balance error | $m^3$ | mbError.tss |
| $^2$ cumulative mass balance error, expressed as mm water slice (average over catchment) | $mm$ | mbErrorMm.tss |
Expand Down
Loading