Extend-bazaar/utilities/cfMesh
Contents
1 Description
cfMesh is a library for mesh generation built on OpenFOAM and foam-extend.
1.1 Support
- Commercial support is provided by the developers of cfMesh, namely Creative Fields.
- Community support is available at the prefix [cfMesh] in the subforum OpenFOAM Community Contributions.
2 Installation
Binaries and the source code can be downloaded from open source project cfMesh @ SourceForge.net.
Supported versions:
- cfMesh is already integrated into foam-extend since version 3.2.
- cfMesh is already integrated into OpenFOAM+ since version v1712.
- The last stable version 1.1.2 in the cfMesh project at SourceForge.net supported foam-extend 4.0 and OpenFOAM 4.0.
- After that, development branch in the official git repository does provide support for OpenFOAM+ and foam-extend, although it is possible to build with OpenFOAM versions 5 and 6 after some minor tweaking.
2.1 Installation instructions on OpenFOAM 5 and 6
There are two sets of instructions you can follow:
- Using the official repository - which lets you use the most recent developments in cfMesh, but requires you to make any additional modifications to the source code yourself, following the instructions provided there.
- Using an adapted fork of cfMesh - which provides simpler instructions on how to download and compile cfMesh with OpenFOAM 5 or 6, may not be as up to date on the developments as the official cfMesh repository.
2.1.1 Using the official repository
Assuming that you already have git installed, you can download the source code by using the following commands, after activating the desired OpenFOAM shell environment:
mkdir - p $FOAM_RUN cd $FOAM_RUN/.. git clone https://git.code.sf.net/p/cfmesh/code cfmesh cd cfmesh git checkout development
Then the change that needs to be done to the source code is as follows:
--- a/meshLibrary/Make/options +++ b/meshLibrary/Make/options @@ -14,9 +14,8 @@ ifeq (OpenFOAM,$(findstring OpenFOAM,$(WM_PROJECT))) endif endif -ifeq (v, $(findstring v, $(WM_PROJECT_VERSION))) - CFMESH_MACROS += -DOpenCFDSpecific -endif +# Use the same macro for OpenFOAM.com and OpenFOAM.org +CFMESH_MACROS += -DOpenCFDSpecific ifeq ($(WM_PROJECT), foam) VER := $(shell expr `echo $(WM_PROJECT_VERSION)` \>= 3.2)
If you are not familiar with patch files, then the changes that you need to do as instructed by the patch above, is as follows:
- The --- character group tells us that the file to the right has had its lines removed whenever there is a minus character.
- The +++ character group tells us that the file to the right has had its lines added whenever there is a plus character.
- The line that starts with @@ gives an indication on which line to start looking at.
- The lines that after that start with a minus - refer to lines that should be removed, so when you see the line to the right of the initial minus character, then that line should be removed.
- Then the lines that start with a plus character + refer to lines that should be added, so add the line text that is after the initial plus character.
If it's not clear to you yet, then here is an example of the before and after editing the file `meshLibrary/Make/options`:
Before | After |
---|---|
endif endif ifeq (v, $(findstring v, $(WM_PROJECT_VERSION))) CFMESH_MACROS += -DOpenCFDSpecific endif ifeq ($(WM_PROJECT), foam) VER := $(shell expr `echo $(WM_PROJECT_VERSION)` \>= 3.2) |
endif endif # Use the same macro for OpenFOAM.com and OpenFOAM.org CFMESH_MACROS += -DOpenCFDSpecific ifeq ($(WM_PROJECT), foam) VER := $(shell expr `echo $(WM_PROJECT_VERSION)` \>= 3.2) |
Then it's just a matter of running the following commands:
./Allwmake > log.make 2>&1 ./Allwmake
The first command will send all of the screen output into the file log.make, so you will not see much going on, since it's being logged inside that file. The second command will then check if everything went well and it should complain if something went wrong.
2.1.2 Using an adapted fork of cfMesh
Assuming that you already have git installed and after activating the desired OpenFOAM shell environment, run the following commands:
mkdir - p $FOAM_RUN cd $FOAM_RUN/.. git clone https://github.com/blueCFD/cfMesh.git cfmesh cd cfmesh git checkout development-OF5x ./Allwmake > log.make 2>&1 ./Allwmake
- The first command will send all of the screen output into the file log.make, so you will not see much going on, since it's being logged inside that file.
- The second command will then check if everything went well and it should complain if something went wrong.
3 User Guide
Depends on how you installed cfMesh:
- When using cfMesh as integrated into foam-extend, the User Guide is provided at $WM_PROJECT_DIR/doc/cfMesh.
- When using cfMesh as integrated into OpenFOAM+, the User Guide is provided at $WM_PROJECT_DIR/modules/cfmesh/userGuide.
- When using cfMesh as built from source code, the User Guide is inside the folder userGuide within the cfmesh source code folder.
4 Tutorials
Depends on how you installed cfMesh:
- When using cfMesh as integrated into foam-extend, the tutorial cases are provided at $FOAM_TUTORIALS/mesh/cfMesh.
- When using cfMesh as integrated into OpenFOAM+, the tutorial cases are provided at $WM_PROJECT_DIR/modules/cfmesh/tutorials.
- When using cfMesh as built from source code, the tutorial cases are inside the folder tutorials within the cfmesh source code folder.
5 History
- 24 December 2018 - Restructured page and provided more details on where cfMesh is provided and how to install it on OpenFOAM 5 and 6.
- 16 June 2014 - Quick page deployment based on template and added link to the cfMesh 1.0 source code.