Difference between revisions of "Fem Workbench"

From FreeCAD Documentation
Jump to: navigation, search
(languages)
(Python scripting)
Line 46: Line 46:
 
Fem.show(m)
 
Fem.show(m)
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
If you want to have predefined element and node numbering:
 +
 +
<syntaxhighlight>
 +
 +
m.addNode(0.0,1.0,0.0,1)
 +
 +
m.addVolume([1,2,3,4,5,6,7,8,9,10],1)
 +
 +
</syntaxhighlight>
 +
 
==== Visual handling ====
 
==== Visual handling ====
  
Line 69: Line 80:
 
Gui.ActiveDocument.ActiveObject.HighlightedNodes = [1,2,3]
 
Gui.ActiveDocument.ActiveObject.HighlightedNodes = [1,2,3]
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
Postprocessing colors and displacement:
 +
 +
Highlight some nodes on the view:
 +
<syntaxhighlight>
 +
# set the volume 1 to red
 +
Gui.ActiveDocument.ActiveObject.ElementColor= {1:(1,0,0)}
 +
# set the node 1 and 2 to a certain Color and interpolate the survace
 +
Gui.ActiveDocument.ActiveObject.NodeColor= {1:(1,0,0),2:(1,0,0)}
 +
# set the node 1 and 2 to a certain displacement
 +
Gui.ActiveDocument.ActiveObject.NodeDisplacement= {1:FreeCAD.Vector(1,0,0),2:FreeCAD.Vector(1,0,0)}
 +
# double the factor of the displacement shown
 +
Gui.ActiveDocument.ActiveObject.animate(2.0)
 +
 +
</syntaxhighlight>
 +
 
== Element Types ==
 
== Element Types ==
 
This description is based on the MED format as described [https://hammi.extra.cea.fr/static/MED/web_med/logiciels/med-2.3.1/doc/html/modele_de_donnees.html#3. here].
 
This description is based on the MED format as described [https://hammi.extra.cea.fr/static/MED/web_med/logiciels/med-2.3.1/doc/html/modele_de_donnees.html#3. here].

Revision as of 23:55, 2 January 2014

The Fem Workbench offers data structures and commands to work with Fem meshes.


General

FemWorkbench.jpg

Comand reference

Doing a analysis

Analysis types

creating or importing meshes/parts

Material definition

Every analysis needs at least one Material object to be fully defined. The easiest is to add a FreeCAD standard material. FreeCAD comes if a set of Material definitions you can use out of the box. But you can define additinal ones very easy. The FreeCAD material system allows a lot of additional values if needed. A good source to find material values is the matweb.com/ web site.

Import/Export

Python scripting

Creating meshes "by hand"

creation of meshes

Creating a mesh with one Tet-10 Elements:

import FreeCAD, Fem

# create a empty mesh
m = Fem.FemMesh()
#create the nodes
m.addNode(0,1,0)
m.addNode(0,0,1)
m.addNode(1,0,0)
m.addNode(0,0,0)
m.addNode(0,0.5,0.5)
m.addNode(0.5,0.03,.5)
m.addNode(0.5,0.5,0.03)
m.addNode(0,0.5,0)
m.addNode(0.03,0,0.5)
m.addNode(0.5,0,0)
# add the volume with the created nodes
m.addVolume([1,2,3,4,5,6,7,8,9,10])

Fem.show(m)

If you want to have predefined element and node numbering:

m.addNode(0.0,1.0,0.0,1)

m.addVolume([1,2,3,4,5,6,7,8,9,10],1)

Visual handling

Highlight some nodes on the view:

import FreeCAD, Fem

m = Fem.FemMesh()

m.addNode(0,1,0)
m.addNode(0,0,1)
m.addNode(1,0,0)
m.addNode(0,0,0)
m.addNode(0,0.5,0.5)
m.addNode(0.5,0.03,.5)
m.addNode(0.5,0.5,0.03)
m.addNode(0,0.5,0)
m.addNode(0.03,0,0.5)
m.addNode(0.5,0,0)
m.addVolume([1,2,3,4,5,6,7,8,9,10])

Fem.show(m)
Gui.ActiveDocument.ActiveObject.HighlightedNodes = [1,2,3]

Postprocessing colors and displacement:

Highlight some nodes on the view:

# set the volume 1 to red
Gui.ActiveDocument.ActiveObject.ElementColor= {1:(1,0,0)}
# set the node 1 and 2 to a certain Color and interpolate the survace
Gui.ActiveDocument.ActiveObject.NodeColor= {1:(1,0,0),2:(1,0,0)}
# set the node 1 and 2 to a certain displacement
Gui.ActiveDocument.ActiveObject.NodeDisplacement= {1:FreeCAD.Vector(1,0,0),2:FreeCAD.Vector(1,0,0)}
# double the factor of the displacement shown
Gui.ActiveDocument.ActiveObject.animate(2.0)

Element Types

This description is based on the MED format as described here.

Segment element

Segments.gif

Triangle element

Triangles.gif

quadratic element

Quadrangles.gif

Tetrahedron element

Tetraedres.gif


Tetrahedron with four or ten nodes
Edge Node 1 Node 2 Middle node
A1 N1 N2 N5
A2 N2 N3 N6
A3 N3 N1 N7
A4 N1 N4 N8
A5 N2 N4 N9
A6 N3 N4 N10
Tetrahedron Faces
Face Edge 1 Edge 2 Edge 3
F1 A1 A2 A3
F2 A4 -A5 -A1
F3 A5 -A6 -A2
F4 A6 -A4 -A3

Pyramid element

Pyramides.gif

Hexahedron element

Hexaedres.gif


Hexahedron with eight or twenty nodes
Edge Node 1 Node 2 Middle node
A1 N1 N2 N9
A2 N2 N3 N10
A3 N3 N4 N11
A4 N4 N1 N12
A5 N5 N6 N13
A6 N6 N7 N14
A7 N7 N7 N15
A8 N8 N5 N16
A9 N1 N5 N17
A10 N2 N6 N18
A11 N3 N7 N19
A12 N4 N8 N20
Hexahedron faces
Face Edge 1 Edge 2 Edge 3 Edge 4
F1 A1 A2 A3 A4
F2 -A8 -A7 -A6 -A5
F3 A9 A5 -A10 -A1
F4 A10 A6 -A11 -A2
F5 A11 A7 -A12 -A3
F6 A12 A8 -A9 -A4

Pentahedron element

Pentaedres.gif



Available translations of this page: Flag-de.jpg Flag-fr.jpg Flag-it.jpg