Versions Compared

Key

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

The model calibration will be done by changing the less reliable parameters from the loaded model. Let’s assume that these factors are the flow boundary condition at the node Boxbergen, and the roughness of the main tributaries leading to Zwolle:

The definitions of boundary conditions object are not known yet in the scripting environment as variables. The complete name of the flow boundary condition at Boxbergen is, as shown in the previous figure, composed by the name of the location and the current value. However, the function GetBoundaryDataByName defined in API library SobekWaterFlowFunctions already takes this into account so you don't have to worry about it. Assign the name of the boundary condition to a new variable bcCalibrationName. Then use that string to assign the Boundary data object to the variable bcCalibration. The property Flow of this object contains the current numeric value of this constant flow boundary. We will save this number in the variable bcInitialValue.

Code Block
languagepy
titleSelecting Boundary Condition for calibration
bcCalibrationName = "Boxbergen"
bcCalibration = GetBoundaryDataByName(flowModel,bcCalibrationName)
bcInitialValue = bcCalibration.Flow

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.

Code Block
languagepy
titleSelecting Roughness for calibration
roughnessMain = flowModel.RoughnessSections[0].RoughnessNetworkCoverage
roughnessInitialValue = roughnessMain.DefaultValue


Similarly, if you double click on the item in the project explorer panel, you will open the corresponding editor view and will be able to see how it automatically changes while the calibration loop is being run.