1. Home
  2. Tutorial
  3. Tutorial 1: Basics
  4. Meshing and Simulating

Meshing and Simulating

Meshing

Start Gmsh and create the mesh with:

gmsh -3 -optimize t2.geo

Possible output

Start Gmsh and create the mesh with:

gmsh -3 -optimize t2.geo
Info : Running 'gmsh -3 -optimize t2.geo' [Gmsh 4.0.4, 1 node, max. 1 thread]
Info : Started on Wed Oct 31 16:19:00 2018
Info : Reading 't2.geo'...
Info : Reading 't1.geo'...
Info : Done reading 't1.geo'
New surfaces '12' and '17'
Info : Done reading 't2.geo'
Info : Meshing 1D...
Info : Meshing curve 1 (Line)
Info : Meshing curve 2 (Line)
Info : Meshing curve 3 (Line)
Info : Meshing curve 4 (Line)
Info : Meshing curve 5 (Line)
Info : Meshing curve 7 (Line)
Info : Meshing curve 8 (Line)
Info : Meshing curve 13 (Line)
Info : Meshing curve 14 (Line)
Info : Meshing curve 15 (Line)
Info : Meshing curve 16 (Line)
Info : Meshing curve 18 (Line)
Info : Meshing curve 19 (Line)
Info : Meshing curve 20 (Line)
Info : Meshing curve 110 (Line)
Info : Meshing curve 111 (Line)
Info : Meshing curve 112 (Line)
Info : Meshing curve 113 (Line)
Info : Meshing curve 114 (Line)
Info : Meshing curve 115 (Line)
Info : Done meshing 1D (0.015625 s)
Info : Meshing 2D...
Info : Meshing surface 1 (Plane, Delaunay)
Info : Meshing surface 11 (Plane, Delaunay)
Info : Meshing surface 12 (Plane, Delaunay)
Info : Meshing surface 17 (Plane, Delaunay)
Info : Meshing surface 119 (Plane, Delaunay)
Info : Meshing surface 121 (Plane, Delaunay)
Info : Meshing surface 123 (Plane, Delaunay)
Info : Meshing surface 125 (Plane, Delaunay)
Info : Meshing surface 138 (Surface, MeshAdapt)
Info : Meshing surface 142 (Surface, MeshAdapt)
Info : Meshing surface 146 (Surface, MeshAdapt)
Info : Done meshing 2D (0.21875 s)
Info : Meshing 3D...
Info : Delaunay Meshing 2 volumes with 1 connected components
Info : Tetrahedrization of 2041 points in 0.03125 seconds
Info : Reconstructing mesh ...
Info : Creating surface mesh...
Info : Identifying boundary edges...
Info : Boundary Recovery...
Info : Writing to GRegion...
Info : Reconstruct time : 0.078125 sec
Info : Found region 129
Info : Found region 130
Info : 0 points created - Worst tet radius is 3.69956 (PTS removed 0 0)
Info : 500 points created - Worst tet radius is 1.13479 (PTS removed 0 0)
Info : 3D point insertion terminated (2809 points created):
Info : - 0 Delaunay cavities modified for star shapeness
Info : - 0 points could not be inserted
Info : - 11002 tetrahedra created in 0.0625 sec. (176032 tets/sec.)
Info : Done meshing 3D (0.1875 s)
Info : Optimizing 3D mesh...
Info : Optimizing volume 129
Info : Opti : STARTS with 2.70000E-03 QBAD 4.45065E-03 QAVG 7.38989E-01
Info : Opti : 0.00 < QUAL < 0.10 : 14 elements
Info : Opti : 0.10 < QUAL < 0.20 : 71 elements
Info : Opti : 0.20 < QUAL < 0.30 : 77 elements
Info : Opti : 0.30 < QUAL < 0.40 : 134 elements
Info : Opti : 0.40 < QUAL < 0.50 : 234 elements
Info : Opti : 0.50 < QUAL < 0.60 : 484 elements
Info : Opti : 0.60 < QUAL < 0.70 : 1178 elements
Info : Opti : 0.70 < QUAL < 0.80 : 1862 elements
Info : Opti : 0.80 < QUAL < 0.90 : 1970 elements
Info : Opti : 0.90 < QUAL < 1.00 : 784 elements
Info : Opti : (159,0,2) = 2.70000E-03 QBAD 2.29759E-01 QAVG 7.53441E-01 ( 0.016 sec)
Info : Opti : (160,0,2) = 2.70000E-03 QBAD 3.00593E-01 QAVG 7.53551E-01 ( 0.016 sec)
Info : Opti : no ill-shaped tets in the mesh ;-)
Info : Opti : 0.00 < QUAL < 0.10 : 0 elements
Info : Opti : 0.10 < QUAL < 0.20 : 0 elements
Info : Opti : 0.20 < QUAL < 0.30 : 0 elements
Info : Opti : 0.30 < QUAL < 0.40 : 121 elements
Info : Opti : 0.40 < QUAL < 0.50 : 220 elements
Info : Opti : 0.50 < QUAL < 0.60 : 505 elements
Info : Opti : 0.60 < QUAL < 0.70 : 1174 elements
Info : Opti : 0.70 < QUAL < 0.80 : 1872 elements
Info : Opti : 0.80 < QUAL < 0.90 : 1984 elements
Info : Opti : 0.90 < QUAL < 1.00 : 786 elements
Info : Optimizing volume 130
Info : Opti : STARTS with 1.80000E-03 QBAD 1.86530E-02 QAVG 7.27254E-01
Info : Opti : 0.00 < QUAL < 0.10 : 16 elements
Info : Opti : 0.10 < QUAL < 0.20 : 37 elements
Info : Opti : 0.20 < QUAL < 0.30 : 58 elements
Info : Opti : 0.30 < QUAL < 0.40 : 87 elements
Info : Opti : 0.40 < QUAL < 0.50 : 151 elements
Info : Opti : 0.50 < QUAL < 0.60 : 352 elements
Info : Opti : 0.60 < QUAL < 0.70 : 776 elements
Info : Opti : 0.70 < QUAL < 0.80 : 1174 elements
Info : Opti : 0.80 < QUAL < 0.90 : 1137 elements
Info : Opti : 0.90 < QUAL < 1.00 : 406 elements
Info : Opti : (110,0,7) = 1.80000E-03 QBAD 2.46333E-01 QAVG 7.43729E-01 ( 0.000 sec)
Info : Opti : (111,0,7) = 1.80000E-03 QBAD 2.83565E-01 QAVG 7.43863E-01 ( 0.000 sec)
Info : Opti : no ill-shaped tets in the mesh ;-)
Info : Opti : 0.00 < QUAL < 0.10 : 0 elements
Info : Opti : 0.10 < QUAL < 0.20 : 0 elements
Info : Opti : 0.20 < QUAL < 0.30 : 1 elements
Info : Opti : 0.30 < QUAL < 0.40 : 75 elements
Info : Opti : 0.40 < QUAL < 0.50 : 139 elements
Info : Opti : 0.50 < QUAL < 0.60 : 362 elements
Info : Opti : 0.60 < QUAL < 0.70 : 781 elements
Info : Opti : 0.70 < QUAL < 0.80 : 1157 elements
Info : Opti : 0.80 < QUAL < 0.90 : 1168 elements
Info : Opti : 0.90 < QUAL < 1.00 : 407 elements
Info : Done optimizing 3D mesh (0.03125 s)
Info : 2809 vertices 15138 elements
Info : Writing 't2.msh'...
Info : Done writing 't2.msh'
Info : Stopped on Wed Oct 31 16:19:01 2018

