CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Installation

[OpenFOAM.com] Installing OpenFOAM on MacOS with Apple Silicon

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree10Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 16, 2024, 19:16
Default
  #21
New Member
 
Gabriel Gerlero
Join Date: Jan 2022
Posts: 22
Rep Power: 5
gerlero is on a distinguished road
Quote:
Originally Posted by bzollars View Post
Gerlero, is cfMesh part of your pre-compiled OpenFOAM package? I have just installed v2406 and it does not seem to be there.
cfMesh is included with v2312 and before. With v2406, cfMesh was removed from the default install, so it's not included anymore (I do not know the reason for its removal).
gerlero is offline   Reply With Quote

Old   November 10, 2024, 17:53
Default
  #22
New Member
 
Join Date: Jun 2013
Posts: 6
Rep Power: 13
Moopie is on a distinguished road
Quote:
Originally Posted by Simbelmynė View Post
Hi,

Did you test v2312? Any improvements with SIP?

I have problems with
Code:
The dummy Pstream library cannot be used in parallel mode
which I did not have on Ventura (I think). Not sure if it is a SIP issue though, since adding
Code:
source $WM_PROJECT_DIR/etc/bashrc
to the Allrun script has no effect.

Did you have similar issues and how did you solve it?
Experiencing the same dummy Pstream error on 2312 compiled with gerlero, was there a fix found for this?
Moopie is offline   Reply With Quote

Old   November 20, 2024, 19:35
Default
  #23
New Member
 
Gabriel Gerlero
Join Date: Jan 2022
Posts: 22
Rep Power: 5
gerlero is on a distinguished road
Quote:
Originally Posted by Moopie View Post
Experiencing the same dummy Pstream error on 2312 compiled with gerlero, was there a fix found for this?
Have you managed to fix/work around your issues? Usually, (1) using the bundled Bash session (i.e., using the 'openfoam' command) and (2) using the tutorial RunFunctions in any run scripts keeps most SIP-related problems at bay...
gerlero is offline   Reply With Quote

Old   January 29, 2025, 08:22
Default
  #24
New Member
 
Kevin Nolan
Join Date: Nov 2012
Posts: 18
Rep Power: 14
Kolan is on a distinguished road
I've now built OpenFOAM v2214 on a Mac mini with an M4 Pro (12 core, 48 GB of RAM). Below I will update the text from my original post.

---------------------------------------------------------------------

OpenFOAM v2412 builds on MacOS without the need for a patch.

I will assume a clean install of MacOS. I'm on 15.3 (24D60) on an M4 Pro (12 Core)

First install Xcode and the Xcode command line tools.
You can do this from the app store. Check the command line tools are installed:
Code:
$ xcode-select --install
Next install homebrew
https://brew.sh

Install the following with homebrew:

Code:
$ brew install --cask paraview
$ brew install open-mpi
$ brew install boost
$ brew install cgal
$ brew install metis
$ brew install libomp
$ brew install scotch
$ brew install mrklein/foam/parmgridgen
This time I elected to use an APFS volume instead of a sparsebundle for performance reasons. Use

Code:
$ diskutil ap list
To list your device volumes. For some reason my new Mac mini lists disk3 as the only disk.
I created a case-sensitive volume called OpenFOAM in /Volumes rather than clutter $HOME. (I can add the Volume to the sidebar in Finder for example.)

Code:
$ diskutil ap addVolume disk3 'Case-sensitive APFS' OpenFOAM -role D
Now we can download the tarballs of the OpenFOAM v2412 source.

Code:
$ curl -L https://dl.openfoam.com/source/v2412/OpenFOAM-v2412.tgz > OpenFOAM-v2412.tgz 
$ curl -L https://dl.openfoam.com/source/v2412/ThirdParty-v2412.tgz > ThirdParty-v2412.tgz
You can download these to your home directory, you can delete them later.

Next extract the tarballs into the new OpenFOAM volume.

Code:
$ cd /Volumes/OpenFOAM/
$ tar xzf $HOME/OpenFOAM-v2206.tgz
$ tar xzf $HOME/ThirdParty-v2206.tgz
This creates two directories in ~/OpenFOAM, OpenFOAM-v2412 and ThirdParty-v2412.

Before we go and build OpenFOAM we need to fix how scotch is linked.

Looking at our scotch install info:
Code:
brew info scotch
we can see where brew put it:
Code:
==> scotch: stable 7.0.6 (bottled), HEAD
Package for graph partitioning, graph clustering, and sparse matrix ordering
https://gitlab.inria.fr/scotch/scotch
Installed
/opt/homebrew/Cellar/scotch/7.0.6 (237 files, 11.4MB) *
  Poured from bottle using the formulae.brew.sh API on 2025-01-29 at 10:26:59
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/s/scotch.rb
License: CECILL-C
==> Dependencies
Build: bison ✘
Required: open-mpi ✔
==> Options
--HEAD
	Install HEAD version
==> Analytics
install: 36 (30 days), 134 (90 days), 508 (365 days)
install-on-request: 36 (30 days), 131 (90 days), 496 (365 days)
build-error: 0 (30 days)
So we need to add this information before building. To do this you need to edit the OpenFOAM-v2412/etc/config.sh/scotch file to include:

