rectangular mesh boundaries

Extension of Elmer in computational glaciology
Post Reply
dolphin
Posts: 5
Joined: 13 Oct 2017, 15:17
Antispam: Yes

rectangular mesh boundaries

Post by dolphin » 15 Feb 2018, 23:39

Hello all,
I have create a rectangular mesh using gmsh and mmg2d library, but it has only one line (not four); at the perimeter. In my problem I need to apply four boundary conditions. Please, does anyone know any way to use my -1 line- mesh and apply 4 boundary conditions on each side of the rectangular boundary? If (I assume) the later is not possible, does anyone could suggest any tool that I could split my mesh -perimeter- line to four; I tried gmsh and it cant work,
best,
k.

gagliar
Posts: 59
Joined: 04 Sep 2009, 16:34
Location: LGGE - Grenoble
Contact:

Re: rectangular mesh boundaries

Post by gagliar » 04 Apr 2018, 10:06

Hello,

To close this post, here are two examples with gmsh and ElmerGrid.


With ElmerGrid, copy and paste the following lines in a file named test.grd

Code: Select all

***** ElmerGrid input file for structured grid generation *****
Version = 210903
Coordinate System = Cartesian 2D
Subcell Divisions in 2D = 1 1
Subcell Limits 1 = 0.0 1.0
Subcell Limits 2 = 0.0 1.0
Material Structure in 2D
  1
End
Materials Interval = 1 1
Boundary Definitions
! type     out      int
  1        -1        1        1
  2        -2        1        1
  3        -3        1        1
  4        -4        1        1
End
Numbering = Horizontal
Coordinate Ratios = 1
Element Innernodes = False
Element Degree = 1
Triangles = False
Element Divisions 1 = 20
Element Divisions 2 = 20
and then execute

Code: Select all

ElmerGrid 1 2 test.grd
You should get a square mesh 1 x 1 composed of 404 elements, with bottom boundary = 1, right = 2, top = 3 and left = 4.

With gmsh, copy the following line into a file named test.geo:

Code: Select all

Point(1) = {0.0,0.0,0.0,0.1};
Point(2) = { 1.0 ,0.0,0.0,0.1};
Point(3) = { 1.0 , 1.0 ,0.0,0.1};
Point(4) = {0.0, 1.0 ,0.0,0.1};
Line(1) = {1,2} ;
Line(2) = {2,3} ;
Line(3) = {3,4} ;
Line(4) = {4,1} ;
Line Loop(5) = {1,2,3,4};
Plane Surface(6) = {5};
Physical Line(1) = {1} ;
Physical Line(2) = {2} ;
Physical Line(3) = {3} ;
Physical Line(4) = {4} ;
Physical Surface(5) = {6} ;
and then execute:

Code: Select all

gmsh -1 -2 test.geo
ElmerGrid 14 2 test.msh -autoclean
You should get a square mesh 1 x 1 composed of 303 elements, with bottom boundary = 1, right = 2, top = 3 and left = 4.

Olivier

Post Reply