diff --git a/raster/r.sim/r.sim.water/main.c b/raster/r.sim/r.sim.water/main.c index 209be3e33d9..c4fda164276 100644 --- a/raster/r.sim/r.sim.water/main.c +++ b/raster/r.sim/r.sim.water/main.c @@ -239,6 +239,18 @@ int main(int argc, char *argv[]) parm.niter->description = _("Time used for iterations [minutes]"); parm.niter->guisection = _("Parameters"); + parm.mintimestep = G_define_option(); + parm.mintimestep->key = "mintimestep"; + parm.mintimestep->type = TYPE_DOUBLE; + parm.mintimestep->answer = "0.0"; + parm.mintimestep->required = NO; + parm.mintimestep->label = + _("Minimum time step for the simulation [seconds]"); + parm.mintimestep->description = + _("A larger minimum time step substantially reduces processing time, " + "but at the cost of accuracy"); + parm.mintimestep->guisection = _("Parameters"); + parm.outiter = G_define_option(); parm.outiter->key = "output_step"; parm.outiter->type = TYPE_INTEGER; @@ -319,8 +331,9 @@ int main(int argc, char *argv[]) parm.threads->type = TYPE_INTEGER; parm.threads->answer = NUM_THREADS; parm.threads->required = NO; - parm.threads->description = - _("Number of threads which will be used for parallel compute"); + parm.threads->description = _( + "Number of threads which will be used for parallel computation. Increasing " + "the number of threads does not really speed up the simulation."); parm.threads->guisection = _("Parameters"); if (G_parser(argc, argv)) @@ -388,6 +401,7 @@ int main(int argc, char *argv[]) G_debug(3, "Parsing numeric parameters"); sscanf(parm.niter->answer, "%d", &wp.timesec); + sscanf(parm.mintimestep->answer, "%lf", &wp.mintimestep); sscanf(parm.outiter->answer, "%d", &wp.iterout); sscanf(parm.diffc->answer, "%lf", &wp.frac); sscanf(parm.hmax->answer, "%lf", &wp.hhmax); diff --git a/raster/r.sim/r.sim.water/r.sim.water.html b/raster/r.sim/r.sim.water/r.sim.water.html index af54dea4490..93ebecd706f 100644 --- a/raster/r.sim/r.sim.water/r.sim.water.html +++ b/raster/r.sim/r.sim.water/r.sim.water.html @@ -25,6 +25,19 @@

DESCRIPTION

can be used to compute partial derivates of the predefined flow using its direction given by aspect and slope. +

+The equations are + +

+dx = tan(slope) * cos(aspect)
+
+ +and + +
+dy = tan(slope) * sin(aspect)
+
+

r.sim.water generated depth map
@@ -99,6 +112,13 @@

DESCRIPTION

diffusion term increases as given by halpha and advection term (direction of flow) is given as "prevailing" direction of flow computed as average of flow directions from the previous hbeta number of grid cells. +The model tries to keep water "shallow" with maximum shallow water +depth defined by hmax default 0.3 meters. However, water depths +much higher than hmax can be observed if water accumulates in +natural sinks or river beds. Depending on the area of interest and the +used digital elevation model, hmax, halpha and +hbeta might need to be adjusted in order to deal realistically +with elevation depressions or obstacles.

NOTES

@@ -146,6 +166,33 @@

NOTES

are useful both for everyday exploratory work using a desktop computer and for large, cutting-edge applications using high performance computing. +

+Suggested Manning's n for surface roughness
+from https://baharmon.github.io/hydrology-in-grass +

+ + + + + + + + + + + + + + + + + +
NLCD Landcover CategoryManning’s n value
Open Water0.001
Developed, Open Space0.0404
Developed, Low Intensity0.0678
Developed, Medium Intensity0.0678
Developed, High Intensity0.0404
Barren Land0.0113
Deciduous Forest0.36
Evergreen Forest0.32
Mixed Forest0.4
Shrub/Scrub0.4
Grassland/Herbaceuous0.368
Pasture/Hay0.325
Cultivated Crops0.325
Woody Wetlands0.086
Emergent Herbaceuous Wetlands0.1825
+ +

