1. Home
  2. Tutorial
  3. Tutorial 2: Mesh Impact
  4. Meshing and Simulating

Meshing and Simulating

Meshing

Start Gmsh and create the mesh with:

gmsh -3 t3a.geo

Then let’s do the same for the second file:

gmsh -3 t3b.geo

Start Gmsh and create the mesh with:

Info    : Running 'gmsh -3 t3a.geo' [Gmsh 4.0.4, 1 node, max. 1 thread]
Info    : Started on Wed Nov 07 15:57:02 2018
Info    : Reading 't3a.geo'...
Info    : Reading 't1.geo'...
Info    : Done reading 't1.geo'
Info    : Done reading 't3a.geo'
Info    : Meshing 1D...
Info    : Meshing curve 1 (Line)
...
Info    : Meshing curve 86 (extruded)
Info    : Done meshing 1D (0 s)
Info    : Meshing 2D...
Info    : Meshing surface 1 (Plane, Delaunay)
...
Info    : Meshing surface 92 (extruded)
Info    : Done meshing 2D (0.078125 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    : Done meshing 3D (0.140625 s)
Info    : Optimizing 3D mesh...
Info    : Done optimizing 3D mesh (0 s)
Info    : 15570 vertices 33542 elements
Info    : Writing 't3a.msh'...
Info    : Done writing 't3a.msh'
Info    : Stopped on Wed Nov 07 15:57:02 2018

You can now open t3a.msh and t3b.msh to view the difference:

t3a – with the Recombine command

t3b – without the Recombine command

As can be seen, there is a difference in the 3D mesh, where the Recombine command generates only one element between any polygon in the 2D mesh, resulting in prisms. Leaving out this command, results in smaller, tetrahedral elements.

This can also be seen in the number of elements produces, shown in the output of the mesh-command:

t3a: 15570 vertices 33542 elements

t3b: 15570 vertices 90994 elements

Copying mesh

Again, to make sure the mesh file will not be overwritten by the results, we copy and rename the files:

cp t3a.msh t3ad.msh

and:

cp t3b.msh t3bd.msh

Converting to dolfyn input

We now convert the mesh into *.cel, a  *.vrt, a  *.bnd, and optionally an  *.inp file using gmsh2dolfyn, and selecting the correct file to convert, in our case: t3ad.

gmsh2dolfyn

and again for t3bd.

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
t3bd
 Opening the Gmsh file
 File t3bd.msh opened
 Reading MeshFormat
 MeshFormat: 4 0 8
 Reading PhysicalNames
 Name            2 -> S1                                                          
 Name            3 -> S2                                                          
 Name            1 -> Fluid                                                       
 Entities
 Entity            1  surface            2 S1                                     
 Entity           92  surface            3 S2                                     
 Entity            1  volume             1 Fluid                                  
 Entity            2  volume             1 Fluid                                  
 Entity            3  volume             1 Fluid                                  
 Entity            4  volume             1 Fluid                                  
 Physical entities found            6
 Reading Nodes
 Number of entity blocks:          81  Nodes:       15552
 Creating the dolfyn .vrt file
 File t3bd.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             10  Node            1
 Point             14  Node            1
 Point             15  Node            1
 Point             16  Node            1
 Point             20  Node            1
 Point             24  Node            1
 Point             39  Node            1
 Point             40  Node            1
 Point             44  Node            1
 Point             48  Node            1
 Point             96  Node            1
 Point             97  Node            1
 Point            101  Node            1
 Point            105  Node            1
 Curve              1  Nodes           7
 Curve              2  Nodes          23
 Curve              3  Nodes           7
 Curve              4  Nodes          23
 Curve              6  Nodes          23
 Curve              7  Nodes           7
 Curve              8  Nodes          23
 Curve              9  Nodes           7
 Curve             11  Nodes           3
 Curve             12  Nodes           3
 Curve             16  Nodes           3
 Curve             20  Nodes           3
 Curve             28  Nodes          23
 Curve             29  Nodes           7
 Curve             30  Nodes          23
 Curve             31  Nodes           7
 Curve             33  Nodes           8
 Curve             34  Nodes           8
 Curve             38  Nodes           8
 Curve             42  Nodes           8
 Curve             50  Nodes          23
 Curve             51  Nodes           7
 Curve             52  Nodes          23
 Curve             53  Nodes           7
 Curve             55  Nodes          23
 Curve             56  Nodes          23
 Curve             60  Nodes          23
 Curve             64  Nodes          23
 Curve             72  Nodes          23
 Curve             73  Nodes           7
 Curve             74  Nodes          23
 Curve             75  Nodes           7
 Curve             77  Nodes          15
 Curve             78  Nodes          15
 Curve             82  Nodes          15
 Curve             86  Nodes          15
 Surface            1  Nodes         224
 Surface           13  Nodes          69
 Surface           17  Nodes          21
 Surface           21  Nodes          69
 Surface           25  Nodes          21
 Surface           26  Nodes         224
 Surface           35  Nodes         184
 Surface           39  Nodes          56
 Surface           43  Nodes         184
 Surface           47  Nodes          56
 Surface           48  Nodes         224
 Surface           57  Nodes         529
 Surface           61  Nodes         161
 Surface           65  Nodes         529
 Surface           69  Nodes         161
 Surface           70  Nodes         224
 Surface           79  Nodes         345
 Surface           83  Nodes         105
 Surface           87  Nodes         345
 Surface           91  Nodes         105
 Surface           92  Nodes         224
 Volume             1  Nodes         672
 Volume             2  Nodes        1792
 Volume             3  Nodes        5152
 Volume             4  Nodes        3360
 Nodes written        15552
 Total Gmsh elements to be read in:       82110
 Creating the dolfyn .cel and .bnd files          14          23
 File t3bd.cel opened
 File t3bd.bnd opened
 Element            1 Fluid    Type            2         510
 Element           92 S2       Type            2         510
 Element            1 Fluid    Type            4        6120
 Element            2 Fluid    Type            4       13770
 Element            3 Fluid    Type            4       36720
 Element            4 Fluid    Type            4       24480
 Triangle boundaries:         1020
 Tetrahedral cells:          81090
 Writing the .inp file
 File t3bd.inp opened
 inp:           2 S1           T
 inp:           3 S2           T
 Done gmsh2dolfyn 2018

Running Pre-Processor

Now we will run the pre-processor.

dolgeo -s 1.0 -b t3ad

and

dolgeo -s 1.0 -b t3bd

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

The pre-processor is run with:

dolgeo -s 1.0 -b t3bd
 Dolfyn PreProcessor
 t3bd                             T T T F
 Using command line arguments
 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
 Using:    1.00000000      binary
 Dump binary geometry file
 Done

Running Simulation

Finaly we will run the dolfyn simulations.

dolfyn t3ad

and:

dolfyn t3bd

If no case name is inputted directly, you will be prompted. If so, enter case name t3ad and t3bd.

The pre-processor is run with:

dolfyn t3ad
 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


 Using case: t3ad
 Appending echo to file t3ad.txt
 Calling dolfyn t3ad .dge
 t3ad.dge binary
. . .
 *** CONVERGENCE ***   7.71197723E-04
 Opening restart file
 File t3ad.rst
 Restartfile 400 written

 Writing VTK data file... t3ad.vtk
 Done
 Writing Full Gmsh file...
 Done
 Maximum change in PP:   7.76433590E-05  0.182830691       1.00000005E-03
 Arrays cleaned up
 Done t3ad
 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? No Yes

How can we help?