This tutorial gives a brief introduction to parameter optimalisation using iPEST. The technique is described in more detail in section section 12.33. It also uses the functionalities of the iPEST Analyser which is described in section 7.16.
This is what you will do:
• Defines a set of measurements.
• Start a parameter optimisation using those measurements.
• Defines zones for the parameter optimisation and examine the result with the iPEST Analyzer.
• Define Pilot Points and use them in the parameter optimisation.
For this tutorial you need the following iMOD Data Files/folders:
• The entire folder (and subfolders) in {tutorialfolder} \TUT_PST.
Note: If you are a left-handed person and you converted your mouse button settings, ’left mouse button’ should be ’right mouse button’ and vice versa in these tutorials.
1. Launch iMOD by double clicking the iMOD executable in Windows Explorer.
2. Select the option Create a new iMOD Project.
3. Click the Start button to initiate iMOD with an empty configuration.
The model configuration has been prepared already, the only thing that misses are the measurements. Therefore, the first thing we’re going to do is to define some measurements for our model with two model layers. Let’s display the boundary conditions such the the graphical window is easily adjusted such that we can enter the measurements.
4. Click the option Map from the main window and select Add Map to display the Load iMOD Map window.
5. Select the file \TUTORIALS \TUT_PST\DBASE\BND.IDF.
6. Select the Open button to open the selected IDF file and close the Load iMOD Map window.
Now we’re going to create an IPF file for the following coordinates.
Table 11.10: List of measurements
x-coordinate | y-coordinate | layer | measurement | weight |
201069.874 | 401374.506 | 1 | 8.095 | 1 |
200200.331 | 402269.698 | 1 | 9.178 | 1 |
200869.692 | 400168.484 | 1 | 9.339 | 1 |
200494.349 | 401100.975 | 1 | 8.011 | 1 |
201879.988 | 400867.853 | 1 | 8.353 | 1 |
201132.431 | 401141.383 | 1 | 8.321 | 1 |
202048.892 | 401846.968 | 1 | 9.982 | 1 |
200982.294 | 402033.466 | 2 | 7.745 | 1 |
200481.838 | 400544.589 | 2 | 8.520 | 1 |
201057.363 | 401203.549 | 2 | 8.214 | 1 |
200760.217 | 401275.040 | 2 | 8.027 | 1 |
201789.281 | 400905.152 | 2 | 8.285 | 1 |
201529.669 | 401371.398 | 2 | 8.385 | 1 |
201029.212 | 400473.098 | 2 | 8.806 | 1 |
202270.970 | 401001.510 | 2 | 8.086 | 1 |
If you’re already quite familiar with iMOD, you can create this IPF file outside iMOD (Excel, Notepad etc.) very easily and continue after step 28..
If you’re not familiar with iMOD (why are you trying this tutorial in the first place ?), you can create the IPF by hand trough the steps 8. to 28.. (If you get bored, know that this IPF is prepared for you in \TUTORIALS \TUT_PST \DBASE\MEASURES.IPF) and you can continue with step 29
8. Click the option Edit from the main window and select Create Features and then select the option Create an IPFs to display the Create IPFs window.
9. Select the Draw button (
) to start drawing points for the IPF.
10. If you move the mouse on the graphical canvas, a circle appears which will be the location of the point. The coordinates of that point are displayed on the statusbar of the main window.
11. Click your left mouse button to add another point. Try to match as close as possible all the coordinates as listed in the table above.
12. In case you want to move a point, select it from the list. Hover over the point and your cursor will change into (
). Hold your Left mouse button and you can move the point.
13. If you’ve added them all, select your right mouse button to stop adding points.
iPEST has the option to perform an interpolation from neighbouring cells to obtain an accurate value at the exact location of an measurement. If you did everything okay, the following image should be on your screen.
Figure 11.186: Example of all the points that are necessary for the optimization.
Now we need to add additional information to the points.
14. Select all points from the list on the Create IPFs window.
15. Select the Info button (
) to start the Attributes Values for Current (selected) Polygons/Lines/Points window.
Here we can create columns and define additional columns to the points, let’s do that. First we rename our first column, just as the column in 11.10.
16. Select the first column that is called [ID], just click on the name.
17. Click the Rename button (
) to start the Rename Attribute window.
18. Enter the name [ILAY] in the input field, this column will hold the layer number to which a measurement is assigned to.
19. Click the OK button to close the Rename Attribute window.
20. Click the Plus button (
) to add a new column to all points. It start the Input window.
21. Enter the name [MEASURE] for the Attribute Name and accept the default value of 32 for the Width of Attribute.
22. Click the OK button to accept the entry and close the Input window.
23. Repeat this process to add the attribute [WEIGTH], with this column individual weights can be assigned to measurements.
If you did everything okay, you can fill in the table as shown in the following figure.
Figure 11.187: Example of all the points that are necessary for the optimization.
24. Click the Apply button to accept all entries and closes the Attributes Values for Current (selected) Polygons/Lines/Points window.
25. Click the Save As button (
) to open the Save IPF files window.
26. Enter the name [MEASURES.IPF] and save the file in the {installfolder} \TUT_PST\DBASE folder.
27. Click the Save button to save the file and close the Save IPF files window.
Now we’ve made our measurements we’re ready to start the parameter optimization. We need to add the measurements to our PRJ file and define the parameters to be optimized.
29. Select the option View and then the option Project Manager to start the iMOD Project Manager window.
30. Select the Open PRJ File button (
) and select the file {installfolder} \tutorials \TUT_PST \TUT_PST.PRJ
31. Click the Open button to load the selected PRJ file in the Project Definition on the iMOD Project Manager window.
The entire model configuration has been filled in, the model isn’t complicated and is defined by two layers with a river system defined by the GHB package. Feel free to open some of the files to inspect the model set-up.
Let’s add the parameter estimation package.
32. Select the entry [(PST) Parameter Estimation] from the Project Definition list from the iMOD Project Manager window.
33. Select the Properties button (
) to open the Parameter Estimation Settings window.
In the Parameter Estimation Settings window it is possible to specify the configuration that is needed for iPEST.
Figure 11.188: Example of all the points that are necessary for the parameter optimization.
For more details, please have a check at the section section 5.5.3.2. For now we leave most of the configuration at its default settings. Three things are necessary to specify, first we need to specify the parameters to be optimized, secondly, we need to define the zones for which the parameters are altered and thirdly, we need to fill in our measurements. Let’s do that.
34. Select the button Define Parameters, located in the lower part of the window, to open the tab Parameters on the Parameter Estimation Settings window.
35. Enter the number [2] in the integer field, left of the push-button Define Parameters. In that way, we create 2 entry rows to specify the parameters.
36. Click the Define Parameters button.
37. Select the item [KH] from the dropdown menu in the second column for both rows.
38. Enter [2] for the second row in the column Layers/Systems.
39. Enter [1] for the second row in the column Zones. Both parameters are defined by zone 1 which we are going to specify hereafter.
40. Enter [AQUIFER1] and [AQUIFER2] for the first and second row respectively in the Acronym column.
If you did everything correct, the tab Parameters shows up as follows.
Figure 11.189: Example of the configured two parameters to be optimized.
41. Click the Apply button to accept the configuration, leave this tab and return to the previous window.
Observe that we now have 2 sets of parameters. Now we specify the zone to which the parameters need to be assigned to.
42. Select the option Define Zones to open the tab Zones on the Parameter Estimation Settings window.
43. Enter the number [1] in the integer field, left of the push-button Define Zones. In that way, we create a single entry rows to specify the zone.
44. Click the Define Zones button.
45. Enter 1 on the first column Zone (constant values and/or IDF/IPF files).
It should all look as follows:
Figure 11.190: Example of the zone for the two parameters to be optimized.
46. Click the Apply button to accept the configuration, leave this tab and return to the previous window.
Observe that we now have 1 zone. Now we specify the measurements to which the parameters need to be optimized against.
47. Select the option Define Measurements to open the tab Measurements on the Parameter Estimation Settings window.
48. Enter the number [1] in the integer field, left of the push-button Define Measurements. In that way, we create a single entry rows to specify the measurement.
49. Click the Define Measurements button.
50. enter {tutorialfolder}\TUT_PST\DBASE \MEASURES.IPF on the first column IPF File.
The window should look as follows, and we’re done.
Figure 11.191: Example of the measurements for the two parameters to be optimized.
51. Click the Apply button to accept the configuration, leave this tab and return to the previous window.
52. Click the Apply System Settings button to leave the Parameter Estimation Settings window and return to the iMOD Project Manager window.
54. Enter [TUT_PST_ONE_ZONE.PRJ] and save the file in the folder {installfolder}\TUTORIALS \TUT_PST.
55. Click the Save button.
56. Click the Ok button of the message that tells you that the file was saved successfully - yeah duh ...
Next, let’s run the model - isn’t that cool ?
57. Click the Simulation Manager button (
) to start the Simulation Manager window.
58. Select the option Standard MODFLOW 2005.
59. Enter [TUT_PST_ONE_ZONE] at the entry field Output Folder. iMOD creates this sub folder in {installfolder}\IMOD_USER\MODELS and exports the model to MODFLOW 2005 files.
60. Click the Start … button to start the simulation.
61. Clik the YES button to confirm the simulation.
The model will run for a while. There are two ways to explore the results of the optimization. One is to look into the files directly, this is for the advanced users. For less advanced users, there is a nice tool called the iPEST Analyser that can be utilized for examining the results of the optimization.
If the model optimization is finished there will be a pop-up window, if that appears we can continue.
62. Click the Ok button that denotes the information of successful completion.
63. Select the option Toolbox from the main menu and then the option iPEST Analyse to start the iPEST Analyse window.
64. Click the button Read iPEST Logfiles to select the folder where the iPEST results are written.
65. select the folder {installfolder}\IMOD_USER\MODELS\TUT_PST_ONE_ZONE\PEST.
66. Click the Ok button.
You’ll see a dashboard filled in with all kind of different information that is of importance to your parameter estimation. All these functionalities are described in section section 7.16. You might be selecting iteration #4 (from the drop down menu Select an Optimization Cycle) as most optimal as the objective function value does not change any more. Especially in the end trajectory of a parameter estimation, parameters might change more-and-more for other deficits in the model. The art is to select the correct iteration just before those parameter might be abused.
Figure 11.192: Example of the iPEST Analyser for the two parameters that were optimized.
Whenever many parameters are concerned, it is advised to use iPEST Parallel. This allows multiply simulations, that are needed for the sensitivity computations, to be carried out in parallel. So, this what we’re going to do. We define so-called pilot points and optimize those with iPEST Parallel, pretty nice isn’t it.
67. Select the entry [(PST) Parameter Estimation] from the iMOD Project Manager list.
68. Select the Properties button (
) to open the Parameter Estimation Settings window.
69. Check the option Apply Parrallel iPEST.
70. Check the option Hide Command Windows to avoid all individual command window to appear on the screen.
71. Enter [4] for the Number of Processors, please enter a larger number if the number of processors on your computer is more.
72. Enter [3] for the Number of Line Searches, here iPESTP is performing a search in 3 directions for a more robust optimization process. Via the iMOD Batch function RUNFILE, the actual size of the line-search can be specified (LAMBDA_TESTS), here the default values 0.1,1.0,10.0 are used.
If we want to use Pilot Points, instead of zones, we need to modify the number of parameters as well as the zones. Each pilot point is a parameter, so let’s enter them.
73. Select the option Define Parameters to open the tab Parameters on the Parameter Estimation Settings window.
74. Enter the number [6] in the integer field, left of the push-button Define Parameters. In that way, we create 6 entry rows to specify the parameters for the pilot points.
75. Click the Define Parameters button.
76. Select the item [KH] from the drop down menu in the second column for all rows.
77. Enter [1] for the all rows in the column Layers/Systems, all Pilot Points affect the first model layer only.
78. Enter [1] for the first row, [2] for the second row, [3] for the third and so on in the column Zones. Each parameter is assigned to a separate Pilot Point which we assign here after.
79. Enter [PPOINT1], [PPOINT2], [PPOINT3] and so on for the rows in the Acronym column.
In the end it should look as follows:
Figure 11.193: Example of the parameter settings for the calibration with Pilot Points.
80. Click the Apply button to save the altered setting ans close the Parameter Estimation Settings window.
81. Select the option Define Zones to open the tab Zones on the Parameter Estimation Settings window.
82. Enter [{installfolder}\TUTORIALS \TUT_PST \DBASE \PPOINTS_6.IPF] in the first column Zone (constant values and/or IDF/IPF files. This IPF file contains the location of the Pilot Points and contains the columns [X], [Y] and [ID]. The latter denotes the zone-number that is assigned to the parameter.
83. Click the Apply button to save the altered setting and close the Parameter Estimation Settings window.
As for Pilot Points, it is advised to turn on the Singular Values Decomposition (SVD). This will mathematically filter out redundancies in the jacobian matrix (i.e. the sensitivity matrix). This is a form of automatical-regularisation to yield a mathematical robust inverse problem. See section section 12.33 for more detailed information. Also, we turn off the Tikhonov Regularisation (which is turned on by default), this allows the pilot points to differ from the prior estimated values (initial values) without punishing.
84. Uncheck the Tikhonov Regularisation.
85. Select the option [SVD] from the Specify Scaling / SVD.
So it should all look like this.
Figure 11.194: Example of the parameter settings for the calibration with Parrellel iPEST.
Let save it and run it.
86. Click the option Apply System Settings to save the changes for the configuration.
88. Enter [TUT_PST_PPOINTS.PRJ] and save the file in the folder {installfolder}\TUTORIAL\TUT_PST.
89. Click the Save button.
90. Click the Ok button of the message that tells you that the file was saved successfully.
91. Click the Simulation Manager button (
) to start the Simulation Manager window.
92. Select the option Standard MODFLOW 2005.
93. Enter [TUT_PST_PPOINTS] at the entry field Enter or Select Output Folder. iMOD creates this sub folder in {installfolder}\IMOD_USER\MODELS and exports the model to MODFLOW 2005 files.
94. Click the Start … button to start the simulation.
95. Click the YES button to confirm the simulation.
The optimization will run in a command tool, which you might want to select to see what happens.
Figure 11.195: Running of the parameter optimization for the calibration with Parrallel iPEST.
The optimization ends with the message Pest Iteration terminated: PEST_ITER (=10) = PEST_NITER (=10). Although the optimization was not finished yet, it has been terminated because no more iterations were allowed. Nevertheless we inspect the results to see how the optimization went. Let’s start the iPEST Analyser again.
96. Click the OK button.
97. Select the option Toolbox from the main menu and then the option iPEST Analyse to start the iPEST Analyse window.
98. Click the button Read iPEST Logfiles to select the folder where the iPEST results are written.
99. Select the folder {installfolder}\IMOD_USER\MODELS\TUT_PST_PPOINTS\PEST.
100. Click the Ok button.
You can experiment with the different features to examine how the optimization went.
Figure 11.196: Results of the parameter optimization for the calibration with Parrallel iPEST of Pilot Points.
Finally it is interesting how the adjusted permeability map look like after the optimization. That is an IDF file that we can open in iMOD.
101. Click the Close button to close the iPEST Analyse window.
102. Click the option Map from the main window and select Add Map to display the Load iMOD Map window.
103. Select the file {installfolder}\IMOD_USER\MODELS\TUT_PST_PPOINTS\IPEST_L#1 \PEST \PARAMETERS_CYCLE0 \KH_L1.IDF. Pretty long name, but if you look into the other folders with the #-sign you see a similar structure, these P#-folders are those used for the sensitivity simulations per parameter.
104. Select the Open button to open the selected IDF file and close the Load iMOD Map window.
You see that the pattern that has been found to lower the objective function shows a clear difference with high values in the centre and significant lower values in the north and south.
Figure 11.197: Results of the permeability after the parameter optimization for the calibration of Pilot Points.
It is obvious that any result of the parameter optimalisation need to be evaluated with knowledge of the geology. It is important to question yourself “Is it geological sound what the optimization found?”. If not, it indicates some model-error(s) for which the optimization wants to compensate.
Please have a look at the iMODBatch function RUNFILE. All of the things we did in this tutorial can be done in batch via that function. For repetitious work, we recommend you to work with that function. An easy example of this could be:
FUNCTION=RUNFILE
PRJFILE_IN= {installfolder}\TUTORIAL\TUT_PST\TUT_PST_PPOINTS.PRJ.
NAMFILE_OUT={installfolder}\TUTORIAL\TUT_PST\MODEL\TUT_PST_PPOINTS.NAM.
IPESTP=1
NCPU=11
LAMBDA_TEST=0.1,1.0,10.0
ISOLVE=1
MODFLOW=d:\IMODFLOW\IMODFLOW_V5.1_R.EXE