[Dune] centerUnitOuterNormal() in UGGrid

Eike Mueller e.mueller at bath.ac.uk
Wed Sep 18 11:27:31 CEST 2013


Hi Oliver,

thanks for looking into this and confirming that it is not a bug but 
rather a problem with my grid - several of my elements did indeed have 
the wrong orientation, i.e. the vertices were not in the correct order. 
The problem did not show up in ALUGrid as there the grid was 2d instead 
of 3d.
I now fixed my code which generates the .dgf grid files such that it 
writes out correctly oriented elements, and then centerUnitOuterNormal() 
shows the expected behaviour.

Apologies for the confusion,

Eike

On 16/09/13 16:24, Oliver Sander wrote:
> Hi Eike,
> that sounds like a bug.  You are right in expecting a method call 
> '*OuterNormal'
> to return an outer normal.  Can you send a complete test case that 
> reproduces
> the problem?
> Cheers,
> Oliver
>
> Am 16.09.2013 16:30, schrieb Eike Mueller:
>> 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
>>
>> _______________________________________________
>> Dune mailing list
>> Dune at dune-project.org
>> http://lists.dune-project.org/mailman/listinfo/dune
>
>
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune





More information about the Dune mailing list