# How to use ORCHIDEE in off-line mode with IPSL LibIGCM (2023/02/13)(Yi-Ying Chen, RCEC)
## 資源
[User Guide to ORCHIDEE](https://forge.ipsl.jussieu.fr/orchidee/wiki/Documentation/UserGuide)
[FERRET TIPS](https://docs.google.com/document/d/1XTgCf6pUy0YQuKt1lK0ExNHnGv3Ibn7tyrTfudfldaw/edit)
## MobaXterm Settings
### OpenGL acceleration: **Hardware**

### Add Session for SSH connection to Taiwainia3 (203.145.216.51)

## Testing the plot
```
$R
>data(volcano)
>image(volcano)
>q()
```
## Login server, computational server
- NCHC server Taiwania3
Domain name: twnia3.nchc.org.tw
Account: xxxx
Passwd: xxxx
MOTP: xxxx (可用Google Authenticator)

- [Slurm 指令](https://man.twcc.ai/@TWCC-III-manual/rysztb9id#Slurm-%E6%8C%87%E4%BB%A4)
## Environment setting
1. In the server Taiwania3, there are several compilers that can be loaded by using “module load *module_name*“
Please type `module list` to show the current loaded modules

2. initial bash setting via the ~/.bashrc file

## Copy the ORCHIDEE to your home directory
```
$mkdir MODEL_IPSL
$cp /home/u9197633/MODEL_IPSL/ORC_4262_copy ~/MODEL_IPSL/ -rf
$du -h --max-depth=1
```

- change the foler name from “ORC_4262_copy” to “ORC_4262”
`$ mv ORC_4262_copy ORC_4262` (mv可改檔名)
## Step by Step configuration, compile the code, and submit jobs
1. Copy ORCHIDEE
`$cp /home/u9197633/MODEL_IPSL/ORC_4262_copy/ /home/u1234567/MODEL_IPSL/. -rf`
2. Modify the local path in libIGCM library
- /home/u1234567/MODEL_IPSL/ORC_4262/libIGCM/libIGCM_sys
`$vim libIGCM_sys_default.ksh`
`export PATH=${PATH}:/chia_cluster/home/${LOGIN}/ORC_4262/bin/`
3. Create make files in TWNIA3 server
- /chia_cluster/home/ User/ORC_4262/util
`$ ./ins_make -t t3`
4. Compile the code
```
cd /home/u1234567/MODEL_IPSL/ORC_4262/config/ORCHIDEE_OL
$ gmake clean
$ gmake without_xios
```
5. Submit a job
```
$ vim clean.sh #modify the job path
$ sbatch Job_test.run.tw
$ squeue | grep "u1234567"
```
## 查看資料輸出結果
### 輸出路徑(Carbon)
```
$ cd /work/u2936446/IGCM_OUT/OL2/TEST/secsto/test.run.tw/SBG/Output/MO/
$ ls
ferret.jnl ferret.jnl.~3~ test.run.tw_20190101_20191231_1M_stomate_history.nc test.run.tw_20220101_20221231_1M_stomate_history.nc
ferret.jnl.~1~ ferret.jnl.~4~ test.run.tw_20200101_20201231_1M_stomate_history.nc test.run.tw_20230101_20231231_1M_stomate_history.nc
ferret.jnl.~2~ test.run.tw_20180101_20181231_1M_stomate_history.nc test.run.tw_20210101_20211231_1M_stomate_history.nc
```
## Ferret繪圖
### 進入ferret
`$ ferret`

### use {data}

### show data

### 畫圖
`shade HEIGHT[K=2, L=1]`

### 存檔
`frame /files=test1.gif`
### 離開
`q`
## 呈現
- 取回local端後可用如[FastStone](https://www.faststone.org/)轉檔為jpg格式
