[GRASS-git] [OSGeo/grass] c69a52: r.sim: Keep the diffusion coefficient in a walker-...

Vaclav Petras noreply at github.com
Tue Sep 29 09:22:07 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/OSGeo/grass
  Commit: c69a52a26b3fb8c0f8b91080aa88b51388b040a7
      https://github.com/OSGeo/grass/commit/c69a52a26b3fb8c0f8b91080aa88b51388b040a7
  Author: Vaclav Petras <wenzeslaus at gmail.com>
  Date:   2026-09-29 (Tue, 29 Sep 2026)

  Changed paths:
    M raster/r.sim/simlib/hydro.c
    M raster/r.sim/simlib/input.c
    M raster/r.sim/simlib/simlib.h

  Log Message:
  -----------
  r.sim: Keep the diffusion coefficient in a walker-local variable (#7965)

The diffusion coefficient of a walker's move was stored in a raster-sized
grid cell only to be read back by the same walker a few lines later, so
with nprocs > 1, concurrent walkers in the same cell could read each
other's value. Keep it in a local variable instead and drop the grid,
which also saves one float grid of memory.

The local variable is a float, the type of the grid, rather than a
double, so that single-threaded results do not change: the depth,
discharge, sediment flux and erosion/deposition maps of single-threaded
runs on the nc_spm elevation are byte-identical to those before this
change. With more threads, results can differ from before, because a
walker no longer moves with a coefficient another walker wrote.

Written with the help of Claude Code.



To unsubscribe from these emails, change your notification settings at https://github.com/OSGeo/grass/settings/notifications


More information about the grass-commit mailing list