Skip to content

Commit

Permalink
[Python] Disable warnings for extinct flame
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
g3bk47 authored and speth committed Jul 15, 2022
1 parent 89f2c7c commit a2af8fe
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions interfaces/cython/cantera/onedim.py
Expand Up @@ -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"""
Expand Down

0 comments on commit a2af8fe

Please sign in to comment.