Difference between revisions of "Extend-bazaar/utilities/cfMesh"

From OpenFOAMWiki
(Installation)
(added information provided by Tobi, namely that it works with 7 and dev)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
This template is only a suggestion aimed at saving your time. Please feel free to use any other format on the subpage for your contribution!
 
 
'''Click "Edit" to access and copy the page code.'''
 
 
 
== Description ==
 
== Description ==
This code implements...
+
cfMesh is a library for mesh generation built on OpenFOAM and foam-extend.
  
 +
<br>
 +
=== Support ===
 +
* Commercial support is provided by the developers of cfMesh, namely [https://cfmesh.com/ Creative Fields].
 +
* Community support is available at the prefix [https://www.cfd-online.com/Forums/openfoam-community-contributions/?pp=40&daysprune=-1&prefixid=openfoam_cc_cfmesh &#91;cfMesh&#93;] in the subforum [https://www.cfd-online.com/Forums/openfoam-community-contributions/ OpenFOAM Community Contributions].
 +
 +
<br>
 
== Installation ==
 
== Installation ==
Download from [http://www.c-fields.com/Media/Default/Repository/cfMesh-v1.0.tgz HERE], use either
+
Binaries and the source code can be downloaded from open source project [http://sourceforge.net/projects/cfmesh/ cfMesh @ SourceForge.net].
  
* embedded .tgz archive directly on page (only for small files)
+
Supported versions:
* link to file-hoster
+
# cfMesh is already integrated into [http://foam-extend.org foam-extend] since version 3.2.
* link to repository, e.g. on sorceforge.org or github.org
+
# cfMesh is already integrated into {{OpenFOAM+}} since version v1712.
 +
# The last stable version 1.1.2 in the [http://sourceforge.net/projects/cfmesh/ cfMesh project at SourceForge.net] supported foam-extend 4.0 and OpenFOAM 4.0.
 +
# After that, {{tt|development}} branch in the [https://sourceforge.net/p/cfmesh/code/ official git repository] does provide support for {{OpenFOAM+}} and [http://foam-extend.org foam-extend], although it is possible to build with {{OpenFOAM}} versions 5 and 6 after some minor tweaking.
  
 +
<br>
 +
=== Installation instructions on OpenFOAM 5, 6, 7 and dev ===
  
Then compile by running:
+
There are two sets of instructions you can follow:
<bash>cd src/
+
# [[#Using the official repository|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.
./Allwmake
+
# [[#Using an adapted fork of cfMesh|Using an adapted fork of cfMesh]]  - which provides simpler instructions on how to download and compile cfMesh with OpenFOAM 5 to 7 and dev, may not be as up to date on the developments as the official cfMesh repository.
 +
 
 +
<br>
 +
==== Using the official repository ====
 +
Assuming that you already have {{tt|git}} installed, you can download the source code by using the following commands, after activating the desired OpenFOAM shell environment:
 +
<bash>mkdir - p $FOAM_RUN
 +
cd $FOAM_RUN/..
 +
git clone https://git.code.sf.net/p/cfmesh/code cfmesh
 +
cd cfmesh
 +
git checkout development
 
</bash>
 
</bash>
  
== Usage examples ==
+
Then the change that needs to be done to the source code is as follows:
To use this code, insert into controlDict:
+
<bash>--- 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)
 +
</bash>
 +
 
 +
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 {{tt|---}} character group tells us that the file to the right has had its lines removed whenever there is a minus character.
 +
# The {{tt|+++}} 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 {{tt|@@}} gives an indication on which line to start looking at.
 +
# The lines that after that start with a minus {{tt|-}} 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 {{tt|+}} 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`:
 +
{| border="1" style="text-align:left" cellpadding="7"
 +
|-
 +
! Before
 +
! After
 +
|-
 +
|<bash>    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)
 +
</bash>
 +
||<bash>    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)
 +
</bash>
 +
|}
 +
 
 +
 
 +
Then it's just a matter of running the following commands:
 +
<bash>./Allwmake > log.make 2>&1
 +
./Allwmake</bash>
 +
The first command will send all of the screen output into the file {{tt|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.
 +
 
 +
<br>
 +
 
 +
==== Using an adapted fork of cfMesh ====
 +
Assuming that you already have {{tt|git}} installed and after activating the desired OpenFOAM shell environment, run the following commands:
 +
<bash>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</bash>
 +
 
 +
* The first command will send all of the screen output into the file {{tt|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.
 +
 
 +
<br>
 +
== User Guide ==
 +
 
 +
Depends on how you installed cfMesh:
 +
* When using cfMesh as integrated into foam-extend, the User Guide is provided at {{tt|$WM_PROJECT_DIR/doc/cfMesh}}.
 +
* When using cfMesh as integrated into {{OpenFOAM+}}, the User Guide is provided at {{tt|$WM_PROJECT_DIR/modules/cfmesh/userGuide}}.
 +
* When using cfMesh as built from source code, the User Guide is inside the folder {{tt|userGuide}} within the {{tt|cfmesh}} source code folder.
 +
 
 +
<br>
 +
 
 +
== Tutorials ==
  
<cpp>functions
+
Depends on how you installed cfMesh:
{
+
* When using cfMesh as integrated into foam-extend, the tutorial cases are provided at {{tt|$FOAM_TUTORIALS/mesh/cfMesh}}.
....(insert the necessary options here)...
+
* When using cfMesh as integrated into {{OpenFOAM+}}, the tutorial cases are provided at {{tt|$WM_PROJECT_DIR/modules/cfmesh/tutorials}}.
}
+
* When using cfMesh as built from source code, the tutorial cases are inside the folder {{tt|tutorials}} within the {{tt|cfmesh}} source code folder.
</cpp>
+
  
== Documentation ==
+
<br>
This implementation is based on publication by [http://www.mathstat.uottawa.ca/~rsmith/Zombies.pdf Munz et al (2009)].
+
  
 
== History ==
 
== History ==
1 Jun 2010: First upload
 
  
1 Oct 2011: Bug fix for negative inlet velocities
+
* 27 December 2019 - Added indication that it should work with OpenFOAM 7 and dev.
 +
* 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.

Latest revision as of 20:42, 27 December 2019

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, 6, 7 and dev

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 to 7 and dev, 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

  • 27 December 2019 - Added indication that it should work with OpenFOAM 7 and dev.
  • 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.