-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile_fullopenfoambuild
176 lines (156 loc) · 6.83 KB
/
Dockerfile_fullopenfoambuild
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# start from cpl library base
FROM cpllibrary/cpl-library
MAINTAINER Edward Smith <[email protected]>
#Number of processes to use in build
ENV FOAM_VERSION=3.0.1 \
FOAM_INST_DIR="/OpenFOAM/"
ENV FOAM_SRC_DIR=$FOAM_INST_DIR/OpenFOAM-$FOAM_VERSION \
APP_DIR=$FOAM_INST_DIR/CPL_APP_OPENFOAM-$FOAM_VERSION \
WM_NCOMPPROCS=12
#Get OpenFOAM and APP
WORKDIR $FOAM_INST_DIR
RUN wget http://downloads.sourceforge.net/foam/OpenFOAM-$FOAM_VERSION.tgz && \
tar -xvf OpenFOAM-$FOAM_VERSION.tgz && \
rm -f ./OpenFOAM-$FOAM_VERSION.tgz && \
wget http://downloads.sourceforge.net/foam/ThirdParty-$FOAM_VERSION.tgz && \
tar -xvf ThirdParty-$FOAM_VERSION.tgz && \
rm -f ./ThirdParty-$FOAM_VERSION.tgz && \
git clone https://github.com/Crompulence/CPL_APP_OPENFOAM-$FOAM_VERSION.git $APP_DIR
#Get Prerequists
RUN apt-get update && apt-get install -y \
bison \
flex-old \
libboost-system-dev \
libboost-thread-dev \
libncurses-dev \
libreadline-dev\
libxt-dev \
libz-dev \
&& rm -rf /var/lib/apt/lists/*
#We copy this pref file to build OpenFOAM with system MPICH instead of OpenMPI
RUN cp $APP_DIR/config/prefs_system_mpich.sh $FOAM_SRC_DIR/etc/prefs.sh
#Build from CPL APP file
RUN echo $FOAM_INST_DIR > $APP_DIR/CODE_INST_DIR
#Ideally we set all these as ENV but so many for OpenFOAM
WORKDIR $APP_DIR
RUN /bin/bash -c "source SOURCEME.sh && \
cd $FOAM_INST_DIR/ThirdParty-$FOAM_VERSION && \
./Allwmake"
RUN /bin/bash -c "source SOURCEME.sh && \
cd $FOAM_SRC_DIR && \
mkdir -p platforms/linux64GccDPInt32OptSYSTEMMPI/src/Pstream/mpi && \
mkdir -p platforms/linux64GccDPInt32OptSYSTEMMPI/src/parallel/decompose/ptscotchDecomp && \
patch src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C $APP_DIR/config/ptscotchDecomp.patch && \
./Allwmake -j"
#We need to make Pstream, patch the OpenFOAM version and build solvers
RUN /bin/bash -c "source SOURCEME.sh && \
make clean && \
make pstream && \
mv $FOAM_SRC_DIR/platforms/linux64GccDPInt32Opt/lib/mpi-system/libPstream.so \
$FOAM_SRC_DIR/platforms/linux64GccDPInt32Opt/lib/mpi-system/libPstream.so.orig && \
cp lib/libPstream.so $FOAM_SRC_DIR/platforms/linux64GccDPInt32Opt/lib/mpi-system/ && \
make"
#Add sourceme to bashrc
#RUN echo "source /OpenFOAM/CPL_APP_OPENFOAM-3.0.1/SOURCEME.sh" >> ~/.bashrc
# Note Bashrc will not work in singularity and it's a poor solution for Docker.
# Instead, we try to ENV everything here
ENV THIRD_PARTY_DIR=$FOAM_INST_DIR/ThirdParty-$FOAM_VERSION \
PLATFORM=/platforms/linux64GccDPInt32Opt
ENV FOAM_CPL_APP=$APP_DIR \
FOAM_CPL_APP_SRC=$APP_DIR/src \
FOAM_CPL_APP_LIBBIN=$APP_DIR/lib \
FOAM_CPL_APP_BIN=$APP_DIR/bin
ENV PATH=$FOAM_SRC_DIR/$PLATFORM/bin:$FOAM_SRC_DIR/bin:$FOAM_SRC_DIR/wmake:$APP_DIR/bin:$PATH
ENV LD_LIBRARY_PATH=$APP_DIR/lib:$FOAM_SRC_DIR/$PLATFORM/lib:$THIRD_PARTY_DIR/$PLATFORM/lib:$FOAM_SRC_DIR/$PLATFORM/lib/dummy:$LD_LIBRARY_PATH
#Essential Libraries in addition to path and LD library path from
# https://www.cfd-online.com/Forums/openfoam-solving/69561-foam-fatal-error-foam-findetcfile-could-not-find-mandatory-file.html
# include: WM_PROJECT_DIR WM_PROJECT_INST_DIR WM_OPTIONS FOAM_LIBBIN FOAM_APPBIN FOAM_USER_APPBIN MPI_BUFFER_SIZE
ENV WM_PROJECT_DIR=$FOAM_SRC_DIR \
WM_PROJECT_INST_DIR=$FOAM_INST_DIR \
WM_OPTIONS=linux64GccDPInt32Opt \
FOAM_LIBBIN=$FOAM_SRC_DIR/$PLATFORM/lib \
FOAM_APPBIN=$FOAM_SRC_DIR/$PLATFORM/bin \
FOAM_USER_APPBIN=/root/$FOAM_INST_DIR/$PLATFORM/bin \
MPI_BUFFER_SIZE=20000000
ENTRYPOINT ["/bin/bash"]
# All variables taken from what bashrc sets
#ENV WM_ARCH=linux64 \
# WM_OSTYPE=POSIX \
# WM_CXXFLAGS="-m64 -fPIC" \
# WM_CFLAGS="-m64 -fPIC" \
# WM_PROJECT_VERSION=3.0.1 \
# WM_LINK_LANGUAGE=c++ \
# WM_CXX=g++ \
# WM_LABEL_OPTION=Int32 \
# WM_ARCH_OPTION=64 \
# WM_COMPILER_LIB_ARCH=64 \
# WM_LDFLAGS=-m64 \
# WM_CC=gcc \
# WM_COMPILER=Gcc \
# WM_MPLIB=SYSTEMMPI \
# WM_COMPILE_OPTION=Opt \
# WM_LABEL_SIZE=32 \
# WM_OPTIONS=linux64GccDPInt32Opt \
# WM_PRECISION_OPTION=DP \
# WM_PROJECT=OpenFOAM \
# WM_PROJECT_INST_DIR=$FOAM_INST_DIR \
# WM_THIRD_PARTY_DIR=$THIRD_PARTY_DIR \
# WM_PROJECT_DIR=$FOAM_SRC_DIR \
# WM_DIR=$FOAM_SRC_DIR/wmake \
# FOAM_VERSION=3.0.1 \
# FOAM_SOLVERS=$FOAM_SRC_DIR/applications/solvers \
# FOAM_EXT_LIBBIN=/$THIRD_PARTY_DIR/$PLATFORM/lib \
# FOAM_APPBIN=$FOAM_SRC_DIR/$PLATFORM/bin \
# FOAM_TUTORIALS=$FOAM_SRC_DIR/tutorials \
# FOAM_JOB_DIR=/OpenFOAM//jobControl \
# FOAM_SITE_APPBIN=/OpenFOAM//site/3.0.1/$PLATFORM/bin \
# FOAM_SITE_LIBBIN=/OpenFOAM//site/3.0.1/$PLATFORM/lib \
# FOAM_APP=$FOAM_SRC_DIR/applications \
# FOAM_SRC=$FOAM_SRC_DIR/src \
# FOAM_UTILITIES=$FOAM_SRC_DIR/applications/utilities \
# FOAM_ETC=$FOAM_SRC_DIR/etc \
# FOAM_MPI=mpi-system \
# FOAM_LIBBIN=$FOAM_SRC_DIR/$PLATFORM/lib \
# FOAM_SETTINGS= \
# WM_PROJECT_USER_DIR=/root/OpenFOAM/-3.0.1 \
# FOAM_RUN=/root/OpenFOAM/-3.0.1/run \
# FOAM_USER_LIBBIN=/root/OpenFOAM/-3.0.1/$PLATFORM/lib \
# FOAM_USER_APPBIN=/root/OpenFOAM/-3.0.1/$PLATFORM/bin \
# MPI_ROOT=/usr \
# MPI_ARCH_PATH=/usr \
# MPI_ARCH_LIBS="-Wl,-Bsymbolic-functions -Wl,-z,relro -L/usr/lib/x86_64-linux-gnu -lmpich" \
# MPI_ARCH_INC=-I/usr/include/mpich \
# MPI_ARCH_FLAGS= \
# MPI_BUFFER_SIZE=20000000 \
# CGAL_ARCH_PATH=/$THIRD_PARTY_DIR/platforms/linux64Gcc/CGAL-4.7 \
# BOOST_ARCH_PATH=/$THIRD_PARTY_DIR/platforms/linux64Gcc/boost-system \
# ParaView_INCLUDE_DIR=/$THIRD_PARTY_DIR/platforms/linux64Gcc/ParaView-4.4.0/include/paraview-4.4 \
# ParaView_DIR=/$THIRD_PARTY_DIR/platforms/linux64Gcc/ParaView-4.4.0 \
# ParaView_VERSION=4.4.0 \
# ParaView_MAJOR=4.4 \
# PV_PLUGIN_PATH=$FOAM_SRC_DIR/$PLATFORM/lib/paraview-4.4
#ENV alias app='cd $FOAM_APP' \
# alias foam='cd $WM_PROJECT_DIR' \
# alias foam3rdParty='cd $WM_THIRD_PARTY_DIR' \
# alias foamApps='cd $FOAM_APP' \
# alias foamSite='cd $WM_PROJECT_INST_DIR/site' \
# alias foamSol='cd $FOAM_SOLVERS' \
# alias foamTuts='cd $FOAM_TUTORIALS' \
# alias foamUtils='cd $FOAM_UTILITIES' \
# alias foamfv='cd $FOAM_SRC/finiteVolume' \
# alias foamsrc='cd $FOAM_SRC/$WM_PROJECT' \
# alias lib='cd $FOAM_LIBBIN' \
# alias run='cd $FOAM_RUN' \
# alias sol='cd $FOAM_SOLVERS' \
# alias src='cd $FOAM_SRC' \
# alias tut='cd $FOAM_TUTORIALS' \
# alias util='cd $FOAM_UTILITIES' \
# alias wm32='wmSET WM_ARCH_OPTION=32' \
# alias wm64='wmSET WM_ARCH_OPTION=64' \
# alias wmDP='wmSET WM_PRECISION_OPTION=DP' \
# alias wmREFRESH='wmSET $FOAM_SETTINGS' \
# alias wmSET='. $WM_PROJECT_DIR/etc/bashrc' \
# alias wmSP='wmSET WM_PRECISION_OPTION=SP' \
# alias wmSchedOFF='unset WM_SCHEDULER' \
# alias wmSchedON='export WM_SCHEDULER=$WM_PROJECT_DIR/wmake/wmakeScheduler' \
# alias wmUNSET='. $WM_PROJECT_DIR/etc/config/unset.sh'