Difference between revisions of "BlockMesh"

From OpenFOAMWiki
(Began restructuring of this page to make it a bit more like the other pages, such as snappyHexMesh)
Line 1: Line 1:
Trick:
+
__FORCETOC__
  
1. use the -blockTopology argument to dump out a blockTopology.obj file.
+
= Introduction =
 +
<tt>blockMesh</tt> is one of the most basic mesh generators in OpenFOAM. It relies on a single dictionary file <tt>blockMeshDict</tt>, usually placed inside the folder <tt>constant/polyMesh</tt>. The latest official documentation on how to use <tt>blockMesh</tt> can be found on the OpenFOAM User Guide and online at the OpenFOAM Foundation website at this page: [http://www.openfoam.org/docs/user/blockMesh.php 5.3 blockMesh]
  
2. the vertex numbering in this file is consistent with that of the vertices in the blockMeshDict
+
{{VersionInfo}} All versions of OpenFOAM.
  
3. visualize in javaview or with 'objToVTK blockTopology.obj blockTopology.vtk' in Paraview.
+
Feel free to contribute to this page!
 +
 
 +
 
 +
==Synopsis==
 +
blockMesh [OPTIONS]
 +
 
 +
==Description==
 +
As the name implies, {{tt|blockMesh}} helps the user build the mesh with blocks. It relies on a single dictionary file {{tt|blockMeshDict}}, usually located at {{tt|constant/polyMesh/blockMeshDict}}. Inside that dictionary file should be defined:
 +
# all of the reference vertices of mesh;
 +
# 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;
 +
# optionally, one can assign special edge definitions for specific edges on blocks, such as arcs and splines;
 +
# assign faces of blocks to patch names;
 +
# and finally, be able to define special face merging, but associating/merging patches.
 +
 
 +
The following options can be used with {{tt|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 {{tt|.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
 +
 
 +
 
 +
= Tips =
 +
On this chapter are listed links and direct tips on using <tt>snappyHexMesh</tt>.
 +
 
 +
== Using {{tt|blockMesh}} to export {{tt|blockMeshDict}} to {{tt|.obj}}  ==
 +
Before there were any nice graphical user interfaces for visually designing and inspecting the {{tt|blockMeshDict}} files, {{tt|blockMesh}} can interpret the dictionary file and export it to an {{tt|.obj}} file, which can be opened by any compatible 3D software, such as ParaView, JavaView and so on. There steps are as follows:
 +
 
 +
# Use the {{tt|-blockTopology}} argument to dump out a {{tt|blockTopology.obj}} file: <bash>blockMesh -blockTopology</bash>
 +
# The vertex numbering in this file is consistent with that of the vertices in the {{tt|blockMeshDict}} file.
 +
# The file {{tt|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: <bash>objToVTK blockTopology.obj blockTopology.vtk</bash>
 +
#* Import in Blender.
  
 
[[Category:Mesh generation utilities]]
 
[[Category:Mesh generation utilities]]

Revision as of 13:54, 19 April 2014


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: All versions of OpenFOAM.

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.