still Schur complement

Barry Smith bsmith at
Wed Mar 19 15:04:36 CDT 2008


      The MATIS object (the IS stands for iterative substructuring) is  
really only good
if you want to use the PETSc Neumann-Neumann preconditioner PCNN. This  
is rarely used.

    Anyways the problem is the lack of clarity of the meaning of the  
sizes. The size of
the IS passed to the MatSetLocalToGlobalMapping() is NOT the same as  
the local size
passed to MatSetSizes(). It is the number of local unknowns plus the  
number of ghost nodes.
The local sizes passed to MatSetSizes() is the size of the part of the  
vector that belongs
to that processor.


On Mar 17, 2008, at 4:54 PM, Kathrin Burckhardt wrote:

> Dear Lisandro,
>> I'm not completelly sure what are you actually trying to do. It seems
>> you know how to actually compute the local Schur complement in a
>> entry-by-entry basis. In that case, your way is semms to be OK.
> What do you mean with entry-by-entry basis? Anyway, I have the local  
> Schur complement explicitely, in form of a matrix (or C++ vector).
>> However, you get a error because of a inner implementation detail of
>> MATIS.  Do de following: set the local-to-global mapping AFTER  
>> setting
>> the matrix type. This way, your code should now work.
> Unfortunately, changing the order of the Mat-commands gives me the  
> same error. I guess I found the origin of the problem:
> I put it in the order below because I thought to avoid
> [2]PETSC ERROR: Sum of local lengths 3916 does not equal global  
> length 1958
> which is due to the fact that in the case of 2 Subdomains and 2  
> processors, e.g., it is NPb=NPb_tot in the Schur system, instead of  
> NPb=NPb_tot/2. However, I realize just now that the order of the Mat- 
> commands has no influence on this, and that the error mentioned  
> below has probably its origin there.
> I have chosen MATIS because in the manual page of MatCreateIS() it  
> is written "...m and n are NOT related to the size of the map", but  
> maybe I understand this setence wrong? How can I choose m,n and M,N  
> independently?
>> On 3/17/08, Kathrin Burckhardt <tribur at> 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),  
>>> 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?

More information about the petsc-users mailing list