Loading

 

Lesson 7: Using Mesh Generator

The current release of is not provided within a native mesh generator. For this, we prefer to add to the package a public domain mesh generator that we have interfaced with classes. The included mesh generator is called BAMG. It was developed by an INRIA team.

To generate a 2-D finite element mesh you have to use the class Domain to create a domain and then call the function BAMG that generates a mesh file in the XML format. The following example contained in the package illustrates a typical usage of the mesh generator. It uses the program g2m created while you install the utilities

An example

We now give an example of XML to generate a domain and then a mesh

<?xml version="1.0" encoding="ISO-8859-1" ?>
<OFELI_File>
<info>
    <title>Definition of a domain with a hole</title>
    <date>January 1, 2010</date>
    <author>R. Touzani</author>
</info>
<Domain dim="2">
      <vertex>    0.      0.    2   0.1</vertex>
      <vertex>    1.      0.    2   0.1</vertex>
      <vertex>    1.      1.    2   0.1</vertex>
      <vertex>    0.      1.    2   0.1</vertex>
      <vertex>    0.4     0.4   1   0.01</vertex>
      <vertex>    0.6     0.4   1   0.01</vertex>
      <vertex>    0.6     0.6   1   0.01</vertex>
      <vertex>    0.4     0.6   1   0.01</vertex>
      <vertex>    0.1     0.2   1   0.01</vertex>
      <vertex>    0.2     0.2   1   0.01</vertex>
      <line>  1   2   2   0 </line>
      <line>  2   3   2   0 </line>
      <line>  3   4   2   0 </line>
      <line>  4   1   2   0 </line>
      <line>  5   6   1   0 </line>
      <line>  6   7   1   0 </line>
      <line>  7   8   1   0 </line>
      <line>  8   5   1   0 </line>
      <circle> 9    9   10   1   1</circle>
      <SubDomain>  1    1    10</SubDomain>
</Domain>
</OFELI_File>

The above text file enables generating a rectangular domain containing a circular hole. Once this file is created and called test.dom, we can generate the file test.m by typing

   g2m -d test.dom

Note that all parameters of the command g2m can be obtained by typing

   g2m --help

 
Copyright © 1998-2016 Rachid Touzani