Gmsh for dolfyn tutorial (8)


Contents


Introduction and Files
First tutorial (t2.geo)
Second and third tutorial (t3a.geo and t3b.geo)
Fourth tutorial (t4.geo)
Fifth tutorial (t5.geo)
Sixth tutorial (t6.geo)
Seventh tutorial (STL file of a man)
Eighth tutorial (Von Karman vortex street)

Eighth tutorial (Von Karman vortex street)


Create a parametric Gmsh geometry file and call it for example "model.geo":

Geometry.CopyMeshingMethod = 1 ;
Mesh.CharacteristicLengthMax = 0.25 ;

NX1  =  21 ; RX1 = 0.95 ; // in front of the cilinder
NX2  =  21 ; RX2 = 1.05 ; // around the cilinder
NX3  =  21 ; RX3 = 1.00 ; // middle of the cilinder
NX4  = 151 ; RX4 = 1.01 ; // behind the cilinder

NY1  =  9 ; RY1  = 1.00 ;
NY1b = 13 ; RY1b = 0.98 ;
NY2  = 31 ; RY2  = 1.05 ;

Z0 = -0.1 ; // plane
SB =  0.1 ; // dummy size
R  =  1.0 ; // unity radius
F  =  2.0 ; // factor around the cilinder

X0 = -10.0 * R ;
X1 = -(1+F)* R ;
X2 = -1.0 * R ;
X3 = -0.70710678 * R ;
X4 = 0.70710678 * R ;
X5 = 1.0 * R ;
X6 = (1+F)* R ;
X7 = 60.0 * R ;

Y0 = 0.0 ;
Y1 = 0.70710678 * R ;
Y2 = 0.70710678 * R * (1+F) ;
Y3 = 12.0 * R ;

Enter the important points:

karmanpoints.png

Point( 0) = { 0, 0, Z0, SB};
Point( 1) = { X0, Y0, Z0, SB};
Point( 2) = { X1, Y0, Z0, SB};
Point( 3) = { X2, Y0, Z0, SB};
Point( 4) = { X5, Y0, Z0, SB};
Point( 5) = { X6, Y0, Z0, SB};
Point( 6) = { X7, Y0, Z0, SB};

Point( 7) = { X3, Y1, Z0, SB};
Point( 8) = { X4, Y1, Z0, SB};

Point( 9) = { X0, Y2, Z0, SB};
Point(10) = {-Y2, Y2, Z0, SB};
Point(11) = { Y2, Y2, Z0, SB};
Point(12) = { X7, Y2, Z0, SB};

Point(13) = { X0, Y3, Z0, SB};
Point(14) = {-Y2, Y3, Z0, SB};
Point(15) = { Y2, Y3, Z0, SB};
Point(16) = { X7, Y3, Z0, SB};

And the lines and line loops:

karmanlines.png

Line(1) = {1,2}; Transfinite Line{1} = NX1 Using Progression RX1 ;
Line(2) = {2,3}; Transfinite Line{2} = NX2 Using Progression 1/RX2 ;
Circle(3)= {3,0,7}; Transfinite Line{3} = NY1 Using Progression RY1 ;
Circle(4)= {7,0,8}; Transfinite Line{4} = NX3 Using Progression RX3 ;
Circle(5)= {8,0,4}; Transfinite Line{5} = NY1b Using Progression 1/RY1b ;
Line(6) = {4,5}; Transfinite Line{6} = NX2 Using Progression RX2 ;
Line(7) = {5,6}; Transfinite Line{7} = NX4 Using Progression RX4 ;

Line( 8) = {9,10}; Transfinite Line{8} = NX1 Using Progression RX1 ;
Circle(9)= {10,0,11};Transfinite Line{9} = NX3 Using Progression RX3 ;
Line(10) = {11,12}; Transfinite Line{10} = NX4 Using Progression RX4 ;

Line(11) = {13,14}; Transfinite Line{11} = NX1 Using Progression RX1 ;
Line(12) = {14,15}; Transfinite Line{12} = NX3 Using Progression RX3 ;
Line(13) = {15,16}; Transfinite Line{13} = NX4 Using Progression RX4 ;

