← Back to team overview

dolfin team mailing list archive

Unexpected(?) behaviour of functions with non-zero values only on boundary

 



The following piece of code, which defines a source that only has non-zero values on one part of the boundary and assembles this source on the boundary,



   from dolfin import *


   class BoundarySource(Function):
       def __init__(self, element, mesh):
           Function.__init__(self, element, mesh)
       def eval(self, values, x):
           values[0] = 0.0
           if abs(x[0] - 1.0) < DOLFIN_EPS:
                   values[0] = 1.0

   mesh = UnitSquare(3, 3)

   element = FiniteElement("DG", "triangle", 0)
   f = BoundarySource(element, mesh)
   v = TestFunction(element)
   L = f*v*ds

   rhs = assemble(L, mesh)
   print "norm of L = ", rhs.norm()



gives output

    norm of L =  0.0


Is this expected?

Changing element to continuous/discontinuous linears gives non-zero values...

--
Marie E. Rognes
Ph.D Fellow, Centre of Mathematics for Applications, University of Oslo
http://folk.uio.no/meg