On Mon, 29 Aug 2022 at 14:55, Matthew Knepley <knep...@gmail.com> wrote: > > On Sun, Aug 28, 2022 at 7:17 PM Matthew Knepley <knep...@gmail.com> wrote: >> >> On Sun, Aug 28, 2022 at 5:36 PM Mike Michell <mi.mike1...@gmail.com> wrote: >>> >>> Thank you for the reply. >>> >>> I think it can be more helpful for me if the attached sample code >>> (DMInterpolation_Mod.tar) could be checked by you. >> >> >> Okay, you are right. I will run it tomorrow. > > > The problem was somewhat conceptual. When you are restricting state, meaning > a function you want to use directly, rather than > residuals, meaning some average or integral, you want to preserve scale. This > is what the 'vscale' vector is for. I added the > VecPointwiseMult to your code (attached) to do this. I also changed to a more > general mehs creation. To get your run, use
The right answer is to use DMCreateInjection (https://petsc.org/release/docs/manualpages/DM/DMCreateInjection.html) to move fine grid state to coarse grid state (rather than DMCreateInterpolation and then VecPointwiseMult, which doesn't work for most discretisations). Matt: the interface to DMCreateInjection is now correct (it returns a Mat, rather than a VecScatter) so DMPlexComputeInjectorFEM (https://petsc.org/release/docs/manualpages/DMPLEX/DMPlexComputeInjectorFEM.html) should be updated to take advantage. Lawrence