Have you tried printing scalarSource to make sure it is at least 0.0 at
some locations and 100.0 at other locations? This might be easier to see if
you make a small, dx=6 x dy=2 mesh.
And you do want it to be a source term like
dcdt = diffusion + convection + 100.0 * c
right? As in, a first order reaction, not zero order. Otherwise, I could
see doing a simple test in which you start out with c=0 everywhere and
having nothing being generated. If you want zero order reaction, you should
add the term as
dcdt = diffusion + convection + scalarSource

Ray

On Fri, Jan 23, 2015 at 3:49 PM, Richard Gillilan <[email protected]> wrote:

> Doing simple convection diffusion in a narrow channel: simulating the
> accumulation of damaged solute in a dilute solution as a result of x-ray
> exposure. I’m having trouble getting a Source term to work the way I think
> it should. I want a strip of volume elements in the middle of the channel
> (the x-ray illuminated volume) to act as a source of “damaged” solute. So
> any solution that convects into those pixels should have the concentration
> of damaged material increased at a constant rate. Note vel is simple
> Poiseuille flow, but set to zero for testing purposes.
>
> Can anyone spot any obvious errors? Here’s what I tried:
>
> <I’m only showing some of the code here for brevity>
>
> print "volume element size: ",dx,"x",dy
>
> Lx = dx*nx
> Ly = dy*ny
>
> mesh = Grid2D(dx=dx, dy=dy, nx=nx, ny=ny)
>
> print "dimensions of capillary: ",Lx,Ly
> ...
> xc,yx = mesh.cellCenters
> ...
> scalarSource = CellVariable(mesh, value=0.0, rank=0)
> strip = ((xc>Lx/3) & (xc<2*Lx/3))
> scalarSource.setValue([100.0], where=strip)
>
> eq = TransientTerm() ==
> (DiffusionTerm(coeff=D)+VanLeerConvectionTerm(coeff=vel))+ImplicitSourceTerm(scalarSource)
>
> _______________________________________________
> 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 ]

Reply via email to