Hi FiPy community,

I'm solving a diffusion equation for *var *on a 2D grid; the diffusion
coefficient is set up as a function of another CellVariable *var2. *Problems
pop up when I tried to truncate the coefficient value at each location to a
small positive number *a*:
​

> ​a = 0.01​

dfactor =
> ​max(​a,
> 1-​var2
> ​)​
>
eq = (TransientTerm() == DiffusionTerm(coeff=
> ​d
> factor)


​When I then tried solving it, I get the error message

> ValueError: The truth value of an array with more than one element is
> ambiguous. Use a.any() or a.all()​


​Alternatively, I tried

> ​dfactor = numerix.fmax(a, (1-var2).value)

but got

ValueError: operands could not be broadcast together with shapes (10000,)
(2,2)

​Experimenting with, for example, getValue() and other functions such as

> dfactor = (1-var2)[(1-var2).value<a]=a

also didn't work.

Does anyone have ideas on the appropriate​
​
​ syntax to use?

Thanks,
Yun​



-- 
Yun Tao
Postdoc
Center for Infectious Disease Dynamics
Pennsylvania State University
State College, PA 16803
_______________________________________________
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