@daidezhi
2017-04-13T00:07:30.000000Z
字数 3413
阅读 1869
OpenFoam TACC Lonestar LS5
OpenFOAM is one of the most widely used CFD open source toolbox both in academic and industrial applications at this time. The brief introduction of OpenFOAM can be found in OpenFOAM - Wikipedia and OpenFOAM®.
Download and unzip the OpenFOAM source code. TACC's $WORK filesystem is used here.
$ cdw$ mkdir OpenFOAM$ cd OpenFOAM$ wget "http://downloads.sourceforge.net/foam/OpenFOAM-2.4.0.tgz?use_mirror=mesh" -O OpenFOAM-2.4.0.tgz$ wget "http://downloads.sourceforge.net/foam/ThirdParty-2.4.0.tgz?use_mirror=mesh" -O ThirdParty-2.4.0.tgz$ tar -xzf OpenFOAM-2.4.0.tgz$ tar -xzf ThirdParty-2.4.0.tgz
Build CGAL-4.6 that is needed in our analytical PLIC method.
ThirdParty-2.4.0/makeCGAL at line 131:from
BOOST_ARCH_PATH=$installBASE/$boostPACKAGE
BOOST_ARCH_PATH=$TACC_BOOST_DIR
OpenFOAM-2.4.0/etc/config/CGAL.sh at line 35:from
export BOOST_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$boost_version
to
export BOOST_ARCH_PATH=$TACC_BOOST_DIR
ThirdParty-2.4.0 directory and load the boost install in LS5:
$ cd ThirdParty-2.4.0$ module load boost
cmake-2.8.12.1:
$ ./makeCmake &> build_log_cmake
CGAL-4.6:
$ PATH="$WORK/OpenFOAM/ThirdParty-2.4.0/platforms/linux64Icc/cmake-2.8.12.1/bin/:${PATH}" ./makeCGAL &> build_log_cgal
Edit the OpenFOAM-2.4.0/etc/bashrc file and change the following environment variables defined in this file:
45from
foamInstall=$HOME/$WM_PROJECT
to
foamInstall=$WORK/$WM_PROJECT
66from
export WM_COMPILER=Gcc
to
export WM_COMPILER=Icc
84from
export WM_MPLIB=OPENMPI
to
export WM_MPLIB=MV2MPI
104from
foamOldDirs="$FOAM_INST_DIR $WM_PROJECT_SITE $HOME/$WM_PROJECT/$USER"
to
foamOldDirs="$FOAM_INST_DIR $WM_PROJECT_SITE $WORK/$WM_PROJECT/$USER"
132from
export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
to
export WM_PROJECT_USER_DIR=$WORK/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
Edit the OpenFOAM-2.4.0/etc/config/settings.sh file and change the following environment variables defined in this file:
89-90:from
export WM_CC='gcc'export WM_CXX='g++'
to
export WM_CC='mpicc'export WM_CXX='mpicxx'
91-93:from
export WM_CFLAGS='-m64 -fPIC'export WM_CXXFLAGS='-m64 -fPIC'export WM_LDFLAGS='-m64'
to
export WM_CFLAGS='-O3 -fPIC'export WM_CXXFLAGS='-O3 -fPIC'export WM_LDFLAGS='-O3'
MV2MPI case we defined in Step 2 after line 364:
MV2MPI)export FOAM_MPI=mpiexport MPI_ARCH_PATH="${MPICH_HOME}";;
OpenFOAM-2.4.0/wmake/rules/linux64Icc/c file and change line 5:from
cc = icc
to
cc = mpicc
OpenFOAM-2.4.0/wmake/rules/linux64Icc/c++ file and change line 5:from
CC = icpc -std=c++0x -fp-trap=common -fp-model precise
to
CC = mpicxx -std=c++0x -fp-trap=common -fp-model precise
Set and export the following environment variables:
$ export WM_CC=mpicc$ export WM_CXX=mpicxx
Source the etc/bashrc file edited in Step 2 and update the shell environment:
$ cdw$ cd OpenFOAM/OpenFOAM-2.4.0$ . etc/bashrc$ wmSET $FOAM_SETTINGS
Start the build and take a 4-5 hour break:
$ ./Allwmake &> build_log$ ./Allwmake &> build_log_summary
To check if everything went well:
$ icoFoam -help
Add the scripts below to $HOME/.bashrc:
source $WORK/OpenFOAM/OpenFOAM-2.4.0/etc/bashrcexport LD_LIBRARY_PATH=/work/04032/ddai/lonestar/OpenFOAM/ThirdParty-2.4.0/platforms/linux64Icc/CGAL-4.6/lib:$LD_LIBRARY_PATHmodule load boost
the dir /work/04032/ddai/ should be replaced by your own work one in LS5.
Then reload the bash file:
$ . ~/.bashrc
Dezhi, Dai [Ph.D. student]
Mechanical & Aerospace Engineering Department
UT Arlington
Email: dezhi.dai@mavs.uta.edu