This is an old revision of the document!
−Table of Contents
Reading SAMCEF files
Introduction
Here, the complex and tedious preprocessing method is used:
- creation of a geometry and mesh with Bacon, [doc:user:general:glossaire#Samcef]] preprocessor ,
- creation of parameters and coundary conditions with Python,
- integration by Metafor.
Thiw way is NOT recommended for simple tests which can be meshed by Metafor meshers. Indeed, since Samcef is used, Samcef license is required, so the model cannot be run anymore should the license expire. Consequently, this method is not really used anymore.
Bacon Part
Test Case description
The point of this exercise is to create a test case rather simple using the three steps described above (Bacon, Python and Metafor). The test case consists of a sheared cube (lower and upper faces and fixed and moved one with respect to another). The figure below shows the geometry:
The file named aleCubeCg.dat
(with the most recent file situated in apps/bQs
) displays the commands used to create the geometry, mesh and selections (see Bacon manual for details).
Geometry
- Command
.3poi
for the 8 points. - Command
.3dro
for the 12 edges. - Command
.con
for the 6 wires. - Command
.face
for the 6 sides. - Command
.plan
to create a surface (required for the 2D domain, see below). - Commande
.vpeau
for the skin. - Commande
.dom
for the domain (one 3D domain - the cube - and one 2D domain - the lower face which will be meshed and extruded).
Mesh
- Performed with
.gen
. - Lines are meshed with the command “
modifie ligne
”. - The lower face is meshed in transfinite (command “
transfini
”) and extruded with the command “extrusion
”. - An attribute number must then be defined.
Type of elements declaration
- The command
.hyp volume
is used (in 2D and 3D).
Definition of the selections
- The command
.sel
is used - If
.ren
is used to change the numbers of nodes and mesh elements, it should be done before the.sel
. - Node selections are used to define boundary conditions (fixations, contact, …) in the Python file.
Creation of the .fdb Bacon file
From the .dat
field, a .fdb
is created with Bacon with the commands:
samcef ba aleCubeCg n 1 input .sauve db format .sto
Conversion of the data into a Python script
In Metafor, the file .dat
is converted with a conversion module named importFdb
. In command lines:
import toolbox.importFdb toolbox.importFdb.bacon2PyMeta('apps/bQs/aleCubeCg')
If all goes well, a file aleCubeCgBacon.py
is then created in the folder apps.bQs
Creation of the "parameter" file in Python
The file with parameters and boundary conditions is created in Python. The list of commands is similar to what is found in How to build my own FE model?.
The relevant parameter file is named aleCubeCg.py
.
Data from Bacon can be retrieved when importing the Python module created by the converter importFdb
:
import apps.bQs.aleCubeCgBacon apps.bQs.aleCubeCgBacon.fillImportedFdb(dom)
The other parameters are defined as usual. To distinguish the various mesh element groups (Bacon attributes), Metafor groups (class Group
) were created. They can be used to apply boundary conditions and define element properties:
# ATTRIBUTES prp99 = ElementProperties(Volume3DElement) prp99.put(MATERIAL,1) prp99.put(CAUCHYMECHVOLINTMETH,VES_CMVIM_SRI) prp99.put(STIFFMETHOD,MES_STIFFANALYTIC) interactionset = dom.getInteractionSet() app99 = FieldApplicator(99) app99.push(99,GROUP_ID) interactionset.copy(app99) interactionset(99).addProperty(prp99)
Metafor Integration
Advice
- groups should be defined with a different number from attributes (the father being put on a fictive group with the number of the attribute) unless the group contains the nodes from the attribute with the corresponding number.
- If DAO objects were generated but are not imported in Metafor, they should be deleted using the command
.del.dao
(Metafor could crash because of an incomplete DAO) - Nodes and mesh elements must be be numbered anew anymore.
Limits of bacon import
- Points
- Curves:
Line
-Arc
(points generated automatically with a negative numbed in Metafor are shifted (numPoint = numMaxPoints-numPoint
) - Surface:
Plan
-Ruled
-Coons
(Only planes defined using three numbers are imported (other planes generate cpoints outside db) ). - Wire
- Sides: Imported (even if not treated by Bacon)
- Skins: If
MultiProjSkin
objects are created, it is best to create them in the Python data set. - Nodes: (imported as
MeshedPoints
) - Mesh elements: Triangle - Quad - Tetra - Hexa (with recovery in Metafor)
- Selections: only groups of nodes are imported (other have no use in Metafor)
- “DAO – Mesh” relations are not read again (
nodeOnLine
, …)