Skip to content

MIKE 21 FM Adapter

This adapter enables use of MIKE 21/3FM (incl. MIKE ECO Lab) models within the MIKE Workbench.

About MIKE 21/3 FM

MIKE 21/3 FM is a Software developed by DHI Group to model coastal and marine environments. Please refer to MIKE BY DHI for more information.

Prerequisite

The Adaptor requires MIKE Zero 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 adapter supports the following model object types.

  • Boundary Conditions
    • Name
    • Code
    • Input Time Series
  • ECO Lab output
    • Name
  • ECO Lab source
    • Name
  • Hydro Dynamic Output
    • Name
  • Hydro Dynamic Source
    • Name
  • Mud Transport Output
    • Name
  • Particle Tracking Output
    • Name
  • Sand Transport Output
    • Name
  • Transport Output
    • Name
  • Wind Forcing
    • Name

Configuration

Registration

To register a MIKE 21 FM model, right click the Model Setups node in the Scenario Explorer and select Register model.

Select MIKE 21 FM and click Next.

Select a model file and specify a Model name.

An optional launch command for running the model can be specified.

If no optional launch command is specified, the adapter runs the MIKE 21 FM engine using the FemEngineHD.exe without parameters.

A warning will occur if files with equidistant time axis is being used by the model.

Click Yes and the model registration wizard will parse the model and display model objects found.

Add a new initial condition by clicking the right-click menu Add New File.

The form Hot start and result file selection dialog shows and the user can select the hot start file and result file for the initial condition.

Edit the selected initial condition by clicking the right-click menu Edit hotstart mapping.

It shows the same form as for Add New File, but pre-filled will be the current mapping. The user can then specify a new result file if needed. But it should not be possible to edit the hot start file.

Click Ok and the selected initial condition changes.

Verify the model objects and click Prepare for Registration.

Click Next.

If the projection used by the model is not supported by the GIS manager of MIKE Workbench, the information dialog above will be shown.

Click OK.

Click Next.

Specify a name of the model and the model group.

Folder is a read only field. The folder made from the root folder, shared by all models of the database workspace (connection), found in the Settings in the System Explorer as Models Folder.

This folder is used for simulation results.

Click Finish to complete the registration.

The model setup is now available in the scenario explorer in MIKE Workbench.

Note

If your model does not use an EPSG coordinate system, please read this faq.

Execution

  1. Export model data to m21fm or m3fm model file
  2. Use DHI.PFS.dll to update the model file
  3. Launch (default) the FemEngineHD.exe to run a simulation

Change engine

The launch command can be changed in the MIKE21FM Adapter.xml created during model registration.

<?xml version="1.0"?>
<MIKE21FMAdapter>

  <!--  ... -->

  <FMFilePath>Calibration_1\oresund.m21fm</FMFilePath>
  <LaunchCmd>FemEngineHD.exe</LaunchCmd>
  <LaunchArguments>
  </LaunchArguments>
  <LaunchSilentArguments>
  </LaunchSilentArguments>
  <Folders>
    <String>Calibration_1</String>
    <String>Calibration_2</String>
    <String>Data</String>
    <String>Result</String>
    <String>Calibration_1\Output</String>
    <String>Calibration_1\Plots</String>
    <String>Calibration_2\Output</String>
    <String>Calibration_2\Plots</String>
    <String>Data\1993</String>
    <String>Data\1993\Ascii</String>
    <String>Data\1993\Bathymetry</String>
    <String>Data\1993\Boundary_Conditions</String>
    <String>Data\1993\Forcings</String>
    <String>Data\1993\Measurements</String>
  </Folders>
</MIKE21FMAdapter>

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 MIKE21FM Adapter.xml can be changed.

After changing the MIKE21FM Adapter.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

  • Files of a model setup are written into zip files into the database without initial conditions and dfsu files
  • Simulation results are not written into the database as with other adapters. Simulation results are saved into a zip files saved to a folder on disk.