<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi all,<br>
    I am using the ASM preconditioner and it works fine with regular
    options.<br>
    However I am having difficulties setting the Pmat operator for on of
    my ASM domain.<br>
    Here is what I coded:<br>
    <br>
    <font face="Courier New, Courier, monospace">         call
      PCASMSetLocalSubdomains(pcdd,2,isddi,isddi,ierr)<br>
               call PetscOptionsGetInt(PETSC_NULL_CHARACTER,<br>
           &        '-n_overlap',n_ol,chk,ierr)<br>
               if (chk.eqv.PETSC_TRUE) then<br>
                  call PCASMSetOverlap(pcdd,n_ol,ierr)<br>
               endif<br>
               call PCSetUp(pcdd,ierr)<br>
               call KSPSetUp(schurKSP,ierr)<br>
               call PCASMGetSubKSP(pcdd,nddl,fbl,ddsubksp, ierr)<br>
               <br>
               do i = 1,nddl<br>
                  if(i.eq.1) then<br>
                     if( (nstep.eq.1).and.(niter.eq.0) ) then<br>
                        call KSPGetOperators(ddsubksp(i),HKmat,<br>
           &                 HPmat,ierr)<br>
                     else<br>
                        call KSPGetOperators(ddsubksp(i),HKmat,<br>
           &                 PETSC_NULL_OBJECT,ierr)<br>
                     endif<br>
                     call PetscObjectReference(HKmat, ierr)<br>
                     call PetscObjectReference(HPmat, ierr)<br>
                     call KSPSetOperators(ddsubksp(i),HKmat,HPmat,ierr)<br>
                     call PetscObjectDereference(HKmat, ierr)<br>
                     call PetscObjectDereference(HPmat, ierr)<br>
                  endif<br>
                  call KSPGetPC(ddsubksp(i),ddsubpc(i),ierr)<br>
                  call PCSetType(ddsubpc(i),PCLU,ierr)<br>
                  call KSPSetType(ddsubksp(i),KSPPREONLY,ierr)<br>
               enddo</font><br>
    <br>
    I am suspecting that the PetscObjectReference is not working well
    based on the following output from valgrind:<br>
    <br>
    ==24001== Invalid read of size 4<br>
    ==24001==    at 0x8EDC69: PetscObjectReference (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x8F5778: petscobjectreference_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x4331A2: reuseschur_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x4297F5: feapuserpcapply_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xA3FB56: ourshellapply (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xD9BAE3: PCApply_Shell (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xD74AC3: PCApply (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xE0FE2D: KSPSolve_PREONLY (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xDFD7E3: KSPSolve (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xA41BEC: kspsolve_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x4288ED: usolve_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x460179: psolve_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==  Address 0x802ea30 is 64 bytes inside a block of size
    1,072 free'd<br>
    ==24001==    at 0x4C2BDEC: free (in
    /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)<br>
    ==24001==    by 0xA66C4C: PetscFreeAlign (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x95A5F6: MatDestroy (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x9672BC: MatDestroyMatrices (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xDDD221: PCReset_ASM (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xD73A26: PCReset (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xD73BB7: PCDestroy (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xDFFF53: KSPDestroy (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xA41C1F: kspdestroy_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x432F00: reuseschur_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x4297F5: feapuserpcapply_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xA3FB56: ourshellapply (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001== <br>
    ==24001== Invalid read of size 4<br>
    ==24001==    at 0x8EDC69: PetscObjectReference (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xD76924: PCSetOperators (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xE045DD: KSPSetOperators (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xA41B40: kspsetoperators_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x4331C4: reuseschur_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x4297F5: feapuserpcapply_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xA3FB56: ourshellapply (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xD9BAE3: PCApply_Shell (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xD74AC3: PCApply (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xE0FE2D: KSPSolve_PREONLY (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xDFD7E3: KSPSolve (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xA41BEC: kspsolve_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==  Address 0x802ea30 is 64 bytes inside a block of size
    1,072 free'd<br>
    ==24001==    at 0x4C2BDEC: free (in
    /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)<br>
    ==24001==    by 0xA66C4C: PetscFreeAlign (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x95A5F6: MatDestroy (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x9672BC: MatDestroyMatrices (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xDDD221: PCReset_ASM (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xD73A26: PCReset (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xD73BB7: PCDestroy (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xDFFF53: KSPDestroy (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xA41C1F: kspdestroy_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x432F00: reuseschur_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x4297F5: feapuserpcapply_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xA3FB56: ourshellapply (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001== <br>
    ==24001== Invalid read of size 8<br>
    ==24001==    at 0x96999F: MatGetNullSpace (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xE0468C: KSPSetOperators (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xA41B40: kspsetoperators_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x4331C4: reuseschur_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x4297F5: feapuserpcapply_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xA3FB56: ourshellapply (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xD9BAE3: PCApply_Shell (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xD74AC3: PCApply (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xE0FE2D: KSPSolve_PREONLY (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xDFD7E3: KSPSolve (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xA41BEC: kspsolve_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x4288ED: usolve_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==  Address 0x802ed98 is 936 bytes inside a block of size
    1,072 free'd<br>
    ==24001==    at 0x4C2BDEC: free (in
    /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)<br>
    ==24001==    by 0xA66C4C: PetscFreeAlign (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x95A5F6: MatDestroy (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x9672BC: MatDestroyMatrices (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xDDD221: PCReset_ASM (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xD73A26: PCReset (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xD73BB7: PCDestroy (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xDFFF53: KSPDestroy (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xA41C1F: kspdestroy_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x432F00: reuseschur_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x4297F5: feapuserpcapply_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xA3FB56: ourshellapply (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001== <br>
    ==24001== Invalid read of size 8<br>
    ==24001==    at 0x8EDC90: PetscObjectDereference (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x8F5798: petscobjectdereference_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x4331EB: reuseschur_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x4297F5: feapuserpcapply_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xA3FB56: ourshellapply (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xD9BAE3: PCApply_Shell (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xD74AC3: PCApply (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xE0FE2D: KSPSolve_PREONLY (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xDFD7E3: KSPSolve (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xA41BEC: kspsolve_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x4288ED: usolve_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x460179: psolve_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==  Address 0x802e9f8 is 8 bytes inside a block of size 1,072
    free'd<br>
    ==24001==    at 0x4C2BDEC: free (in
    /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)<br>
    ==24001==    by 0xA66C4C: PetscFreeAlign (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x95A5F6: MatDestroy (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x9672BC: MatDestroyMatrices (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xDDD221: PCReset_ASM (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xD73A26: PCReset (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xD73BB7: PCDestroy (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xDFFF53: KSPDestroy (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xA41C1F: kspdestroy_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x432F00: reuseschur_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x4297F5: feapuserpcapply_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xA3FB56: ourshellapply (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001== <br>
    ==24001== Invalid read of size 8<br>
    ==24001==    at 0x8EDC94: PetscObjectDereference (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x8F5798: petscobjectdereference_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x4331EB: reuseschur_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x4297F5: feapuserpcapply_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xA3FB56: ourshellapply (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xD9BAE3: PCApply_Shell (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xD74AC3: PCApply (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xE0FE2D: KSPSolve_PREONLY (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xDFD7E3: KSPSolve (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0xA41BEC: kspsolve_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x4288ED: usolve_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==    by 0x460179: psolve_ (in
    /home/luc/research/feap_repo/ShearBands/parfeap/feap)<br>
    ==24001==  Address 0x10 is not stack'd, malloc'd or (recently)
    free'd<br>
    ==24001== <br>
    <br>
    Can you let me know how I should issue the PetscObejctReference
    subroutine call?<br>
    If PetscObejctReference is not fully working in FORTRAN (that's
    always a possibility), I assume that I cannot do the following:<br>
    <br>
    <font face="Courier New, Courier, monospace">      call
      MatGetSubMatrix(Kmat, isddi(1), isddi(1), MAT_INITIAL_MATRIX,
      DDPMat, ierr)<br>
            call KSPSetOperators(ddsubksp(i),DDPMat,DDPMat,ierr)</font><br>
    <br>
    because of the overlap that is set after I computed issddi(1), is
    there a way to get an updated isddi(1) that contain the overlap
    created by PCASMSetOverlap?<br>
    <pre class="moz-signature" cols="72">-- 
Best,
Luc</pre>
  </body>
</html>