Welcome to MS Thermo’s documentation!
Installation
This package is available on Python Package Index.
Install with pip install ms_thermo
.
This is a small package from Cerfacs dedicated to multispecies thermodynamics operations. Some short command line tools come with the installtion of the package
Command line tools
tadia_table
: gives the final adiabatic temperature of a kerosene mixture. Inputs are the initial temperature, pressure and equivalence ratio.
>tadia_table 300 102000 0.7
The adiabatic flame temperature of a mix C10H22-air from tables is : 1904.29 K.
Species | Mass fraction
------------------------------
N2 | 0.732
fuel | 0.000
O2 | 0.067
CO2 | 0.143
H2O | 0.058
tadia_cantera
: same as previous, but using Cantera. (Require Cantera pre-installed). See our dedicated site for the original input and much mmore http://www.cerfacs.fr/cantera/.fresh_gas
: a no-brainer again, conversion from primitive vriables (T, P, phi) to conservative variables(rho, rhoE, rhoYk). The inputs are the mixture temperature, pressure and equivalence ratio.
>fresh_gas 300. 101325 0.
rho | 1.172 kg/m3
rhoE | 253179.098 J.kg/m3
rhoYk |
N2 | 0.899 mol.kg/m3
O2 | 0.273 mol.kg/m3
KERO | 0.000 mol.kg/m3
------------------------------
Yk |
N2 | 0.767 [-]
O2 | 0.233 [-]
KERO | 0.000 [-]
yk_from_phi
: a no-brainer conversion from equivalence ratio to mass fraction. Inputs are the equivalence ratio and the numbers of C and H atoms in your fuel.
>yk_from_phi 0.7 1 4
Species | Mass fraction
------------------------------
fuel | 0.078
N2 | 0.707
O2 | 0.215
Generic module
There is also the state
module, which allows to move from conservative to primitive variables and back. State consider a field of several locations, usually the nodes of a mesh.
In the followng example, we create a 10 points field at 600K, then change a part of the field to a different temperature.
import numpy as np
from ms_thermo import State
print("\nInitialize a 600K air mixture on 10 locations")
state = State(
temperature=600. * np.ones(10),
pressure=100000.* np.ones(10),
mass_fractions_dict={
'O2': 0.2325 * np.ones(10),
'N2': 0.7675 * np.ones(10)})
print(state)
print("\nSet half of the field to 1200K.")
state.temperature = [600., 600., 600., 600., 600., 1200., 1200., 1200., 1200., 1200.]
print(state)
Initialize a 600K air mixture on 10 locations
Current primitive state of the mixture
| Most Common | Min | Max
----------------------------------------------------
rho| 5.78297e-01 | 5.783e-01 | 5.783e-01
energy| 4.38546e+05 | 4.385e+05 | 4.385e+05
temperature| 6.00000e+02 | 6.000e+02 | 6.000e+02
pressure| 1.00000e+05 | 1.000e+05 | 1.000e+05
Y_O2| 2.32500e-01 | 2.325e-01 | 2.325e-01
Y_N2| 7.67500e-01 | 7.675e-01 | 7.675e-01
Set half of the field to 1200K.
Current primitive state of the mixture
| Most Common | Min | Max
----------------------------------------------------
rho| 2.89148e-01 | 2.891e-01 | 5.783e-01
energy| 4.38546e+05 | 4.385e+05 | 9.411e+05
temperature| 6.00000e+02 | 6.000e+02 | 1.200e+03
pressure| 1.00000e+05 | 1.000e+05 | 1.000e+05
Y_O2| 2.32500e-01 | 2.325e-01 | 2.325e-01
Y_N2| 7.67500e-01 | 7.675e-01 | 7.675e-01
Contributors
This Python package is currently being developped by the CERFACS team COOP, with a non exhaustive list of the main contributors as of June 2022: Antoine Dauptain, Aimad Er-Raiy, Matthieu Rossi, Théo Defontaine, Thibault Gioud, Thibault Duranton, Elsa Gullaud, Victor Xing
- ms_thermo package
- Subpackages
- Submodules
- ms_thermo.cli module
- ms_thermo.constants module
- ms_thermo.example_gasout module
- ms_thermo.flame_params module
- ms_thermo.fresh_gas module
- ms_thermo.gasout module
- ms_thermo.mixture_state module
- ms_thermo.species module
- ms_thermo.state module
- ms_thermo.tadia module
- ms_thermo.yk_from_phi module
- States in ms-thermo