## Fifth model (t5.geo)

Use the Gmsh tutorial "t5.geo":

lcar1 = .1;
lcar2 = .05;
lcar3 = .02;

Point(1) = {0.5,0.5,0.5,lcar2}; Point(2) = {0.5,0.5,0,lcar1};
Point(3) = {0,0.5,0.5,lcar1}; Point(4) = {0,0,0.5,lcar1};
Point(5) = {0.5,0,0.5,lcar1}; Point(6) = {0.5,0,0,lcar1};
Point(7) = {0,0.5,0,lcar1}; Point(8) = {0,1,0,lcar1};
Point(9) = {1,1,0,lcar1}; Point(10) = {0,0,1,lcar1};
Point(11) = {0,1,1,lcar1}; Point(12) = {1,1,1,lcar1};
Point(13) = {1,0,1,lcar1}; Point(14) = {1,0,0,lcar1};

Line(1) = {8,9}; Line(2) = {9,12}; Line(3) = {12,11};
Line(4) = {11,8}; Line(5) = {9,14}; Line(6) = {14,13};
Line(7) = {13,12}; Line(8) = {11,10}; Line(9) = {10,13};
Line(10) = {10,4}; Line(11) = {4,5}; Line(12) = {5,6};
Line(13) = {6,2}; Line(14) = {2,1}; Line(15) = {1,3};
Line(16) = {3,7}; Line(17) = {7,2}; Line(18) = {3,4};
Line(19) = {5,1}; Line(20) = {7,8}; Line(21) = {6,14};

Line Loop(22) = {-11,-19,-15,-18}; Plane Surface(23) = {22};
Line Loop(24) = {16,17,14,15}; Plane Surface(25) = {24};
Line Loop(26) = {-17,20,1,5,-21,13}; Plane Surface(27) = {26};
Line Loop(28) = {-4,-1,-2,-3}; Plane Surface(29) = {28};
Line Loop(30) = {-7,2,-5,-6}; Plane Surface(31) = {30};
Line Loop(32) = {6,-9,10,11,12,21}; Plane Surface(33) = {32};
Line Loop(34) = {7,3,8,9}; Plane Surface(35) = {34};
Line Loop(36) = {-10,18,-16,-20,4,-8}; Plane Surface(37) = {36};
Line Loop(38) = {-14,-13,-12,19}; Plane Surface(39) = {38};

// Instead of using included files, we now use a user-defined function
// in order to carve some holes in the cube:

Function CheeseHole

p1 = newp; Point(p1) = {x, y, z, lcar3} ;
p2 = newp; Point(p2) = {x+r,y, z, lcar3} ;
p3 = newp; Point(p3) = {x, y+r,z, lcar3} ;
p4 = newp; Point(p4) = {x, y, z+r,lcar3} ;
p5 = newp; Point(p5) = {x-r,y, z, lcar3} ;
p6 = newp; Point(p6) = {x, y-r,z, lcar3} ;
p7 = newp; Point(p7) = {x, y, z-r,lcar3} ;

c1 = newreg; Circle(c1) = {p2,p1,p7};
c2 = newreg; Circle(c2) = {p7,p1,p5};
c3 = newreg; Circle(c3) = {p5,p1,p4};
c4 = newreg; Circle(c4) = {p4,p1,p2};
c5 = newreg; Circle(c5) = {p2,p1,p3};
c6 = newreg; Circle(c6) = {p3,p1,p5};
c7 = newreg; Circle(c7) = {p5,p1,p6};
c8 = newreg; Circle(c8) = {p6,p1,p2};
c9 = newreg; Circle(c9) = {p7,p1,p3};
c10 = newreg; Circle(c10) = {p3,p1,p4};
c11 = newreg; Circle(c11) = {p4,p1,p6};
c12 = newreg; Circle(c12) = {p6,p1,p7};

// We need non-plane surfaces to define the spherical holes. Here we
// use ruled surfaces, which can have 3 or 4 sides:

l1 = newreg; Line Loop(l1) = {c5,c10,c4}; Ruled Surface(newreg) = {l1};
l2 = newreg; Line Loop(l2) = {c9,-c5,c1}; Ruled Surface(newreg) = {l2};
l3 = newreg; Line Loop(l3) = {c12,-c8,-c1}; Ruled Surface(newreg) = {l3};
l4 = newreg; Line Loop(l4) = {c8,-c4,c11}; Ruled Surface(newreg) = {l4};
l5 = newreg; Line Loop(l5) = {-c10,c6,c3}; Ruled Surface(newreg) = {l5};
l6 = newreg; Line Loop(l6) = {-c11,-c3,c7}; Ruled Surface(newreg) = {l6};
l7 = newreg; Line Loop(l7) = {-c2,-c7,-c12};Ruled Surface(newreg) = {l7};
l8 = newreg; Line Loop(l8) = {-c6,-c9,c2}; Ruled Surface(newreg) = {l8};

// We then store the surface loops identification numbers in list
// for later reference (we will need these to define the final
// volume):

theloops[t] = newreg ;

Surface Loop(theloops[t]) = {l8+1,l5+1,l1+1,l2+1,l3+1,l7+1,l6+1,l4+1};

Physical Surface(Sprintf("Sphere_%g",t)) = {l8+1,l5+1,l1+1,l2+1,l3+1,l7+1,l6+1,l4+1};

