我自己在学习辐射计算的时候走了好多弯路,最近发现一个开源的基于逐线法的辐射计算代码(GitHub - radis/radis: 🌱 A fast line-by-line code for high-resolution infrared molecular spectra)简直是发现了宝藏。我想找一下关于RADIS的中文教程,发现竟然没有。所以我非常想和大家分享一下这个代码。
RADIS目前可以计算CO2和CO的非平衡辐射,以及所有可以从HITRAN类数据库下载的粒子的平衡辐射。除了可以计算单温度、多温度的玻尔兹曼分布,还可以计算Treanor分布(我不是学物理化学的,不了解这是什么分布),以及任意分布。
一.安装radis
pip install radis
二.计算平衡辐射
以CO为例,计算温度700K,一标准大气压,路径长度1cm,同位素种类1,2,3的平衡辐射,数据库选择HITRAN。
from radis import calc_spectrum
s = calc_spectrum(1900, 2300, # cm-1
molecule='CO',
isotope='1,2,3',
pressure=1.01325, # bar
Tgas=700, # K
mole_fraction=0.1,
path_length=1, # cm
databank='hitran', # or use 'hitemp'
)
s.apply_slit(0.5, 'nm') # simulate an experimental slit
s.plot('radiance')
结果:
三.计算非平衡辐射
同样以CO为例,振动温度700K,转动温度300K,其他设置同上。
from astropy import units as u
s2 = calc_spectrum(1900 / u.cm, 2300 / u.cm,
molecule='CO',
isotope='1,2,3',
pressure=1.01325 * u.bar,
Tvib=700 * u.K,
Trot=300 * u.K,
mole_fraction=0.1,
path_length=1 * u.cm,
databank='hitran', # or use 'hitemp'
)
s2.apply_slit(0.5, 'nm')
s2.plot('radiance', nfig='same') # compare with previous
结果:
两个做一下对比:
最后希望多和大家交流,一个人学很容易走弯路!
参考文献:
[1] Pannier E , Laux C O . RADIS: A nonequilibrium line-by-line radiative code for CO2 and HITRAN-like database species[J]. Journal of Quantitative Spectroscopy and Radiative Transfer, 2018, 222.