On Feb 11, 2014, at 11:39 AM, Daniel Wheeler <[email protected]> wrote:
> On Mon, Feb 10, 2014 at 9:02 PM, yuan wang <[email protected]> wrote: > My guess is that "copy()" just returns a plain old CellVariable > without its dependencies. Basically, the "copy()" is not exactly the > same object as the original. > > Unfortunately, I'm not sure what you are trying to do above, I think > I'd need to see the full traceback to debug it. My hunch is that you > should be doing either > > kp['NO3'][:] = numerix.array((k['R2'] * k_O2_NO3/(k_O2_NO3 + O2.var))) > > to cast the RHS to be an array rather than a variable, if you want to > not have kp['NO3'] updated via lazy evaluation. Likewise, I don't understand what the actual objective is, here. I suspect you *do* want lazy evaluation and that what should be written is something like kp['NO3'] = (k['R2'] * k_O2_NO3/(k_O2_NO3 + O2.var)) * (Qcc != 0) and then *never re-write kp['NO3'] again*!!! If you are using FiPy properly, there should never be a "when it hits to the next time" because you only write expressions like this once and you let lazy evaluation take care of updating the values. .copy() is a red herring. It apparently does produce a CellVariable, but I don't think it should. Please work through some of FiPy's examples that involve non-linear coefficients. These would be some good ones to start with: http://www.ctcms.nist.gov/fipy/examples/diffusion/generated/examples.diffusion.mesh1D.html http://www.ctcms.nist.gov/fipy/examples/phase/generated/examples.phase.simple.html http://www.ctcms.nist.gov/fipy/examples/phase/generated/examples.phase.quaternary.html _______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
