**Description**

MIKE Curvilinear (MIKE 21C) possesses features not yet available in the GUI. These features are activated via the option system in the DHI PFS (Parameter File System). The MIKE 21C input files with extension .M21C are PFS files, which are ASCII files that can be edited using any ASCII editor (e.g. Notepad). A MIKE 21C input file has two so-called options sections (hydrodynamics and river morphology) allowing direct inputs to the model engine without needing the GUI.

The hydrodynamic options can be found in the PFS .M21C file here:

[HYDRODYNAMIC_MODULE]

[OPTION_PARAMETERS]

EndSect // OPTION_PARAMETERS

The above is the default form with nothing specified. Options are added by writing a command that the engine will understand in the following format:

[HYDRODYNAMIC_MODULE]

[OPTION_PARAMETERS]

keyword = X

EndSect // OPTION_PARAMETERS

Options are in the form of a keyword equal to some value(s) or text string(s).

**#01 – How do I parallelize the hydrodynamic model?**

You can make the MIKE 21C hydrodynamic model 100% parallelized by setting the two options shown below.

[HYDRODYNAMIC_MODULE]

[OPTION_PARAMETERS]

eddy_terms_HD = 2

convective_terms_HD = 2

EndSect // OPTION_PARAMETERS

These two can in principle be used individually, but they are always used together. When setting the two options, the HD solver will become 100% parallelized, which will increase run speed significantly, especially on computers with several cores, while a laptop with 4 cores will see only a modest speed increase. The parallelization uses the OpenMP technology, which will give memory bottleneck problems when adding more and more cores. The run speed increase varies from model to model, but usually the speed does not increase beyond, say, 20 cores due to memory bottlenecks.

When using the parallel HD solver, you should also beware that the equations are modified to a more explicit form, which may require a smaller time-step. Based on our experience, models dominated by bed friction are the easiest to parallelize, while models with large convective terms can cause problems and sometimes will work better without the parallel HD solver (more implicit).

**#02 – How do I parallelize flooding and drying?**

You can make the MIKE 21C hydrodynamic model use a parallelized flooding and drying procedure by setting the option shown below.

[HYDRODYNAMIC_MODULE]

[OPTION_PARAMETERS]

No_Border_FLD = true

EndSect // OPTION_PARAMETERS

To make parallelization possible, the parallelized method has a few deviations from the default method, which can lead to small differences in the results. The option is usually used in combination with the two options that parallelize the HD solver. For some models (large models with intense flooding and drying) it can be observed that when using the two options that parallelize the HD solver, the relative CPU time-consumption for flooding and drying will increase, and the parallelization of flooding and drying will improve this.

**#03 – How do I allow for low eddy viscosity when using the parallel hydrodynamic solver?**

You can make the hydrodynamic model use Second Order Upwind for the cross-convective terms by setting the following option:

[HYDRODYNAMIC_MODULE]

[OPTION_PARAMETERS]

Upwind_Cross_Terms = true

EndSect // OPTION_PARAMETERS

When the HD solver is parallelized, the cross-convective terms will by default be represented with an explicit central scheme, which means that the parallelized HD solver will not be able to run with a low eddy viscosity. You might observe this in the shape of a model developing wiggles when you use the two parallelization options.

When setting this option, the explicit central scheme will be replaced by explicit Second Order Upwind, which allows using low eddy viscosity.

**#04 – How do I avoid excessive RAM use for long-term simulations for storing time-series?**

You can change the internal time-series storage time-step by setting the following option:

[HYDRODYNAMIC_MODULE]

[OPTION_PARAMETERS]

Time_Series_Timestep = 600

EndSect // OPTION_PARAMETERS

In this example the time-series time-step is set to 600 sec. The time-step will be used for the internal storage of time-series, while the default is that the internal time-series are stored using the general time-step set under the Simulation Period. For models running very long time-periods, the use of the general time-step for storing time-series can lead to excessive RAM consumption, especially for models with many time-steps and time-series, e.g., many open boundaries with time-varying values and/or many sources and sinks with time-varying values.

It is difficult to set this internal time-series time-step in the engine, so it is up to the user to set it. As a rule of thumb, the time-series time-step should be set to the lowest time-step adopted in any input time-series, but there are cases where this will not work well if the time-series has fast variations and has a phase difference from the simulation. If the input time-series with the smallest time-step is aligned in time with the simulation, i.e., the input time-series has a value given for the starting date of the model simulation, then the ideal time-series time-step is the time-step of that input time-series.

The time-series time-step can also be set as a reasonable smallest timescale you want to resolve in time. For a tidal model, the time-step should probably be in minutes, while for a model running a very long timescale with e.g., daily values at the boundaries, the time-series time-step can be set as high as 86400 sec. It is usually not important whether the time-series time-step is set to 3600 sec or 86400 sec, as long as it is set to a value that will significantly reduce RAM consumption compared to the usage if adopting the general time-step for storing time-series.__Example__

You have a model running 10 years with a 1 sec general time-step (such models have been developed by DHI). Each time-series will be internally stored with (roughly) the following number of time-steps:

10 years x 365 days/year x 86400 sec/day / 1 sec = 315,360,000

Internal time-series are stored using 32-bit floating point, which means that each time-series will consume 1.2 GB RAM. For a model with e.g., 8 time-series (boundaries and sources), the RAM consumption would be around 10 GB, which is a lot of memory that would need to be stored and also exchanged between RAM and CPU.

The time-series time-step option is only important for models with many time-steps, i.e., you can tell how much RAM each time-series will consume by multiplying the number of time-steps by 4 bytes per time-step to identify the RAM consumption.

**FURTHER INFORMATION & USEFUL LINKS**

**Manuals and User Guides**

Curvilinear Model for River Morphology. User Guide

**Training options**

MIKE 21 C - Getting started with morphological modelling