示例#1
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)

        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
示例#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
示例#3
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)

        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
示例#4
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)

        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(1.0)
        self._model = ur
示例#5
0
    'm04_SR_k': 0.000916739466627,
    'm04_split_split-par': 0.0,
}

PARAMETERS_WEIERBACH_M04 = {
    'm04_FR_k': 0.003454773102112,
    'm04_FR_alpha': 2.06272140965805,
    'm04_UR_Ce': 0.771711960349972,
    'm04_UR_Smax': 117.195201845032,
    'm04_UR_beta': 10.0,
    'm04_SR_k': 0.00157523385576,
    'm04_split_split-par': 0.0,
}

root_finder = PegasusPython(iter_max=1000)
num_app = ImplicitEulerPython(root_finder=root_finder)

unsaturated_reservoir = UnsaturatedReservoir(parameters={
    'Smax': 200.0,
    'Ce': 1.0,
    'm': 0.01,
    'beta': 0.02
},
                                             states={'S0': 100.0},
                                             approximation=num_app,
                                             id='UR')

splitter = ParameterizedSingleFluxSplitter(parameters={'split-par': 0.3},
                                           id='split')
fast_reservoir = PowerReservoir(parameters={
    'k': 0.1,
示例#6
0
visit the page https://superflexpy.readthedocs.io

CODED BY: Marco Dal Molin
DESIGNED BY: Marco Dal Molin, Fabrizio Fenicia, Dmitri Kavetski

This file implements a version of the model Hymod
"""

from superflexpy.implementation.computation.pegasus_root_finding import PegasusPython
from superflexpy.implementation.computation.implicit_euler import ImplicitEulerPython
from superflexpy.implementation.elements.hymod import UpperZone, LinearReservoir
from superflexpy.implementation.elements.structure_elements import Junction, Splitter, Transparent
from superflexpy.framework.unit import Unit

root_finder = PegasusPython()  # Use the default parameters
numerical_approximation = ImplicitEulerPython(root_finder)

upper_zone = UpperZone(parameters={
    'Smax': 50.0,
    'm': 0.01,
    'beta': 2.0
},
                       states={'S0': 10.0},
                       approximation=numerical_approximation,
                       id='uz')

splitter = Splitter(weight=[[0.6], [0.4]], direction=[[0], [0]], id='spl')

channel_routing_1 = LinearReservoir(parameters={'k': 0.1},
                                    states={'S0': 10.0},
                                    approximation=numerical_approximation,
示例#7
0
Reference
---------

Kavetski, D., and F. Fenicia (2011), Elements of a flexible approach
for conceptual hydrological modeling: 2. Application and experimental insights,
Water Resour. Res., 47, W11511, doi:10.1029/2011WR010748
"""

from superflexpy.implementation.computation.pegasus_root_finding import PegasusPython
from superflexpy.implementation.computation.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
},
示例#8
0
import sys
import pathlib
REPO_FOLDER = pathlib.Path(__file__).absolute().parents[2]
sys.path.insert(0, str(REPO_FOLDER))
from superflexpy.implementation.elements.thur_model_hess import SnowReservoir, UnsaturatedReservoir, HalfTriangularLag, PowerReservoir
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
from superflexpy.implementation.computation.pegasus_root_finding import PegasusPython
from superflexpy.implementation.computation.implicit_euler import ImplicitEulerPython

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
},
                     states={'S0': 0.0},
                     approximation=approximator,