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

Both sides previous revisionPrevious revision
Next revision
Previous revision
doc:user:geometry:import:importgmsh [2014/08/10 14:21] jorisdoc:user:geometry:import:importgmsh [2016/03/30 15:23] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== Import of a Gmsh geometry and mesh ======+====== 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.
  
-Geometry (''.geo''and mesh (''.msh'') defined in Gmsh can be imported in Metafor.+The "physical groups" that have been defined in gmsh (i.e. list of nodes for the boundary conditions, or list of elements for multi-material simulationsare translated into ''Groups'' in Metafor. 
  
-Several physical areas are defined in Gmshand correspond to various Metafor groups. The file must simply be imported in Metafor with the commands:+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) #or importer = GmshImport(filename.geo, domain+   
-    importer.execute()+  importer = GmshImport(filename, domain) 
 +   
 +  importer.setOrder(order=1)    
 +  importer.setOpti(opti=True) 
 +  importer.setAlgo(algo='default')  
 +    
 +  importer.execute()
  
-If the file is ''.geo'', Gmsh can be executed with the following options (see  [[commit:2009:08_21]] and [[commit:2008:06_03]]) :+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''
  
-    importer.setOrder(ordre_des_elements) 
-    importer.setOpti(True)#False by default 
-    importer.setAlgo(algo) 
-     
-Then, the right elementProperties must be associated to the Gmsh type of element.     
  
-Exampled can be found in ''apps.externalMeshers.gmshtestXX'' 
doc/user/geometry/import/importgmsh.1407673288.txt.gz · Last modified: 2016/03/30 15:22 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki