erdc / proteus

A computational methods and simulation toolkit
http://proteustoolkit.org
MIT License
87 stars 54 forks source link

Cannot save the archive #329

Closed robertsawko closed 8 years ago

robertsawko commented 8 years ago

I am back to working on my partial differential equations with stochastic inputs. Figured out some mistakes I did back then, but unfortunately not all the old scripts are working. Could you have a look at this file

https://github.com/robertsawko/pde-and-uq/blob/master/high_dimension/lc_and_forcing.py

The code seems to calculate the solution to Burgers' equation just fine, but begins crashes the moment it attempts to save the solution. I am running it with python2 lc_and_forcing.py, but I also tried with mpirun + parun as it seems to have something to do with parallel implementation.

Here's the error:

Traceback (most recent call last):
  File "/home/c111269/projects/proteus/linux2/bin/parun", line 5, in <module>
    pkg_resources.run_script('proteus==1.0.0', 'parun')
  File "/home/c111269/projects/proteus/linux2/lib/python2.7/site-packages/pkg_resources.py", line 528, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/home/c111269/projects/proteus/linux2/lib/python2.7/site-packages/pkg_resources.py", line 1394, in run_script
    execfile(script_filename, namespace, namespace)
  File "/home/c111269/projects/proteus/linux2/lib/python2.7/site-packages/proteus-1.0.0-py2.7-linux-x86_64.egg/EGG-INFO/scripts/parun", line 282, in <module>
    so = __import__(args[0][:-3])
  File "./lc_and_forcing.py", line 36, in <module>
    ns1.calculateSolution(so.name)
  File "/home/c111269/projects/proteus/linux2/lib/python2.7/site-packages/proteus-1.0.0-py2.7-linux-x86_64.egg/proteus/NumericalSolution.py", line 830, in calculateSolution
    self.closeArchive(model,index)
  File "/home/c111269/projects/proteus/linux2/lib/python2.7/site-packages/proteus-1.0.0-py2.7-linux-x86_64.egg/proteus/NumericalSolution.py", line 1013, in closeArchive
    self.ar[index].close()
  File "/home/c111269/projects/proteus/linux2/lib/python2.7/site-packages/proteus-1.0.0-py2.7-linux-x86_64.egg/proteus/Archiver.py", line 239, in close
    self.gatherAndWriteTimes()
  File "/home/c111269/projects/proteus/linux2/lib/python2.7/site-packages/proteus-1.0.0-py2.7-linux-x86_64.egg/proteus/Archiver.py", line 210, in gatherAndWriteTimes
    Domain = XDMF[0]
  File "/home/c111269/projects/proteus/linux2/lib/python2.7/xml/etree/ElementTree.py", line 266, in __getitem__
    return self._children[index]
IndexError: list index out of range

If you could look at it and let me know if can think of anything which may be causing it, would be great. From what I could figure out doing short pdb session is that XDMF has length zero so any index puts it out of range.

robertsawko commented 8 years ago

Clearly this is not a proteus issue, but an issue with the way I use it. I was confident that I can set up several cases by importing physics and numerics and then creating NumericalSolution objects.

When I run my *_p.py and *_n.py files separately using parun, the saving to the archive works fine. It's only when I import them into another py file and manipulate NumericalSolution objects things go wrong. There must be some relation with proteus.iproteus which I import too.

That script used to work though, so please let me know if you're aware of any changes that I could incorporate to bring back this functionality.

robertsawko commented 8 years ago

Right, it seems that the problem was in one of the options I was setting. I don't know remember why I needed cacheArchive=True, but commenting that out made the problem disappear. I can now run cases again directly through python (rather than through parun).