Subject: [FEniCS-users] FacetNormal

From: Douglas N Arnold <[email-masked]>
Date: Fri, 20 Nov 2009 08:35:12 -0600

The FacetNormal function doesn't work under dolfin-0.9.4, even though it 
is called in some of the demos.  For example the 3-line program

from dolfin import *
mesh = UnitSquare(4,4)
n = FacetNormal(mesh)

fails with

Invalid domain <Mesh of topological dimension 2 (triangles) with 25 
vertices and 32 cells, ordered>.
Traceback (most recent call last):
   File "junk.py", line 3, in <module>
     n = FacetNormal(mesh)
   File "/usr/lib/python2.6/dist-packages/ufl/geometry.py", line 54, in 
__init__
     GeometricQuantity.__init__(self, cell)
   File "/usr/lib/python2.6/dist-packages/ufl/geometry.py", line 20, in 
__init__
     self._cell = as_cell(cell)
   File "/usr/lib/python2.6/dist-packages/ufl/geometry.py", line 186, in 
as_cell
     return cell if isinstance(cell, Cell) else Cell(cell)
   File "/usr/lib/python2.6/dist-packages/ufl/geometry.py", line 117, in 
__init__
     ufl_assert(domain in domain2dim, "Invalid domain %s." % (domain,))
   File "/usr/lib/python2.6/dist-packages/ufl/assertions.py", line 20, in 
ufl_assert
     if not condition: error(*message)
   File "/usr/lib/python2.6/dist-packages/ufl/log.py", line 106, in error
     raise UFLException(self._format_raw(*message))
ufl.log.UFLException: Invalid domain <Mesh of topological dimension 2 
(triangles) with 25 vertices and 32 cells, ordered>.

---

From: "Garth N. Wells" <[email-masked]>
Date: Fri, 20 Nov 2009 16:34:01 +0000

Douglas N Arnold wrote:
> is called in some of the demos.  

FacetNormal was removed on the C++ side before 0.9.4, and then re-added 
sometime after 0.9.4 to Python, so 0.9.4 falls through the gap.

The solution with 0.9.4 is to use

     n = triangle.n

or

     n = V.cell().n

where V is a FunctionSpace. FacetNormal(mesh) will work again in 0.9.5 
when it's released.

Garth

For example the 3-line program
> _______________________________________________
> FEniCS-users mailing list
> [email-masked]
> http://fenics.org/mailman/listinfo/fenics-users