hkmoffat / cantera

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

Python OneD Flows: _initialized flag not set upon restore #77

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Do a simulation for a OneD flow in Python. In my case, it was a counterflow 
flame, named 'f'.
2. Save the solution using 'f.save('solution.xml','solution')'
3. Close the python session and open a new one.
4. Create a OneD object, e. g. by 'f = CounterFlame(gas = gas, grid = 
initial_grid)'.
5. Restore the previous solution by 'f.restore('solution.xml','solution')'
6. Set boundary conditions for the simulations.
7. Run the simulation by 'f.solve()'

What is the expected output? What do you see instead?
Ideally, this should run the simulation continuing from the restored situation. 
Instead, because the flag 'f._initialized' is still 0, it first tries to again 
initialize the simulation.

What version of the product are you using? On what operating system?
r1421, on OS X 10.6.8

Please provide any additional information below.

For an easy solution, you could just set the '_initialized' flag manually to 1 
after restoring the solution. However, this is not intuitive.

I actually created a patch, which introduces the function 'restore' into all 
OneD classes. It simply wraps the 'restore' function of the base class, and 
additionally sets the flag '_initialized' to 1. I suppose this is a more 
convenient solution.

Original issue reported on code.google.com by thetruet...@googlemail.com on 20 Apr 2012 at 2:23

Attachments:

GoogleCodeExporter commented 9 years ago
Can you upload a sample Python script that demonstrates the problem as 
described?

Original comment by yarmond on 17 May 2012 at 9:20

GoogleCodeExporter commented 9 years ago
I attached a test case which illustrates the issue.
I think this problem can be solved using the patch I provided above.

Original comment by thetruet...@googlemail.com on 30 May 2012 at 8:51

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the patch. This problem is fixed in r1513.

Original comment by yarmond on 30 May 2012 at 4:07

GoogleCodeExporter commented 9 years ago
You're welcome, thanks for the fix!

Original comment by thetruet...@googlemail.com on 30 May 2012 at 4:22