Go to the first, previous, next, last section, table of contents.


CUSTOMIZATION

Introduction

When GiD is to be used for a particular type of analysis, it is necessary to predefine all the information required from the user and to define the way the final information is given to the solver module. To do so, some files are used to describe conditions, materials, general data, units systems, symbols and the format of the input file for the solver. We call Problem Type to this collection of files used to configure GiD for a particular type of analysis.

Note: You can also learn how to configure GiD for a particular type of analysis, following the Problem Type Tutorial; this tutorial is included with the GiD package you've bought. You can also download it from the GiD web page. (http://www.gidhome.com/support)

Due to the vocation of GiD as general-purpose pre and post processor, the configuration for the different analysis must be performed according to the particular specifications of every solver. This implies the necessity of creating specific data input files for every solver. However, GiD allows to performing this configuration process inside itself without any change in the solver and without having to program any independent utility.



To configure these files means to define the data that must be input by the user, as well as the materials to be implemented and other geometrical and time-dependent conditions. It is also possible to add some symbols or drawings to represent the defined conditions. GiD gives the opportunity of working with units when defining the properties of the mentioned data, but there must be a configuration file where it could be found the definition of the units systems.It must be also defined the way that all this data must be written inside a file that will be the input file to be read by the corresponding solver.

The creation of a Problem Type implies the creation of a directory with the Problem's Type name and the extension .gid. This directory can be located in the current working directory or in the main GiD executable directory. The first case, the creation inside the current working directory, can be useful during the development of the project. Once it is finished, it can be advisable to move the directory to the one where GiD is stored; like this, your Problem Type will be added to those included in the system and it will appear in the GiD menu (see section Problem type). In both cases, the series of files must be inside the problem type directory. The name for most of them will be composed by the same problem type's name and an extension referring to their function. Considering problem_type_name to be the name of the Problem Type and project_name the name of the project, the diagram of the file configuration is the following:



Files problem_type_name.sim, ***.geo and ***.bas are not mandatory and can be added to facilitate the visualization (files problem_type_name.sim and ***.geo) or to prepare the data input for the restart in additional files (files ***.bas). In the same way problem_type_name.xml is not necessary, it can be used to customize features such as: version info, icon identification, password validation, etc.



Configuration Files

These files generate the conditions and material properties, as well as the proper general problem and intervals data to be transferred to the mesh, giving at the same time the chance to define geometrical drawings or symbols to represent some conditions on the screen.



XML file

The file <problem type>.xml contains information related with the configuration of the problem type such as file browser, icon, password validation or message catalog location. Besides this file can be used for the problem type in order to store assorted structured infomation such as version number, news added from the last version, and whatever the developer decide to include. This file can be read using the tcl extension tcom which is provided with GiD.

The data included inside the xml file should follow the following structure:

<Infoproblemtype version="1.0">
<Program>
</Program>
</Infoproblemtype>

We suggest to include the following nodes (the value of the nodes are just examples):

ValidatePassword node

The default behaviour taken by GiD when validating a problem type password if verifying if it is not empty. Also when a password is considered as valid then this information is writen in the file password.txt where the file is located relative to the problem type directory. In order to override this behaviour 2 nodes are provided in the .xml file

Conditions file (.cnd)

The file with extension's name .cnd contains all the information about the conditions that can be applied to different entities. The condition can adopt different field values for every entity. This type of information includes, for instance, all the displacement constraints and applied loads in a structural problem or all the prescribed and initial temperatures in a thermical analysis.

An important characteristic of the conditions is that they must define over what kind of entity are going to be applied, i.e., over points, lines, surfaces, volumes or layers and over what kind of entity will be transferred, i.e., over nodes, over face elements or over body elements.

Note: For backwards compatibility, it is accepted the possibility over elements, that will transfer either to elements or to faces of higher level elements.

Another important feature is that all the conditions can be applied to different entities with different values for all the defined intervals of the problem.

Therefore, a condition can be considered as a group of fields containing the name of the referred condition, the geometric entity over which it is applied, the mesh entity over which it will be transferred, its corresponding properties and their values.

The format of the file is as follows:

CONDITION: condition_name
CONDTYPE: 'over' ('points', 'lines', 'surfaces', 'volumes', 'layer')
CONDMESHTYPE: 'over' ('nodes', 'face elements','face elements multiple', 'body elements')
QUESTION: field_name['#CB#'(...,optional_value_i,...)]
VALUE: default_field_value
  ...
QUESTION: field_name['#CB#'(...,optional_value_i,...)]
VALUE: default_field_value
END CONDITION

CONDITION: condition_name
  ...
END CONDITION

Note: #CB# means Combo Box.

Note that this file format does not permit to put blank lines between the last line of a condition definition, END CONDITION, and the first one of the next condition definition.



Local Axes

QUESTION: field_name['#LA#'('global', 'automatic', 'automatic alternative')]
VALUE: default_field_value

This type of field makes reference to the local axes system to be used. The position of the values indicates the kind of local axes.

If it only has a single default value, this will be the name of the global axes. If two values are given, the second one will reference a system that will be automatically computed for every node and that will depend on the geometric constraints, like tangencies, orthogonalities, etc. If a third value is given, it will be the name of the automatic alternative axes, which are the automatic axes rotated 90 degrees.

All the different user defined systems will be added automatically to these default possibilities.

To enter only a specific kind of local axes it's possible to use the modifiers #G#,#A#,#L#.

When using these modifiers the position of the values doesn't indicate the kind of local axes.

Example

QUESTION: Local_Axes#LA#(Option automatic#A#,Option automatic_alt#L#)
VALUE: -Automatic-



Note: All the fields must be fulfilled with words, considering as a word a character string without any blank space amongst them. The strings signaled between quotes are literal and the ones inside brackets are optional. The interface is case-sensitive, so the uppercase letters must be maintained. Default_field_value and different optional_value_i can be alphanumeric, integers or reals. GiD treats them as alphanumeric until the moment that are written to the solver input files.

Note: The numbers of the conditions must be consecutive, beginning with number 1. There is no need to point out the overall number of conditions or the respective number of fields for each one. This last one can be variable for each condition.

One optional flag to add to a condition is:

CANREPEAT: yes

It is written after CONDMESHTYPE and means that user can assign one condition several times to the same entity.

Another type of field that can be included inside a condition is:

QUESTION: Surface_number#FUNC#(NumEntity)
VALUE: 0

Where the key #FUNC#, means that the value of this field will be calculated just when the mesh is generated. It can be considered a function that evaluates when meshing. In the example above, NumEntity is one of the possible variables of the function. It will be substituted by the label of the geometry entity from where the node or element is generated.

QUESTION: X_press#FUNC#(Cond(3,REAL)*(x-Cond(1,REAL))/(Cond(2,REAL)-Cond(1,REAL)))
VALUE: 0

In this second example, x variable is used, which means the x-coordinate of the node or of the center of the element. Others fields of the condition can also be used in the function. Variables y and z give the y ans z-coordinate of this point.

Note: There are other available options to expand the capabilities of the conditions window. (see section Special fields)



Example: Creating the conditions file

