Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The other parameter that will be used to calibrate the model is the roughness at the main tributaries.  First of all, this object should be available in the scripting environment. Look for the object RoughnessType in the online help, and add the corresponding import to the first region of the main cross section type. the script. The roughness at the main tributaries is the first object (so the index is [0]) in the list of roughness items, as shown in the picture above. The object to grab is the corresponding network coverage. We will assume that this parameter can change from 24 to 34 m1/3 s-1 in steps of 2, so a total of 6 different cases.

Code Block
languagepy
titleSecond parameter used in the calibration: roughness
 roughnessMain = GetItemByName(flowModel.RoughnessSections, "Main").RoughnessNetworkCoverage
rangeRoughness = [24, 26, 28, 30, 32, 34] 

 

In summary for the calibration, we will study all the possible combinations ( 6 x 3 = 18) of the just mentioned parameters.

Before starting the calibration procedure, we want to calculate and save the goodness of the current settings of the flow model. So first of all, let's assign the current values of the calibration parameters to a couple of respective variables. The results of a model during the first time steps are extremely dependent on the initial conditions. So if these are not good ones, then not so meaningful results, and even in some cases, numerical oscillations can be found during the first tie steps. This unreliable period, sometimes called warm-up of a simulation, can be skipped by using the function GetAverageDeviation, as defined in the library. Let's neglect the results of the first 20 output time steps. We can then calculate the goodness of the initial model settings and save those value in the variable listCalibration for later useThe property Flow of this object contains the current numeric value of this constant flow boundary. We will save this number in the variable bcInitialValue.

bcCalibrationName = "Boxbergen" bcCalibration = GetBoundaryDataByName(flowModel,bcCalibrationName) bcInitialValue = bcCalibration.Flow
Code Block
languagepy
titleSelecting Boundary Condition for calibration
Calculate goodness of current model settings
# Deviation of current model results with respect to measurements
roughnessInitialValue = roughnessMain.DefaultValue
bcInitialValue = bcCalibration.Flow
warmUpTimeSteps = 20
dev = GetAverageDeviation(measuredTimeSeries, waterlevelResults , startAt = warmUpTimeSteps)
listCalibration = [[bcInitialValue, roughnessInitialValue, dev]]

 

 

If you want to see how the BC is modified by the script you can look at the corresponding item on the project explorer view. Additionally, you can double click on this item to open the corresponding editor view.

The other object that will be used for tuning the model up is the roughness at the main tributaries. First of all, this object should be available in the scripting environment . Look for the object RoughnessType in the online help, and add the corresponding import to the first region of the script. The roughness at the main tributaries is the first object (so the index is [0]) in the list of roughness items, as shown in the picture above. The object to grab is the corresponding network coverage. You can save the current value for future reference, as done before with the BC.

...