You can now open t2.msh to see something similar to the following:

Copying mesh

If you recall, the *.din file tells dolfyn to create a  *.msh file containing the results. Keeping the same case-name will cause the file to be overwritten. Due to built-in randomness, no 2 meshes created with Gmsh will be the same. For this reason, it is advised to copy the file and rename it for the simulation purposes.

Copying and renaming the file can be performed however you prefer, for example with the following command:

cp t2.msh t2d.msh

Converting to dolfyn input

Because dolfyn uses its own set of input files, we now need to convert the mesh into *.cel, a  *.vrt, a  *.bnd, and optionally an  *.inp file.

This is performed using gmsh2dolfyn, and selecting the correct file to convert, in our case: t2d.

gmsh2dolfyn

Possible output

Start gmsh2dolfyn converter with:

gmsh2dolfyn
Gmsh2Dolfyn: Converts a Gmsh mesh file to Dolfyn format.
 Input must be in Gmsh version 2.0, 2.1, 2.2 or 4 ascii format.

 Input Gmsh filename, excluding the .msh suffix
t2d
 Opening the Gmsh file
 File t2d.msh opened
 Reading MeshFormat
 MeshFormat: 4 0 8
 Reading PhysicalNames
 Name            2 -> Inlet
 Name            3 -> Outlet
 Name            1 -> Fluid
 Entities
 Entity          123  surface            2 Inlet
 Entity          142  surface            3 Outlet
 Entity          129  volume             1 Fluid
 Entity          130  volume             1 Fluid
 Physical entities found            4
 Reading Nodes
 Number of entity blocks:          45  Nodes:        1531
 Creating the dolfyn .vrt file
 File t2d.vrt opened
 Point              1  Node            1
 Point              2  Node            1
 Point              3  Node            1
 Point              4  Node            1
 Point              5  Node            1
 Point              6  Node            1
 Point              7  Node            1
 Point              8  Node            1
 Point             12  Node            1
 Point             16  Node            1
 Point             18  Node            1
 Point             22  Node            1
 Curve              1  Nodes           5
 Curve              2  Nodes          12
 Curve              3  Nodes           2
 Curve              4  Nodes          23
 Curve              5  Nodes          23
 Curve              7  Nodes          11
 Curve              8  Nodes           2
 Curve             13  Nodes          23
 Curve             14  Nodes           5
 Curve             15  Nodes          12
 Curve             16  Nodes           2
 Curve            110  Nodes           9
 Curve            111  Nodes           4
 Curve            112  Nodes           9
 Curve            113  Nodes           4
 Curve            131  Nodes          23
 Curve            132  Nodes           3
 Curve            133  Nodes          16
 Curve            137  Nodes           9
 Curve            141  Nodes           6
 Surface            1  Nodes          86
 Surface           11  Nodes          49
 Surface           12  Nodes          86
 Surface          119  Nodes          72
 Surface          121  Nodes         266
 Surface          123  Nodes          50
 Surface          125  Nodes          21
 Surface          138  Nodes         253
 Surface          142  Nodes          22
 Surface          146  Nodes          74
 Surface          151  Nodes          65
 Volume           129  Nodes         177
 Volume           130  Nodes          95
 Nodes written         1531
 Total Gmsh elements to be read in:        5446
 Creating the dolfyn .cel and .bnd files          14          23
 File t2d.cel opened
 File t2d.bnd opened
 Element          123 Inlet    Type            2         125
 Element          142 Outlet   Type            2          66
 Element          129 Fluid    Type            4        3035
 Element          130 Fluid    Type            4        2220
 Triangle boundaries:          191
 Tetrahedral cells:           5255
 Writing the .inp file
 File t2d.inp opened
 inp:           2 Inlet        T
 inp:           3 Outlet       T
 Done gmsh2dolfyn 2018