Next is an example of a condition file creation, explained step by step:

  1. First, you have to create the folder or directory where all the problem type files are located, problem_type_name.gid/ on this case.

  2. Then create and edit the file (problem_type_name.cnd on this example) inside the recently created directory (where all your problem type files are located). As you can see, except for the extension, the name of the file and the directory are the same.

  3. Create the first condition, which starts with the line
    CONDITION: Point-Constraints 
    
    The parameter is the name of the condition. A unique condition name into this condition file is required.

  4. This first line is followed by the next pair:
    CONDTYPE: over points
    CONDMESHTYPE: over nodes
    
    which declare over what entity is going to be applied the condition. The first line, CONDTYPE:... refers to the geometry, and may take as parameters the sentences "over points", "over lines", "over surfaces" or "over volumes".

    The second line refers to the type of condition applied to the mesh, once generated. GiD does not force to provide this second parameter, but if it is present, the treatment and evaluation of the problem will be more acurate. The available parameters for this statement are "over nodes" and "over elements".

  5. Then, you'll have to declare a set of questions and values applied to this condition.
    QUESTION: Local-Axes#LA#(-GLOBAL-)
    VALUE: -GLOBAL-
    QUESTION: X-Force
    VALUE: 0.0
    QUESTION: X-Constraint:#CB#(1,0)
    VALUE: 1
    QUESTION: X_axis:#CB#(DEFORMATION_XX,DEFORMATION_XY,DEFORMATION_XZ)
    VALUE: DEFORMATION_XX
    
    END CONDITION
    
    After the QUESTION: word you have the choice of put:
    • An alphanumeric field name followed by the #LA# statement, and then the single or double parameter.
    • An alphanumeric field name.
    • An alphanumeric field name followed by the #CB# statement, and then the optional values between parenthesis.

    The VALUE: word must be followed by one of the optional values, if you have declared them in the previous QUESTION: line. If you don't follow this statement, the program may not work correctly.

    In the previous example, the X-Force QUESTION takes the value 0.0. Also in the example, the X-Constraint QUESTION includes a combo box statement (#CB#), followed by the declaration of the choices 1 and 0. In the next line, the value takes the parameter 1. The X_axis QUESTION declares three items for the combo box DEFORMATION_XX,DEFORMATION_XY,DEFORMATION_XZ, with the value DEFORMATION_XX chosen.

    Beware of leaving blank spaces between parameters. If in the first question, you put the optional values (-GLOBAL, -AUTO-), (note the blank space after the comma), there will be an error when reading the file. Take this precaution specially in the Combo Box question parameters, to avoid unpredictable parameters.

  6. The management of the conditions defined in the .cnd file, is done in the Conditions window (found in the Data menu), in the preprocess of GiD.


Conditions edition window on Preprocess, showing an unfolded combo box



Materials file (.mat)

This file NAME.mat include originally the definition of different materials through their properties. These are base materials as they can be used as templates during the pre-processing step for the creation of newer ones.

The user can define as many materials as desired and with a variable number of fields. All the unused materials will not be taken in consideration when writing the data input files for the solver. Alternatively, they can be useful to generate a materials library.

Conversely to the case of conditions, the same material can be assigned to different geometrical entities levels (lines, surfaces or volumes) and even can be assigned directly to the mesh elements.

In a similar way as a condition was defined, a material can be considered as a group of fields containing its name, its corresponding properties and their values.

The format of the file is as follows:

MATERIAL: material_name
QUESTION: field_name['#CB#'(...,optional_value_i,...)]
VALUE: default_field_value
  ...
QUESTION: field_name['#CB#'(...,optional_value_i,...)]
VALUE: default_field_value
END MATERIAL

MATERIAL: material_name
  ...
END MATERIAL

If a property of a material change depending on something (one example would be one property depending on the temperature and defined with several values for several temperatures), a table of changing values may be declared for this property. When the solver evaluates the problem, it reads the values and apply the suitable property value.

The declaration of the table requires a pair of lines:

First, a QUESTION line with a list of alphanumeric values between parenthesis.

QUESTION: field_name:(...,optional_value_i,...)

This values are the name of each of the columns in the table, and the number of values declared are the number of columns.

This first line is followed by the actual data declaration: a line started with the words VALUE: #N# is followed by a number that indicates the quantity of elements in the matrix and, finally, the list of values.

VALUE: #N# number_of_values ... value_number_i ...

The number of values declared for the matrix, obviously, has to be the multiplication of the number of columns by the number of rows to be declared.

The usual case of application of this declaration is on the thermo-mechanical simulations, where the problem is exposed to a temperature variation, and the properties of the materials change for each temperature value.

All the fields must be filled with words, considering a word as a character string without any blank space amongst them. The strings signaled between quotes are literal and the ones within brackets are optional. The interface is case-sensitive, so the uppercase letters must be maintained. Default_field_value and different optional_value_i can be alphanumeric, integers or reals, depending on the type.

The numbers of the materials have to be consecutive, beginning with number 1. There is no need to point out the overall number of materials or the respective number of fields for each one. This last one can be variable for each material.

Note that in this file it's not permitted the inclusion of blank lines between material definitions neither between questions and values.

Note: There are other available options to expand the capabilities of the materials window. (see section Special fields)



Example: Creating the materials file

Next is an example of a materials file creation, explained step by step:

  1. Create and edit the file (problem_type_name.mat on this example) inside the problem_type_name directory (where all your problem type files are located). As you can see, except for the extension, the name of the file and the directory are the same.

  2. Create the first material, which starts with these lines:
    MATERIAL: Air 
    
    The parameter is the name of the material. A unique material name into this material file is required (do not use blank spaces in the name of the material.)

  3. The next two lines define a property of the material and its default value:
    QUESTION: Density
    VALUE: 1.0
    
    You can add as many properties as you want. To end the material definition, add the following line:
    END MATERIAL
    

  4. In this example we have introduced some materials; the .mat file would be as follows:
    MATERIAL: Air
    QUESTION: Density
    VALUE: 1.01
    END MATERIAL
    
    MATERIAL: Steel
    QUESTION: Density
    VALUE: 7850
    END MATERIAL
    
    MATERIAL: Aluminium
    QUESTION: Density
    VALUE: 2650
    END MATERIAL
    
    MATERIAL: Concrete
    QUESTION: Density
    VALUE: 2350
    END MATERIAL
    
    MATERIAL: Water
    QUESTION: Density
    VALUE: 997
    END MATERIAL
    
    MATERIAL: Sand
    QUESTION: Density
    VALUE: 1370
    END MATERIAL
    
  5. The management of the materials defined in the .mat file, is done in the Materials window (found in the Data menu), in the preprocess of GiD.



Materials edition window on the GiD Preprocess



Problem and intervals data file (.prb)

The file NAME.prb contains all the information about the general problem and intervals data. The general problem data is all the information required for performing the analysis and it does not concern any particular geometrical entity. This differs from the previous definitions of conditions and materials properties, which are assigned to different entities. Example of general problem data can be the type of solution algorithm used by the solver, the value of the various time steps, convergence conditions and so on.

Within this data, the user may consider the definition of specific problem data (for the whole process) and intervals data (variable values along the different solution intervals). An interval would be the subdivision of a general problem that contains its own particular data. Typically, one can define a different load case for every interval or, in dynamic problems, not only variable loads, but also changing the various time steps, convergence conditions and so on.

The format of the file is as follows:

PROBLEM DATA
QUESTION: field_name['#CB#'(...,optional_value_i,...)]
VALUE: default_field_value
  ...
QUESTION: field_name['#CB#'(...,optional_value_i,...)]
VALUE: default_field_value
END PROBLEM DATA

INTERVAL DATA
QUESTION: field_name['#CB#'(...,optional_value_i,...)]
VALUE: default_field_value
  ...
QUESTION: field_name['#CB#'(...,optional_value_i,...)]
VALUE: default_field_value
END INTERVAL DATA

All the fields must be filled with words, considering a word as a character string without any blank space amongst them. The strings signaled between quotes are literal and the ones inside brackets are optional. The interface is case-sensitive, so the uppercase letters must be maintained. Default_field_value and different optional_value_i can be alphanumeric, integers or reals, depending on the type.

Note: There are other available options to expand the capabilities of the Problem Data window. (see section Special fields)



Example: Creating the PRB data file

Next is an example of a problem data file creation, explained step by step:

  1. Create and edit the file (problem_type_name.prb on this example) inside the problem_type_name directory (where all your problem type files are located). Except for the extension, the name of the file and the directory must be the same.

  2. Start the file with this line:
    PROBLEM DATA 
    

  3. Then, add the following lines:
    QUESTION: Unit_System#CB#(SI,CGS,User)
    VALUE: SI
    
    QUESTION: Title
    VALUE: Default_title
    
    The first question defines a combo style menu called Unit_System, which has the SI option selected by default. The second question defines a text field called Title, and its default value is Default_title.

  4. To finish the file, add the following line:
    END PROBLEM DATA
    

  5. The whole file is as follows:
    PROBLEM DATA
    QUESTION: Unit_System#CB#(SI,CGS,User)
    VALUE: SI
    QUESTION: Title
    VALUE: Default_title
    END GENERAL DATA
    
  6. The management of the options defined in the .prb file, is done in the Problem Data window (found in the Data menu), in the preprocess of GiD.



Problem Data window on the GiD Preprocess



Conditions symbols file (.sim)

This file NAME.sim comprises different symbols to represent some conditions during the pre-processing stage. The user may define these symbols by creating, ad hoc, geometrical drawings and the appropriate symbol will appear over the entity with the applied condition every time the user asks for it.

One or more symbols can be defined for every condition and the selection will depend on the specified values in the file, which may be obtained through mathematical conditions.

Also the spatial orientation can be defined in this file, depending on the values taken by the required data. For global definitions, the user must input the three components of a vector to express its spatial direction. GiD takes these values from the corresponding conditions window. The orientation of the vector can be understood as the rotation from vector (1,0,0) towards the new vector defined in the file.

For line and surface conditions, the symbols may be considered as local. In this case, GiD does not consider the defined spatial orientation vector and it takes its values from the line or surface orientation. The orientation assumes vector (1,0,0) to be the corresponding entity's normal.

These components, making reference to the values obtained from the adequate conditions, may include C-language expressions. They express the different field values of the mentioned condition as cond(type,i), where type (real or int) makes reference to the type of variable (independent of the letters case) and i is the number of the field for that particular condition.



Example: Creating the Symbols file

Next is an example of a symbol file creation. Create and edit the file (problem_type_name.sim on this example) inside the problem_type_name directory (where all your problem type files are located). Except for the extension, the name of the file and the directory must be the same.

The contents of the problem_type_name.sim example should be the following:

cond Point-Constraints
3
global
cond(int,5)
1
0
0
Support3D.geo
global
cond(int,1) && cond(int,3)
1
0
0
Support.geo
global
cond(int,1) || cond(int,3)
cond(int,3)
cond(int,1)*(-1)
0
Support-2D.geo
cond Face-Load
1
local
fabs(cond(real,2))+fabs(cond(real,4))+fabs(cond(real,6))>0.
cond(real,2)
cond(real,4)
cond(real,6)
Normal.geo

This is a particular example of the file .sim where the user has defined four different symbols. Each one is read from a file ***.geo. There is no indication of how many overall symbols are implemented. GiD simply reads all the file long through the end.

The files ***.geo are obtained through GiD. The user may design a particular drawing to symbolize a condition and this drawing will be stored as PROBLEMNAME.geo when saving this project as PROBLEMNAME.gid. The user needs not to be concerned about the symbol size but has to keep in mind that the origin corresponds to the point (0,0,0) and the reference vector is (1,0,0). Subsequently, when these files ***.geo are invoked from problem_type_name.sim, the symbol drawing, appears scaled on the display, at the entities location.

Nevertheless, the number of symbols and consequently, the number of files ***.geo, can vary from a condition to another. In the previous example, for instance, the condition called Point-Constraints, which is so declared by the use of cond, comprises three different symbols. GiD knows that from the number 3 written below the condition's name. Next, GiD reads if the orientation is relative to the spatial axes (global) or moves together with its entity (local). In the example, the three symbols concerning point constraints are globally oriented.

Let's imagine that this condition has six fields. First, third and fifth field values express if there exist constraints along X-axis, Y-axis and Z-axis, respectively. These values are integers and in case they were null, the concerned degree of freedom would be assumed to be unconstrained.

For the first symbol, got from the file Support3D.geo, GiD reads cond(int,5), or Z-constraint. If it is false, what means that the field's value is zero, the C-condition will not be accomplished and GiD will not draw it. Otherwise, the C-condition will be accomplished and the symbol will be invoked. When this occurs, GiD skips the rest of symbols related to this condition. Its orientation will be the same of the original drawing because the spatial vector is (1,0,0).

All the considerations are valid for the second symbol, got from the file Support.geo, but now GiD has to check that both constraints (&&), X-constraint and Y-constraint are fixed (values different from zero).

For the third symbol, got from the file Support-2D.geo, only one of them has to be fixed (||) and the orientation of the symbol will depend on which one is free and which one is fixed, showing on the screen the corresponding direction for both degrees of freedom.

Finally, for the fourth symbol, got from the file Normal.geo, it can be observed that the drawing of the symbol, related to the local orientation will appear scaled according to the real-type values of the second, fourth and sixth fields values. Different ways of C-language expressions are available in GiD. Thus, the last expression would be equivalent to put '(fabs(cond(real,2))>0. || fabs(cond(real,4))!=0. || fabs(cond(real,6))>1e-10)'.

Note: As previously mentioned, GiD internally creates a PROJECTNAME.geo when saving a project, where it keeps all the information about the geometry in binary format. In fact, this is the reason why the extension of these files is .geo. However, the file PROJECTNAME.geo is stored in the PROJECTNAME.gid directory, whereas these user-created files ***.geo are stored in the problem_type_name.gid directory, being problem_type_name the problem's name.



Unit System file (.uni)

When GiD is installed, the file units.gid is copied within the GiD directory. In this file it's defined a table of magnitudes. For each magnitude there is a set of units and a conversion factor between the unit and the reference unit. Also are defined the units systems. An unit system is a set of mangnitudes and the corresponding unit.

BEGIN TABLE
 LENGTH : m {reference}, 100 cm, 1e+3 mm
 ...
 STRENGTH : kg*m/s^2 {reference}, N, 1.0e-1 kp
END

BEGIN SYSTEM(INTERNATIONAL)
 LENGTH : m
 MASS : kg
 STRENGTH : N
 ...
 TEMPERATURE : C
END

The syntax of the unit file (problem_type_name.uni) within the problem type is similar. Besides, it could include the line:

USER DEFINED: ENABLED 
(or DISABLED)

meaning that the user is able (or not) to define it's own system unit within the project. If the line does not appear in the file then, it's assumed as having the value ENABLED

It is possible to ignore all units systems defined by default inside the file units.gid:

USE BASE SYSTEMS: DISABLED
(or ENABLED)

Some magnitudes can be hidden to the user in the units window with this order: HIDDEN: 'magnitude', 'magnitude'

HIDDEN: strength, pressure

If the problem type uses a property which has a unit, then GiD creates the file project_name.uni in the project directory. This file includes the information related to the unit used in the geometric model and the unit system used. The structure of this file is:

MODEL: km

PROBLEM: USER DEFINED

BEGIN SYSTEM
 LENGTH: m
 PRESSURE: Pa
 MASS: kg
 STRENGTH: N
END

In this file, MODEL refers to the unit of the geometric model, PROBLEM is the name of the units system used by GiD to convert all the data properties in the output to the solver. If this name is USER DEFINED, then the system is the one defined within the file. The block

BEGIN SYSTEM 
 ...
END

corresponds to the user defined system.



Data unit window



Special fields

These fields are useful in order to organize the information within the data files. They make the information showed on the data windows nicest and more readable. In this way the user can concentrate just on the data properties concerning the current context.



Template File

Once the user has generated the mesh, assigned the conditions and the materials properties, as well as the general problem and intervals data for the solver, it is necessary to produce the data input files to be processed by that program.

To manage this reading, GiD has the capability of interpret a file called problem_type_name.bas (where problem_type_name is the name of the working directory of the Problem Type without the .bas extension).

This file (template file) describes the format and structure of the required data input file for the solver that is used in a particular case. This file must remain in the problem_type_name.gid directory, as well as the other files already described, problem_type_name.cnd, problem_type_name.mat, problem_type_name.prb and also problem_type_name.sim and ***.geo, if desired.

In case more than one data input file is needed, GiD allows the creation of more files by means of additional files ***.bas (note that while problem_type_name.bas creates an data input file named project_name.dat, successive files ***.bas, -where *** can be any name-, create successive files project_name-1.dat, project_name-2.dat and so on), the new files follow the same rules than the ones explained next for problem_type_name.bas.



These files work as interface from the GiD's standard results to the specific data input for any individual solver module. This allows to complete the process of running the analysis (see section CALCULATE) as one step more within the system.

In case of an error in the preparation of the data input files, the programmer has only to fix the corresponding file problem_type_name.bas or ***.bas and rerun the example, without having to leave GiD, recompile or, even more, reassign any data or remesh.

This facility is due to the structure of the template files. They are a group of macros (like an ordinary programming language) that can be read, without need of any compiler, every time the corresponding analysis file is to be written. This ensures a fast way to debug mistakes.



General description

All the rules that apply to the file NAME.bas are also valid for the rest of files with extension .bas. Thus, everything in this section will refer explicitly to the file NAME.bas. Any information written into this file, apart from the so-called commands, is reproduced exactly in the output file (the data input file for the numerical solver). The commands are words that begin with the character *. If the programmer wants to write an asterisk into the file he should write **. The commands are inserted among the text to be literally translated. Everyone of these commands returns one (see section Single value return commands) or multiple (see section Multiple values return commands) values obtained from the pre-processing. Other commands mimic the traditional structures to do loops or conditionals (see section Specific commands). It is also possible to create variables to manage some data. Comparing it to a classic programming language, the main differences will be the following:

The arguments that appear in a command are written immediately behind it and inside parenthesis. If there are more than one, they will be separated by commas. The parenthesis might be put without any argument inside. This is useful to write something just behind the command without any separation in the middle. The arguments can be real numbers or integers, meaning the word REAL or the word INT (both in upper or lowercase) that the value to which it points has to be considered as real or integer, respectively. Other types of arguments are sometimes allowed, like the type of element, described by its name, in the command *set elem, or a chain of characters inserted between double quotes " for the C-instructions strcmp and strcasecmp. It is also possible, sometimes, to write the field's name instead of its ordering number.

EXAMPLE:

Next it's showed a piece of what it could be a .bas file. There are two commands (*nelem and *npoin) which return the total number of elements and nodes of a project.

%%%% Problem Size %%%%
Number of Elements & Nodes:
*nelem *npoin

This .bas file will be converted into a project_name.dat file by GiD. The contents of the project_name.dat file could be something like this:

%%%% Problem Size %%%%
Number of Elements & Nodes:
5379 4678

(being 5379 the number of elements of the project, and 4678 the number of nodes)



Commands used in the .bas file



Single value return commands

When writing a command, it is generally (if not explicitly mentioned) independent of the letters case, even a mixture of uppercase or lowercase would not affect the results.



Multiple values return commands

These commands return more than one value in a prescribed order, writing them one behind another. All of them, but LocalAxesDef, are able to return one single value when a numerical argument giving the order of the value is added to the command. In this way, these commands can appear within an expression. LocalAxesDef or the rest of the commands without the numerical argument cannot be used inside expressions. Following, it is displayed a list of the commands with the appropriate description:



Specific commands

The following commands must be written at the beginning of a line and the rest of the line will serve for their modifiers. No additional text should be written.



Detailed example - Template file creation

Next is an example of template file creation, step by step:

Note that this is a concrete file for a particular solver, so it's a sure state that some or all of the commands that this solver program expects, will be non standard or incompatible with the one that another user owns.

In this example, this particular solver treats a line like a comment, inside the calculation input file, if its prefix is a $ sign. In your case, it can be another convention.

Anyway, the actual target of this example is the comprehension of the commands that GiD exposes to the user. This is the universal method to access to GiD's internal database, and then output the desired data to the solver.

Also, it's assumed that the user will create the file or files with .bas extension, inside the working directory where the problem type file is located. The name must be problem_type_name.bas for the first file and any other name for the additional .bas files. Each .bas file will be read by GiD, and translated to a .dat file.

It is very important to remark that any word in the .bas file having no meaning as a GiD compilation command or not belonging to any command instructions (parameters), will be verbatim written to the output file.

First, we create the header that the solver, on this particular case, needs.

This is the name of the solver application and a brief description of its behaviour.

$-----------------------------------------------------
CALSEF: PROGRAM FOR STRUCTURAL ANALYSIS

Then, another particular sentence that may be incompatible in your case, although a similar one may exist for your solver. It's a commented line with the ECHO ON command. This line, when uncommented, is useful if you want to monitor the progress of the calculation.

$-----------------------------------------------------
$ECHO ON

The next line specifies the type of calculation and the materials involved on the calculation, and it's not a GiD related command either.

$-----------------------------------------------------
ESTATICO-LINEAL, EN SOLIDOS

As you can see, it's used a commented line with dashes to separate the different parts of the file improving the readability of the text.

Here comes the initialization of some variables. This is needed by the solver to start the calculating process.

The following assignments take the first (parameter (1)) and second (parameter (2)) fields in the general problem, as the number of problems and the title of the problem.

The actual position of a field is determined checking its order on the problem file, so you will guess this is a method that depends on a strict position.

Assignment of the first (1) Field of the Problem data file, with the command *GenData(1):

$-----------------------------------------------------
$NUMBER OF PROBLEMS:
NPROB = *GenData(1)
$-----------------------------------------------------

Assignment of the second (2) field assignment, *GenData(2):

$ TITLE OF THE PROBLEM:          
TITULO= *GenData(2)
$-----------------------------------------------------

The next instruction takes the field where the starting time is saved. On this case, it is on the 10th position of the general problem data file, but we will use another feature of the *GenData command, the parameter of the command will be the name of the field.

This is a preferable method, because if the list is shifted due to the adding or subtracting of a field, you will not loose the actual position. This command accepts an abbreviation, if there is no conflict with other field name.

$-----------------------------------------------------
$ TIME OF START:          
TIME= *GenData(Starting_time)
$-----------------------------------------------------

Here comes the init of some general variables refering to the project we are considering, as the number of points, the number of elements or the number of materials.

The first line is a description of the section.

$ DIMENSIONS OF THE PROBLEM:

Then it is a line that introduces the next assignments

DIMENSIONS :  

Which is followed by another one with the three assignments of variables. NPNOD gets, from the *npoin function, the number of nodes of the model; NELEM gets, from *nelem, or the total number of elements of the model or the number of elements of every kind of element and nmats is initialized with the number of materials:

 NPNOD= *npoin,   NELEM= *nelem,   NMATS= *nmats,   \

Then comes a line where NNODE gets the maximum number of nodes per element and NDIME gets the variable *ndime. This variable must be a number that specifies if all the nodes are on the plane whose Z values are equal to 0 (NDIME=2) or if they are not (NDIME=3):

NNODE= *nnode,   NDIME= *ndime,                    \ 

The next lines take data from the general data fields in the problem file. NCARG gets the number of charge cases; NGDLN the number of degrees of freedom; NPROP the properties number; NGAUSS the gauss number; NTIPO, is assigned dynamically:

NLOAD= *GenData(Load_Cases), *\

You could use NGDLN= *GenData(Degrees_Freedom), *\, but because the length of the argument will make exceed a line, we have abbreviated its parameter (there is no conflict with other question name in this problem file), to simplify the command.

NGDLN= *GenData(Degrees_Fre), *\
NPROP= *GenData(Properties_Nbr), \
NGAUS= *GenData(Gauss_Nbr) , NTIPO= *\

Note that the last assignment is ended with the specific command *\, to avoid the line feeding. This permits to include a conditional assignment of this variable, depending on the data in the General data problem.

Inside the conditional it is used a C format like strcmp instruction. This instruction compares the two strings passed as parameter, and returns an integer number which express the relationship between the two strings. If the result of the operation is equal to 0, the two strings are identical; if it is a positive integer, the first argument is greater than the second, and otherwise, the second argument string is less.

The script checks what problem type is declared in the general data file, and then it assigns the coded number for the this type to the NTIPO variable:

*if(strcmp(GenData(Problem_Type),"Plane-stress")==0)
1 *\
*elseif(strcmp(GenData(Problem_Type),"Plane-strain")==0)
2 *\
*elseif(strcmp(GenData(Problem_Type),"Revol-Solid")==0)
3 *\
*elseif(strcmp(GenData(Problem_Type),"Solid")==0)
4 *\
*elseif(strcmp(GenData(Problem_Type),"Plates")==0)
5 *\
*elseif(strcmp(GenData(Problem_Type),"Revol-Shell")==0)
6 *\
*endif

You have to cover all the cases within the if sentences, or end the commands with an else, if you don't want unpredictable results, like the next line raised to the place where the parameter will have to be:

$ Default Value:
*else
0*\
*endif

Although in our case this last rule has not been followed, it could be a very good option, when the problem file has been modified or created by another user, and the new specification may differ from the one we expect.

The next assignment is formed by a string compare conditional, to inform the solver about a setting of the configuration.

First is the output of the variable to be assigned.

, IWRIT= *\

Then there is a conditional where it's compared the string contained on the value of the Result_File field with the string "Yes". If the result is 0, then the two strings are the same, and we output an 1, to declare a boolean TRUE.

*if(strcmp(GenData(Result_File),"Yes")==0)
1 ,\

Then we compare the same value string with the string "No", to check the complementary option. If we find that the strings match, then we output a 0.

*elseif(strcmp(GenData(Result_File),"No")==0)
0 ,\
*endif

The second last assignment is a simple output of the solver field contents into the INDSO variable:

             INDSO= *GenData(Solver) , *\

The last assign is a little more complicated. It requires the creation of some internal values, with the aid of the command *set cond.

The first action to execute is to set the conditions, so we can access its parameters. This setting may serve for several loops or instructions, as long as the parameters needed for the other blocks of instructions are the same.

This line sets the condition Point-Constraints as an active condition. The *nodes modifier means that the condition will be listed over nodes. The *or(... modifiers are necessary when an entity shares some conditions, because it belongs to two or more elements.

As an example, take a node which is part of two lines, and each of these lines have assigned a different condition. This node, a common point of the two lines, will have this two conditions into its list of properties. So declaring the *or modifiers, GiD will decide which condition to use, between the list of conditions of the entity.

A first instruction will be this, where the parameters of the *or commands are an integer number ((1, and (3,, respectively on this example) and the specification int, that forces GiD to read the condition whose number position is the integer number.

In our case, we find that the first (1) field of the condition file is X-constraint, and the third (3), is Y-constraint:

Gid still has no support for the substitution of the position of the condition in the file by its corresponding label, as succeeds in the case of the fields of the problem data file.

*Set Cond Surface-Constraints *nodes *or(1,int) *or(3,int)

Now we want to complete the setting of the loop, with the addition of new conditions.

*Add Cond Line-Constraints *nodes *or(1,int) *or(3,int)
*Add Cond Point-Constraints *nodes *or(1,int) *or(3,int)

Observe the order in which the conditions have been included: first the surface constraints with the *Set Cond command, since it is the initial sentence. Then the pair of *Add Cond sentences, the line constraints and as the last one, the point constraints sentence. This logical hierarchy forces the points as the most important items, due to the fact that the program takes

Finally, we set a variable with the number of entities assigned to this particular condition.

Note that the execution of this instruction is only possible if a condition has been set previously.

NPRES= *CondNumEntities

To end this section, we put a separator on the output file:

$-----------------------------------------------------

Thus, after the init of those variables, this part of the file ends up as:

$ DIMENSIONS OF THE PROBLEM:
DIMENSIONES :
 NPNOD= *npoin,  NELEM= *nelem,  NMATS= *nmats,     \
 NNODE= *nnode,  NDIME= *ndime,                     \
 NCARG= *GenData(Charge_Cases), *\
 NGDLN= *GenData(Degrees_Fre), *\
 NPROP= *GenData(Properties_Nbr), \
 NGAUS= *GenData(Gauss_Nbr) , NTIPO= *\
*if(strcmp(GenData(Problem_Type),"Tens-Plana")==0)
1 *\
*elseif(strcmp(GenData(Problem_Type),"Def-Plana")==0)
2 *\
*elseif(strcmp(GenData(Problem_Type),"Sol-Revol")==0)
3 *\
*elseif(strcmp(GenData(Problem_Type),"Sol-Tridim")==0)
4 *\
*elseif(strcmp(GenData(Problem_Type),"Placas")==0)
5 *\
*elseif(strcmp(GenData(Problem_Type),"Laminas-Rev")==0)
6 *\
*endif
, IWRIT= *\
*if(strcmp(GenData(Result_File),"Yes")==0)
1 ,\
*elseif(strcmp(GenData(Result_File),"No")==0)
0 ,\
*endif
   INDSO= *GenData(Solver) , *\
*Set Cond Surface-Constraints *nodes *or(1,int) *or(3,int)
*Add Cond Line-Constraints *nodes *or(1,int) *or(3,int)
*Add Cond Point-Constraints *nodes *or(1,int) *or(3,int)
NPRES=*CondNumEntities
$-----------------------------------------------------

After creation or reading of our model, once generated the mesh and applied the conditions, we can export the file (file project_name.dat) and send it to the solver.

The command to create the .dat file can be found on the File / Export / Calculation File GiD menu. It's also possible to use the keyboard shortcut Control-x Control-c

This would be the contents of the project_name.dat file:

$-----------------------------------------------------
CALSEF: PROGRAM FOR STRUCTURAL ANALYSIS
$-----------------------------------------------------
$ECHO ON
$-----------------------------------------------------
LINEAR-STATIC, SOLIDS
$-----------------------------------------------------
$NUMBER OF PROBLEMS:
NPROB = 1
$-----------------------------------------------------
$ PROBLEM TITLE           
TITLE= Title_name
$-----------------------------------------------------
$DIMENSIONS OF THE PROBLEM
DIMENSIONS :
  NPNOD=    116 ,  NELEM= 176 ,   NMATS=  0 ,     \
  NNODE=      3 ,  NDIME=   2 ,                   \ 
  NCARG=      1 ,  NGDLN=   1 ,   NPROP=  5 ,     \
  NGAUS=      1 ,  NTIPO=   1 ,   IWRIT=  1 ,     \
  INDSO=     10 ,  NPRES=   0
$-----------------------------------------------------

Here begins the calculation input, the actual starting of data transfer



A) Elements, materials and connectivities listing

Now we want to output the desired results to the output file. This first line, apparently a title or label, is the way that offers the solver, in this example, to determine the beginning and end of a loop section. This block of instructions ends with the next END_GEOMETRY sentence, also for this example.

GEOMETRY 

Here, we introduce an user informative couple of lines.

A title of the first subsection, ELEMENTAL CONNECTIVITIES:

$ ELEMENTAL CONNECTIVITIES

And here is the header that precedes the output list, a user oriented data:

$ ELEM. MATER.    CONNECTIVITIES

And then we travel trough the elements of the model, by the action of the *loop instruction, followed in this case by the elems argument.

*loop elems

For each element in the model, GiD will output: its element number, by the action of the *elemsnum command, the material assigned to this element, using the *elemsmat command, and the connectivities associated to the element, with the command *elemsConec:

  *elemsnum *elemsmat *elemsConec
*end elems

You can use the parameter swap if you are working with quadratic elements and the listing modes of the nodes is non hierarchical (by default first list corner nodes, and after mid nodes).

  *elemsnum *elemsmat *elemsConec(swap)
*end elems

Here finishes the first part of this section.



B) Formatted nodes and coordinates listing

And here starts the next section NODAL COORDINATES:

$ NODAL COORDINATES

Next is the header of the output list:

$  NODE  COORD.-X   COORD.-Y   COORD.-Z

Now GiD will trace all the nodes of the model:

*loop nodes

For each node in the model, it will generate the output of the number of node, *NodesNum and the coordinates for this node *NodesCoord.

The command executed before the output, *format, will force that the resulting output follow the guidelines of formatting specified.

On this case, the *format command gets a string parameter with a set of codes: %6i, which specify that the first word in the list is coded as a integer and is printed six points from the left, the rest of the three codes, %15.5f, are ordering the printing of a real number, represented on a floating point format, with a distance of 15 spaces between columns (the number will be shifted to have the last digit in the 15th position of the column) and the fractional part of the number will be represented with five digits.

Note that this is the C language format command.

*format "%6i%15.5f%15.5f%15.5f"
  *NodesNum *NodesCoord
*end

And at the end of the section, it's the finishing mark sentence, in this solver example.

END_GEOMETRY

The full set of commands to make this part of the output is showed the next lines.

GEOMETRY
$ ELEMENT CONNECTIVITIES
$ ELEM. MATER.    CONNECTIVITIES
*loop elems
  *elemsnum *elemsmat *elemsConec
*end elems
$ NODAL COORDINATES
$  NODE  COORD.-X   COORD.-Y   COORD.-Z
*loop nodes
*format "%6i%15.5f%15.5f%15.5f"
  *NodesNum *NodesCoord
*end
END_GEOMETRY

The result of the compilation, output to a file (project_name.dat) to be processed by the solver program.

The first part of the section:

$-----------------------------------------------------
GEOMETRY
$ ELEMENT CONNECTIVITIES
$ ELEM. MATER.    CONNECTIVITIES
     1      1     73    89    83
     2      1     39    57    52
     3      1     17    27    26
     4      5      1     3     5
     5      5      3    10     8
     6      2     57    73    67
     .      .      .     .     .
     .      .      .     .     .
     .      .      .     .     .
   176      5     41    38    24

And the second part of the section:

$ NODAL COORDINATES
$  NODE  COORD.-X   COORD.-Y   COORD.-Z
       1         5.55102        5.51020
       2         5.55102        5.51020
       3         4.60204        5.82993
       4         4.60204        5.82993
       5         4.88435        4.73016
       6         4.88435        4.73016
       .         .              .
       .         .              .
       .         .              .
     116        -5.11565        3.79592
END_GEOMETRY

If the solver module you are using needs a list of the nodes that have assigned a condition, like for example, a neighborhood condition, you have to provide it as is explained in the next example:



C) Nodes listing declaration

First, we set the necessary conditions, as it was done in the previous section.

*Set Cond Surface-Constraints *nodes *or(1,int) *or(3,int)
*Add Cond Line-Constraints *nodes *or(1,int) *or(3,int)
*Add Cond Point-Constraints *nodes *or(1,int) *or(3,int)
NPRES=*CondNumEntities

After the data init and declarations, the solver requires a list of nodes, with boundary conditions and the fields that have been assigned

In this example, all the selected nodes will be output, also printing the 3 conditions. The columns will be output with no aparent format:

First, there is a line with the header of the section for the solver program and a commentary line for the user

BOUNDARY CONDITIONS
$ RESTRICTED NODES

Then comes the first line of the output list, the header:

$ NODE CODE         PRESCRIPTED VALUES

Then the loop instruction, over nodes, and with the specification argument *OnlyInCond, to iterate only over the entities that have the condition assigned. This is the condition that has been set on the previous lines.

*loop nodes *OnlyInCond

The next line is the format command, followed by the lines with the commands to fill the fields of the list.

*format "%5i%1i%1i%f%f"
   *NodesNum *cond(1,int) *cond(3,int)  *\

Also into the *format command influence there are the next couple of if sentences. If the degrees of freedom field contains an integer equal or greater than 3, the number of properties will be output.

*if(GenData(Degrees_Freedom_Nodes,int)>=3)
*cond(5,int) *\
*endif

And if the value of the same field is equal to 5 the output will be a pair of zeros.

*if(GenData(Degrees_Free,int)==5)
0 0  *\
*endif

The next line ouputs the values contained in the second and fourth fields, both real numbers.

*cond(2,real) *cond(4,real) *\

In a similar manner as done in the previous if sentences here come a group of lines to output the sixth condition field value, if the number of degrees of freedom is equal or greater than three, and output a pair of zeros if it's equal to five.

*if(GenData(Degrees_Free,int)>=3)
*cond(6,real) *\
*endif
*if(GenData(Degrees_Free,int)==5)
0.0 0.0  *\
*endif

Finally, to end the section, the *end command closes the previous *loop. The last line is the label of the end of the section.

*end
END_BOUNDARY CONDITIONS
$-------------------------------------------------------

The full set of commands included in this section are the next:

BOUNDARY CONDITIONS
$ RESTRICTED NODES
$ NODE CODE         PRESCRIPTED VALUES
*loop nodes *OnlyInCond
*format "%5i%1i%1i%f%f"
   *NodesNum *cond(1,int) *cond(3,int)  *\
*if(GenData(Degrees_Free,int)>=3)
*cond(5,int) *\
*endif
*if(GenData(Degrees_Free,int)==5)
0 0  *\
*endif
*cond(2,real) *cond(4,real) *\
*if(GenData(Degrees_Free,int)>=3)
*cond(6,real) *\
*endif
*if(GenData(Degrees_Free,int)==5)
0.0 0.0  *\
*endif
*end
END_BOUNDARY CONDITIONS
$-----------------------------------------------------

If it is needed the output of a list of the materials



D) Materials listing declaration

