Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing the rate in Python does not change the forward rate constant calculation #394

Closed
bryanwweber opened this issue Nov 16, 2016 · 1 comment

Comments

@bryanwweber
Copy link
Member

Using 7d3ebdd (from the conda package) on Linux (Ubuntu 16.04), replacing the reaction rate parameters of a reaction does not affect the calculation of the forward rate constants.

import cantera as ct
cti_str = """
units(length='cm', time='s', quantity='mol', act_energy='cal/mol')
ideal_gas(
    name='gas',
    elements='C',
    species='A B',
    reactions='all',
    initial_state=state(temperature=300.0, pressure=OneAtm)
)

species(
    name='A',
    atoms='C:12',
    thermo=(
        NASA(
            [300.00, 1000.00],
            [2.08692170E+00,  1.33149650E-01, -8.11574520E-05,
             2.94092860E-08, -6.51952130E-12, -3.59128140E+04,
             2.73552890E+01]
        ),
        NASA(
            [1000.00, 5000.00],
            [2.48802010E+01,  7.82500480E-02, -3.15509730E-05,
             5.78789000E-09, -3.98279680E-13, -4.31106840E+04,
             -9.36552550E+01]
        )
    ),
)

species(
    name='B',
    atoms='C:12',
    thermo=(
        NASA(
            [300.00, 1000.00],
            [2.08692170E+00,  1.33149650E-01, -8.11574520E-05,
             2.94092860E-08, -6.51952130E-12, -3.59128140E+04,
             2.73552890E+01]
        ),
        NASA(
            [1000.00, 5000.00],
            [2.48802010E+01,  7.82500480E-02, -3.15509730E-05,
             5.78789000E-09, -3.98279680E-13, -4.31106840E+04,
             -9.36552550E+01]
        )
    ),
)

reaction(
    equation='A => B',
    kf=Arrhenius(A=52499925000.0, b=1.5, E=40900.0),
)
"""
gas = ct.Solution(source=cti_str)
gas.TP = 1000, 101325
print(gas.reactions()[0].rate(1000))
print(gas.forward_rate_constants)

gas.reactions()[0].rate = ct.Arrhenius(A=4.8765e+69, b=0.0e+00, E=5.0E+04)
print(gas.reactions()[0].rate(1000))
print(gas.forward_rate_constants)

which has the output

1912707.2378390601
[ 1912707.23783906]
4.847262590622456e+69
[ 1912707.23783906]

Is there another function I have to call to inform the Solution about the updated rate?

@speth
Copy link
Member

speth commented Nov 17, 2016

Yes, you need to call Kinetics.modify_reaction. I think we are currently missing and example that utilizes this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants