Thanks a lot  Daniel,
so if I understand well it is not possible for now, to impose that the
gradient of the concentration field would be normal to the face?


On Tue, Feb 15, 2011 at 6:33 PM, Daniel Wheeler
<[email protected]>wrote:

>
> On Mon, Feb 14, 2011 at 9:36 AM, Jonathan Guyer <[email protected]> wrote:
>
> >> I don't really understand, the gradient of the concentration field is
> not necessarly normal to the side ? or is it ?
>
> It isn't necessarily normal. However, for a regular isotropic
> diffusion coefficient, only the normal component of the constraint is
> used.
>
> >> a priori the direction of grad(c) can be different than the normal, no ?
>
> Yes. Using the ".faceGrad.constrain()" syntax you can't only specify
> the normal component. As Jon suggested, if you want to specify the
> normal value than you have to
> calculate it. This is often easy when you know the face orientation
> with grids. Say you want to specify the normal gradient "U" for some
> arbitrary oriented faces, you might do this,
>
>    >>> from fipy import *
>    >>> N = 100
>    >>> m = Grid2D(nx=N, dx=1. / N, ny=N, dy=1. / N)
>    >>> v = CellVariable(mesh=m)
>    >>> U = 10.
>    >>> nx, ny = m._faceNormals
>    >>> ux = numerix.where(nx != 0, U / nx, 0)
>    >>> uy = numerix.where(nx == 0, U / ny, 0)
>    >>> v.faceGrad.constrain(value=numerix.array([ux, uy]),
> where=m.facesRight +   m.facesTop)
>    >>> print v.faceGrad
>    >>> v.constrain(value=0, where=m.facesBottom + m.facesLeft)
>    >>> DiffusionTerm().solve(v)
>    >>> vi = Viewer(v)
>    >>> vi.plot()
>    >>> vi.plot()
>    >>> raw_input('stopped')
>
> > In the FixedFlux case, the boundary condition is definitely n\dot\vec{J},
> but for phi.faceGrad.constrain(), I'm not sure that's true. Wheeler would
> know for sure; I think he'll be back tomorrow.
>
> It is no longer possible to specify n\dot\vec{J} with the new scheme.
>
> > My guess is that phi.faceGrad.constrain(value=mesh._getFaceNormals() *
> phi_grad_mag, where=...) would do the trick, but Wheeler may know some
> finite-volumy reason for why that's not necessary.
> > It looks to me like phi.faceGrad.constrain() has only been tested in 1D
> cases, where this doesn't matter. Again, Wheeler will be happy to look into
> this when he gets back... won't you Wheeler?
>
> I'll change the examples to use vector values.
>
> --
> Daniel Wheeler
>
>

Reply via email to