Metafor

ULiege - Aerospace & Mechanical Engineering

User Tools

Site Tools


doc:user:geometry:import:tuto2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
doc:user:geometry:import:tuto2 [2015/01/08 10:44] – [Reading a SAMCEF Geometry & Mesh] bomandoc:user:geometry:import:tuto2 [2016/03/30 15:23] (current) – external edit 127.0.0.1
Line 3: Line 3:
 ===== Introduction ===== ===== Introduction =====
  
-Here, the complex and tedious preprocessing method is used:+{{:doc:user:ico-advanced.png?40 |Advanced}} 
 +Due to historical reasons, the preprocessor of [[http://www.plm.automation.siemens.com/fr_be/products/lms/samtech/|SAMCEF]] (called BACON) can be used to generate a mesh and geometrical entities. The module ''toolbox.samcef'' defines functions that convert a ''.fdb'' file (''fdb'' stands for "formatted database") to commands that Metafor understands. If a ''.dat'' file (i.e. a BACON script file) is provided, Metafor automatically runs BACON first as a background process in order to create the missing ''.fdb'' file. In this case, a SAMCEF license is required.
  
-    * creation of geometry and mesh with [[doc:user:general:glossaire#Bacon]], [doc:user:general:glossaire#Samcef]] preprocessor , +<note important>Using BACON is not recommended! The user who wants to use another preprocessor should have a look at [[:doc:user:geometry:import:importgmsh|gmsh]] which is modern, free, and sometimes more robust than BACON.</note>
-    * creation of parameters and coundary conditions with [[doc:user:general:glossaire#Python]], +
-    * integration by Metafor.+
  
-Thiw way is **NOT recommended** for simple tests which can be meshed by Metafor meshers. Indeed, since [[doc:user:general:glossaire#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 ''.dat'' file =====
  
-===== Bacon Part =====+The example simulation consists of a sheared cube (lower and upper faces and fixed and moved one with respect to another). The figure below shows the geometry:
  
-==== Test Case description ====+{{ doc:user:cube_geo.png?400 |Geometry of the model}}
  
-The point of this exercise is to create a test case rather simple using the three steps described above (BaconPython 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 BACON input file named ''cubeCG.dat'' (located in ''apps/ale'') contains the commands used to create the geometrythe mesh and node groups (selections). 
  
-{{ doc:user:cube_geo.png?400 |Géométrie du test}}+__Geometry__
  
-The file named ''aleCubeCg.dat'' (with the most recent file situated in ''apps/bQs'') displays the commands used to create the geometrymesh and selections (see Bacon manual for details). +The geometry is created with the following BACON commands (see BACON manual for details): 
 +    * ''.3POI'' for the 8 points. 
 +    * ''.3DRO'' for the 12 edges. 
 +    * ''.CON'' for the 6 wires. 
 +    * ''.FACE'' for the 6 sides. 
 +    * ''.PLAN'' to create a surface (required for the 2D domain, see below). 
 +    * ''.VPEAU'' for the skin. 
 +    * ''.DOM'' for the domain (one 3D domain - the cube - and one 2D domain - the lower side which will be meshed and extruded).
  
-==== Geometry ====+__Mesh Generation__
  
-    * Command ''.3poi'' for the 8 points. +    * Performed with ''.GEN''
-    * Command ''.3dro'' for the 12 edges. +    * Lines are meshed with the command "''MODIFIE LIGNE''"
-    * Command ''.con'' for the 6 wires. +    * The lower side is meshed with a transfinite mapping (command "''transfini''") and extruded with the command "''EXTRUSION''".
-    * 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.     * An attribute number must then be defined.
  
-==== Type of elements declaration ====+__Choice of Element Type__
  
-    * The command ''.hyp volume'' is used (in 2D and 3D).+    * The command ''.HYP VOLUME'' is used (in 2D and 3D).
  
-==== Definition of the selections ====+__Definition of node/element groups (selections)__
  
-    * The command ''.sel'' is used +    * 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''+    * If ''.REN'' is used to change the numbering 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.+    * Node selections will be used to define boundary conditions (fixations, contact, ...) in the Metafor model.
  
-===== Creation of the .fdb Bacon file =====+__Manual Creation of the ''.fdb'' file__
  
-From the ''.dat'' field, a ''.fdb'' is created with Bacon with the commands:+BACON can be started manually with the command:
  
-    samcef ba aleCubeCg n 1 +  samcef ba aleCubeCg n 1
-    input +
-    .sauve db format +
-    .sto+
  
-===== Conversion of the data into Python script =====+From the ''.dat'' file, ''.fdb'' is created with BACON with the commands: 
 +  INPUT 
 +  .SAUVE DB FORMAT 
 +  .STO
  
-In Metafor, the file ''.dat'' is converted with a conversion module named ''importFdb''. In command lines: +__Summary:__ What can be imported from BACON?
- +
-    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 [[doc:user:tutorials:tuto1]]. +
- +
-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), [[doc:user:geometry:user:selections|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 ===== +
- +
-The temporal integration is launched with the command ''meta('apps.bQs.aleCubeCg')''+
- +
-{{ doc:user:cube_result.png?400 |résultat du test aleCubeCg}} +
- +
-===== 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 [[doc:user:general:glossaire#CAO|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     * Points
Line 116: Line 67:
     * Selections: only groups of nodes are imported (other have no use in Metafor)     * Selections: only groups of nodes are imported (other have no use in Metafor)
     * "DAO -- Mesh" relations are not read again (''nodeOnLine'', ...)     * "DAO -- Mesh" relations are not read again (''nodeOnLine'', ...)
 +
 +===== Metafor input file =====
 +
 +__Reading the BACON file from Metafor__
 +
 +In Metafor, the file ''.dat'' is converted thanks to a conversion module named ''toolbox.samcef'' (see ''apps.ale.cubeCG''):
 +
 +  import toolbox.samcef
 +  bi = toolbox.samcef.BaconImporter(domain, os.path.splitext(__file__)[0]+'.dat' )
 +  bi.execute()
 +  
 +where ''domain'' is the domain that should be filled with the converted mesh and geometry. The second argument corresponds to the full path to the file ''cubeCG.dat'' (it is computed from the full path of the python input file).
 + 
 +If all goes well, a file  ''cubeCG.fdb'' is then created in the folder ''workspace/apps_ale_cubeCG''
 +
 +__Element Generation in Metafor__
 +
 +The BACON attributes are converted to ''Groups'' in Metafor. For example, if attribute #99 has been used when generating mesh in BACON, all the elements are stored in ''groupset(99)'' in Metafor. 
 +  app = FieldApplicator(1)
 +  app.push(groupset(99))
 +  interactionset.add(app)
 +  
 +__Boundary conditions in Metafor__
 +
 +Selections in BACON are translated into ''Groups'' with the same number. Boundary conditions such as prescribed displacements or contact can be thus defined easily in Metafor. For example, a selection such as ''.SEL GROUPE 4 NOEUDS'' can lead to the following command in the input file: 
 +  loadingset.define(groupset(4), Field1D(TX,RE))
 +
 +<note important>Consequence: Groups should be defined with a different number from attributes</note>
doc/user/geometry/import/tuto2.1420710269.txt.gz · Last modified: 2016/03/30 15:22 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki