Heat release rate of each reaction

1,132 views
Skip to first unread message

Inna G

unread,
Apr 8, 2016, 2:06:55 PM4/8/16
to Cantera Users' Group
Hi guys,

I am new to Cantera and I am using Python environment to predict ignition delay times and excitation times. I am currently trying to determine which reactions have the maximum contribution to total heat release for 0-D Ideal Gas Reactor at the time of maximum heat release. I calculated the maximum heat release using following formula heat_release_rate2[i]=(np.dot(gas.net_rates_of_progress, gas.delta_enthalpy) ) which gave me 3.114e+14 for the total volumetric heat release. However, when I am trying to calculate the heat release of each reaction it is giving a total volumetric heat release of 3.22. I am not sure where I am going wrong.. This is part of my code for calculating it:

q=np.zeros((710))
z=np.zeros((710))
w=np.zeros((710))
outfile = open('reaction.csv', 'wb')
csvfile = csv.writer( outfile )
csvfile.writerow(['Reaction', ' delta enthalpy [J/kmol]', 'net rates of progress [kmol/m^3/s]'])


for i in xrange(int(x1)):
        if heat_release_rate2[i]==h_max2:
                t_x=times2[i]

                II = [k for k, r2 in enumerate(gas.reactions())]
                for k in II:
                        q=gas.reaction(k).equation     
                        z=gas.delta_enthalpy[k]
                        w=gas.net_rates_of_progress[k]
                        csvfile.writerow([q, z, w])
                print (np.dot(gas.net_rates_of_progress[II], gas.delta_enthalpy[II]))       
                print (heat_release_rate2[i])
                print (t_x)
                print (h_max2)               
     
outfile.close()

Thanks,

Inna



Ray Speth

unread,
Apr 8, 2016, 2:32:43 PM4/8/16
to Cantera Users' Group
Inna,

You showed one method of calculating the heat release rate:

    np.dot(gas.net_rates_of_progress, gas.delta_enthalpy)

which is correct, but you did not explain the other method you are using. The only other straightforward method would be to sum over the species instead, by calculating:

    np.dot(gas.net_production_rates, gas.partial_molar_enthalpies)

These methods should give you the same answer to within a relative tolerance on the order of the working precision, around 1e-16. If you're still having trouble, it would help to show an example which is simplified but still complete.

Regards,
Ray

Inna

unread,
Apr 8, 2016, 3:11:01 PM4/8/16
to Cantera Users' Group
Hi Ray,

Thank you for your reply. I tried the second method you suggested and the problem still persists. I attached the simplified version of the code.

Thank you.

Regards,

Inna 
reaction_calculation.py

Ray Speth

unread,
Apr 8, 2016, 5:28:08 PM4/8/16
to Cantera Users' Group
Inna,

Thank you, that helps clarify the problem. The issue is that you never update the state of the Solution object (gas) in the second loop, so it just has whatever state that it did at the end of the reactor network integration (which presumably had reached a near-equilibrium state where the heat release rate is essentially zero). If you want to do calculations after the fact, you will need to also store the temperature, pressure, and mass fractions after each time step so that you can set the Solution object to that state later.

Regards,
Ray

Inna

unread,
Apr 9, 2016, 9:31:22 AM4/9/16
to Cantera Users' Group
Hi Ray,

Thank you very much for your help. I really appreciate it. I will try it next week and will let you know if I have any further issues.

Kind Regards,

Inna

JM7

unread,
Mar 26, 2023, 2:09:58 PM3/26/23
to Cantera Users' Group
Hi Inna, did you get or figure out how to get the heat release rate?, you mind to share the solution code.

Thank you

Reply all
Reply to author
Forward
0 new messages