MS热API
ms-thermo的Python项目详细描述
温女士
。这是CERFACS多品种反应性操作的最小程序包。在
它在pipy上可用, 文档位于readtthedocs,源代码在gitlab.com上镜像
安装
从Python包索引安装:
pip install ms_thermo
命令行工具
安装包后,您就可以通过命令ms_thermo
在终端中访问CLI:
tadia
命令
这将使用煤油表格返回燃烧气体的温度和质量分数。 表格是用CANTERA创建的。在
对于环境条件下的定量新鲜气体混合物,典型的用法是:
>ms_thermo tadia 300. 101325 1.
The adiabatic flame temperature of a mix C10H22-air from tables is : 2312.99 K.
Species | Mass fraction
------------------------------
N2 | 0.718
fuel | 0.000
O2 | -0.000
CO2 | 0.200
H2O | 0.082
hp-equil
命令
这将使用CANTERA.cti
文件返回燃烧气体的温度和质量分数。在
对于环境条件下的定量新鲜气体混合物,典型的用法是:
>ms_thermo hp_equil 300 101325 1 NC10H22 ../../Desktop/Luche1.cti
**** WARNING ****
For species C5H4O, discontinuity in cp/R detected at Tmid = 1000
Value computed using low-temperature polynomial: 22.0928
Value computed using high-temperature polynomial: 22.1544
The adiabatic flame temperature of a mix C10H22-air from cantera is : 2277.41 K.
Species | Mass fraction
------------------------------
CO | 0.014
CO2 | 0.172
H2O | 0.084
N2 | 0.718
NO | 0.003
O2 | 0.007
OH | 0.002
+ 82 others | 0.000
WARNING:如果您的虚拟环境中没有安装CERFACS的CANTERA,则此功能将不可用!!在
yk_from_phi
命令
这将根据燃料的化学成分和当量比返回新鲜气体的质量分数。在
典型用法是:
>ms_thermo yk-from-phi 0.5 10. 22.
Species | Mass fraction
------------------------------
fuel | 0.466
N2 | 0.410
O2 | 0.125
fresh_gas
命令
这是从原始变量p,T和phi(当量比)计算煤油/空气新鲜气体混合物的保守变量。在
典型用法是:
>ms_thermo fresh-gas 300 101325. 1.
rho | 1.232 kg/m3
rhoE | 266054.682 J.kg/m3
rhoYk |
N2 | 0.886 mol.kg/m3
O2 | 0.269 mol.kg/m3
KERO | 0.077 mol.kg/m3
gasout
命令
此命令是在ms thermo软件包上构建用于设置CFD计算的工具的示例。它可以对一个CFD场进行多次局部修改。 典型的输入文件是:
#This is the tentative input file of a python Gasout.# Enable YAML syntax highlighting in you IDE for the best experience.# input filesinst_solut:./solut_0003.sol.h5mesh:./solut_0003.mesh.h5inst_solut_output:./gasouted.sol.h5# list (each - block) of actions to takeactions:-type:directional_linear_maskdirection:"x"#direction x, y, or zmax_abcissa:0.11#If None, takes 70% of CAO sizemin_abcissa:0.1#If None, takes 30% of CAO sizenew_pressure:null#use null if you dont want to edit this fieldnew_temperature:2000.0# Temp in K.new_yk:null-type:spherical_tanh_maskcenter:[0.1,0.1,0]# center sphere. If None, takes CAO center.radius:0.01# radius sphere [m]. If None, takes from CAO sizedelta:0.05# transition thickness [m], If None, takes half radnew_pressure:nullnew_temperature:1600.new_yk:# dictionnary of species YkN2:0.8# order and competion does not matterO2:0.2# Sum MUST be 1!-type:fraction_z_maskspecfuel:KERO_LUCHE# Fuel spec nameatom_ref:C# reference atom for Z computationoxyd_mass_fracs:# Mixture oxidizer, for Z computation.O2:0.233# If None, takes AIRN2:0.767fuel_mass_fracs:None# Mixture fuel. dict of Yk.zmax:0.02# If None, takes the mix at the Higesh Yk fuelzmin:0.01new_pressure:103000.0# Pressure in Panew_temperature:nullnew_yk:null-type:fraction_z_mask# You can repeat several treatmentsspecfuel:KERO_LUCHEatom_ref:Coxyd_mass_fracs:O2:0.233N2:0.767fuel_mass_fracs:Nonezmax:0.05zmin:0.04new_pressure:103000.0
软件包使用
ms_thermo
也可以用于较大的脚本/包中。在
state
类
state类处理混合气体。在
此类的典型用法。下面的脚本创建新鲜气体的初始混合物,然后将字段的子集更改为热气。在
>>> import ms_thermo as ms
>>> case = ms.State()
>>> print(case)
Current primitive state of the mixture
| Most Common | Min | Max
----------------------------------------------------
rho| 1.17192e+00 | 1.172e+00 | 1.172e+00
energy| 2.16038e+05 | 2.160e+05 | 2.160e+05
temperature| 3.00000e+02 | 3.000e+02 | 3.000e+02
pressure| 1.01325e+05 | 1.013e+05 | 1.013e+05
Y_O2| 2.32500e-01 | 2.325e-01 | 2.325e-01
Y_N2| 7.67500e-01 | 7.675e-01 | 7.675e-01
>>> case.temperature = 1200
>>> print(case)
Current primitive state of the mixture
| Most Common | Min | Max
----------------------------------------------------
rho| 2.92980e-01 | 2.930e-01 | 2.930e-01
energy| 9.41143e+05 | 9.411e+05 | 9.411e+05
temperature| 1.20000e+03 | 1.200e+03 | 1.200e+03
pressure| 1.01325e+05 | 1.013e+05 | 1.013e+05
Y_O2| 2.32500e-01 | 2.325e-01 | 2.325e-01
Y_N2| 7.67500e-01 | 7.675e-01 | 7.675e-01
- 项目
标签: