[petsc-users] [PATCH 2/2] Call KSPSetFromOptions before setting fieldsplit-specific options
Jed Brown
jedbrown at mcs.anl.gov
Sun Sep 8 01:43:32 CDT 2013
Umut Tabak <u.tabak at tudelft.nl> writes:
> Maybe a naive question but on this simple system the solution is wrong
> at the moment which is surprising to me, could you see immediately the
> reason of this?
>
> I run with
>
> ./ex2 -pc_type fieldsplit
>
> And get
>
> 0.0909091
> 0.0909091
> 0
> 0
>
> as the solution vector.
Your splits were both the same, so the preconditioner was applied twice
to the first block and zero to the second block. That made the
preconditioner singular.
ISCreateBlock(PETSC_COMM_SELF,bs,n1,inputindices,PETSC_COPY_VALUES,&is_row1);
ISCreateBlock(PETSC_COMM_SELF,bs,n2,inputindices,PETSC_COPY_VALUES,&is_row2);
We could check for this case, but it would require a little code and
isn't currently done. This is probably what you wanted:
diff --git i/ex2.c w/ex2.c
index 94cea2c..0cce3e6 100644
--- i/ex2.c
+++ w/ex2.c
@@ -45,7 +45,7 @@ int main(int argc,char **args)
PetscInt bs = 2, n1=1, n2=1, inputindices[]={0,1}; /* block size is 2 */
ISCreateBlock(PETSC_COMM_SELF,bs,n1,inputindices,PETSC_COPY_VALUES,&is_row1);
- ISCreateBlock(PETSC_COMM_SELF,bs,n2,inputindices,PETSC_COPY_VALUES,&is_row2);
+ ISCreateBlock(PETSC_COMM_SELF,bs,n2,inputindices+n1,PETSC_COPY_VALUES,&is_row2);
ISView(is_row1,PETSC_VIEWER_STDOUT_SELF);
ISView(is_row2,PETSC_VIEWER_STDOUT_SELF);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130908/72817de0/attachment.pgp>
More information about the petsc-users
mailing list