GithubHelp home page GithubHelp logo

openfoam-applem1's Introduction

OpenFOAM-AppleM1

Patch to compile OpenFOAM-v2206 on M1 Mac.

OpenFOAM-v2206

Procedures

  1. Create to a case-sensitive volume like this

I usually create a soft link so I don't need to change etc/bashrc

ln -s /Volumes/OpenFOAM ~/OpenFOAM
cd ~/OpenFOAM
  1. Install these components from homebrew
brew install cmake open-mpi libomp adios2 boost fftw kahip metis 
  1. Install modifiled scotch and CGAL@4 (Thanks to @gerlero for creating this tap)
brew tap gerlero/openfoam
brew install scotch-no-pthread cgal@4
  1. Clone the OpenFOAM source code into this volume
git clone https://develop.openfoam.com/Development/openfoam.git OpenFOAM-v2206
cd OpenFOAM-v2206
git checkout OpenFOAM-v2206
git submodule init
git submodule update
  1. Apply mrklein's patch for OpenFOAM-v2206
curl -OL https://github.com/mrklein/openfoam-os-x/raw/master/OpenFOAM-v2206.patch
git apply OpenFOAM-v2206.patch
  1. Apply my patch for M1.
curl -OL https://github.com/BrushXue/OpenFOAM-AppleM1/raw/main/M1.patch
git apply M1.patch
  1. Add OpenFOAM to .zshrc or .bashrc
echo 'source ~/OpenFOAM/OpenFOAM-v2206/etc/bashrc' >> ~./zshrc

And you probably need to add the following for M1:

export CPATH=/opt/homebrew/include
export LIBRARY_PATH=/opt/homebrew/lib
  1. Compile the code with bear (remove -with-bear if you don't need it).
./Allwmake -j -s -l -with-bear

It takes 40~45 minutes on M1.

  1. Install paraview from Homebrew
brew install --cask paraview

Known issue

sigFpe is disabled for now until new solution comes.

It is suggested to run parallel command in scripts by using

. $WM_PROJECT_DIR/bin/tools/RunFunctions
runParallel ***Foam

to avoid macOS restrictions.

swak4Foam

Procedures

  1. Download swak4Foam
hg clone http://hg.code.sf.net/p/openfoam-extend/swak4Foam swak4Foam
cd swak4Foam
hg update develop
  1. Apply my patch for macOS.
curl -OL https://github.com/BrushXue/OpenFOAM-AppleM1/raw/main/swak4Foam.patch
git apply swak4Foam.patch
  1. Install these components from homebrew:
brew install bison pkgconfig
  1. Add bison to the path:
export PATH="$(brew --prefix)/opt/bison/bin:$PATH"
  1. Compile the code.
./AllwmakeAll

It takes approximately 6 minutes on M1.

Known issue

python 2.7 is removed in macOS 12.3+. Therefore swakPythonIntegration and funkyPythonPostproc are disabled.

Benchmark

The benchmark is modified from https://www.cfd-online.com/Forums/hardware/198378-openfoam-benchmarks-various-hardware.html

openfoam-applem1's People

Contributors

brushxue avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.