Genray完全安裝手冊
Genray是一個通用的射線追蹤程序,一般用於幾何光學近似下電磁波傳播和吸收的計算。
安裝步驟 (基於Ubuntu 18.04)
安裝Gfortran-9 和 Gcc-9 參考資料鏈接
sudo apt-add-repository "deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu bionic main"
# 對於不同版本的ubuntu上面一行中的bionic需要被替換
# Ubuntu 18.04 bionic
# Ubuntu 20.04 focal
# 其餘的版本名請自行百度
sudo apt -y install gfortran-9
sudo apt -y install gcc-9
構建gfortran和gcc的軟鏈接。
sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-7 7
sudo update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-9 9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9
沒有出現error,並使用gfortran -v 和 gcc -v 查看版本沒有問題即安裝成功。
安裝PGPLOT和 NETCDF4 參考資料鏈接
sudo apt -y install nco
sudo apt -y install netcdf-bin libnetcdff-dev pgplot5
sudo apt install python-netcdf4
sudo apt-get install ncview #用於查看.nc文件
構建並測試 參考資料鏈接
# 執行下列命令前需要先進入包含makefile_gfortran64 文件的文件夾
make -f makefile_gfortran64 clean
make -f makefile_gfortran64
ctest
測試Demo 參考資料鏈接
# 執行下列命令前需要先進入包含00_Genray_egression_Tests文件的文件夾
cd 00_Genray_egression_Tests
mkdir test-CMod-LH-edge
cd test-CMod-LH-edge
cp ../genray.in_CMod_LH_edge genray.in
cp ../g1060728011.01100 .
../../xgenray
上述Demo運行成功後會在test-CMod-LH-edge生成包含genray.nc、genray_one_ray_point.nc、plot.ps等一系列文件。
使用NCVIEW查看.nc文件 參考資料鏈接
ncview genray.nc
ncview genray_one_ray_point.nc
下圖是genray_one_ray_point.nc 的charge的示例:
Genray安裝完畢。
歡迎郵件至[email protected]與我交流討論~