[Dune] centerUnitOuterNormal() in UGGrid

Eike Mueller e.mueller at bath.ac.uk
Mon Sep 16 16:30:21 CEST 2013


Dear DUNE-list,

is centerUnitOuterNormal() for the (3d-) UGGrid guaranteed to give the 
OUTER normal in all cases?
in other word, should the following code, which calculates the scalar 
product of the outer normal and the distance between the center of the 
cell and center of its the intersection with the neighbouring cell 
always print out positive values? [Ok, of course one could construct 
some weird mapping from the reference elements to 3d such that this is 
not the case, but for the grid I'm looking at the cells are 
approximately prisms].

iend = gv.template end<0,Dune::Interior_Partition>()
for (Iterator it =gv.template 
begin<0,Dune::Interior_Partition>();it!=;++it) {
     Entity &en = *it;
     typename Entity::Geometry::GlobalCoordinate    centerEn = 
en.geometry().center();
     IntersectionIterator isend = gv.iend()
     for (IntersectionIterator is = gv.ibegin(en);is!=isend; ++is)
     {
         typename Entity::Geometry::GlobalCoordinate    normal = 
is.centerUnitOuterNormal();
         typename Entity::Geometry::GlobalCoordinate    centerIs = 
is.geometry().center();
         centerIs -= centerEn;
         std::cout << " Normal * (centerIs - centerEn)" << 
normal*centerIs << std::endl;
     }
}

I found that I sometimes get negative values in a cell (and all it's 
children which share the same boundary).
In my case, I actually need the dot product between the outer normal and 
the distance between the cell and it's neighbours, and I can fix the 
problem by just adding an fabs(), but I was slightly surprised by this 
behaviour which I did not see in ALUGrid.

Thanks a lot,

Eike




More information about the Dune mailing list