def _init_model(self, solver): if solver == 'numba': solver = PegasusNumba() num_app = ImplicitEulerNumba(root_finder=solver) elif solver == 'python': solver = PegasusPython() num_app = ImplicitEulerPython(root_finder=solver) fr = PowerReservoir(parameters = {'k' : 0.01, 'alpha' : 2.5}, states = {'S0' : 0.0}, approximation=num_app, id = 'FR') ur = UnsaturatedReservoir(parameters = {'Smax' : 50.0, 'Ce' : 1.5, 'm' : 0.01, 'beta' : 1.5, }, states = {'S0' : 0.2*50.0, 'PET' : None}, approximation=num_app, id = 'UR') hru = Unit(layers = [ [ur], [fr] ], id = 'H1') hru.set_timestep(1.0) self._model = hru
def _init_model(self, solver): if solver == 'numba': solver = PegasusNumba() num_app = ImplicitEulerNumba(root_finder=solver) elif solver == 'python': solver = PegasusPython() num_app = ImplicitEulerPython(root_finder=solver) fr = PowerReservoir(parameters={ 'k': 0.01, 'alpha': 2.5 }, states={'S0': 0.0}, approximation=num_app, id='FR') fr.set_timestep(2.0) self._model = fr
def _init_model(self, solver): if solver == 'numba': solver = PegasusNumba() num_app = ImplicitEulerNumba(root_finder=solver) elif solver == 'python': solver = PegasusPython() num_app = ImplicitEulerPython(root_finder=solver) ur = UnsaturatedReservoir(parameters={ 'Smax': 50.0, 'Ce': 1.5, 'm': 0.01, 'beta': 1.5 }, states={'S0': 0.2 * 50.0}, approximation=num_app, id='UR') ur.set_timestep(2.0) self._model = ur
from superflexpy.implementation.root_finders.pegasus import PegasusPython from superflexpy.implementation.numerical_approximators.implicit_euler import ImplicitEulerPython from superflexpy.implementation.elements.hbv import UnsaturatedReservoir, PowerReservoir from superflexpy.framework.unit import Unit root_finder = PegasusPython() numeric_approximator = ImplicitEulerPython(root_finder=root_finder) ur = UnsaturatedReservoir(parameters={ 'Smax': 50.0, 'Ce': 1.0, 'm': 0.01, 'beta': 2.0 }, states={'S0': 25.0}, approximation=numeric_approximator, id='UR') fr = PowerReservoir(parameters={ 'k': 0.1, 'alpha': 1.0 }, states={'S0': 10.0}, approximation=numeric_approximator, id='FR') model = Unit(layers=[[ur], [fr]], id='M4') from superflexpy.implementation.models.m4_sf_2011 import model model.set_input([P, E])
Dal Molin, M., Schirmer, M., Zappa, M., and Fenicia, F.: Understanding dominant controls on streamflow spatial variability to set up a semi-distributed hydrological model: the case study of the Thur catchment, Hydrol. Earth Syst. Sci., 24, 1319–1345, https://doi.org/10.5194/hess-24-1319-2020, 2020. """ from superflexpy.implementation.root_finders.pegasus import PegasusPython from superflexpy.implementation.numerical_approximators.implicit_euler import ImplicitEulerPython from superflexpy.implementation.elements.thur_model_hess import SnowReservoir, UnsaturatedReservoir, PowerReservoir, HalfTriangularLag from superflexpy.implementation.elements.structure_elements import Transparent, Junction, Splitter from superflexpy.framework.unit import Unit from superflexpy.framework.node import Node from superflexpy.framework.network import Network solver = PegasusPython() approximator = ImplicitEulerPython(root_finder=solver) # Fluxes in the order P, T, PET upper_splitter = Splitter( direction=[ [0, 1, None], # P and T go to the snow reservoir [2, None, None] # PET goes to the transparent element ], weight=[[1.0, 1.0, 0.0], [0.0, 0.0, 1.0]], id='upper-splitter') snow = SnowReservoir(parameters={ 't0': 0.0, 'k': 0.01, 'm': 2.0
def _init_model(self, solver): if solver == 'numba': solver = PegasusNumba() num_app = ImplicitEulerNumba(root_finder=solver) elif solver == 'python': solver = PegasusPython() num_app = ImplicitEulerPython(root_finder=solver) # Define HRU 1 (40%) fr = PowerReservoir(parameters={ 'k': 0.01, 'alpha': 2.5 }, states={'S0': 0.0}, approximation=num_app, id='FR') h1 = Unit(layers=[[fr]], id='H1') # Define HRU 2 (60%) fr = PowerReservoir(parameters={ 'k': 0.01, 'alpha': 2.5 }, states={'S0': 0.0}, approximation=num_app, id='FR') sr = PowerReservoir(parameters={ 'k': 1e-4, 'alpha': 1.0 }, states={'S0': 0.0}, approximation=num_app, id='SR') ur = UnsaturatedReservoir(parameters={ 'Smax': 50.0, 'Ce': 1.5, 'm': 0.01, 'beta': 1.5, }, states={ 'S0': 0.2 * 50.0, 'PET': None }, approximation=num_app, id='UR') s = Splitter(weight=[[0.3], [0.7]], direction=[[0], [0]], id='S') j = Junction(direction=[[0, 0]], id='J') h2 = Unit(layers=[[ur], [s], [fr, sr], [j]], id='H2') # Define the catchment cat = Node(units=[h1, h2], weights=[0.4, 0.6], area=1.0, id='Cat') cat.set_timestep(1.0) self._model = cat
CODED BY: Marco Dal Molin DESIGNED BY: Marco Dal Molin, Fabrizio Fenicia, Dmitri Kavetski This file implements a version of the model GR4J """ from superflexpy.implementation.root_finders.pegasus import PegasusPython from superflexpy.implementation.numerical_approximators.implicit_euler import ImplicitEulerPython from superflexpy.implementation.elements.gr4j import InterceptionFilter, ProductionStore, UnitHydrograph1, UnitHydrograph2, RoutingStore, FluxAggregator from superflexpy.implementation.elements.structure_elements import Transparent, Splitter, Junction from superflexpy.framework.unit import Unit x1, x2, x3, x4 = (50.0, 0.1, 20.0, 3.5) root_finder = PegasusPython() # Use the default parameters numerical_approximation = ImplicitEulerPython(root_finder) interception_filter = InterceptionFilter(id='ir') production_store = ProductionStore(parameters={'x1': x1, 'alpha': 2.0, 'beta': 5.0, 'ni': 4/9}, states={'S0': 10.0}, approximation=numerical_approximation, id='ps') splitter = Splitter(weight=[[0.9], [0.1]], direction=[[0], [0]], id='spl') unit_hydrograph_1 = UnitHydrograph1(parameters={'lag-time': x4},