As a must, the first lines are the title of the section and a commentary.

MATERIAL PROPERTIES
$ MATERIAL PROPERTIES FOR MULTILAMINATE

Then there is the loop sentence, this time related to materials.

*loop materials

Then comes the line were the number of the material and its different properties are output.

   *matnum() *MatProp(1) *MatProp(2) *MatProp(3) *MatProp(4)

Finally comes the ending of the section.

*end
END_MATERIAL PROPERTIES
$-----------------------------------------------------

The full set of commands is the next:

MATERIAL PROPERTIES
$ MATERIAL PROPERTIES FOR MULTILAMINATE
*loop materials
   *matnum() *MatProp(1) *MatProp(2) *MatProp(3) *MatProp(4)
*end
END_MATERIAL PROPERTIES
$-----------------------------------------------------

If it is needed the output of a list of the elements



E) Elements listing declaration

First, we set the loop to the interval of the data.

*loop intervals

The next couple of lines indicate the starting of one section and the title of the example, taken from the first field in the interval data with an abbreviation on the label. They are followed by a comment explaining the type of data we are using.

LOADS
    TITLE: *IntvData(Charge_case)
$ LOAD TYPE

First, we set the condition as done before. If one condition is assigned twice or more to the same element, without the include of the *CanRepeat parameter in the *Set Cond the condition will appear once, if exists the *CanRepeat parameter, then the number of conditions that will appear is the number of times is the number of times it was assigned to the condition.