Running Pre-Processor

Now we will run the pre-processor.

dolgeo -s 1.0 -b t2d

If no options are given with the dolgeo command, you will be prompted for them. Fill in case name t2d, scaling factor of 1.0 (default) and bin as format of geometry file.

Possible output

The pre-processor is run with:

dolgeo
Dolfyn PreProcessor
Input casename:
t2d
Using t2d as input
Opening vertex file
Initialise vertex list
. . .
Region ID: 2 => Inlet
Region ID: 3 => Outlet
Type 1 regions found: 2 3
WARNING: check inp-file
Enter scaling factor (1.0):
1.0
Enter format of geometry file (bin|ascii):
bin
Using: 1.00000000 binary
Dump binary geometry file
Done

Running Simulation

Finaly we will run the dolfyn simulation.

dolfyn t2d

If no case name is inputted directly, you will be prompted. If so, enter case name t2d.

Possible output

The pre-processor is run with:

dolfyn
This is dolfyn version 0.608
Copyright(C) 2002-2016 Cyclone Fluid Dynamics BV
NL-5583 XM, Waalre, The Netherlands
see http://www.cyclone.nl and https://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 (tecplt.f90) (C) 2006-2012 by
S.B. Kuang, UNSW, Sydney, Australia
VTK interface updated (C) 2007 by J. Jacobs
Static boundary conditions (C) 2011 by J. JoJo
MKL contributions and suggestions by Runar

Enter case:
t2d
Using case: t2d
Calling dolfyn t2d .dge
t2d.dge binary

.
.
.

*** CONVERGENCE *** 9.43839725E-04
Opening restart file
File t2d.rst
Restartfile 400 written

Writing VTK data file... t2d.vtk
Done
Writing Full Gmsh file...
Done
Maximum change in PP: 1.39341195E-04 2.60319840E-02 1.00000005E-03
Arrays cleaned up
Done t2d
Bye!

That’s it! Now all the calculations have been carried out, we can start to analyze the output.

Was this article helpful to you? Yes No

How can we help?