mesh and normal to the elements

Moderator: GiD Team

Post Reply
caronte88
Posts: 4
Joined: Thu Feb 26, 2015 11:50 am

mesh and normal to the elements

Post by caronte88 »

Hi!
at this time, I export the informations from GiD via text file: geometry, mesh, an easy problem-tipe by which I add informations such as materials, ports, analysis parameters; but I would like to export also the normals to the mesh elements: how I can do this without .bas file and TCL commands?

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

Re: mesh and normal to the elements

Post by escolano »

I think that is not a good idea to write the elements normal, it is a redundant information that could be easily recalculated from the nodes of the element.

In any case, in the .bas file you it exists the command *ElemsNormal
This command writes the normal's coordinates. It must be inside a loop over elements, and it is only defined for triangles, quadrilaterals, and circles (and also for lines in 2D cases).

In Tcl in doesn't exists a specific commad to get it, but as I've said it is trivial to calculate it getting the element nodes and its coordinates asked with the GiD_Mesh command, for example defining a procedure like this:

Code: Select all

proc GetSurfaceElementNormal { element_id } {
  set i 0
  foreach node_id [lrange [GiD_Mesh get element $element_id] 3 6] {
     set coordinates($i) [lrange [GiD_Mesh get node $node_id] 1 3]
     incr i
  }
  set v1 [MathUtils::VectorDiff $coordinates(0) $coordinates(1)]
  set v2 [MathUtils::VectorDiff $coordinates(1) $coordinates(2)]
  return [MathUtils::VectorNormalized [MathUtils::VectorVectorialProd $v1 $v2]]
}
Post Reply