<div dir="ltr">Hi Petsc Users, <br clear="all"><div><br>I'm working with a dmplex system with a subsampled mesh distributed with an overlap of 1. <br><br>I'm encountering unusual situations when using VecGetOwnershipRange to adjust the offset received from a global section. The logic of the following code is first to get the offset needed to index a global vector while still being able to check if it is an overlapped cell and skip if needed while counting the owned cells. <br><br><div style="color:rgb(255,255,255);background-color:rgb(0,36,81);font-family:Consolas,"Courier New",monospace;font-size:14px;line-height:19px;white-space:pre"><div>
<div style="line-height:19px"><div><span style="color:rgb(235,187,255)">call</span> DMGetGlobalSection(dmplex,section,ierr)</div></div>
<div style="line-height:19px"><div><span style="color:rgb(235,187,255)">call</span> VecGetArrayF90(stateVec,stateVecV,ierr)</div><div><span style="color:rgb(235,187,255)">call</span> VecGetOwnershipRange(stateVec,oStart,oEnd,ierr)</div></div><span style="color:rgb(235,187,255)">do</span> i <span style="color:rgb(153,255,255)">=</span> c0, (c1<span style="color:rgb(255,197,143)">-1</span>)</div><div> </div><div> <span style="color:rgb(235,187,255)">call</span> PetscSectionGetOffset(section,i,offset,ierr)</div><div> <span style="color:rgb(235,187,255)">write</span>(<span style="color:rgb(153,255,255)">*</span>,<span style="color:rgb(153,255,255)">*</span>) <span style="color:rgb(209,241,169)">"cell"</span>,i,<span style="color:rgb(209,241,169)">"offset"</span>,offset,<span style="color:rgb(209,241,169)">'oStart'</span>,oStart, offset<span style="color:rgb(153,255,255)">-</span>oStart</div><div> </div><div> <span style="color:rgb(235,187,255)">if</span>(offset<span style="color:rgb(153,255,255)"><</span><span style="color:rgb(255,197,143)">0</span>) <span style="color:rgb(235,187,255)">then</span></div><div> <span style="color:rgb(235,187,255)">cycle</span></div><div> <span style="color:rgb(235,187,255)">endif</span></div><div> offset<span style="color:rgb(153,255,255)">=</span>offset<span style="color:rgb(153,255,255)">-</span>oStart
</div><div style="line-height:19px"><div> plexcells<span style="color:rgb(153,255,255)">=</span>plexcells<span style="color:rgb(255,197,143)">+1</span></div></div> stateVecV(offset)= <set to something>
enddo
<div> </div></div><br>I'm noticing some very weird results that I've appended below. The GetOffset documentation notes that a negative offset indicates an unowned point (which I use to cycle). However, the offset subtraction with oStart will yield an illegal index for the Vector access. I see that on the documentation for GetOwnershipRange, it notes that this may be "ill-defined" but I wanted to see if this is type of ill-defined I can expect or there is just something terribly wrong with my PetscSection.(both the Vec and Section were produced from DMPlexDistributeField so should by definition have synchronized section information) I was wondering if there is a possible output and/or the best way to index the vector. I'm thinking of subtracting the offset of cell 0 perhaps?</div><div><br>on rank 0<br><br> cell 0 offset 0 oStart 0 0<br> cell 1 offset 55 oStart 0 55<br> cell 2 offset 110 oStart 0 110<br> cell 3 offset 165 oStart 0 165<br> cell 4 offset 220 oStart 0 220<br> cell 5 offset 275 oStart 0 275<br> cell 6 offset 330 oStart 0 330<br> cell 7 offset 385 oStart 0 385<br> cell 8 offset 440 oStart 0 440<br> cell 9 offset 495 oStart 0 495<br> cell 10 offset 550 oStart 0 550<br> cell 11 offset 605 oStart 0 605<br> cell 12 offset 660 oStart 0 660<br> cell 13 offset 715 oStart 0 715<br><br>and on rank one <br>cell 0 offset 2475 oStart 2640 -165<br> cell 1 offset 2530 oStart 2640 -110<br> cell 2 offset 2585 oStart 2640 -55<br> cell 3 offset 2640 oStart 2640 0<br> cell 4 offset 2695 oStart 2640 55<br> cell 5 offset 2750 oStart 2640 110<br> cell 6 offset 2805 oStart 2640 165<br></div> cell 7 offset 2860 oStart 2640 220<br> cell 8 offset 2915 oStart 2640 275<br> cell 9 offset 2970 oStart 2640 330<br> cell 10 offset 3025 oStart 2640 385<br> cell 11 offset 3080 oStart 2640 440<br> cell 12 offset 3135 oStart 2640 495<br> cell 13 offset 3190 oStart 2640 550<br> cell 14 offset 3245 oStart 2640 605<br> cell 15 offset -771 oStart 2640 -3411<br><br><br>Sincerely<br>Nicholas<br><br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div style="font-family:arial;font-size:small"><font color="#000000">Nicholas Arnold-Medabalimi<br><br></font><span style="font-family:sans-serif;font-size:14px">Ph.D. Candidate</span><font color="#000000"><br>Computational Aeroscience Lab<br>University of Michigan</font></div></div></div></div></div></div>