How to Create a GiD Problem Type

Moderator: GiD Team

User avatar
escolano
Posts: 1918
Joined: Sun Sep 05, 1982 10:51 pm

Re: How to Create a GiD Problem Type

Post by escolano »

I guess that you are defining in the .cnd some condition 'over layers' similar to this:

Code: Select all

CONDITION: xxx
CONDTYPE: over layers
CONDMESHTYPE: 'over nodes'
QUESTION: PNAX
VALUE: 0.0
QUESTION: PNAY
VALUE: 0.0
END CONDITION
and want that each one of your bodies (platen1, platen2, rock) will be represented by a layer with a condition, and the extra values are stored in the condition applied to each body-layer

the normal way to loop this information is like this

Code: Select all

*set cond xxx *layers
*loop layers onlyincond
*layernum *layername *cond(PNAX) *cond(PNAY)
*end layers
with a known (and usually small) number of columns. and a unknow(and maybe big) number of rows, one by entity (layer in this rare case, nodes or elements usually)

but do you want instead that each printed row do the opposite loop: a single row by question and as much columns as entities (in this case I assume that is expected a small amount of bodies)

Code: Select all

*set cond xxx *layers
Num bodies: *CondNumEntities
bodies: (to know the body represented by each column)
*loop layers onlyincond
*layername *\
*end layers

PNAX
*loop layers onlyincond
*cond(PNAX) *\
*end layers

PNAY
*loop layers onlyincond
*cond(PNAY) *\
*end layers
and ... must repeat the block of code for all wanted questions
(the .bas is very limited and is not possible to do a loop over questions, to do it must swap to use Tcl scripting).
Chambernan
Posts: 23
Joined: Tue Mar 22, 2022 3:13 pm

Re: How to Create a GiD Problem Type

Post by Chambernan »

Many thanks to you! The last CODE is what I want. But in this case, the layernum is important to me.

And I found that the layernum is related to the order in which the layers were created, and when a layer is deleted, the corresponding number is also deleted. Creating a new layer again will add a new number (not the deleted number).

I would like to know if it is possible to get the number of each layer in the GiD_GUI interface and try to modify the number.

Essentially, I need to get the condition and the extra values for each entity, and arrange them by condition sets number (number 1 is placed in the first column, like an array), a single row by question and as much columns as entities . Because I need to store the condition set number in the node boundary conditions, the number 0 represents the first column above.

Image

So the solution I thought of was to set up different layers to store bodies with different boundary conditions, just like the last CODE. But this way does not seem to be very safe (when a layer is deleted, there will be problems). I don't know if there is any other way. Thank you very much! Best wishes to you!
Chambernan
Posts: 23
Joined: Tue Mar 22, 2022 3:13 pm

Re: How to Create a GiD Problem Type

Post by Chambernan »

Hello! I would like to know if it is possible to get the number of each layer in the GiD_GUI and try to modify the number. Thank you sincerely!
User avatar
escolano
Posts: 1918
Joined: Sun Sep 05, 1982 10:51 pm

Re: How to Create a GiD Problem Type

Post by escolano »

The current Tcl layers procedures are not providing the internal integer id (or using them to specify a layer). This id is considered some kind of internal data. Instead it is used the layer name.

It is not possible to modify this id (renumber the layers)

At .bas programming level *layernum , *elemslayernum is printing this internal id.

you can relate the name and the id writing this extra information
*loop layers
*layenum *layername
*ends layers

As trick you can call a Tcl proc to store in an array a implicit inde 0,1,2,... for each layenum
e.g. in a file <problemtype>.tcl define these procs to be called from the bas file

Code: Select all

proc MySetKey {key value} {
  set ::MyLayerIndex($key) $value
  return ""
}

proc MyGetKey {key} {
  return $::MyLayerIndex($key)
}
and in the .bas file do a first loop to set the values of this array

Code: Select all

*set var index=0
*loop layers
*tcl(MySetKey *layernum *index)*\
*set var index=operation(index+1,int)
*end layers
(note the *\ to avoid print anything in this loop)
and then can know this index from the layernum

Code: Select all

*loop layers
*layernum *layername *tcl(MyGetKey *layernum)
*end layers

*loop nodes
*nodesnum *tcl(MyGetKey *nodeslayernum)
*end nodes
Chambernan
Posts: 23
Joined: Tue Mar 22, 2022 3:13 pm

Re: How to Create a GiD Problem Type

Post by Chambernan »

Thank you very much, I understand what to do.
Chambernan
Posts: 23
Joined: Tue Mar 22, 2022 3:13 pm

Re: How to Create a GiD Problem Type

Post by Chambernan »

Hello!

How to get the minimum size(length) of an element in the GUI?

Is it possible to output the smallest element size(length) by writing a .bas file, or even operate on it?

Thank you!
User avatar
escolano
Posts: 1918
Joined: Sun Sep 05, 1982 10:51 pm

Re: How to Create a GiD Problem Type

Post by escolano »

You can use the 'Mesh->Mesh quality' tool, selecting as quality criteria 'Minimum edge'
mesh_edge_sizes_distribution_accumulated.png
mesh_edge_sizes_distribution_accumulated.png (25.2 KiB) Viewed 64235 times
Can see a frequency graph or and accumulated frequency graph (default)
Clicking the graph they are selected the elements under this x-value

The data to populate this graph is obtained with the 'GiD_Info MeshQuality' GiD-Tcl command
https://gidsimulation.atlassian.net/wik ... eshquality

From the .bas can invoke a *tcl command to print the value of minimum edge of the whole mesh of triangles with something like this:

Code: Select all

minimum triangles edge=*tcl(lindex [GiD_Info MeshQuality ElemMinEdge Triangle 0 0 1] 1)
Off course yourself can calculate the distance between the node's coordinates of an element (can ask GiD for the nodes of an element and ask for its coordinates with Tcl commands)
Chambernan
Posts: 23
Joined: Tue Mar 22, 2022 3:13 pm

Re: How to Create a GiD Problem Type

Post by Chambernan »

Thank you for your patience to answer me, thank you! :D :D
Chambernan
Posts: 23
Joined: Tue Mar 22, 2022 3:13 pm

Re: How to Create a GiD Problem Type

Post by Chambernan »

Hello! In the boundary condition setting (.cnd), when setting over line or over surface, it seems that only a line or surface in one element can be selected. Is it possible to select an entire edge or an entire surface of the model for setting?
User avatar
escolano
Posts: 1918
Joined: Sun Sep 05, 1982 10:51 pm

Re: How to Create a GiD Problem Type

Post by escolano »

I don't understand your question.
if you declare in the .cnd a condition as
CONDTYPE: over lines
Then this condition can be only assigned to geometrical lines, not only a lines, as much lines as you want, but it don't allow to be assigned to geometrical points, surfaces or volumes, only to curves.
And similarly if you define as 'over surfaces', then logically can be only assigned to geometrical surfaces

A condition can be declared to only one geometrical category (points,line, surface or volume), not to multiple categories

The previous declaration is only related to geometry, not to mesh. For mesh it the next declaration
CONDMESHTYPE: over XXX

In mesh there are other categories XXX: nodes, body elements, face elements
('body element' mean the element, 'face element' mean a face of an element, e.d. the element 2565 its face 2

The normal way is that the user only assign manually the conditions to the geometry, and then generate the mesh, and then automatically the conditions over nodes, elements or face of elements are applied (to mesh entities of category CONDMESHTYPE)

It is possible to manually assign conditions to mesh entities, but in general is unrecommended (if generate a new mesh will be lost, and usually is difficult to select mesh entities because can be millions)
Post Reply