Page tree

MESH - A Community Hydrology - Land Surface Model


Skip to end of metadata
Go to start of metadata

This page describes how to use MESH to create a WATFLOOD "map" file from an existing MESH_drainage_database.r2c file.

Configuring SHDFILEFLAG

This process requires a drainage database and to activate the option via SHDFILEFLAG in MESH_input_run_options.ini.

If the setup already has SHDFILEFLAG with option 1, the "to_map" option can be appended to the flag:

MESH_input_run_options.ini (excerpt)
##### Control Flags #####
----#
    1 # Number of control flags
SHDFILEFLAG            1     to_map

If the setup already has SHDFILEFLAG with option "r2c", the "to_map" option can be appended to the flag:

MESH_input_run_options.ini (excerpt)
##### Control Flags #####
----#
    1 # Number of control flags
SHDFILEFLAG              r2c to_map
The option is only compatible with distributed drainage databases. It is not compatible with "SHDFILEFLAG 2" (point mode).

Running the Model

An existing MESH setup can be run as-is. The model will create a new file named "MESH_basin.map".

If no existing MESH setup exists, a MESH_input_run_options.ini file can be created with only the following options (a sample file is attached for reference):

MESH_input_run_options.ini
MESH run options input file
##### Control Flags #####
----#
    1 # Number of control flags
SHDFILEFLAG              r2c to_map
##### Output Grid selection #####
----#
    0 # Number of output grid points (5 points maximum)
---------#
         1 #1 Grid number
         1 #2 Land class
.          #3 Output directory
##### Output Directory #####
---------#
.          # Output Directory for total-basin files
##### Simulation Run Times #####
---#---#---#---#
   0   0   0   0 # Start year, day, hour, minute
   0   0   0   0 # Stop year, day, hour, minute

The model can then be run. The model will exit when it fails to read other input files, but before existing will have created a new file named "MESH_basin.map".

Limitations

Some variables cannot be derived from the attributes of MESH_drainage_database.r2c alone. The following table lists the "map" file attributes created by this process.

WATFLOOD "map" file attributeRestored?Detail
Channel Elevation (ELV)(tick) - YesFrom the native "Elev" attribute
Drainage Area (FRAC)(tick) - Yes

Calculated as the "GridArea" attribute divided by "NominalGridSize_AL" (AL) squared:

`"FRAC" = "GridArea"//"AL"//"AL"`
Drainage direction (S)(tick) - Yes

Derived from the "Rank" and "Next" attributes by the location of "Next" relative to "Rank" in eight directions:

do y = 1, yCount
  do x = 1, xCount
    if (RNKGRD(y, x) .gt. 0) then
      if (NEXT(RNKGRD(y, x)) .gt. 0) then
        grid(y, x) = -1
        if (y .gt. 1) then
          if (x .gt. 1) then
            if (RNKGRD(y - 1, x - 1) .eq. NEXT(RNKGRD(y, x))) DDIR(y, x) = 5
          end if
          if (x .lt. shd%xCount) then
            if (RNKGRD(y - 1, x + 1) .eq. NEXT(RNKGRD(y, x))) DDIR(y, x) = 3
          end if
          if (RNKGRD(y - 1, x) .eq. NEXT(RNKGRD(y, x))) DDIR(y, x) = 4
        end if
        if (y .lt. yCount) then
          if (x .gt. 1) then
            if (RNKGRD(y + 1, x - 1) .eq. NEXT(RNKGRD(y, x))) DDIR(y, x) = 7
          end if
          if (x .lt. xCount) then
            if (RNKGRD(y + 1, x + 1) .eq. NEXT(RNKGRD(y, x))) DDIR(y, x) = 1
          end if
          if (RNKGRD(y + 1, x) .eq. NEXT(RNKGRD(y, x))) DDIR(y, x) = 8
        end if
        if (x .gt. 1) then
          if (RNKGRD(y, x - 1) .eq. NEXT(RNKGRD(y, x))) DDIR(y, x) = 6
        end if
        if (x .lt. xCount) then
          if (RNKGRD(y, x + 1) .eq. NEXT(RNKGRD(y, x))) DDIR(y, x) = 2
        end if
      end if
    end if
  end do
end do

The WATFLOOD "map" file does not use standard D8 drainage directions, instead using:

IDDirection
1NorthEast
2East
3SouthEast
4South
5SouthWest
6West
7NorthWest
8North
River Class (IBN)(tick) - YesFrom the native "IAK" attribute
Contour Density (IROUGH)(error) - No

Not calculated, but speculated to be the following equation based using the "IntSlope", "NominalGridSize_AL" (AL), and "ContourInterval" attributes (pending verification):

`"IROUGH" = ("IntSlope"*"AL")/("ContourInterval" - 0.0001)`
Channel Density (ICHNL)(tick) - YesFrom the native "Chnl" attribute
Reach Number (IREACH)(tick) - YesFrom the native "Reach" attribute
GRU/Land cover fractions(tick) - Yes

From the native "ACLASS" attribute of MESH_drainage_database.r2c converted from fraction to percent:

`"PERC" = "ACLASS"*100.0`

Considerations

This process will decrease the number of cells in the domain "TotalNumOfGrids" when converting from a MESH_drainage_database.r2c file where an outlet is not properly defined (e.g., when "numGridsInBasin" is equal to "TotalNumOfGrids").

In this case, the last cell in the domain likely drains into itself, and thus a representative drainage direction cannot be derived from "Rank" and "Next" alone.