alimaye / sun-fan-delta-model

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

Bugfix, and towards #53 (channel network) #54

Closed amoodie closed 3 years ago

amoodie commented 3 years ago

I've been working on #53, and came across what I think is a bug. This PR fixes that bug.

The bug: missing water discharge at confluences. When >two flows went into one cell the Qw field is correctly added to anything that was already in the downstream cell (see here). However, the Qw_toRoute field is not updated by summation but rather replacement (see here).

As a result of not summing, the amount of water that is routed from this confluence point would be wrong. Depending on the order of cells in the column ordering (i.e., the routing order), this error could be large or small. Indeed, sometimes, the confluence discharge was set to 0 and no flow would be routed from that point (if it were later in the routing order). This would lead to flowsToFrac_Qw_distributed field being empty for this confluence cell when it was indexed in updateTopography.

I believe this is a bug, and I have corrected it, but want to be sure you agree it is a bug.

FWIW, this goes at least some of the way of making bifurcations and braid plains more stable: channels are not set to Qw=0 by mistake and thus abandoned.

Screenshot from 2021-09-21 17-16-18

alimaye commented 3 years ago

good catch