Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

Image ModifiedImage Modified

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.

...


It's time to load the problemtype. Go to Data --> Problemtype --> Examples --> cmas2d_customlib. The first you can see is a window like this:

Image Modified

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:

Image Modified

...

After this, let's open the properties tree. Go to Data --> Data tree.

Interface definition

In this section, we are going to prepare the interface definition document, called cmas2d_customlib_default.spd.
This is a file in XML format and contains all the definition of all the data necessary for the analysis.
First of all, let's see the final result:

Image Modified

Step by step. The first we see is Units. It's useful to set a global criteria, such as the geometry units, or the default units system.


The next is Point Weight, to assign concentrated mass to a group that contains points. It's spd code is:

...

  • Write '25' in the Weight field
  • Click on 'select' button and select one (or more) point.
  • Press ESC to stop selecting. A group name will be generated.
  • Click OK

Image Modified

Then we find 'Properties', a folder or 'container', that contains 'Shells' and 'Materials'. It's code is:

...


There is a 'container', another 'condition' called Shells, and a special 'value' called material. In this section, we want to assign a material from the database to a surface (see 'ov' field on the condition). NOTE: As you can see, there is an include to a file. The customLib library allows splitting the spd in different slices. You can find the materials database on that file in the problemtype folder.
By 'double clicking' on Shells, we get a window like this:

Image Modified

  • Select a material from the list.
  • Select the surface
  • Press ESC
  • Click OK


Your tree should look like this:

Image Modified

Writing the calculation files

...


Access the .post.res file to see the format, and check the documentation about the Postprocess data files in the Customization manual.
It's time to change to postprocess and see our results. Go to View results in the menu, contour fill > DISTANCE CENTER
You should see something like this, but adapted to your generated geometry:


Image Modified

Extra: Wizard problemtype example

...