一、WSL 安装 Ubuntu22.04
启用 WSL
打开 Microsoft Store,安装 Ubuntu22.04
设置源,更新
ref: https://linuxmirrors.cn/use/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| sudo -i
bash <(curl -sSL https://linuxmirrors.cn/main.sh)
sudo apt update sudo apt upgrade
|
- 安装 ZSH、oh-my-zsh
参考 zsh & oh-my-zsh 安装配置
1 2 3 4 5 6 7 8 9
| sudo apt install zsh sh -c "$(wget https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh -O -)"
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
source ~/.zshrc
|
二、编译安装 openmc
ref: https://docs.openmc.org/en/stable/quickinstall.html
- 参照 Manually Installing from Source, 安装编译所需的基础库
1
| sudo apt install g++ cmake libhdf5-dev libpng-dev
|
- 编译 build
1 2 3 4 5 6
| git clone --recurse-submodules https://github.com/openmc-dev/openmc.git cd openmc mkdir build && cd build cmake .. make sudo make install
|
- 创建虚拟环境,安装 openmc 库
1 2 3 4 5 6 7 8 9 10 11 12
| python3 -V sudo apt install python3-pip pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
sudo apt install python3-venv python3 -m venv ~/openmc-venv source ~/openmc-venv/bin/activate
python3 -m pip install .
|
- 下载材料数据集
1 2 3 4 5
| git clone https://github.com/openmc-dev/data openmc-dev_data
cd openmc-dev_data python3 convert_nndc71.py
|
把 cross_sections.xml
的路径加入环境变量,或直接在openmc程序中设置:
1 2 3 4 5 6 7
| config['cross_sections'] = "/home/xxxx/openmc-dev_data/nndc-b7.1-hdf5/cross_sections.xml"
import openmc openmc.config["cross_sections"] = "/home/bo/openmc_data/nndc-b7.1-hdf5/cross_sections.xml"
|