On May 11, 2012, at 6:01 PM, Yun Tao wrote:

> I've now successfully simulated a diffusing bivariate normal (see 
> attachment), thanks to your help. For those who're curious, the crucial thing 
> to do is to first reshape the axial variables, feed it through bivariate 
> normal, and finally flatten the result for CellVariable. To illustrate:
> 
> x, y = mesh.getCellCenters()
>  
> xr = np.reshape(x, (nx, nx))
> yr = np.reshape(y, (ny, ny))
>  
> zf = bivariate_normal(xr, yr, 1., 1., 0., 0.)
>  
> zflat = zf.flatten()
> phi = CellVariable(mesh=mesh, value=zflat)


I don't believe you need to reshape and flatten. bivariate_normal() returns the 
same shape that you pass in, so all you need to do is

x, y = mesh.getCellCenters()
 
z = bivariate_normal(x, y, 1., 1., 0., 0.)
 
phi = CellVariable(mesh=mesh, value=z)


_______________________________________________
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