still Schur complement

Matthew Knepley knepley at gmail.com
Mon Mar 17 10:13:18 CDT 2008


On Mon, Mar 17, 2008 at 7:20 AM, Kathrin Burckhardt
<tribur at vision.ee.ethz.ch> wrote:
> Dear all,
>
>  My problem, once again and more concrete:
>
>  I have given the local Schur matrices Si and I would like to set-up the
>  global matrix S without assembling the Si on one processor.
>
>  I thought "MATIS" is the suitable matrix type, but I don't succeed in
>  using it. My code is:
>
>      IS is;
>      ISCreateGeneral(PETSC_COMM_SELF, NPb, &uBId_global[0], &is);
>      ISLocalToGlobalMapping mapping;
>      ISLocalToGlobalMappingCreateIS(is, &mapping);
>      Mat Stot;
>      MatCreate(PETSC_COMM_WORLD,&Stot);
>      MatSetLocalToGlobalMapping(Stot, mapping);
>      MatSetSizes(Stot,NPb,NPb,NPb_tot,NPb_tot);
>      MatSetType(Stot,MATIS);
>     //or, alternatively
>     //MatCreateIS(PETSC_COMM_WORLD,NPb,NPb,NPb_tot,NPb_tot,mapping,&Stot);
>      for(int i=0; i<NPb; i++)
>        for(int j=0; j<NPb; j++)
>         MatSetValuesLocal(Stot, 1, &i, 1, &j, &S(i+1,j+1), ADD_VALUES);
>
>  And I got the error
>
>  [1]PETSC ERROR: MatSetValuesLocal() line 1471 in
>  src/mat/interface/matrix.c
>  [1]PETSC ERROR: --------------------- Error Message
>  ------------------------------------
>  [1]PETSC ERROR: Object is in wrong state!
>  [1]PETSC ERROR: Object Type not set: Argument # 1!
>
>  Can you tell me what's wrong?

It appears the code snipper above should work, however it is usually
because something in the actual code was not sent. Also, if the type
was not set, it should fail on all processes. I would go in with the
debugger and look at Stot to make sure it has a type. You can also
call the MatValidType(mat,1) method explicitly in your code to check.

However, I have another question. Are you sure that you want MATIS
for the Schur complement? This seems strange to me. You usually
want unassembled matrices for subdomain problems. What is wrong
with just assembling it (if you indeed have the local pieces)?

   Thanks,

      Matt

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which
their experiments lead.
-- Norbert Wiener




More information about the petsc-users mailing list