## Unraveling the HRU water balance in SWAT (I)

There is surprisingly very few information about how to compute the water balance at the hydrologic response unit (HRU) level with the Soil and Water Assessment Tool (SWAT) model. The SWAT theoretical manual does a good job in explaining the different concepts of the hydrological simulation performed in the model, and the SWAT input/output manual details very precisely the format and variables reported in the various files produced by the code, and yet one is left without a clear idea of how the water balance is calculated in the model.

The water balance of a closed unit is a very basic notion in Hydrology: the sum of the input flows (precipitation, irrigation, seepage) minus the output flows (channel flow, evapotranspiration, deep aquifer percolation) should equal the variation of the internal storages (snowpack, soil moisture, shallow and deep aquifer). How is this water balance defined in SWAT? It is difficult to give an answer based only on the information provided in the manuals, or at least it was not clear to me. And when one looks at the `output.hru` file of one simulation and tries to do the maths, the result is frustrating at least. In simple words, I was not able to compute a correct water balance for a given HRU at the monthly level, based on the variables in the `output.hru` file.

Looking directly at the SWAT code can however shed a light on this problem. The `watbal.f` routine computes the daily water balance for the HRUs, and it provides the exact water balance equations that are used in SWAT. Storages are represented in the code in the variable `dstor`, while flows are stored as `h2oloss`. They are computed as:

```dstor = sno_hru(j) - snoprev +
sol_sw(j) - swprev +
shallst(j) - shallstp +
deepst(j) - deepstp +
surf_bs(1,j) - bsprev +
bss(1,j) - bssprev
```

where `sno_hru(j)`, `sol_sw(j)`, `shallst(j)`, `deepst(j)`, `surf_bs(1,j)` and `bss(1,j)` are the amount of water stored in the snowpack, in the soil, in the shallow aquifer, in the deep aquifer, as lagged surface runoff and lagged lateral flow on day `j`, respectively; and `snoprev`, `swprev`, `shallstp`, `deepest`, `bsprev` and `bssprev` are the same variables corresponding to day `j-1`. And (after some rearranging of variables with respect to the original code):

```h2oloss = subp(j) + aird(j) + rchrg(j) + twlpnd +
twlwet - etday - revapday - qday -
latq(j) - gw_q(j) - qtile - sepbtm(j)
```

where subp(j) is the precipitation on day `j`, `aird(j)` is the amount of irrigation, `rchrg(j)` is the amount of water recharging the shallow and deep aquifers, `twlpnd` and `twlwet` are water seepage from ponds and wetlands, `etday` is the daily evapotranspiration, `revapday` is the amount of water moving from the shallow aquifer to the soil profile or taken by the plant roots, `qday`, `latq(j)` and `gw_q(j)` are the surface runoff, lateral flow and groundwater flow to the main channel, respectively, `qtile` is the drainage tile flow and `sepbtm(j)` is the seepage leaving the bottom of the soil profile.

So there we have it, cristal clear. There is a comment in the code stating that on any given day and hru `dstor` should equal `h2oloss`, i.e. `h2oloss - dstor = 0`. There is even a balance check (commented out though, so I assume it’s there for debugging purposes).

• As I understand it, `sepbtm` is the seepage from the soil profile that enters the vadose zone in its transit towards the shallow and deep aquifers. Since this zone is not accounted for, this water is subtracted from the balance.
• Accordingly, `rchrg` is the water that goes past the vadose zone and recharges both aquifers. Since this water is recovered, it is accounted for as a positive flow.
• I am not totally sure of what drainage tile flow (`qtile`) is.
The next step is check whether the above water balance can be computed or not from the data on the `output.hru` file. But this has been a rather long post so far, so I leave it for an incoming post.