if (FALSE) {
## Load example data for test running DMMF_Simple function
data(Potato.Convex)
attach(Potato.Convex)
## Make toy dataset using summary statistics of field datasets of "Potato.Convex" data.
## The width and slope of the field are set according to the slope length of the convex field
## from Arnhold et al. (2013)
W = 25
L = 25
## The slope of the field is set as the average slope angle of the field from Arnhold et al. (2013)
S <- pi/180 * 9
## The proportion of impervious areas are estimated as the mean value of the IMP map.
IMP <- cellStats(s.map$IMP, stat='mean', na.rm=TRUE)
## "n_s" estimated using the guide value of RFR using paraplough (10cm/m)
## and conversion equation from RFR to Manning's n from Morgan and Duzant (2008).
n_s <- 0.171
## Using the ridge height of the field from Arnhold et al. (2013)
## as the hydrological radius (flow depth) of the field.
d_a <- 0.15
## We use dynamic variables of the 12th day that has enough rainfall to produce soil erosion.
d.var_12<- d.var[12,]
## Run DMMF_Simple function
Output <- DMMF_Simple( W = W, L = L, S = S, R = d.var_12$R, RI = d.var_12$RI, ET = d.var_12$ET,
P_c = s.var$P_c, P_z = s.var$P_z, P_s = s.var$P_s,
theta_init = s.var$theta_fc, theta_sat = s.var$theta_sat,
theta_fc = s.var$theta_fc, SD = s.var$SD, K = s.var$K, P_I = s.var$P_I,
n_s = n_s, CC = d.var_12$CC, GC = s.var$GC, IMP = IMP, PH = d.var_12$PH,
D = s.var$D, NV = s.var$NV, d_a = d_a,
DK_c = s.var$DK_c, DK_z = s.var$DK_z, DK_s = s.var$DK_s,
DR_c = s.var$DR_c, DR_z = s.var$DR_z, DR_s = s.var$DR_s,
Q_in = 0, IF_in = 0, SL_c_in = 0, SL_z_in = 0, SL_s_in = 0, R_type = 0)
## Print outputs.
Output
## Calculate per unit surface area
## Runoff per surface area of the field
Output$Q_out / Output$A
## Interflow per surface area of the field
Output$IF_out / Output$A
## Soil loss per surface area of the field
(Output$SL_c_out + Output$SL_z_out + Output$SL_s_out) / Output$A
}
Run the code above in your browser using DataLab