*Set Cond Face-Load *elems *CanRepeat

Then, a condition checks if exist any element into the condition.

*if(CondNumEntities(int)>0)

Next is a title of the next section, followed by a comment for the user.

DISTRIBUTED ON FACES
$ LOADS DISTRIBUTED ON ELEMENT FACES

We assign the number of nodes to a variable.

$ NUMBER OF NODES BY FACE  
NODGE =  2  
$ LOADED FACES AND FORCE VALUES
*loop elems *OnlyInCond
      ELEMENT=*elemsnum(), CONNECTIV *globalnodes
      *cond(1) *cond(1)  *cond(2) *cond(2) 
*end
END_DISTRIBUTED ON FACES
*endif

Finally, output of a list of the nodes and conditions



F) Nodes and its conditions listing declaration

As ever, the first thing to do in the setting of the conditions.

*Set Cond Point-Load *nodes

As in the previous section, the next loop will be executed only if exists any condition in the selection.

*if(CondNumEntities(int)>0)

Here starts the loop over the nodes.

PUNCTUAL ON NODES
*loop nodes *OnlyInCond
      *NodesNum *cond(1) *cond(2) *\

The next *if sentences, condition the output writting of the end of the line.

*if(GenData(Degrees_Free,int)>=3)
*cond(3) *\
*endif
*if(GenData(Degrees_Free,int)==5)
0 0  *\
*endif
*end

