Hi Pedro,

Now I understand. You have a boundary condition of the form:

dT / dn = h (T - Tinf)

Is this more or less correct? If this is the case, then one method for specifying the boundary condition
is to add a source term to the equation. FiPy currently doesn't explicitly support mixed boundary conditions,
but there is another easy way to do it. So, do the following:

    >>> Lx = nx * dx
    >>> mesh = Grid2D(nx=nx, ny=ny, dx=dx, dy=dy)
   
    >>> T = CellVariable(mesh=mesh, hasOld=True) ## must set hasOld=True for sweeping

    >>> mask = CellVariable(mesh=mesh)
    >>> mask.setValue(1, where=mesh.getCellCenters()[...,0] > (Lx - dx)) 

    >>> eqn = TransientTerm() == DiffusionTerm(D) + mask * D * (T - Tinf) * h / dx

We have replaced the boundary condition on the left hand side with a source.
You may have to flip the sign to get it right. Also you will have to iterate a few
steps at each time step in order to reach convergence. You will need to
check the residual, something like this:

for step in range(steps):
      T.updateOld()
      res = 1
      while res < 1e-3:
            res = eqn.sweep(T, boundaryConditions=bcs, dt=...)
            print 'res',res

Good luck!




On Sep 19, 2006, at 9:53 PM, Pedro Henrique wrote:

Hi  Mr. Daniel,

Sorry to bother you again...

Actually, my problem is a rectangular plate, with diferent boundary conditions in each face. On the left face it has a fixed temperature, wich I can represent as a fixed value in the program. The bottom face is adiabatic, wich I can represent as a fixed flux (q"=0). On the top face, it has a fixed flux (q"). On the right face (which is my problem) it has convection with known: fluid temperature (T infinit) and convection coefficient(h).
oThe problem I´m having (because my lack of experince in Fipy), is how to express this boundary condition in the right face.
I had looked in chapter 8 and didn´t found anything helpfull.

Thanks again for your time


Pedro Henrique


2006/9/19, Daniel Wheeler <[EMAIL PROTECTED]>:
Hi Pedro,

Thanks for your interest in FiPy. Answers to your questions are below.

On Sep 18, 2006, at 5:25 PM, Pedro Henrique wrote:

Hi, my name is Pedro and I study mechanical engeneering in Unesp, Brazil.
 
I have some questions about Fipy.
 
How do I represent convection as a boundary condition in Fipy?

Do you mean "How do I represent boundary conditions if I have a ConvectionTerm in my equation?".

I think Chapter 8 in the manual has examples that use a ConvectionTerm in conjunction with a FixedValue
boundary condition. You could also use a FixedFlux boundary condition. I can be more specific if you give
me more details regarding your problem.

There are some subtle issues involving boundary conditions with different combinations of terms that
FiPy can handle, but not in the canonical way. I can get into more details about this if you wish depending on 
whether it impacts your problem.

Regards

Daniel

 
Please reply as soon as possible.
Thanks for helping.


Daniel Wheeler





Daniel Wheeler



Reply via email to