> I didn't give the whole program, but 'bot' was an array(or vector), so this
> seemed to work.

Good.

> However, the problem with the fluxes at the boundaries is not yet clear to me.
> Is there any manual where the differences between getGrad(), getGaussGrad(),
> getFaceGrad()etc. are explained?

Yes. Pages 186 and 187 of the reference manual have some explanation.

   <http://www.ctcms.nist.gov/fipy/download/reference.pdf>

getGrad() just calls getGaussGrad(). getFaceGrad() is the gradient
approximated at
the face center rather than the cell center.

> For testing purposes, I simplified my example further to a 1D stationary
> diffusion problem, solved on a 2D grid (similar to the second example in the
> manual).
>
> I fixed the concentrations on the top and at the bottom. The solution variable
> is linear as expected in the y coordinate. But if I regard the gradients at 
> the
> top or at the bottom, the values at the boundaries are only half of what they
> are in the center. Could it be that the difference between the face and the
> center is divided by the total cell height, instead of  half the cell height?

This is not the issue. The actual cell values are correct for the
equation you solved.
The issue is that the exterior face values use the adjacent  interior
cell values when
calculating the gradient instead of values calculated using the
boundary condition.

> Is
> this wanted?

No, it was an oversight in the basic design. The variable knows
nothing about the
boundary conditions and hence always assumes a zero gradient on the exterior
faces when calculating the gradient. This can cause problems when you
have explicit
gradients and divergences as source terms. There are ways to deal with
this, but it is not ideal.

Our hope is to associate the boundary conditions with the variable in
the future.
This probably won't be a huge effort. Unfortunately, this is not top
of the agenda
as we have other more pressing issues. I can explain the work around
if you need it.

>Is it the task of the user to think about this, or is there another
> way to get the gradient at the boundary?

It shouldn't be, but it is right now.

Cheers

-- 
Daniel Wheeler

Reply via email to