To end the section, here comes the label and the if closing.

END_PUNCTUAL ON NODES
*endif

Finally, it is written an information label, if the value of the second field in the interval data section, inside the problem file, is equal to "si" (yes).

*if(strcasecmp(IntvData(2),"Si")==0)
SELF_WEIGHT
*endif

After the end of this loop, it comes the label that identifies the end of the forces section, but the actual end of the section will be the next *end command, located some lines after.

END_LOADS

Before the end of the section, nevertheless, we indicate the solver which will be the postprocess file. This information is gathered from the *IntvData command. The argument that this command receives (3) specifies that the name of the file is in the third field of the loop iteration of the interval.

$-----------------------------------------------------
$POSTPROCESS FILE
FEMV = *IntvData(3)

To end the forces interval loop, finally comes the *end command:

$-----------------------------------------------------
*end

Finally, the file is ended with the sentence required by the solver:

END_CALSEF
$-----------------------------------------------------

The preceding section is compiled complete into the following lines:

*Set Cond Point-Load *nodes
*if(CondNumEntities(int)>0)
PUNCTUAL ON NODES
*loop nodes *OnlyInCond
      *NodesNum *cond(1) *cond(2) *\
*if(GenData(Degrees_Free,int)>=3)
*cond(3) *\
*endif
*if(GenData(Degrees_Free,int)==5)
0 0  *\
*endif
*end
END_PUNCTUAL ON NODES
*endif
*if(strcasecmp(IntvData(2),"Si")==0)
SELF_WEIGHT
*endif
END_LOADS
$-----------------------------------------------------
$POSTPROCESS FILE
FEMV = *IntvData(3)
$-----------------------------------------------------
*end
END_CALSEF
$-----------------------------------------------------

With this section ends the template file example.



Executing an external program

Once all the files of the problem type are finished (.cnd, .mat, .prb, .sim, .bas files), you are able to run the solver. It may be interesting 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 the user selects the option CALCULATE in the GiD preprocess this shell script is executed. (see section CALCULATE)

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

If GiD founds 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 more files, names project_name-1.dat ... are used). Next, this shell script will be executed. GiD will assign to this script 3 arguments:

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

Note1: This file must have the executable flag set (see UNIX command chmod) in UNIX systems.

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



Commands accepted by the GiD command.exe

The keywords are the following ones:

Unknown instructions will be executed as if it was an external file.

In the GiD command.exe are not implemented all the possible parameters and modifiers available in the operating system.

Note:
At the moment, command.exe is only used in Windows operating systems, as an alternative to the command.com or cmd.exe. With the GiD command.exe some of the disadvantages of Windows can be avoided (the limited length of the parameters, temporary use of letters of virtual units that sometimes are not possible to eliminate, fleeting appearance of the console window, etc).

If GiD finds the file command.exe, located next to gid.exe, it will be used to interpret the *.bat file of the problem type; if the file command.exe cannot be found, the *.bat file will be interpreted by the windows command.com. If conflicts appear by the use of some instruction still nonimplemented in the GiD command.exe, it's possible to rename the command.exe file, so that GiD doesn't find it, and the operating system command.com is used.




%
Returns the value of a variable.

%number
%name%

Parameters
number
The number is the position (from 0 to 9) of one of the parameters which the *.bat file receives.

name
Is the name of an environment variable. That variable has to be declared with instruction "set".

Note:
GiD sends to the *.bat file three parameters: %1, %2, %3
%1 is the name of the current project (project_name)
%2 is the path of the current project (c:\a\b\c\project_name.gid)
%3 is path of the problem type (c:\a\b\c\problem_type_name.gid )

For example, if GiD is installed in c:\gidwin, the "problemtype" name is cmas2d.gid and the project is test.gid, located in c:\temp (the project is a directory called c:\temp\test.gid with some files inside), parameters will have the following values:

%1 test
%2 c:\temp\test.gid
%3 c:\gidwin\problemtypes\cmas2d.gid

Note: it's possible that the file and directory names of these parameters are in the short mode Windows format. So, parameter %3 would be: c:\GIDWIN\PROBLE~\CMAS2D.GID.

Examples

echo %1 > %2\%1.txt
echo %TEMP% >> %1.txt




Shift
The shift command changes the values of parameters %0 to %9 copying each parameter in the previous one. That is to say, value %1 copy to %0, value %2 copy to %1, etc.

shift

Parameter
None.

Note:
The shift command can be used to create a batch program that accepts more than 10 parameters. If it specifies more than 10 parameters in the command line, those that appear after tenth (%9) will move to parameter %9 one by one.




Rem
Rem is used to include comments in a *.bat file or in a configuration file.

rem [comment]

Parameter
comment
Any character string.

Note:
Some comments are GiD commands.




Chdir (Cd)
Changes to a different directory.

