Difference between revisions of "Installation/Mac OS/OpenFOAM 2.1.x"
(Transcription complete.) |
(Improved document.) |
||
Line 5: | Line 5: | ||
<br> | <br> | ||
= Basic requirements = | = Basic requirements = | ||
− | This manual assumes that the reader is familiar with Mac OS X, the installation of | + | This manual assumes that the reader is familiar with Mac OS X, the installation of applications as well as with basic commands in the Terminal.app. This manual covers |
− | applications as well as with basic commands in the Terminal.app. This manual covers | + | |
the installation of OpenFOAM on Mac OS X 10.6.8, also called Snow Leopard. | the installation of OpenFOAM on Mac OS X 10.6.8, also called Snow Leopard. | ||
+ | |||
What do you need? | What do you need? | ||
* Apple Mac OS X 10.6.8 | * Apple Mac OS X 10.6.8 | ||
* Apple Developer Tools 3.2.6 (delivered on the DVDs you’ve got with your mac, or you can download this here: [http://developer.apple.com/ developer.apple.com]) | * Apple Developer Tools 3.2.6 (delivered on the DVDs you’ve got with your mac, or you can download this here: [http://developer.apple.com/ developer.apple.com]) | ||
* MacPorts software, you can download this here: [http://www.macports.org www.macports.org] | * MacPorts software, you can download this here: [http://www.macports.org www.macports.org] | ||
− | For downloading the Apple Developer Tools you might have to become a member of the Apple developer site, it is | + | For downloading the Apple Developer Tools you might have to become a member of the Apple developer site, it is still free. |
− | How do I know if the above | + | How do I know if the above mentioned software is already installed? |
− | <ol><li>Open the <tt>Terminal.app</tt> you find in your <tt>/Applications/Utilities</tt> folder: | + | <ol><li>Open the <tt>Terminal.app</tt>, which you will find in your <tt>/Applications/Utilities</tt> folder: |
[[File:Howto install OpenFOAM v21 Mac-images-000.ppm.png|thumb|500px|center]]</li> | [[File:Howto install OpenFOAM v21 Mac-images-000.ppm.png|thumb|500px|center]]</li> | ||
− | <li>Type < | + | <li>Type: |
+ | <pre>gcc -v</pre> | ||
+ | |||
+ | the output should look like this: | ||
[[File:Howto install OpenFOAM v21 Mac-images-002.ppm.png|thumb|500px|center]]</li> | [[File:Howto install OpenFOAM v21 Mac-images-002.ppm.png|thumb|500px|center]]</li> | ||
− | <li>Check for the MPI installation as well by typing < | + | <li>Check for the MPI installation as well by typing: |
− | + | <pre>mpirun -V</pre> | |
− | [[File:Howto install OpenFOAM v21 Mac-images-004.ppm.png|thumb|500px|center]]</li> | + | [[File:Howto install OpenFOAM v21 Mac-images-004.ppm.png|thumb|500px|center|'''Note''': the option <tt>-V</tt> is different from <tt>-v</tt>]]</li> |
− | <li>After installing the | + | <li>After installing the MacPorts software - see [http://www.macports.org/install.php www.macports.org/install.php] for installation guide - we check the installation with: |
− | installation guide | + | <pre>sudo port selfupdate</pre> |
− | + | [[File:Howto install OpenFOAM v21 Mac-images-006.ppm.png|thumb|500px|center|'''Note''': you have to confirm the <tt>sudo</tt> command with your password.]]</li> | |
− | [[File:Howto install OpenFOAM v21 Mac-images-006.ppm.png|thumb|500px|center]]</li> | + | |
<li>Now we are installing the GCC 4.6 by entering: | <li>Now we are installing the GCC 4.6 by entering: | ||
<pre>sudo port install gcc46</pre> | <pre>sudo port install gcc46</pre> | ||
− | on the command line. After the operation is done you could check the version and it | + | on the command line. After the operation is done you could check the version and it should look like this: |
− | should look like this: | + | |
[[File:Howto install OpenFOAM v21 Mac-images-008.ppm.png|thumb|500px|center]]</li> | [[File:Howto install OpenFOAM v21 Mac-images-008.ppm.png|thumb|500px|center]]</li> | ||
</ol> | </ol> | ||
Line 37: | Line 38: | ||
First, we create a disk image with the Apple Disk Utility. Open <tt>/Applications/Utilities/Disk Utility</tt>. Click New Image: | First, we create a disk image with the Apple Disk Utility. Open <tt>/Applications/Utilities/Disk Utility</tt>. Click New Image: | ||
[[File:Howto install OpenFOAM v21 Mac-images-010.ppm.png|thumb|500px|center]] | [[File:Howto install OpenFOAM v21 Mac-images-010.ppm.png|thumb|500px|center]] | ||
+ | |||
It is important to set as <tt>Format: Mac OS Extended (Case-sensitive,Journaled)</tt>. The sparse image will grow with the place used inside the image. Create a sparse image with the following settings (examples, you could change the values): | It is important to set as <tt>Format: Mac OS Extended (Case-sensitive,Journaled)</tt>. The sparse image will grow with the place used inside the image. Create a sparse image with the following settings (examples, you could change the values): | ||
[[File:Howto install OpenFOAM v21 Mac-images-012.ppm.png|thumb|500px|center]] | [[File:Howto install OpenFOAM v21 Mac-images-012.ppm.png|thumb|500px|center]] | ||
− | Go to the directory of the image by typing | + | Go to the directory of the image by typing: |
− | [[File:Howto install OpenFOAM v21 Mac-images-014.ppm.png|thumb|500px|center]] | + | [[File:Howto install OpenFOAM v21 Mac-images-014.ppm.png|thumb|500px|center|<tt>cd /Volumes/OpenFOAM-v2.1</tt>]] |
− | Use a browser to download the archives of OpenFoam 2.1 and ThirdParty 2.1 from [http://openfoam.org/download/source.php | + | Use a browser to download the archives of OpenFoam 2.1 and ThirdParty 2.1 from [http://openfoam.org/download/source.php here] and copy the archives into the image. Extract the archives by double clicking on each one. |
− | Then download the patches created by Bernhard Gschaider, | + | Then download the patches created by Bernhard Gschaider, available [http://www.cfd-online.com/Forums/openfoam-installation-windows-mac/95763-1-9-aka-2-1-mac-os-x.html#post340297 here]. |
Copy or move them into the image. Your image content should look like this: | Copy or move them into the image. Your image content should look like this: | ||
Line 51: | Line 53: | ||
Move the appropriate patches into the directories, see below: | Move the appropriate patches into the directories, see below: | ||
[[File:Howto install OpenFOAM v21 Mac-images-018.ppm.png|thumb|500px|center]] | [[File:Howto install OpenFOAM v21 Mac-images-018.ppm.png|thumb|500px|center]] | ||
− | Change into the OpenFOAM directory and apply the first | + | Change into the OpenFOAM directory and apply the first patch via: |
<pre>patch -p1 < *.patch</pre> | <pre>patch -p1 < *.patch</pre> | ||
[[File:Howto install OpenFOAM v21 Mac-images-020.ppm.png|thumb|500px|center]] | [[File:Howto install OpenFOAM v21 Mac-images-020.ppm.png|thumb|500px|center]] | ||
Line 64: | Line 66: | ||
<pre>patch -p1 < OpenFOAM-2.1.x-Mac-gcc46.patch</pre> | <pre>patch -p1 < OpenFOAM-2.1.x-Mac-gcc46.patch</pre> | ||
− | Open the file <tt>/etc/bashrc</tt> with a text editor, e. g. Text Wrangler | + | Open the file <tt>/etc/bashrc</tt> with a text editor, e. g. Text Wrangler, <tt>pico</tt> or <tt>nano</tt> and add these lines: |
<pre>ulimit −n 1024 | <pre>ulimit −n 1024 | ||
export WM_NCOMPPROCS=20</pre> | export WM_NCOMPPROCS=20</pre> | ||
− | The first entry is to increase the number of files which one process may open at a time; the second you should set to the number of processes your CPU could manage in parallel, e. g. 4, 8, 16, ... | + | The first entry is to increase the number of files which one process may open at a time; on the second you should set to the number of processes your CPU could manage in parallel, e. g. 4, 8, 16, ... |
− | + | '''Note''': If you don't know how many your machine can handle, then run: | |
+ | <pre>sysctl -n hw.ncpu</pre> | ||
+ | |||
+ | The <tt>/etc/bashrc</tt> file should look similar to this: | ||
[[File:Howto install OpenFOAM v21 Mac-images-026.ppm.png|thumb|500px|center]] | [[File:Howto install OpenFOAM v21 Mac-images-026.ppm.png|thumb|500px|center]] | ||
− | Go back to your home directory by simply typing < | + | Go back to your home directory by simply typing: |
+ | <pre>cd</pre> | ||
+ | |||
+ | Then create a symbolic link with: | ||
<pre>ln -s /Volumes/OpenFOAM-v2.1 OpenFOAM</pre> | <pre>ln -s /Volumes/OpenFOAM-v2.1 OpenFOAM</pre> | ||
[[File:Howto install OpenFOAM v21 Mac-images-028.ppm.png|thumb|500px|center]] | [[File:Howto install OpenFOAM v21 Mac-images-028.ppm.png|thumb|500px|center]] | ||
Line 87: | Line 95: | ||
[[File:Howto install OpenFOAM v21 Mac-images-032.ppm.png|thumb|500px|center]] | [[File:Howto install OpenFOAM v21 Mac-images-032.ppm.png|thumb|500px|center]] | ||
− | If you want to keep a | + | If you also want to keep a log-file in case of errors, type: |
− | <pre>./Allwmake | tee Allwmake.log</pre> | + | <pre>./Allwmake 2>&1 | tee Allwmake.log</pre> |
+ | |||
+ | If don't want to see what is happening during the build until it's completed, run: | ||
+ | <pre>./Allwmake > Allwmake.log 2>&1</pre> | ||
+ | |||
+ | When the command returns control to you, then you should be done. You can check if there are any errors by opening the file <tt>Allwmake.log</tt> with a text editor and search for lines have the expression "Error " (including the space after the word "Error"); keep in mind that if your terminal is returning error messages in another language, then you should search for the respective word for "Error". | ||
− | + | = Installing and using ParaView = | |
+ | TODO | ||
[[Category:OpenFOAM on Mac OS X]] | [[Category:OpenFOAM on Mac OS X]] |
Revision as of 10:48, 1 April 2012
This is a transcript and subsequent improvements on the guide made by Michael Plagge. The original PDF: Compiling Manual OpenFOAm Mac OS X.pdf
Contents
1 Basic requirements
This manual assumes that the reader is familiar with Mac OS X, the installation of applications as well as with basic commands in the Terminal.app. This manual covers the installation of OpenFOAM on Mac OS X 10.6.8, also called Snow Leopard.
What do you need?
- Apple Mac OS X 10.6.8
- Apple Developer Tools 3.2.6 (delivered on the DVDs you’ve got with your mac, or you can download this here: developer.apple.com)
- MacPorts software, you can download this here: www.macports.org
For downloading the Apple Developer Tools you might have to become a member of the Apple developer site, it is still free.
How do I know if the above mentioned software is already installed?
- Open the Terminal.app, which you will find in your /Applications/Utilities folder:
- Type:
gcc -v
the output should look like this:
- Check for the MPI installation as well by typing:
mpirun -V
- After installing the MacPorts software - see www.macports.org/install.php for installation guide - we check the installation with:
sudo port selfupdate
- Now we are installing the GCC 4.6 by entering:
sudo port install gcc46
on the command line. After the operation is done you could check the version and it should look like this:
2 Installing and compiling OpenFOAM 2.1 with GCC 4.6 and OpenMPI 1.5.4
First, we create a disk image with the Apple Disk Utility. Open /Applications/Utilities/Disk Utility. Click New Image:
It is important to set as Format: Mac OS Extended (Case-sensitive,Journaled). The sparse image will grow with the place used inside the image. Create a sparse image with the following settings (examples, you could change the values):
Go to the directory of the image by typing:
Use a browser to download the archives of OpenFoam 2.1 and ThirdParty 2.1 from here and copy the archives into the image. Extract the archives by double clicking on each one. Then download the patches created by Bernhard Gschaider, available here.
Copy or move them into the image. Your image content should look like this:
Move the appropriate patches into the directories, see below:
Change into the OpenFOAM directory and apply the first patch via:
patch -p1 < *.patch
The end of the output should look like this:
Add executive rights to a python script like this:
Apply the second patch for the compiler, in this case we use the GCC 4.6 so choose the right patch by typing:
patch -p1 < OpenFOAM-2.1.x-Mac-gcc46.patch
Open the file /etc/bashrc with a text editor, e. g. Text Wrangler, pico or nano and add these lines:
ulimit −n 1024 export WM_NCOMPPROCS=20
The first entry is to increase the number of files which one process may open at a time; on the second you should set to the number of processes your CPU could manage in parallel, e. g. 4, 8, 16, ...
Note: If you don't know how many your machine can handle, then run:
sysctl -n hw.ncpu
The /etc/bashrc file should look similar to this:
Go back to your home directory by simply typing:
cd
Then create a symbolic link with:
ln -s /Volumes/OpenFOAM-v2.1 OpenFOAM
Go back to your home directory again. Now you have to source the settings by running:
. OpenFOAM/OpenFOAM-2.1.0/etc/bashrc
No error or other output should occur.
Now we go to the OpenFOAM directory and start compilation. Take a coffee. And a cookie. Or two:
If you also want to keep a log-file in case of errors, type:
./Allwmake 2>&1 | tee Allwmake.log
If don't want to see what is happening during the build until it's completed, run:
./Allwmake > Allwmake.log 2>&1
When the command returns control to you, then you should be done. You can check if there are any errors by opening the file Allwmake.log with a text editor and search for lines have the expression "Error " (including the space after the word "Error"); keep in mind that if your terminal is returning error messages in another language, then you should search for the respective word for "Error".
3 Installing and using ParaView
TODO