Gmsh for dolfyn tutorial (2 and 3)


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)

Second model (t3a.geo)

Use the Gmsh tutorial "t3a.geo":

Include "t1.geo";

// As in `t2.geo', we plan to perform an extrusion along the z axis.
// But here, instead of only extruding the geometry, we also want to
// extrude the 2D mesh. This is done with the same `Extrude' command,
// but by specifying element 'Layers' (2 layers in this case, the
// first one with 8 subdivisions and the second one with 2
// subdivisions, both with a height of h/2):

h = 0.1;
s = 0.025; // cell length

// Extrude {0,0,h} {
// Surface{6}; Layers{ {8,2}, {0.5,1} };
// }

Extrude {0,0,h} {
Surface{6}; Layers{h/s}; Recombine;
}

// The extrusion can also be performed with a rotation instead of a
// translation, and the resulting mesh can be recombined into prisms
// (we use only one layer here, with 7 subdivisions). All rotations
// are specified by an axis direction ({0,1,0}), an axis point
// ({-0.1,0,0.1}) and a rotation angle (-Pi/2):

Extrude { {0,1,0} , {-0.1,0,0.1} , -Pi/2 } {
Surface{28}; Layers{9}; Recombine;
}

// Note that a translation ({-2*h,0,0}) and a rotation ({1,0,0},
// {0,0.15,0.25}, Pi/2) can also be combined:

out[] = Extrude { {-6*h,0,0}, {1,0,0} , {0,0.15,0.25} , Pi } {
Surface{news-1}; Layers{6*h/s}; Recombine;
};

// For decent outlet we need to extrude once again...

Extrude {-4*h,0,0} {
Surface{news-1}; Layers{4*h/s}; Recombine;
}

// ...

// Physical Volume("Fluid") = {1, 2, 3, out[1]};

// Mesh.CharacteristicLengthFactor = 4;
// General.Color.Text = White;
// Geometry.Color.Points = Orange;
// Mesh.Color.Points = {255,0,0};
// Geometry.Color.Surfaces = Geometry.Color.Points;

//
// Boundaries (non-default)
//
Physical Volume("Fluid") = {1, 2, 3, 4};
Physical Surface("S1") = {6};
Physical Surface("S2") = {94};

Note the two "Physical Surfaces" ("S1" and "S2").

Start Gmsh and create the mesh with:

$ gmsh -3 t3a.geo
Info : Running '../gmsh -3 t3a.geo'
Info : Started on Thu Apr 16 13:56:43 2009
Info : Reading 't3a.geo'
Info : Reading 't1.geo'
Info : Read 't1.geo'
Info : Read 't3a.geo'
Info : Meshing 1D...
Info : Meshing curve 1 (Line)
Info : Meshing curve 2 (Line)

...

Info : Mesh 2D complete (0.176011 s)
Info : Meshing 3D...
Info : Meshing volume 1 (extruded)
Info : Meshing volume 2 (extruded)
Info : Meshing volume 3 (extruded)
Info : Meshing volume 4 (extruded)
Info : Mesh 3D complete (0.360023 s)
Info : 12006 vertices 25886 elements
Info : Writing 't3a.msh'
Info : Wrote 't3a.msh'
Info : Stopped on Thu Apr 16 13:56:43 2009


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

$ cp t3a.msh t3ad.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
t3ad
Opening the Gmsh file
Reading MeshFormat
Reading PhysicalNames
Reading Nodes
Creating the dolfyn .vrt file
Total Gmsh elements to be read in: 21010
Creating the dolfyn .cel and .bnd files
Writing the .inp file
Done gmsh2dolfyn
$ preprocessor
Dolfyn PreProcessor
Input casename:
t3ad
Using t3ad as input
Opening vertex file
Initialise vertex list
...
Region ID: 2 => S1
Region ID: 3 => S2
Type 1 regions found: 2 3
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 t3ad contains:

title Test Gmsh t3.geo model

...

boundary,0
wall
noslip
0.0 0.0 0.0
adiabatic

boundary,S1
inlet
0.0 0.1 0.0
1.2
293
inle
0.05 0.01

boundary,S2
outlet
1.0

Note the the boundaries are simply called "S1" and "S2" (corresponding to the contents of "t3a.geo").

$ 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
Using Sparsekit2 by Yousef Saad
(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:
t3ad
Using case: t3ad
Appending echo to file t3ad.txt
t3ad.geo binary

...

Writing Gmsh data file... 764
Writing Gmsh data vectors cell
Writing Gmsh data pressure cell
Done

...

Done t3ad

Finally start Gmsh with:

$ gmsh t3ad.msh t3ad_uvwc.msh

The result in Gmsh is:

t3ad.png

Third model (t3b.geo)

Remove the "Recombine" commands from "t3a.geo". The result is:

$ diff t3a.geo t3b.geo
28c28
< Surface{6}; Layers{h/s}; Recombine;
---
> Surface{6}; Layers{h/s};
38c38
< Surface{28}; Layers{9}; Recombine;
---
> Surface{28}; Layers{9};
45c45
< Surface{news-1}; Layers{6*h/s}; Recombine;
---
> Surface{news-1}; Layers{6*h/s};
51c51
< Surface{news-1}; Layers{4*h/s}; Recombine;
---
> Surface{news-1}; Layers{4*h/s};

Start Gmsh:

$ gmsh -3 -optimize t3b.geo
Info : Running '../gmsh -3 t3b.geo'
Info : Started on Thu Apr 16 14:13:13 2009
Info : Reading 't3b.geo'
Info : Reading 't1.geo'
Info : Read 't1.geo'
Info : Read 't3b.geo'
Info : Meshing 1D...
Info : Meshing curve 1 (Line)
Info : Meshing curve 2 (Line)

...

Info : Meshing surface 89 (extruded)
Info : Remeshing surface 93
Info : Meshing surface 93 (extruded)
Info : Mesh 3D complete (1.53209 s)
Info : Optimizing 3D...
Info : Mesh 3D optimization complete (0 s)
Info : 12006 vertices 69558 elements
Info : Writing 't3b.msh'
Info : Wrote 't3b.msh'
Info : Stopped on Thu Apr 16 14:13:15 2009


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

$ cp t3b.msh t3bd.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
t3bd
Opening the Gmsh file
Reading MeshFormat
Reading PhysicalNames
Reading Nodes
Creating the dolfyn .vrt file
Total Gmsh elements to be read in: 61502
Creating the dolfyn .cel and .bnd files
Writing the .inp file
Done gmsh2dolfyn
$ preprocessor
Dolfyn PreProcessor
Input casename:
t3bd
Using t3bd as input
Opening vertex file
Initialise vertex list
...
Region ID: 2 => S1
Region ID: 3 => S2
Type 1 regions found: 2 3
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

Using the same *.din file for t3bd!

$ 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
Using Sparsekit2 by Yousef Saad
(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:
t3bd
Using case: t3bd
Appending echo to file t3bd.txt
t3bd.geo binary

...

Writing Gmsh data file... 764
Writing Gmsh data vectors cell
Writing Gmsh data pressure cell
Done

...

Done t3bd

Finally start Gmsh with:

$ gmsh t3bd.msh t3bd_uvwc.msh

The result in Gmsh is:

t3bd.png


<< First < Previous Next > Last >>



Cyclone www.dolfyn.net