<div dir="ltr"><div dir="ltr">On Mon, Aug 29, 2022 at 10:22 AM Lawrence Mitchell <<a href="mailto:wence@gmx.li">wence@gmx.li</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">On Mon, 29 Aug 2022 at 14:55, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:<br>
><br>
> On Sun, Aug 28, 2022 at 7:17 PM Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:<br>
>><br>
>> On Sun, Aug 28, 2022 at 5:36 PM Mike Michell <<a href="mailto:mi.mike1021@gmail.com" target="_blank">mi.mike1021@gmail.com</a>> wrote:<br>
>>><br>
>>> Thank you for the reply.<br>
>>><br>
>>> I think it can be more helpful for me if the attached sample code (DMInterpolation_Mod.tar) could be checked by you.<br>
>><br>
>><br>
>> Okay, you are right. I will run it tomorrow.<br>
><br>
><br>
> The problem was somewhat conceptual. When you are restricting state, meaning a function you want to use directly, rather than<br>
> residuals, meaning some average or integral, you want to preserve scale. This is what the 'vscale' vector is for. I added the<br>
> VecPointwiseMult to your code (attached) to do this. I also changed to a more general mehs creation. To get your run, use<br>
<br>
The right answer is to use DMCreateInjection<br>
(<a href="https://petsc.org/release/docs/manualpages/DM/DMCreateInjection.html" rel="noreferrer" target="_blank">https://petsc.org/release/docs/manualpages/DM/DMCreateInjection.html</a>)<br>
to move fine grid state to coarse grid state (rather than<br>
DMCreateInterpolation and then VecPointwiseMult, which doesn't work<br>
for most discretisations).<br>
<br>
Matt: the interface to DMCreateInjection is now correct (it returns a<br>
Mat, rather than a VecScatter) so DMPlexComputeInjectorFEM<br>
(<a href="https://petsc.org/release/docs/manualpages/DMPLEX/DMPlexComputeInjectorFEM.html" rel="noreferrer" target="_blank">https://petsc.org/release/docs/manualpages/DMPLEX/DMPlexComputeInjectorFEM.html</a>)<br>
should be updated to take advantage.<br></blockquote><div><br></div><div>I am not sure Injection is going to "do the right thing" when you move between spaces. At least my memory of the implementation</div><div>was that it just did local interpolation, which is not right when injecting P0 into P1.</div><div><br></div><div>  Thanks,</div><div><br></div><div>      Matt</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Lawrence<br>
</blockquote></div><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>