On Feb 3, 2011, at 1:45 PM, Julien Derr wrote:

> I tried setValue but doesn't seem to work right.
> 
> xc, yc = mesh.getCellCenters()
> newphi = CellVariable(name = "solution variable",    mesh = mesh,    value=0) 
>    
> newphi.setValue(oldphi((xc,yc)))
> 
> 
> when I look at newphi, there are only zeros, it didn't take the values of 
> oldphi; isn't it supposed to do that with setValue ? 


newphi contains integers because you set value to `0` and not `0.` and so the 
interpolated values are getting rounded to 0.


Try

newphi = CellVariable(name = "solution variable",    mesh = mesh,    value=0.)  
  

or just

newphi = CellVariable(name = "solution variable",    mesh = mesh)    



Reply via email to