Code:
export SCOTCH_VERSION=scotch-system
export SCOTCH_ARCH_PATH=/opt/homebrew/Cellar/scotch/7.0.6
Comment out the existing entries and save the file.

Next run these commands to update some necessary preferences which will be stored in a ~/OpenFOAM/prefs.sh:

Code:
$ mkdir -p $HOME/.OpenFOAM
$ echo 'WM_COMPILER=Clang' > $HOME/.OpenFOAM/prefs.sh
$ echo 'WM_COMPILE_OPTION=Opt' >> $HOME/.OpenFOAM/prefs.sh
$ echo 'WM_MPLIB=SYSTEMOPENMPI' >> $HOME/.OpenFOAM/prefs.sh
$ echo 'export WM_NCOMPPROCS=$(sysctl -n hw.ncpu)' >> $HOME/.OpenFOAM/prefs.sh
$ echo 'WM_LABEL_SIZE=32' >> $HOME/.OpenFOAM/prefs.sh
$ source etc/bashrc
$ [ "$(ulimit -n)" -lt "4096" ] && ulimit -n 4096

Now we can build OpenFOAM
Code:
$ cd /Volumes/OpenFOAM/OpenFOAM-v2412/
$ ./Allwmake > log.Allwmake 2>&1
Give it some time to build. You can monitor the build log by looking at log.Allwmake. For example by using tail in another terminal window with:
Code:
$ tail -f /Volumes/OpenFOAM/OpenFOAM-v2412/log.Allwmake
After the build is complete we need to add some files and environmental variables so OpenFOAM is available when we open the Terminal.

Code:
$ mkdir -p $HOME/.OpenFOAM
$ echo 'v2412' > $HOME/.OpenFOAM/OpenFOAM-release
Finally you need to add the following to your $HOME/.zprofile or where you prefer to put this stuff.

Code:
$ source "/Volumes/OpenFOAM/OpenFOAM-v2412/etc/bashrc"
Finally we can add our run folder
Code:
$ mkdir -p /Volumes/OpenFOAM/$USER-$WM_PROJECT_VERSION
$ mkdir -p /Volumes/OpenFOAM/$USER-$WM_PROJECT_VERSION/run
and update the path in /Volumes/OpenFOAM/OpenFOAM-v2412/etc/bashrc
Code:
export WM_PROJECT_USER_DIR="/Volumes/OpenFOAM/${USER:-user}-$WM_PROJECT_VERSION"
It's pretty quick using the benchmark:
Code:
cores  MeshTime(s)     RunTime(s)     
-----------------------------------
1      407.23          334.47         
2      292.06          196.36         
4      181.5           101.12         
6      135.4           79.75          
8      128.51          62.74          
12     162.66          95.73

Last edited by Kolan; January 29, 2025 at 09:49.
Kolan is offline   Reply With Quote

Old   January 29, 2025, 12:16
Default
  #25
New Member
 
Kevin Nolan
Join Date: Nov 2012
Posts: 18
Rep Power: 14
Kolan is on a distinguished road
I've now installed v2412 on my 16" M3 Max MBP (4E+12P) which I had benched previously with OpenFOAM running in a sparse bundle.

Now using v2412 with an APFS volume I get:

Code:
cores  MeshTime(s)     RunTime(s)     
-----------------------------------
1      433.06          338.44         
2      301.92          193.1          
4      208.73          106.67         
6      158.28          73.87          
8      121.56          62.14          
12     106.8           53.07
armin69me likes this.
Kolan is offline   Reply With Quote

Old   January 29, 2025, 12:57
Default
  #26
Senior Member
 
Simbelmynė's Avatar
 
Join Date: May 2012
Posts: 562
Rep Power: 16
Simbelmynė is on a distinguished road
Thank you Kolan for this update. Very nice that ESI have made it possible to easily compile from source on MacOS.

Have you by any chance tested to build cfMesh with apple silicon, as it is no longer bundled with ESI OpenFOAM?
Simbelmynė is offline   Reply With Quote

Old   January 29, 2025, 13:01
Default
  #27
New Member
 
Kevin Nolan
Join Date: Nov 2012
Posts: 18
Rep Power: 14
Kolan is on a distinguished road
I haven’t but I can try. I’m a blockMesh masochist.
Kolan is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[OpenFOAM.com] Native OpenFOAM for macOS: OpenFOAM-v2112.app (install instructions and GitHub link) gerlero OpenFOAM Installation 32 November 21, 2024 03:20
Frequently Asked Questions about Installing OpenFOAM wyldckat OpenFOAM Installation 3 November 14, 2023 12:58
[Other] Basic questions about OpenFOAM cluster running and installing Fauster OpenFOAM Installation 0 May 25, 2018 16:00
[OpenFOAM.com] Issues with installing v1712 on MacOS Spacegirl1923 OpenFOAM Installation 8 April 12, 2018 18:44
Suggestion for a new sub-forum at OpenFOAM's Forum wyldckat Site Help, Feedback & Discussions 20 October 28, 2014 10:04


All times are GMT -4. The time now is 11:00.