MARRMOT_46

Implementation

MARRMoT v2.1.1 rev eeb7e15 m_46_classic_12p_8s; standardized continuous structure, not original model

  • Time step: daily

  • Backend: octave-cli + Octave optim

  • Calibrated parameters: 12

  • Temperature required: no

Inspect the exact implementation.

Parameters and initial configuration

Parameter

Supported calibration range

Default

p01

0 to 1

0.5

p02

0.01 to 0.99

0.5

p03

1 to 2000

1000.5

p04

0 to 1

0.5

p05

0 to 1

0.5

p06

0 to 1

0.5

p07

0.01 to 0.99

0.5

p08

1 to 2000

1000.5

p09

0 to 1

0.5

p10

0 to 1

0.5

p11

0 to 1

0.5

p12

0 to 1

0.5

s01

Fixed initial/configuration value

0.0

s02

Fixed initial/configuration value

0.0

s03

Fixed initial/configuration value

0.0

s04

Fixed initial/configuration value

0.0

s05

Fixed initial/configuration value

0.0

s06

Fixed initial/configuration value

0.0

s07

Fixed initial/configuration value

0.0

s08

Fixed initial/configuration value

0.0

Ranges/defaults are implementation contracts, not universal priors or a recommended basin calibration. Consult source comments for parameter units and coupling.

Governing equations

The following source is the exact model kernel used by this adapter. For MARRMoT it includes the state derivative and each referenced flux function; the solver and routing are described above. Original notices and source citations are retained in the files.

        function [dS, fluxes] = model_fun(obj, S)
            % parameters
            theta   = obj.theta;
            fap   = theta(1);     % Fraction of catchment area that has permeable soils [-]
            fdp   = theta(2);     % Fraction of depth of permeable soil that is store Px [-]
            dp    = theta(3);     % Depth of permeable soil [mm]
            cq    = theta(4);     % Runoff coefficient for permeable soil [d-1]
            d1    = theta(5);     % Fraction of Ps that infiltrates into semi-permeable soil [-]
            tf    = theta(6);     % Fraction of (1-fap) that is fas [-]
            fds   = theta(7);     % Fraction of depth of semi-permeable soil that is store Sx [-]
            ds    = theta(8);     % Depth of semi-permeable soil [mm]
            d2    = theta(9);     % Fraction effective precipitation in semi-permeable soils that goes to quick flow [-]
            cxq   = theta(10);    % Quick runoff coefficient for semi-permeable soil [d-1]
            cxs   = theta(11);    % Slow runoff coefficient for semi-permeable soil [d-1]
            cu    = theta(12);    % Runoff coefficient for impermeable soil [d-1]
            
            % auxiliary parameters
            aux_theta = obj.aux_theta;
            fas = aux_theta(1);   % Fraction of catchment area that has semi-permeable soils [-]
            fai = aux_theta(2);   % Fraction of catchment area that has impermeable soils [-]
            pxm = aux_theta(3);   % Depth of store Px [mm]
            pym = aux_theta(4);   % Depth of store Py [mm]
            sxm = aux_theta(5);   % Depth of store Sx [mm]
            sym = aux_theta(6);   % Depth of store Sy [mm]
            
            % delta_t
            delta_t = obj.delta_t;
            
            % stores
            S1 = S(1);
            S2 = S(2);
            S3 = S(3);
            S4 = S(4);
            S5 = S(5);
            S6 = S(6);
            S7 = S(7);
            S8 = S(8);
            
            % climate input
            t = obj.t;                             % this time step
            climate_in = obj.input_climate(t,:);   % climate at this step
            P  = climate_in(1);
            Ep = climate_in(2);
            T  = climate_in(3);
            
            % fluxes functions
            flux_pp  = split_1(fap,P);
            flux_ps  = split_1(fas,P);
            flux_pi  = split_1(fai,P);
            flux_epx = evap_1(S1,fap*Ep,delta_t);
            flux_ppx = saturation_1(flux_pp,S1,pxm);
            flux_epy = evap_18(1.9,0.6523,pxm,S2+pxm,fap*Ep-flux_epx);
            flux_ppe = saturation_9(flux_ppx,S2,0.01);
            flux_q   = baseflow_1(cq,S3);
            flux_psd = split_1(1-d1,flux_ps);
            flux_psi = split_1(d1,flux_ps);
            flux_esx = evap_1(S4,fas*Ep,delta_t);
            flux_psx = saturation_1(flux_psi,S4,sxm);
            flux_esy = evap_18(1.9,0.6523,sxm,S4+sxm,fas*Ep-flux_esx);
            flux_pse = saturation_9(flux_psx,S5,0.01);
            flux_psq = split_1(d2,flux_pse+flux_psd);
            flux_pss = split_1(1-d2,flux_pse+flux_psd);
            flux_xq  = baseflow_1(cxq,S6);
            flux_xs  = baseflow_1(cxs,S7);
            flux_pie = effective_1(fai*flux_pi,0.5);
            flux_ei  = flux_pi - flux_pie;
            flux_u   = baseflow_1(cu,S8);

            % stores ODEs
            dS1 =    flux_pp  - flux_epx - flux_ppx;
            dS2 =  -(flux_ppx - flux_epy - flux_ppe);    
            dS3 =    flux_ppe - flux_q;    
            dS4 =    flux_psi - flux_esx - flux_psx;    
            dS5 =  -(flux_psx - flux_esy - flux_pse);    
            dS6 =    flux_psq - flux_xq;    
            dS7 =    flux_pss - flux_xs;    
            dS8 =    flux_pie - flux_u; 
            
            % outputs
            dS = [dS1 dS2 dS3 dS4 dS5 dS6 dS7 dS8];
            fluxes = [flux_pp,  flux_ps,  flux_pi,  flux_epx, flux_ppx,...
                      flux_epy, flux_ppe, flux_q,   flux_psd, flux_psi,...
                      flux_esx, flux_psx, flux_esy, flux_pse, flux_psq,...
                      flux_pss, flux_xq,  flux_xs,  flux_ei,  flux_pie, flux_u];
        end
        
        % STEP runs at the end of every timestep
