Skip to content

Commit d97ff0f

Browse files
authored
Merge pull request #189 from ec-jrc/debug/prerun_no_mct
Fix to deactivate MCT when performing an Initrun
2 parents 380f904 + f7593a0 commit d97ff0f

File tree

4 files changed

+6346
-7
lines changed

4 files changed

+6346
-7
lines changed

src/lisflood/hydrological_modules/routing.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ def initialMCT(self):
550550
# ************************************************************
551551
# ***** INITIALISATION FOR MCT ROUTING ************
552552
# ************************************************************
553-
553+
554554
# even if MCT is active, it should be deactivated if there is no MCT cell in the domain
555555
if option['MCTRouting']:
556556
self.var.IsChannelMCTPcr = boolean(loadmap('ChannelsMCT', pcr=True)) #pcr
@@ -561,7 +561,7 @@ def initialMCT(self):
561561
# rebuild lists of reported files with MCTRouting = False
562562
settings.build_reportedmaps_dicts()
563563

564-
if option['MCTRouting']:
564+
if option['MCTRouting'] and not option['InitLisflood']:
565565
maskinfo = MaskInfo.instance()
566566

567567
self.var.IsChannelMCTPcr = boolean(decompress(self.var.IsChannelMCT)) # pcr
@@ -712,7 +712,8 @@ def dynamic(self, NoRoutingExecuted):
712712
# ************************************************************
713713
if option['InitLisflood']:
714714
self.var.IsChannelKinematic = self.var.IsChannel.copy()
715-
# Use kinematic routing in all grid cells
715+
# Use kinematic routing in all grid cells when performing an InitRun
716+
# MCT is automatically switched off (see MCT initialization)
716717

717718
# only run kinematic for InitLisflood option
718719
# either kinematic or split routing always runs for all pixels when using MCT routing
@@ -771,7 +772,7 @@ def dynamic(self, NoRoutingExecuted):
771772
# Main channel routing and above bankfull routing from second line of routing
772773

773774
# MUSKINGUM-CUNGE-TODINI ROUTING - no InitLisflood
774-
if option['MCTRouting']:
775+
if option['MCTRouting'] and not option['InitLisflood']:
775776
# MCT routing
776777
# This is calculated for MCT grid cell only but takes the output of kinematic or split routing.
777778
# First, Kinematic/Split routing is solved on all pixels (including MCT pixels) then results are updated

tests/data/LF_MCT_UseCase/settings/mct_cold_for_results_generation.xml

Lines changed: 158 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ You can use builtin path variables in this template and reference to other paths
4848
<setoption choice="0" name="simulateReservoirs"/>
4949

5050
<setoption choice="0" name="SplitRouting"/>
51-
<setoption choice="0" name="MCTRouting"/>
51+
<setoption choice="1" name="MCTRouting"/>
5252

5353

5454
# use inflow data
@@ -58,8 +58,9 @@ You can use builtin path variables in this template and reference to other paths
5858
<setoption choice="0" name="indicator"/>
5959

6060
# option to initialize Lisflood
61-
<setoption choice="0" name="InitLisflood"/>
61+
<setoption choice="1" name="InitLisflood"/>
6262
<setoption choice="0" name="InitLisfloodwithoutsplit"/>
63+
<setoption choice="0" name="ColdStart"/>
6364

6465
# option to read/write NetCDF
6566
<setoption choice="1" name="readNetcdfStack"/>
@@ -975,6 +976,69 @@ You can use builtin path variables in this template and reference to other paths
975976
</textvar>
976977
</group>
977978

979+
<group>
980+
981+
<comment>
982+
**************************************************************
983+
CUMULATIVE FLUXES REQUIRED WHEN COMPUTING THE PRE-RUN IN CHUNKS
984+
**************************************************************
985+
</comment>
986+
987+
<textvar name="LZInflowCUMInit" value="0">
988+
<comment>
989+
$(PathInit)/LZInflowCumEnd
990+
Cumulative inflow to the lower groundwater zone
991+
0: this is appropriate for the cold start of the pre-run, the cold start of the run, the warm start of the run
992+
LZInflowCumEnd: required for the warm start of the pre-run
993+
</comment>
994+
</textvar>
995+
996+
<textvar name="cumSeepTopToSubBOtherInit" value="0">
997+
<comment>
998+
$(PathInit)/cumSeepTopToSubBOtherEnd
999+
Cumulative flux from second to third soil layer, other land cover fraction
1000+
0: this is appropriate for the cold start of the pre-run, the cold start of the run, the warm start of the run
1001+
cumSeepTopToSubBOtherEnd: required for the warm start of the pre-run
1002+
</comment>
1003+
</textvar>
1004+
1005+
<textvar name="cumSeepTopToSubBForestInit" value="0">
1006+
<comment>
1007+
$(PathInit)/cumSeepTopToSubBForestEnd
1008+
Cumulative flux from second to third soil layer, forest land cover fraction
1009+
0: this is appropriate for the cold start of the pre-run, the cold start of the run, the warm start of the run
1010+
cumSeepTopToSubBForestEnd: required for the warm start of the pre-run
1011+
</comment>
1012+
</textvar>
1013+
1014+
<textvar name="cumSeepTopToSubBIrrigationInit" value="0">
1015+
<comment>
1016+
$(PathInit)/cumSeepTopToSubBIrrigationEnd
1017+
Cumulative flux from second to third soil layer, irrigation land cover fraction
1018+
0: this is appropriate for the cold start of the pre-run, the cold start of the run, the warm start of the run
1019+
cumSeepTopToSubBIrrigationEnd: required for the warm start of the pre-run
1020+
</comment>
1021+
</textvar>
1022+
1023+
<textvar name="CumQInit" value="0">
1024+
<comment>
1025+
$(PathInit)/CumQEnd
1026+
Cumulative discharge
1027+
0: this is appropriate for the cold start of the pre-run, the cold start of the run, the warm start of the run
1028+
CumQEnd: required for the warm start of the pre-run
1029+
</comment>
1030+
</textvar>
1031+
1032+
<textvar name="TimeSinceStartPrerunChunkInit" value="0">
1033+
<comment>
1034+
$(PathInit)/TimeSinceStartPrerunChunkEnd
1035+
Cumulative number of days from the start of the prerun
1036+
0: this is appropriate for the cold start of the pre-run, the cold start of the run, the warm start of the run
1037+
TimeSinceStartPrerunChunkEnd: required for the warm start of the pre-run
1038+
</comment>
1039+
</textvar>
1040+
1041+
</group>
9781042

9791043
<group>
9801044
<comment>
@@ -2562,6 +2626,61 @@ LFBINDING: MORE LOW-LEVEL CONTROL OVER MODEL IN- AND OUTPUT
25622626
</textvar>
25632627
</group>
25642628

