Hi Daniel
Thank you for following up-
I did try your suggestion, ( C is my concentration dependent Cell variable)

Dx=Dpe_x*(a_x+((1.-a_x)/(b_x*C+g_x)))
Dz=Dpe_z*(a_z+((1.-a_z)/(b_z*C+g_z)))
diff = Dx.dot([[1,0],[0,0]])+Dz.dot([[0,0],[0,1]])

and program runs and "looks correct" so good to go!!

But before your suggestion I was trying to create the suggested rank 2 diffusion coefficient a different way and I did not get far before hitting a road block- If you have time to answer this specific question it may help with understanding the structure of variables in this program

I created a 2x2 Cell Variable on a 2x2 2Dim mesh. I can show that code if necessary, but the result for the initialized CellVariable is shown below

print(D.value)

[[[ 0.  2.  4.  6.]
  [ 1.  1.  1.  1.]]

 [[ 1.  1.  1.  1.]
  [ 1.  1.  1.  1.]]]


Now the part that I am having trouble with. How can I change the 6 to a 0.?
The closet I can come is changing all the values at that mesh position to 0.
that is using

D.setValue(0,where=[[0,0,0,1]])
print(D.value)

[[[ 0.  2.  4.  0.]
  [ 1.  1.  1.  0.]]

 [[ 1.  1.  1.  0.]
  [ 1.  1.  1.  0.]]]


again what I was angling for was an output that looked like

[[[ 0.  2.  4.  0.]
  [ 1.  1.  1.  1.]]

 [[ 1.  1.  1.  1.]
  [ 1.  1.  1.  1.]]]


thanks for your help
Phil





On 4/19/2016 6:51 AM, Daniel Wheeler wrote:
Phil, just to follow up and complete the answer. I neglected to
explain how to create a rank 2 CellVariable from two rank 0
CellVariables to preserve the dependency. The dot operator helps with
that. Given two rank 0 CellVariables, v00 and v11, then to get the
rank 2 CellVariable use,

     vv = v00.dot([[1, 0], [0, 0]]) + v11.dot([[0, 0], [0, 1]])

On Mon, Apr 18, 2016 at 3:33 PM, Daniel Wheeler
<[email protected]> wrote:
On Mon, Apr 18, 2016 at 12:33 PM, Phil Battle <[email protected]> wrote:
Ok, below works as I would expect ( note Dx and Dz are constants)
Thanks for that. I can confirm that it's broken in Python 2.7 as well
when the diffusion coefficient is [[Dx, Dy]].


--
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