+The NLCD user guide +provides more information about the different NLCD classes. +

EXAMPLE

Using the North Carolina full sample dataset: diff --git a/raster/r.sim/simlib/hydro.c b/raster/r.sim/simlib/hydro.c index eb7649763e9..d8eea788641 100644 --- a/raster/r.sim/simlib/hydro.c +++ b/raster/r.sim/simlib/hydro.c @@ -104,6 +104,7 @@ int iterout, mx2o, my2o; int miter, nwalka; double timec; int ts, timesec; +double mintimestep; double rain_val; double manin_val; @@ -156,6 +157,8 @@ void main_loop(void) for (iblock = 1; iblock <= nblock; iblock++) { /* ++icoub; */ + G_message(_("Processing block %d of %d"), iblock, nblock); + lw = 0; walkwe = 0.; barea = stepx * stepy; diff --git a/raster/r.sim/simlib/input.c b/raster/r.sim/simlib/input.c index e9f41b88709..44a948d0244 100644 --- a/raster/r.sim/simlib/input.c +++ b/raster/r.sim/simlib/input.c @@ -95,6 +95,7 @@ void WaterParams_init(struct WaterParams *wp) wp->timec = 0; wp->ts = 0; wp->timesec = 0; + wp->mintimestep = 0; wp->rain_val = 0; wp->manin_val = 0; @@ -201,6 +202,7 @@ void init_library_globals(struct WaterParams *wp) timec = wp->timec; ts = wp->ts; timesec = wp->timesec; + mintimestep = wp->mintimestep; rain_val = wp->rain_val; manin_val = wp->manin_val; @@ -508,6 +510,9 @@ int grad_check(void) deltaw = 0.8 / (sigmax * vmax); /*time step for sediment */ deltap = 0.25 * sqrt(stepx * stepy) / vmean; /*time step for water */ + if (deltap < mintimestep) + deltap = mintimestep; + if (deltaw > deltap) timec = 4.; else diff --git a/raster/r.sim/simlib/simlib.h b/raster/r.sim/simlib/simlib.h index 4a0fe592bb7..2b651bb5503 100644 --- a/raster/r.sim/simlib/simlib.h +++ b/raster/r.sim/simlib/simlib.h @@ -35,6 +35,7 @@ struct WaterParams { int miter, nwalka; double timec; int ts, timesec; + double mintimestep; double rain_val; double manin_val; @@ -86,10 +87,10 @@ void free_walkers(void); struct options { struct Option *elevin, *dxin, *dyin, *rain, *infil, *traps, *manin, - *observation, *depth, *disch, *err, *outwalk, *nwalk, *niter, *outiter, - *density, *diffc, *hmax, *halpha, *hbeta, *wdepth, *detin, *tranin, - *tauin, *tc, *et, *conc, *flux, *erdep, *rainval, *maninval, *infilval, - *logfile, *seed, *threads; + *observation, *depth, *disch, *err, *outwalk, *nwalk, *niter, + *mintimestep, *outiter, *density, *diffc, *hmax, *halpha, *hbeta, + *wdepth, *detin, *tranin, *tauin, *tc, *et, *conc, *flux, *erdep, + *rainval, *maninval, *infilval, *logfile, *seed, *threads; }; struct flags { diff --git a/raster/r.sim/simlib/waterglobs.h b/raster/r.sim/simlib/waterglobs.h index 7bf9fab74f2..10acce39c5b 100644 --- a/raster/r.sim/simlib/waterglobs.h +++ b/raster/r.sim/simlib/waterglobs.h @@ -111,6 +111,7 @@ extern int iterout, mx2o, my2o; extern int miter, nwalka; extern double timec; extern int ts, timesec; +extern double mintimestep; extern double rain_val; extern double manin_val;