Error codes exist in the model to warn the user of inconsistencies and
errors. The model is released to the community as a package which
should not trigger such inconsistencies or errors. However, the user
may change the code or modify the input files in a way which triggers
such a message. The user may even simply operate the model on a
platform which brings up an error message. In many cases these error
codes are followed by a stoprun in order to alert the user of a
problem which will render the simulation useless or will cause it to
fail later.

In general, when an error message appears, the user must switch gears
from production to debugging mode. The error message may make the
corrective measures obvious. If not, the user will need to find the
line in the code which wrote the error message and gradually back
track till the cause for the error is found. The old fashioned
placement of write statements in the code or, if available, debugging
software may help understand the problem. When using debugging
software, it is useful to change DEBUG to .true. in the jobscript.

To make sure that the model conserves energy and mass, energy and
water imbalances appearing in a simulation will trigger errors and
halt the simulation,

To accomplish energy conservation, all energy inputs at the land
surface are reflected or absorbed. Absorbed energy may return to the
atmosphere as sensible heat or may be emitted as terrestrial
radiation, stored as soil heat, used to evaporate or transpire water,
or used to melt snow and ice. The error check for the energy balance
is in subroutine src/main/BalanceCheck.F90.

Similarly, water incident on the land will evaporate, transpire
through leaf stomata, run off and drain from the soil, or be stored in
the soil and snow pack. The error check for the water balance is in
subroutine BalanceCheck.

Water which runs off or drains from the soil fills river chanels and
flows downstream. At every model time step, the global sum of water
which runs off and drains from the soil into the rivers must equal the
global sum of change in river volume. This is because the global sum
of water flowing out of grid cells must cancel the global sum of water
flowing into grid cells from upstream. This error check is in
subroutine src/riverroute/RtmMod.F90.