function [out] = split_1(p1,In)
%split_1 flow splitting

% Copyright (C) 2019, 2021 Wouter J.M. Knoben, Luca Trotter
% This file is part of the Modular Assessment of Rainfall-Runoff Models
% Toolbox (MARRMoT).
% MARRMoT is a free software (GNU GPL v3) and distributed WITHOUT ANY
% WARRANTY. See <https://www.gnu.org/licenses/> for details.

% Flux function
% ------------------
% Description:  Split flow (returns flux [mm/d])
% Constraints:  -
% @(Inputs):    p1   - fraction of flux to be diverted [-]
%               In   - incoming flux [mm/d]

out = p1.*In;

end
function [out] = evap_1(S,Ep,dt)
%evap_1 

% Copyright (C) 2019, 2021 Wouter J.M. Knoben, Luca Trotter
% This file is part of the Modular Assessment of Rainfall-Runoff Models
% Toolbox (MARRMoT).
% MARRMoT is a free software (GNU GPL v3) and distributed WITHOUT ANY
% WARRANTY. See <https://www.gnu.org/licenses/> for details.

% Flux function
% ------------------
% Description:  Evaporation at the potential rate
% Constraints:  f <= S/dt
% @(Inputs):    S    - current storage [mm]
%               Ep   - potential evaporation rate [mm/d]
%               dt   - time step size

out = min(S/dt,Ep);

end
function [out] = saturation_1(In,S,Smax,varargin)
%saturation_1 

% Copyright (C) 2019, 2021 Wouter J.M. Knoben, Luca Trotter
% This file is part of the Modular Assessment of Rainfall-Runoff Models
% Toolbox (MARRMoT).
% MARRMoT is a free software (GNU GPL v3) and distributed WITHOUT ANY
% WARRANTY. See <https://www.gnu.org/licenses/> for details.

% Flux function
% ------------------
% Description:  Saturation excess from a store that has reached maximum capacity
% Constraints:  -
% @(Inputs):    In   - incoming flux [mm/d]
%               S    - current storage [mm]
%               Smax - maximum storage [mm]
%               varargin(1) - smoothing variable r (default 0.01)
%               varargin(2) - smoothing variable e (default 5.00)

if size(varargin,2) == 0
    out = In.*(1-smoothThreshold_storage_logistic(S,Smax));
elseif size(varargin,2) == 1
    out = In.*(1-smoothThreshold_storage_logistic(S,Smax,varargin(1)));
elseif size(varargin,2) == 2
    out = In.*(1-smoothThreshold_storage_logistic(S,Smax,varargin(1),varargin(2)));    
end

end
function [out] = evap_18(p1,p2,p3,S,Ep)
%evap_18 

% Copyright (C) 2019, 2021 Wouter J.M. Knoben, Luca Trotter
% This file is part of the Modular Assessment of Rainfall-Runoff Models
% Toolbox (MARRMoT).
% MARRMoT is a free software (GNU GPL v3) and distributed WITHOUT ANY
% WARRANTY. See <https://www.gnu.org/licenses/> for details.

% Flux function
% ------------------
% Description:  Exponentially declining evaporation from deficit store
% Constraints:  -
% @(Inputs):    p1   - linear scaling parameter [-]
%               p2   - linear scaling parameter [-]
%               p3   - storage scaling parameter [mm]
%               S    - current storage [mm]
%               Ep   - potential evapotranspiration rate [mm/d]

out = p1.*exp(-1.*p2.*S./p3).*Ep;

end
function [out] = saturation_9(In,S,St,varargin)
%saturation_9 

% Copyright (C) 2019, 2021 Wouter J.M. Knoben, Luca Trotter
% This file is part of the Modular Assessment of Rainfall-Runoff Models
% Toolbox (MARRMoT).
% MARRMoT is a free software (GNU GPL v3) and distributed WITHOUT ANY
% WARRANTY. See <https://www.gnu.org/licenses/> for details.

