installing cfdof on Macos

A subforum specific to the development of the OpenFoam-based workbenches ( Cfd https://github.com/qingfengxia/Cfd and CfdOF https://github.com/jaheyns/CfdOF )

Moderator: oliveroxtoby

funky
Posts: 8
Joined: Mon Nov 15, 2021 2:34 pm

installing cfdof on Macos

Post by funky »

Hello guys,

Does somebody know how to install cfdof on Mac? I checked this topic https://forum.freecadweb.org/viewtopic.php?p=364713 , however I could not get anything out of it. I installed openfoam9 by using docker in the described way (https://openfoam.org/download/9-macos/) and the installation is working as intended.
Regarding cfdof in FreeCad, I can't add the OpenFoam install directory in preferences. usr/openfoam/run isn't working and I have no clue how I could add it from Docker or find the installation directory.

Freecad 0.19
macOS Catalina 10.15.7
Intel version

I really appreciate any help, Thanks!
User avatar
oliveroxtoby
Posts: 837
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: installing cfdof on Macos

Post by oliveroxtoby »

funky wrote: Mon Nov 15, 2021 2:48 pm Hello guys,

Does somebody know how to install cfdof on Mac? I checked this topic https://forum.freecadweb.org/viewtopic.php?p=364713 , however I could not get anything out of it. I installed openfoam9 by using docker in the described way (https://openfoam.org/download/9-macos/) and the installation is working as intended.
Regarding cfdof in FreeCad, I can't add the OpenFoam install directory in preferences. usr/openfoam/run isn't working and I have no clue how I could add it from Docker or find the installation directory.

Freecad 0.19
macOS Catalina 10.15.7
Intel version

I really appreciate any help, Thanks!
It might be worth pinging the creator of this pull request as it sounds like they have it working on MacOS.
KAKM
Posts: 112
Joined: Tue May 04, 2021 12:17 am

Re: installing cfdof on Macos

Post by KAKM »

I made that pull request (and responded over on Gitlab), but I thought I'd respond here too to make everyone's life easier later on.

I didn't use docker–I had OpenFOAM on docker for a while, but I got tired of having to cp files into and out of the container to be able to use them with other things. Instead, I installed it natively (MacOS is unix based, so you can do that without a crazy amount of effort). The instructions here worked very nicely for me https://github.com/mrklein/openfoam-os- ... &-Homebrew (Does require homebrew). You can just copy/paste the lines into Terminal, and the only thing you have to do is replace <version> with your version of OpenFOAM. It does take 3-4 hours for OpenFOAM to compile though, so plan accordingly. You should be able to run the test case of your choice as soon as it's compiled. There's a bit here about downloading Paraview if you need to do that: https://github.com/mrklein/openfoam-os- ... Questions)

A couple of notes about actually running CfdOF: You need to have the disk mounted and OpenFOAM sourced for it to work. The first time, that's done by the install process (which is where I swiped these commands from), but subsequently you may need to do this manually.
Run this line to mount the disk:

Code: Select all

hdiutil attach -mountpoint $HOME/OpenFOAM OpenFOAM.sparsebundle
If you try to do it by just double-clicking on the disc image in finder, it mounts outside your user directory somewhere that is freaking impossible to figure out the path to.
Run this line to source OpenFOAM:

Code: Select all

source ~/OpenFOAM/OpenFOAM-<version>/etc/bashrc
Note that <version> needs to be replaced with your version number (mine is v2012).

Also, I never did get it to recognize my HISA install, but I wasn't much fussed by that because I wasn't planning on doing things that require it. It might also take me a bit if you ask a question that requires running CfdOF to answer it, because I'm in the process of getting Cfd and CfdOF to coexist on my machine and they're still interfering with each other, so I can't actually load either one at the moment.

EDIT: It is now possible to install OpenFOAM natively on Mac through Homebrew. Instructions here: https://www.cfd-online.com/Forums/openf ... -link.html
Last edited by KAKM on Sat Oct 01, 2022 1:33 am, edited 1 time in total.
User avatar
oliveroxtoby
Posts: 837
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: installing cfdof on Macos

Post by oliveroxtoby »

KAKM wrote: Wed Nov 17, 2021 5:42 pm I made that pull request (and responded over on Gitlab), but I thought I'd respond here too to make everyone's life easier later on.
Thanks so much for taking the time to document this. I'm going to put a link in the Readme.
funky
Posts: 8
Joined: Mon Nov 15, 2021 2:34 pm

Re: installing cfdof on Macos

Post by funky »

Thank you very much!

The installation seems to be working, even though I don't understand everything going on there.
CfdOF dependency check in Freecad shows then the following: HiSA not found (as you already mentioned) and
/OpenFOAM/OpenFOAM-9/etc/config.sh/mpi: line 46: mpicc: command not found

I also followed this tutorial https://www.youtube.com/watch?v=7i_K7fo8BSk until ~ min. 20 when the CfdSolver is run. There write works but run ends after ~ 10 sec with this error: ./Allrun: line 9: mpiexec: command not found

Do you maybe know how to resolve these errors?
KAKM
Posts: 112
Joined: Tue May 04, 2021 12:17 am

Re: installing cfdof on Macos

Post by KAKM »

It sounds like the MPI library might not have been installed or something went wrong with the install.

If you run

Code: Select all

mpicc --version
in your terminal, does it return something similar to

Code: Select all

Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
or does it return an error?

If you get "command not found", try running

Code: Select all

brew install open-mpi
Have you run any of the OpenFOAM examples from the command line? If those don't work, then it's a problem with the OpenFOAM install that is probably best debugged by talking to the folks at the CFD-Online forum. If they do, then CfdOF is not correctly finding open MPI, and we might be able to help you sort that out.

Katy
funky
Posts: 8
Joined: Mon Nov 15, 2021 2:34 pm

Re: installing cfdof on Macos

Post by funky »

The MPI library is installed correctly as the mpicc --version command returns exactly what you described.

I also reinstalled to openfoam-8 as I thought this might resolve the problem, but it didn't and still shows the same mistake in Freecad.

Regarding the tutorials, I executed the commands described here https://github.com/mrklein/openfoam-os- ... stallation which seemed to work correctly. Except for:

Code: Select all

$ cat > system/decomposeParDict
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      decomposeParDict;
}

