MESH-Model / MESH-Dev

This repository contains the official MESH development code, which is the basis for the 'tags' listed under the MESH-Releases repository. The same tags are listed under this repository. Legacy branches and utilities have also been ported from the former SVN (Subversion) repository. Future developments must create 'forks' from this repository.
Other
1 stars 4 forks source link

Issue with "islands" in `Rank` and `Next` and `MESH`'s sanity check #16

Open kasra-keshavarz opened 1 year ago

kasra-keshavarz commented 1 year ago

Problem statement

MESH v.1813 seems to have an issue in reading valid Rank and Next values when "islands" are placed at the end of the Rank list in a vector-based setup. Please note that even if "islands" are placed at the end of the Rank list, both Rank and Next lists are still valid. However, MESH v.1813 apparently "does a sanity check to compare the last draining outlet against the number of Rank, the ordering creates this disconnect", and therefore, cannot fully comprehend the network setup.

An "island" is defined as a sub-basin without any immediate downstream segment and drains to the outside of the modelling domain; non-contributing areas could be an example of an "island."

The typical "Remarks" printed by MESH v.1813 when "islands" become problematic are as follows:

   REMARK: The total number of active cells is adjusted to the maximum 'Next' value. Consider adjusting the input files.
   REMARK: The number of outlets is adjusted to the number of cells where 'Next' is zero. Consider adjusting the input files.

And the following error is raised:

At line 739 of file ./Driver/MESH_Driver/read_initial_inputs.f90
Fortran runtime error: Array bound mismatch for dimension 1 of array 'shd' (458/473)

Error termination. Backtrace:
#0  0x2af4e1560730 in ???
#1  0x2af4e1561289 in ???
#2  0x2af4e1561906 in ???
#3  0xcf8926 in read_initial_inputs_
    at ./Driver/MESH_Driver/read_initial_inputs.f90:739
#4  0xec9754 in runmesh
    at ./Driver/MESH_Driver/MESH_driver.f90:244
#5  0xed0345 in main
    at ./Driver/MESH_Driver/MESH_driver.f90:97

Example of problematic Rank and Next with "islands"

The following gives an example of Rank and Next created using MESH-Scripts workflow (commit e8fcba5) applied on the St. Mary and Milk geo-fabric.

Rank:

 Rank = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 
    20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 
    38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 
    56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 
    74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 
    92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 
    108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 
    122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 
    136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 
    150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 
    164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 
    178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 
    192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 
    206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 
    220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 
    234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 
    248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 
    262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 
    276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 
    290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 
    304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 
    318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 
    332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 
    346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 
    360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 
    374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 
    388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 
    402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 
    416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 
    430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 
    444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 
    458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 
    472, 473 ;

Next:

 Next = 2, 4, 4, 5, 6, 8, 9, 10, 10, 12, 13, 13, 16, 18, 19, 20, 21, 21, 22, 
    23, 24, 25, 25, 27, 27, 28, 29, 31, 31, 32, 35, 35, 36, 37, 37, 38, 39, 
    456, 456, 42, 43, 43, 44, 47, 47, 48, 49, 51, 53, 55, 55, 56, 56, 57, 57, 
    60, 60, 64, 64, 65, 67, 67, 68, 69, 69, 72, 72, 74, 74, 75, 75, 76, 78, 
    78, 81, 81, 82, 82, 86, 86, 87, 87, 88, 89, 89, 90, 90, 93, 95, 95, 96, 
    99, 100, 101, 102, 105, 106, 108, 108, 109, 111, 111, 113, 114, 115, 116, 
    117, 117, 118, 119, 119, 121, 122, 123, 123, 124, 124, 125, 126, 131, 
    132, 133, 133, 135, 135, 136, 137, 138, 139, 141, 141, 143, 144, 147, 
    147, 148, 149, 149, 150, 151, 151, 152, 153, 153, 154, 154, 155, 155, 
    156, 161, 161, 162, 162, 165, 165, 167, 167, 168, 168, 169, 170, 171, 
    172, 173, 174, 177, 177, 179, 179, 180, 181, 182, 183, 183, 184, 186, 
    186, 188, 188, 189, 190, 191, 191, 192, 193, 194, 195, 196, 196, 197, 
    199, 199, 203, 203, 208, 208, 209, 210, 210, 211, 212, 213, 214, 217, 
    219, 219, 220, 220, 221, 221, 223, 224, 227, 228, 229, 230, 231, 232, 
    232, 233, 233, 234, 234, 235, 235, 236, 236, 237, 238, 238, 239, 241, 
    242, 242, 243, 243, 245, 247, 248, 251, 252, 252, 254, 258, 258, 259, 
    260, 260, 262, 262, 263, 263, 265, 265, 266, 266, 267, 268, 270, 270, 
    271, 272, 272, 276, 276, 278, 278, 279, 280, 281, 282, 282, 284, 284, 
    286, 286, 288, 289, 290, 291, 294, 294, 296, 296, 298, 298, 299, 300, 
    301, 301, 304, 305, 306, 306, 308, 308, 310, 310, 312, 312, 316, 317, 
    319, 319, 322, 322, 324, 324, 326, 326, 331, 331, 332, 332, 333, 333, 
    334, 336, 336, 337, 338, 338, 340, 340, 342, 342, 345, 345, 346, 346, 
    347, 349, 349, 351, 353, 353, 354, 354, 356, 356, 358, 358, 359, 360, 
    360, 361, 361, 362, 362, 363, 364, 365, 366, 366, 368, 368, 370, 370, 
    374, 375, 375, 377, 379, 379, 380, 380, 382, 382, 383, 384, 386, 386, 
    388, 389, 389, 390, 390, 391, 392, 392, 394, 394, 395, 396, 398, 398, 
    399, 400, 400, 401, 402, 402, 403, 403, 404, 404, 405, 405, 406, 406, 
    407, 407, 408, 408, 410, 410, 411, 412, 413, 413, 414, 414, 420, 420, 
    424, 424, 428, 428, 429, 429, 432, 432, 433, 434, 434, 436, 436, 437, 
    437, 438, 439, 439, 440, 440, 442, 443, 443, 445, 446, 446, 447, 448, 
    448, 450, 450, 451, 452, 452, 453, 453, 454, 454, 457, 457, 458, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ;

Relevant Issue

This issue could be resolved outside of MESH by bringing the "islands" in between the river segments of the longest branch of rivers in a network. This is explained in an issue in MESH-Scripts workflow repository.

If I can help further, please let me know. Thanks.

kasra-keshavarz commented 1 year ago

Just an extra note, this issue is addressed outside of the MESH's source code, in the relevant workflow mesfhlow where the islands are dealt with in the setup process: the longest branch of river segments is extracted using the functionalities in Hydrant and the islands are put in between the found segments.

Adding this note just for the sake of completeness and possibly guidance for future visitors.