Advanced Swat Workshop Manual
Advanced Swat Workshop Manual
Advanced Swat Workshop Manual
http://swatmodel.tamu.edu/
Advanced Manual
R. Srinivasan
r-srinivasan@tamu.edu
Soil & Water Assessment Tool
http://swatmodel.tamu.edu/
Advanced SWAT
Training Manual
R. Srinivasan
r-srinivasan@tamu.edu
Introduction
The Soil and Water Assessment Tool (SWAT) is a physically-based continuous-event
hydrologic model developed to predict the impact of land management practices on
water, sediment, and agricultural chemical yields in large, complex watersheds with
varying soils, land use, and management conditions over long periods of time.
For simulation, a watershed is subdivided into a number of homogenous
subbasins (hydrologic response units or HRUs) having unique soil and land use
properties. The input information for each subbasin is grouped into categories of
weather; unique areas of land cover, soil, and management within the subbasin;
ponds/reservoirs; groundwater; and the main channel or reach, draining the
subbbasin.
The loading and movement of runoff, sediment, nutrient and pesticide loadings to
the main channel in each subbasin is simulated considering the effect of several
physical processes that influence the hydrology.
For a detailed description of the capabilities of SWAT, refer to the Soil and Water
Assessment Tool User’s Manual, published by the Agricultural Research Service and
Texas AgriLife Research, Temple, Texas. To downloaded visit (http://swatmodel.
tamu.edu/).
In this course, we will use the latest SWAT version. Besides all the features included
in the latest SWAT version, this latest version also includes modules for sensitivity
analysis, automatic model calibration and uncertainty analysis.
To install the latest SWAT version and for information on required hardware and
software visit the SWAT website (http://swatmodel.tamu.edu/).
Table of Contents
Section 1 .......................................1
Introduction to Sensitivity and
Uncertainty Analysis
Section 2 .......................................19
SWAT-CUP
2.1 One-at-a-time sensitivity analysis .24
2.2 Autocalibration ............................33
2.3 Uncertainty analysis ....................39
Section 1
Introduction to
Sensitivity and
Uncertainty Analysis
1
2
Introduction to Sensitivity and
Uncertainty Analysis
R. Srinivasan
Contents
Implementation in SWAT2005
• Sensitivity analysis
• Automatic model calibration
• Uncertainty Analysis
Contents
Implementation in SWAT2005
• Sensitivity analysis
• Automatic model calibration
• Uncertainty analysis
3
Aim of Sensitivity Analysis (SA)
4
One-at-a-time Sensitivity Analysis III
Advantages:
• Simple to implement and perform
• Computationally efficient
Disadvantages:
• Sensitivity is only assessed locally
5
Monte Carlo SA I
Monte Carlo SA II
6
Monte Carlo SA IV
Albedo [a]
Stomatal conductance [gs max]
Canopy height [Hmax]
Root depth [RDmax]
Maximum and minimum leaf area index [LAI]
Base temperature [tbase]
Interception [Imax]
Curve number [cn]
Radiation use efficiency [RUE]
Nitrogen uptake coefficients [n1-3]
Phosphorus uptake coefficients [p1-3]
http://www.uni-giessen.de/~gh1461/plapada/plapada.html
Breuer et al. (2003)
7
Plant Parameter Bounds
Plant Parameter SA I
Plant Parameter SA II
8
Plant Parameter SA III
Plant Parameter SA IV
Advantages:
• Sensitivity is determined over the entire parameter space
Disadvantages:
• Assumption of linearity in multiple regression
• Computationally inefficient
9
Monte Carlo Sampling Efficiency
N = number of intervals
m = number of parameters
q = number of draws
m p0
2 0.017
3 0.448
4 0.852
2. Take N samples assuring that you sample each stratum only once
10
Latin Hypercube Sampling III
Advantages:
• Sensitivity is determined over the entire parameter space
• Computationally efficient
Disadvantages:
• Assumption of linearity in multiple regression
SWAT Implementation SA
8 2 4 3 1 5 7 9 6 10
11
LHS-OAT Sensitivity Analysis II
Sources of Uncertainty
12
Model Parameter Uncertainty
13
Output Data Uncertainty
14
SWAT Example: Plant Parameters
Albedo [a]
Stomatal conductance [gs max]
Canopy height [Hmax]
Root depth [RDmax]
Maximum and minimum leaf area index [LAI]
Base temperature [tbase]
Interception [Imax]
Curve number [cn]
Radiation use efficiency [RUE]
Nitrogen uptake coefficients [n1-3]
Phosphorus uptake coefficients [p1-3]
5% percentile 95%
15
Monte Carlo UA Example III
16
Scenarios and Uncertainty II
17
18
Section 2
SWAT-CUP
19
20
Introduction
SWAT-CUP is a computer program for calibration of SWAT models. SWAT-CUP is a public domain program, and as such
may be used and copied freely. The program links GLUE, ParaSol, SUFI2, MCMC, and PSO procedures to SWAT. It
enables sensitivity analysis, calibration, validation, and uncertainty analysis of a SWAT model.
In the new version, SWAT-CUP4, a more powerful SWAT_Edit program is provided where ALL SWAT parameters are
handled, including different soil layers and management rotation-operations, precipitation data, etc. The users are also
allowed 20 “free” parameters placed at the end of *.gw files to use for their own programs, which may be linked to SWAT.
This version also includes parallel processing (which is licensed but 20 simulation are allowed to be made for testing the
program), visualization of the outlet locations using the Bing Map, creation of multi_objective objective function, extraction
and calculation of 95PPU for all variables in output.rch, output.hru, and output.sub files without measurements, and one-
at-a-time sensitivity analysis).
For a detailed description of the capabilities of the SWAT-CUP, refer to SWAT Calibration and Uncertainty Programs - A
User Manual. Department of Systems Analysis, Integrated Assessment and Modelling (SIAM), Eawag, Swiss Federal
Institute of Aquatic Science and Technology, Duebendorf, Switzerland, 2008, 95pp. The manual can be downloaded from
the EAWAG Web site (www.eawag.ch/organisation/abteilungen/siam/software/swat/index_EN).
R. Srinivasan, r-srinivasan@tamu.edu 1 21
The overall program structure is as shown in the Figure below.
Objectives
The objectives of this exercise are to (1) Using a SWAT-CUP for automatic model calibration procedure and (2) Linking
uncertainty and sensitivity program to SWAT.
“TxtInOut” Directory:
C:\temp\Swat Project_test\Scenarios\Default\TxtInOut
Project Directory:
C:\temp\SWATworkshopAK\swatcupadvanced431\swatcupadvanced431\test.Sufi2.SwatCup
Project Directory:
C:\temp\SWATworkshopAK\swatcupadvanced431\oat431\oat431.Sufi2.SwatCup
Range and number of parameters, and number of simulations are set here.
Two types of sensitivity analysis are allowed in SWAT_CUP. Global Sensitivity and One-at-a-time sensitivity analysis.
x__<parname>.<ext>__<hydrogrp>__<soltext>__<landuse>__<subbsn>__<slope>
Where
x__ Code to indicate the type of change to be applied to the parameter:
v__ means the existing parameter value is to be replaced by the given value,
a__ means the given value is added to the existing parameter value,
r__ means the existing parameter value is multiplied by (1+ a given value).
Note: that there are always two underscore
r__CN2.mgt__D______7__0-10…….-0.2……..0.2 CN2 of Soils with D hydrologic group with slope 0 to10 is multiplied
by values between -1.2 to 1.2
a__ESCO.hru______FRST__7-12……..0.0…….0.2 ESCO value of Forest in subbasins 7 to 12 increased by adding 0
to 0.2
This file is used by SWAT_Edit.exe to restart a simulation from the middle. Starting and ending simulations are indicated
here.
Note that the number of simulations needs to be indicated in both Par_inf.txt and SUFI2_swEdit.def
This is a SWAT file. It is put here for convenience. What you need from this file are the simulation years and the number
of warm-up period (NYSKIP) to correctly provide SWAT-CUP with beginning and end year of simulation (not including
warm-up period).
Note:
You do not need to modify this
file.
Note:
During SWAT-CUP running you may receive an error message that
the specific parameter value is not in the absolute values file; simply
add the parameter manually in the absolute value file under the
related file name extension.
Under Observation are three files that contain the observed variables.
Only edit the file(s) that applies to your project and do not worry about the ones that don’t.
If there is missing data in data series continue with the rest of the data series and skip the record number. For example, if
the data of January 1993 is missing the record number is started from 2.
Note: The measurement unit of data series should be same as SWAT variable.
Under Extraction you will find two types of files .txt and .def corresponding again to SWAT output files.
If you have observations corresponding to variables in these files, then you need to extract the corresponding simulated
values from these files.
Var_file_rch.txt
Notes:
The beginning and end year of simulation should be equal to the beginning year (IYR-NYSKIP) and end year simulation
(IYR+NBYR-1) in File.Cio.
For each variable determine the number of subbasins to get for the variable and sub basin number for the variable.
Column number indicates the column number of SWAT variable in output.rch file. The variables under Remark
Observed.txt
In the presented project, base flow has the same values as the peak flows, since the value of separation is -1. Setting this
value to 0 or 1 divides the flow data to into small and large values. Considering a separation of signal dramatically
improves the simulation results.
This option is most effective for option 2 of objective function and is not defined for R2 and bR2.
If separation of signal is considered, the weight of the small and large values in the objective function should be
determined.
If you choose option 2 for objective function, i.e., mean square error, then base flow my not have much effect on the
optimization, hence, peak flow will dominate the processes. With this option they can be given the same weight.
Step 8. No Observation
The .txt and .def files are the same as the Extraction
section.
Note:
The 95PPU is calculated at the 2.5% and 97.5%
levels of the cumulative distribution of an output
variable obtained through Latin hypercube
sampling, disallowing 5% of the very bad
simulations.
The four batch files indicate what should or should not be run.
SUFI2_Pre.bat: this batch file runs the preprocessing procedures, which now include running the
Latin hypercube sampling program. This batch file usually does not need to be edited.
SUFI2.Run.bat: this program executes SUFI2_execute.exe program, which runs the SWAT_Edit.exe, extraction batch files, as
well as SWAT2009.exe. This batch file usually does not need to be edited.
SUFI2.Post.bat: This section should be modified depending on our purpose of using SUFI2. The
programs that are not desired to run should be remarked by “rem” as shown.
Notes:
SUFI2_Pre.bat first.
Click OK
Click OK
To perform sensitivity analysis run the model for one or two years and no need to run for many years of data
series as perform in calibration process.
To perform the one-at-a-time sensitivity analysis, one should set the values of the parameters that are
kept constant to some reasonable values. These reasonable values could, for example, be the best
simulation (simulation with the best objective function value) of the last iteration.
This command will replace the parameter values and set them to the best values of the last iteration. If there is no
need to run SWAT here, then the program can be stopped when SWAT run begins.
Project directory:
C:\temp\SWATworkshopAK\swatcupadvanced431\swatcupadvanced431\swatcup431.Sufi2.SwatCup
SUFI2-swEdit.def
Then set the values of file SUFI2_swEdit.def as
follows:
The 95PPU is calculated at the 2.5% and 97.5% levels of the cumulative distribution of an output variable obtained
through Latin hypercube sampling, disallowing 5% of the very bad simulations.
Rfactor: Average thickness of the 95PPU band divided by the standard deviation of the measured data. SUFI-2, hence seeks to
bracket most of the measured data with the smallest possible uncertainty band. Smaller Rfactor indicates the less sensitivity.
P-factor: Percentage of measured data bracketed by the 95% prediction uncertainty (95PPU).
Improved
model
prediction
Objective
Objective Function
Function (NS)
(Sum)
Goal.txt - This command shows the value of all parameter sets as well as the
value of the objective function in the last column.
New_Pars.txt - This file shows the suggested values of the new parameters
to be used in the next iteration.
Also shown is the objective function (goal function) type, best simulation number of the current iteration, and the best
value of the objective function for the current run.
If behavioral solutions exist (multiobjective function), then the p-factor and r-factor for these solutions are also calculated.
As shown in the following Table the effect of using behavioral solutions is to obtain smaller p-factor and r-factor, or a
smaller prediction uncertainty.
The table shows that the objective function (NS) of 44 simulations is above threshold value 0.2 which means
Steps:
1) Change/check parameters in "model.in": copy all of the parameters and values in the "Best_Par.txt" to the
"model.in"
5) Replace the parameters and their limits in the "Par_inf.txt" with the parameters and values in the "New_pars.txt"
(Check and modify the parameter ranges if it is required)
Above process updates the SWAT model parameters; therefore, the user does not need to update the parameters via the
SWAT Interface, run the program, and move the files from "TxtInOut" into the Sufi2 project folder.
t-stat provides a measure of sensitivity (larger absolute values are more sensitive)
p-values determined the significance of the sensitivity which is often 0.05 or 0.01. A values close to zero has more
significance.
In the above example, the most sensitive parameters are CH_K2 followed by GW_REVAP and CN2.
The 95PPU is calculated at the 2.5% and 97.5% levels of the cumulative distribution
of an output variable obtained through Latin hypercube sampling, disallowing 5% of
the very bad simulations. Hence, SUFI-2 starts by assuming a large parameter
uncertainty (within a physically meaningful range), so that the measured data initially
falls within the 95PPU, then decreases this uncertainty in stepswhile monitoring the
P-factor and the R-factor. Conceptual illustration of the
relationship between parameter
uncertainty and prediction
Par_inf.txt
The .txt and .def files are the same as the Extraction section.
Var_file_rch_No_obs.txt
SUFI2.Post.bat: SUFI2_Extract.bat: