Hi,
I tried to use getGrad to calculate the normal vector field for a distance
variable (phi) in fipy trunk.
phi is initialized as below.
m = Grid2D(nx=N, ny=N, Lx=L, Ly=L)
phi = CellVariable(mesh=m, value=-1.0, name='distance function')
phi.setValue(1.0, where = (m.y > h0))
phi[:] = computeDistanceFunction2d(phi.value, nx=m.nx, ny=m.ny, dx=m.dx,
dy=m.dy)
I was confirmed that phi is successfully initialized and
computeDistanceFunction2d is a function in lsmlib.
Then I calculated the normal vector fields as below:
gradient = phi.getGrad
print gradient
print gradient.shape
The output is:
<bound method CellVariable.getGrad of distance function>
File "PVD.py", line 51, in <module>
print gradient.shape
AttributeError: 'function' object has no attribute 'shape'
What leads to this error and How can I get a (2, N) matrix of normal vector
fields in this case?
Thanks very much!
Best,
Yunbo
_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
[ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]