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 ]

Reply via email to