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
2 stars 3 forks source link

Resuming in route-only mode does not work #21

Closed mee067 closed 8 months ago

mee067 commented 8 months ago

This was first reported by Mazda. I managed to reproduce it using a setup of the Yukon river basin running r1860. Saving resume files work but it still wrote LSS and baseflow states. Using netcdf format (SAVERESUMEFLAG 6), the gru dim for these was zero, i.e. they do not really exist. When coming to read those states, MESH finds a mismatch between the number of GRUs read from the drainage database and the number in the resume file (zero as mentioned). Thus, it does not manage to initialize the channel states, which all that's needed. This also applied when states are saved in seq format (SAVE/RESUMFLAG 4 or 5)

I resolved this by adding conditions to read LSS states only when LSS in active. By extension, I made it write LSS states only when LSS is active (which reduced the size of the resume file by not writing useless data). Similarly, I conditioned the writing of the routing states for reading and writing on whether routing is active or not.

I tested a couple of scenarios, but not all possible ones: 1- running LSS+Routing and resuming LSS+routing - works as before 1- running LSS+Routing, then resuming in routing-only mode - now works (could be considered an enhancement) 2- running routing-only mode and then resuming routing-only mode - now works (bug fixed)

The scenario of resuming a routing-only run in LSS+routing mode is meaningless. The scenario of resuming an LSS+Routing in LSS-only mode was not tested but I think it should still work.

I will commit the changes to my branch of code.