[Dune] Re-ordering of elements in ALUGrid and boundarySegmentIndex()

Sacconi, Andrea a.sacconi11 at imperial.ac.uk
Thu May 15 16:06:59 CEST 2014


Hi Carsten,

thanks again for your answer. 
The way you described is precisely the procedure I have followed so far, and it works perfectly with Alberta. To use your example, the insertionIndex 2 is mapped into boundarySegmentIndex index 42, so I keep track of the 42 and I assign Neumann or Dirichlet appropriately.

Unfortunately, when I switch to ALUGird, the two numbers are the same, so the mapping I need apparently doesn't work. Maybe I'm doing a silly mistake, but I fail to see where, since I just change the grid manager, so one line in the code.

I will further look into this and keep you posted.
Cheers,
Andrea
__________________________________________________________

Andrea Sacconi
PhD student, Applied Mathematics
AMMP Section, Department of Mathematics, Imperial College London,
London SW7 2AZ, UK
a.sacconi11 at imperial.ac.uk

________________________________________
From: Carsten Gräser [graeser at mi.fu-berlin.de]
Sent: 15 May 2014 14:59
To: Sacconi, Andrea; dune at dune-project.org
Subject: Re: [Dune] Re-ordering of elements in ALUGrid and boundarySegmentIndex()

Hi,

Am 15.05.2014 14:56, schrieb Sacconi, Andrea:
> Hi Carsten,
>
> thanks for your prompt answer! But there is still something not clear
> to me.
> I have already been using both insertionIndex() and
> boundarySegmentIndex() methods, which for the same intersection can
> return two different integers. I thought that the permutation from the
yes, that's the result of the reordering. Perhaps it was not clear
enough so I'll provide more details

If you want to assign data to some specific boundary segment you
first have to remembere when you inserted it. Let's assume it was
the 3rd inserted segment.

After grid creation you have to loop over all intersections, and
ask the factory for the insertionIndex. If it gives you 2 (zero based
indices!) you know you've found the correct one. Then you ask this
intersection for the segment index. If this gives 42, then you now that
you have to assign your data to all intersections with segment index 42.

> order of insertion (i.e., insertionIndex()) to the actual index
> assigned to the segment (i.e., boundarySegmentIndex()) was the mapping
> I needed to associate b.c. correctly, but apparently it is not enough.
> What do I have to do more?
Yes it is the mapping and I hope the example makes it more clear. If it
does not work this way please file a bug report using a simple test
case.

Best,
Carsten

>
> Thanks again!
> Andrea
> __________________________________________________________
>
> Andrea Sacconi
> PhD student, Applied Mathematics
> AMMP Section, Department of Mathematics, Imperial College London,
> London SW7 2AZ, UK
> a.sacconi11 at imperial.ac.uk
>
> ________________________________________
> From: Carsten Gräser [graeser at mi.fu-berlin.de]
> Sent: 15 May 2014 12:50
> To: dune at dune-project.org; Sacconi, Andrea
> Subject: Re: [Dune] Re-ordering of elements in ALUGrid and boundarySegmentIndex()
>
> Hi Andrea,
> indeed the grid interface allows that entities and boundary segments are
> reordered during creation time. Hence you need to know the reordering
> map if you want to associate data to entities or boundary intersections.
>
> After the grid was created you can use the insertionIndex() methods of
> the grid factory for the insertion index of entities/intersections,
> i.e. the index wrt. the insertion order. At the same time you can ask
> the grid for the level index/leaf index/id of entities and the segment
> index associated to intersections allowing you to reconstruct this map.
>
> So mapping the indices using the insertionIndex method should solve
> your problem.
>
> Best,
> Carsten
>
>
>
>
> Am 15.05.2014 13:39, schrieb Sacconi, Andrea:
>> Hi all,
>>
>> I am experiencing a problem I can't solve, maybe you will be able to shed some light on it.
>>
>> I am using ALUGrid as grid manager; I pass to the grid factory the complete list of vertices, elements and boundary faces, and then I create the grid.
>> First point, I noticed that ALUGrid performs a re-ordering of the elements.
>> Now, the problem is, when I traverse the intersections and extract the boundarySegmentIndex() to which I associated somewhere else the appropriate b.c., everything goes wrong, i.e. Neumann and Dirichlet conditions got mixed up on the boundary. I clearly see this from the vtk output: my solution is not the one which is supposed to be.
>>
>> Does the element re-numbering affect the boundarySegmentIndex()? I switched to Alberta as grid manager, wiithout changing anything else, and in that case the programme works fine.
>> Am I missing something about ALUGrid I should be aware of?
>>
>> Thanks in advance!
>> Cheers,
>> Andrea




More information about the Dune mailing list