clear clc %define parameters for the drainage layer global x_end sl n Q1 dx % define parameters for the drainage layer x_end=5; % length of the drainage layer (m) sl=2/100; % slope of the drainage layer n=0.07/60; % manning's n dx=0.1; % spatial step in m, change this to a smaller value (e.g. 0.05) if rainfall is very dynamic load Substrate_outflow Q1=Q*10; % substrate outflow in mm/min, it is the inflow to the drainage layer