2629+
<group>
2630+
<comment>
2631+
**************************************************************
2632+
CUMULATIVE FLUXES REQUIRED WHEN COMPUTING THE PRE-RUN IN CHUNKS
2633+
**************************************************************
2634+
</comment>
2635+
<textvar name="LZInflowCUMInit" value="$(LZInflowCUMInit)">
2636+
<comment>
2637+
Cumulative inflow to the lower groundwater zone
2638+
0: this is appropriate for the cold start of the pre-run, the cold start of the run, the warm start of the run
2639+
LZInflowCumEnd: required for the warm start of the pre-run
2640+
</comment>
2641+
</textvar>
2642+
2643+
<textvar name="cumSeepTopToSubBOtherInit" value="$(cumSeepTopToSubBOtherInit)">
2644+
<comment>
2645+
Cumulative flow from second to third soil layer, other land cover fraction
2646+
0: this is appropriate for the cold start of the pre-run, the cold start of the run, the warm start of the run
2647+
cumSeepTopToSubBOtherEnd: required for the warm start of the pre-run
2648+
</comment>
2649+
</textvar>
2650+
2651+
<textvar name="cumSeepTopToSubBForestInit" value="$(cumSeepTopToSubBForestInit)">
2652+
<comment>
2653+
Cumulative flow from second to third soil layer, forest land cover fraction
2654+
0: this is appropriate for the cold start of the pre-run, the cold start of the run, the warm start of the run
2655+
cumSeepTopToSubBForestEnd: required for the warm start of the pre-run
2656+
</comment>
2657+
</textvar>
2658+
2659+
<textvar name="cumSeepTopToSubBIrrigationInit" value="$(cumSeepTopToSubBIrrigationInit)">
2660+
<comment>
2661+
Cumulative flow from second to third soil layer, irrigation land cover fraction
2662+
0: this is appropriate for the cold start of the pre-run, the cold start of the run, the warm start of the run
2663+
cumSeepTopToSubBIrrigationEnd: required for the warm start of the pre-run
2664+
</comment>
2665+
</textvar>
2666+
2667+
<textvar name="CumQInit" value="$(CumQInit)">
2668+
<comment>
2669+
Cumulative discharge
2670+
0: this is appropriate for the cold start of the pre-run, the cold start of the run, the warm start of the run
2671+
CumQEnd: required for the warm start of the pre-run
2672+
</comment>
2673+
</textvar>
2674+
2675+
<textvar name="TimeSinceStartPrerunChunkInit" value="$(TimeSinceStartPrerunChunkInit)">
2676+
<comment>
2677+
Cumulative number of days from the start of the prerun
2678+
0: this is appropriate for the cold start of the pre-run, the cold start of the run, the warm start of the run
2679+
NetTimeSinceStartPrerunChunkEnd: required for the warm start of the pre-run
2680+
</comment>
2681+
</textvar>
2682+
2683+
</group>
25652684

25662685
<group>
25672686
<comment>
@@ -3427,8 +3546,44 @@ LFBINDING: MORE LOW-LEVEL CONTROL OVER MODEL IN- AND OUTPUT
34273546
Reported storage in upper response box [mm]
34283547
</comment>
34293548
</textvar>
3430-
</group>
34313549

3550+
<textvar name="LZInflowCUMEnd" value="$(PathOut)/LZInflowCUMEnd">
3551+
<comment>
3552+
Reported cumulative inflow to the lower groundwater zone [mm]
3553+
</comment>
3554+
</textvar>
3555+
3556+
<textvar name="CumQEnd" value="$(PathOut)/CumQEnd">
3557+
<comment>
3558+
Reported cumulative discharge [m3/s] (required only when the prerun is performed in chunks)
3559+
</comment>
3560+
</textvar>
3561+
3562+
<textvar name="cumSeepTopToSubBOtherEnd" value="$(PathOut)/cumSeepTopToSubBOtherEnd">
3563+
<comment>
3564+
Reported cumulative flux from second to third soil layer, other land cover fraction [mm] (required only when the prerun is performed in chunks)
3565+
</comment>
3566+
</textvar>
3567+
3568+
<textvar name="cumSeepTopToSubBForestEnd" value="$(PathOut)/cumSeepTopToSubBForestEnd">
3569+
<comment>
3570+
Reported cumulative flux from second to third soil layer, forest land cover fraction [mm] (required only when the prerun is performed in chunks)
3571+
</comment>
3572+
</textvar>
3573+
3574+
<textvar name="cumSeepTopToSubBIrrigationEnd" value="$(PathOut)/cumSeepTopToSubBIrrigationEnd">
3575+
<comment>
3576+
Reported cumulative flux from second to third soil layer, irrigation land cover fraction [mm] (required only when the prerun is performed in chunks)
3577+
</comment>
3578+
</textvar>
3579+
3580+
<textvar name="TimeSinceStartPrerunChunkEnd" value="$(PathOut)/TimeSinceStartPrerunChunkEnd">
3581+
<comment>
3582+
Reported total number of days since the start of the prerun (required only when the prerun is performed in chunks)
3583+
</comment>
3584+
</textvar>
3585+
3586+
</group>
34323587

34333588
<group>
34343589
<comment>

0 commit comments

Comments
 (0)