[GiDlist] Mesh output

Moderator: GiD Team

Post Reply
Asteroide

[GiDlist] Mesh output

Post by Asteroide »

I use GiD to mesh geometries and then export node coordinates and connectivity to a text file. For this purpose, I use a .bas file of this format:

NOEUDS ET COORDONNEES
*npoin
*loop nodes *All
*format "%7i%15.5f%15.5f%15.5f"
*NodesNum *NodesCoord
*end

CONNECTIVITE
*nelem
*loop elems
*elemsnum *elemsConec
*end elems

INLET
*Set Cond INLET *nodes
*loop nodes *OnlyInCond
*NodesNum
*end
........etc

The inlet section is to extract nodes to which I applied a certain condition. These nodes are then used in a finite element program to apply a boundary condition. I have 2 questions:

1) Is there a better or more efficient way to do this (then to apply conditions to boundaries)

2) (More important) Say I have a boundary condition which is a line. I absolutely want the nodes (written in the text file) to be written line-wise i.e. in the order they are encountered along the line (is this automatic?) Is there a way to reverse this order?

3) Is there a way to perform a calculation (ex: write the normal of each line element) and write this automatically in the exported calculation file (text file).

Alexandre Forest, B. Eng
École de technologie supérieure
Montréal, QC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20020814/7f394b5f/attachment.htm
Enrique Escolano

[GiDlist] Mesh output

Post by Enrique Escolano »

1) Is there a better or more efficient way to do this (then to apply conditions to boundaries)
I not understand the question well.
This method is efficient (fast) at the time of writing the calculation file.
I suppose that the condition will be applied over geometric entities: lines, etc, not directly on the mesh nodes ,
which can be very slow for the user, and forces to reassign the conditions if remesh.

2) (More important) Say I have a boundary condition which is a line. I absolutely want the nodes (written in the text file) to be written line-wise i.e. in the order they are encountered along the line (is this automatic?) Is there a way to reverse this order?

Actually It is not possible to force the nodes to be numbered along the line or another specific renumerations.
An automatic renumeration is made after generating the mesh, in order to diminish the bandwidth (maximum
difference of numeration of nodes of an element)

You must reorder the nodes inside your code following the element connectivities.

3) Is there a way to perform a calculation (ex: write the normal of each line element) and write this automatically in the exported calculation file (text file).

Inside the bas file it is possible to perform small calculations with the *Operation order (see help-Customization-Template file).

Example: (Template STL.bas included with GiD 7 inside the directory \templates)

*realformat "%15.6e"
*intformat "%8i"
*# Interface GID-STL to export triangle closed mesh
*# Written by Kike III - October 2001
*if(nelem(Triangle)==0)
*MessageBox Error: Must create a mesh of triangles.
*endif
*if(nelem(Linear) || nelem(Quadrilateral) || nelem(Tetrahedra) || nelem(Hexahedra))
*WarningBox Warning: Exist Bad elements. A STL file is a collection of triangles bounding a volume.
*endif
*if(isquadratic)
*WarningBox Warning: Quadratic triangles are written as linear.
*endif
solid GiD
*set elems(triangle)
*loop elems
*set var ax=operation(NodesCoord(2,1)-NodesCoord(1,1))
*set var ay=operation(NodesCoord(2,2)-NodesCoord(1,2))
*set var az=operation(NodesCoord(2,3)-NodesCoord(1,3))
*set var bx=operation(NodesCoord(3,1)-NodesCoord(2,1))
*set var by=operation(NodesCoord(3,2)-NodesCoord(2,2))
*set var bz=operation(NodesCoord(3,3)-NodesCoord(2,3))
*set var nx=operation(ay*bz-az*by)
*set var ny=operation(az*bx-ax*bz)
*set var nz=operation(ax*by-ay*bx)
*set var modulo=operation(sqrt(nx*nx+ny*ny+nz*nz))
*set var nx=operation(nx/modulo)
*set var ny=operation(ny/modulo)
*set var nz=operation(nz/modulo)
facet normal *nx *ny *nz
outer loop
*for(INODO=1;INODO=3;INODO=INODO+1)
vertex *NodesCoord(*INODO,1) *NodesCoord(*INODO,2) *NodesCoord(*INODO,3)
*end INODO
endloop
endfacet
*end elems
endsolid GiD

See the red lines to calculate the unitary normal of a triangle element

Regards

Enrique Escolano
----- Original Message -----
From: Asteroide
To: gidlist at gatxan.cimne.upc.es
Sent: Wednesday, August 14, 2002 10:16 PM
Subject: [GiDlist] Mesh output


I use GiD to mesh geometries and then export node coordinates and connectivity to a text file. For this purpose, I use a .bas file of this format:

NOEUDS ET COORDONNEES
*npoin
*loop nodes *All
*format "%7i%15.5f%15.5f%15.5f"
*NodesNum *NodesCoord
*end

CONNECTIVITE
*nelem
*loop elems
*elemsnum *elemsConec
*end elems

INLET
*Set Cond INLET *nodes
*loop nodes *OnlyInCond
*NodesNum
*end
........etc

The inlet section is to extract nodes to which I applied a certain condition. These nodes are then used in a finite element program to apply a boundary condition. I have 2 questions:

1) Is there a better or more efficient way to do this (then to apply conditions to boundaries)

2) (More important) Say I have a boundary condition which is a line. I absolutely want the nodes (written in the text file) to be written line-wise i.e. in the order they are encountered along the line (is this automatic?) Is there a way to reverse this order?

3) Is there a way to perform a calculation (ex: write the normal of each line element) and write this automatically in the exported calculation file (text file).

Alexandre Forest, B. Eng
École de technologie supérieure
Montréal, QC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listas.cimne.upc.edu/pipermail/gidlist/attachments/20020828/2fc129f8/attachment.htm
Post Reply