Skip to content

Commit

Permalink
mct using average discharge and closing water balance on single grid …
Browse files Browse the repository at this point in the history
…cell
  • Loading branch information
Cinzia Mazzetti committed Apr 17, 2024
1 parent 624803b commit 36aecd5
Show file tree
Hide file tree
Showing 3 changed files with 140 additions and 63 deletions.
13 changes: 10 additions & 3 deletions src/lisflood/Lisflood_dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,18 @@
import gc

from pcraster.framework import DynamicModel

import numpy as np
from lisflood.global_modules.errors import LisfloodWarning

from lisflood.global_modules.zusatz import checkmap

from .global_modules.settings import CDFFlags, LisSettings, MaskInfo

from pcraster import upstream
from lisflood.global_modules.add1 import decompress, compressArray


class LisfloodModel_dyn(DynamicModel):

# =========== DYNAMIC ====================================================
Expand Down Expand Up @@ -175,6 +180,7 @@ def splitlanduse(array1, array2=None, array3=None):
# ************************************************************
maskinfo = MaskInfo.instance()
self.sumDisDay = maskinfo.in_zero()

# sums up discharge of the sub steps
for NoRoutingExecuted in range(self.NoRoutSteps):
self.routing_module.dynamic(NoRoutingExecuted)
Expand Down Expand Up @@ -207,11 +213,12 @@ def splitlanduse(array1, array2=None, array3=None):
self.TotalCrossSectionArea = self.ChanM3 * self.InvChanLength
# Total river channel cross-section area at t+dt

# Calculate total river outflow at t+dt as average of routing sub-steps (average)
self.sumDis += self.sumDisDay
# Accumulated average discharge over the entire simulation period

self.ChanQAvg = self.sumDisDay/self.NoRoutSteps
# Average channel outflow on the model computation step (average of instantaneous outflows at the end of routing sub-steps)
# Same as ChanQ if using only one routing sub-step
# Average channel outflow over the model computation step
# NOT the same as ChanQ even when if using only one routing sub-step


# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down
4 changes: 3 additions & 1 deletion src/lisflood/Lisflood_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ def __init__(self):

# initialise averaged discharge
maskinfo = MaskInfo.instance()
self.ChanQAvg = maskinfo.in_zero()

#cmcheck - now it's a state variable and it's initialised elsewhere
# self.ChanQAvg = maskinfo.in_zero()

# initialise outputs once everything is set
self.output_module.initial()
Expand Down
Loading

0 comments on commit 36aecd5

Please sign in to comment.