Skip to main content
U.S. flag

An official website of the United States government

Soil-Water-Balance (SWB) for estimating groundwater recharge

April 5, 2016


The Soil-Water-Balance (SWB) code has been developed to allow estimates of potential recharge to be made quickly and easily. The code calculates components of the water balance at a daily timestep by means of a modified version of the Thornthwaite-Mather soil-moisture-balance approach. Data requirements include several commonly available tabular and gridded data types:

(1) precipitation, and minimum and maximum air temperature (tabular or gridded)

(2) land-use classification (gridded)

(3) hydrologic soil group (gridded)

(4) flow direction (gridded)

(5) soil-water capacity (gridded)

The data and formats required are designed to take advantage of widely available GIS datasets and file structures.



Complete documentation of the SWB source code may be found on SWB’s publicly accessible GitHub repository, including current, developmental, and experimental versions of SWB. Versions of SWB found on GitHub may contain undocumented features and incomplete additions to the code.

SWB executables are currently available for Windows (32-bit and 64-bit) systems and Linux (64-bit) systems. There is no installation procedure needed; unzip or untar the archive files and ensure that the executables are placed into your path and are accessible from the command line.

Version 1.0.1 – Includes NETCDF support module

Windows (32-bit):, 1.2 MB, compiled September 10, 2012

Windows (64-bit):, 1.7 MB, compiled November 20, 2012

Linux (64-bit): swb_ubuntu_x64.tar.gz, 6 MB

All versions:, 32 MB



A simple test case demonstrating the application of the Soil-Water-Balance Model may be downloaded here:, 400 KB



User Guides and Technical Information

Westenbroek, S.M., Kelson, V.A., Dripps, W.R., Hunt, R.J., and Bradbury, K.R., 2010, SWB-A modified Thornthwaite-Mather Soil-Water-Balance code for estimating groundwater recharge: U.S. Geological Survey Techniques and Methods 6-A31, 60 p.

Supported Computing Platforms and Source Code Compilation

SWB is known to run on Windows (XP/7) and Linux platforms. There should be no problems running the code on Macintosh hardware, but this has not been attempted by the authors.

The SWB code is written entirely in Fortran 95/2003. Compilation of the code has been routinely accomplished using the G95, gfortran, and Intel Fortran compilers.



Support is provided for correcting bugs and clarification of how the code is intended to work. Only limited assistance can be provided for applying SWB to specific problems. For support or comments regarding SWB, contact Steve Westenbroek.



This software, documentation, and example data sets are made available by the U.S. Geological Survey (USGS) to be used in the public interest and in the advancement of science. You may, without any fee or cost, use, copy, modify, or distribute this software, and any derivative works thereof, and its supporting documentation, subject to the restrictions and understandings found in the USGS Software User Rights Notice.


* Any use of trade, firm, or product names is for descriptive purposes only and does not imply endorsement by the U.S. Government.

Publication Year 2016
Title Soil-Water-Balance (SWB) for estimating groundwater recharge
Product Type Software Release
Record Source USGS Digital Object Identifier Catalog