Views:

Question
How do you create batch jobs in MIKE 21? 

Answer 
To execute batch jobs, you have to create a text file with the extension *.bat. To edit the file (right-click and select 'Edit') you

1. Add the folder for the MZlaunch executable to the overall path
2. Add - below - one command line for each simulation to be run
3. Save and execute this batch file

E.g. to run three simulations with version 2022, the content of the batch file may be as follows:
path=%path%;%DHI_MIKE_2022%;
start /wait Mzlaunch.exe mud_run1.m21 -x
start /wait Mzlaunch.exe mud_run2.m21 -x
start /wait Mzlaunch.exe mud_C.m21fm -x 

In this example, we assume that the three setup files are all located in the same folder as the one containing the batch file.  When setup files are located in different directories, you can either add extra lines with the commands “cd” and “cd..” to navigate between folders, or replace the names of the setup files by their full paths.

Additionally
1. You can also control the parallelization technique using extra arguments, when running simulations with the Flexible Mesh version. 
E.g. you can run simulations using 8 sub-domains on the CPU and 1 thread per sub-domain, using this batch file:

path=%path%;%DHI_MIKE_2022%;
set OMP_NUM_THREADS=1
cd NameOfSubfolderContainingSetupFile
Start /wait Mzlaunch.exe Scenario1.m21fm -mpi 8 -x
cd..
cd NameOfSubfolderContainingSecondSetupFile
Start /wait Mzlaunch.exe Scenario2.m21fm -mpi 8 –x

2. You can run simulations using 2 sub-domains on 2 GPU cards (with double precision) and 1 thread per sub-domain, using this batch file:
path=%path%;%DHI_MIKE_2022%;
set OMP_NUM_THREADS=1
Start /wait Mzlaunch.exe C:\FolderName1\Scenario1.m21fm –gpu 2 -x
Start /wait Mzlaunch.exe C:\FolderName2\Scenario2.m21fm –gpu 2 –x

FURTHER INFORMATION & USEFUL LINKS 
User Guide. MIKE ZERO. The Common DHI User Interface for Project Oriented Water Modelling (Chapter 5.4 Batch Execution)
 

Related Products: MIKE 21/3