Recently OpenFOAM Foundation announced release of OpenFOAM 2.3.0. So I've decided to make patches to build this version with Clang.
Notes:
- Build process was tested on OS X 10.9 with Clang version: Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
- In this version CGAL library appeared which depends on boost, gmp, mpfr, and cmake. I use Homebrew as a package manager so patches assume that boost, gmp, and mpfr are installed with brew. Basically I use this package manager to get installation prefixes for the libraries.
- I have multi-threaded build of boost intalled (--without-single option of the package) so build was tested with this version (i.e. libraries have -mt suffix). If you have single threaded libraries installed makeCGAL script will try to adjust build options, though this wasn't tested.
- Paraview is downloaded from paraview.org and installed in /Applications
Instruction is rather similar to the previous one:
- Download OpenFOAM sources from openfoam.org: OpenFOAM-2.3.0.tgz and ThirdParty-2.3.0.tgz
- Download patches: OpenFOAM-2.3.0-2.patch and ThirdParty-2.3.0-1.patch
- Create disk image with CASE SENSITIVE file system. One can find instructions with pictures in OpenFOAM wiki.
- Mount created disk image to $HOME/OpenFOAM (for example, it can be done with command hdiutil attach -quiet -mountpoint $HOME/OpenFOAM <your disk image file>).
- Unpack source archives to $HOME/OpenFOAM (if you downloaded files elsewhere, correct paths to archives)
$ cd $HOME/OpenFOAM
$ tar xzf ~/Downloads/OpenFOAM-2.3.0.tgz
$ tar xzf ~/Downloads/ThirdParty-2.3.0.tgz
- Copy patches into correspondent directories:
$ cp ~/Downloads/OpenFOAM-2.3.0-2.patch OpenFOAM-2.3.0/
$ cp ~/Downloads/ThirdParty-2.3.0-1.patch ThirdParty-2.3.0/
- Apply patches with git apply command. I prefer using git (instead of patch) for this because git will get permissions on created files (for example addr2line4Mac.py will be created as an executable).
$ cd OpenFOAM-2.3.0
$ git apply OpenFOAM-2.3.0-2.patch
$ cd ../ThirdParty-2.3.0
$ git apply ThirdParty-2.3.0-1.patch
$ cd ../OpenFOAM-2.3.0
- Edit etc/bashrc to correspond to your system and desires. Major changes that can be done are:
- Change export WM_MPLIB=SYSTEMOPENMPI to export WM_MPLIB=OPENMPI if you'd like to use OpenMPI from ThirdParty source distribution (version 1.6.5). I use Homebrew installed OpenMPI 1.7.4.
- Remove verbosity by changing export FOAM_VERBOSE=1 to export FOAM_VERBOSE=0
- Source etc/bachrc
- Execute ./Allwmake
- Wait.
Build process will take some time, after you can test installation with traditional:
$ mkdir -p $FOAM_RUN
$ run
$ cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity .
$ cd cavity
$ blockMesh
$ icoFoam
To mount disk image automatically upon every launch of terminal you can add something like:
# OpenFOAM
if [ -f $HOME/.OpenFOAM-release ]; then
OF_VER=$(cat $HOME/.OpenFOAM-release)
if [ ! -f $HOME/OpenFOAM/OpenFOAM-$OF_VER/etc/bashrc ]; then
hdiutil attach -quiet -mountpoint $HOME/OpenFOAM OpenFOAM-$OF_VER.sparsebundle &&
. $HOME/OpenFOAM/OpenFOAM-$OF_VER/etc/bashrc
else
. $HOME/OpenFOAM/OpenFOAM-$OF_VER/etc/bashrc
fi
fi
to .profile file and create .OpenFOAM-release file with
$ echo '2.3.0' > $HOME/.OpenFOAM-release
This snippet assumes that you've names your disk image OpenFOAM-2.3.0.sparsebundle.
That's it.
I get the following error: ./Allwmake: line 4: wmakeCheckPwd: command not found
RépondreSupprimerError: Current directory is not $WM_PROJECT_DIR
The environment variables are inconsistent with the installation.
Check the OpenFOAM entries in your dot-files and source them.
export WM_PROJECT=OpenFOAM
export WM_PROJECT_VERSION=2.3.0
################################################################################
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
#
# either set $FOAM_INST_DIR before sourcing this file or set
# 'foamInstall' below to where OpenFOAM is installed
#
# Location of the OpenFOAM installation
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foamInstall=$HOME/OpenFOAM/OpenFOAM-2.3.0
# foamInstall=~$WM_PROJECT
# foamInstall=/opt/$WM_PROJECT
#foamInstall=/usr/local/OpenFOAM/OpenFOAM-2.3.0
#
# END OF (NORMAL) USER EDITABLE PART
################################################################################
brew_help() {
echo <<- EOM
Applied patch assumes you are using Homebrew (http://brew.sh) as a
package manager but it wasn't found. Please check you installation.
EOM
}
# Checking if brew is available
`which -s brew` || { brew_help; unset brew_help; return; }
unset brew_help
#
# These are the defaults for this version which should generally be
# overridden from the prefs.sh file or from command-line specification
#
#- note the location for later use (eg, in job scripts)
: ${FOAM_INST_DIR:=$foamInstall}; export FOAM_INST_DIR
#- Compiler location:
# foamCompiler= system
foamCompiler=system
#- Compiler:
# WM_COMPILER = Clang
export WM_COMPILER=Clang
unset WM_COMPILER_ARCH WM_COMPILER_LIB_ARCH
#- Architecture:
# WM_ARCH_OPTION = 32 | 64
export WM_ARCH_OPTION=64
#- Precision:
# WM_PRECISION_OPTION = DP | SP
export WM_PRECISION_OPTION=DP
mein Email rostand.mowa@yahoo.de
Hello Alexey, if you could just upload a video of the installation process, that would be unbelievably great! you will be my hero, role model/god! :)
RépondreSupprimerI don't see the point in making video of the installation process (also to make it I need to 1) find a software to capture the video, 2) change locale so text labels in the video are in English) as it won't make installation process easier.
SupprimerSo, guess, I won't be your role model/god. Sorry.