Repository navigation
Equation/Data Format in YML File
New Feature: Equation/Data Format in YML File
Description:
Added support for defining thermodynamic equations in YML files, allowing flexible customization and integration with custom thermodynamic databases.
Details:
- EQUATIONS:
Vapor-Pressure:
TABLE-ID: 3
DESCRIPTION:
This table provides the vapor pressure (P) in Pa as a function of temperature (T) in K.
EQUATIONS:
EQ-1:
BODY:
- parms['C1 | C1 | 1'] = parms['C1 | C1 | 1']/1
- parms['C2 | C2 | 1'] = parms['C2 | C2 | 1']/1
- parms['C3 | C3 | 1'] = parms['C3 | C3 | 1']/1
- parms['C4 | C4 | 1'] = parms['C4 | C4 | 1']/1
- parms['C5 | C5 | 1'] = parms['C5 | C5 | 1']/1
- res['vapor-pressure | VaPr | Pa'] = math.exp(parms['C1 | C1 | 1'] + parms['C2 | C2 | 1']/args['temperature | T | K'] + parms['C3 | C3 | 1']*math.log(args['temperature | T | K']) + parms['C4 | C4 | 1']*(args['temperature | T | K']**parms['C5 | C5 | 1']))
BODY-INTEGRAL:
None
BODY-FIRST-DERIVATIVE:
None
BODY-SECOND-DERIVATIVE:
None - PARAMETERS, ARGS, AND RETURN:
- Defined as
[name of parameter | symbol | unit]
- Defined as
STRUCTURE:
COLUMNS: [No.,Name,Formula,State,C1,C2,C3,C4,C5,Tmin,P(Tmin),Tmax,P(Tmax),Eq]
SYMBOL: [None,None,None,None,C1,C2,C3,C4,C5,Tmin,P(Tmin),Tmax,P(Tmax),VaPr]
UNIT: [None,None,None,None,1,1,1,1,1,K,Pa,K,Pa,Pa]
VALUES:
- [1,'carbon dioxide','CO2','g',140.54,-4735,-21.268,4.09E-02,1,216.58,5.19E+05,304.21,7.39E+06,1]- DATA:
General-Data:
TABLE-ID: 2
DESCRIPTION:
This table provides the general data of different chemical species participating in the CO2 hydrogenation reaction and includes molecular weight (MW) in g/mol, critical temperature (Tc) in K, critical pressure (Pc) in MPa, and critical molar volume (Vc) in m3/kmol. The table also includes the critical compressibility factor (Zc), acentric factor (AcFa), enthalpy of formation (EnFo) in kJ/mol, and Gibbs energy of formation (GiEnFo) in kJ/mol. The chemical state of the species is also provided in the table and hence the enthalpy of formation and Gibbs energy of formation are provided for the ideal gas and liquid state are designated as EnFo_IG, GiEnFo_IG, EnFo_LIQ, and GiEnFo_LIQ, respectively.
DATA:
COLUMNS:
- No.
- Name
- Formula
- State
- molecular-weight
- critical-temperature
- critical-pressure
- critical-molar-volume
- critical-compressibility-factor
- acentric-factor
- enthalpy-of-formation
- gibbs-energy-of-formation
SYMBOL:
- None
- None
- None
- None
- MW
- Tc
- Pc
- Vc
- Zc
- AcFa
- EnFo
- GiEnFo
UNIT:
- None
- None
- None
- None
- g/mol
- K
- MPa
- m3/kmol
- None
- None
- kJ/mol
- kJ/mol
CONVERSION:
- None
- None
- None
- None
- 1
- 1
- 1
- 1
- 1
- 1
- 1
- 1
VALUES:
- [1,'carbon dioxide','CO2','g',44.01,304.21,7.383,0.094,0.274,0.2236,-393.5,-394.4]
- [2,'carbon monoxide','CO','g',28.01,132.92,3.499,0.0944,0.299,0.0482,-110.5,-137.2]
- [3,'hydrogen','H2','g',2.016,33.19,1.313,0.064147,0.305,-0.216,0,0]
- [4,'methanol','CH3OH','g',32.04,512.5,8.084,0.117,0.222,0.5658,-200.7,-162]
- [5,'water','H2O','g',18.01,647.096,22.064,0.0559472,0.229,0.3449,-241.8,-228.6]
- [6,'acetylene','C2H2','g',26.037,308.3,6.138,0.112,0.268,0.1912,227.5,210.0]
- [7,'ethanol','C2H6O','l',46.068,514,6.137,0.168,0.241,0.6436,-277.70,-174.80]
- [8,'n-butane','C4H10','g',58.122,425.12,3.796,0.255,0.274,0.2002,-125.80,-16.60]
- [9,'methane','CH4','g',16.042,190.564,4.599,0.0986,0.286,0.0115,-74.50,-50.50]
- [10,'propane','C3H8','g',44.096,369.83,4.248,0.2,0.276,0.1523,-104.70,-24.30]
- [11,'1-butene','C4H8','g',56.106,419.5,4.02,0.241,0.278,0.1845,1.20,70.30]
- [12,"1,3-Butadiene",'C4H6','g',54.090,425,4.32,0.221,0.27,0.1950,109.20,149.80]
- [13,'ethylene','C2H4','g',28.053,282.34,5.041,0.131,0.281,0.0862,52.50,68.50]
- [14,'benzene','C6H6','l',78.112,562.05,4.895,0.256,0.268,0.2103,-49.10,124.5]
- [15,'nitrogen','N2','g',28.013,126.2,3.4,0.08921,0.289,0.0377,0,0]
- [16,'ethane','C2H6','g',30.069,305.32,4.872,0.1455,0.279,0.0995,-83.8,-31.9]Initialization:
# files
yml_file = 'tests\\source-ref-4.yml'
yml_path = os.path.join(os.getcwd(), yml_file)
# custom ref
ref = {'reference': [yml_path]}
# Initialization of Own Thermo DB
thermo_db = ptdb.init(custom_reference=ref)