Hello all,
   A possibility is to define the diffusion as a variable (similar to
mesh1D with position dependent diffusion). In this case I can use something
like

phi = CellVariable(name="Concentration (M)",mesh=mesh,value=0.0)

and then:

facesphi=phi.arithmeticFaceValue

to obtain the concentration at the faces. Can I then use statements in the
form:

D.setValue(facesphi*slope+intercept,where="concentration rage")

My concern is that facesphi will not update as the solution is being
obtained.  Thanks for any guidance.

Salomon




On Fri, Jan 4, 2013 at 2:51 PM, Salomon Turgman Cohen <[email protected]>wrote:

> Hello developers and users,
>    I am interesting in solving a simple 1D diffusion equation using fipy.
> My requirement is that the diffusion coefficient is concentration
> dependent. Following the mesh1D example I know how to do this if I have a
> simple functional form to describe the diffusion's dependence on
> concentration. However, what I have is just 5 data points of diffusion
> versus concentration. What I want to do is a linear interpolation of the
> diffusion in between the data points. I constructed the following function
> as an example:
>
> def diffusion(phi):
>     if (phi>=0.0) & (phi<0.902449):
>         return phi*(-7.63256E-8) + 1.05240E-7
>     elif (phi >= 0.902449) & (phi < 1.807062):
>         return phi*(-1.37296E-08) + 4.87503E-08
>     elif (phi >= 1.807061587) & (phi < 2.713202143):
>         return phi*(-2.23797E-08) + 6.43815E-08
>     elif (phi >= 2.713202143) & (phi < 3.570465711):
>         return phi*-1.48121E-09 + 7.67966E-09
>     elif (phi >= 3.570465711) & (phi < 4.425457264):
>         return phi*-4.04495E-10 + 3.83529E-09
>     elif (phi >= 4.425457264):
>         return phi*-4.62147E-10 + 4.0904E-09
>
> But it cannot handle the arrays obtained from CellVariables command. What
> would be the right way to do this?
>
> Thanks!
>
> --
> Salomon Turgman Cohen
> Postdoctoral Associate
> Cornell University
> (919) 341-9650
>



-- 
Salomon Turgman Cohen
Postdoctoral Associate
Cornell University
(919) 341-9650
_______________________________________________
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