Okay, thanks for the suggestion - this was what I ended up doing. Unfortunately, using an explicit convection term raised some issues with vector/matrix operations that hadn't been extended to vector equations yet. (My workaround, for now, is to uncouple the vector equation I'm solving and split it into a set.)
Charles On Tue, Apr 8, 2014 at 8:04 AM, Daniel Wheeler <[email protected]>wrote: > On Mon, Apr 7, 2014 at 2:08 PM, Charles Reid <[email protected]> > wrote: > > > What I'd like to be able to do is assign a term to a CellVariable, so > that I > > could perform the AB2 averaging with the current value of the variable > and > > the old value of the variable, something like this: > > > > -----------------8<---------------------- > > > > MyConvectionTerm = CellVariable(mesh=m, hasOld=True, value=0.) > > > > MyConvectionTerm = ConvectionTerm(mycoeff) # initial convection term > value > > > > while t < ttotal: > > > > [...] > > > > ContinuityConvection.updateOld() > > MyConvectionTerm = (3./2.)*ConvectionTerm(mycoeff) - > > (1./2.)*MyConvectionTerm.old() > > > > [...] > > > > ------------------8<------------------------- > > > > However, I can't figure out how to make terms and variables compatible. > Any > > ideas on how I can do this? How can I store old values of terms? > > Hi Charles, > > I would say that shoehorning terms to have the properties of variables > is probably not the best way to go. Having said that, I am not sure > how best to approach this problem. Adams Bashforth schemes do multiple > steps so it seems like it's sensible to make each step a new equation. > However, the terms in the equations take variables from old values and > old-old values and so on. Also once a term is evaluated it would be > nice to use that in subsequent equations. For multiple steps this > might be quite difficult as things stand in FiPy. > > However, as you only seem to be doing one step above, maybe you should > be using an ExplicitConvectionTerm rather than trying to construct > "MyConvectionTerm.old()". > > Cheers, > > Daniel > > -- > Daniel Wheeler > _______________________________________________ > fipy mailing list > [email protected] > http://www.ctcms.nist.gov/fipy > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] >
_______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
