Metafor

ULiege - Aerospace & Mechanical Engineering

User Tools

Site Tools


doc:user:geometry:import:importgmsh

Differences

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

Link to this comparison view

Next revision
Previous revision
doc:user:geometry:import:importgmsh [2013/07/12 14:56] – created jorisdoc:user:geometry:import:importgmsh [2016/03/30 15:23] (current) – external edit 127.0.0.1
Line 1: Line 1:
-==== Import Gmsh ====+====== Reading gmsh files ====== 
 +{{:doc:user:ico-beginner.png?40 |Beginner}} 
 +Meshes (files with extension ''.geo'' or ''.msh'') generated by [[http://geuz.org/gmsh/|gmsh]] can be imported in Metafor. This is a very easy way to define a mesh (and groups of nodes or elements) when the geometry of the model is too difficult to be modelled with the tools available in Metafor.
  
-Il est possible d'importer de la géométrie (.geo) ou des maillages (.mshissus de Gmsh.+The "physical groups" that have been defined in gmsh (i.elist of nodes for the boundary conditions, or list of elements for multi-material simulationsare translated into ''Groups'' in Metafor
  
-Différents régions physiques sont définis dans gmsh qui correspondent à différents groupes Metaforil suffit d'importer le fichier dans Metafor par exemple :+In practicethe gmsh file (extension ''.msh'') must be imported in Metafor with the commands:
  
-    from toolbox.gmsh import GmshImport +  from toolbox.gmsh import GmshImport 
-    importer = GmshImport(filename.msh, domain)#ou importer = GmshImport(filename.geodomain) +   
-    importer.execute()+  importer = GmshImport(filename, domain) 
 +   
 +  importer.setOrder(order=1)    
 +  importer.setOpti(opti=True) 
 +  importer.setAlgo(algo='default')  
 +    
 +  importer.execute() 
 + 
 +with 
 +| ''filename''  | ''str''     | filename including ''.msh'' or ''.geo'' extension | 
 +| ''domain''    | ''Domain''  | domain used to store the mesh                     | 
 +| ''order''     | ''int''     | order of the elements [default=1]                 | 
 +| ''opti''      | ''bool''    | activate mesh optimisation [default=True]         | 
 +| ''algo''      | ''str''     | activate mesh optimisation [default='default'   | 
 + 
 +If the file extension is ''.geo'' (corresponding to a gmsh script instead of a mesh), gmsh is executed automatically by Metafor and the script is read to produce a mesh file in the workspace directory.  
 + 
 +<note important>Problems may occur if ''gmsh.exe'' is not reachable from ''Metafor''. The easiest way to solve this problem is to manually copy ''gmsh.exe'' in the same folder as ''Metafor.exe'' (e.g. in ''c:\Program Files\Metafor'').</note>    
 + 
 +__Example:__ Element generation: 
 + 
 +If the "Physical Group" #300 is defined in gmsh as a list of finite elements, it is converted into a ''Group'' with the same number in Metafor. This ''Group'' can be obtained from the ''GroupSet'' using the ''operator()'' member function. This ''Group'' is useful to define a ''FieldApplicator'' in Metafor. 
 +  app1 = FieldApplicator(1) 
 +  app1.push( groupset(300) ) 
 +  interactionset.add( app1 ) 
 + 
 +__Example:__ Boundary conditions: 
 + 
 +Similarly, if the "Physical Group" #200 is defined in gmsh as a list of nodes, it is converted into a ''Group'' with the same number in Metafor. This ''Group'' can be obtained from the ''GroupSet'' using the ''operator()'' member function. This ''Group'' is useful to prescribe boundary conditions in Metafor. For example, if we want to prescribe a 0-displacement to all the nodes of this group along the ''x'' direction: 
 +  loadingset.define(groupset(200), Field1D(TX,RE)) 
 + 
 +\\ 
 + 
 +More Examples can be found in ''apps.externalMeshers''
  
-Si le fichier est un fichier geo, on peut executer gmsh avec les options suivantes (cfr  [[commit:2009:08_21|page de commit associée]] et [[commit:2008:06_03|page de commit associée]]) : 
-    importer.setOrder(ordre_des_elements) 
-    importer.setOpti(True)#False par defaut 
-    importer.setAlgo(algo) 
-     
-Il faut ensuite associer le bon elementProperties au type d'éléments de gmsh. 
  
-Des exemples sont disponibles dans ''apps.externalMeshers.gmshtestXX'' 
doc/user/geometry/import/importgmsh.1373633817.txt.gz · Last modified: 2016/03/30 15:22 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki