@@ -95,6 +95,27 @@ def initial(self):
95
95
self .var .LZ = np .where (LZInitValue == - 9999 , LZSteady , LZInitValue )
96
96
# Initialise lower store with steady-state value
97
97
# if LZInitValue is set to -9999
98
+
99
+ if option ['InitLisflood' ]:
100
+ self .var .LZInflowCUM = loadmap ('LZInflowCUMInit' )
101
+ self .var .TimeSinceStartPrerunChunkInit = loadmap ('TimeSinceStartPrerunChunkInit' )
102
+ if isinstance (self .var .TimeSinceStartPrerunChunkInit , float ):
103
+ MAP = []
104
+ MAP = maskinfo .in_zero () + self .var .TimeSinceStartPrerunChunkInit
105
+ self .var .TimeSinceStartPrerunChunkInit = []
106
+ self .var .TimeSinceStartPrerunChunkInit = MAP
107
+ # Cumulative lower zone inflow [mm]
108
+ # Needed for calculation of average LZ inflow (initialisation)
109
+ # Added the option to read LZInflowCUM from settings file: this is needed when the prerun is completed in separate chunks (e.g. 1990-200 and 2000-2010).
110
+ else :
111
+ self .var .NumDaysSpinUp = 0.0 # this allows to write lzavin in the model run, recommended ONLY when the run is done in 1 chunk
112
+ self .var .TimeSinceStartPrerunChunkInit = 0.0 # this allows to write lzavin in the model run, recommended ONLY when the run is done in 1 chunk
113
+ if isinstance (self .var .TimeSinceStartPrerunChunkInit , float ):
114
+ MAP = []
115
+ MAP = maskinfo .in_zero () + self .var .TimeSinceStartPrerunChunkInit
116
+ self .var .TimeSinceStartPrerunChunkInit = []
117
+ self .var .TimeSinceStartPrerunChunkInit = MAP
118
+ self .var .LZInflowCUM = maskinfo .in_zero () # this allows to write lzavin in the model run, recommended ONLY when the run is done in 1 chunk
98
119
99
120
# Water in lower store [mm]
100
121
self .var .LZThreshold = loadmap ('LZThreshold' )
@@ -119,9 +140,6 @@ def initial(self):
119
140
120
141
self .var .GwLossCUM = maskinfo .in_zero ()
121
142
# Cumulative groundwater loss [mm]
122
- self .var .LZInflowCUM = maskinfo .in_zero ()
123
- # Cumulative lower zone inflow [mm]
124
- # Needed for calculation of average LZ inflow (initialisation)
125
143
126
144
self .var .GwPercUZLZ = self .var .allocateVariableAllVegetation ()
127
145
self .var .GwLossLZ = maskinfo .in_zero ()
@@ -135,8 +153,6 @@ def dynamic(self):
135
153
# outflow from LZ to channel stops when LZ is below its threshold.
136
154
# LZ can be below its threshold because of water abstractions
137
155
self .var .LZOutflow = np .minimum (self .var .LowerZoneK * self .var .LZ , self .var .LZ - self .var .LZThreshold )
138
- # Total UZ
139
- self .var .UZtotal = self .var .deffraction (self .var .UZ )
140
156
# Outflow out of lower zone [mm per model timestep]
141
157
self .var .LZOutflow = np .maximum (self .var .LZOutflow , 0 )
142
158
# No outflow if LZ is below threshold
@@ -163,19 +179,22 @@ def dynamic(self):
163
179
self .var .LZ = self .var .LZ - self .var .GwLossLZ
164
180
# (ground)water in lower response box [mm]
165
181
166
- self .var .LZInflowCUM += (self .var .GwPercUZLZPixel - self .var .GwLossLZ )
167
- # cumulative inflow into lower zone (can be used to improve
168
- self .var .LZInflowCUM = np .maximum (self .var .LZInflowCUM , 0.0 )
169
- # LZInflowCUM would become negativ, if LZInit is set to high
170
- # therefore this line is preventing LZInflowCUM getting negativ
171
-
172
182
self .var .GwLossPixel = self .var .GwLossLZ
173
183
# from GROUNDWATER TRANSFER to here
174
184
# Compute pixel-average fluxes
175
185
self .var .GwLossCUM += self .var .GwLossPixel
176
186
self .var .GwLossWB = self .var .GwLossPixel
177
187
# Accumulated groundwater loss over simulation period [mm]
178
- self .var .LZAvInflow = (self .var .LZInflowCUM * self .var .InvDtDay ) / self .var .TimeSinceStart
179
- # Average inflow into lower zone over executed time steps [mm/day]
188
+
189
+ if (self .var .TimeSinceStart > np .round (self .var .NumDaysSpinUp / self .var .DtDay )) :
190
+ self .var .LZInflowCUM += (self .var .GwPercUZLZPixel - self .var .GwLossLZ )
191
+ # cumulative inflow into lower zone (can be used to improve
192
+ self .var .LZInflowCUM = np .maximum (self .var .LZInflowCUM , 0.0 )
193
+ # LZInflowCUM would become negativ, if LZInit is set to high
194
+ # therefore this line is preventing LZInflowCUM getting negativ
195
+ self .var .LZAvInflow = (self .var .LZInflowCUM * self .var .InvDtDay ) / ( self .var .TimeSinceStart + self .var .TimeSinceStartPrerunChunkInit [0 ] - np .round (self .var .NumDaysSpinUp / self .var .DtDay ))
196
+ # Average inflow into lower zone over executed time steps [mm/day]
197
+ self .var .TimeSinceStartPrerunChunk = self .var .TimeSinceStartPrerunChunkInit + self .var .TimeSinceStart - np .round (self .var .NumDaysSpinUp / self .var .DtDay )
198
+
180
199
181
200
self .var .LZOutflowToChannelPixel = self .var .LZOutflowToChannel
0 commit comments