On Fri, May 5, 2017 at 5:37 PM, James Pringle <[email protected]> wrote:
> Jon --
>
>     Thanks for this reply. There is something in it I don't understand. Why
> is it necessary in fipy constrain the tangential derivative to the solution
> to the Poisson equation in fipy?

I don't think that the tangential derivative matters. I think that in
James's version of "DemoBug.py" multiplying by the "faceNorms" is
giving the wrong sign in some places from the normal component. By
removing the "faceNorms", the normal component is correct. I think
that you can zero out the tangential component and it has no impact.
For example, the following also works,

~~~~
faceNorm_x = faceNorm.copy()
faceNorm_y = faceNorm.copy()
faceNorm_x[:] = 0.
faceNorm_y[:] = 0.
faceNorm_x[0, :] = 1.
faceNorm_y[1, :] = 1.
psiInvert.faceGrad.constrain(psiTrue.faceGrad * faceNorm_y, where=yeq0bound)
psiInvert.constrain(psiTrue.faceValue,where=yeq1bound)
psiInvert.faceGrad.constrain(psiTrue.faceGrad * faceNorm_x, where=xeq0bound)
psiInvert.faceGrad.constrain(psiTrue.faceGrad * faceNorm_x, where=xeq1bound)
~~~~

In the above the tangential component is zeroed out and the normal
component is unity, so the sign of the gradient is unaffected.

-- 
Daniel Wheeler
_______________________________________________
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