Hi Daniel,
Thank you for the sharing of pickling objects. Can the whole data of
each step be written in the same one file? I used the pygist on WinXP.
Do you have any suggestion for a better environment?
Regards,
Quoting Daniel Wheeler <[EMAIL PROTECTED]>:
Which viewer were you using? What platform are you on?
On May 4, 2007, at 6:48 PM, [EMAIL PROTECTED] wrote:
Hi Daniel,
Thank you so much for your suggestion. In the early testing, it
works when I turn off the viewers and replace with TSVViewer. I
just wonder if there is more convenient way to record the result
(or animation) without the complicated re-building process.
You can pickle stuff.
>>> from fipy import *
>>> dump.write(myCellVariable, 'myfile.gz')
>>> v = dump.read('myFile.gz')
>>> viewer = make(v)
>>> viewer.plot()
The problem with pickling objects is that when the class changes (if
changes are made to variable.py) sometimes
the object can not be unpickled. For this reason, I generally turn
the CellVariable into an array and then pickle it along
with some info about the mesh. For example,
>>> from fipy import *
>>> myArray = numerix.array(myCellVar)
>>> nx = mesh.nx
>>> ny = mesh.ny
>>> d = { "data" : myArray, "nx" : nx, "ny" : ny}
>>> dump.write(d, 'myFile.gz')
You now have a pickled dictionary with the data and its mesh shape.
Thanks again.
Regards,
Kundar
Quoting Daniel Wheeler <[EMAIL PROTECTED]>:
Hi Kundar,
Thanks for the email. The problem could well be a memory leak.
Check that you are not creating
Variable objects within a loop. Sometimes, recursive creation of
Variables can be problematic, but the
error message would be a little different. Still worth checking
though. Also, run with the viewers turned off.
I've experienced memory leak issues with some of the viewers. When
you run the code, check to see the
memory usage with "top" or something else. It should then be clear
whether there is a leak.
Hope the above helps.
On May 3, 2007, at 4:10 PM, [EMAIL PROTECTED] wrote:
Hello all,
I got a technical problem while I ran fipy to solve Cahn- Hilliard
equation. The elements is 30625 and dt=1. When the program ran
at step 844, it terminates with the error message:
Traceback (most recent call last):
File "C:\Python24\FiPy-1.2\data\DKS\Sizmann-regular fiber
\present- test\Sizmann-regular fiber-keep2.py", line 124, in ?
eqch.solve(var, boundaryConditions = BCs, solver = solver, dt = dt)
File "C:\Python24\Lib\site-packages\fipy\terms\term.py", line
121, in solve
matrix, RHSvector = self.__buildMatrix(var, boundaryConditions, dt)
File "C:\Python24\Lib\site-packages\fipy\terms\term.py", line
88, in __buildMatrix
return self._buildMatrix(var, boundaryConditions, dt)
File "C:\Python24\Lib\site-packages\fipy\terms\binaryTerm.py",
line 64, in _buildMatrix
matrix, RHSvector = self.term1._buildMatrix(var,
boundaryConditions, dt = dt)
File "C:\Python24\Lib\site-packages\fipy\terms\binaryTerm.py",
line 64, in _buildMatrix
matrix, RHSvector = self.term1._buildMatrix(var,
boundaryConditions, dt = dt)
File "C:\Python24\Lib\site-packages\fipy\terms\binaryTerm.py",
line 68, in _buildMatrix
matrix = self._operator()(matrix,termMatrix)
File "C:\Python24\Lib\site-packages\fipy\terms\binaryTerm.py",
line 89, in <lambda>
return lambda a,b: a - b
File "C:\Python24\Lib\site-packages\fipy\tools \sparseMatrix.py",
line 172, in __sub__
L.shift(-1, other._getMatrix())
MemoryError
May someone know what's problem, and how can I fix it?
Thanks and Regards,
Kundar
--
Daniel Wheeler
--
Daniel Wheeler