hkmoffat / cantera

Automatically exported from code.google.com/p/cantera
0 stars 0 forks source link

singular Jacobian error after pruning or scaling the grid in FreeFlame #146

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. use setRefineCriteria with prune > 0 (very small prune may be okay) in 
premixed flame calculations

OR

2. adjust the domain size using flame.setupGrid(z) or flame.set(grid=z) in 
premixed flame calculations

What is the expected output? What do you see instead?

These methods should (1) eliminate unneeded points or (2) resize the domain 
without causing solver errors. Instead, the solver throws an error if these 
methods are invoked (see below). It seems that the solver gets confused when 
the "fixed" temperature point (used to compute the laminar flame speed) is 
altered(?)

..............................................................................
Attempt Newton solution of steady-state problem...Traceback (most recent call 
last):
  File "premix_test.py", line 92, in <module>
    f.solve(loglevel, refine_grid)
  File "/usr/local/cantera/lib/python2.7/site-packages/Cantera/OneD/FreeFlame.py", line 72, in solve
    Stack.solve(self, loglevel = loglevel, refine_grid = refine_grid)
  File "/usr/local/cantera/lib/python2.7/site-packages/Cantera/OneD/onedim.py", line 581, in solve
    return _cantera.sim1D_solve(self._hndl, loglevel, refine_grid)
cantera.error: 

************************************************
                Cantera Error!                  
************************************************

Procedure: MultiNewton::step
Error:   Jacobian is singular for domain flame, component CH3CHO at point 75
(Matrix row 4333) 
see file bandmatrix.csv

What version of the product are you using? On what operating system?

Cantera 2.X (svn revision 2170) on Mac OS X 10.7.5

Please provide any additional information below.

This bug can be reproduced by changing the parameters "prune" and "resize" in 
the attached python script "premix_test.py." The script performs three solves: 
first, it solves the adiabatic flame; second, it perturbs the temperature 
profile and solves again with a fixed temperature profile; and third, it tries 
to solve the adiabatic problem again. Each solve uses the previous solution as 
a starting guess. 

If prune = 0.0 and resize = 1.0, the script executes as intended. If prune > 0, 
the script will have problems on the second solve. For prune=0.01, the script 
gets stuck in and endless loop of refining and pruning the grid and never 
converges. For prune=0.02, the solver fails with the error above. If resize != 
1.0, the script will fail on the third solve with the error above.

In this configuration, the solver fixes the temperature at one point in the 
domain in order to compute the flame speed. Pruning or resizing the grid seems 
to cause problems with this element of the algorithm.  

Original issue reported on code.google.com by lee.sh...@gmail.com on 22 Feb 2013 at 8:58

Attachments:

GoogleCodeExporter commented 9 years ago
These bugs are fixed in trunk by commits r2185, r2186, r2187, and r2188. 

It might be worth adding a regression test based on the script provided here, 
as the pruning functionality isn't being fully exercised by the existing tests.

Original comment by yarmond on 5 Mar 2013 at 5:08