I would start by setting a variable x = mesh.getCellCenters()[0], then just
use x in your source function.

For source term that does not involve n, rather than using SourceTerm, just
let it define a variable "source" and add it directly to your eq.

This example might be of further assistance.
http://matforge.org/fipy/browser/trunk/examples/cahnHilliard/mesh2D-coupled.py

-Yun

On Sun, Apr 1, 2012 at 9:54 PM, Daniel Farrell <[email protected]> wrote:

> Dear list,
>
> I'm trying to solve a simple 1D (diffusion only) problem, but I'm
> having difficulty writing the source term. The equations is of the
> form (here for a typeset version, http://i.imgur.com/GOBww.png),
>
> TransientTerm(n) = DiffusionTerm(n) + SourceTerm(n) + SourceTerm(x)
>
> where 'n' is the CellVariable an 'x' is space coordinate.
>
> How can I write a source term that is a function of the spatial coordinate?
>
> This is the script I have constructed so far,
> http://gist.github.com/2280822, I have assumed a 'variable' course
> term is a  constant to get things working.
>
> Best regards,
>
> Dan
> _______________________________________________
> 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
_______________________________________________
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