Skip to content

Instantly share code, notes, and snippets.

@iydon
Created June 1, 2022 09:48
Show Gist options
  • Save iydon/a9a131ffdd270cbdb79c4ada0eedc236 to your computer and use it in GitHub Desktop.
Save iydon/a9a131ffdd270cbdb79c4ada0eedc236 to your computer and use it in GitHub Desktop.
OpenFOAM
# docker build -t of:orig .
# docker run -dit of:orig
# docker exec -it `docker container ls --format "{{.ID}}"` bash
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive \
DIRECTORY=/root/OpenFOAM \
ALIASES=/root/.bash_aliases
# Software for Compilation
# Reference:
# - https://openfoam.org/download/source/software-for-compilation/
# - https://openfoam.org/download/source/third-party-software/
RUN sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list \
&& apt-get update \
# Install packages for repositories and compilation
&& apt-get install -y build-essential cmake git ca-certificates \
# Install general packages for OpenFOAM
&& apt-get install -y flex libfl-dev bison zlib1g-dev libboost-system-dev libboost-thread-dev libopenmpi-dev openmpi-bin gnuplot libreadline-dev libncurses-dev libxt-dev \
&& apt-get install -y libptscotch-dev libscotch-dev \
# Install extra packages for OpenFOAM-2.4.x
&& apt-get install -y libcgal-dev \
# Install other packages
&& apt-get install -y vim python3-pip \
# Erase downloaded archive files
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
# OpenFOAM directory
&& mkdir -p $DIRECTORY
# [v] OpenFOAM 9
# Reference: https://github.com/OpenFOAM/OpenFOAM-9
ENV REPOSITORY=OpenFOAM-9
RUN echo "alias of9='source $DIRECTORY/$REPOSITORY/etc/bashrc'" >> $ALIASES \
&& git clone https://github.com/OpenFOAM/$REPOSITORY $DIRECTORY/$REPOSITORY \
&& cd $DIRECTORY/$REPOSITORY \
&& source etc/bashrc \
&& ./Allwmake -j 2>stderr.log 1>stdout.log
# [v] OpenFOAM 8
# Reference: https://github.com/OpenFOAM/OpenFOAM-8
ENV REPOSITORY=OpenFOAM-8
RUN echo "alias of8='source $DIRECTORY/$REPOSITORY/etc/bashrc'" >> $ALIASES \
&& git clone https://github.com/OpenFOAM/$REPOSITORY $DIRECTORY/$REPOSITORY \
&& cd $DIRECTORY/$REPOSITORY \
&& source etc/bashrc \
&& ./Allwmake -j 2>stderr.log 1>stdout.log
# [v] OpenFOAM 7
# Reference: https://github.com/OpenFOAM/OpenFOAM-7
ENV REPOSITORY=OpenFOAM-7
RUN echo "alias of7='source $DIRECTORY/$REPOSITORY/etc/bashrc'" >> $ALIASES \
&& git clone https://github.com/OpenFOAM/$REPOSITORY $DIRECTORY/$REPOSITORY \
&& cd $DIRECTORY/$REPOSITORY \
&& source etc/bashrc \
&& ./Allwmake -j 2>stderr.log 1>stdout.log
# [v] OpenFOAM 6
# Reference: https://github.com/OpenFOAM/OpenFOAM-6
ENV REPOSITORY=OpenFOAM-6
RUN echo "alias of6='source $DIRECTORY/$REPOSITORY/etc/bashrc'" >> $ALIASES \
&& git clone https://github.com/OpenFOAM/$REPOSITORY $DIRECTORY/$REPOSITORY \
&& cd $DIRECTORY/$REPOSITORY \
&& source etc/bashrc \
&& ./Allwmake -j 2>stderr.log 1>stdout.log
# [v] OpenFOAM 5.x
# Reference: https://github.com/OpenFOAM/OpenFOAM-5.x
ENV REPOSITORY=OpenFOAM-5.x
RUN echo "alias of5='source $DIRECTORY/$REPOSITORY/etc/bashrc'" >> $ALIASES \
&& git clone https://github.com/OpenFOAM/$REPOSITORY $DIRECTORY/$REPOSITORY \
&& cd $DIRECTORY/$REPOSITORY \
&& source etc/bashrc \
&& ./Allwmake -j 2>stderr.log 1>stdout.log
# [v] OpenFOAM 4.x
# Reference: https://github.com/OpenFOAM/OpenFOAM-4.x
# Bug:
# -
# File: src/OSspecific/POSIX/fileStat.C
# Description: #include <sys/sysmacros.h>
# -
# File: src/OpenFOAM/containers/Lists/PackedList/PackedListI.H
# Description: inline void Foam::PackedList<nBits>::const_iterator::operator=
# -
# File: src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionI.H
# Description: // inline word& Reaction<ReactionThermo>::name() { return name_; }
ENV REPOSITORY=OpenFOAM-4.x
RUN echo "alias of4='source $DIRECTORY/$REPOSITORY/etc/bashrc'" >> $ALIASES \
&& git clone https://github.com/OpenFOAM/$REPOSITORY $DIRECTORY/$REPOSITORY \
&& cd $DIRECTORY/$REPOSITORY \
&& source etc/bashrc \
&& ./Allwmake -j 2>stderr.log 1>stdout.log
# [v] OpenFOAM 3.0.x
# Reference: https://github.com/OpenFOAM/OpenFOAM-3.0.x
# Bug:
# -
# File: src/OSspecific/POSIX/fileStat.C
# Description: #include <sys/sysmacros.h>
# -
# File: src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue/oscillatingFixedValueFvPatchField.H
# Description:
# - // scalar amplitude() const { return amplitude_; }
# - // scalar& amplitude() { return amplitude_; }
# Reference:
# - https://www.cfd-online.com/Forums/openfoam-programming-development/174892-cannot-convert-dataentry-scalar.html
# -
# File: src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionI.H
# Description: // inline word& Reaction<ReactionThermo>::name() { return name_; }
ENV REPOSITORY=OpenFOAM-3.0.x
RUN echo "alias of3='source $DIRECTORY/$REPOSITORY/etc/bashrc'" >> $ALIASES \
&& git clone https://github.com/OpenFOAM/$REPOSITORY $DIRECTORY/$REPOSITORY \
&& cd $DIRECTORY/$REPOSITORY \
&& source etc/bashrc \
&& ./Allwmake -j 2>stderr.log 1>stdout.log
# [v] OpenFOAM 2.4.x
# Reference: https://github.com/OpenFOAM/OpenFOAM-2.4.x
# Bug:
# -
# File: src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue/oscillatingFixedValueFvPatchField.H
# Description:
# - // scalar amplitude() const { return amplitude_; }
# - // scalar& amplitude() { return amplitude_; }
# Reference:
# - https://www.cfd-online.com/Forums/openfoam-programming-development/174892-cannot-convert-dataentry-scalar.html
# -
# File:
# - src/conversion/ensight/part/ensightPart.C
# - src/conversion/ensight/part/ensightPartIO.C
# Description: `#include <cmath>` and `std::isnan`
# -
# File: src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionI.H
# Description: // inline word& Reaction<ReactionThermo>::name() { return name_; }
# -
# Description: #if YY_FLEX_MINOR_VERSION < 6 && YY_FLEX_SUBMINOR_VERSION < 34
# Reference:
# - https://github.com/OpenFOAM/OpenFOAM-3.0.x/commit/31185852095c0a67e516dfb0d0b1d634955bb617
ENV REPOSITORY=OpenFOAM-2.4.x
RUN echo "alias of24='source $DIRECTORY/$REPOSITORY/etc/bashrc'" >> $ALIASES \
&& git clone https://github.com/OpenFOAM/$REPOSITORY $DIRECTORY/$REPOSITORY \
&& cd $DIRECTORY/$REPOSITORY \
&& source etc/bashrc \
&& ./Allwmake -j 2>stderr.log 1>stdout.log
# [v] OpenFOAM 2.3.x
# Reference: https://github.com/OpenFOAM/OpenFOAM-2.3.x
# Bug:
# -
# File: src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue/oscillatingFixedValueFvPatchField.H
# Description:
# - // scalar amplitude() const { return amplitude_; }
# - // scalar& amplitude() { return amplitude_; }
# Reference:
# - https://www.cfd-online.com/Forums/openfoam-programming-development/174892-cannot-convert-dataentry-scalar.html
# -
# File:
# - src/conversion/ensight/part/ensightPart.C
# - src/conversion/ensight/part/ensightPartIO.C
# Description: `#include <cmath>` and `std::isnan`
# -
# File: src/thermophysicalModels/specie/reaction/Reactions/Reaction/ReactionI.H
# Description: // inline word& Reaction<ReactionThermo>::name() { return name_; }
# -
# Description: #if YY_FLEX_MINOR_VERSION < 6 && YY_FLEX_SUBMINOR_VERSION < 34
# Reference:
# - https://github.com/OpenFOAM/OpenFOAM-3.0.x/commit/31185852095c0a67e516dfb0d0b1d634955bb617
ENV REPOSITORY=OpenFOAM-2.3.x
RUN echo "alias of23='source $DIRECTORY/$REPOSITORY/etc/bashrc'" >> $ALIASES \
&& git clone https://github.com/OpenFOAM/$REPOSITORY $DIRECTORY/$REPOSITORY \
&& cd $DIRECTORY/$REPOSITORY \
&& source etc/bashrc \
&& ./Allwmake -j 2>stderr.log 1>stdout.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment