Hi Jon,

I think I didn't understand the operator variable completely. Thanks for
pointing that out. And thank you for all the supports. Please see below an
example of what I'm trying to do:

kp['NO3'] = (k['R2'] * k_O2_NO3/(k_O2_NO3 + O2.var)).copy()

kp['NO3'].setValue(0.,where = Qcc == 0)


So, I'd like to set the the kp['NO3'] value to be equal to k['R2'] *
k_O2_NO3/(k_O2_NO3 + O2.var. But when it hits to the next time, I got the
error "TypeError: The value of an `_OperatorVariable` cannot be assigned".
Then, after I adding the .copy() method behind, it works. kp['NO3'] becomes
a CellVariable rather than an OperatorVariable.


Best regards,

Rose





On Mon, Feb 10, 2014 at 8:50 PM, Guyer, Jonathan E. Dr. <
[email protected]> wrote:

>
> On Feb 8, 2014, at 11:25 AM, yuan wang <[email protected]> wrote:
>
> > I found that if b and c are cellvariables, the command a = b*c will make
> a an operator variable. If I use a = (b * c).copy(), a becomes a
> cellvariable. Would this be a good command to use to assign b*c values to
> cellvariable a?
>
> Not really. .copy() ought to produce another operator variable. I would
> not rely on the fact that it doesn't.
>
> What are you trying to do? Set an initial condition?
>
>   a = CellVariable(..., value=(b * c).value)
>
> would be a good way, or
>
>   a.value = (b * c).value
>
> after a has been declared.
>
>
> > A general question is why we need the operator variables, if all we care
> is numpy array operations and value assignment?
>
> Who said all we care about is numpy array operations and value assignment?
> The coefficients of PDEs often depend on the fields being solved for.
> Operator values allow these coefficients to evolve as the fields evolve.
>
> What are you actually trying to do?
> _______________________________________________
> fipy mailing list
> [email protected]
> http://www.ctcms.nist.gov/fipy
>   [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
>



-- 
Yuan (Rose) Wang
PhD Candidate, Tufts University
Cellphone: 617-699-8006
_______________________________________________
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