Problem: currently the code uses a single dimension to handle all lake variables that involve "nodes". This term is unfortunately overloaded. The curve delineating the shape of the lake basin (the depth-area relationship) is discretized into a static set of "nodes". But the lake water is divided into layers dynamically (as lake volume decreases, the number of layers may decrease to avoid layers getting too thin). Each lake layer contains a thermal node, so the number of thermal nodes = number of lake layers. This becomes a problem because the code attempts to figure out the number of nodes (both senses of the term) from the length of the lake_node dimension in the parameter file. However, this file only contains the static lake basin nodes. The code then assumes this length should match the dimension length lake_node in the state and output files, but these files contain dynamic lake variables that won't in general have the same length as the depth-area relationship.
Proposed solution: create separate dimensions for the two types of nodes, as follows: 1. MAX_LAKE_NODES will now refer only to dynamic nodes, and the new MAX_LAKE_BASIN_NODES now refers to the points on the depth-area relationship; 2. options.Nlakenode now only refers to dynamic nodes (it is the maximum allowable number of dynamic nodes in any lake at any given time), and the new options.Nlakebasnode refers to the depth-area relationship; 3. options.Nlakenode and options.Nlakebasnode are initialized to MAX_LAKE_NODES and MAX_LAKE_BASIN_NODES, respectively; 4. options.Nlakenode can now be set by the user in the global parameter file with LAKE_NODES; 5. vic_start.c will read options.Nlakebasnode from the params file.
LAKES=TRUE
lake_node
dimension in the parameter file. However, this file only contains the static lake basin nodes. The code then assumes this length should match the dimension lengthlake_node
in the state and output files, but these files contain dynamic lake variables that won't in general have the same length as the depth-area relationship.MAX_LAKE_NODES
will now refer only to dynamic nodes, and the newMAX_LAKE_BASIN_NODES
now refers to the points on the depth-area relationship; 2.options.Nlakenode
now only refers to dynamic nodes (it is the maximum allowable number of dynamic nodes in any lake at any given time), and the newoptions.Nlakebasnode
refers to the depth-area relationship; 3.options.Nlakenode
andoptions.Nlakebasnode
are initialized to MAX_LAKE_NODES and MAX_LAKE_BASIN_NODES, respectively; 4.options.Nlakenode
can now be set by the user in the global parameter file withLAKE_NODES
; 5.vic_start.c
will readoptions.Nlakebasnode
from the params file.