On Mon, Dec 16, 2013 at 4:30 PM, J Hung <jyh...@mit.edu> wrote:
> Hi,
> I'm trying to find the best way to write my equation, which involves not
> only diffusion terms in terms of two order parameters phi and psi, but also
> terms like grad(phi) dot grad(laplacian(psi)). Since all these terms are
> being added together, I'm trying to use faceGrad to make terms like
> grad(phi) dot grad(laplacian(psi)) consistent with terms like
> DiffusionTerm(var=phi). (Do you think this necessary?)

I'm not sure. Can you paste up the tex for your equations? That might
help because at the moment you have more than one variable, but only
one equation, which is a little confusing.

> The way I'm trying to
> express grad(phi) dot grad(laplacian(psi)) is
>
> DOT(phi.faceGrad,((psi.faceGrad).divergence).faceGrad)
>
> as in the following code:
>
>
> import fipy as fp
> mesh= fp.Grid2D(nx=500,ny=500,dx=0.25, dy=0.25)
> phi = fp.CellVariable(name=r"$\phi$", mesh=mesh)
> phi.setValue(fp.GaussianNoiseVariable(mesh=mesh, mean=0.5, variance=0.01))
> psi = fp.CellVariable(name=r"$\psi$", mesh=mesh)
> psi.setValue(fp.GaussianNoiseVariable(mesh=mesh, mean=0.5, variance=0.01))
> PHI = phi.getArithmeticFaceValue()
> PSI = psi.getArithmeticFaceValue()
>
> DOT = fp.numerix.dot
> eq1=(fp.TransientTerm(var=phi) ==
> DOT(phi.faceGrad,((psi.faceGrad).divergence).faceGrad)
> +DiffusionTerm(coeff=PHI**2, var=phi)
> -DiffusionTerm(coeff=PHI, var=psi))
>
>
> But I get an error that the coefficient can not be a FaceVariable. Changing
> the faceGrad to grad seems to make it alright, but would that affect the
> accuracy?

I'm not sure it matters a great deal for the first term on the RHS,
but the term does need to end up being a "CellVariable" not a
"FaceVariable". It'll be a "FaceVariable" in its current form. Change
the outermost "faceGrad" to "grad" and things should work.

-- 
Daniel Wheeler
_______________________________________________
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to