📄 topmodel.cpp
字号:
///////////////////////////////////////////////////////////
// //
// SAGA //
// //
// System for Automated Geoscientific Analyses //
// //
// Module Library: //
// sim_hydrology //
// //
//-------------------------------------------------------//
// //
// topmodel.cpp //
// //
// Copyright (C) 2003 by //
// Olaf Conrad //
// //
//-------------------------------------------------------//
// //
// This file is part of 'SAGA - System for Automated //
// Geoscientific Analyses'. SAGA is free software; you //
// can redistribute it and/or modify it under the terms //
// of the GNU General Public License as published by the //
// Free Software Foundation; version 2 of the License. //
// //
// SAGA is distributed in the hope that it will be //
// useful, but WITHOUT ANY WARRANTY; without even the //
// implied warranty of MERCHANTABILITY or FITNESS FOR A //
// PARTICULAR PURPOSE. See the GNU General Public //
// License for more details. //
// //
// You should have received a copy of the GNU General //
// Public License along with this program; if not, //
// write to the Free Software Foundation, Inc., //
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, //
// USA. //
// //
//-------------------------------------------------------//
// //
// e-mail: oconrad@saga-gis.org //
// //
// contact: Olaf Conrad //
// Institute of Geography //
// University of Goettingen //
// Goldschmidtstr. 5 //
// 37077 Goettingen //
// Germany //
// //
///////////////////////////////////////////////////////////
//---------------------------------------------------------
///////////////////////////////////////////////////////////
// //
// //
// //
///////////////////////////////////////////////////////////
//---------------------------------------------------------
#include "topmodel.h"
///////////////////////////////////////////////////////////
// //
// //
// //
///////////////////////////////////////////////////////////
//---------------------------------------------------------
CTOPMODEL::CTOPMODEL(void)
{
CSG_Parameter *pNode;
//-----------------------------------------------------
// Place information about your module here...
Set_Name (_TL("TOPMODEL"));
Set_Author (_TL("Copyrights (c) 2003 by Olaf Conrad"));
Set_Description (_TW(
"Simple Subcatchment Version of TOPMODEL\n\n"
"Based on the 'TOPMODEL demonstration program v95.02' by Keith Beven "
"(Centre for Research on Environmental Systems and Statistics, "
"Institute of Environmental and Biological Sciences, "
"Lancaster University, Lancaster LA1 4YQ, UK) "
"and the C translation of the Fortran source codes implementated in GRASS.\n\n"
"This program allows single or multiple subcatchment calculations "
"but with single average rainfall and potential evapotranspiration "
"inputs to the whole catchment. Subcatchment discharges are routed "
"to the catchment outlet using a linear routing algorithm with "
"constant main channel velocity and internal subcatchment "
"routing velocity. The program requires ln(a/tanB) distributions "
"for each subcatchment. These may be calculated using the "
"GRIDATB program which requires raster elevation data as input. "
"It is recommended that those data should be 50 m resolution or "
"better.\n\n"
"NOTE that TOPMODEL is not intended to be a traditional model "
"package but is more a collection of concepts that can be used "
"**** where appropriate ****. It is up to the user to verify that "
"the assumptions are appropriate (see discussion in "
"Beven et al.(1994). This version of the model will be "
"best suited to catchments with shallow soils and moderate "
"topography which do not suffer from excessively long dry "
"periods. Ideally predicted contributing areas should be "
"checked against what actually happens in the catchment.\n\n"
"It includes infiltration excess calculations and parameters "
"based on the exponential conductivity Green-Ampt model of "
"Beven (HSJ, 1984) but if infiltration excess does occur it "
"does so over whole area of a subcatchment. Spatial variability "
"in conductivities can however be handled by specifying "
"Ko parameter values for different subcatchments, even if they "
"have the same ln(a/tanB) and routing parameters, ie. to "
"represent different parts of the area.\n\n"
"Note that time step calculations are explicit ie. SBAR "
"at start of time step is used to determine contributing area. "
"Thus with long (daily) time steps contributing area depends on "
"initial value together with any volume filling effect of daily "
"inputs. Also baseflow at start of time step is used to update "
"SBAR at end of time step."
"\n\nReferences\n"
"- Beven, K., Kirkby, M.J., Schofield, N., Tagg, A.F. (1984): "
" Testing a physically-based flood forecasting model (TOPMODEL) for threee U.K. catchments, "
" Journal of Hydrology, H.69, S.119-143.\n"
"\n"
"- Beven, K. (1997): "
" TOPMODEL - a critique, "
" Hydrological Processes, Vol.11, pp.1069-1085.\n"
));
//-----------------------------------------------------
Parameters.Add_Grid(
NULL , "ATANB" , _TL("A / tan(\xc3\x9f)"),
_TL(""),
PARAMETER_INPUT
);
pNode = Parameters.Add_Grid(
NULL , "MOIST" , _TL("Soil Moisture Deficit"),
_TL(""),
PARAMETER_OUTPUT_OPTIONAL
);
Parameters.Add_Table(
NULL , "CLIMATE" , _TL("Climate Data (P, EP)"),
_TL(""),
PARAMETER_INPUT
);
Parameters.Add_Table(
NULL , "TABLE" , _TL("Simulation Output"),
_TL(""),
PARAMETER_OUTPUT
);
Parameters.Add_Value(
NULL , "DTIME" , _TL("Time Step [h]"),
_TL(""),
PARAMETER_TYPE_Double , 1.0
);
Parameters.Add_Value(
NULL , "NCLASSES" , _TL("Number of Classes"),
_TL(""),
PARAMETER_TYPE_Int , 30 , 1 , true
);
pNode = NULL;
Parameters.Add_Value(
pNode, "P_QS0" , _TL("Initial subsurface flow per unit area [m/h]"),
_TL(""),
PARAMETER_TYPE_Double , 3.28e-05
);
Parameters.Add_Value(
pNode, "P_LNTE" , _TL("Areal average of ln(T0) = ln(Te) [ln(m^2/h)]"),
_TL(""),
PARAMETER_TYPE_Double , 5.0
);
Parameters.Add_Value(
pNode, "P_MODEL" , _TL("Model parameter [m]"),
_TL(""),
PARAMETER_TYPE_Double , 0.032
);
Parameters.Add_Value(
pNode, "P_SR0" , _TL("Initial root zone storage deficit [m]"),
_TL(""),
PARAMETER_TYPE_Double , 0.002
);
Parameters.Add_Value(
pNode, "P_SRZMAX" , _TL("Maximum root zone storage deficit [m]"),
_TL(""),
PARAMETER_TYPE_Double , 0.05
);
Parameters.Add_Value(
pNode, "P_SUZ_TD" , _TL("Unsaturated zone time delay per unit storage deficit [h]"),
_TL(""),
PARAMETER_TYPE_Double , 50.0
);
Parameters.Add_Value(
pNode, "P_VCH" , _TL("Main channel routing velocity [m/h]"),
_TL(""),
PARAMETER_TYPE_Double , 3600.0
);
Parameters.Add_Value(
pNode, "P_VR" , _TL("Internal subcatchment routing velocity [m/h]"),
_TL(""),
PARAMETER_TYPE_Double , 3600.0
);
Parameters.Add_Value(
pNode, "P_K0" , _TL("Surface hydraulic conductivity [m/h]"),
_TL(""),
PARAMETER_TYPE_Double , 1.0
);
Parameters.Add_Value(
pNode, "P_PSI" , _TL("Wetting front suction [m]"),
_TL(""),
PARAMETER_TYPE_Double , 0.02
);
Parameters.Add_Value(
pNode, "P_DTHETA" , _TL("Water content change across the wetting front"),
_TL(""),
PARAMETER_TYPE_Double , 0.1
);
Parameters.Add_Value(
pNode, "BINF" , _TL("Green-Ampt Infiltration"),
_TL(""),
PARAMETER_TYPE_Bool , true
);
}
//---------------------------------------------------------
CTOPMODEL::~CTOPMODEL(void)
{}
///////////////////////////////////////////////////////////
// //
// //
// //
///////////////////////////////////////////////////////////
//---------------------------------------------------------
bool CTOPMODEL::On_Execute(void)
{
bool bInfiltration;
int iClass, nClasses, iTime, nTimeSteps, n, k;
double Precipitation, Evaporation, Infiltration, Infiltration_Excess;
CSG_Grid *pAtanB, *pMoist, gClass;
CSG_Table_Record *pRecord;
CSG_Table *pTable;
//-----------------------------------------------------
// Get user inputs from the 'Parameters' object...
pAtanB = Parameters("ATANB") ->asGrid();
pClimate = Parameters("CLIMATE") ->asTable();
dTime = Parameters("DTIME") ->asDouble();
nClasses = Parameters("NCLASSES") ->asInt();
bInfiltration = Parameters("BINF") ->asBool();
nTimeSteps = pClimate->Get_Record_Count();
if( (pMoist = Parameters("MOIST")->asGrid()) != NULL )
{
pMoist->Set_Name(_TL("Soil Moisture Deficit"));
DataObject_Set_Colors(pMoist, 100, SG_COLORS_RED_GREY_BLUE, true);
}
//-----------------------------------------------------
pTable = Parameters("TABLE")->asTable();
pTable->Destroy();
pTable->Set_Name(_TL("TOPMODEL - Simulation Output"));
pTable->Add_Field(_TL("Total flow (in watershed) [m\xc2\xb3/dt]") , TABLE_FIELDTYPE_Double);
pTable->Add_Field(_TL("Total flow [m/dt]") , TABLE_FIELDTYPE_Double);
pTable->Add_Field(_TL("Saturation overland flow [m/dt]") , TABLE_FIELDTYPE_Double);
pTable->Add_Field(_TL("Subsurface flow [m/dt]") , TABLE_FIELDTYPE_Double);
pTable->Add_Field(_TL("Vertical (drainage) flux [m/dt]") , TABLE_FIELDTYPE_Double);
pTable->Add_Field(_TL("Mean saturation deficit (in watershed) [m]") , TABLE_FIELDTYPE_Double);
pTable->Add_Field(_TL("Infiltration rate [m/dt]") , TABLE_FIELDTYPE_Double);
pTable->Add_Field(_TL("Infiltration excess runoff [m/dt]") , TABLE_FIELDTYPE_Double);
//-----------------------------------------------------
Vals.Create(dTime, nTimeSteps, &Parameters, pAtanB, nClasses, &gClass);
//-----------------------------------------------------
inf_bPonding = false;
inf_cumf = 0.0;
for(iTime=0; iTime<nTimeSteps && Set_Progress(iTime, nTimeSteps); iTime++)
{
Get_Climate(iTime, Precipitation, Evaporation);
if( bInfiltration && Precipitation > 0.0 )
{
Infiltration = dTime * Get_Infiltration((iTime + 1) * dTime, Precipitation / dTime);
Infiltration_Excess = Precipitation - Infiltration;
Precipitation = Infiltration;
}
else
{
Infiltration = 0.0;
Infiltration_Excess = 0.0;
}
Run(Evaporation, Precipitation, Infiltration_Excess);
for(iClass=0; iClass<Vals.nreach_; iClass++)
{
k = iTime + iClass + Vals.ndelay_;
if( k > nTimeSteps - 1 )
break;
Vals.Qt_[k] += Vals.qt_Total * Vals.Add[iClass];
}
if( pMoist )
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -