This tutorial takes you through the steps involved in defining a problem type using GiD. A problem type is a set of files configured by a solver developer so that the program can prepare data to be analyzed.
A simple example was chosen, and takes us through all the associated configuration files while using few lines of code. Particular emphasis is given to the calculation of the centers of mass for two-dimensional surfaces. A simple formulation both conceptually and numerically.
By the end of the example, you should be able to create a calculating module that will interpret the mesh generated in GiD Preprocess. The module will calculate values for each element of the mesh and store the values in a file in such a way as they can be read by GiD Post-process.
Introduction
Our aim is to solve a problem that involves calculating the center of gravity (center of mass) of a 2D object. To do this, we need to develop a calculating module that can interact with GiD.
The problem: calculate the center of mass.
The center of mass (XCM,YCM) of a two-dimensional body is defined as
...
Where ρ(x,y) is the density of the material at point (x,y) and S is the surface of the body; mi are concentrated masses applied on the point (xi,yi).
Each of the N elements is treated as concentrated weight whose mass is defined as the product of the (surface) density and the area of the element.
Interaction of GiD with the calculating module
GiD Preprocess makes a discretization of the object under study and generates a mesh of elements, each one of which is assigned a material and some conditions. This preprocessing information in GiD (mesh, materials, and conditions) enables the calculating module to generate results. For the present example, the calculating module will find the distance of each element relative to the center of mass of the object.
Finally, the results generated by the calculating module will be read and visualized in GiD Post-process.
...
GiD must adapt these data to deal with them. Materials, boundary and/or load conditions, and general problem data must be defined.
The calculating module (in this example cmas2d.exe) solves the equations in the problem and saves the results in the results file. This module may be programmed in the language of your choice, 'C' is used in this example
GiD Post-process reads the following files generated by the calculating module:
project_name.post.res: results file.
Each element of the mesh corresponds to a value.
project_name.post.msh: file containing the post-process mesh. If this file does not exist, GiD uses the preprocess mesh also for postprocess.
Example: cmas2d_customlib
Let's see out example: the cmas2d_customlib problemtype. You can see it's files on the example's problemtype folder (GiD 14.0\problemtypes\Examples\cmas2d_customlib.gid)
Inside it's folder, we can find the following files:
...
It's time to load the problemtype. Go to Data->Problemtype-> Problemtype --> Examples --> cmas2d>Examples->cmas2d_customlib. The first you can see is a window like this:
This window helps you to generate a random 4 sided surface. For this example let's click Random surface and get an auto-generated surface. You can click continue and create your own surface. This is the surface I'll work with:
...
After this, let's open the properties tree. Go to Data--> Data >Data tree.
Interface definition
...