chdir [drive:path] [..]
-or-
cd [drive:path] [..]

Parameters
[drive:path]
Disk and path of the new directory.

[..]
Goes back one directory. For example if you are within the C:\WINDOWS\COMMAND> directory this would take you to C:\WINDOWS>.

Note:
When GiD calls the *.bat file, the path of project is the current path, so it's not necessary to use cd %2 at the beginning of the *.bat file.

Examples

chdir e:\tmp
cd ..




Delete (Del, Erase)
Command used to delete files permanently from the computer.

delete [drive:][path] fileName [fileName]

Parameters
[drive:][path] fileName [fileName]
Parameters specify the location and the name of the file that has to be erased from disk. Several file names can be given.

Note:
Files will be eliminated although they have the hidden or read only flag. Use of wildcards is not allowed. For example del *.* is not valid. File names must be separated by spaces and if the path contains blank spaces, the path should be inside inverted commas (the short path without spaces can also be used).

Examples

delete %2\%1\file.cal
del C:\tmp\fa.dat C:\tmp\fb.dat
del "C:\Program files\test 4.txt"




Copy
Copies one or more files to another location.

copy source [+ source [+ ...]] destination

Parameters
source
Specifies the file or files to be copied

destination
Specifies the filename for the new file(s).

To append files, specify a single file for destination, but multiple files for source (using file1 + file2 + file3 format).

Note:
If the destination file already exists, it will be overwrited without prompting if you wanted to overwrite the file or not. File names must be separated by spaces. If destination only contains the path but not the filename, the new name will be the same as the source filename.

Examples

copy f1.txt f2.txt
copy f1.txt c:\tmp
rem if directory c:\tmp exists, c:\tmp\f1.txt will be created, if it doesn't exist, file c:\tmp will be created.
copy a.txt + b.txt + c.txt abc.txt




Rename (Ren, Move)
Used to rename files and directories from the original name to a new name.

rename [drive:][path] fileName1 fileName2

Parameter
[drive:][path] fileName1 Specifies the path and the name of the file which has to be renamed.

fileName2
Specifies the new name file.

Note:
If the destination file already exists, it will be overwrited without prompting if you wanted to overwrite the file or not. Wildcards are not accepted (*,?), so only one file can be renamed every time. Note that you cannot specify a new drive for your destination. A directory can be renamed in the same way as if it was a file.

Examples

Rename fa.txt fa.dat
Rename "c:\Program Files\fa.txt" c:\tmp\fa.txt
Rename c:\test.gid c:\test2.gid




Mkdir (md)
Allows you to create your own directories.

mkdir [drive:]path
md [drive:]path

Parameter
drive:
Specifies the drive where the new directory has to be created.

path
Specifies the name and location of the new directory. The maximum length of the path is limited by the file system.

Note:
mkdir can be used to create a new path with many new directories.

Examples

mkdir e:\tmp2
mkdir d1\d2\d3




Set
Displays, sets, or removes Windows environment variables.

set variable=[string]

Parameters
variable
Specifies the environment-variable name.

string
Specifies a series of characters to assign to the variable.

Note:
The set command creates variables which can be used in the same way as the variables %0 to %9. Variables %0 to %9 can be assigned to new variables using the set command.

To get the value of a variable, the variable has to be written inside two % symbols. For example, if the environment-variable name is V1, its value is %V1%. Variable names are not case sensitive.

Examples

set basename = %1
set v1 = my text




Echo (@echo)
Displays messages.

echo [message]

message
Specifies the text that will be displayed in the screen.

Note:
The message will not be visible because the console is not visible, GiD hides the console. So that this command it's only useful if the output is redirected to a file (using > or >>). Symbol > sends the text to a new file, and symbol >> sends the text to a file if it already exists. Commands if and echo can be used in the same command line.

Examples

Echo %1 > out.txt
Echo %path% >> out.txt
If Not Exist %2\%1.flavia.res Echo "Program failed" >> %2\%1.err




If
Executes a conditional sentence. If the specified condition is true, the command which follows the condition will be executed; if the condition is false, next line is ignored.

Parameters
not
Specifies that the command has to be executed only if the condition is false.

exist file
Returns true if file exists.

command
Is the command that has to be executed if the condition returns true.

string1==string2
Returns true if string1 and string2 are equal. It's possible to compare two strings, or variables (for example, %1).

errorlevel number
Returns true if the last program executed returned a code equal or bigger to number.

Note:
Exist can also be used to check if a directory exists.

Examples

if exist sphere.igs echo File exists >> out.txt
if not exist test.gid echo Dir doesn't exist >> out.txt
if %1 == test echo Equal %1 >> out.txt




Call
Executes a new program.

call [drive:][path] file [parameters]

Parameter
[drive:][path] file Specifies the location and the name of the program that has to be executed.

parameters
Parameters required by the program executed.

Note:
The program can be *.bat file, a *.exe file or a *.com file. If the program does a recursive call, some condition has to be imposed to avoid an endless curl.

Examples

call test.bat %1
call gid.exe -n -PostResultsToBinary %1.flavia.res %1.flavia.bin




Goto
The execution jumps to a line identified by a label.

goto label

Parameter
label
It specifies a line of the *.bat file where the execution will continue. That label must exist when the Goto command is executed. A label is a line of the *.bat file and starts with (:).
Goto is often used with the command if, in order to execute conditional operations. The Goto command can be used with the label :EOF to make the execution jump to the end of the *.bat file and finish.

Note:
The label can have more than eight characters and cannot have spaces between them. The label name is not case sensitive.

Example

goto :EOF

if exist %1.err goto end
...
:end




:
Declares a label.

: labelName

Parameter
labelName
Is a string which identifies a line of the file, so that the Goto command can jump there. The label line will not be executed.

Note:
The label can have more than eight characters and cannot have spaces between them. The label name is not case sensitive.

Examples

:my_label
:end




Type
Displays the contents of text files.

type [drive:][path] fileName

Parameters
[drive:][path] fileName
Specifies the location and the name of the file to be displayed. If the file name contains blanc spaces it should be inside inverted commas ("file name").

Note:
The text will not be visible because the console is not visible, GiD hides the console. So that this command it's only useful if the output is redirected to a file (using > or >>). Symbol > sends the text to a new file, and symbol >> sends the text to a file if it already exists. It's recommended to use the copy command instead of type.

In general, the type command should not be used with binary files.

Examples

type %2\%1.dat > %2\%1.txt



Showing feedback when runing the solver

The information about what is displayed when the user presses Output view:, is also given here. The way of doing so is to include a commented line in the script of the form:

# OutputFile: $1.log or rem OutputFile: %1.log

where $1.log means to display in that window, a file whose name is: project_name.log The name can also be and absolute name like output.dat. If this line is omitted, when the user presses Output view:, nothing will be displayed.



Managing errors

A commented line like

# ErrorFile: $1.err or rem ErrorFile: %1.err

included in the .bat file, means to consider that the given filename is the error file. At the end of the execution of the .bat file, if the errorfile does not exist or is zero, execution is considered to be successful. If not, an error window appears an the contents of the error file are considered to be the error message. If this line exists, GiD will delete this file just before calculating to avoid errors with previous calculations.

A commented line like

# WarningFile: $1.err or rem WarningFile: %1.err

included in the .bat file, means to consider that the given filename is the warning file. This file stores the warnings that may appear during the execution of the .bat file.



Examples

Two examples are given of easy scripts to do so. One of them is for Unix machines and the other one is for ms-dos or Windows.


Go to the first, previous, next, last section, table of contents.