Is there a limit to the length of a file path string in a model setup file? 

Yes, there is a limit to the length of string when the model engines read the input from a setup file. The limit is typically 255 characters, but may be higher in certain cases (e.g. for map projections). If this limit is exceeded the model will not execute as the programme fails to read the entire string. 

If the model cannot execute and it gives an error message, e.g. ‘DFS Open Error’ or ‘Wrong file type’, the cause may be that a file string has become too long. To verify that this is indeed the problem, you will need to open the log-file and view the file string used by the model engine. Even if it is not apparent from the User Interface, it may happen that the resulting file path to an output result file becomes too long - for 2 main reasons: 

1. If the Output file is defined as relative to the model setup, the output file will be saved in a subfolder (e.g. c:/My Models/Test setup/ModelSetup.m21fm – Result Files/output.dfsu) which will extend number of characters in the resulting file path. 

2. If the simulation is carried out using several subdomains (for MIKE FM) temporary output files will be generated with an extra extension such that the file name becomes 3-4 characters longer, e.g. Flow_WinterConditions_ApplyingTSmodule_p0.dfsu. 

Fig. 1 gives an example of a model simulation failing as the total number of characters in the resulting file path extends beyond 255 characters. 

Graphical user interface, text, application, email<br><br>Description automatically generated

Fig. 1 - Failure of simulation 



Manuals and User Guides 
User Guide. MIKE 21 Flow Model FM. Hydrodynamic Module