SimScale CAE Forum

BlockMesh Grid Generation


#1

I think including the ability to create structured grids using the OpenFOAM BlockMesh tool would be very beneficial. For those not familiar with BlockMesh, this is a built-in tool for OpenFOAM that allows the user to create simple grids for both 2D and 3D analysis. The grid is controlled using a small text file that describes the domain of the problem. Below is a copy of the BlockMeshDist for analysis of the 2D turbulence in a box validation case:

1/*--------------------------------*- C++ -*----------------------------------*\ 
2| =========                 |                                                 | 
3| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           | 
4|  \\    /   O peration     | Version:  v1812                                 | 
5|   \\  /    A nd           | Web:      www.OpenFOAM.com                      | 
6|    \\/     M anipulation  |                                                 | 
7\*---------------------------------------------------------------------------*/ 
8FoamFile 
9{ 
10    version     2.0; 
11    format      ascii; 
12    class       dictionary; 
13    object      blockMeshDict; 
14} 
15// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 
16 
17scale   0.1; 
18 
19vertices 
20( 
21    (0 0 0) 
22    (1 0 0) 
23    (1 1 0) 
24    (0 1 0) 
25    (0 0 0.1) 
26    (1 0 0.1) 
27    (1 1 0.1) 
28    (0 1 0.1) 
29); 
30 
31blocks 
32( 
33    hex (0 1 2 3 4 5 6 7) (20 20 1) simpleGrading (1 1 1) 
34); 
35 
36edges 
37( 
38); 
39 
40boundary 
41( 
42    movingWall 
43    { 
44        type wall; 
45        faces 
46        ( 
47            (3 7 6 2) 
48        ); 
49    } 
50    fixedWalls 
51    { 
52        type wall; 
53        faces 
54        ( 
55            (0 4 7 3) 
56            (2 6 5 1) 
57            (1 5 4 0) 
58        ); 
59    } 
60    frontAndBack 
61    { 
62        type empty; 
63        faces 
64        ( 
65            (0 3 2 1) 
66            (4 5 6 7) 
67        ); 
68    } 
69); 
70 
71mergePatchPairs 
72( 
73); 
74 
75// ************************************************************************* //

This file creates a box that is 1m long, 1m tall, and 0.1m deep. It also names the various boundaries of the box accordingly. As previously mentioned, this grid setup is used for the lid-driven cavity turbulence in a box validation problem. Other similar problems that can be calculated using this method include the Backwards Facing Step, most 2D airfoil analyses, and an Axisymmetric Methane Flame.