% Flux function
% ------------------
% Description:  Deficit store: Saturation excess from a store that has 
%               reached maximum capacity
% Constraints:  -
% @(Inputs):    In   - incoming flux [mm/d]
%               S    - current storage [mm]
%               St   - threshold for flow generation [mm], 0 for deficit
%               store
%               varargin(1) - smoothing variable r (default 0.01)
%               varargin(2) - smoothing variable e (default 5.00)

if size(varargin,2) == 0
    out = In.*smoothThreshold_storage_logistic(S,St);
elseif size(varargin,2) == 1
    out = In.*smoothThreshold_storage_logistic(S,St,varargin(1));
elseif size(varargin,2) == 2
    out = In.*smoothThreshold_storage_logistic(S,St,varargin(1),varargin(2));    
end

end
function [out] = baseflow_1(p1,S)
% baseflow_1 

% Copyright (C) 2019, 2021 Wouter J.M. Knoben, Luca Trotter
% This file is part of the Modular Assessment of Rainfall-Runoff Models
% Toolbox (MARRMoT).
% MARRMoT is a free software (GNU GPL v3) and distributed WITHOUT ANY
% WARRANTY. See <https://www.gnu.org/licenses/> for details.

% Flux function
% ------------------
% Description:  Outflow from a linear reservoir
% Constraints:  -
% @(Inputs):    p1   - time scale parameter [d-1]
%               S    - current storage [mm]

out = p1.*S;

end
function [out] = effective_1(In1,In2)
%effective_1 

% Copyright (C) 2019, 2021 Wouter J.M. Knoben, Luca Trotter
% This file is part of the Modular Assessment of Rainfall-Runoff Models
% Toolbox (MARRMoT).
% MARRMoT is a free software (GNU GPL v3) and distributed WITHOUT ANY
% WARRANTY. See <https://www.gnu.org/licenses/> for details.

% Flux function
% ------------------
% Description:  General effective flow (returns flux [mm/d])
% Constraints:  In1 > In2
% @(Inputs):    In1  - first flux [mm/d]
%               In2  - second flux [mm/d]

out = max(In1-In2,0);

end
function [out] = smoothThreshold_storage_logistic(S,Smax,r,e)
%smoothThreshold_storage_logistic Logisitic smoother for storage threshold functions.

% Copyright (C) 2018 Wouter J.M. Knoben
% This file is part of the Modular Assessment of Rainfall-Runoff Models
% Toolbox (MARRMoT).
% MARRMoT is a free software (GNU GPL v3) and distributed WITHOUT ANY
% WARRANTY. See <https://www.gnu.org/licenses/> for details.

%   Smooths the transition of threshold functions of the form:
%
%   Q = { P, if S = Smax
%       { 0, if S < Smax
%
%   By transforming the equation above to Q = f(P,S,Smax,e,r):
%   Q = P * 1/ (1+exp((S-Smax+r*e*Smax)/(r*Smax)))
%
%   Inputs:
%   S       : current storage
%   Smax    : maximum storage
%   r       : [optional] smoothing parameter rho, default = 0.01
%   e       : [optional] smoothing parameter e, default 5
%
%   NOTE: this function only outputs the multiplier. This needs to be
%   applied to the proper flux utside of this function.
%
%   NOTE: can be applied for temperature thresholds as well (i.e. snow
%   modules). This simply means that S becomes T, and Smax T0.

% Check for inputs and use defaults if not provided
% NOTE: this is not very elegant, but it is more than a factor 10 faster then: 
% if ~exist('r','var'); r = 0.01; end
% if ~exist('e','var'); e = 5.00; end
if nargin == 2
    r = 0.01;
    e = 5.00;
elseif nargin == 3
    r = r{1};
    e = 5.00;
elseif nargin == 4
    r = r{1};
    e = e{1};
end

% Calculate multiplier
Smax = max(Smax,0);   % this avoids numerical instabilities when Smax<0
if r*Smax == 0
    out = 1 ./ (1+exp((S-Smax+r*e*Smax)/(r)));
else
    out = 1 ./ (1+exp((S-Smax+r*e*Smax)/(r*Smax)));
end

end

Note

This standardized MARRMoT structure is not identical to the original named model. p01... follow exact source order; s01... are fixed initial stores, defaulting to zero. Octave + optim are required. Solver behavior can differ across runtime versions.

Simulation

from basinforge import Basin, get_model

basin = Basin.from_csv("basin.csv", basin_id="A", area_km2=1200,
                       q_unit="m3/s", timestep="daily")
q_mm = get_model("MARRMOT_46").simulate(basin)
q_m3s = basin.to_m3s(q_mm)

Supply your actual data and catchment area; temperature-dependent models require a temperature column. For non-daily models, choose an appropriate warmup in model steps.

See calibration, input requirements, sources and verification limitations.