From 6b5b8e77357f71dfab71ed1079976679db3a94c5 Mon Sep 17 00:00:00 2001 From: Thomas Fiala Date: Mon, 16 Feb 2015 17:24:34 +0000 Subject: [PATCH] [1D] Add convenience functions for heat release rate --- interfaces/cython/cantera/onedim.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/interfaces/cython/cantera/onedim.py b/interfaces/cython/cantera/onedim.py index 6acc5e7a0..b6c19fd31 100644 --- a/interfaces/cython/cantera/onedim.py +++ b/interfaces/cython/cantera/onedim.py @@ -180,6 +180,26 @@ class FlameBase(Sim1D): for k in range(k0, k0 + self.gas.n_species)] self.gas.TPY = self.value(self.flame, 'T', point), self.P, Y + @property + def heat_release_rate(self): + """ + Get the total volumetric heat release rate [W/m^3]. + """ + return - np.sum(self.partial_molar_enthalpies * + self.net_production_rates, 0) + + @property + def heat_production_rates(self): + """ + Get the volumetric heat production rates [W/m^3] on a per-reaction + basis. The sum over all reactions results in the total volumetric heat + release rate. + Example: C. K. Law: Combustion Physics (2006), Fig. 7.8.6 + + >>> f.heat_production_rates[2] # heat production rate of the 2nd reaction + """ + return - self.net_rates_of_progress * self.delta_standard_enthalpy + def write_csv(self, filename, species='X', quiet=True): """ Write the velocity, temperature, density, and species profiles