Hello Jonathan, Thanks for the suggestions.
The term I tried was PowerLawConvectionTerm(coeff=(-alpha/C**2, ), var=C) but I got an error that said "IndexError: id1 does not have the same size as b". The rest of the error log can be found at http://pastebin.com/K4hy0GCh. I also tried declaring the term explicitly, but the solver could not converge after when sharp gradients in C appeared. Best, Edwin On Fri, Mar 15, 2013 at 8:20 AM, Jonathan Guyer <[email protected]> wrote: > > On Mar 14, 2013, at 9:33 PM, Edwin Sze Lun Khoo wrote: > > > I am having difficulties with trying to put a PDE into a form that FiPy > accepts. The equation in question is dC/dt + alpha*d/dx(1/C) = d^2C/dx^2 > where C is the dependent variable and alpha is a constant. The first and > last terms are just the standard TransientTerm and DiffusionTerm > respectively, but the second term is a ConvectionTerm with a variable that > is the reciprocal of the dependent variable. FiPy doesn't accept the > keyword var=1/C when defining an equation, while casting d/dx(1/C) as a > source term causes the solver to stop converging when there are sharp > gradients are in C. What are some other ways of recasting this PDE? Thanks! > > You can try running the chain rule on it: > > \alpha\frac{\partial}{\partial x}\frac{1}{C} > = -\frac{\alpha}{C^2}\frac{\partial C}{\partial x} > > so you get a "normal" convection term with a velocity of -alpha/C**2. > > Otherwise, you'll need to declare that term explicitly. > _______________________________________________ > 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 ]
