The error message indicates that `dump.read` got something unexpected
-- namely, a `value` field -- and threw.

Naïvely, dumping `phi.faceGrad.value` instea dof `phi.faceGrad`
appears to do the trick.

-- 
Trevor Keller, Ph.D.
Materials Science and Engineering Division
National Institute of Standards and Technology
100 Bureau Dr. MS 8550; Gaithersburg, MD 20899
Office: 223/A131 or (301) 975-2889

On Thu, Dec 19, 2019 at 04:26:07PM +0100, Marcel UJI wrote:
>    I'm getting errors dumping vector variables in fipy. This minimal code
>    shows the problem:
> 
>    from fipy import *
> 
>    mesh=Grid3D(nx=10,ny=10,nz=10)
> 
>    phi=CellVariable(mesh=mesh,value=(mesh.x*mesh.y))
> 
>    dump.write({'E' : (phi.faceGrad)},filename='prova.gz',extension='.gz')
> 
>    fitxer=dump.read('prova.gz')
> 
>    produces:
> 
>    -----------------------------------------------------------------------
>    ----
>    TypeError                                 Traceback (most recent call
>    last)
>    <ipython-input-11-873751b8952b> in <module>()
>    ----> 1 fitxer=dump.read('prova.gz')
>    /home/marcel/.local/lib/python2.7/site-packages/fipy/tools/dump.pyc in
>    read(filename, fileobject, communicator, mesh_unmangle)
>        123         unpickler.find_global = find_class
>        124
>    --> 125     return unpickler.load()
>        126
>        127 def _test():
>    /usr/lib/python2.7/pickle.pyc in load(self)
>        862             while 1:
>        863                 key = read(1)
>    --> 864                 dispatch[key](self)
>        865         except _Stop, stopinst:
>        866             return stopinst.value
>    /usr/lib/python2.7/pickle.pyc in load_build(self)
>       1221         setstate = getattr(inst, "__setstate__", None)
>       1222         if setstate:
>    -> 1223             setstate(state)
>       1224             return
>       1225         slotstate = None
>    /home/marcel/.local/lib/python2.7/site-packages/fipy/variables/variable
>    .pyc in __setstate__(self, dict)
>       1525         self._refcount = sys.getrefcount(self)
>       1526
>    -> 1527         self.__init__(**dict)
>       1528
>       1529     def _test(self):
>    TypeError: __init__() got an unexpected keyword argument 'value'
> 
>    Any idea on what is wrong in this code??
> 
>    Marcel
> --
> Dr. Marcel Aguilella-Arzo
> Professor Titular d'Universitat, Física Aplicada
> Coordinador de la Subcomissió d'Especialitat de Ciències Experimentals i 
> Tecnolo
> gia
> del Màster Universitari en Professor d'Educació Secundària Obligatòria i 
> Batxill
> erat,
> Formació Professional i Ensenyament d'Idiomes
> Departament de Física
> Escola Superior de Tecnologia i Ciències Experimentals
> Universitat Jaume I
> Av. Sos Baynat, s/n
> 12071 Castelló de la Plana (Spain)
> +34 964 728 046
> [1][email protected]
> 
> References
> 
>    1. mailto:[email protected]

> _______________________________________________
> fipy mailing list
> [email protected]
> http://www.ctcms.nist.gov/fipy
>   [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]


_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to