numberOfSubdomains 4;

method          scotch;
^D
$ decomposePar
$ mpiexec -np 4 icoFoam -parallel

I also did the pitzdaily-tutorial described here https://openfoam.org/download/9-source/ but there he doesn't find Paraview: /OpenFOAM/OpenFOAM-8/bin/paraFoam: line 68: paraview: command not found.
However, regarding different solutions online and also the one you mentioned to add Paraview, I have my trouble how to implement/execute these commands in the terminal.
KAKM
Posts: 112
Joined: Tue May 04, 2021 12:17 am

Re: installing cfdof on Macos

Post by KAKM »

So one solution is to simply not run in parallel–it sounds like that's where the install problem actually is, and if you have less than ~100,000 cells per core, there isn't really any benefit to running parallel anyway.

A single line command can be run in Terminal by just copy/pasting or typing it in, then pressing enter. If you have a multi-line command, you can copy-paste in the whole thing at once. You may need to press enter if the last line doesn't get run. It can also be run one line at a time in the same way as a single line command.

If you want to install Paraview, then you can just type

Code: Select all

brew cask install paraview
into Terminal, or if you don't want to use the command line/don't really care about keeping the most up-to-date version, you can go to https://www.paraview.org/download/ and just do a typical download–it should work regardless.
funky
Posts: 8
Joined: Mon Nov 15, 2021 2:34 pm

Re: installing cfdof on Macos

Post by funky »

Okay, as for the parallel commands it says that, when staying in the cavity folder right after performing the cavity tutorial: zsh: no such file or directory: system/decomposeParDict

Yeah, I installed Paraview 5.9.1 already, it is also working in freecad and was working with the previous docker installation.
I also renamed it to paraview.app as instructed, however I've got my problems with running commands like the exported shell functions (presented here https://github.com/mrklein/openfoam-os- ... Questions)).
Example:

Code: Select all

$ type paraview
paraview is a function
paraview ()
{
    /Applications/Paraview*/Contents/MacOS/paraview "$@"
}
There I don't know where and how to execute these. (and also if these are relevant to get paraview running for the pitzdaily tutorial)

For the rest, when mounting and then sourcing OpenFOAM it gives this message:

Code: Select all

paraview () {
	local _paraviews=(/Applications/[Pp][Aa][Rr][Aa][Vv][Ii][Ee][Ww]*.app) 
	$_paraviews/Contents/MacOS/paraview "$@"
}
However, do you think that the Paraview problem is also part of the mpicc error?
funky
Posts: 8
Joined: Mon Nov 15, 2021 2:34 pm

Re: installing cfdof on Macos

Post by funky »

And the mpicc command not found is the following in the mpi file:

Code: Select all

libDir=`mpicc --showme:link | sed -e 's/.*-L\([^ ]*\).*/\1/'`
Post Reply