Line(14) = {1,9}; Transfinite Line{14} = NY1 Using Progression RY1 ;
Line(15) = {9,13}; Transfinite Line{15} = NY2 Using Progression RY2 ;
Circle(16)= {2,0,10};Transfinite Line{16} = NY1 Using Progression RY1 ;
Line(17) = {10,14}; Transfinite Line{17} = NY2 Using Progression RY2 ;
Circle(18)= { 5,0,11}; Transfinite Line{18} = NY1b Using Progression RY1b ;
Line(19) = {11,15}; Transfinite Line{19} = NY2 Using Progression RY2 ;
Line(20) = {6,12}; Transfinite Line{20} = NY1b Using Progression RY1b ;
Line(21) = {12,16}; Transfinite Line{21} = NY2 Using Progression RY2 ;
Line(22) = {7,10}; Transfinite Line{22} = NX2 Using Progression RX2 ;
Line(23) = {8,11}; Transfinite Line{23} = NX2 Using Progression RX2 ;

Line Loop(1) = {1,16,-8,-14};
Ruled Surface(1) = {1};
Transfinite Surface(1) = {1,2,10,9};

Line Loop(2) = {8,17,-11,-15};
Ruled Surface(2) = {2};
Transfinite Surface(2) = {9,10,14,13};

Line Loop(3) = {2,3,22,-16};
Ruled Surface(3) = {3};
Transfinite Surface(3) = {2,3,7,10};
Line Loop(4) = {4,23,-9,-22};
Ruled Surface(4) = {4};
Transfinite Surface(4) = {7,8,11,10};
Line Loop(5) = {5,6,18,-23};
Ruled Surface(5) = {5};
Transfinite Surface(5) = {4,5,11,8};

Line Loop(6) = {9,19,-12,-17};
Ruled Surface(6) = {6};
Transfinite Surface(6) = {10,11,15,14};

Line Loop(7) = {7,20,-10,-18};
Ruled Surface(7) = {7};
Transfinite Surface(7) = {5,6,12,11};
Line Loop(8) = {10,21,-13,-19};
Ruled Surface(8) = {8};
Transfinite Surface(8) = {11,12,16,15};

Recombine Surface(1);
Recombine Surface(2);
Recombine Surface(3);
Recombine Surface(4);
Recombine Surface(5);
Recombine Surface(6);
Recombine Surface(7);
Recombine Surface(8);

Symmetry { 0.0,1.0,0.0,0.0 }{Duplicata{Surface{1};}}
Transfinite Line{27} = NX1 Using Progression 1/RX1 ;
Symmetry { 0.0,1.0,0.0,0.0 }{Duplicata{Surface{2};}}
Transfinite Line{32} = NX1 Using Progression 1/RX1 ;
Transfinite Line{33} = NY2 Using Progression 1/RY2 ;
Symmetry { 0.0,1.0,0.0,0.0 }{Duplicata{Surface{3};}}
Symmetry { 0.0,1.0,0.0,0.0 }{Duplicata{Surface{4};}}
Transfinite Line{41} = NX3 Using Progression 1/RX3 ;
Symmetry { 0.0,1.0,0.0,0.0 }{Duplicata{Surface{5};}}
Symmetry { 0.0,1.0,0.0,0.0 }{Duplicata{Surface{6};}}
Transfinite Line{49} = NX3 Using Progression 1/RX3 ;
Symmetry { 0.0,1.0,0.0,0.0 }{Duplicata{Surface{7};}}
Transfinite Line{53} = NX4 Using Progression 1/RX4 ;
Symmetry { 0.0,1.0,0.0,0.0 }{Duplicata{Surface{8};}}
Transfinite Line{57} = NX4 Using Progression 1/RX4 ;

Finally the volumes and physical ID's:

karmanvolumes.png

Extrude {0.0,0.0,4.2} { Surface{1,2,3,4,5,6,7,8}; Layers{1}; Recombine;}
Extrude {0.0,0.0,4.2} { Surface{24,29,34,38,42,46,50,54}; Layers{1}; Recombine;}

Physical Volume("Fluid") = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};

Physical Surface("Wand") = {114,132,154,330,308,290};
Physical Surface("In") = { 78,100,254,276};
Physical Surface("Uit") = {202,224,378,400};
Physical Surface("Onder") = {272,360,404};
Physical Surface("Boven") = { 96,184,228};
Physical Surface("Voor") = {101,189,233,79,255,123,299,145,       321,167,343,277,365,409,387,211};
Physical Surface("Achter")= {1,2,3,4,5,6,7,8,24,29,34,38,42,46,50,54};

Start Gmsh and create the mesh with:

$ gmsh -3 model.geo
Info : Running '../gmsh -3 model.geo'

...

