Example #1
0
    def set_parameters(self):
        """
        Sets the parameters for a cell instance
        :param par: Object with all parameters
        :return: None
        """
        c = self.cell
        out = self.outlet

        # Fill in some water
        c.layers[0].volume = 296.726 / 1000 * self.area * 1e6
        c.layers[1].volume = 77.053 / 1000 * self.area * 1e6

        # Scale to the cellsize
        V0_L1 = (185.524 / 1000) * self.area * 1e6
        V0_L2 = (150.623 / 1000) * self.area * 1e6

        # Set uptake stress
        ETV1 = 0.145 * V0_L1
        ETV0 = 0.434 * ETV1
        c.set_uptakestress(cmf.VolumeStress(ETV1, ETV0))

        # Connect layer and outlet
        cmf.PowerLawConnection(c.layers[0],
                               out,
                               Q0=V0_L1 / 48.823,
                               V0=V0_L1,
                               beta=2.949)

        cmf.PowerLawConnection(c.layers[0],
                               c.layers[1],
                               Q0=(V0_L1 / 3.198),
                               V0=V0_L1,
                               beta=3.743)
        cmf.PowerLawConnection(c.layers[1],
                               out,
                               Q0=V0_L2 / 162.507,
                               V0=V0_L2,
                               beta=1.081)

        # Snow
        cmf.SimpleTindexSnowMelt(c.snow, c.layers[0], c, rate=3.957)
        cmf.Weather.set_snow_threshold(3.209)

        # Split the rainfall in interception and throughfall
        cmf.Rainfall(c.canopy, c, False, True)
        cmf.Rainfall(c.surfacewater, c, True, False)

        # Make an overflow for the interception storage
        cmf.RutterInterception(c.canopy, c.surfacewater, c)

        # Transpiration from the plants is added
        cmf.CanopyStorageEvaporation(c.canopy, c.evaporation, c)

        # Sets the paramaters for interception
        c.vegetation.LAI = 9.852

        # Defines how much throughfall there is (in %)
        c.vegetation.CanopyClosure = 0.603
Example #2
0
    def set_parameters(self, par):
        """
        Sets the parameters for a cell instance
        :param par: Object with all parameters
        :return: None
        """
        c = self.cell
        out = self.outlet

        # Scale to the cellsize
        V0_L1 = (par.V0_L1 / 1000) * self.area * 1e6
        V0_L2 = (par.V0_L2 / 1000) * self.area * 1e6

        # Set uptake stress
        ETV1 = par.fETV1 * V0_L1
        ETV0 = par.fETV0 * ETV1
        c.set_uptakestress(cmf.VolumeStress(ETV1, ETV0))

        # Connect layer and outlet
        cmf.PowerLawConnection(c.layers[0],
                               out,
                               Q0=V0_L1 / par.tr_L1_out,
                               V0=V0_L1,
                               beta=par.beta_L1_out)

        cmf.PowerLawConnection(c.layers[0],
                               c.layers[1],
                               Q0=(V0_L1 / par.tr_L1_L2),
                               V0=V0_L1,
                               beta=par.beta_L1_L2)
        cmf.PowerLawConnection(c.layers[1],
                               out,
                               Q0=V0_L2 / par.tr_L2_out,
                               V0=V0_L2,
                               beta=par.beta_L2_out)

        # Snow
        cmf.SimpleTindexSnowMelt(c.snow,
                                 c.layers[0],
                                 c,
                                 rate=par.snow_meltrate)
        cmf.Weather.set_snow_threshold(par.snow_melt_temp)

        # Split the rainfall in interception and throughfall
        cmf.Rainfall(c.canopy, c, False, True)
        cmf.Rainfall(c.surfacewater, c, True, False)

        # Make an overflow for the interception storage
        cmf.RutterInterception(c.canopy, c.surfacewater, c)

        # Transpiration from the plants is added
        cmf.CanopyStorageEvaporation(c.canopy, c.evaporation, c)

        # Sets the paramaters for interception
        c.vegetation.LAI = par.LAI

        # Defines how much throughfall there is (in %)
        c.vegetation.CanopyClosure = par.CanopyClosure
    def create_connections(self):
        # Route snow melt to surface
        cmf.SimpleTindexSnowMelt(self.cell.snow,
                                 self.cell.surfacewater,
                                 rate=7)
        # Infiltration
        cmf.SimpleInfiltration(self.soil, self.cell.surfacewater, W0=0.8)
        # Route infiltration / saturation excess to outlet
        cmf.WaterBalanceFlux(self.cell.surfacewater, self.outlet)
        # Parameterize soil water capacity
        self.soil.soil.porosity = 0.2
        C = self.soil.get_capacity()
        # Parameterize water stress function
        self.cell.set_uptakestress(cmf.VolumeStress(0.2 * C, 0 * C))
        cmf.TurcET(self.soil, self.cell.transpiration)

        # Route water from soil to gw
        cmf.PowerLawConnection(self.soil,
                               self.gw,
                               Q0=self.mm_to_m3(50),
                               V0=0.5 * C,
                               beta=4)
        # Route water from gw to outlet
        cmf.LinearStorageConnection(self.gw,
                                    self.outlet,
                                    residencetime=20,
                                    residual=0 * C)
 def get_runoff(v, beta=1, residual=0):
     """
     Calculates runoff from W1 to W2 when volume of W1 is v with beta and residual
     """
     cmf.PowerLawConnection(W1,
                            W2,
                            Q0=1,
                            V0=1,
                            beta=beta,
                            residual=residual)
     W1.volume = v
     return W1.flux_to(W2, cmf.Time())
Example #5
0
    def setparameters(self, par=None):
        """
        Sets the parameters of the model by creating the connections
        """
        par = par or spotpy.parameter.create_set(self, valuetype='optguess')

        # Some shortcuts to gain visibility
        c = self.project[0]
        o = self.outlet

        # Set uptake stress
        ETV1 = par.fETV1 * par.V0
        ETV0 = par.fETV0 * ETV1
        c.set_uptakestress(cmf.VolumeStress(ETV1, ETV0))

        # Connect layer with outlet
        cmf.PowerLawConnection(c.layers[0], o,
                               Q0=par.V0 / par.tr, beta=par.beta,
                               residual=par.Vr * par.V0, V0=par.V0)