From a2af8fe63425a02d7d2f02006ff25f80eee15f74 Mon Sep 17 00:00:00 2001 From: ThorstenZirwes Date: Wed, 13 Jul 2022 19:38:04 -0700 Subject: [PATCH] [Python] Disable warnings for extinct flame Currently, each counterflow flame solution that is extinct will print a warning that the flame is too thick. Since the temperature checks for flame thickness and width do not make sense for an extinct flame, disable the warnings in that case. --- interfaces/cython/cantera/onedim.py | 44 ++++++++++++++--------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/interfaces/cython/cantera/onedim.py b/interfaces/cython/cantera/onedim.py index b721a62e28..fdded21d8c 100644 --- a/interfaces/cython/cantera/onedim.py +++ b/interfaces/cython/cantera/onedim.py @@ -1280,28 +1280,28 @@ def solve(self, loglevel=1, refine_grid=True, auto=False): if loglevel > 0: if self.extinct(): print('WARNING: Flame is extinct.') - - # Check if the flame is very thick - # crude width estimate based on temperature - z_flame = self.grid[self.T > np.max(self.T) / 2] - flame_width = z_flame[-1] - z_flame[0] - domain_width = self.grid[-1] - self.grid[0] - if flame_width / domain_width > 0.4: - print('WARNING: The flame is thick compared to the domain ' - 'size. The flame might be affected by the plug-flow ' - 'boundary conditions. Consider increasing the inlet mass ' - 'fluxes or using a larger domain.') - - # Check if the temperature peak is close to a boundary - z_center = (self.grid[np.argmax(self.T)] - self.grid[0]) / domain_width - if z_center < 0.25: - print('WARNING: The flame temperature peak is close to the ' - 'fuel inlet. Consider increasing the ratio of the ' - 'fuel inlet mass flux to the oxidizer inlet mass flux.') - if z_center > 0.75: - print('WARNING: The flame temperature peak is close to the ' - 'oxidizer inlet. Consider increasing the ratio of the ' - 'oxidizer inlet mass flux to the fuel inlet mass flux.') + else: + # Check if the flame is very thick + # crude width estimate based on temperature + z_flame = self.grid[self.T > np.max(self.T) / 2] + flame_width = z_flame[-1] - z_flame[0] + domain_width = self.grid[-1] - self.grid[0] + if flame_width / domain_width > 0.4: + print('WARNING: The flame is thick compared to the domain ' + 'size. The flame might be affected by the plug-flow ' + 'boundary conditions. Consider increasing the inlet mass ' + 'fluxes or using a larger domain.') + + # Check if the temperature peak is close to a boundary + z_center = (self.grid[np.argmax(self.T)] - self.grid[0]) / domain_width + if z_center < 0.25: + print('WARNING: The flame temperature peak is close to the ' + 'fuel inlet. Consider increasing the ratio of the ' + 'fuel inlet mass flux to the oxidizer inlet mass flux.') + if z_center > 0.75: + print('WARNING: The flame temperature peak is close to the ' + 'oxidizer inlet. Consider increasing the ratio of the ' + 'oxidizer inlet mass flux to the fuel inlet mass flux.') def strain_rate(self, definition, fuel=None, oxidizer='O2', stoich=None): r"""