Spent all day testing out the stability issue and think I've finally understand it. So please ignore my last silly question. However, I'm still confused about the difference between
>>> eq2 = (TransientTerm(var=psi) == ImplicitSourceTerm(coeff=c**phi*, var=* psi*) and >>> eq2 = (TransientTerm(var=psi) == ImplicitSourceTerm(coeff=c**psi*, var=* phi*) .Why is the first config preferable over the second? Thanks, Yun On Mon, Jul 2, 2012 at 4:52 PM, Yun Tao <[email protected]> wrote: > Hm. Implemented the code but the solution quickly reached instability > (script and video attached). I haven't encountered this since solving for > the transients of 4th order Cahn-Hilliard. So I wonder, is there a > numerical stability condition specific to the way coupled nonlinear > equations are solved in FiPy? Furthermore, even with fixedflux BCs, > *phi.getCellVolumeAverage() > * l* here indicates leakage in the solution. Sorry I couldn't narrow my > question down as I'm at a complete loss looking at the output. > > Thank you for your patience and kind assistance, > > Yun > > > On Mon, Jul 2, 2012 at 11:23 AM, Yun Tao <[email protected]> wrote: > >> >> >> On Mon, Jul 2, 2012 at 11:12 AM, Jonathan Guyer <[email protected]> wrote: >> >>> >>> On Jul 2, 2012, at 1:08 PM, Daniel Wheeler wrote: >>> >>> > On Mon, Jul 2, 2012 at 6:56 AM, Yun Tao <[email protected]> wrote: >>> > >>> > 1. In Equation [1], when I set the coefficient of the ConvectionTerm >>> to a function of psi, it returns >>> > >>> > TypeError: unsupported operand type(s) for *: 'binOp' and 'unOp' >>> > >>> > I gather this may due to me multiplying a FaceVariable to a >>> CellVariable as a consequence of me using a position-dependent convection >>> term. However, when I tested what happens if I remove the space-dependence, >>> I get >>> > >>> > VectorCoeffError: The coefficient must be a vector value. >>> > >>> > Of course, when I take out the dependence on psi altogether, >>> everything's fine. >>> > >>> > The coefficient does need to be a vector value. Unfortunately, a >>> function of psi alone is not a vector field, but a scalar field. Multiply >>> it by a vector. For example, >>> > >>> > >>> import fipy as fp >>> > >>> fp.Grid1D(nx=2) >>> > >>> v = fp.CellVariable(mesh=m) >>> > >>> (v * [[1]]).rank >>> > 1 >>> > >>> (v * [[1]]).shape >>> > (1, 2) >>> >>> Also, to be able to use your position-depedent form, you should be able >>> to write >>> >>> c / psi.faceValue *np.tanh(40*pos) >>> >>> and then you're multiplying two FaceVariables and one of them is rank-1, >>> so everything should be OK >>> >> >> Woohoo! Works like a charm! Will be analyzing this for awhile. Thanks so >> much! >> >>> >>> _______________________________________________ >>> fipy mailing list >>> [email protected] >>> http://www.ctcms.nist.gov/fipy >>> [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] >>> >> >> >> >> -- >> Graduate Group of Ecology Doctoral Candidate >> Department of Environmental Science and Policy >> Center for Population Biology >> University of California, Davis >> >> >> > > > -- > Graduate Group of Ecology Doctoral Candidate > Department of Environmental Science and Policy > Center for Population Biology > University of California, Davis > > > -- Graduate Group of Ecology Doctoral Candidate Department of Environmental Science and Policy Center for Population Biology University of California, Davis
_______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
