BlockMesh

From OpenFOAMWiki
Revision as of 14:04, 19 April 2014 by Wyldckat (Talk | contribs)


1 Introduction

blockMesh is one of the most basic mesh generators in OpenFOAM. It relies on a single dictionary file blockMeshDict, usually placed inside the folder constant/polyMesh. The latest official documentation on how to use blockMesh can be found on the OpenFOAM User Guide and online at the OpenFOAM Foundation website at this page: 5.3 blockMesh

Valid versions: OF version 10.png OF version 11.png OF version 12.png OF version 13.png OF version 14.png OF version 15.png OF version 16.png OF version 17.png OF Version 20.png OF Version 21.png OF Version 22.png OF Version 23.png OF Version 14dev.png OF Version 15dev.png OF Version 16ext.png OF Version 30ext.png

Feel free to contribute to this page!


1.1 Synopsis

blockMesh [OPTIONS]

1.2 Description

As the name implies, blockMesh helps the user build the mesh with blocks. It relies on a single dictionary file blockMeshDict, usually located at constant/polyMesh/blockMeshDict. Inside that dictionary file should be defined:

  1. all of the reference vertices of mesh;
  2. all of the building blocks for the mesh, each block composed of:
    • 8 vertices (repeat vertices, for collapsing edges);
    • grading definition;
    • cell count over each major axis;
  3. optionally, one can assign special edge definitions for specific edges on blocks, such as arcs and splines;
  4. assign faces of blocks to patch names;
  5. and finally, be able to define special face merging, but associating/merging patches.

The following options can be used with blockMesh:

-case DIR

Execute the command on the case directory DIR. If not provided, use the current directory.

-dict FILE

Read dictionary from specified location.

-blockTopology

Write block edges and centres as .obj files, for visual inspection elsewhere.

-noFunctionObjects

Skip the execution of the functionObjects

-region NAME

Generate the mesh only for a specific region (e.g. for multi-region simulations).

-help

Display the help and exit


2 Tips

On this chapter are listed links and direct tips on using snappyHexMesh.

2.1 Using blockMesh to export blockMeshDict to .obj

Before there were any nice graphical user interfaces for visually designing and inspecting the blockMeshDict files, blockMesh can interpret the dictionary file and export it to an .obj file, which can be opened by any compatible 3D software, such as ParaView, JavaView and so on. There steps are as follows:

  1. Use the -blockTopology argument to dump out a blockTopology.obj file:
    blockMesh -blockTopology
  2. The vertex numbering in this file is consistent with that of the vertices in the blockMeshDict file.
  3. The file blockTopology.obj can be visualized in the following 3D software:
    • Visualize directly with JavaView;
    • Visualize directly in ParaView or convert the file to VTK if you prefer:
      objToVTK blockTopology.obj blockTopology.vtk
    • Import in Blender.
    • (fell free to add more...)


2.2 Graphical User Interfaces for visualizing and designing blockMeshDict

paraFoam -block
Introduced in OpenFOAM 2.0.0, this argument for the paraFoam script requires that the respective OpenFOAM plugin is built for ParaView. This means that ParaView has to be built from source code or to use the Deb/RPM packages provided by the OpenFOAM Foundation.