To make a long story short, I spent this week fixing the problems encountered last week (plus some others). Although, rather than say 'fixing', I should say 'patching' or more accurately 'finding workarounds for'. The practical end result is the same: progress. Rather than belabor the issue(s), I'll just present some working results, and concentrate on the success of the effort instead of its gory details.
To test the code, I've manually set the channel width to 10.0 and the depth to 2.5 for all meandering nodes. The actual meandering calculations are now performed by an external Python program which is called (via popen()) from within meander_() in meander.cpp. All input and output arrays are passed to/from this program as text, which probably isn't the fastest way to do it, but makes the testing much easier to debug at present.
Here is an excerpt from a single meandering 'transaction' for the null case (delta x and y are always set to zero):
time = 0, stations = 96, stnserod = 96
i x y xs dels flow rerody lerody slope width depth diam
----- -------------- -------------- -------------- -------------- -------------- -------------- -------------- -------------- -------------- -------------- --------------
0 484.974226 960.000000 0.000000 10.000001 0.031688 0.010000 0.010000 0.010000 10.000000 2.500000 0.010000
1 484.970962 950.000000 10.000001 10.000001 0.031688 0.010000 0.010000 0.010000 10.000000 2.500000 0.010000
2 484.974293 940.000000 20.000001 10.000000 0.031688 0.010000 0.010000 0.010000 10.000000 2.500000 0.010000
3 484.976040 930.000000 30.000001 10.000000 0.031688 0.010000 0.010000 0.010000 10.000000 2.500000 0.010000
4 484.974226 920.000000 40.000001 10.000001 0.031688 0.010000 0.010000 0.010000 10.000000 2.500000 0.010000
5 484.970859 910.000000 50.000002 10.000001 0.031688 0.010000 0.010000 0.010000 10.000000 2.500000 0.010000
6 484.975120 900.000000 60.000003 10.000000 0.031688 0.010000 0.010000 0.010000 10.000000 2.500000 0.010000
7 484.976321 890.000000 70.000003 10.000000 0.031688 0.010000 0.010000 0.010000 10.000000 2.500000 0.010000
8 484.974226 880.000000 80.000003 10.000000 0.031688 0.010000 0.010000 0.010000 10.000000 2.500000 0.010000
9 484.974239 870.000000 90.000003 10.000000 0.031688 0.010000 0.010000 0.010000 10.000000 2.500000 0.010000
...
86 484.970384 100.000000 860.000045 10.000000 0.031688 0.010000 0.010000 0.010000 10.000000 2.500000 0.010000
87 484.967932 90.000000 870.000045 10.000002 0.031688 0.010000 0.010000 0.010000 10.000000 2.500000 0.010000
88 484.974226 80.000000 880.000047 10.000000 0.031688 0.010000 0.010000 0.009999 10.000000 2.500000 0.010000
89 484.974203 70.000000 890.000047 10.000000 0.031688 0.010000 0.010000 0.009999 10.000000 2.500000 0.010000
90 484.976472 60.000000 900.000047 10.000000 0.031688 0.010000 0.010000 0.009999 10.000000 2.500000 0.010000
91 484.974729 50.000000 910.000047 10.000000 0.031688 0.010000 0.010000 0.009999 10.000000 2.500000 0.010000
92 484.974226 40.000000 920.000047 10.000001 0.031688 0.010000 0.010000 0.009999 10.000000 2.500000 0.010000
93 484.970844 30.000000 930.000048 10.000001 0.031688 0.010000 0.010000 0.009999 10.000000 2.500000 0.010000
94 484.966139 20.000000 940.000049 10.000000 0.031688 0.010000 0.010000 0.009999 10.000000 2.500000 0.010000
95 484.967670 10.000000 950.000049 10.000002 0.031688 0.010000 0.010000 0.009999 10.000000 2.500000 0.010000
i delx dely rightdepth leftdepth lambda
----- -------------- -------------- -------------- -------------- --------------
0 0.000000 0.000000 2.500000 2.500000 0.500000
1 0.000000 0.000000 2.500000 2.500000 0.500000
2 0.000000 0.000000 2.500000 2.500000 0.500000
3 0.000000 0.000000 2.500000 2.500000 0.500000
4 0.000000 0.000000 2.500000 2.500000 0.500000
5 0.000000 0.000000 2.500000 2.500000 0.500000
6 0.000000 0.000000 2.500000 2.500000 0.500000
7 0.000000 0.000000 2.500000 2.500000 0.500000
8 0.000000 0.000000 2.500000 2.500000 0.500000
9 0.000000 0.000000 2.500000 2.500000 0.500000
..
86 0.000000 0.000000 2.500000 2.500000 0.500000
87 0.000000 0.000000 2.500000 2.500000 0.500000
88 0.000000 0.000000 2.500000 2.500000 0.500000
89 0.000000 0.000000 2.500000 2.500000 0.500000
90 0.000000 0.000000 2.500000 2.500000 0.500000
91 0.000000 0.000000 2.500000 2.500000 0.500000
92 0.000000 0.000000 2.500000 2.500000 0.500000
93 0.000000 0.000000 2.500000 2.500000 0.500000
94 0.000000 0.000000 2.500000 2.500000 0.500000
95 0.000000 0.000000 2.500000 2.500000 0.500000
Here are graphics for running 1000 iterations of this case:
This is (finally!) as expected: no change. Here is detail of the final output:
The second set of nodes on the left bank was added by AddChanBorder() at 1/2 the width plus 1cm.
The meandering output can be set to something more interesting than zero; in this case delta x is set to the sine of the y coordinate:
i delx dely rightdepth leftdepth lambda
----- -------------- -------------- -------------- -------------- --------------
0 0.000000 0.000000 2.500000 2.500000 0.500000
1 0.013218 0.000000 2.500000 2.500000 0.500000
2 0.026378 0.000000 2.500000 2.500000 0.500000
3 0.039423 0.000000 2.500000 2.500000 0.500000
4 0.052296 0.000000 2.500000 2.500000 0.500000
5 0.064940 0.000000 2.500000 2.500000 0.500000
6 0.077300 0.000000 2.500000 2.500000 0.500000
7 0.089322 0.000000 2.500000 2.500000 0.500000
8 0.100953 0.000000 2.500000 2.500000 0.500000
9 0.112143 0.000000 2.500000 2.500000 0.500000
10 0.122843 0.000000 2.500000 2.500000 0.500000
11 0.133005 0.000000 2.500000 2.500000 0.500000
12 0.142586 0.000000 2.500000 2.500000 0.500000
13 0.151543 0.000000 2.500000 2.500000 0.500000
14 0.159838 0.000000 2.500000 2.500000 0.500000
...
81 -0.159838 0.000000 2.500000 2.500000 0.500000
82 -0.151543 0.000000 2.500000 2.500000 0.500000
83 -0.142586 0.000000 2.500000 2.500000 0.500000
84 -0.133005 0.000000 2.500000 2.500000 0.500000
85 -0.122843 0.000000 2.500000 2.500000 0.500000
86 -0.112143 0.000000 2.500000 2.500000 0.500000
87 -0.100953 0.000000 2.500000 2.500000 0.500000
88 -0.089322 0.000000 2.500000 2.500000 0.500000
89 -0.077300 0.000000 2.500000 2.500000 0.500000
90 -0.064940 0.000000 2.500000 2.500000 0.500000
91 -0.052296 0.000000 2.500000 2.500000 0.500000
92 -0.039423 0.000000 2.500000 2.500000 0.500000
93 -0.026378 0.000000 2.500000 2.500000 0.500000
94 -0.013218 0.000000 2.500000 2.500000 0.500000
95 0.000000 0.000000 2.500000 2.500000 0.500000
Here are graphics for 1000 iterations:
Here is detail of the final output:
One abberation is that AddChanBorder() seems to duplicate nodes along with their drainage areas, although I don't think these are sent to the next meandering cycle:
More detail of the final output showing the potential floodplain:
Here are results for:
w = (960.0 - y) / 950.0 delx = sin(w * 2.0 * pi) / 5.0 + sin(w * 6.0 * pi) / 10.0 + sin(w * 10.0 * pi) / 15.0 + sin(w * 14.0 * pi) / 20.0
More detail of the final output:
This is pretty much where I wanted to be last week (sigh). However, I still have 10 days remaining in March to begin testing the JP code. I expect to discover additional problems, but am fairly confident that I can find workarounds as required.
Some advantages of using the hybrid external testbed include: