# OpenFOAM-v1912 설치 소개 (SKL)

OpenFOAM(Open Field Operation and Manipulation)은 주로 유체역학(CFD) 시뮬레이션에서 사용되는 오픈소스 시뮬레이션 소프트웨어입니다. 유체 흐름, 열전달, 화학 반응, 고체역학, 전자기장 등 다양한 물리적 현상을 시뮬레이션 할 수 있고, C++ 언어로 개발되어 사용자 정의가 용이하고 확장성이 높으며 병렬 계산을 지원해 대규모 시뮬레이션도 효율적으로 처리할 수 있는 프로그램 입니다.

이 문서에서는 KISTI 슈퍼컴퓨팅센터의 뉴론 시스템에 OpenFOAM-v1912 Source 버전으로 설치 하는 방법에 대하여 소개 드립니다.

## **가. 설치 환경**

| 구분         | 내용                         |
| ---------- | -------------------------- |
| 대상 시스템     | 뉴론                         |
| OS Version | 리눅스 / CentOS 7.4           |
| CPU        | Intel(R) Xeon(R) Gold 6140 |
| 컴파일러       | Intel 2018.2               |
| MPI        | IntelMPI 2018.2            |
| 기타         |                            |

## **나. 설치 전 환경 설정**

OpenFOAM-v1912 버전 설치에 필요한 gmp, mpfr, mpc, boost, CGAL 는 뉴론 시스템에 미리 설치된 /apps/common 라이브러리들을 사용합니다.\
만약 다른 버전의 gmp, mpfr, mpc, boost, CGAL 가 필요한 경우는 사용자의 홈 디렉토리(/home01/$USER)에 설치 후 환경설정을 해서 사용하시면 됩니다.

\[환경 설정]

```shell-session
$ module load cmake/3.12.3
$ module load intel/18.0.2 impi/18.0.2
```

## **다. OpenFOAM-v1912 버전 설치 과정**

설치 과정 소개는 tar 를 이용한 압축 해제 방법과 설정 방법등 진행 절차를 위주로 설명하고,\
소스 파일 다운로드 등은 생략합니다. 설치 소개 시 사용된 경로 <mark style="color:blue;">**/scratch/${USER}**</mark> 는 설치 안내를 위한\
경로 이므로 실제 사용되는 경로를 사용합니다.

\[설치과정]

```shell-session
$ cd /scratch/${USER}
$ mkdir OpenFOAM
$ cd OpenFOAM

$ tar -xzvf OpenFOAM-v1912.tgz
$ tar -xzvf ThirdParty-v1912.tgz

$ sed -i -e 's/\(boost_version=\)boost_1_64_0/\1boost-system/' OpenFOAM-v1912/etc/config.sh/CGAL
$ sed -i -e 's/\(cgal_version=\)CGAL-4.9.1/\1cgal-system/' OpenFOAM-v1912/etc/config.sh/CGAL

$ vi OpenFOAM-v1912/etc/bashrc 
 - - - [bashrc 수정 사항] 참고 - - -

$ mkdir -p OpenFOAM-v1912/platforms/linux64IccDPInt64Opt/bin  #해당 디렉터리 생성해야 bashrc 설정 적용 가능
$ source OpenFOAM-v1912/etc/bashrc

$ mkdir -p $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER
$ ln -s /apps/common/gmp/6.1.2 $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/gmp-system
$ ln -s /apps/common/mpfr/4.0.1 $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/mpfr-system
$ ln -s /apps/common/mpc/1.1.0 $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/mpc-system
$ ln -s /apps/common/boost/1.68.0 $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/boost-system
$ ln -s /apps/common/CGAL/4.9.1 $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cgal-system
$ ln -s /apps/applications/cmake/3.12.3 $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake-system

$ cd $WM_PROJECT_DIR
$ ./Allwmake
```

\[bashrc 수정 사항]

```
 61line : export WM_COMPILER=Icc
 69line : export WM_LABEL_SIZE=64
 80line : export WM_MPLIB=INTELMPI
```

## **라. 테스트**

```shell-session
$ module load intel/18.0.2 impi/18.0.2
$ source /scratch/${USER}/OpenFOAM/OpenFOAM-v1912/etc/bashrc 

$ mkdir -p $FOAM_RUN 
$ run 
$ cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily .
$ cd pitzDaily 
$ blockMesh 
$ simpleFoam 
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-ksc.gitbook.io/blog/install/neuron/openfoam-v1912-install-skl.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
