MARRMOT_20
Implementation
MARRMoT v2.1.1 rev eeb7e15 m_20_gsfb_8p_3s; standardized continuous structure, not original model
Time step: daily
Backend: octave-cli + Octave optim
Calibrated parameters: 8
Temperature required: no
Parameters and initial configuration
Parameter |
Supported calibration range |
Default |
|---|---|---|
|
0 to 1 |
0.5 |
|
0.05 to 0.95 |
0.5 |
|
1 to 2000 |
1000.5 |
|
0 to 20 |
10.0 |
|
0 to 200 |
100.0 |
|
0 to 1 |
0.5 |
|
0 to 1 |
0.5 |
|
1 to 300 |
150.5 |
|
Fixed initial/configuration value |
0.0 |
|
Fixed initial/configuration value |
0.0 |
|
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;
c = theta(1); % Recharge time coeffcient [d-1]
ndc = theta(2); % Threshold fraction of Smax [-]
smax = theta(3); % Maximum soil moisture storage [mm]
emax = theta(4); % Maximum evaporation flux [mm/d]
frate = theta(5); % Maximum infiltration rate [mm/d]
b = theta(6); % Fraction of subsurface flow that is baseflow [-]
dpf = theta(7); % Baseflow time coefficient [d-1]
sdrmax = theta(8); % Threshold before baseflow can occur [mm]
% delta_t
delta_t = obj.delta_t;
% stores
S1 = S(1);
S2 = S(2);
S3 = S(3);
% 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_ea = evap_20(emax,ndc,S1,smax,Ep,delta_t);
flux_qs = saturation_1(P,S1,smax);
flux_f = interflow_11(frate,ndc*smax,S1,delta_t);
flux_qb = baseflow_9(b*dpf,sdrmax,S2);
flux_dp = baseflow_1((1-b)*dpf,S2);
flux_qdr = recharge_5(c,ndc*smax,S3,S1);
% stores ODEs
dS1 = P + flux_qdr - flux_ea - flux_qs - flux_f;
dS2 = flux_f - flux_qb - flux_dp;
dS3 = flux_dp - flux_qdr;
% outputs
dS = [dS1 dS2 dS3];
fluxes = [flux_ea, flux_qs, flux_f, flux_qb, flux_dp, flux_qdr];
end
% STEP runs at the end of every timestep
function [out] = evap_20(p1,p2,S,Smax,Ep,dt)
%evap_20
% 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 limited by a maximum evaporation rate and
% scaled below a wilting point
% Constraints: f <= Ep
% f <= S/dt
% @(Inputs): p1 - maximum evaporation rate [mm/d]
% p2 - wilting point as fraction of Smax [-]
% S - current storage [mm]
% Smax - maximum storage [mm]
% Ep - potential evapotranspiration rate [mm/d]
% dt - time step size [d]
out = min([p1.*S./(p2.*Smax),Ep,S/dt]);
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] = interflow_11(p1,p2,S,dt,varargin)
%interflow_11
% 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: Constant interflow if storage exceeds a threshold
% Constraints: f <= (S-p2_/dt
% @(Inputs): p1 - interflow rate [mm/d]
% p2 - storage threshold for flow generation [mm]
% S - current storage [mm]
% dt - time step size [d]
% varargin(1) - smoothing variable r (default 0.01)
% varargin(2) - smoothing variable e (default 5.00)
if size(varargin,2) == 0
out = min(p1,(S-p2)/dt).*(1-smoothThreshold_storage_logistic(S,p2));
elseif size(varargin,2) == 1
out = min(p1,(S-p2)/dt).*(1-smoothThreshold_storage_logistic(S,p2,varargin(1)));
elseif size(varargin,2) == 2
out = min(p1,(S-p2)/dt).*(1-smoothThreshold_storage_logistic(S,p2,varargin(1),varargin(2)));
end
end
function [out] = baseflow_9(p1,p2,S)
%baseflow_9 Linear flow above a threshold
% 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: Linear outflow from a reservoir if a storage threshold is exceeded
% Constraints: -
% @(Inputs): p1 - time coefficient [d-1]
% p2 - storage threshold for flow generation [mm]
% S - current storage [mm]
out = p1.*max(0,S-p2);
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] = recharge_5(p1,p2,S1,S2)
%recharge_5
% 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: Recharge to fulfil evaporation demand if the receiving
% store is below a threshold
% Constraints: -
% @(Inputs): p1 - time coefficient [d-1]
% p2 - storage threshold in S2 [mm]
% S1 - current storage in S1 [mm]
% S2 - current storage in S1 [mm]
out = p1.*S1.*(1-min(1,S2./p2));
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_20").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.