<div dir="ltr"><div dir="ltr">On Thu, Dec 5, 2019 at 12:34 PM Ellen M. Price <<a href="mailto:ellen.price@cfa.harvard.edu">ellen.price@cfa.harvard.edu</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I think I'm still unclear on exactly how this should work. Suppose, in<br>
my RHS function for TS, I'm processing the grid to compute its time<br>
derivative and get to an edge. What do I do?<br></blockquote><div><br></div><div>The idea here, I think, is that you keeping using your normal stencil. If you tell</div><div>PETSc that the edge is a mirror boundary, it will have automatically put a value</div><div>in the ghost location that will force a 0 spatial derivative.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
If I set the derivative there to zero, the value will never change, but<br>
it *should* change so that the spatial derivative there is zero.<br>
<br>
If I set it to the value it would get if it wasn't an edge, then the<br>
derivative isn't preserved anymore.<br>
<br>
This is where I get stuck.<br>
<br>
Ellen<br>
<br>
<br>
On 12/5/19 10:16 AM, Smith, Barry F. wrote:<br>
> <br>
> Are you using cell-centered or vertex centered discretization ( makes a slight difference)?<br>
> <br>
> Our model is to use DM_BOUNDARY_MIRROR DMBoundaryType. This means that u_first_real_grid_point - u_its_ghost_point = 0 (since DMGlobalToLocal will automatically put into the physical ghost location the appropriate mirror values) thus u_n is zero along the edge; zero Neumann conditions, for non-zero Neuman you need to put something in the "local rhs" to represent that, I'm not sure it is clear, but think about it in one dimension for the non-zero Neumann case.<br>
> <br>
> Bad news not yet implemented for 3d.<br>
> <br>
> If you are using 3d we should fix this for you (or you fix it and make a MR because we should have this support). <br>
> <br>
> If you have a 2d version of your code I would test with 3d your model etc and then let us know and request how we can get the 3d mirror written.<br>
> <br>
> Others may have alternative advice for Neumann with DMDA,<br>
> <br>
> Barry<br>
> <br>
> <br>
>> On Dec 5, 2019, at 10:00 AM, Ellen M. Price <<a href="mailto:ellen.price@cfa.harvard.edu" target="_blank">ellen.price@cfa.harvard.edu</a>> wrote:<br>
>><br>
>> Hi PETSc users,<br>
>><br>
>> I am working with a code that solves a set of PDEs on a rectangular<br>
>> domain with Neumann boundary conditions. My understanding of<br>
>> implementing the boundary condition is that I should set the boundary<br>
>> value to be the value that makes the finite difference derivative go to<br>
>> zero (or some other prescribed value) on that boundary.<br>
>><br>
>> I was attempting to update the solution from TS using a pre- or<br>
>> post-step/stage function and TSGetSolution, but this does not appear to<br>
>> work as expected. What would be the correct way to prescribe the<br>
>> boundary condition, given that I'm using TSRK for timestepping and a<br>
>> DMDA for discretization?<br>
>><br>
>> Looking forward to any help!<br>
>><br>
>> Ellen Price<br>
> <br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>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><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>