Usermanual Swat Cup
description
Transcript of Usermanual Swat Cup
-
7/18/2019 Usermanual Swat Cup
1/100
SWATCUP
SWATCalibrationandUncertaintyPrograms
KarimC.Abbaspour
-
7/18/2019 Usermanual Swat Cup
2/100
2
SWATCUP:SWATCalibrationandUncertaintyPrograms AUserManual.
Eawag2015
-
7/18/2019 Usermanual Swat Cup
3/100
3
DISCLAIMER
ThisreportdocumentsSWATCUP,acomputerprogramforcalibrationofSWATmodels.SWATCUP4is
apublicdomainprogram,andassuchmaybeusedandcopied freely.Theprogram linksSUFI2,PSO,
GLUE,ParaSol,andMCMCprocedures toSWAT. Itenables sensitivityanalysis, calibration, validation,anduncertaintyanalysisofSWATmodels.SWATCUP2012hasbeentestedforallprocedurespriorto
release. However, no warranty is given that the program is completely errorfree. If you encounter
problemswiththecode,finderrors,orhavesuggestionsfor improvement,pleasewritetoSWATCUP
-
7/18/2019 Usermanual Swat Cup
4/100
4
Content Page
Foodforthoughtincalibrationandapplicationofwatershedmodels 6
SUFI2 16
ConceptualbasisoftheSUFI2uncertaintyanalysisroutine 17
SUFI2asanoptimizationalgorithm 19
SWATCUP 20
StepbystepCreatingofSWATSUFI2InputFiles 21
ParameterizationinSWATCUP 51
Objectivefunctiondefinition 55
Sensitivityanalysis 59
ParallelProcessing 63
ValidationinSUFI2 64
Thesequenceofprogramexecution 65
Howto.. 66
PSO 70
IntroductiontoPSO 71
GLUE 74
IntroductiontoGLUE 75
CouplingGLUEtoSWATCUP 77
ValidationofGLUE 78
FileDefinition 79
ParaSol 81
IntroductiontoParaSol 82
CouplingParaSoltoSWATCUP 83
-
7/18/2019 Usermanual Swat Cup
5/100
5
ParaSol:Optimizationanduncertaintyanalysis 85
MCMC 92
IntroductiontoMCMC 93
StepbysteprunningofMCMC 96
References 98
-
7/18/2019 Usermanual Swat Cup
6/100
6
Foodforthoughtincalibrationandapplicationofwatershedmodels
Calibrationanduncertaintyanalysisofdistributedwatershedmodels isbesetwithafewserious issues
thatdeserve theattentionandcarefulconsiderationofresearchers.Theseare:1)Parameterizationof
watershedmodels.2)Definitionofwhatisacalibratedwatershedmodelandwhatarethelimitsofits
use.3)Conditionalityofa calibratedwatershedmodel.4)Calibrationofhighlymanagedwatersheds
wherenaturalprocessesplayasecondaryrole,and5)uncertaintyandnonuniquenessproblems.These
issuesarebrieflydiscussedhere.
1)ModelParameterization
Shouldasoilunitappearinginvariouslocationsinawatershed,underdifferentlandusesand/orclimate
zones,havethesameordifferentparameters?Probablyitshouldhavedifferentparameters.Thesame
argument could be made with all other distributed parameters. How far should one go with this
differentiation?Ontheonehandwecouldhavethousandsofparameterstocalibrate,andonotherwe
maynothaveenoughspatialresolution inthemodeltoseethedifferencebetweendifferentregions.
This balance is not easy to determine and the choice of parameterization will affect the calibrationresults.Detailed informationon spatialparameters is indispensable forbuilding a correctwatershed
model.Acombinationofmeasureddataandspatialanalysis techniquesusingpedotransfer functions,
geostatisticalanalysis,andremotesensingdatawouldbethewayforward.
2)Whenisawatershedmodelcalibrated?
Ifawatershedmodeliscalibratedusingdischargedataatthewatershedoutlet,canthemodelbecalled
calibrated for that watershed? If we add water quality to the data and recalibrate, the hydrologic
parametersobtainedbasedondischargealonewillchange. Is thenewmodelnowcalibrated for that
watershed?Whatifweadddischargedatafromstationsinsidethewatershed?Willthenewmodelgivecorrect loadsfromvarious landuses inthewatershed?Perhapsnot,unlesswe includethe loads inthe
calibrationprocess (seeAbbaspouretal.,2007).Hence,an importantquestionarisesas to:forwhat
purpose can we use a calibrated watershed model? For example: What are the requirements of a
calibratedwatershedmodelifwewanttodolandusechangeanalysis?Or,climatechangeanalysis?Or,
analysis of upstream/downstream relations in water allocation and distribution? Can any single
calibratedwatershedmodeladdressall these issues?Canwehave several calibratedmodels for the
samewatershedwhereeachmodel isapplicable toa certainobjective?Note that thesemodelswill
mostlikelyhavedifferentparametersrepresentingdifferentprocesses(seeAbbaspouretal.1999).
3)Conditionality
of
calibrated
watershed
models
Conditionality isan important issuewithcalibratedmodels.This isrelatedtothepreviousquestionon
thelimitationontheuseofacalibratedmodel.Calibratedparametersareconditionedonthechoiceof
objectivefunction,thetype,andnumbersofdatapointsandtheprocedureusedforcalibration,among
other factors. Inapreviousstudy (Abbaspouretal.1999),we investigatedtheconsequencesofusing
different variables and combination of variables from among pressure head, water content, and
cumulativeoutflowontheestimationofhydraulicparametersby inversemodeling.The inversestudy
-
7/18/2019 Usermanual Swat Cup
7/100
7
combinedaglobaloptimizationprocedurewithanumerical solutionof theonedimensionalvariably
saturated Richards flow equation. We analyzed multistep drainage experiments with controlled
boundaryconditions in large lysimeters.Estimatedhydraulicparametersbasedondifferentobjective
functionswerealldifferentfromeachother;however,asignificanttestofsimulationresultsbasedon
these parameters revealed that most of the parameter sets produced similar simulation results.
Notwithstanding the significance test, rankingof theperformancesof the fittedparameters revealed
that theywerehighlyconditionalwith respectto thevariablesused intheobjective functionand the
typeofobjectivefunctionitself.Mathematically,wecouldexpressacalibratedmodelMas:
,....),,,,,( mvbwgpMM
whereisavectorofparameters,p isacalibrationprocedure,g istheobjectivefunctiontype,wisa
vectorofweights intheobjectivefunction,b istheboundaryconditions,v isthevariablesused inthe
objectivefunction,misthenumberofobservedvs,etc.Therefore,acalibratedmodelisconditionedon
the procedure used for calibration, on the objective function, on the weights used in the objective
function,onthe initialandboundaryconditions,onthetypeand lengthofmeasureddataused inthe
calibration,etc.Suchamodelcanclearlynotbeappliedforjustanyscenarioanalysis.
4)Calibrationofhighlymanagedwatersheds
Inhighlymanagedwatersheds,naturalprocessesplayasecondaryrole.Ifdetailedmanagementdatais
notavailable,thenmodelingthesewatershedswillnotbepossible.Examplesofmanagementsaredams
andreservoirs,watertransfers,andirrigationfromdeepwells.InFigure1atheeffectofAswandamon
downstreamdischargebeforeandafteritsoperationisshown.Itisclearthatwithouttheknowledgeof
damsoperation,itwouldnotbepossibletomodeldownstreamprocesses.Figure1bshowstheeffect
ofwetlandondischargeupstream,inthemiddle,anddownstreamofNigerInlandDelta.
Figure1.left)EffectofAswandamondownstreamdischargebeforeandafteritsoperationin1967.
right)TheinfluenceofNigerInlandDeltaonthethroughflowatupstream,within,anddownstreamof
thewetland.(AfterSchuoletal.,2008a,b)
-
7/18/2019 Usermanual Swat Cup
8/100
8
InFigure2theeffectofirrigationonactualETandsoilmoistureisillustratedinEsfahan,Iran.Esfahanis
aregionofhighirrigationwithanegativewaterbalanceforalmosthalfoftheyear.
Figure2.
Illustration
of
the
differences
in
predicted
actual
ET
(a)
and
soil
moisture
(b)
with
and
without
consideringirrigationinEsfahanprovince,Iran.Thevariablesaremonthlyaveragesfortheperiodof
19902002.(AfterFaramarzietal.,2009)
Inthestudyofwaterresources in Iran,Faramarzietal., (2008)producedawatermanagementmap
(Figure3)inordertoexplainthecalibrationresultsofahydrologicmodelofthecountry.
Figure3.WatermanagementmapofIranshowingsomeofmansactivitiesduring19902002.Themap
showslocationsofdams,reservoir,watertransfersandgroundwaterharvest(backgroundshows
provincialbasedpopulation).AfterFaramarzietal.,(2009).
0
10
20
30
40
50
60
Jan Feb
Mar Ap
rMa
y Jun Ju
lAu
gSep
Oct
Nov
Dec
Month
ActualET(mmm
onth-1)
0
10
20
30
40
50
6070
80
90
100
Jan Feb
Mar
Apr
May Ju
n Jul
Aug
Sep
Oct
Nov
Dec
Month
Soilwater(mm
(a) (b)
With irrigation Without irrigation
-
7/18/2019 Usermanual Swat Cup
9/100
9
5)Uncertaintyissues
Anotherissuewithcalibrationofwatershedmodelsisthatofuncertaintyinthepredictions.Watershed
modelssufferfromlargemodeluncertainties.Thesecanbedividedinto:conceptualmodeluncertainty,
input uncertainty, and parameter uncertainty. The conceptual model uncertainty (or structural
uncertainty) couldbeof the following situations:a)Modeluncertaintiesdue to simplifications in the
conceptualmodel,
b)
Model
uncertainties
due
to
processes
occurring
in
the
watershed
but
not
included
in the model, c) Model uncertainties due to processes that are included in the model, but their
occurrencesinthewatershedareunknowntothemodeler,andd)Modeluncertaintiesduetoprocesses
unknowntothemodelerandnotincludedinthemodeleither!
Inputuncertaintyisasaresultoferrorsininputdatasuchasrainfall,andmoreimportantly,extension
ofpointdatatolargeareasindistributedmodels.Parameteruncertaintyisusuallycausedasaresultof
inherentnonuniquenessofparameters in inversemodeling.Parametersrepresentprocesses.Thefact
thatprocessescancompensateforeachothergivesrisetomanysetsofparametersthatproducethe
sameoutputsignal.Ashortexplanationofuncertaintyissuesisofferedbelow.
5.1)Conceptualmodeluncertainty
a)Modeluncertaintiesduetosimplificationsintheconceptualmodel.Forexample,theassumptionsin
the universal soil loss equation for estimating sediment loss, or the assumptions in calculating flow
velocityinariver.Figures4aand4bshowsomegraphicalillustrations.
Fig.4.(left)Asimplifiedconceptualmodelofhydrologyinawatershedwhererevapisignored.(right)A
naturalprocessnearthesourceofYellowRiverinChinaplayinghavocwithriverloadingbasedonthe
USLE!
b)Modeluncertaintiesduetoprocessesoccurringinthewatershedbutnotincludedinthemodel.For
example,winderosion(Fig.5 left),erosionscausedby landslides(Fig.5right),andthesecondstorm
effecteffectingthemobilizationofparticulatesfromsoilsurface(seeAbbaspouretal.,2007).
-
7/18/2019 Usermanual Swat Cup
10/100
10
Figure5.Naturalprocessesnotincludedinmostwatershedmodelsbutwithalargeimpactonhydrology
and
water
quality
of
a
watershed,
albeit
for
a
short
period
c)Modeluncertaintiesdue toprocesses thatare included in themodel,but theiroccurrences in the
watershed areunknown to themodelerorunaccountable; for example, various formsof reservoirs,
watertransfer,irrigation,orfarmmanagementaffectingwaterquality,etc.(Fig.6,7).
Fig.6.Agriculturalmanagementpracticessuchaswaterwithdrawalandanimalhusbandrycanaffect
waterquantityandquality.These,maynotalwaysbeknowntothemodeller.
-
7/18/2019 Usermanual Swat Cup
11/100
11
Fig.7.Watercontrolandwaterdiversionsmaychangetheflowinwaysthatareunknowntothe
modellerand,hence,cannotbeaccountedforinthemodel.
d)Modeluncertaintiesduetoprocessesunknowntothemodelerandnotincludedinthemodeleither!
These includedumpingofwastematerialandchemicals intherivers,orprocessesthatmay lastfora
numberofyearsanddrasticallychangethehydrologyorwaterqualitysuchaslargescaleconstructions
ofroads,
dams,
bridges,
tunnels,
etc.
Figure
8shows
some
situations
that
could
add
substantial
conceptualmodelerrortoouranalysis.
Fig.8Largeconstructionprojectssuchasroads,dams,tunnels,bridges,etc.canchangeriverflowand
waterqualityforanumberofyears.Thismaynotbeknownoraccountablebythemodellerorthemodel
-
7/18/2019 Usermanual Swat Cup
12/100
12
5.2)InputUncertainty
Inadditiontomodeluncertainty,thereareuncertaintiesduetoerrorsininputvariablessuchasrainfall
andtemperature,aspointmeasurementsareusedindistributedmodels.Itisquitedifficulttoaccount
forinputuncertainty.Someresearchersproposetreatinginputsasrandomvariable,whichallowsfitting
them togetbetter simulations.Asmodeloutputsarevery sensitive to inputdata,especially rainfall,
caremust
be
taken
in
such
approaches.
In
mountainous
regions,
input
uncertainty
could
be
very
large.
5.3)Parameternonuniqueness
Asinglevaluedparameterresults inasinglemodelsignal indirectmodeling.Inan inverseapplication,
anobservedsignal,however,couldbemorelessreproducedwiththousandsofdifferentparametersets.
Thisnonuniquenessisaninherentpropertyofinversemodeling(IM).IM,hasinrecentyearsbecomea
verypopularmethodforcalibration(e.g.,BevenandBinley,1992,2001;Abbaspouretal.,1997,2007;
Duanetal.,2003;Guptaetal.,1998). IM isconcernedwith theproblemofmaking inferencesabout
physical systems from measured output variables of the model (e.g., river discharge, sediment
concentration).This
is
attractive
because
direct
measurement
of
parameters
describing
the
physical
system is time consuming, costly, tedious, and often has limited applicability. Because nearly all
measurementsaresubjecttosomeuncertainty,theinferencesareusuallystatisticalinnature.
Figure9.Exampleofparameternonuniquenessshowingtwosimilardischargesignalsbasedonquite
differentparametervalues
Furthermore,becauseone canonlymeasure a limited numberof (noisy) data and becausephysical
systems are usually modelled by continuum equations, no hydrological inverse problem is really
uniquely solvable. Inotherwords, if there isa singlemodel that fits themeasurements therewillbe
GW_DELAY CH_N2 CN2 REVAPMN Sol_AWC g
3.46 0.0098 50 0.8 0.11 0.010
0.34 0.131 20 2.4 0.2 3 0.011
-
7/18/2019 Usermanual Swat Cup
13/100
13
manyofthem.AnexampleisshowninFigure9wheretwoverydifferentparametersetsproducesignals
similartotheobserveddischarge.Ourgoalininversemodellingisthentocharacterizethesetofmodels,
mainlythroughassigningdistributions(uncertainties)totheparameters,whichfitthedataandsatisfy
ourpresumptionsaswellasotherpriorinformation.
TheSwisscheeseeffect
Thenonuniquenessproblemcanalsobelookedatfromthepointofviewofobjectivefunction.Plotting
the objectivefunction response surface for two by two combinations of parameters could be quite
revealing.Asanexample,seeFigure10wheretheinverseofanobjectivefunctionisplottedagainsttwo
parameters,hence,localminimaareshownaspeaks.Sizeanddistributionofthesepeaksresemblesthe
mysteriousholesinablockofSwissEmmentalercheesewherethesizeofeachholerepresentsthelocal
uncertainty.Ourexperienceshowsthateachcalibrationmethodconvergestoonesuchpeak (see the
papers by Yang et al., 2008, Schuol et al., 2008a, and Faramarzi et al., 2008). Yang et al., (2008)
comparedGeneralized LikelihoodUncertaintyEstimation (GLUE) (BevenandBinley,1992),Parameter
Solution (ParaSol) (Van Griensven and Meixner, 2003a), Sequential Uncertainty Fitting (SUFI2)
(Abbaspouretal.,2004;2007),andMarkovchainMonteCarlo(MCMC)(e.g.,KuczeraandParent,1998;
Marshalletal.,2004;Vrugtetal.,2003;Yangetal.,2007)methodsinanapplicationtoawatershedin
China. They found that these different optimization programs each found a different solution at
different locations in theparameter spaceswithmore less the samedischarge results.Table1hasa
summaryofthecomparison.
To limit thenonuniqueness, theobjective function shouldbemadeascomprehensiveaspossibleby
includingdifferent fluxesand loads (seeAbbaspouretal.,2007).Thedownsideof this is thata lotof
datashouldbemeasured forcalibration.Theuseofremotesensingdata,when itbecomesavailable,
couldbeextremelyuseful.Infactwebelievethatthenextbigjumpinwatershedmodelingwillbemade
asaresultofadvancesinremotesensingdataavailability.
Furthererrorscouldalsoexist intheverymeasurementsweusetocalibrate themodel.Theseerrors
couldbe very large, forexample, in sedimentdataandgrab samples ifused for calibration.Another
uncertainty worth mentioning is that of modeler uncertainty! It has been shown before that the
experienceofmodelerscouldmakeabigdifference inmodelcalibration.Wehopethatpackages like
SWATCUPcanhelpdecreasemodeleruncertaintybyremovingsomeprobablesourcesofmodelingand
calibrationerrors.
Onafinalnote, it ishighlydesirabletoseparatequantitativelytheeffectofdifferentuncertaintieson
model outputs, but this is very difficult to do. The combined effect, however, should always be
quantifiedonmodeloutputs.
-
7/18/2019 Usermanual Swat Cup
14/100
14
Figure10.Amultidimensionalobjectivefunctionismultimodalmeaningthattherearemanyareasof
goodsolutions
with
different
uncertainties
much
like
the
mysterious
holes
in
aslice
of
Swiss
cheese.
-
7/18/2019 Usermanual Swat Cup
15/100
15
Table1.Summarystatisticscomparingdifferentcalibrationuncertaintyprocedures.
Criterion GLUE ParaSol SUFI2 Bayesianinferencewithcont.
autoregr.errormodel
MCMC IS
Goalfunction NashSutcliffe NashSutcliffe NashSutcliffe post.prob.
density
post.prob.
density
a__CN2.mgt
v__ESCO.hru
v__EPCO.hru
r__SOL_K.sol
a__SOL_AWC.sol
v__ALPHA_BF.gw
v__GW_DELAY.gw
r__SLSUBBSN.hru
a__CH_K2.rte
a__OV_N.hru2dry
2
wet2dry
2wet
16.8 (29.6,
9.8)1
0.76 (0.02,0.97)
0.22 (0.04,0.90)
0.16 (0.36,
0.78)
0.11 (0.01,0.15)
0.12 (0.06,0.97)
159.58 (9.7,
289.3)
0.45 (0.56,
0.46)78.19 (6.0,144.8)
0.05 (0.00,0.20)
21.0 (21.9,
20.1)
0.67(0.65,0.69)
0.16(0.13,0.20)
0.37(0.41,
0.34)
0.07(0.08, 0.08)
0.12(0.08, 0.13)
107.7(91.2,115.2)
0.59(0.60,
0.58)
35.70(27.72,37.67)
0.11(0.07,0.10)
26.9(30.0,7.2)
0.82(0.43,1.0)
1(0.34,1.0)
0.1(0.58,0.34)
0.07(0.05,0.15)
0.51(0.23,0.74)
190.07(100.2,300)
0.52(0.60, 0.03)
83.95(69.4,150.0)
0.06(0.00,0.11)
14.2(16.8,
11.6)
0.74(0.63,0.75)
0.94(0.39,0.98)
0.29(0.31,0.78)
0.12(0.1,0.13)
0.14(0.11, 0.15)
25.5(17.8,33.3)
0.55(0.56,
0.15)
78.3(68.0,86.2)
0.12(0.00, 0.19)0.93(0.81,1.10)
2.81(2.4,3.9)
38.13(29.5,53.8)
3.42(2.4,8.0)
19.60
0.62
0.27
0.01
0.05
0.91
33.15
0.58
147.23
0.08
0.87
2.3028.47
0.92
NSforcal(val) 0.80(0.78) 0.82(0.81) 0.80(0.75) 0.77(0.77) 0.64 (0.71)
R2forcal(val) 0.80(0.84) 0.82(0.85) 0.81(0.81) 0.78(0.81) 0.70(0.72)
LogPDFforcal(val) 1989(926) 2049(1043) 2426 (1095) 1521(866) 1650(801)3pfactorforcal
(val)
79%(69%) 18% (20%) 84% (82%) 85%(84%)
4
dfactorforcal
(val)0.65(0.51) 0.08 (0.07) 1.03 (0.82) 1.47(1.19)
Uncertainty
describedby
parameter
uncertainty
Allsourcesof
uncertainty
Parameter
uncertaintyonly
Allsourcesof
uncertainty
Parameter
uncertaintyonly
Parameter
uncertainty
only
Difficultyof
implement.
veryeasy easy easy morecomplicated more
complicated
Numberofruns 10000 7500 1500+1500 5000+20000+
20000
100000
1c(a,b)foreachparametermeans:cisthebestparameterestimate,(a,b)isthe95%parameter
uncertaintyrangeexceptSUFI2(inSUFI2,thisintervaldenotesthefinalparameterdistribution).2
thedry,wet,dry,andwetusedtocalculatetheCalculatethelogarithmoftheposteriorprobabilitydensityfunction(PDF)arefromthebestofMCMC.3pfactormeansthepercentageofobservationscoveredbythe95PPU
4dfactormeansrelativewidthof95%probabilityband(AfterYangetal.,2008)
-
7/18/2019 Usermanual Swat Cup
16/100
16
SUFI2
SequentialUncertaintyFitting
version2
Discharge Calibration
0
100
200
300
400
500
600
700
01.01.91 01.07.91 01.01.92 01.07.92 01.01.93 01.07.93 01.01.94 01.07.94 01.01.95 01.07.95 01.01.96
Date
Dailydischa
rge(m3
s-1)
measured data bracketed by the 95PPU = 91%
d-factor= 1.0
-
7/18/2019 Usermanual Swat Cup
17/100
17
ConceptualbasisoftheSUFI2uncertaintyanalysisroutine
The deterministic approach to calibration is now outdated and unacceptable. Example of a
deterministicoptimization is trial and error.Meaning you keep adjustingparametersuntil you get
somekindofa reasonablematchbetween simulationandobservation.Reporting thisasacalibrated
model,inmyopinioniswrong,andwillnotstandinanycourtoflaw,ifitcomestothat.Here,wewill
not furtherdiscuss thedeterministicapproaches that result ina single setofparameters claiming to
representthebestsimulation.
Instochasticcalibration,werecognizetheerrorsanduncertainties inourmodelingworkand try to
capture,tosomedegree,ourignoranceandlackofunderstandingoftheprocessesinnaturalsystems.
There is an intimate relationship between calibration and uncertainty (Abbaspour, et al., 2015).
Reporting the uncertainty is not a luxury in modeling, it is a necessity. Without the uncertainty,
calibration ismeaninglessandmisleading. Furthermore,anyanalysiswith the calibratedmodelmust
includetheuncertaintyintheresultbypropagatingtheparameteruncertainties.
In SUFI2, uncertainty in parameters, expressed as ranges (uniform distributions), accounts for all
sources of uncertainties such as uncertainty in driving variables (e.g., rainfall), conceptual model,parameters, and measured data. Propagation of the uncertainties in the parameters leads to
uncertainties inthemodeloutputvariables,whichareexpressedasthe95%probabilitydistributions.
Thesearecalculatedatthe2.5%and97.5% levelsofthecumulativedistributionofanoutputvariable
generatedby thepropagationof theparameteruncertaintiesusing Latinhypercube sampling.This is
referred to as the 95% prediction uncertainty, or 95PPU. These 95PPUs are the model outputs in a
stochastic calibration approach. It is important to realize that we do not have a single signal
representing model output, but rather an envelope of good solutions expressed by the 95PPU,
generatedbycertainparameterranges.
InSUFI2,wewant thatourmodel result (95PPU)envelopsmostof theobservations.Observation, is
whatwehavemeasuredinthenaturalsystem.Observationisimportantbecauseitistheculminationof
alltheprocessestakingplaceintheregionofstudy.Theargument,howevernave,isthatifwecapturetheobservationcorrectlywithourmodel,thenwearesomehowcapturingcorrectlyall theprocesses
leadingtothatobservation.Theproblem,ofcourse, isthatoftenacombinationofwrongprocesses in
ourmodelmayalsoproducegoodsimulationresults.Forthisreason,themorevariables(representing
differentprocesses)we include in theobjective function, themore likelyweare toavoid thewrong
processes.
Toquantifythefitbetweensimulationresult,expressedas95PPU,andobservationexpressedasasingle
signal (withsomeerrorassociatedwith it)wecameupwith two statistics:PfactorandRfactor (see
Abbaspouretal.,2004,2007 referencesprovided in the reference listof SWATCUP).Pfactor is the
percentageofobserveddataenvelopedbyourmodelingresult,the95PPU.Rfactor isthethicknessof
the95PPUenvelop.InSUFI2,wetrytogetreasonablevaluesofthesetwofactors.Whilewewouldlike
tocapturemostofourobservations inthe95PPUenvelop,wewouldatthesametime liketohavea
smallenvelop.Nohardnumbersexistforwhatthesetwofactorsshouldbe,similartothefactthatno
hardnumbersexistforR2orNS.The largertheyare,thebettertheyare.ForPfactor,wesuggesteda
valueof>70%fordischarge,whilehavingRfactorofaround1.Forsediment,asmallerPfactoranda
largerRfactorcouldbeacceptable.
SUFI2operatesbyperforming several iterations,usuallyatmost
-
7/18/2019 Usermanual Swat Cup
18/100
18
previousiteration.Naturally,asparameterrangesgetsmaller,the95PPUenvelopgetssmaller,leading
tosmallerPfactorandsmallerRfactor.Aseachiterationzooms intoabetterregionoftheparameter
space,obtainedbythepreviousiteration,itisgoingtofindabetterbestsolution.So,ifyouhaveNSas
yourobjectivefunction,thenyouwillgetabetterNS insubsequent iterations,butthePfactorandR
factorwilldecreasebecauseofnarrowerparameter ranges.But the idea isnot to find that socalled
bestsimulation.Because,1)therearealwaysbettersimulations,and2)thedifferencebetweenthe
best simulation and the next best simulation and the next next best simulation is usually
statisticallyinsignificant(e.g.,NS=0.83vsNS=0.81areprobablynotsignificantlydifferent),meaningthat
theycouldbothbeidentifiedasthebestsimulations.Butwhilethedifferencesareinsignificantinterms
oftheobjectivefunctionvalue,theyareverysignificant intermsofparametersvalues.Therefore,the
nextbestsolutioncannotbeignored.
TheconceptbehindtheuncertaintyanalysisoftheSUFI2algorithmisdepictedgraphicallyintheFigure
below.ThisFigure illustratesthatasingleparametervalue(shownbyapoint) leadstoasinglemodel
response (Fig.a),whilepropagationof theuncertainty inaparameter (shownbya line) leads to the
95PPU illustratedby the shaded region in Figureb.Asparameteruncertainty increases, the output
uncertaintyalso increases (notnecessarily linearly) (Fig. c).Hence,SUFI2 startsbyassuminga large
parameteruncertainty (withinaphysicallymeaningful range),sothatthemeasureddata initially fallswithin the95PPU, thendecreases thisuncertainty in stepswhilemonitoring thePfactorand theR
factor. In each step, previous parameter ranges are updated by calculating the sensitivity matrix
(equivalenttoJacobian),andequivalentofaHessianmatrix,followedbythecalculationofcovariance
matrix, 95% confidence intervals of the parameters, and correlation matrix. Parameters are then
updated in such a way that the new ranges are always smaller than the previous ranges, and are
centeredaroundthebestsimulation(formoredetailseeAbbaspouretal.,2004,2007).
A conceptual illustration of the relationship between parameter uncertainty and prediction
uncertainty
Thegoodnessof fitand thedegree towhich the calibratedmodelaccounts for theuncertaintiesare
assessedbytheabovetwomeasures.Theoretically,thevalueforPfactorrangesbetween0and100%,
whilethatofRfactorrangesbetween0andinfinity.APfactorof1andRfactorofzeroisasimulation
thatexactlycorrespondstomeasureddata.Thedegreetowhichweareawayfromthesenumberscan
beusedtojudgethestrengthofourcalibration.A
-
7/18/2019 Usermanual Swat Cup
19/100
19
largerPfactorcanbeachievedattheexpenseofalargerRfactor.
Hence,oftenabalancemustbereachedbetweenthetwo.WhenacceptablevaluesofRfactorandP
factor are reached, then the parameter uncertainties are the desired parameter ranges. Further
goodness of fit can be quantified by the R2 and/or NashSutcliff (NS) coefficient between the
observations and the final best simulation. It should be noted that we do not seek the best
simulationasinsuchastochasticprocedurethebestsolutionisactuallythefinalparameterranges.
Ifinitiallywesetparameterrangesequaltothemaximumphysicallymeaningfulrangesandstillcannot
finda95PPUthatbracketsanyormostofthedata,forexample,ifthesituationinFiguredoccurs,then
theproblemisnotoneofparametercalibrationandtheconceptualmodelmustbereexamined.
SUFI2asanoptimizationalgorithm
ForadescriptionofSUFI2seeAbbaspouretal.,(2004,2007).ReferencesareprovidedintheReference
directoryofSWATCUP.
ForacalibrationprotocolseeAbbaspouretal.,(2015).
http://www.sciencedirect.com/science/article/pii/S0022169415001985
-
7/18/2019 Usermanual Swat Cup
20/100
20
SWATCUP
Automatedmodelcalibrationrequiresthattheuncertainmodelparametersaresystematicallychanged,
themodel is run,and the requiredoutputs (corresponding tomeasureddata)areextracted from the
modeloutputfiles.Themainfunctionofaninterfaceistoprovidealinkbetweentheinput/outputofa
calibrationprogramandthemodel.Thesimplestwayofhandlingthefileexchange isthroughtextfile
formats.
SWATCUP is an interface that was developed for SWAT. Using this generic interface, any
calibration/uncertaintyorsensitivityprogramcaneasilybe linkedtoSWAT.Aschematicofthe linkage
betweenSWATandfiveoptimizationprogramsisillustratedintheFigurebelow.
-
7/18/2019 Usermanual Swat Cup
21/100
21
StepbystepCreatingofSWATSUFI2InputFiles
SWAT_Edit.exeBACKUP
SUFI2_LH_sample.exe
SUFI2_new_pars.exepar_val.txt
swat.exe
ModifiedSWAT inputs
SWAT
outputs
par_inf.txt
SUFI2_extract_rch.exe
SUFI2_goal_fn.exe
SUFI2_95ppu.exe
*.out
Is
calibration
criteriasatisfied?
observed.txt
goal.txt
yes
stop
no
SUFI2_extract_rch.def
SUFI2_swEdit.def
-
7/18/2019 Usermanual Swat Cup
22/100
22
1.BeforeSWATCUP
BecomefamiliarwithSWATparameters.TheyareallexplainedintheSWATI/Omanual.Also,readthe
theoryandapplicationofSWATSUFI2atthebeginningofthismanualandinthefollowingpapers:
Thurwatershedpaper(Abbaspouretal.,2007)
Landfill
application
in
Switzerland
(Abbaspour
et
al.,
2004)
ThecontinentalapplicationinAfrica(Schuoletal,2008a,b)andEurope(Abbaspouretal,2014)
ThecountrybasedapplicationinIran(Faramarzietal.,2008)
Thecomparisonofdifferentoptimizationprograms(Yangetal.,2008)
Theparallelprocessingpaper(Rouholahnejadetal.,2013)
TheBlackSeaapplicationpaper(Rouholahnejadetal.,2014)
TheapplicationtoentireEurope(Abbaspouretal.,2015)
(http://www.sciencedirect.com/science/article/pii/S0022169415001985)
AndothersprovidedintheC:\SWAT\SWATCUP\ExternalData\References
2.StartSWATCUP
InstalltheSWATCUPinC:\SWAT\SWATCUP,thesamedirectoryastheSWATandstarttheprogramby
pressingtheSWATCUPicononthedesktop:
3.OpenaProject
Toopenaneworoldproject:Pressthe symbolatthetopleftcorner
andchooseaNeworOpenanoldproject
-
7/18/2019 Usermanual Swat Cup
23/100
23
Foranewproject locatea SWAT TxtInOutdirectory.Any filewith TxtInOut in thename string
wouldbeacceptable
ChooseSWATandprocessorversions
Selectaprogramfromthelistprovided(SUFI2,GLUE,ParaSol,MCMC,PSO).Adetailedexplanationof
theSUFI2procedureisofferedhere,butallprogramsfollowthesameformat.
GiveanametotheprojectandalocationwhereSWATCUPprojectcanbesaved.
-
7/18/2019 Usermanual Swat Cup
24/100
24
NotethedefaultadditiontothenameprovidedinthewindowtotherightofProjectNamewindow.
For a SUFI2 project, the full SWATCUP directory name in the example below would be
test_1.Sufi2.SwatCup,whichwillresideinc:\ArcSWATprojects\Black_Seadirectory.
AtthispointTheprogramcreatesthedesiredprojectdirectoryandcopiesthereallTxtInOutfilesfrom
theindicatedlocationintotheSWATCUPprojectdirectory.ItalsocreatesadirectorycalledBackupin
thesameSWATCUPprojectdirectoryandcopiesallSWATTxtInOutfilethere.Theparameters inthe
filesintheBackupdirectoryserveasthedefaultparametersanddonotchangedduringthecalibration
process.TheBackupdirectory isalwaysneeded as itsoriginal formbecause,relativechangesthat
havebeenmadetotheparametersduringcalibration,weremaderelativetotheparametervalues in
theBackupdirectory.Therefore,itisimportantthattheBackupdirectoryisneverchanged.
4.SWATOutputFiles
Youcancalibratethemodelbasedonthevariablesfromoutput.rch,output.hru,output.sub,output.res,
output.mgt,andnowalsohourlygeneratedfiles.However,theinterfaceonlyshows.rch,.hru,and.sub
files.Asmostoftenwehaveeitherdischarge,nutrientsdata,orsedimentdata,onlytheseareshownin
the interface.Justclickandactivatewhich fileyouwanttouse (i.e.,yourobservedvariablesreside in
whichSWATfile(s)).
-
7/18/2019 Usermanual Swat Cup
25/100
25
5.CalibrationInputs
UndertheCalibrationInputseditthefollowingfiles:
Par_inf.txt
This file resides in the project directory in SUFI2.IN directory. It contains input parameters to be
optimized.Anexample isprovided,whichneeds tobe edited by theuser. The examples shows theformatofthefile.Editthistoyourneeds.Atextviewandaformviewisprovided.Theformviewhelps
with finding the correct parameter syntax or expression. All SWAT parameters (up to the time of
compilationofthe lastswatcupversion)canbefoundhere.TheformviewfollowsstandardWindows
protocol and the users are advised to familiarize themselves with this module by testing different
featuresof it.Whatyoudo in theformview,appears in the textviewandviceversa.Usersarealso
encouraged to trydifferent things in theformviewand lookat the them in the textview tobecome
familiarwiththisimportantanduniquefeatureofSWATCUP.
Thisfilecontainsthenumberofparameterstobeoptimizedandthenumberofsimulationstomakein
thecurrent iteration.SUFI2 is iterative,each iteration containsanumberof simulations.Around500
simulations are recommended in each iteration. But if a swat project takes too long to run, fewer
numberofsimulations (200300) ineach iterationcouldbeacceptable.Parametersaresampledusing
Latinhypercubeschemeexplainedlaterinthemanual.Usually,notmorethan4iterationsaresufficient
to reach an acceptable solution. A parallel processing module is also available to speed up the
calibrationprocess.
To learn more about parameterization and parameter qualifiers r__, v__, and a__ please see the
sectiononparameterizationbelow.
-
7/18/2019 Usermanual Swat Cup
26/100
26
What parameters to use depend on the objective function. Initially, in every case, flow should be
calibratedand thenwaterqualityvariablesaddedoneat time (seeAbbaspouretal.,2007,2015 for
parameterchoicesandcalibrationprotocol).
SUFI2_swEdit.def
This file contains the beginning and the ending simulation years. Please note that the beginning
simulationdoesnot include thewarmupperiod.SWATsimulates thewarmupperiodbutdoesnot
printanyresults,therefore,theseyearsarenotconsideredinSWATCUP.Youcancheckoutput.rchfile
ofSWATtoseewhenthebeginningandtheendingsimulationtimesis.
-
7/18/2019 Usermanual Swat Cup
27/100
27
File.cio
ThisisaSWATfile.Itisputhereforconvenience.Whatyouneedfromthisfilearethesimulationyears
andthenumberofwarmupyears(NYSKIP)tocorrectlyprovideSWATCUPwithbeginningandendyear
ofsimulation.Itisrecommendedthatyouhave23yearsofwarmupperiod.
.
.
Missspecifyingthecorrectdatesisthecauseofbiggestusererror!Pleasenotethefollowing:
- Intheaboveexample,beginningyearofSWATsimulationis1987,endyearis2001
- There are 3 years of warm up period as indicated by NYSKIP. Therefore, SWAT output files
containdata from1990 to2001.Thesedatesareof interest toSWATCUP.So, inSWATCUP
beginningyearis1990andendyearis2001.
- AlsonotethatSWATCUPrequiresthe IDAFtobeatthebeginningof theyear (always1)and
IDALtogototheendoftheyear(365or366forleapyears).ThereforeSWATsimulationshould
alwaysbe from thebeginning to theendof theyear.Soyourclimatedatamustbe from thebeginningtotheendoftheyear.
Absolute_SWAT_Values.txt
Allparameterstobefittedshouldbeinthisfileplustheirabsoluteminandmaxranges.Currentlymost,
butperhapsnotallparametersareincludedinthisfile.Simplyaddtoittheparametersthatdontexist.
TheSWAT_Edit.exeprogram, that replacesparameters in theSWAT files,doesnotallowparameters
beyondthisrangeintoSWATfiles.
etc.
-
7/18/2019 Usermanual Swat Cup
28/100
28
6.Observation
UnderObservationarethreefilesthatcontaintheobservedvariables.Observedvariablescorrespond
to thevariables inoutput.rch,output.hru,andoutput.sub,output.res,andoutput.mgt files,although
thelattertwodonotappearinSWATCUP.
Initially, all options are deactivated. To activate you need to choose which SWAT file contains the
simulateddata(step4above).Variablesfromdifferentfilescanbeincludedtoformamulticomponent
objectivefunction.Simplyonlyeditthefile(s)thatappliestoyourprojectanddonotworryaboutthe
onesthatdont.Theformatshouldbeexactlyasshown intheexamplesprovided intheprogram.The
three files Observed_rch.txt, Observed_hru.txt, and Observed_bsn.txt can be edited here, but
observed_res.txtforreservoirdataandobserved_mgt.txtforcropyieldarealsoavailablethatcouldbe
editeddirectlyinthe.\SUFI2.INdirectoryintheSWATCUPprojectdirectory.
Missingvalues
Theformatoftheobservationfilesareasshown intheexamplesprovided.Thesefilescouldeasilybe
madeinExcelandpastedhere.IntheobservedfilesYoumayhavemissingdatathatcanbeaccounted
forasshownintheexamplefilesandexplainedbelow.
Thefirstcolumnhassequentialnumbersfromthebeginningofsimulationtimeperiod.Intheexample
below,thefirst10monthsaremissingsothefirstcolumnbeginsfrom11.Also,months18,19,and20
aremissing.
-
7/18/2019 Usermanual Swat Cup
29/100
29
Thesecond
column
has
an
arbitrary
format
but
it
should
be
one
connected
string.
Here,
it
is
showing
thevariablename,month,andyear.Thirdcolumnisthevariablevalue.
Ifbaseflow isseparated,anddynamicbaseflow isused,thenaforthcolumn indicatingthebaseflow
should also be added. The example of an observation file with base flow is given in observed+.txt
in.\SUFI2.INdirectory.
Allotherobservation_*.txtfileshavethesameformat.ThisfiletellstheextractprogramsofSWATCUP
whattoextractfromtheSWAToutputfiles.
Theobserved_rch.txt filescancontainmanyvariablessuchasdischarge,sediment,nitrate,etc.which
appearintheSWAToutputfileoutput.hru.Simplyusethesameformatforallvariablesasshowninthe
examples.Also,
for
the
variables
name,
be
consistent
in
all
SWAT
CUP
files.
7.Extraction
UnderExtractionyouwillfindtwotypesoffiles.txtand.defcorrespondingagaintoSWAToutputfiles
output.rch,output.hru, andoutput.sub. If youhaveobservations corresponding to variables in these
files,thenyouneedtoextractthecorrespondingsimulatedvaluesfromthesefilesonly.
-
7/18/2019 Usermanual Swat Cup
30/100
30
.txtfilessimplycontainthenamesofthefilesthatextractedvaluesshouldbewrittento,and.deffiles
define which variables need to be extracted from which subbasins. These files are relatively self
explanatory.Hereagainonlyedittheneededfiles.
Intheexampleprovided,wehave4measuredvariables,3dischargesfromsubbasins1,3,7,and1nitrate
from subbasin 7. The extract files of SWATCUP extract the corresponding simulated data from
output.rchfileandwritethemtothefilesindicatedhereforeverysimulation.
BelowisanexampleofSUFI2_extrcat_rch.def
-
7/18/2019 Usermanual Swat Cup
31/100
31
Thefileisselfexplanatory.Weareextracting2variables:dischargeandnitrate.Theyare incolumns7
and18 in theoutput.rch file.Thereareatotalof20subbasins in theproject.Fordischarge,wehave
flow measurements from subbasins 1, 3, and 7. For nitrate we have measurement from subbasin
number7only.Thebeginningdatedoesnotincludewarmupperiod.
8.Objectivefunction
Next,ObjectiveFunctionisdefined.InthissteptwofilesObserved.txtandVar_file_name.txtshouldbe
edited. The Observed.txt file contains all the information in observed_rch.txt, observed_hru.txt,
observed_sub.txtfiles,plussomeextrainformationforthecalculationoftheobjectivefunction.
Var_file_name.txt contains the names of all the variables that should be included in the in the
objectivefunction.Thesenamesaresimilartothenamesinthevar_file_*.txtintheExtractionsection.
Observed.txtfilealsoisquiteselfexplanatory.
-
7/18/2019 Usermanual Swat Cup
32/100
32
Inthisexamplewehave4variables.Wehaveanoptiontochoosefrom10differentobjectivefunctions.
ReadthesectiononObjectiveFunctionbelowformoreexplanationofthefunctions.
Thethird line isoptional torun,butthereshouldbeanumberhere. Ifyouexpressathresholdvalue
here,thenallsimulationswithobjectivefunctionvaluebetterthanthethresholdarecollectedandthe
95PPUcalculatedbasedon thosesimulations.Here, theSUFI2becomessimilar toGLUE.Thepfactor
andthe
rfactor
for
agiven
threshold
may
be
different
from
the
solution
where
threshold
is
not
considered. Pleasenote that the threshold valuemust correspond to the typeofobjective function
beingused.
Baseflowseparation
Two options are provided to considerbaseflow separation: static and dynamic. In the static case, a
constantthresholdvalue forbaseflow isused.Thisvalues,dividesthedischargesignal intotwoparts.
Valuessmallerthanthethresholdandvalueslargerthanthethresholdaretreatedastwovariablesand
carrytwodifferentweights.This istoensurethat, forexample,base flowhasthesamevaluesasthe
peakflows.
Without
this
division,
ifyou
choose
option
2for
objective
function,
i.e.,
mean
square
error
(see objective function section below), then the small flows will not have much effect on the
optimization.Hence, peak flowwill dominate the processes.With the static threshold option, small
flows can be given a larger weight in the objective function so that they have almost the same
contribution to theobjective function as thepeak flows. Thebase flow separation ismost effective
whenoption2ischosenforobjectivefunction.Separatingthebaseflowdoesnotbecomeverycriticalif
R2orbR2isusedforobjectivefunction.
Tonotusethisoption,simplysetconstant flowseparationthresholdtoanegativevalue (say 1 fora
variablethatisalwayspositive)andtheweightsforsmallerandlargerflowsto1.
Threshold=35
-
7/18/2019 Usermanual Swat Cup
33/100
33
In the dynamic case, a flow separation program should be used to calculate the base flow. Both
observedflowandbaseflowmustthenappearintheobserved.txtfileastwoseparatecolumns,column
3andcolumn4,respectively,asshownintheobserved+.txtexamplefilein.\SUFI2.INdirectory.
Percentageof
measured
error
Thisvaluereferstothemeasurementerror.Adefaultvalueof10%isspecified,buttheuserscanchange
thisbasedontheirknowledge.Thisvalueisreasonableforflow,butshouldbehigherforothervariables
suchassedimentandnitrate,etc.
9.No_Observations
TheNo_Observation section isdesigned for the extraction and visualization of uncertainties for the
variables for which we have no observation, but would like to see how they are simulated such as
variousnutrientloads,orsoilmoisture,ET,etc.The.txtfilesareinactive.
The.deffileshavemoreorlessthesameformatastheExtractionsection.
Extract_rch_No_Obs.def Extract_hru_No_Obs.def Extract_sub_No_Obs.def
This files isalso selfexplanatory.Thenumberof variables to get, columnnumbers (sequential),and
representativevariablenamesarespecified(R isusedheretoindicatethesearefromoutput.rchSWAT
-
7/18/2019 Usermanual Swat Cup
34/100
34
file) in rows 35. These names are used to build files where simulated values are collected for all
simulations.Thentotalnumberofsubbasinsintheprojectisspecified.
Foreachvariable,weidentifythenumberofsubbasinstoget,andthesubbasinnumber(s).Ifwewant
to getall subbasin values, forexample forplottingmaps, then simply indicateALL.This followedby
beginningandendyearofsimulation.Again,beginningyearofsimulationshouldnot includewarmup
period.
95ppu_No_Obs.def
Finally,forNO_Observationoptionweneedtoeditthe95ppu_No_Obs.deffile.Thisisafileusedforthe
calculationofthe95ppufortheextractedvariableswithnoobservation.
95ppu_No_Obs.def
Thisfileagain isquiteselfexplanatory.Thenumberofvariablesforwhich95PPU istobecalculated is
giveninthesecondrow.Variablesnamesarethenprovided.Thesenamesshouldbeexactlythesame
astheonesgiveninthe.deffile(s).Finally,thenumberofsimulationtimestepsaregiven.For12years
ofmonthlysimulationthiswouldbe144.
-
7/18/2019 Usermanual Swat Cup
35/100
35
10.Executables
ThesectiononExecutableFilesplaystheroleofengineinSWATCUP.Thefourbatchfilesindicatewhat
shouldorshouldnotberun.
SUFI2_pre.bat
This batch file runs the preprocessing procedures. It include running the Latin hypercube sampling
program.Thisbatchfileusuallydoesnotneedtobeedited.
NotethatmanyfilesattheendhaveFormViewandTextView.IntheTextViewyouhavethetextfile,
whichappears inyouSWAZCUPprojectdirectory.Youcaneasilyeditthistextfileasneededwiththe
sameformatasshown.
-
7/18/2019 Usermanual Swat Cup
36/100
36
SUFI2_run.bat
ThisprogramexecutesSUFI2_execute.exe program,which runs theSWAT_Edit.exe,extractionbatch
files,aswellasSWAT.exe.
SUFI2_post.bat
runs thepostprocessingbatch file,which runs theprograms forobjective functioncalculation,new
parametercalculation,95ppucalculation,95ppuforbehavioralsimulations,and95ppuforthevariables
withnoobservations(optional).IntheTextFormonecanuncheckaprogramifitisnotneededtorun.
-
7/18/2019 Usermanual Swat Cup
37/100
37
SUFI2_Extract.bat
Thisbatchfilecontainsthenamesofalltheextractprogramswithorwithoutobservations.Currently8
programsaresupported.Thisfilemustbeeditedandtheprogramsthatarenotdesiredtorunshouldbe
remarked oruncheckedasshownbelow:
11.BeforeCalibration
Atthispointtheinputfilesarecompleteandtheprojectisreadytobecalibrated.Butbeforestartingan
iteration,youneedtomakesurethatthemodelyouhavebuiltinfeasibleinitially.So,youshouldmake
afirstrunwiththeinitialmodelstructureandinitialmodelparameters.
TochecktheinitialmodelwithSWATCUPdothefollowing:
1InPar_inf,putthenumberofsimulationsandthenumberofparametersto1
2InSUFI2_swEditputthebeginningandtheendingsimulationalsoto1
3Setupadummyparametersuchas
r__SFTMP.bsn 0 0 (thisdoesnotchangeanything)
4Thenexecuteinorder:Pre,Run,andPostprocessing.
Nowlookatthe95PPUresultofyourdefaultorinitialmodelrun.Ifsimulationsandobservationsaretoodifferent,thenyouneedtotakeacloserlookatyourswatmodel,includingrainfall,etc.Else,lookatthe
calibrationprotocolin(http://www.sciencedirect.com/science/article/pii/S0022169415001985)to
adjusttheparameterinawayastoachievethebestsimulationresultateachobservedoutlet.
Forthisinitialsimulation, youshouldalsolookattheoutput.stdfiletomakesuretheoverallwatershed
flowcomponentsarecorrectornot.
-
7/18/2019 Usermanual Swat Cup
38/100
38
12.Calibration
Next,aftereditingallthe inputfiles,performSaveAllandCloseAlltasks.Theruntheprograms in
theCalibrationwindowintheorderthattheyappear.Inthissectionthreestepsareperformed:
i) Sufi2_pre.bat ThiscommandrunstheSufi2_pre.batfile.Thisfilemustberunbeforethestart
ofeverynewiteration.
ii) SUFI2_run.bat Thiscommandexecutestherunbatchfile.
iii) SUFI2_post.bat
Afterall
simulations
are
finished,
this
command
executes
the
post
processing
batchfiledescribedabove.
-
7/18/2019 Usermanual Swat Cup
39/100
39
13.CalibrationOutputs
95ppuplot
Thiscommandshowsthe95ppuofallvariables.Alsoshownareobservationsandbestsimulationofthe
currentiteration.PleaseNotethatthebestsimulationisonlyshownforhistoricreason.Thesolutionto
thecalibrationatthisstageisthe95PPUgraphandtheparameterrangesthatwereusedtogenerateit.
Notethefeatureswitharrowwhereyoucanchangethevariablesaswellaszoomingthehydrograph.
-
7/18/2019 Usermanual Swat Cup
40/100
40
Also,pleasenotetheoptionsgivenbyChartLayoutandPrintPreview
95ppuNo_Observedplot
Thiscommandshowsthe95ppuofallvariableswithnoobservations.Hereyouonlyseetheuncertainty
insimulationofSoilMoisture,avariableforwhichwehavenoobservation.
DottyPlots
Thiscommandshowsthedottyplotsofallparameters.Theseareplotsofparametervaluesorrelative
changesversusobjectivefunction.Themainpurposeofthesegraphsaretoshowthedistributionofthe
samplingpointsaswellastogiveanideaofparametersensitivity.Inthefollowingfigureyouseeanice
trend for CN2 as it increases. Objective function is NashSutcliffe (NS). Clearly CN2 is a sensitive
parameteranditsbestfittingvaluesarelessthan0.1inrelativechange(r__).ButALPHA_BFdoesnot
appeartobesensitiveasthevalueofobjectivefunctiondoesntreallychange.GW_DELAYalso isnot
verysensitive,but itsvalueshouldprobablynotbeabove300,GWQMNalsonotverysensitive,butit
shouldprobablybesomewhereabove0.6.Moreaboutsensitivitylater.
-
7/18/2019 Usermanual Swat Cup
41/100
41
Best_Par.txt
This fileshowsthebestparametervaluesaswellas theirranges.Theseare theparameters,which
gavethebestobjectivefunctionvalueinthecurrent iteration.Again,I liketoemphasizethatthebest
parameterreallydoesnotmeanverymuchasthenextobjectivefunctionvaluemaynotbestatistically
nottoodifferentfromthebestone.Theparameterrangesarethesolutionforthisiteration.
-
7/18/2019 Usermanual Swat Cup
42/100
42
Best_Sim.txt
This file shows the best simulated values for all the variables used in the objective function. Both
observedandsimulatedvaluesaregivensothattheycouldeasilybeplottedwithothersoftwaresas
desired.
Goal.txt
Thisfileshowsthevalueofallparametersetsforthesimulationsperformedaswellasthevalueofthegoalfunctioninthelastcolumn.Thisfileisusedlatetocalculatethesocalledglobalsensitivity.
New_Pars.txt
This file shows the suggested valuesof thenewparameters tobeused in thenext iteration.These
values can be copied and pasted in the Par_inf.txt file for the next iteration, or alternatively, the
Import New Parameters could be used to copy new parameters into par_inf.txt file. The new
parametersshouldbecheckedforpossibleunreasonablevalues(e.g.,negativehydraulicconductivity,
-
7/18/2019 Usermanual Swat Cup
43/100
43
etc.). These suggested parameter ranges should bemanually corrected and if desired directed to a
certainrangebytheuserincaseofavailableinformationorknowledgeofthesystem.
Summary_Stat
Thisfilehasthestatisticsofcomparingobserveddatawiththesimulationbandthroughpfactorandr
factorandthebestsimulationofthecurrentiterationbyusingR2,NS,bR2,MSE,SSQR,PBIAS,KGE,RSR,
andVOL_FR.Themeanandstandarddeviationoftheobservedandsimulatedvariablesarealsogiven
attheend.Fordefinitionofthesefunctionsseethesectiononobjectivefunctions.Alsoshown isthe
goalfunctiontype,bestsimulationnumberofthecurrentiteration,andthebestvalueoftheobjective
functionforthecurrentrunonthetop.
Ifbehavioral
solutions
exist,
then
the
p
factor
and
rfactor
for
these
solutions
are
also
calculated.
As
showninthefollowingTabletheeffectofusingbehavioralsolutionsistoobtainsmallerpfactorandr
factor,orasmallerpredictionuncertainty.
-
7/18/2019 Usermanual Swat Cup
44/100
44
14.Sensitivityanalysis
Thismoduleoftheprogramperformssensitivityanalysis.Twotypesofsensitivityanalysisareallowed.
GlobalSensitivityandOneatatimesensitivityanalysis.
Globalsensitivityanalysiscanbeperformedafteraniteration.Oneatatimesensitivityisperformedfor
oneparameteratatimeonly.Theprocedureisexplainedinthenextsection.
15.Maps
TheMapsmoduleenablesvisualizationoftheoutlets.TheBingmap isusedtoprojectthe locationof
outlets,rivers,climatestations,andsubbasinsontheactualmapoftheworld.
-
7/18/2019 Usermanual Swat Cup
45/100
45
Whenyou invoke theOutletMap, theBingmap isactivatedand theprogramasks for theArcSWAT
projectShapesfolder.
Upon locatingtheShapefilefolder intheArcSWATproject, ...\Watershed\Shapes,severaloptionsare
providedforvisualizationoftheoutletlocation:
-
7/18/2019 Usermanual Swat Cup
46/100
46
Thesubbasinboundaries,andthelocationofraingauges.Thismodule isextremelyuseful inanalyzing
weather theoutlets are in their correct locationornot,whether the rivers areproperlydigitizedby
SWATornot,iftheoutletisundertheinfluenceofsnowandglacier,intensiveagriculture,etc.
SomeexamplesfromtheEuropeanprojectshow:
(from http://www.sciencedirect.com/science/article/pii/S0022169415001985)
a) Wrong positioning of an outlet on Viar river instead of on the main Rio Guadalquivir in Spain.
The red-green symbol indicates location of the outlet.
-
7/18/2019 Usermanual Swat Cup
47/100
47
b) The position of an outlet downstream of a dam on Inn River near Munich, Germany. SWAT
cannot calibrate the flow in this outlet unless the reservoir is modeled.
c) a complex river geometry on Pechora River near Golubovo in Russia. SWAT cannot beexpected to simulate the flow in this outlet with high accuracy.
-
7/18/2019 Usermanual Swat Cup
48/100
48
d) The flow in the outlet below is governed by glacier melt near Martigny in Switzerland. These
features could explain some of the discrepancies between simulation and observed results in
SWAT calibration.
16.Utilityprograms(C:\SWAT\SWATCUP5.1.6.2\ExternalData\utilityprograms)
Thismodule
currently
has
two
program
in
it:
Make_ELEV_BAND,
not
shown
in
the
interface,
and
Upstreamsubbasins,whichisshownintheinterface.
Make_ELEV_BAND,thisprogramcancalculate theelevationband foraSWATprojectanduseSWAT
CUPtoputtheinformationinSWAT*.subfiles.Thereisanexplanatoryfilecalledelev_band.doc,which
explainshowtodothis.
-
7/18/2019 Usermanual Swat Cup
49/100
49
Upstreamsubbasins,thisprogramcandeterminetheupstreamsubbasins.This isauseful information
for parameterization. A READ_ME.txt file explains how to use this program. The file
upstream_sorted.out,which is not shown in the interface shows, in a sortedmanner, all the above
subbasinsofanyobserved subbasin.Theupstream.outcontainsavisualizationoptionthatshowswhich
outletsareconnectedtoeachother.
Theabovetextandvisualaidshowthatsubbasin(oroutlet)number1hasnoupstreamsubbasin,while
outlets3,7,18(whichareheremeasuredoutlets)haveupstreamsubbasins.Ifyourightclickonthenode
connectingoutlets3and18above,thenyouwillfindallthenonintersectingsubbasinsbetween3and
18.Thatmeansallthesubbasinsbetween3and18.Usingthisinformation,onecancalibrateforoutlet
18byparameterizingsubbasin19and20first,whichcontributetooutlet18.Thenkeeptherangesfixed
fortheparametersofsubbasins18and19,andparameterizesubbasins inbetween18and3(seethe
picturebelow,thearrowshowsalistoftheseparametersinthetextform).Usingthisprocedure,outlet
3canbecalibrated.
-
7/18/2019 Usermanual Swat Cup
50/100
50
17.IterationsHistory
Alliterations
can
be
saved
in
the
iteration
history.
This
allows
studying
the
progress
to
convergence.
Afteracomplete iteration, review the suggestednewparameters in thenew_pars.txt,copy them to
par_inf.txtandeditthemasexplainedbefore,andmakeanewiteration.Therearenohardrulesasto
whenacalibrationprocesscanbeterminated.Buttheprocesscanstopwhensatisfactorystatisticsare
achievedandtherearenofurtherimprovementsintheobjectivefunctionvalue.
-
7/18/2019 Usermanual Swat Cup
51/100
51
ParameterizationinSWATCUP
Thefollowingschemecanbeusedtoparameterize,orregionalizeparametersofawatershed.InSWAT,
theHRU is the smallestunitof spatialdisaggregation.Asawatershed isdivided intoHRUsbasedon
elevation,soil,andlanduse,adistributedspatialparametersuchashydraulicconductivity,bulkdensity,
orCN2canpotentiallybedefinedforeachHRU.Ananalystis,hence,confrontedwiththedifficulttask
of collecting or estimating a large number of input parameters, which are usually not available. An
alternativeapproach fortheestimationofdistributedparameters isto lumpthembasedonsoiltype,
landuse type, location, slope,or a combination of these. They can then be calibratedusing a single
globalmodificationtermthatcanscaletheinitialestimatesbyamultiplicative,oranadditiveterm.This
leadstothefollowingproposedparameteridentifiersexplainedbelow.
x__.__________
Where
x__ =Identifiercodetoindicatethetypeofchangetobeappliedtotheparameter:
v__meanstheexistingparametervalueistobereplacedbyagivenvalue,
a__meansagivenvalueisaddedtotheexistingparametervalue,and
r__meansanexistingparametervalueismultipliedby(1+agivenvalue).
Note:thattherearealwaystwounderscores__aftertheidentifier
= SWAT parameter name as it appears in the SWAT I/O manual or in the
Absolute_SWAT_Values.txtfile.
= SWAT file extension code for the file containing the parameter(e.g.,.sol,.hru,.rte,etc.)
=(optional)soilhydrologicalgroup(A,B,CorD)
=(optional)soiltextureasitappearsintheheaderlineofSWATinputfiles
=(optional)nameofthelandusecategoryasitappearsintheheaderlineofSWAT
inputfiles
= (optional) subbasinnumber(s)as itappears in theheader lineof SWAT input
files
= (optional)slopeasitappearsintheheaderlineofSWATinputfiles
Anycombinationoftheabovefactorscanbeusedtodescribeaparameteridentifier.Iftheparameters
are used globally, the identifiers , , , , and can be
omitted.
Note: thetwounderscoresaftereverypreviousspecificationsmustbeused,i.e.,tospecifyonlythe
subbasinwemustwriteeightunderscoresafter.crp v__USLE_C.crp________2
-
7/18/2019 Usermanual Swat Cup
52/100
52
The presented encoding scheme allows the user to make distributed parameters dependent on
importantinfluentialfactorssuchas:hydrologicalgroup,soiltexture,landuse,elevation,andslope.The
parameters canbe assigned and calibrated regionally,orbe changed globally. This gives the analyst
largerfreedominselectingthecomplexityofadistributedparameterscheme.Byusingthisflexibility,a
calibrationprocesscanbestartedwithasmallnumberofparametersthatonlymodifyagivenspatial
pattern, with more complexity and regional resolution added in a stepwise learning process. Some
examplesoftheparameterizationschemeisasfollows:
SpecificationofSoilParameters
Parameteridentifiers Description
r__SOL_K(1).sol KofLayer1ofallHRUs
r__SOL_K(1,2,46).sol KofLayer1,2,4,5,and6ofallHRUs
r__SOL_K().sol KofAlllayersandallHRUs
r__SOL_K(1).sol__D Koflayer1ofHRUswithhydrologicgroupD
r__SOL_K(1).sol____FSL Koflayer1ofHRUswithsoiltextureFSL
r__SOL_K(1).sol____FSL__PAST Koflayer1ofHRUswithsoiltextureFSLand
landusePAST
r__SOL_K(1).sol____FSL__PAST__13 Koflayer1ofsubbasin1,2,and3withHRUs
containingsoiltextureFSLandlandusePAST
SpecificationofManagementParameters
Parameteridentifiers Description
v__HEAT_UNITS{rotationno,operationno}.mgt Managementparametersthatare
subjecttooperation/rotationmust
havebothspecified
v__CNOP{[],1}.mgt Thischangesanoperation's
parametersinallrotations
v__CNOP{2,1,plant_id=33}.mgt ChangesCNOPforrotation2,
operation1,andplant33only
v__CNOP{[],1,plant_id=33}.mgt Similartoabove,butforallrotations
v__CNOP{[],1,plant_id=33}.000010001.mgt Withthiscommandyoucanonly
modifyonefile
-
7/18/2019 Usermanual Swat Cup
53/100
53
r__FRT_KG{9,1}.mgt Inthesethreeexamples,rotation9,
operation1,andtherestarefilters
where,meansANDr__FRT_KG{9,1,PLANT_ID=12}.mgt
r__FRT_KG{9,1,PLANT_ID=12,HUSC=0.15}.mgt
SpecificationofCropParameters
Parameteridentifiers Description
v__T_OPT{30}.CROP.DAT ParameterT_OPTforcropnumber30inthe
crop.datfile
v__PLTNFR(1){3}.CROP.DAT Nitrogenuptakeparameter#1forcrop
number3incrop.datfile
SpecificationofPesticideParameters
Parameteridentifiers Description
v__WSOL{1}.pest.dat ThischangesparameterWSOLforpesticide
number1inpest.datfile
SpecificationofPrecipitationandTemperatureParameters
Parameteridentifiers Description
v__precipitation(1){1977300}.pcp1.pcp (1)meanscolumnnumber1inthepcpfile
{1977300}specifiesyearandday
v__precipitation(13){1977300}.pcp1.pcp (13)meanscolumn1,2,and3
{1977300}specifiesyearandday
v__precipitation(){1977300,1977301}.pcp ()meansallcolumns(allstations)
{1977300,1977301}means1977days300and
301
v__precipitation(){1977001
1977361,19780011978365,1979003}.pcp
()meansallcolumns
fromday1today361of1977,andfromday1
today365of1978,andday3of1979
v__MAXTEMP(1){1977001}.tmp1.tmp (1)meanscolumn1inthetmp1.tmpfile
-
7/18/2019 Usermanual Swat Cup
54/100
54
{1977001}specifiesyearandday
v__MAXTEMP(2){1977002
1977007}.tmp1.tmp
(2)meanscolumn2inthetmp1.tmpfile
fromday2today7in1977
v__MINTEMP(){19770021977007}.tmp1.tmp ()meansallcolumnsintmp1.tmpfile
SpecificationofslopeParameters
Parameteridentifiers Description
v__SOL_K(1).sol______________010 Koflayer1forHRUswithslope010
Pleasenotethatbrackets()areusedtodistinguishlayersinparametersthathavemanylayers.
Also,pleasenotethatprecipitationandtemperaturearealsoallowedtobeusedasfittingparameters.
Thisoptionmustbeusedwithcautionbecausefittingrainfallcanmakecalibrationofparameters
irrelevantasrainfallisthesinglemostimportantdrivingvariablecontrollingthebehaviorofflow.
-
7/18/2019 Usermanual Swat Cup
55/100
55
ObjectiveFunctionDefinition
Intheobserved.txtfile,10differentobjectivefunctionsarecurrentlyallowed.Theseinclude:
1=mult Minimize:
....***
222
N
i
ism
S
i
ism
Q
i
ism
n
NN
n
SS
n
QQ
g
This isamultiplicativeformofthesquareerrorwhereQ,S,andNstandforvariables(e.g.,discharge,
sediment,andnitrate),nisthenumberofobservations,andmandsstandformeasuredandsimulated.
Sometimesthedenominatorisdividedby1000tokeepgsmall.
2=sum Minimize: .....1 2 3
1 1 1
2
3
2
2
2
1
n
i
n
i
n
iismismism
NNwSSwQQwg
This isthesummationformofthesquareerrorwhereQ,S,andNstandforvariables(e.g.,discharge,
sediment,andnitrate),mandsstandformeasuredandsimulated,nisthenumberofdatapoints,and
weightswscouldbecalculatedas:
i) 21
jj
jn
w
where2
j isthevarianceofthe
j
thmeasuredvariable(seeAbbaspour,etal.,2001),or
ii)m
m
m
m
N
Qw
S
Qww 321 ,,1
wherebars indicateaverages (seeAbbaspouretal.,1999).Note thatchoiceofweighscanaffect the
outcomeofanoptimizationexercise(seeAbbaspour,etal.,1997).
3=R2 Maximize:
i
sis
i
mim
sis
i
mim
QQQQ
QQQQ
R2
,
2
,
2
,,
2
CoefficientofdeterminationR2whereQisavariable(e.g.,discharge),andmandsstandformeasured
and simulated, i is the ithmeasuredor simulateddata. If therearemore thanonevariable, then the
objectivefunctionisdefinedas:
-
7/18/2019 Usermanual Swat Cup
56/100
56
j
jjRwg2
Wherewjistheweightofjthvariable.
4=Chi2 Minimize:
2
2
2
m
i
ism QQ
whereQisavariable(e.g.,discharge),andmandsstandformeasuredandsimulated,respectively,and2
m isthevarianceofmeasureddata.Iftherearemorethanonevariable,thentheobjectivefunctionis
calculateas:
j
jjwg2
Wherewjistheweightofjthvariable.
5=NS Maximize:
imim
iism
QQ
QQ
NS2
,
2
1
NashSutcliffe (1970), where Q is a variable (e.g., discharge), and m and s stand for measured and
simulated, respectively,and thebar stands foraverage. If there ismore thanone variable, then the
objectivefunctionisdefinedas:
j
jjNSwg
Wherewjistheweightofjthvariable.
6=bR2 Maximize:
1
1
21
2
bifRb
bifRb
WhereCoefficientofdeterminationR2 ismultipliedby the coefficientof the regression linebetween
measuredandsimulateddata,b.Thisfunctionallowsaccountingforthediscrepancy inthemagnitude
oftwosignals(depictedbyb)aswellastheirdynamics(depictedbyR2).Ifmorethanonevariable,the
objectivefunctionisexpressedas(Krauseetal.,2005):
-
7/18/2019 Usermanual Swat Cup
57/100
57
incaseofmultiplevariables,gisdefinedas:
j
jjwg
Wherewjistheweightofjthvariable.
7=SSQR Minimize:
, ,
whereQisavariable(e.g.,discharge),andmandsstandformeasuredandsimulated,respectively.Here
irepresentstherank.TheSSQRmethodaimsatfittingthefrequencydistributionsoftheobservedand
the simulated series. After independent ranking of the measured and the simulated values (van
GriensvenandBauwens,2003):
incaseofmultiplevariables,gisdefinedas:
j jjSSQRwg
Wherewjistheweightofjthvariable.
8.PBIAS Minimize:
n
i
im
n
iism
Q
QQ
PBIAS
1
,
1*100
whereQ isavariable (e.g.,discharge),andmand s stand formeasuredand simulated, respectively.
Percentbiasmeasures the average tendencyof the simulateddata tobe largeror smaller than the
observations. The optimum value is zero, where low magnitude values indicate better simulations.
Positive values indicate model underestimation and negative values indicate model over estimation
(Guptaetal.,1999).
incaseofmultiplevariables,gisdefinedas:
j
jjPBIASwg
Wherewjistheweightofjthvariable.
-
7/18/2019 Usermanual Swat Cup
58/100
58
9.KGE Maximize: 1 1 1 1
Where
,and
,andristhelinearregressioncoefficientbetweensimulatedandmeasured
variable, s and m are means od simulated and measured data, and s and m are the standard
deviationofsimulatedandmeasureddata.KlingGuptaefficiency(Guptaetal.,2009).
incaseofmultiplevariables,gisdefinedas:
j
jjKGEwg
Wherewjistheweightofjthvariable.
10.RSR Minimize:
n
i
mim
n
iism
QQ
QQ
RSR
1
2
,
1
2
whereQisavariable(e.g.,discharge),andmandsstandformeasuredandsimulated,respectively.RSR
isthestandardizestheRMSEusingtheobservationstandarddeviation.RSRisquitesimilartoChiin4.It
variesfrom0tolargepositivevalues.ThelowertheRSRthebetterthemodelfit(Moriasietal.,2007).
incaseofmultiplevariables,gisdefinedas:
j
jjRSRwg
Wherewjistheweightofjthvariable.
11.MNS Maximize:
i
p
imim
i
p
ism
QQ
QQ
NS
,
1
Modified NaschSutcliffe efficiency factor. Ifp=2, then this is simply NS as in 5 above. Ifp=1, the
overestimationofapeakisreducedsignificantly.Themodifiedformisreportedtobemoresensitivetosignificantover orunderpredictionthanthesquareform.Increasingthevalueofpbeyond2resultsin
an increase inthesensitivitytohighflowsandcouldbeusedwhenonlythehighflowsareof interest,
e.g.forfloodprediction(Krauseetal.,2005)
NOTE:Afteraniteration,trychangingthetypeofobjectivefunctionandrunSUFI2Post.bataloneto
see the effect of different objective functions, without having to run SWAT again. This is quite
informativeasitshowshowthechoiceofobjectivefunctionaffectsthecalibrationsolution.
-
7/18/2019 Usermanual Swat Cup
59/100
59
SensitivityAnalysis
1 GlobalSensitivityanalysis
Parametersensitivitiesaredeterminedby calculating the followingmultiple regressionsystem,which
regresses the Latin hypercube generated parameters against the objective function values (in file
goal.txt):
m
i
iibg1
A ttest is thenused to identify the relative significanceofeachparameterbi.The sensitivitiesgiven
aboveareestimatesof theaveragechanges in theobjective function resulting from changes ineach
parameter, while all other parameters are changing. This gives relative sensitivities based on linear
approximations and, hence, only provides partial information about the sensitivity of the objective
functiontomodelparameters.Inthisanalysis,thelarger,inabsolutevalue,thevalueoftstat,andthe
smallerthepvalue,themoresensitivetheparameter. Intheexamplebelow,CN2,ESCO, followedby
GE_DELAY,CH_N2,andALPHA_BFarethefivemostsensitiveparameters.
-
7/18/2019 Usermanual Swat Cup
60/100
60
tstatandpvalue
Amultipleregressionanalysisisusedtogetthestatisticsofparametersensitivity.Thetstatis
thecoefficientofaparameterdividedbyitsstandarderror.Itisameasureoftheprecisionwith
whichtheregressioncoefficientismeasured.Ifacoefficientislargecomparedtoitsstandard
error,thenitisprobablydifferentfrom0andtheparameterissensitive.Whatislarge?
YoucouldcomparethetstatofaparameterwiththevaluesintheStudent'stdistributiontable
todeterminethepvalue,whichisthenumberthatyoureallyneedtobelookingat.The
Student'stdistribution(youfindattheendofmoststatisticsbook)describeshowthemeanof
asamplewithacertainnumberofobservationsisexpectedtobehave.Thepvalueforeach
termteststhenullhypothesisthatthecoefficientisequaltozero(noeffect).Alowpvalue(
-
7/18/2019 Usermanual Swat Cup
61/100
61
bymuch.Therefore,thevaluesofthefixedparametersmakeadifferencetothesensitivityofa
changingparameter.
Toperformtheoneatatimesensitivityanalysis:
1 DoasshowninthefollowingFigure.SetthenumberofparametersinthePar_inf.txtfileto1,and
performaminimumof3simulations.
2 ThensetthevaluesoffileSUFI2_swEdit.defasfollows:
3 FinallyperformtheiterationbyrunningunderCalibration,SUFI2_pre.batandthenSUFI2_run.bat.
4 Now,thethreesimulationcanbevisualizedforeachvariablebyexecutingoneat
atimecommand
underSensitivityanalysisasshownbelow:
-
7/18/2019 Usermanual Swat Cup
62/100
62
ThedashedlineistheobservationandthedischargesignalforFLOW_OUT_1isplottedforthreevalues
ofCN2withinthespecifiedrange.Clearly,CN2issensitiveandneedstohavelargervalues.
NOTE:TheusersmustbeawarethattheparametersintheSWATfilesinthemainSWATCUPproject
directoryarealwayschanging.Onceyouperformasensitivityiteration,thentheparametervaluesin
thosefilesarethevaluesofthelastrun(lastparameterset)ofthelastiteration.Toperformtheoneat
atimesensitivityanalysis,oneshouldsetthevaluesoftheparametersthatarekeptconstanttosome
reasonablevalues.Thesereasonablevaluescould,forexample,bethebestsimulation(simulationwith
thebestobjectivefunctionvalue)ofthelastiteration,ortheinitialmodelparametersthatresideintheBackupdirectory.
-
7/18/2019 Usermanual Swat Cup
63/100
63
ParallelProcessing
Parallel processing is a licensed product. Its function is to speed up the calibration process by
parallelizingtherunsinSUFI2.Thespeedoftheparallelprocessingdependsonthecharacteristicsofthe
computer.Newlaptopsnowhaveatleast4CPUs.Theparallelprocessingmodulecanutilizeall4CPUs
sothata1000runiterationcanbedividedinto4simultaneousrunsof250eachperCPU.Thespeedup
willnotbe4timesbecauseofprogramandWindowsoverheads;but therunwithparallelprocessing
willbesubstantiallyfasterthanasingle1000runsubmission.
Nowadaysitispossibletobuildquiteinexpensivelyacomputerwith48to64CPUsandmorethan96
GBofRAM.MostSWATmodelsofanydetailcouldberunonsuchmachineswithouttheneedforcloud
orgridcomputing(seeRouholahnejad,etal.,2012formoredetail).
Currently,20 simulationsareallowed tobemadewithout theneed fora license.Toobtaina license
follow the direction under license and activation and send the hardware ID, for the time being, to
([email protected]).Afterobtainingalicensefilebyemail,followtheactivationprocess.
Torunparallelprocessing,simplyclicktheParallelProcessingbuttononthecommandbar.Anewsetof
command icons appear. Press parallel Processing to seehowmanyjobs canbe submitted to your
computer.UnderProcesscountyoucanchoosehowmanyparalleljobsyouwanttosubmitIfthesize
oftheprojectislargeandthereisnotenoughmemory,thensmallernumberofparallelprocessesthan
thenumberofCPUsmaybepossible.TheCalibrationiconworksasbefore.
-
7/18/2019 Usermanual Swat Cup
64/100
64
ValidationinSUFI2
Forvalidation,youshouldusethecalibratedparameterrangeswithoutanyfurtherchangesandrun
aniteration(withthesamenumberofsimulationsasyouusedforcalibration).
Toperformvalidation inSUFI2,editthefilesobserved_rch.txt,observed_hru.txt,obsrved_sub.txt,and
observed.txtasnecessary forthevalidationperiod.Also,theextraction filesand the file.ciotoreflect
thevalidationperiod.Thensimplyusethecalibratedparameterrangestomakeonecompleteiteration
(usingthecalibrationbutton).The95PPUandtheSummary_statfileshouldreflectthevalidationresults.
Thevalidationkeybringsupthefollowingmenu,whichexplainsthevalidationsteps.
-
7/18/2019 Usermanual Swat Cup
65/100
65
Thesequenceofprogramexecution
Thesequenceofprogramexecutionandinput/outputsareshowninbelow.Inthefollowing,eachinput
andoutputfileisdescribedindetail.
INPUTFILES OUTPUTFILES
SUFI2_Extract_*_No_obs.exe
- model.in
- Absolute_SWAT_Values.txt
- BACKUP file
-New SWAT parameter files
-Swat EditLo .txt
SUFI2_make_input.exe- SUFI2.IN\\trk.txt- SUFI2.IN\\par_inf.txt
- SUFI2.IN\\par_val.txt
-Echo\echo_make_par.txt
-model.in
SWAT_Edit.exe
SUFI2_LH_sample.exe- SUFI2.IN\\trk.txt
- SUFI2.IN\\par_inf.txt
-ECHO\\echo_LH_sample.txt
-SUFI2.IN\\par_val.txt
-SUFI2.IN\\str.txt
SWAT.exe-SWAT output files
SUFI2_Extract_*.exe
- SUFI2_Extract_*.def- output.*
- SUFI2.IN\var_file_*.txt
- SUFI2.IN\trk.txt
- SUFI2.IN\observed *.txt
-Echo\echo_extract_*.txt
-SUFI2.OUT\files listed in
var_file_*.txt
SUFI2_goal_fn.exe
SUFI2_95ppu.exe
SUFI2_new_pars.exe
-Echo\echo_goal_fn.txt-SUFI2.OUT\\goal.txt
-SUFI2.OUT\best_sim.txt-SUFI2.OUT\\best_par.txt
-SUFI2.OUT\\beh_pars.txt
-SUFI2.OUT\\no_beh_sims.txt
-SUFI2.OUT\best_sim_nr.txt
- SUFI2.IN\par_inf.txt
- SUFI2.IN\observed.txt
- SUFI2.IN\par_val.txt- SUFI2.IN\\var_file_name.txt
-Echo\echo_95ppu.txt
-SUFI2.OUT\95ppu.txt-SUFI2.OUT\\95ppu_g.txt
-SUFI2.OUT\\summary_stat.txt
- SUFI2.IN\par_inf.txt
- Files liste in var_file_name.txt
- SUFI2.IN\observed.txt
- SUFI2.IN\\best_sim.txt
Echo\new_pars_all.txt
SUFI2.OUT\new_pars.txt
SUFI2.IN\observed.txt
SUFI2.OUT\\goal.txt
SUFI2.OUT\\best_par.txt
SUFI2_Post.bat
SUFI2_Run.bat
- extract_*_No_Obs.def
- output.*
- SUFI2.IN\var_file_*_No_obs.txt
- SUFI2.IN\trk.txt
SUFI2.OUT\files listed in
var_file_*_No_obs.txt
95ppu_No_Obs.exe- 95ppu_No_Obs.def- SUFI2.IN\par_inf.txt
SUFI2.OUT\95ppu_No_Obs.txt
SUFI2.OUT\95ppu_g_No_Obs.txt
NO_Observation
SUFI2_95ppu_beh.exe
-Echo\echo_95ppu_beh.txt-SUFI2.OUT\\summary_stat.txt
- SUFI2.IN\par_inf.txt
-SUFI2.OUT\\no_beh_sims.txt
- Files liste in var_file_name.txt
- SUFI2.IN\observed.txt- SUFI2.IN\\best_sim.txt
-
7/18/2019 Usermanual Swat Cup
66/100
66
Howtoseetheresultsofmyinitialmodel?
BeforestartingiterationsinSWATCUP,youshouldchecksimulationofyourinitialmodelsetup.Itis
assumedthatsomethoughtandinvestigationhasgoneintodatacollectionandthebestinformationis
usedtobuildtheSWATmodel.Tochecktheinitial(default)simulationofyourmodelinSWATCUPdo
thefollowing:
1InPar_inf,putthenumberofsimulationsandthenumberofparametersto1andsetupadummy
parameterchangesuchas
r__SFTMP.bsn 0 0 (thisdoesnotchangeanything)
2InSUFI2_swEditputthebeginningandtheendingsimulationalsoto1
3Thenexecute:Pre,Run,andPostprocessing.
Nowlookatthe95PPUresultofyourdefaultorinitialmodelrun.Ifsimulationsandobservationsaretoo
different,thenyouneedtotakeacloserlookatyourswatmodel,includingrainfall,etc.
Iftheyarenottoodifferent,thenforeachoutletadjustrelevantparametersintherelevantsubbasins
(referredtoasparameterization),anddoafewiterationsbasedonthat.
Foraprotocolseetheopenaccesspaper:
http://www.sciencedirect.com/science/article/pii/S0022169415001985
HowtosettheparametersinSWATtextfilestothebestparametervaluesof
thelast
iteration?
IfyouwanttheSWATTxtInOutfilesreflectthebestparametersyouobtainedinaniterationdothe
following:
1 NotethenumberofthebestsimulationintheSummary_Stat.txtfile
2 IntheSUFI2_swEdit.txtsetthestartingandendingsimulationvaluesbothtothenumberofthebest
simulationinstep1.
3 UnderCalibration,runSUFI2_run.bat.DonotrunSUFI2Pre.bat.
Thiscommandwillreplacetheparametervaluesandsetthemtothebestvaluesofthelastiteration.
-
7/18/2019 Usermanual Swat Cup
67/100
67
HowtodoLatinHypercubeSampling
ThebatchfileSUFI2_pre.batrunstheSUFI2_LH_sample.exeprogram,whichgeneratesLatinhypercube
samples.Thesesamplesarestoredinpar_val.txtfile.
ThisprogramusesLatinhypercubesamplingtosamplefromtheparameterintervalsgiveninpar_inf.txt
file.The sampledparametersaregiven inpar_val.txt file,while the structureof the sampleddata is
writtentostr.txtjustforinformation.Ifthenumberofsimulationsis3,thenthefollowinghappens:
1)Parameters(say2)aredividedintotheindicatednumberofsimulations(say3)
2)Parametersegmentsarerandomized
3)Asampleistakenatthemiddleofeverysegment
Everyverticalcombinationisthenaparameterset.
2 31
1 2 3
2 1 3
3 2 1
2 1 3
3 2 1
-
7/18/2019 Usermanual Swat Cup
68/100
68
HowtoCalibratemorethanoneVariable
Ifyouwanttocalibrateusing,forexampledischarge,nitrate,andphosphate,youshouldfirstcalibrate
fordischarge.Thisisbecauseflowisthemaincontrollingvariable.Aftercalibratingforflow,keepflow
parameterrangesasyouobtainedfromflowcalibrationandaddsedimentparameters.Therearetwo
typesofsedimentparameters,thosethataffectonlysediment,andthosethataffectflowandsediment.
SeetheTablebelowfromAbbaspouretal.,(2007).
Initially,add theparameters thatonlyaffectsedimentand runan iteration.Youshouldget the same
dischargeresultsasbefore,sotrycalibratingonlyforthesedimentparametersthatdontaffecttheflow
-
7/18/2019 Usermanual Swat Cup
69/100
69
first.After,oneortwoiterations,ifsedimentresultsarenotsatisfactory,thenaddtheotherparameters
thataffectsedimentandflowanddoacoupleofiterationsbyallowingflowparameterstoalsochange
slightly.
ForNitraterepeatthesameprocedurewithnitrateparameters.Notethatforcalibratingphosphoryou
mustcalibrateforsedimentfirst,becausemuchofthephosphormoveswithsediment,butnitratecan
becalibratedwithoutsediment.
Itisimportanttoalsonotethatthesolutiontothecalibratedmodelisthe95PPUgeneratedby
theparameterranges.DONOTtrytoonlyusethebestparametersetforfurtheranalysis.By
doing this youare assuming that the calibratedmodelonlyhasone solution and this isnot
correct. It is never correct to assume that only one set of parameters can represent a
watershed, which was modeled by very uncertain information about soil, landuse, climate,
management, measured data used for calibration, etc. Always propagate the range of
parametersyouobtainedduringcalibrationforallpurposesofmodeluse.
-
7/18/2019 Usermanual Swat Cup
70/100
70
PSO
ParticleSwarmOptimization
-
7/18/2019 Usermanual Swat Cup
71/100
71
IntroductiontoPSO
Particleswarmoptimization(PSO)isapopulationbasedstochasticoptimizationtechniquedevelopedby
Dr.EberhartandDr.Kennedy in1995,inspiredbysocialbehaviorofbirdflockingorfishschooling.
PSOsharesmanysimilaritieswithevolutionarycomputationtechniquessuchasGeneticAlgorithms(GA).
The system is initializedwithapopulationof random solutionsand searches foroptimabyupdating
generations.However,unlikeGA,PSOhasnoevolutionoperatorssuchascrossoverandmutation. In
PSO, thepotential solutions, calledparticles, fly through theproblem spaceby following the current
optimumparticles.Thedetailedinformationwillbegiveninfollowingsections.
Compared to GA, the advantages of PSO are that PSO is easy to implement and there are few
parameterstoadjust.PSOhasbeensuccessfullyappliedinmanyareas:functionoptimization,artificial
neuralnetworktraining,fuzzysystemcontrol,andotherareaswhereGAcanbeapplied.
There are two popular swarm inspired methods in computational intelligence areas: Ant colony
optimization (ACO)andparticleswarmoptimization (PSO).ACOwas inspiredby thebehaviorsofants
and has many successful applications in discrete optimization problems.
(http://iridia.ulb.ac.be/~mdorigo/ACO/ACO.html)
Theparticleswarmconceptoriginatedasasimulationofsimplifiedsocialsystem.Theoriginalintentwas
tographicallysimulate thechoreographyofbirdofabirdblockor fishschool.However, itwas found
that particle swarm model can be used as an optimizer.
(http://www.engr.iupui.edu/~shi/Coference/psopap4.html)
Thealgorithm
Asstatedbefore,PSOsimulatesthebehaviorsofbirdflocking.Supposethefollowingscenario:agroup
of birds are randomly searching food in an area. There is only one piece of food in the area beingsearched. All the birds do not know where the food is. But they know how far the food is in each
iteration.Sowhat'sthebeststrategyto findthefood?Theeffectiveone istofollowthebirdwhich is
nearesttothefood.
PSOlearnsfromthescenarioandusesittosolvetheoptimizationproblems.InPSO,eachsinglesolution
is a "bird" in the search space. We call it "particle". All of particles have fitness values which are
evaluatedby the fitness function tobeoptimized, andhave velocitieswhichdirect the flyingof the
particles.Theparticlesflythroughtheproblemspacebyfollowingthecurrentoptimumparticles.
PSOisinitializedwithagroupofrandomparticles(solutions)andthensearchesforoptimabyupdating
generations.Inevery iteration,eachparticle isupdatedbyfollowingtwo"best"values.Thefirstoneis
thebestsolution (fitness) ithasachievedso far. (The fitnessvalue isalsostored.)Thisvalue iscalledpbest.Another"best"valuethatistrackedbytheparticleswarmoptimizeristhebestvalue,obtainedso
farbyanyparticle inthepopulation.Thisbestvalue isaglobalbestandcalledgbest.Whenaparticle
takespartofthepopulationasitstopologicalneighbors,thebestvalueisalocalbestandiscalledlbest.
After finding the two best values, the particle updates its velocity and positions with the following
equations(a)and(b).
v[]=v[]+c1*rand()*(pbest[] present[])+c2*rand()*(gbest[] present[]) (a)
-
7/18/2019 Usermanual Swat Cup
72/100
72
present[]=persent[]+v[] (b)
v[]istheparticlevelocity,persent[]isthecurrentparticle(solution).pbest[]andgbest[]aredefinedas
statedbefore.rand()isarandomnumberbetween(0,1).c1,c2arelearningfactors.usuallyc1=c2=2.
Thepseudocodeoftheprocedureisasfollows:
Foreachparticle
Initializeparticle
END
Do
Foreachparticle
Calculatefitnessvalue
Ifthefitnessvalueisbetterthanthebestfitnessvalue(pBest)inhistory
setcurrentvalueasthenewpBest
End
ChoosetheparticlewiththebestfitnessvalueofalltheparticlesasthegBest
Foreachparticle
Calculateparticlevelocityaccordingequation(a)
Updateparticlepositionaccordingequation(b)
EndWhilemaximumiterationsorminimumerrorcriteriaisnotattained
Particles' velocities on each dimension are clamped to a maximum velocity Vmax. If the sum of
accelerations would cause the velocity on that dimension to exceed Vmax, which is a parameter
specifiedbytheuser,thenthevelocityonthatdimensionislimitedtoVmax.
ComparisonsbetweenGeneticAlgorithmandPSO
Mostofevolutionarytechniqueshavethefollowingprocedure:
1.Randomgenerationofaninitialpopulation
2.Reckoningofafitnessvalueforeachsubject.Itwilldirectlydependonthedistancetotheoptimum.
3.Reproductionofthepopulationbasedonfitnessvalues.
4.Ifrequirementsaremet,thenstop.Otherwisegobackto2.Fromtheprocedure,wecanlearnthatPSOsharesmanycommonpointswithGA.Bothalgorithmsstart
withagroupofarandomlygeneratedpopulation,bothhavefitnessvaluestoevaluatethepopulation.
Bothupdatethepopulationandsearchfortheoptimumwithrandomtechniques.Bothsystemsdonot
guaranteesuccess.
However,PSOdoesnothavegeneticoperatorslikecrossoverandmutation.Particlesupdatethemselves
withtheinternalvelocity.Theyalsohavememory,whichisimportanttothealgorithm.
Compared with genetic algorithms (GAs), the information sharing mechanism in PSO is significantly
different.InGAs,chromosomesshareinformationwitheachother.Sothewholepopulationmoveslike
aonegrouptowardsanoptimalarea.InPSO,onlygBest(orlBest)givesouttheinformationtoothers.It
isaonewayinformationsharingmechanism.Theevolutiononlylooksforthebestsolution.Compared
withGA,alltheparticlestendtoconvergetothebestsolutionquicklyeveninthelocalversioninmostcases.
7.OnlineResourcesofPSO
ThedevelopmentofPSOisstillongoing.AndtherearestillmanyunknownareasinPSOresearchsuchas
themathematicalvalidationofparticleswarmtheory.
-
7/18/2019 Usermanual Swat Cup
73/100
73
Onecanfindmuchinformationfromtheinternet.Followingaresomeinformationyoucangetonline:
http://www.particleswarm.net lots of information about Particle Swarms and, particularly, Particle
SwarmOptimization.LotsofParticleSwarmLinks.
http://icdweb.cc.purdue.edu/~hux/PSO.shtml lists an updated bibliography of particle swarm
optimizationandsomeonlinepaperlinks