<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Message: 2<br>
Date: Sat, 30 May 2015 18:05:31 +0800<br>
From: Rongliang Chen <<a href="mailto:rongliang.chan@gmail.com">rongliang.chan@gmail.com</a>><br>
To: PETSc Users mail list <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>><br>
Subject: [petsc-users] NASM FormFunctionLocal<br>
Message-ID:<br>
        <<a href="mailto:CAOoA1QUTVYwBxr6c2NkztK%2BOZqrkGQsj9hP8_6E4XyPKWxebAg@mail.gmail.com">CAOoA1QUTVYwBxr6c2NkztK+OZqrkGQsj9hP8_6E4XyPKWxebAg@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi there,<br>
<br>
I am trying to use NASM to solve a nonlinear problem. In my<br>
FormFunctionLocal, I need to call DMDAVecGetArray(da, myvec, z). For the<br>
"-da_overlap 0" case, the code works fine.<br>
<br>
For the "-da_overlap 1" case, when I use the vector "myvec" created by<br>
DMCreateLocalVector, it works fine. But if I use the vector "myvec" created<br>
by DMCreateGlobalVector, I got the error messages:<br>
-----------------------<br>
[6]Arguments are incompatible<br>
[6]PETSC ERROR: Vector local size 597870 is not compatible with DMDA local<br>
sizes 619528 664392<br>
----------------------<br>
<br>
And when I switch to "-da_overlap 2", both of the global and local version<br>
of "mrvec" got error messages:<br>
----------------------------------<br>
[10]PETSC ERROR: Arguments are incompatible<br>
[10]PETSC ERROR: Vector local size 589680 is not compatible with DMDA local<br>
sizes 633144 678680<br>
<br>
[3]PETSC ERROR: Arguments are incompatible<br>
[3]PETSC ERROR: Vector local size 619528 is not compatible with DMDA local<br>
sizes 650256 696540<br>
-----------------------------------<br>
<br>
Can any one tell me how to use DMDAVecGetArray in FormFunctionLocal for<br>
NASM? Thanks.<br>
<br>
Best regards,<br>
Rongliang<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150530/95f3c7b3/attachment-0001.html" target="_blank">http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150530/95f3c7b3/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Sat, 30 May 2015 09:55:42 -0500<br>
From: Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>><br>
To: Rongliang Chen <<a href="mailto:rongliang.chan@gmail.com">rongliang.chan@gmail.com</a>><br>
Cc: PETSc Users mail list <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>><br>
Subject: Re: [petsc-users] NASM FormFunctionLocal<br>
Message-ID:<br>
        <<a href="mailto:CAMYG4GmceYNTQnxFNTifPJ%2B5O39x3Rq1sMuY7mgDvt4WvJjiWA@mail.gmail.com">CAMYG4GmceYNTQnxFNTifPJ+5O39x3Rq1sMuY7mgDvt4WvJjiWA@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
On Sat, May 30, 2015 at 5:05 AM, Rongliang Chen <<a href="mailto:rongliang.chan@gmail.com">rongliang.chan@gmail.com</a>><br>
wrote:<br>
<br>
> Hi there,<br>
><br>
> I am trying to use NASM to solve a nonlinear problem. In my<br>
> FormFunctionLocal, I need to call DMDAVecGetArray(da, myvec, z). For the<br>
> "-da_overlap 0" case, the code works fine.<br>
><br>
> For the "-da_overlap 1" case, when I use the vector "myvec" created by<br>
> DMCreateLocalVector, it works fine. But if I use the vector "myvec" created<br>
> by DMCreateGlobalVector, I got the error messages:<br>
> -----------------------<br>
> [6]Arguments are incompatible<br>
> [6]PETSC ERROR: Vector local size 597870 is not compatible with DMDA local<br>
> sizes 619528 664392<br>
> ----------------------<br>
><br>
> And when I switch to "-da_overlap 2", both of the global and local version<br>
> of "mrvec" got error messages:<br>
> ----------------------------------<br>
> [10]PETSC ERROR: Arguments are incompatible<br>
> [10]PETSC ERROR: Vector local size 589680 is not compatible with DMDA<br>
> local sizes 633144 678680<br>
><br>
> [3]PETSC ERROR: Arguments are incompatible<br>
> [3]PETSC ERROR: Vector local size 619528 is not compatible with DMDA local<br>
> sizes 650256 696540<br>
> -----------------------------------<br>
><br>
> Can any one tell me how to use DMDAVecGetArray in FormFunctionLocal for<br>
> NASM? Thanks.<br>
><br>
<br>
1) You have to show the full error messages<br>
<br>
2) You should simplify the problem for debugging. Run on 1 or 2 processes<br>
<br>
3) The vector that comes into FormFunctionLocal() is a local vector<br>
<br>
  Thanks,<br>
<br>
    Matt<br>
<br>
<br>
> Best regards,<br>
> Rongliang<br>
><br>
><br></blockquote><div><br></div><div><br></div><div>To use  the FormFunctionLocal, your input has to be local vector. If you want to use the global vector as your input, you can add one function to scatter global vector to local vector.</div><div><br></div><div><br></div><div>Thanks,</div><div><br></div><div>Fande,</div></div><br></div></div>