On Feb 22, 2011, at 11:32 AM, Burak Atakan wrote:
> I would like to vary the example circle.py and apply convective boundary > conditions at the outer surface for a heat transfer problem. > -k dT/dr = h (T-T0) > > There were similar problems in the postings, using a 2Dmesh and applying a > mask, which is one at a given boundary and 0 everywhere else: > > mask = CellVariable(mesh, value=0.) > mask.setValue(1, where=(mesh.getCellCenters()[1] <= dy)) > convectionOut = mask * (T - Tinf) * h / (dy ) > > This works fine, using some sweeping. I'm not sure what postings you are referring to. Could you provide a subject or date or, best, a link to the message at http://dir.gmane.org/gmane.comp.python.fipy ? The cases where we calculate a mask are for in/outflow conditions, and sometimes as a way to assign a flux boundary condition, but regardless, mask is always on Faces, not on Cells. > Now the question is, how to set the mask correctly using the GmshImporter2D > (just as it is used in the circle.py example). > > I would like to apply this boundary condition all around the exterior Faces, > but > I cannot figure out the appropriate syntax. If I understand what you are doing, I believe you want to set a FixedFlux boundary condition. There is no need to locate the Cells around the boundary, only the Faces, and we give you that: FixedFlux(faces=mesh.getExteriorFaces(), value=h * (T.getArithmeticFaceValue() - Tinf)) getExteriorFaces() works just as well for a circular Gmsh mesh as for a Grid2D. As you've seen, this will require sweeping because the BC depends on the solution value T.
