Daniel  --

Thank you, that makes a great deal of sense. On the boundary conditions you
are write about faceNorm; I had misinterpreted the text from
http://www.ctcms.nist.gov/fipy/documentation/USAGE.html

If the gradient normal to the boundary (*e.g.*, [image:
\hat{n}\cdot\nabla\phi]) is to be set to a scalar value of 2, use

>>> var.faceGrad.constrain(2 * mesh.faceNormals, where=mesh.exteriorFaces)


to mean that the gradient boundary conditions was defined normal and
outward of the solution domain. But it is clear from the text above that
this is not so; my bad.

Jamie





On Tue, May 9, 2017 at 1:55 PM, Daniel Wheeler <daniel.wheel...@gmail.com>
wrote:

> On Fri, May 5, 2017 at 5:37 PM, James Pringle <jprin...@unh.edu> 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
> fipy@nist.gov
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.
> ctcms.nist.gov_fipy&d=DwICAg&c=c6MrceVCY5m5A_KAUkrdoA&r=
> 7HJI3EH6RqKWf16fbYIYKw&m=xq7jzzUAUm5bpCMpllA6E_eUfqWzoAEZQTfsDZ33klc&s=
> NdwgYlVTn0mfJ7DeAyliZl5Tk3V6adv7fSpuszW9Hls&e=
>   [ NIST internal ONLY: https://urldefense.proofpoint.
> com/v2/url?u=https-3A__email.nist.gov_mailman_listinfo_
> fipy&d=DwICAg&c=c6MrceVCY5m5A_KAUkrdoA&r=7HJI3EH6RqKWf16fbYIYKw&m=
> xq7jzzUAUm5bpCMpllA6E_eUfqWzoAEZQTfsDZ33klc&s=
> E958ChgiyZsgdzhMDnik1d5wRFV3zQVlGDphpMvParY&e=  ]
>
_______________________________________________
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