Once all the problem type files are finished (.cnd, .mat, .prb, .sim, .bas files), you can run the solver. You may wish to run it directly from inside GiD.

To do so, it is necessary to create the file problem_type_name.bat in the Problem Type directory. This must be a shell script that can contain any type of information and that will be different for every operating system. When you select the Calculate option in GiD Preprocess this shell script is executed (see CALCULATE from Reference Manual).

Because the .bat file will be different depending on the operating system, it is possible to create two files: one for Windows and another for Unix/Linux. The Windows file has to be called: problem_type_name.win.bat; the Unix/Linux file has to be called: problem_type_name.unix.bat.

If GiD finds a .win.bat or .unix.bat file, the file problem_type_name.bat will be ignored.

If a .bat file exists in the problem type directory when choosing Start in the calculations window, GiD will automatically write the analysis file inside the example directory assigning the name project_name.dat to this file (if there are more files, the names project_name-1.dat ... are used). Next, this shell script will be executed. GiD will assign three arguments to this script:

  • 1st argument: project_name (name of the current project);
  • 2nd argument: c:\a\b\c\project_name.gid (path of the current project);
  • 3rd argument: c:\a\b\c\problem_type_name.gid (path of the problem type selected);

Among other utilities, this script can move or rename files and execute the process until it finishes.

Note 1: This file must have the executable flag set (see the UNIX command chmod +x) in UNIX systems.

Note 2: GiD sets as the current directory the model directory (example: c:\examples\test1.gid) just before executing the .bat file. Therefore, the lines (cd $directory) are not necessary in the scripts.

Note 3: In UNIX platforms check you have installed the shell you are using in the .unix.bat script, there are more than one possibilities: bash, csh, tcsh, ...

The first line of the script specify the shell to be used, for example

#!/bin/sh

or

#!/bin/bash

In Windows platforms, the command.exe provided by GiD is used instead the standard cmd.exe or command.com

Executing external program

External program execution