MARRMOT_22
Implementation
MARRMoT v2.1.1 rev eeb7e15 m_22_vic_10p_3s; standardized continuous structure, not original model
Time step: daily
Backend: octave-cli + Octave optim
Calibrated parameters: 10
Temperature required: no
Parameters and initial configuration
Parameter |
Supported calibration range |
Default |
|---|---|---|
|
0.1 to 5 |
2.55 |
|
0 to 1 |
0.5 |
|
1 to 365 |
183.0 |
|
1 to 2000 |
1000.5 |
|
0.01 to 0.99 |
0.5 |
|
0 to 10 |
5.0 |
|
0 to 1 |
0.5 |
|
0 to 10 |
5.0 |
|
0 to 1 |
0.5 |
|
1 to 5 |
3.0 |
|
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;
ibar = theta(1); % Mean interception capacity [mm]
idelta = theta(2); % Seasonal interception change as fraction of mean [-]
ishift = theta(3); % Maximum interception peak timing [-]
b = theta(6); % Infiltration excess shape parameter [-]
k1 = theta(7); % Percolation time parameter [d-1]
c1 = theta(8); % Percolation non-linearity parameter [-]
k2 = theta(9); % Baseflow time parameter [d-1]
c2 = theta(10); % Baseflow non-linearity parameter
aux_theta = obj.aux_theta;
smmax = aux_theta(1);
gwmax = aux_theta(2);
tmax = aux_theta(3);
% 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
aux_imax = phenology_2(ibar,idelta,ishift,obj.t,tmax,delta_t);
flux_ei = evap_7(S1,aux_imax,Ep,delta_t);
flux_peff = interception_1(P,S1,aux_imax);
flux_iex = excess_1(S1,aux_imax,delta_t);
flux_qie = saturation_2(S2,smmax,b,flux_peff+flux_iex);
flux_inf = effective_1(flux_peff+flux_iex,flux_qie);
flux_et1 = evap_7(S2,smmax,max(0,Ep-flux_ei),delta_t);
flux_qex1 = saturation_1(flux_inf,S2,smmax);
flux_pc = percolation_5(k1,c1,S2,smmax,delta_t);
flux_et2 = evap_7(S3,gwmax,max(0,Ep-flux_ei-flux_et1),delta_t);
flux_qex2 = saturation_1(flux_pc,S3,gwmax);
flux_qb = baseflow_5(k2,c2,S3,gwmax,delta_t);
% stores ODEs
dS1 = P - flux_ei - flux_peff - flux_iex;
dS2 = flux_inf - flux_et1 - flux_qex1 - flux_pc;
dS3 = flux_pc - flux_et2 - flux_qex2 - flux_qb;
% outputs
dS = [dS1 dS2 dS3];
fluxes = [flux_ei flux_peff flux_iex flux_qie ...
flux_inf flux_et1 flux_qex1 flux_pc ...
flux_et2 flux_qex2 flux_qb];
end
% STEP runs at the end of every timestep
function [out] = phenology_2(p1,p2,p3,t,tmax,dt)
%phenology_2
% 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: Phenology-based maximum interception capacity (returns store size [mm])
% Constraints: Implicit assumption: 0 <= p2 <= 1
% @(Inputs): p1 - mean interception capacity [mm]
% p2 - seasonal change as fraction of the mean [-]
% p3 - time of maximum store size [d]
% t - current time step [-]
% tmax - seasonal length [d]
% dt - time step size [d]
out = p1*(1+p2*sin(2*pi*(t*dt-p3)/tmax));
end
function [out] = evap_7(S,Smax,Ep,dt)
%evap_7 evaporation based on scaled current water storage, limited by
%potential rate.
% 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 scaled by relative storage
% Constraints: f <= S/dt
% @(Inputs): S - current storage [mm]
% Smax - maximum contributing storage [mm]
% Ep - potential evapotranspiration rate [mm/d]
% dt - time step size [d]
out = min(S./Smax.*Ep,S/dt);
end
function [out] = interception_1(In,S,Smax,varargin)
%interception_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: Interception excess when maximum capacity is reached
% 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] = excess_1(So,Smax,dt)
%excess_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: Storage excess when store size changes (returns flux [mm/d])
% Constraints: f >= 0
% @(Inputs): So - 'old' storage [mm]
% Smax - 'new' maximum storage [mm]
% dt - time step size [d]
out = max((So-Smax)/dt,0);
end
function [out] = saturation_2(S,Smax,p1,In)
%saturation_2
% 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 with different degrees of saturation
% Constraints: 1-S/Smax >= 0 prevents numerical issues with complex
% numbers
% @(Inputs): S - current storage [mm]
% Smax - maximum contributing storage [mm]
% p1 - non-linear scaling parameter [-]
% In - incoming flux [mm/d]
% NOTE: When stores are very slightly below or over their maximum, the
% exponent can push this function into regions where no feasible solutions
% exist. The min(max()) combination prevents this from happening.
out = (1- min(1,max(0,(1-S./Smax))).^p1) .*In;
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] = 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] = percolation_5(p1,p2,S,Smax,dt)
%percolation_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: Non-linear percolation
% Constraints: f <= S/dt
% S >= 0 prevents complex numbers
% @(Inputs): p1 - base percolation rate [mm/d]
% p2 - exponential scaling parameter [-]
% S - current storage [mm]
% Smax - maximum contributing storage [mm]
% dt - time step size [d]
out = min(S/dt,p1.*((max(S,0)./Smax).^p2));
end
function [out] = baseflow_5(p1,p2,S,Smax,dt)
%baseflow_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: Non-linear scaled outflow from a reservoir
% Constraints: f <= S/dt
% @(Inputs): p1 - base outflow rate [mm/d]
% p2 - exponential scaling parameter [-]
% S - current storage [mm]
% Smax - maximum contributing storage [mm]
% dt - time step size [d]
out = min(S/dt,p1*((max(S,0)/Smax)^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_22").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.