Installation/Mac OS/OpenFOAM 1.7.x

From OpenFOAMWiki
< Installation‎ | Mac OS
Revision as of 05:03, 29 August 2010 by Mreeske (Talk | contribs)

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

This page describes how to compile OpenFOAM 1.7.x on Mac OS X. It was created from the official OpenFOAM installation instructions, the Howto install OpenFOAM v16 Mac OpenFOAMWiki topic, information shared on this thread of the OpenFOAM Installation forum of CFD Online, and my personal experience of installing it on my own laptop.

These compilation instructions have only been tested on the following system:

Macbook (version 5,2)
Intel Core 2 Duo
Mac OS X Snow Leopard (version 10.6.4)

These instructions may need to be tailored as required to fit your specific system if they deviate from the above.

Many thanks go to Bernhard Gschaider (a.k.a. gschaider) of CFD Online for maintaining the latest OpenFOAM Mac OS X patches.


1 Prepare your Mac OS X

  1. Obtain the latest version of XCode.
  2. Obtain the latest version of XQuartz from http://xquartz.macosforge.org/.
  3. Obtain the latest version of Qt from http://qt.nokia.com/downloads/qt-for-open-source-cpp-development-on-mac-os-x.
    • Note: You do not need the full SDK. The "QT libraries" download is sufficient, and will include qmake.
  4. Obtain the latest version of CMake from http://www.cmake.org/cmake/resources/software.html


2 OpenFOAM 1.7.x Compilation Instructions

  1. Create the ubiquitous case-sensitive file system. There are two ways of doing this:
    1. Repartition your Mac's hard drive with Disk Utility to create a new partition.
      • Often this may be problematic when attempting to re-size a live hard drive partition, as Disk Utility may simply error out with a vague message of being unsuccessful. If this is consistently a problem, try using Disk Utility from a booted system disk; this is done by inserting your Mac OS X installation CD/DVD, then going to System Preferences->Startup Disk.
    2. Purchase an external hard drive and format it with Disk Utility.
  2. Obtain OpenFOAM 1.7.x source code from http://www.openfoam.com/download/source.php.
  3. Obtain OpenFOAM 1.7.x Mac OS X patches from http://www.cfd-online.com/Forums/openfoam-installation/77570-patches-openfoam-1-7-macos-x.html.
  4. Decompress both OpenFOAM and ThirdParty archives into the case-sensitive file system.
cd ~/Downloads/
mv OpenFOAM-1.7.0.gtgz /Volumes/OpenFOAM/
mv ThirdParty-1.7.0.gtgz /Volumes/OpenFOAM/
cd /Volumes/OpenFOAM/
tar -zvxf OpenFOAM-1.7.0.gtgz
tar -zvxf ThirdParty-1.7.0.gtgz
  1. Apply the Mac OS X patches.
cd ~/Downloads/
mv OpenFOAM-1.7-Mac.patch.gz /Volumes/OpenFOAM/OpenFOAM-1.7.0/
mv ThirdParty-1.7-Mac.patch.gz /Volumes/OpenFOAM/ThirdParty-1.7.0/
cd /Volumes/OpenFOAM/OpenFOAM-1.7.0/
gunzip OpenFOAM-1.7-Mac.patch.gz
patch -p1 <OpenFOAM-1.7-Mac.patch
cd /Volumes/OpenFOAM/ThirdParty-1.7.0/
gunzip ThirdParty-1.7-Mac.patch.gz
patch -p1 <ThirdParty-1.7-Mac.patch
  1. Edit etc/bashrc within OpenFOAM-1.7.0/, and modify the foamInstall variable (line 45) to the appropriate location.
cd /Volumes/OpenFOAM/OpenFOAM-1.7.0/
vi etc/bashrc
  1. Create the directory structure lib/darwinIntel64DPOpt/ within OpenFOAM-1.7.0/.
    • Note: For some reason the etc/bashrc script has trouble creating this directory on its own.
mkdir lib
mkdir lib/darwinIntel64DPOpt
  1. Source the "etc/bashrc" script.
source etc/bashrc
  1. Execute Allwmake to compile the core OpenFOAM programs.
 ./Allwmake


3 ThirdParty 1.7.x Compilation Instructions