|January 8, 2016, 15:53||
A Mac OS X of23x Development Environment Using Docker
Join Date: Sep 2013
Posts: 10Rep Power: 5
Apologies for the long post.
In summary the idea is to basically have a Docker container which essentially has OpenSUSE (as on my workstation) with all the OpenFOAM dependencies and the basic OpenFOAM install. This can be run on a Mac (from the OS X terminal), with the user’s OpenFOAM files readily shared from a folder in OS X (so we can still browse and edit them using our favourite OS X tools). This is easier to install than native OS X OpenFOAM, and provides an environment that is very similar to that on workstations and clusters. It is a lighter-weight solution and allows for much better OS X integration when compared to running OpenFOAM from a full Linux virtual machine in OS X. I suspect that like many here, my MacBook is really just used for development work (writing code and testing it builds), whilst any cases are run on my workstation or cluster. What I outline below is well suited to this usage profile.
See this recent article for a summary of Docker and it's advantages for OpenFOAM https://www.cfdengine.com/blog/how-t...e-with-docker/ - though this seems to be more focused on using a completely standard OpenFOAM build without additional libraries/apps etc by downloading one of several existing Docker containers. I've been thinking about how we can use Docker to make it easier to install OpenFOAM on a Mac, that will:
Docker behaves a little differently on OSX than how it does on Linux distros. Docker containers are actually run inside a custom 'docker-machine' virtual machine (using virtualbox) rather than in pure OSX, this virtual machine is however very very light weight. The OSX /Users/[USER NAME] directories are automatically shared to the virtual machine as default and can then be very easily mounted into a Docker container. However due to limitations in virtual box’s file sharing (vboxsf) used by Docker this results in quite a degradation in read/write performance (see http://mitchellh.com/comparing-files...rtual-machines). Hopefully Docker will eventually resolve this by switching from vboxsf to NFS or similar.
Due to the virtual machine setup, sharing files which are stored in Docker containers (or Docker volumes) back into OS X is challenging as they are buried somewhere in the docker-machine's virtual disk image. The only way I have found is to ssh into docker-machine and browse/edit files in the terminal (after using a Docker command to look up where they are actually stored) but then we don’t have any real OS X integration (can’t view files in the Finder or access them in apps). I have tried using sshfs and various virtual disk image mounting tools without success. There are various third party add ons that make attempts to address various aspects of this but none are a complete solution and many introduce other problems.
There is thus a balance between having good OpenFOAM performance and having good OS X integration. I have considered and tested three options:
Note that if we were to run the same Docker container in a Linux distro this approach would be ideal. There'd be no slow down by mounting the user files in this way (since they don't need to pass through the intermediate docker-machine's vboxsf system) and we'd easily be able to browse the OpenFOAM source code stored in the container on the linux OS (because unlike on a Mac it's not buried in docker-machine's virtual disk image). So this approach is also suitable if you want to use this same OpenFOAM container on your mac and workstations/clusters (to ensure a fully consistent environment).
Here is my setup for OpenFOAM 2.3.x, though it could easily be modified to run any other version of OpenFOAM:
of23xfull Docker container
How to actually then do OpenFOAM stuff:
Running multiple of23x containers at once:
|February 28, 2016, 20:00||
Join Date: Nov 2011
Location: RMIT. Melbourne, Australia
Posts: 11Rep Power: 7
looks really interesting. I can run now blockMesh...
how can edit files? for example using an osx text editor like "open"
bash: open: command not found
thanks in advance!
|Thread||Thread Starter||Forum||Replies||Last Post|
|FOAM on Windows, Linux and Mac||hjasak||OpenFOAM Installation||7||January 24, 2016 07:54|
|environment variables are inconsistent - openFOAM-2.2.0 on mac mavericks||esujby||OpenFOAM Installation on Windows, Mac and other Unsupported Platforms||0||March 3, 2014 18:42|
|Extend Project 1.6-ext Binary Release for Mac OS X||hjasak||OpenFOAM Announcements from Other Sources||26||November 5, 2013 17:50|
|CFX11 + Fortran compiler ?||Mohan||CFX||20||March 30, 2011 18:56|
|Software development environment||jojo||Main CFD Forum||12||July 14, 2006 08:14|