Пример #1
0
                  get_H_kwargs={'units': 'kcal/mol'},
                  get_S_kwargs={'units': 'cal/mol/K'},
                  get_G_kwargs={'units': 'kcal/mol'})
f2.set_size_inches(6, 6)
f2.set_dpi(200)
plt.show()

# <a id='section_8_2'></a>

# ## 8.2. Fitting an empirical object to a StatMech object
# Empirical objects can be made directly using ``StatMech`` objects and the ``from_model`` method.

# In[10]:

H2_nasa = Nasa.from_model(name='H2',
                          T_low=200.,
                          T_high=3500.,
                          model=H2_statmech)

# Compare the statistical mechanical model to the empirical model
f3, ax3 = H2_nasa.plot_statmech_and_empirical(Cp_units='J/mol/K',
                                              H_units='kJ/mol',
                                              S_units='J/mol/K',
                                              G_units='kJ/mol')
f3.set_size_inches(6, 8)
f3.set_dpi(200)
plt.show()

# <a id='section_9'></a>

# # 9. Input/Output
# pMuTT has more IO functionality than below. See this page for [supported IO functions](https://vlachosgroup.github.io/pMuTT/io.html).
Пример #2
0
    def setUp(self):
        unittest.TestCase.setUp(self)
        self.Nasa_direct = Nasa(name='H2O',
                                elements={
                                    'H': 2,
                                    'O': 1
                                },
                                phase='g',
                                a_low=np.array([
                                    4.04618796E+00, -6.87238823E-04,
                                    2.79722240E-06, -1.42318006E-09,
                                    2.34551159E-13, -3.02826236E+04,
                                    -2.50036531E-01
                                ]),
                                a_high=np.array([
                                    2.41854323E+00, 3.35448922E-03,
                                    -9.66398101E-07, 1.34441829E-10,
                                    -7.18940063E-15, -2.97582484E+04,
                                    8.37839787E+00
                                ]),
                                T_low=100.,
                                T_mid=1610.97,
                                T_high=5000.)

        self.Nasa_direct_dict = {
            'class':
            "<class 'pmutt.empirical.nasa.Nasa'>",
            'name':
            'H2O',
            'elements': {
                'H': 2,
                'O': 1
            },
            'phase':
            'g',
            'a_low': [
                4.04618796E+00, -6.87238823E-04, 2.79722240E-06,
                -1.42318006E-09, 2.34551159E-13, -3.02826236E+04,
                -2.50036531E-01
            ],
            'a_high': [
                2.41854323E+00, 3.35448922E-03, -9.66398101E-07,
                1.34441829E-10, -7.18940063E-15, -2.97582484E+04,
                8.37839787E+00
            ],
            'T_low':
            100.,
            'T_mid':
            1610.97,
            'T_high':
            5000.,
            'notes':
            None,
            'model':
            None,
            'misc_models': [{
                'class': "<class 'pmutt.empirical.GasPressureAdj'>"
            }],
            'cat_site':
            None,
            'n_sites':
            None,
            'smiles':
            None,
            'type':
            'nasa'
        }

        self.Nasa_data = Nasa.from_data(
            name='H2O',
            elements={
                'H': 2,
                'O': 1
            },
            phase='g',
            T=np.array([
                500., 600., 700., 800., 900., 1000., 1100., 1200., 1300.,
                1400., 1500., 1600., 1700., 1800., 1900., 2000., 2100., 2200
            ]),
            CpoR=np.array([
                4.238636088, 4.363835667, 4.503924733, 4.654023202,
                4.809813915, 4.967542636, 5.124018051, 5.276611768,
                5.423258319, 5.56245516, 5.693262665, 5.815304137, 5.928750505,
                6.034087273, 6.131819121, 6.222433488, 6.306400563, 6.384173277
            ]),
            T_ref=500.,
            HoRT_ref=-56.49930957,
            SoR_ref=24.84583501)

        self.Nasa_statmech = Nasa.from_model(name='H2O',
                                             elements={
                                                 'H': 2,
                                                 'O': 1
                                             },
                                             phase='g',
                                             model=StatMech,
                                             trans_model=trans.FreeTrans,
                                             n_degrees=3,
                                             vib_model=vib.HarmonicVib,
                                             elec_model=elec.GroundStateElec,
                                             rot_model=rot.RigidRotor,
                                             potentialenergy=-14.2209,
                                             atoms=molecule('H2O'),
                                             symmetrynumber=2,
                                             spin=0,
                                             vib_wavenumbers=np.array(
                                                 [0.47462, 0.46033, 0.19633]),
                                             T_low=100.,
                                             T_mid=1610.97,
                                             T_high=5000.)
        self.mw = get_molecular_weight({'H': 2, 'O': 1})  # g/mol
