What is Canoe?

Canoe is an light-weighted extension of an astrophysical code Athena++ to enable atmospheric simulations. We utilize the static/adaptive mesh-refinement, parallelization, curvilinear geometry, and dynamic task scheduling innate to the Athena++ code and augment it with a multi-fluid hydrodynamic solver that is specially designed for atmospheric flows involving condensible gases, clouds, hazes and precipitation. The purpose of the model is to fascilitate fundamental atmospheric research while maintaining a certain degree of sophistication and reality to explain the real world observation and phenomena.

环境准备

本安装环境是RedHat商用系统,如果你用的是其他linux系统,请尝试做对应的依赖库的替换,请参考Canoe仓库的readme文件。

GitHub仓库拉取源码,安装依赖。

bash
> git clone https://github.com/chengcli/canoe
> sudo yum -y install $(cat packages_centos.txt) ## 安装必要的依赖

根据版本不同,如果package文件中没有包括mpich,就需要手动下载

bash
> sudo yum install mpich-devel  ## 安装 MPICH,支持并行
> vim ~/bash_profile # 添加如下内容
#/home/jiehnghu/.bash_profile
export PATH=$PATH:/usr/lib64/mpich/bin
> source ~/.bash_profile ## 执行生效

科学格式读写相关依赖库

安装支持NETCDF格式IO的库

bash
> cd external/
> ./fetch_pnetcdf.sh
> ./install_pnetcdf.sh

安装FITS格式IO库

bash
> sudo yum install cfitsio-devel

安装后期处理的python和相关库

安装python3.9,虚拟环境和开机默认进入

bash
> cd
> sudo yum install python39
> python3.9 -m venv env ## 创建虚拟环境env
> source env/bin/activate ## 进入env
(env)> echo 'source /home/jihenghu/env/bin/activate'>> ~/.bash_profile ## 追加到开机执行

安装requirements文件中的依赖:

bash
(env)> cd canoe/
(env)> pip3 install -r requirements.txt
# Astropy
# Black
# Cmakelang
# Cpplint
# Netcdf4
# Numpy
# pre-commit
# Tqdm

安装格式检查:

bash
(env)> pre-commit install

这样,canoe编译和运行,后期处理相关的环境就准备好了。

项目编译

Canoe源码已经内置了一些构建好的项目,可以直接编译和运行:
``内列举了这些内置项目的名称,这些项目的源码位于canoe/examples/路径下。
你可以使用如下命令尽心项目的编译、安装和运行:
例如,对于straka项目:

bash
(env)> cd ; mkdir -p strakaProj/build
(env)> cd strakeProj/build/
(env)> cmake ~/canoe -DTASK=straka ## 编译
(env)> make -j8 ## 安装

运行

bash
cd ..
(env)> ln -s build/bin/straka.release .
(env)> ln -s build/bin/combine.py .
(env)> cp build/bin/straka.inp . ## 输入的namelist
(env)> ./straka.release -i straka.inp ## 运行
(env)> python combine.py -o test ## 合并输出文件

参考