MIKE HYDRO Basin Adapter¶
This adapter enables use of MIKE HYDRO Basin models within the MIKE Workbench.
About MIKE HYDRO Basin¶
MIKE HYDRO Basin is a Software developed by DHI Group to model and manage river basins. Please refer to MIKE BY DHI for more information.
Prerequisite¶
The Adaptor requires MIKE HYDRO Basin to be installed on the MIKE Workbench computer (for registration) and the run machine. The execution of models will require a license on the run machine.
Supported Model objects¶
The below list of model objects can be derived from a MIKE HYDRO Basin setup. Input and output timeseries are associated to corresponding model objects.
- RiverNode -Parameters: - Chainage - Identifier - Name
- Branch
- Parameters:
- Flow direction
- Identifier
- Name
- Start chainage
- Parameters:
- Connection
- Parameters:
- Direction
- Identifier
- Parameters:
- WaterUserNode
- Parameters:
- Supply connections
- Identifier
- Priority (editable)
- Supply type
- Groundwater options
- Identifier
- Name
- Supply connections
- Parameters:
- ReservoirNode
- Parameters:
- Branch
- Chainage
- Identifier
- Initial water level (editable)
- Level area volume table (editable)
- Name
- Reservoir type
- Sediment distribution type (editable)
- Users
- Identifier
- Name
- Number of reduction levels
- Priority (editable)
- Parameters:
- Catchment
- Parameters:
- Area
- Groundwater model
- Identifier
- Name
- Rainfall-Runoff model
- Parameters:
- Crops
- Parameters:
- Depletion fraction (editable)
- Kcb initial (editable)
- Kcb late season (editable)
- Kcb mid-season (editable)
- Last irrigation date (editable)
- Length development (editable)
- Length initial (editable)
- Length late season (editable)
- Length mid-season (editable)
- Max height mid-season (editable)
- Model type
- Name
- Root depth initial (editable)
- Root depth mid-season (editable)
- Sowing date
- Parameters:
Configuration¶
Registration¶
The MIKE HYDRO Basin adapter runs a user defined launch command if specified.
Hotstart functionality for the Rainfall-Runoff model is supported if the MIKE HYDRO Basin setup is configured accordingly: Use Hotstart files is checked on and Create runoff hotstart files is checked on. The adapter maintains only one hotstart file which implies that only one runoff hotstart file can be specified in the model setup.
The MIKE HYDRO Basin UI does not allow to run the MIKE Basin engine with support of hotstart functionality for MIKE HYDRO Basin parameters such as initial reservoir levels. However, the adapter does support this functionality offered by the MIKE Basin engine. If Use MHB Initial Conditions is checked at registration, the adapter creates necessary folders and maintains MIKE HYDRO Basin hotstart files in the registered model setup folder.
If the MIKE HYDRO Basin hotstart support is activated, the adapter creates the folder MBHOTSTARTINPUT and MBHOTSTARTOUTPUT in the root folder.
The MIKE Basin engine supports storing of parameters for hotstarting when simulated time step by time step. Consequently, the adapter runs the MIKE Basin engine time step by time step if support for hotstart on MIKE HYDRO Basin parameters is activated. The hotstart files are written to MBHOTSTARTOUTPUT. At simulation run, hotstart files from the corresponding MBHOTSTARTOUTPUT folder are copied to the MBHOTSTARTINPUT folder and the MIKE Basin engine hotstarts on these files. This logic is the same compared to the initial condition support of all other adapters.
If a Rainfall-Runoff model is specified and the option for hotstarting
on MIKE HYDRO Basin parameters is activated, then the adapter runs the
MIKE 1D engine to run the Rainfall-Runoff model and the MIKE Basin
engine to run the MIKE HYDRO Basin model. This model execution is similar to the DHI.MHydro.Application.exe
.
Note that from MIKE 2024, the model simulation is similar to DHI.Mike1D.Application.exe
.
Execution¶
If no launch command is specified, the adapter runs the MIKE Basin
engine if no Rainfall-Runoff model is specified. In case a
Rainfall-Runoff model is specified, it uses the
DHI.MHydro.Application.exe
to run the Rainfall-Runoff model and the MIKE HYDRO Basin model.
The default launch command of the MIKE HYDRO Basin model adapter from version 2024 is DHI.Mike1D.Application.exe
.
This command is used for executing the MIKE HYDRO Basin model when running simulations.
The launch command can be changed in the MIKE HYDRO.xml
created during model registration.
<?xml version="1.0"?>
<MIKEHYDRO>
<!-- ... -->
<HydroFileName>ProjectData.mhydro</HydroFileName>
<LaunchCmd>
</LaunchCmd>
<LaunchArguments>
</LaunchArguments>
<LaunchSilentArguments>
</LaunchSilentArguments>
<UseMBHotstart>False</UseMBHotstart>
<UseRR>False</UseRR>
<Folders />
</MIKEHYDRO>
Updating the launch command requires that the model setup is exported e.g. using the Open in Native Tool or by using an export script, so that that the MIKE HYDRO.xml
can be changed.
After changing the MIKE HYDRO.xml
file, the exported model, should be zipped and imported again, e.g. by using an zip and import script in the script manager.
def ReZipSetup(modelSetupPath, directory):
"""
<Script>
<Author>admin</Author>
<Description>Script to zip a folder and assign the result as content to a modelsetup, ths updating the blob</Description>
<Parameters>
<Parameter name="modelSetupPath" type="string">The full path of the model setup in the database (copy Full Path)</Parameter>
<Parameter name="directory" type="string">The directoy path in windows where the setup has been unpacked</Parameter>
</Parameters>
</Script>
"""
if (System.IO.Directory.Exists(directory) == False):
return;
scm = app.Modules.Get("Scenario Manager");
modelsetup = scm.ModelSetupList.Fetch(modelsetupPath);
zipptr = BaseAdapter.ZipFiles(directory, None, "no Adapter");
modelsetup.Content = zipptr;
scm.ModelSetupList.Update(modelsetup, True);
Warning
Be carefull when editing the model information and importing the changes, as the model information is used as when running simulation.
Limitations¶
-
mhydro-file must be in the root folder of the setup.
-
All files in the directory structure from the root folder and down including hotstart files (except result files) are zipped during registration, so reduce the size of data files and remove unnecessary files.
-
To support hotstart functionality for the Rainfall-Runoff model, the MIKE HYDRO Basin model must be set up to run with Rainfall-Runoff hotstart files: Use Hotstart files is checked on and Create runoff hotstart files is checked on.
-
In case of using Rainfall-Runoff hotstart files, only one hotstart file can be specified.