Daniel Wheeler <[EMAIL PROTECTED]> writes:

> 
> 
> > > I tried the following:
> > > ###################################
> > > BCs = (FixedValue(faces=mesh.getFacesBottom()[0:Ende],
> > >                   value=bot))
> 
> This should be:
> 
>    >>>  BCs = (FixedValue(faces=mesh.getFacesBottom()[0:Ende], value=bot), )
> 
> to make it a tuple (instead of an expression).
> Boundary conditions should be in the form of a list or tuple.
> 

Dear Daniel, 

let me thank you first of all! I didn't expect to get an answer this year!

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


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?

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? Is
this wanted? Is it the task of the user to think about this, or is there another
way to get the gradient at the boundary?

My test program looks like this:


from fipy import *
from fipy.variables.cellVariable import CellVariable
m = Grid2D(nx=4, ny=4, dx=.25, dy=.25)

phi=CellVariable(name = "Concentration", mesh = m, value = 1.)
BCs = (FixedValue(faces=m.getFacesBottom(), value=0.),
       FixedValue(faces=m.getFacesTop(), value=1.))
bot=m.getFacesBottom()
diffTerm=ImplicitDiffusionTerm(coeff=1.)
eq=diffTerm==0.
eq.solve(var=phi,
             boundaryConditions=BCs)

gr3=phi.getGrad()
print gr3,"Grad"
#+++++++++++++++++++++++++
The Output is:

[[ -3.93574062e-14   5.00000000e-01]
 [  2.57682764e-13   5.00000000e-01]
 [  3.14914761e-13   5.00000000e-01]
 [  1.78745907e-14   5.00000000e-01]
 [  4.50528503e-13   1.00000000e+00]
 [  6.24611474e-13   1.00000000e+00]
 [ -3.50830476e-13   1.00000000e+00]
 [ -5.25135491e-13   1.00000000e+00]
 [  9.23705556e-14   1.00000000e+00]
 [ -1.18127730e-13   1.00000000e+00]
 [  1.59428026e-13   1.00000000e+00]
 [  3.69482223e-13   1.00000000e+00]
 [  2.08721929e-14   5.00000000e-01]
 [ -6.92779167e-14   5.00000000e-01]
 [  2.49578136e-13   5.00000000e-01]
 [  3.41060513e-13   5.00000000e-01]] Grad
+++++++++++++++++++++++++++++
Thanks again!
Burak


Reply via email to