URUNME can be used to automatically calibrate models based on user defined criteria. Although very sophisticated auto-calibration techniques can be used, a very simple example is shown here from a reservoir modeling project to elaborate the basic concept. CE-QUAL-W2 is a two-dimensional hydrodynamic and water quantity model developed by the U.S. Army Corps of Engineers to simulate the water quantity and quality in a waterbody (Cole and Wells, 2011). The simulated water elevation from the model is often not well calibrated (the model does not account for water loss due to seepage, etc.) and requires external calculations to create artificial tributary inflows/outflows for water balance. A water balance utility is provided in the CE-QUAL-W2 package, which requires a text file ‘el_obs.npt’ containing observed water elevation as an input for the simulated time period. The model is required to be run multiple times, and each iteration must be followed by running the utility to calibrate the water elevation. A looped process is created in URUNME to run the model and water balance utility successively (Figure 1), which automatically calibrates the model until a desired performance is achieved.
The process starts with a ‘Formula’ function to initialize a variable called ‘count’ to keep track of the number of times the model is run:
count = 1;
Observed water elevation is read from the Visual FoxPro file ‘pool.db’ for the desired time period by a ‘Read Database’ function and is then written to the ‘el_obs.npt’ file by a ‘Write Text File’ function in the desired format. The CE-QUAL-W2 model is run by ‘Execute’ and then followed by ‘Calibration’ function to calculate different calibration performance indices as scalar variables, such as r-squared (Rsq). count and Rsq variables are used by the ‘Calculate’ formula function (Figure 2) to evaluate the following two expressions:
count = count + 1;
stop = if (count > 10 || Rsq > 0.9, 1, 0);
The ‘count’ is incremented and an ‘if’ statement is used to calculate a scalar variable ‘stop’ (the condition shown here is just for demonstration purposes, any logical statement can be used instead) to be used by the ‘Decision’ function to break the loop and go to the ‘End’.
This is achieved by dragging and dropping the ‘stop’ variable in the ‘Decision’ Properties Form (Figure 3) (when variable is 1, the loop breaks). In case the criterion is not met, the process goes into the loop and executes the water balance utility. A similar technique can be used for calibrating models by replacing the water balance utility with any other optimization routine or objective function.