Info : Reading 'model.geo'
...
Info : Read 'model.geo'

...

Info : Mesh 3D complete (0.07 s)
Info : 34462 vertices 55190 elements
Info : Writing 'model.msh'
Info : Wrote 'model.msh'
Info : Stopped on Mon Feb 15 14:20:13 2010

karmanmesh.png

Copy the *.msh file and start the translator followed by the preprocessor:

$ cp model.msh karman.msh
$ gmsh2dolfyn
Gmsh2Dolfyn: Converts a Gmsh mesh file to Dolfyn format.
(Input must be in Gmsh version 2.0 ascii format.
Output is in Dolfyn version Jan 2009 format.)

Input Gmsh filename, excluding the .msh suffix
karman
Opening the Gmsh file
Reading MeshFormat
MeshFormat: 2.1 0 8
Reading PhysicalNames
Name 2 -> Wand
Name 3 -> In
Name 4 -> Uit
Name 5 -> Onder
Name 6 -> Boven
Name 7 -> Voor
Name 8 -> Achter
Name 1 -> Fluid
Reading Nodes
Creating the dolfyn .vrt file
Nodes written 34460
Total Gmsh elements to be read in:         51380
Creating the dolfyn .cel and .bnd files
Quad boundaries: 34460
Hexahedral cells: 16920
Writing the .inp file
Done gmsh2dolfyn
$ preprocessor
Dolfyn PreProcessor
Input casename:
karman
Using karman as input
Opening vertex file
Initialise vertex list
...
Found karman.inp !
Opening inp file
Region ID: 2 => Wand
Region ID: 3 => In
Region ID: 4 => Uit
Region ID: 5 => Onder
Region ID: 6 => Boven
Region ID: 7 => Voor
Region ID: 8 => Achter
Type 1 regions found: 7 8
WARNING: check inp-file
Enter scaling factor (1.0):
1.0
Using: 1.000000
Enter format of geometry file (bin|ascii):
bin
Dump binary geometry file
Done

Create the *.din file for karman:

title Omstroming van een cilinder, Re = 250
#
# Re = rho V D / mu
#    = 1.0 1.0 2.0 / 0.0001 = 20,000
#    = 1.0 1.0 2.0 / 0.008  = 250
#
steps 30000 1.0e-4

opendx off
use vtk
output every 10
thermal on
#turbulence,ke,0.01
#
# *** control parameters ***
#
scheme uvw lux 1.0
scheme T lux 1.0
#scheme keps lux 0.5

relax,0.7,0.3,0.7
rtol,0.1,0.05,0.01

slope uvw p1
slope p off
#slope keps p1
slope t p1

post U vert
post P vert
post T vert
#
# *** fluid properties ***
#
density 1.0
vislam 0.008
#vislam 0.0001
pref 1
monitor 2941

solver,w,off
init field 1.0 0.0 0.0,,1.e-4,1.e-4
init steps 10

#
# *** transient flow ***
#
transient,0.01,quad,1.0

#
# *** boundary conditions ***
#
boundary,In # inlet
inlet
1.0 0 0
1.0
293.0
inle
0.01 0.01
#
boundary,Uit # outlet
outlet
1.0
#
# cilinder wall
#
boundary,Wand
wall
noslip
0. 0.0 0.0
fixed
273. + 100.0

#
# the symmetry planes
#
boundary,Onder
symp
boundary,Boven
symp
boundary,Voor
symp
boundary,Achter
symp

Start dolfyn:.

$ dolfyn
This is dolfyn version 0.526
Copyright(C) 2002-2010 Cyclone Fluid Dynamics BV
NL-5583 XM, Waalre, The Netherlands
see http://www.cyclone.nl and http://www.dolfyn.net
Using Sparsekit2 by Yousef Saad
(C) 2005, the Regents of the University of Minnesota
Modules with patches (C) 2004-2010 by B. Tuinstra
see http://www.home.zonnet.nl/bouke_1/dolfyn
Tecplot interface (C) 2006 by S.B. Kuang
VTK interface updated (C) 2007 by J. Jacobs


Enter case:
karman
Using case: karman
Appending echo to file karman.txt
karman.geo binary

...

Done karman

After a 'little' while start VisIt (or your favourite postprocessor) with:

$ visit &

The result for the temperature is (laminar flow, Re 250):

The same model at a higher Reynolds number (turbulent flow, Re 20,000):

More movies are collected here.


<< First < Previous    



Cyclone www.dolfyn.net