thehole = newreg ;
Volume(thehole) = theloops[t] ;

Return

// We can use a `For' loop to generate five holes in the cube:

x = 0 ; y = 0.75 ; z = 0 ; r = 0.09 ;

For t In {1:5}

x += 0.166 ;
z += 0.166 ;

//Sprintf(s,"Sphere_%g",t);
//s = 'ss';
//Printf("we printen %s",s);

Call CheeseHole ;

Printf("Hole %g (center = {%g,%g,%g}, radius = %g) has number %g!",
t, x, y, z, r, thehole) ;
EndFor

theloops = newreg ;
Surface Loop(theloops) = {35,31,29,37,33,23,39,25,27} ;
Volume(186) = {theloops[]} ;

Physical Volume ("Fluid") = 186 ;

Physical Surface("Floor") = {27};
Physical Surface("Wall_1") = {29};
Physical Surface("Wall_2") = {31};
Physical Surface("Wall_3") = {33};
Physical Surface("Wall_4") = {37};
Physical Surface("Roof") = {35};
Physical Surface("Box") = {25,39,23};

Start Gmsh and create the mesh with:

\$ gmsh -3 t5.geo
Info : Running '../gmsh -3 -optimize t5.geo'

...

Info : Opti : 0.90 < QUAL < 1.00 : 49 elements
Info : Mesh 3D optimization complete (4.87631 s)
Info : 6840 vertices 43817 elements
Info : Writing 't5.msh'
Info : Wrote 't5.msh'
Info : Stopped on Thu Apr 16 14:46:23 2009

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

\$ cp t5.msh t5d.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
t5d
Opening the Gmsh file
Creating the dolfyn .vrt file
Total Gmsh elements to be read in: 27178
Creating the dolfyn .cel and .bnd files
Writing the .inp file
Done gmsh2dolfyn
\$ preprocessor
Dolfyn PreProcessor
Input casename:
t5d
Opening vertex file
Initialise vertex list
...
Region ID: 1 => Sphere_1
Region ID: 2 => Sphere_2
Region ID: 3 => Sphere_3
Region ID: 4 => Sphere_4
Region ID: 5 => Sphere_5
Region ID: 7 => Floor
Region ID: 8 => Wall_1
Region ID: 9 => Wall_2
Region ID: 10 => Wall_3
Region ID: 11 => Wall_4
Region ID: 12 => Roof
Region ID: 13 => Box
Type 1 regions found: 12 13
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

The *.din file for t5d contains:

title Test Gmsh t5.geo model
steps 200 1.e-6
density 1.2
vislam 18.e-6
opendx off
use gmsh

scheme UVW LUX 0.8
scheme KEPS UD 1.0
scheme T LUX 1.0
relax 0.5 0.2 0.5 0.6

slope UVW vnf
slope P vnf
slope T vnf

thermal on
init,field,0.0 0.0 0.0,,1.e-4,1e-4
init steps 0
gravity 0 -9.81 0

post t cell
post t vert

set T0 273.0
set T1 \$T0 + 50.0
limit t lower \$T0 + 20
limit t upper \$T1

# safety first
boundary,0
wall
noslip
0.0 0.0 0.0

boundary,floor
wall
noslip
0.0 0.0 0.0
fixed
\$T0 + 20 0.0

boundary,wall_1
wall
noslip
0.0 0.0 0.0
fixed
\$T0 + 20 0.0

boundary,wall_2
wall
noslip
0.0 0.0 0.0
fixed
\$T0 + 20 0.0

boundary,wall_3
wall
noslip
0.0 0.0 0.0
fixed
\$T0 + 20 0.0

boundary,wall_4
wall
noslip
0.0 0.0 0.0
fixed
\$T0 + 20 0.0

boundary,Roof
wall
noslip
0.0 0.0 0.0

boundary,Roof
symp

boundary,box
wall
noslip
0.0 0.0 0.0
fixed
\$T0 + 20 0.0

boundary,sphere_1
wall
noslip
0.0 0.0 0.0
fixed
\$T1 0.0

boundary,sphere_2
wall
noslip
0.0 0.0 0.0
fixed
\$T1 0.0

boundary,sphere_3
wall
noslip
0.0 0.0 0.0
fixed
\$T1 0.0

boundary,sphere_4
wall
noslip
0.0 0.0 0.0
fixed
\$T1 0.0

boundary,sphere_5
wall
noslip
0.0 0.0 0.0
fixed
\$T1 0.0

Start dolfyn:.

\$ dolfyn
This is dolfyn version 0.524
Copyright(C) 2002-2009 Cyclone Fluid Dynamics BV
NL-5583 XM, Waalre, The Netherlands
see http://www.cyclone.nl and http://www.dolfyn.net
(C) 2005, the Regents of the University of Minnesota
Modules with patches (C) 2004-2008 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:
t5d
Using case: t5d
Appending echo to file t5d.txt
t5d.geo binary

...

Writing Gmsh data file... 4324
Writing Gmsh data vectors cell
Writing Gmsh data pressure cell
Writing GMSH data temperature cell relative to 273.0000
Writing GMSH data temperature vertex relative to 273.0000
Done

...

Done t5d

Finally start Gmsh with:

\$ gmsh t5d.msh t5d_tc.msh

The result in Gmsh is:

 << First < Previous Next > Last >>