OpenCFD 컴파일
주어진 환경은 Windows 11WSL Ubutun 20.04입니다.
ESI-OpenCFD 버전 v2112를 사용합니다.원본을 다운로드하여 압축을 풀다.
$ wget https://dl.openfoam.com/source/v2112/OpenFOAM-v2112.tgz
$ wget https://dl.openfoam.com/source/v2112/ThirdParty-v2112.tgz
$ mkdir ~/src
$ cd ~/src
$ tar zxvf ~/OpenFOAM-v2112.tgz
$ tar zxvf ~/ThirdParty-v2112.tgz
기본 설정으로 컴파일
어쨌든 기본값으로 해보자.
큰 설정은 OpenFOAM-v2112/etc/bashrc에 기록되어 있습니다.일부분을 발췌하면 기본 설정은 이렇다.
OpenFOAM-v2112/etc/bashrc
# [WM_COMPILER_TYPE] - Compiler location:
# = system | ThirdParty
export WM_COMPILER_TYPE=system
# [WM_COMPILER] - Compiler:
# = Gcc | Clang | Icc | Icx | Amd | Arm | Cray | Fujitsu |
# Gcc<digits> | Clang<digits>
# [Not well tested: Pgi | Nvidia]
export WM_COMPILER=Gcc
# [WM_MPLIB] - MPI implementation:
# = SYSTEMOPENMPI | OPENMPI | SYSTEMMPI | MPI | MPICH | MPICH-GM |
# HPMPI | CRAY-MPICH | FJMPI | QSMPI | SGIMPI | INTELMPI | USERMPI
# Specify SYSTEMOPENMPI1, SYSTEMOPENMPI2 for internal tracking (if desired)
# Can also use INTELMPI-xyz etc and define your own wmake rule
export WM_MPLIB=SYSTEMOPENMPI
ThirdParty의 컴파일
먼저 ThirdParty를 컴파일합니다.
$ source ~/src/OpenFOAM-v2112/etc/bashrc
$ cd ~/src/ThirdParty-v2112
$ ./Allwmake -j
METIS 및 ADIOS2 에 오류가 발생했습니다.METIS 오류
========================================
METIS decomposition
Did not find ... metis-5.1.0
Missing sources: 'metis-5.1.0'
Possible download locations for metis :
http://glaros.dtc.umn.edu/gkhome/metis/metis/overview
http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-5.1.0.tar.gz
---------------------------------------------------
Optional component (METIS) had build issues
OpenFOAM will nonetheless remain largely functional
---------------------------------------------------
ADIOS2 오류========================================
ADIOS2
Did not find ... ADIOS2-2.6.0
========================================
Build adios library ADIOS2-2.6.0 for sys-openmpi
Starting build: ADIOS2-2.6.0 (using cmake)
./makeAdios2: 191: cd: can't cd to $HOME/src/ThirdParty-v2112/ADIOS2-2.6.0
Error building: ADIOS2-2.6.0
---------------------------------------------------
Optional component (ADIOS2) had build issues
OpenFOAM will nonetheless remain largely functional
---------------------------------------------------
소스 모양도 안 나고.!
ThirdParty-v2112/BUIILD.md의 마지막 쪽은 다운로드 주소를 기재했다.
METIS 소스를 다운로드하고 ThirdParty-v2112/sources에서 확장합니다.
$ wget http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-5.1.0.tar.gz
$ tar zxvf metis-5.1.0.tar.gz -C sources
ADIOS2는 2.6.02.7.1이 아니기 때문에 그곳을 사용하기로 했다.동결해제 후 ADIOS2-2.7.1 디렉토리를 생성할 수 있습니다.$ wget https://github.com/ornladios/ADIOS2/archive/refs/tags/v2.7.1.tar.gz
$ tar zxvf v2.7.1.tar.gz
사용하는 ADIOS2의 버전을 기본값에서 변경하기 때문에 OpenFOAM-v2112/etc/config입니다.sh/adios2를 편집합니다.OpenFOAM-v2112/etc/config.sh/adios2
--- OpenFOAM-v2112/etc/config.sh/adios2,orig 2021-12-21 03:57:43.000000000 +0900
+++ OpenFOAM-v2112/etc/config.sh/adios2 2022-03-13 21:49:25.779751600 +0900
@@ -21,7 +21,7 @@
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
-adios2_version=ADIOS2-2.6.0
+adios2_version=ADIOS2-2.7.1
export ADIOS2_ARCH_PATH="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$adios2_version"
# END OF (NORMAL) USER EDITABLE PART
OpenFOAM-v2112/etc/bashrc를 다시 읽을 필요가 없을 수도 있습니다. 어쨌든.$ source ~/src/OpenFOAM-v2112/etc/bashrc
$ ./Allwmake -j
번역에 성공했습니다.OpenFOAM 컴파일
ThirdParty의 컴파일링이 끝났습니다. OpenFOAM을 컴파일합니다.
$ cd ~/src/OpenFOAM-v2112
$ ./Allwmake -j -s -l
Cfdof를 통해 동작 확인
OpenFOAM의 컴파일링이 완료되면 CfdOF에서 참조하는 OpenFOAM의 설치 디렉토리 설정을 수정하고 작업을 확인합니다.
응, 안 돼.병렬 계산을 실행하는 중 오류가 발생했습니다.
CfdOF에서 병렬 계산을 실행하는 중 오류 발생
--> FOAM FATAL ERROR: (openfoam-2112)
attempt to run parallel on 1 processor
From static bool Foam::UPstream::init(int&, char**&, bool)
in file UPstream.C at line 297.
FOAM aborting
#0 Foam::error::printStack(Foam::Ostream&)
--> FOAM FATAL ERROR: (openfoam-2112)
attempt to run parallel on 1 processor
From static bool Foam::UPstream::init(int&, char**&, bool)
in file UPstream.C at line 297.
FOAM aborting
at ??:?
#1 Foam::error::simpleExit(int, bool)#0 Foam::error::printStack(Foam::Ostream&)
--> FOAM FATAL ERROR: (openfoam-2112)
attempt to run parallel on 1 processor
From static bool Foam::UPstream::init(int&, char**&, bool)
in file UPstream.C at line 297.
FOAM aborting
#0 Foam::error::printStack(Foam::Ostream&) at ??:?
#2 Foam::error::exiting(int, bool) at ??:?
#1 Foam::error::simpleExit(int, bool)
--> FOAM FATAL ERROR: (openfoam-2112)
attempt to run parallel on 1 processor
From static bool Foam::UPstream::init(int&, char**&, bool)
in file UPstream.C at line 297.
FOAM aborting
#0 Foam::error::printStack(Foam::Ostream&) at ??:?
at ??:?
#1 Foam::error::simpleExit(int, bool)#2 Foam::error::exiting(int, bool) at ??:?
#3 Foam::UPstream::init(int&, char**&, bool) at ??:?
#4 Foam::argList::argList(int&, char**&, bool, bool, bool) at ??:?
#2 Foam::error::exiting(int, bool) at ??:?
#3 Foam::UPstream::init(int&, char**&, bool) at ??:?
#5 at ??:?
#4 Foam::argList::argList(int&, char**&, bool, bool, bool) at ??:?
#3 Foam::UPstream::init(int&, char**&, bool) at ??:?
#4 Foam::argList::argList(int&, char**&, bool, bool, bool) at ??:?
#1 Foam::error::simpleExit(int, bool)? at ??:?
#5 in ~/src/OpenFOAM-v2112/platforms/linux64GccDPInt32Opt/bin/potentialFoam
#6 __libc_start_main at ??:?
#5 in /lib/x86_64-linux-gnu/libc.so.6
#7 ?? at ??:?
#2 Foam::error::exiting(int, bool)? in ~/src/OpenFOAM-v2112/platforms/linux64GccDPInt32Opt/bin/potentialFoam
#6 __libc_start_main in ~/src/OpenFOAM-v2112/platforms/linux64GccDPInt32Opt/bin/potentialFoam
[OPTIPLEX:00691] *** Process received signal ***
[OPTIPLEX:00691] Signal: Aborted (6)
[OPTIPLEX:00691] Signal code: (-6)
[OPTIPLEX:00691] [ 0] /lib/x86_64-linux-gnu/libpthread.so.0(+0x143c0)[0x7f82150b83c0]
[OPTIPLEX:00691] [ 1] /lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcb)[0x7f8214ef503b]
[OPTIPLEX:00691] [ 2] /lib/x86_64-linux-gnu/libc.so.6(abort+0x12b)[0x7f8214ed4859]
[OPTIPLEX:00691] [ 3] /home/zzzzz/src/OpenFOAM-v2112/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam5error10simpleExitEib+0x17a)[0x7f8215823d2a]
[OPTIPLEX:00691] [ 4] /home/zzzzz/src/OpenFOAM-v2112/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam5error7exitingEib+0x4a)[0x7f821582732a]
[OPTIPLEX:00691] [ 5] /home/zzzzz/src/OpenFOAM-v2112/platforms/linux64GccDPInt32Opt/lib/sys-openmpi/libPstream.so(_ZN4Foam8UPstream4initERiRPPcb+0x1ad9)[0x7f8214ea2dc9]
[OPTIPLEX:00691] [ 6] /home/zzzzz/src/OpenFOAM-v2112/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam7argListC1ERiRPPcbbb+0x7e2)[0x7f8215853f42]
[OPTIPLEX:00691] [ 7] potentialFoam(+0x31ed3)[0x56249e35aed3]
[OPTIPLEX:00691] [ 8] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7f8214ed60b3]
[OPTIPLEX:00691] [ 9] potentialFoam(+0x347ee)[0x56249e35d7ee]
[OPTIPLEX:00691] *** End of error message ***
in ~/src/OpenFOAM-v2112/platforms/linux64GccDPInt32Opt/bin/potentialFoam
#6 __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
===================================================================================
= BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
= PID 690 RUNNING AT OPTIPLEX
= EXIT CODE: 9
= CLEANING UP REMAINING PROCESSES
= YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
===================================================================================
YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Terminated (signal 15)
This typically refers to a problem with your application.
Please see the FAQ page for debugging suggestion
사용할 OpenMPI 변경
OpenMPI를 컴파일하여 사용해 보십시오.
OpenFOAM-v2112/etc/bashrc
--- OpenFOAM-v2112/etc/bashrc,orig 2021-12-21 03:57:43.000000000 +0900
+++ OpenFOAM-v2112/etc/bashrc 2022-03-14 21:55:31.189751600 +0900
@@ -95,7 +95,7 @@
# HPMPI | CRAY-MPICH | FJMPI | QSMPI | SGIMPI | INTELMPI | USERMPI
# Specify SYSTEMOPENMPI1, SYSTEMOPENMPI2 for internal tracking (if desired)
# Can also use INTELMPI-xyz etc and define your own wmake rule
-export WM_MPLIB=SYSTEMOPENMPI
+export WM_MPLIB=OPENMPI
#------------------------------------------------------------------------------
ThirdParty 다시 컴파일
$ source ~/src/OpenFOAM-v2112/etc/bashrc
$ cd ~/src/ThirdParty-v2112
$ ./Allwmake -j
SCOTCH에 오류가 있는 것 같습니다.SCOTCH 오류
make \
CC="/home/zzzzz/src/ThirdParty-v2112/platforms/linux64Gcc/openmpi-4.1.2/bin/mpicc" \
CFLAGS="-m64 -DOPENFOAM=2112 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -O3 -fPIC -fPIC -O3 -UCOMMON_FILE_COMPRESS -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_DETERMINISTIC -DSCOTCH_RENAME -DIDXSIZE64 -Drestrict=__restrict -DSCOTCH_PTSCOTCH" \
CCDFLAGS="-m64 -DOPENFOAM=2112 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -O3 -fPIC -fPIC -O3 -UCOMMON_FILE_COMPRESS -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_DETERMINISTIC -DSCOTCH_RENAME -DIDXSIZE64 -Drestrict=__restrict -DSCOTCH_PTSCOTCH" \
ptscotch.h \
ptscotchf.h \
libptscotch.so \
libptscotcherr.so \
libptscotcherrexit.so
make[2]: ディレクトリ '/home/zzzzz/src/ThirdParty-v2112/sources/scotch/scotch_6.1.0/src/libscotch' に入ります
/home/zzzzz/src/ThirdParty-v2112/platforms/linux64Gcc/openmpi-4.1.2/bin/mpicc -m64 -DOPENFOAM=2112 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -O3 -fPIC -fPIC -O3 -UCOMMON_FILE_COMPRESS -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_DETERMINISTIC -DSCOTCH_RENAME -DIDXSIZE64 -Drestrict=__restrict -DSCOTCH_PTSCOTCH -DSCOTCH_VERSION_NUM=6 -DSCOTCH_RELEASE_NUM=1 -DSCOTCH_PATCHLEVEL_NUM=0 dummysizes.c -o ptdummysizes -Xlinker --no-as-needed -m64 -lm -lrt
In file included from dummysizes.c:92:
common.h:123:21: fatal error: mpi.h: そのようなファイルやディレクトリはありません
123 | #include <mpi.h>
| ^~~~~~~
compilation terminated.
ThirdParty-v2112가 가입된 SCOTCH 버전은 6.1.0으로, 버전 7.0.1과 6.1.3이기 때문에 6.1.3을 사용한다.사용하는 SCOTCH의 버전을 변경하기 때문에 OpenFOAM-v2112/etc/config입니다.수정sh/scoth.
OpenFOAM-v2112/etc/config.sh/scotch
$ wget https://gitlab.inria.fr/scotch/scotch/-/archive/v6.1.3/scotch-v6.1.3.tar.gz
$ tar zxvf scotch-v6.1.3.tar.gz -C sources/scotch
$ mv sources/scotch/scotch-v6.1.3 sources/scotch/scotch_6.1.3
그리고 다시 컴파일합니다.--- OpenFOAM-v2112/etc/config.sh/scotch,orig 2021-12-21 03:57:43.000000000 +0900
+++ OpenFOAM-v2112/etc/config.sh/scotch 2022-03-14 23:09:30.169751600 +0900
@@ -33,7 +33,7 @@
#------------------------------------------------------------------------------
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
-SCOTCH_VERSION=scotch_6.1.0
+SCOTCH_VERSION=scotch_6.1.3
export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$SCOTCH_VERSION
# END OF (NORMAL) USER EDITABLE PART
다시 OpenFOAM 컴파일
ThirdParty 컴파일링이 완료되면 OpenFOAM을 다시 컴파일합니다.
$ ./Allwmake -j
Cfdof를 통해 동작 확인
이번에는 순조롭게 병렬 계산을 했다!
Reference
이 문제에 관하여(OpenCFD 컴파일), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://zenn.dev/yoshikz/articles/47ea1a65d68b43텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)