On Wed, Mar 9, 2016 at 12:21 PM, Zhekai Deng
<[email protected]> wrote:
> Thank for you taking the time clarify this to me. I implemented your
> suggestions, and it works right now. I understand the TransientTerm part
> now. And I have  a quick follow up question regarding to velocity field
> part: So in my original problem, the velocity field is linear in x
> direction, and no velocity in y direction. So I think using
> "mesh.faceCenters" gives me linear velocity on both direction. I think I get
> the idea why we should use faceCenters instead of mesh.y or mesh.x, so I
> made following changes to my definition of velocity field by declaring them
> directly as FaceVariable. Is this the right things to do ?

Yes, absolutely. Note that mesh.faceCenters is already a FaceVariable.

>
> Best,
>
> Zhekai
>
>
> ----------------
>
> velocityX = FaceVariable(mesh=mesh, value = mesh.faceCenters[1]) # linear
> velocity profile
>
> velocityY = FaceVariable(mesh=mesh, value = 0) # zero velocity in y
> direction
>
> velocityVector = FaceVariable(mesh=mesh, rank=1)
>
> velocityVector[0] = velocityX
>
> velocityVector[1] = velocityY

You can do the following to remove some of the steps above.

In [1]: import fipy as fp

In [2]: m = fp.Grid2D(nx=2, ny=2)

In [3]: velocity = m.faceCenters.copy()

In [4]: print velocity
[[ 0.5  1.5  0.5  1.5  0.5  1.5  0.   1.   2.   0.   1.   2. ]
 [ 0.   0.   1.   1.   2.   2.   0.5  0.5  0.5  1.5  1.5  1.5]]

In [5]: velocity[0] = 0.0

In [6]: print velocity
[[ 0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0. ]
 [ 0.   0.   1.   1.   2.   2.   0.5  0.5  0.5  1.5  1.5  1.5]]

-- 
Daniel Wheeler
_______________________________________________
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