alimaye / sun-fan-delta-model

GNU General Public License v3.0
0 stars 0 forks source link

Prob routing #56

Closed amoodie closed 2 years ago

amoodie commented 2 years ago

Probabalistic avulsion pathfinding and refactor water routing.

docstrings

%%% Path selection is implemented following Sun et al., 2005, as best as possible.
%%% The path is selected towards a steepest descent, but with
%%% randomness weighted by angle of deviation from the direction of
%%% the pre-avulsion flow path. Sun et al implementation is
%%% ambiguous in path direction downstream of the avulsion site is
%%% chosen; here we use a fixed angle-of-deviation weighting for
%%% all steps of path finding, but determine steepness on each step
%%% by the local neighborhood.
%%%
%%% To prevent single-cell loop and cross-over channel formation
%%% during avulsion path finding, we restrict flow to certain
%%% neighbor cells with the `forbiddenCells` array.
%%% Flow routing begins with the inlet cell, and it formulated as a
%%% sequential unordered walk through the channel network. Flow is
%%% stepped cell-by-cell, only moving to flowsTo cells when a given
%%% location has received flow from all contributing cells. This
%%% algorithm is an O(n) process, where n is the number of cells in
%%% the network.
%%%
%%% Routing is organized around `Qw_toRoute`, a `grid.size` of NaN, which
%%% records the location and volume of flow in the network. The cell
%%% to route flow next is selected by finding a location where
%%% `~isnan(Qw_toRoute)` and `readyToFlow`, where `readyToFlow` is
%%% true when a cell has received flow from all upstream cells. A
%%% cell is also limited to only flow once, by checking if it has
%%% `alreadyFlowed`; this check prevents loops in the network from
%%% recursion, but may lead to flow becoming trapped within the
%%% network. In these cases, the network loop is trimmed out, so that
%%% there is no loop on the next timestep.

results

We expected that probabalistic routing might lead to a complex network (#53), but this does not seem to be the case. I will have to keep looking to resolve that issue.