Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions raster/r.sim/simlib/hydro.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,17 @@ void main_loop(const Setup *setup, const Geometry *geometry,
#endif
double hhc = pow(d1, 3. / 5.);
double velx, vely;
/* Diffusion coefficient of this walker's move */
float dif;
if (hhc > settings->hhmax &&
inputs->wdepth == NULL) { /* increased diffusion
if w.depth > hhmax */
grids->dif[k][l] =
(settings->halpha + 1) * deldif;
dif = (settings->halpha + 1) * deldif;
velx = sim->vavg[lw].x;
vely = sim->vavg[lw].y;
}
else {
grids->dif[k][l] = deldif;
dif = deldif;
velx = grids->v1[k][l];
vely = grids->v2[k][l];
}
Expand All @@ -262,10 +263,9 @@ void main_loop(const Setup *setup, const Geometry *geometry,
}
}

sim->w[lw].x +=
(velx +
grids->dif[k][l] * gaux); /* move the walker */
sim->w[lw].y += (vely + grids->dif[k][l] * gauy);
/* Move the walker. */
sim->w[lw].x += (velx + dif * gaux);
sim->w[lw].y += (vely + dif * gauy);

if (hhc > settings->hhmax &&
inputs->wdepth == NULL) {
Expand Down
2 changes: 0 additions & 2 deletions raster/r.sim/simlib/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ void alloc_grids_water(const Geometry *geometry, const Outputs *outputs,
grids->gama = G_alloc_matrix(geometry->my, geometry->mx);
if (outputs->err != NULL)
grids->gammas = G_alloc_matrix(geometry->my, geometry->mx);
grids->dif = G_alloc_fmatrix(geometry->my, geometry->mx);
}

void alloc_grids_sediment(const Geometry *geometry, const Outputs *outputs,
Expand All @@ -47,7 +46,6 @@ void alloc_grids_sediment(const Geometry *geometry, const Outputs *outputs,

/* memory allocation for output grids */

grids->dif = G_alloc_fmatrix(geometry->my, geometry->mx);
if (outputs->erdep != NULL || outputs->et != NULL)
grids->er = G_alloc_fmatrix(geometry->my, geometry->mx);
}
Expand Down
1 change: 0 additions & 1 deletion raster/r.sim/simlib/simlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ typedef struct {
float **er; // Erosion [output]
float **ct; // Transport capacity coefficient [input]
float **trap; // Traps [input]
float **dif; // Diffusion coefficient [internal]
} Grids;

struct point2D {
Expand Down
Loading