<div dir="ltr">On Thu, Sep 26, 2013 at 11:10 AM, Mark F. Adams <span dir="ltr"><<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">What Chombo usually does, which is not great but it simplifies things greatly, is fill ghost cells with, for instance, the negative of the boundary cell for low order homogenous Dirichlet BCs, then run your kernel (once), rinse and repeat. I can do this in my FormFunction routine. I was thinking this would be problem for G-S smoothers. Chombo calls a setBC method in our G-S code to do this but I'm guessing PETSc does not. Now I'm thinking I can just use damped Jacob, using my operator, and that should take care of all places where the stencil is used. This is constant coefficient Laplacian and am just trying to get a mock up code to do SR.<br>
</blockquote><div><br></div><div>We have ghost cells in TS ex11, and I think we do them the correct way :) We have a function you register that fills them up, and we</div><div>loop over them explicitly.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Also, I know this is a dumb question, and I don't really need to know this, but I can't understand this, and am very curious how code like this can work:<br>
<br>
PetscScalar **array;<br>
ierr = DMDAVecGetArray(da, b, &array);CHKERRQ(ierr);<br>
for (j=ys; j<ys+ym; j++) {<br>
for (i=xs; i<xs+xm; i++) {<br>
array[j][i] = ….<br>
}<br>
}<br>
<br>
This is fantastic. You seem to be doing arbitrary(ish) indexing into a multidimensional, dynamically sized, array. Just like fortran. I never knew you could do this and can not see how the compiler even implements this as you are not even telling it any dimension as far as I can see. I obviously missing something very simple here.<br>
</blockquote><div><br></div><div>This is one of the most successful Barryisms. We construct the multi-dimensional array by-hand, putting in the correct pointers</div><div>to the relevant parts of the 1D array in the Vec.</div>
<div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Mark<br>
<br>
On Sep 26, 2013, at 12:36 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br>
<br>
><br>
> For vertex centered finite differences it is easy, one simply does not include the boundary nodes in the DMDA and then puts the actual Dirichlet values into the ghost slots.<br>
><br>
> For cell centered since the boundary value is the average of the ghost cell and the first cell I don't know how to do this because I don't know what one should put into the ghost location. Maybe include the "ghost" cell as a real point (don't use boundary_ghosted) and make the equation for that last cell force the average of that slot and its neighbor to equal the Dirichlet value.<br>
><br>
><br>
> Barry<br>
><br>
> On Sep 26, 2013, at 11:28 AM, Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>> wrote:<br>
><br>
>> On Thu, Sep 26, 2013 at 9:25 AM, Mark F. Adams <<a href="mailto:mfadams@lbl.gov">mfadams@lbl.gov</a>> wrote:<br>
>> I am interested in making a cell centered test problem with Dirichlet BCs. I want to go high(ish) order and doing explicit stencils (preferred) looks rather messy and I am interest in using ghost cells. I assume this would entail using DMDA_BOUNDARY_GHOSTED. I do not see any examples or documentation on using this other than just creating it. Any suggestions? I would think that there would have to be callback function for the user to set ghost values but I am not seeing anything like this around. Perhaps I am not understand the intent of DMDA_BOUNDARY_GHOSTED.<br>
>><br>
>> My understanding is that it adds a single layer of ghost cells around the domain boundary. Then these show up in the gxm, etc. so that<br>
>> you can put values there if you want.<br>
>><br>
>> Matt<br>
>><br>
>><br>
>> Mark<br>
>><br>
>><br>
<span class="HOEnZb"><font color="#888888">>><br>
>> --<br>
>> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
>> -- Norbert Wiener<br>
><br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener
</div></div>