Пример #3
0
# In[3]:

from pmutt.empirical.nasa import Nasa

# Lower and higher temperatures
T_low = 298.  # K
T_high = 800.  # K

species_data = read_excel(io=input_path, sheet_name='species')
species = []
species_phases = {}
for ind_species_data in species_data:
    # Initialize NASA from statistical mechanical data
    ind_species = Nasa.from_model(T_low=T_low,
                                  T_high=T_high,
                                  references=refs,
                                  **ind_species_data)
    species.append(ind_species)

    # Group the species by phase for later use
    try:
        species_phases[ind_species.phase].append(ind_species)
    except KeyError:
        species_phases[ind_species.phase] = [ind_species]

# ### Adding species from other empirical sources

# In[4]:

import numpy as np
from pmutt.empirical.shomate import Shomate
Пример #4
0
        'The "refs" sheet could not be found in {}. Skiping references'.format(
            input_path))
    refs = None
else:
    refs = [Reference(**ref_data) for ref_data in refs_data]
    refs = References(references=refs)

# ### Reading Species
#
# Third, we will use the ``refs`` defined before and the ``species`` sheet to convert statistical mechanical data to [``NASA``](https://vlachosgroup.github.io/pMuTT/api/empirical/nasa/pmutt.empirical.nasa.Nasa.html#pmutt.empirical.nasa.Nasa) objects.
# Read the species' data
species_data = read_excel(io=input_path, sheet_name='species')

# Create NASA polynomials from the species
species = [
    Nasa.from_model(references=refs, **ind_species_data)
    for ind_species_data in species_data
]

# ### Adding species from other empirical sources (optional)
#
# Note that OpenMKM also supports [``Shomate``](https://vlachosgroup.github.io/pMuTT/api/empirical/shomate/pmutt.empirical.shomate.Shomate.html#pmutt.empirical.shomate.Shomate) and [``NASA9``](https://vlachosgroup.github.io/pMuTT/api/empirical/nasa/pmutt.empirical.nasa.Nasa9.html) objects. Below, we define a single ``Shomate`` species.
Ar = Shomate(name='Ar',
             elements={'Ar': 1},
             phase='gas',
             T_low=298.,
             T_high=6000.,
             a=np.array([
                 20.78600, 2.825911e-7, -1.464191e-7, 1.092131e-8,
                 -3.661371e-8, -6.19735, 179.999, 0.
             ]))
Пример #5
0
# ### Reading species

# In[9]:


from pmutt.empirical.nasa import Nasa

# Range of data to fit the Nasa polynomials
T_low = 298. # K
T_high = 800. # K

species_data = read_excel(io=excel_path, sheet_name='species')
species = []
for specie_data in species_data:
    specie = Nasa.from_model(T_low=T_low, T_high=T_high, references=refs, **specie_data)
    # If the species is a surface species, assign the catalyst site specified above
    if specie.phase.lower() == 's':
        specie.cat_site = cat_site
        specie.n_sites = 1
    species.append(specie)


# The warning above is typical when empirical objects are fitting to `StatMech` objects with the `placeholder` preset.

# ### Reading reactions

# In[10]:


from pmutt import pmutt_list_to_dict
Пример #6
0
# ### NASA polynomial
# The [``NASA``][0] format is used for our microkinetic modeling software, Chemkin.
# 
# #### Initializing Nasa from StatMech
# Below, we initialize the NASA polynomial from the ``StatMech`` object we created earlier.
# 
# [0]: https://vlachosgroup.github.io/pmutt/empirical.html#nasa

# In[6]:


from pmutt.empirical.nasa import Nasa

butane_nasa = Nasa.from_model(name='butane',
                              model=butane_statmech,
                              T_low=298.,
                              T_high=800.,
                              elements={'C': 4, 'H': 10},
                              phase='G')

H_nasa = butane_nasa.get_H(T=298., units='kJ/mol')
S_nasa = butane_nasa.get_S(T=298., units='J/mol/K')
print('H_butane(T=298) = {:.1f} kJ/mol'.format(H_nasa))
print('S_butane(T=298) = {:.2f} J/mol/K'.format(S_nasa))


# Although it is not covered here, you can also generate empirical objects from experimental data using the ``.from_data`` method. See [Experimental to Empirical][6] example.
# 
# [6]: https://vlachosgroup.github.io/pmutt/examples.html#experimental-to-empirical

# #### Initializing Nasa Directly
# We can also initialize the NASA polynomial if we have the polynomials. Using an entry from the [Reaction Mechanism Generator (RMG) database][0].