Here is a summary of how to customize the image after installing OpenFOAM v8 (Foundation version) on Mac. For details such as installation, click here Qiita page and here cfdengine page -install-openfoam-anywhere-with-docker /) may also be helpful.
Download and install Docker Desktop from the Docker site. There is nothing special to mention here ... (It's easy, isn't it?).
After the installation is complete, start Docker Desktop. A whale mark will appear in the upper right corner like this.
Install according to Foundation in Foundation. Create a directory called ʻopenfoam` and type the following command in it.
Excerpt from the head family
sudo curl --create-dirs -o /usr/local/bin/openfoam8-macos http://dl.openfoam.org/docker/openfoam8-macos
sudo chmod 755 /usr/local/bin/openfoam8-macos
By executing the following command (script) in the ʻopenfoam` directory, the OpenFOAM environment will be started.
openfoam8-macos
You can now use blockMesh and solvers.
First, check the ID of the image.
docker images
Make a note of this Image ID. After that, launch Image as root.
docker run -it -u=root <Image ID>
If you start it with a script, it will not be recorded even if you install the application with apt etc. However, when started as root, customizations and various setting changes are recorded in the container. In this state, install your desired application.
After that, stop the container (log out) and check __Container ID __.
docker ps -a
Commit the modified container to the image.
docker commit <container ID> <Repository>
Although it is Repository
, it is better to use the default setting and set it to ʻopenfoam / openfoam8-graphical-macos. You can change the
Repository to whatever you like here, but you'll need to modify DOCKER_IMAGES in the startup script
/ usr / local / bin / openfoam8-macos`.
For example, if you want the Repository to be openfoam8,
example
docker commit <container ID> openfoam8
openfoam8-macos
DOCKER_IMAGE='macos8'
will do.
Personally, I think it would be convenient to include lv
, gmsh
, python3.8
,python3-pip (numpy, pandas, torch, tensorflow, scikit-learn)
. [^ 1]
This is the end of customization. Thank you for your hard work.
[^ 1]: When installing torch, an event occurred that could not be installed due to an error like the one in here. Download torch directly from here and install it directly with pip3 I can do it. Alternatively, you can resolve it with pip --no-cache-dir install torch
.
I couldn't find a site or page that summarizes how to customize the Docker image of OpenFOAM, so I summarized it here. I still don't understand how to use Docker, and sometimes I haven't used it up yet, so I don't know if it's the best way to do it ... I would be grateful if you could point out a better way.
Recommended Posts