SWAT Makefile Updated – Ignore Underflow.

The SWAT Makefile is updated again. Underflow flag is removed to get same results as official SWAT.

Download Link

Makefile Generator, Debug Makefile, Release Makefile

In an attempt to run SWAT (rev 615) in Eclipse and compare with official SWAT, although official SWAT could run to end without problems, Eclipse-SWAT stops running due to underflow (erroneous arithmetic operation).

The underflow happens in subwq.f Line 88.

wtmp = 5.0 + 0.75 * tmpav(j)

where

tmpav is average air temperature on current day in HRU

From the Expression window, the value of tmpav(j) is 4.6281851e-038. The underflow should happen when 0.75 * tmpav(j) is calculated.

The fact that official SWAT could run to end means underflow is ignored, i.e. the compilation flag for underflow is turned off. As mentioned in previous post SWAT Makefile Updated – Stop running when overflow happens, following flag is used to stop SWAT running when invalid, zero, overflow or underflow happens.

-ffpe-trap=invalid,zero,overflow,underflow

To run Eclipse-SWAT successfully, only need to remove underflow flag and re-compile the source codes, which will be become as following format.

-ffpe-trap=invalid,zero,overflow

After that, Eclipse-SWAT could run to end and get exactly the same results as official SWAT.

© 2000 – 2021 SWAT Output Viewer All rights reserved