This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

How can I know a given mesh's FacetNormals on every interior facets?

+1 vote

For example :

from dolfin import * 
mesh = UnitSquareMesh(3,3)
n = FacetNormal(mesh)
cc = Facet(mesh,0)

Then how can I know the normal vector on "cc"?
Thanks!
And can I change the direction of the normal vector on a facet?

asked Nov 7, 2014 by motianlunfenics FEniCS Novice (310 points)
edited Nov 7, 2014 by motianlunfenics

I know how to calculate the vector of a given facet, here we give '0':

from dolfin import * 
mesh = UnitSquareMesh(3,3)
n = FacetNormal(mesh)
cc = Facet(mesh,0)
cc_normal_vec = [cc.normal().x(), cc.normal().y(),cc.normal().z()]

But I still don't know how to change the direction of it !

What about

cc_normal_vec = -[cc.normal().x(), cc.normal().y(),cc.normal().z()]

?

Perhaps it can't , because I want to change it but not get the opposite direction ,for I want to integrate on some interior facets with given direction by myself! Thank you all the same!

1 Answer

+1 vote

Facet has a member function Facet::normal:

from dolfin import *
mesh = UnitSquareMesh(3, 3)
cc = Facet(mesh, 0)
n = cc.normal()
print n.str(True)
answered Nov 11, 2014 by Garth N. Wells FEniCS Expert (35,930 points)

Thank you, I don't know it before your words !

...