Added an extra constraint to ensure flux only returns values with non-negative deficits (i.e., water surplus):
Included test against known solution: the piece-wise function described in #61:
% function inputs
D = linspace(-1,1,201);
delta_t = 1;
% specify parameters as used in the Q0.05 pyMARRMoT comparison runs
dsurp = 100.95; % theta(6)
qpmax = 1; % theta(9)
% true solution
qp_true = zeros(1,length(D));
for i = 1:length(D)
d = D(i);
if d >= dsurp
out = min(d/delta_t,qpmax);
elseif d < 0
out = 0;
else
out = min(d/delta_t,qpmax*d/dsurp);
end
qp_true(i) = out;
end
Closes #61
Added an extra constraint to ensure flux only returns values with non-negative deficits (i.e., water surplus):
Included test against known solution: the piece-wise function described in #61: