Extend-bazaar/utilities/cfMesh

From OpenFOAMWiki
< Extend-bazaar‎ | utilities
Revision as of 16:08, 10 March 2019 by Wyldckat (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

1 Description

cfMesh is a library for mesh generation built on OpenFOAM and foam-extend.


1.1 Support


2 Installation

Binaries and the source code can be downloaded from open source project cfMesh @ SourceForge.net.

Supported versions:

  1. cfMesh is already integrated into foam-extend since version 3.2.
  2. cfMesh is already integrated into OpenFOAM+ since version v1712.
  3. The last stable version 1.1.2 in the cfMesh project at SourceForge.net supported foam-extend 4.0 and OpenFOAM 4.0.
  4. 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:

  1. 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.
  2. 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:

  1. The --- character group tells us that the file to the right has had its lines removed whenever there is a minus character.
  2. The +++ character group tells us that the file to the right has had its lines added whenever there is a plus character.
  3. The line that starts with @@ gives an indication on which line to start looking at.
  4. 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.
  5. 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.