On Sun, Sep 1, 2013 at 9:23 AM, sunghyun Kim <[email protected]>wrote:
> I found examples for anisotropy and heterogeneous.
> However, It is hard to apply both simultaneous.
>
> What I want is spatially varying anisotropic diffusion term.
>
> Following is the part of my code.
>
> anisoD = numerix.array(((1,0),(0,100)))
> DProfile2.setValue(value = anisoD, where = x > Lx/2.)
>
Hi,
I think you need something like this.
>>> import fipy as fp
>>> m = fp.Grid2D(nx=3, ny=3)
>>> v = fp.FaceVariable(mesh=m, rank=2, value=((1., 0.), (0., 100.)))
>>> X, Y = m.faceCenters
>>> v[:, :, X > 1.5] = 10.
>>> print v
[[[ 1. 1. 10. 1. 1. 10. 1. 1. 10. 1. 1. 10.
1. 1. 10. 10. 1. 1. 10. 10. 1. 1. 10. 10.]
[ 0. 0. 10. 0. 0. 10. 0. 0. 10. 0. 0. 10.
0. 0. 10. 10. 0. 0. 10. 10. 0. 0. 10. 10.]]
[[ 0. 0. 10. 0. 0. 10. 0. 0. 10. 0. 0. 10.
0. 0. 10. 10. 0. 0. 10. 10. 0. 0. 10. 10.]
[ 100. 100. 10. 100. 100. 10. 100. 100. 10. 100. 100. 10.
100. 100. 10. 10. 100. 100. 10. 10. 100. 100. 10.
10.]]]
>>> print X
[ 0.5 1.5 2.5 0.5 1.5 2.5 0.5 1.5 2.5 0.5 1.5 2.5 0. 1.
2.
3. 0. 1. 2. 3. 0. 1. 2. 3. ]
Seems to work. Hope that helps.
--
Daniel Wheeler
_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
[ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]