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

Broken diffusion_flame_extinction.py example #872

Closed
ischoegl opened this issue Jun 19, 2020 · 3 comments
Closed

Broken diffusion_flame_extinction.py example #872

ischoegl opened this issue Jun 19, 2020 · 3 comments

Comments

@ischoegl
Copy link
Member

ischoegl commented Jun 19, 2020

System information

  • Cantera version: current development branch
  • OS: Ubuntu 18.04
  • Python/MATLAB version: 3.6.9

Expected behavior

diffusion_flame_extinction.py terminates and produces plot.

Actual behavior

diffusion_flame_extinction.py appears to be stuck in indefinite loop.

To Reproduce

Steps to reproduce the behavior:

  1. Run python
  2. After the temperature drops below temperature_limit_extinction, the loop gets stuck:
Flame extinguished at n = 284. Restoring n = 283 with alpha = 284.0
Flame extinguished at n = 285. Restoring n = 283 with alpha = 284.0
Flame extinguished at n = 286. Restoring n = 283 with alpha = 284.0
Flame extinguished at n = 287. Restoring n = 283 with alpha = 284.0
Flame extinguished at n = 288. Restoring n = 283 with alpha = 284.0
Flame extinguished at n = 289. Restoring n = 283 with alpha = 284.0
Flame extinguished at n = 290. Restoring n = 283 with alpha = 284.0
Flame extinguished at n = 291. Restoring n = 283 with alpha = 284.0
Flame extinguished at n = 292. Restoring n = 283 with alpha = 284.0
Flame extinguished at n = 293. Restoring n = 283 with alpha = 284.0
Flame extinguished at n = 294. Restoring n = 283 with alpha = 284.0
Flame extinguished at n = 295. Restoring n = 283 with alpha = 284.0
Flame extinguished at n = 296. Restoring n = 283 with alpha = 284.0
Flame extinguished at n = 297. Restoring n = 283 with alpha = 284.0
Flame extinguished at n = 298. Restoring n = 283 with alpha = 284.0
[...]
  1. The above keeps running beyond n = 2000

Additional Context:

Issue was found in the context of #871.

PS: It is relatively straight-forward to ensure that the loop exits, but there appear to be some issues with the implementation of the termination criterion itself.

@bryanwweber
Copy link
Member

Thanks for reporting this! Can you locate when this problem started happening? Is it a problem for the 2.4.0 release?

@ischoegl
Copy link
Member Author

@bryanwweber ... example works on 2.4.

@ischoegl
Copy link
Member Author

Recent commits appear to have resolved the issue - I no longer can reproduce it.

@bryanwweber bryanwweber mentioned this issue Jul 30, 2020
4 tasks
bryanwweber added a commit to bryanwweber/cantera that referenced this issue Jul 30, 2020
This change reworks the abortion criteria for the diffusion flame
extinction example. Previously, the loop was only aborted when the flame
temperature was above the inlet temperature, the difference of the flame
temperature in the prior two iterations was less than the threshold, AND
the change in strain rate parameter was less than the threshold.
However, I found that this combination of conditions was never reached,
because the only way to change the strain rate delta was to have an
extinguished flame, and eventually the flame remains extinguished even
if the delta_alpha is reduced. This leads to an infinite loop, since the
abortion criteria check are only done if the flame is burning. This
change moves the abortion criteria check into the case where the flame
is not burning.

In addition, the flame temperature check is modified to use
np.isclose(). I found that on the last burning iteration, the maximum
flame temperature was only just barely above the oxidizer inlet
temperature. Thus, the result printed to the screen was not very useful.
The change to np.isclose() produces a more useful result for the final
burning iteration before extinction. The last non-burning iteration is
also saved to the output file(s) for reference.

Fixes Cantera#872
bryanwweber added a commit to bryanwweber/cantera that referenced this issue Aug 20, 2020
This change reworks the abortion criteria for the diffusion flame
extinction example. Previously, the loop was only aborted when the flame
temperature was above the inlet temperature, the difference of the flame
temperature in the prior two iterations was less than the threshold, AND
the change in strain rate parameter was less than the threshold.
However, I found that this combination of conditions was never reached,
because the only way to change the strain rate delta was to have an
extinguished flame, and eventually the flame remains extinguished even
if the delta_alpha is reduced. This leads to an infinite loop, since the
abortion criteria check are only done if the flame is burning. This
change moves the abortion criteria check into the case where the flame
is not burning.

In addition, the flame temperature check is modified to use
np.isclose(). I found that on the last burning iteration, the maximum
flame temperature was only just barely above the oxidizer inlet
temperature. Thus, the result printed to the screen was not very useful.
The change to np.isclose() produces a more useful result for the final
burning iteration before extinction. The last non-burning iteration is
also saved to the output file(s) for reference.

Fixes Cantera#872
bryanwweber added a commit to bryanwweber/cantera that referenced this issue Aug 20, 2020
This change reworks the abortion criteria for the diffusion flame
extinction example. Previously, the loop was only aborted when the flame
temperature was above the inlet temperature, the difference of the flame
temperature in the prior two iterations was less than the threshold, AND
the change in strain rate parameter was less than the threshold.
However, I found that this combination of conditions was never reached,
because the only way to change the strain rate delta was to have an
extinguished flame, and eventually the flame remains extinguished even
if the delta_alpha is reduced. This leads to an infinite loop, since the
abortion criteria check are only done if the flame is burning. This
change moves the abortion criteria check into the case where the flame
is not burning.

In addition, the flame temperature check is modified to use
np.isclose(). I found that on the last burning iteration, the maximum
flame temperature was only just barely above the oxidizer inlet
temperature. Thus, the result printed to the screen was not very useful.
The change to np.isclose() produces a more useful result for the final
burning iteration before extinction. The last non-burning iteration is
also saved to the output file(s) for reference.

Fixes Cantera#872
speth pushed a commit that referenced this issue Aug 21, 2020
This change reworks the abortion criteria for the diffusion flame
extinction example. Previously, the loop was only aborted when the flame
temperature was above the inlet temperature, the difference of the flame
temperature in the prior two iterations was less than the threshold, AND
the change in strain rate parameter was less than the threshold.
However, I found that this combination of conditions was never reached,
because the only way to change the strain rate delta was to have an
extinguished flame, and eventually the flame remains extinguished even
if the delta_alpha is reduced. This leads to an infinite loop, since the
abortion criteria check are only done if the flame is burning. This
change moves the abortion criteria check into the case where the flame
is not burning.

In addition, the flame temperature check is modified to use
np.isclose(). I found that on the last burning iteration, the maximum
flame temperature was only just barely above the oxidizer inlet
temperature. Thus, the result printed to the screen was not very useful.
The change to np.isclose() produces a more useful result for the final
burning iteration before extinction. The last non-burning iteration is
also saved to the output file(s) for reference.

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

No branches or pull requests

2 participants