<div dir="ltr">Hi,<div><br></div><div>thanks for the very quick reply.</div><div><br></div><div>One more question: is there a way to get the lx and ly from the first dm and use them (modified) for the second dm? DMDAGetInfo does not seem to provide this information.</div><div><br></div><div>Thanks again for your help</div><div><br></div><div>Gianluca</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 11, 2015 at 8:12 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
When you create the 2 DM you must be set the lx, ly arguments (the ones you set to 0) in your code carefully to insure that the vectors for the 2 DM you create have compatible layout to do the matrix vector product.<br>
<br>
You can run a very small problem with 2 processors and printing out the vectors to see the layout to make sure you get it correct.<br>
<br>
The 2 DM don't have any magically way of knowing that you created another DMDA and want it to be compatible automatically.<br>
<br>
Barry<br>
<br>
DMDACreate2d(PETSC_COMM_WORLD , DM_BOUNDARY_GHOSTED , DM_BOUNDARY_GHOSTED , DMDA_STENCIL_BOX ,<br>
Mx , Nx , PETSC_DECIDE , PETSC_DECIDE , 1 , 0 , 0 , 0 , &dax);<br>
DMDACreate2d(PETSC_COMM_WORLD , DM_BOUNDARY_NONE , DM_BOUNDARY_NONE , DMDA_STENCIL_BOX ,<br>
Mx-2*bs , Nx-2*bs , PETSC_DECIDE , PETSC_DECIDE , 1 , 0 , 0 , 0 , &daf);<br>
<div><div class="h5"><br>
> On Nov 11, 2015, at 10:05 PM, Gianluca Meneghello <<a href="mailto:gianmail@gmail.com">gianmail@gmail.com</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> I am trying to do something apparently really simple but with no success.<br>
><br>
> I need to perform a matrix-vector multiplication x = B f , where the length of x is bigger than the length of f (or viceversa). Thus, B cannot be created using DMCreateMatrix.<br>
><br>
> Both x and f are obtained from different DMs, the smaller covering only a subdomain of the larger. The application is to apply a control f to a system, e.g. \dot{x} = A x + B f.<br>
><br>
> The problem is, when running on more than one core, the vector x is not organized as I would expect (everything works fine on a single core).<br>
><br>
> I attach a short example where B is intended to map f to the interior of x.<br>
><br>
> mpirun -n 1 ./test -draw_pause -1 works fine while<br>
> mpirun -n 2 ./test -draw_pause -1 shows the problem<br>
><br>
> I have not found any example with non square matrices in the src folder, any help is very welcome.<br>
><br>
> Thanks for your time,<br>
><br>
> Gianluca<br>
</div></div>> <test.cpp><br>
<br>
</blockquote></div><br></div>