On Dec 4, 2012, at 10:08 AM, Daniel Wheeler wrote:
> What I mean is: will all
> variables be updated as they should be after each iteration of sweep &
> updateOld?
>
> All "var.updateOld()" does is update the var's old value. Each CellVariable
> (if "var.hasOld = True") has an "old" attribute, which is itself a
> CellVariable. If the CellVariable has ("hasOld = False") then "var.old =
> var". Now, the TransientTerm simply uses "(var - var.old) / dt". If there are
> no sweeps then an old value is not required as "var" is implicit. However, if
> your problem does have sweeps then you require an old value otherwise
> "var.old" will be the value from the previous sweep rather than the previous
> time step. Thus, if you use sweeps, you need to call updateOld() on all your
> CellVariable's between each time step.
While that's true, I'm not sure the updateOld() is particularly germane to
Lafras' question. There's nothing special about being in __main__. If FiPy
doesn't throw an error when you instantiate the variables, then there's no
reason that any Variable expressions won't continue to work as you iterate the
problem.
_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
[ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]