extBlockMesh extend OpenFOAM blockMesh with the capability of smoothing the mesh and snapping the boundary faces to a triSurfaceMesh (stl, obj,.. All formats read by OpenFOAM). With extBlockMesh, no need to define complex edges and expansion ratio in your blockMeshDict!

Installation

Linux instructions for OpenFOAM version 2.x.x:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# If needed source your Open FOAM bashrc
source OpenFOAM/OpenFOAM-2.2.x/etc/bashrc

# Download the source and move inside downloaded directory
git clone https://github.com/Etudes-NG/extBlockMesh
cd extBlockMesh

# Run the installation script
./Allwmake.sh

# Run the application in place of blockMesh
extBlockMesh

Usage

In order to use extBlockMesh, you need a valid blockMeshDict and a dictionary in the system folders named "smootherDict". This dictionary defines all parameters used by extBlockMesh.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.3.x                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      smootherDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

smoothControls
{
    // Max number of iterations
    maxIterations               500;
    
    // The regularizing speed of the transformation depends on the choice of the
    // transformation parameter
    transformParameter          0.666;

    // If average of cell quality increase is below improvementTolerance, switch
    // to min cycle
    meanImprovTol               1e-4;

    snapRelaxationTable         (1   0.5  0.25  0);
    meanRelaxationTable         (1.0 0.25 0.125 0);
    minRelaxationTable          (1.0 0.25 0.125 0);

    // During min cycle, if worst cell quality is not changing/increasing for 
    // maxIneffectiveIteration, stop the smoothing
    maxMinCycleNoChange          5;
    
    // Ratio of cell used for min cycle
    ratioWorstQualityForMin      0.2;
}


snapControls
{
    // Feature angle for feature edges detection
    // NOTE: angle is included angle, not feature angle and is in degrees.
    // The included angle is the smallest angle between two planes. For coplanar
    // faces it is 180, for straight angles it is 90. To pick up straight edges
    // only use included angle of 91 degrees
    featureAngle                 152;
    
    // 
    minEdgeForFeature            0;
    minFeatureEdgeLength         1e-20;

    boundarys
    {
        // List of boundary for wich you want a specific behavior: 
        // - snap to triSurface -> give the triSurface name
        // - use internal edges -> true or false
        
        Inlet
        {
            triSurface           Inlet.stl;
            internalFeatureEdges false;
        }
    }
}


// ************************************************************************* //

Examples

Example of bend T pipe.
This example can be found in the tutorial folder. In order to run it, simply call extBlockMesh in place of blockMesh.

Input blockMesh definition with snapping surface.

Resulting mesh after snapping and smoothing (mesh split by region)

Limitations

  • The input mesh needs to be valid.
  • extBlockMesh cannot handle boundary layers.