Luc Berger-Vergiat <lb2...@columbia.edu> writes:

> Hi all,
> I am using the ASM preconditioner and it works fine with regular options.
> However I am having difficulties setting the Pmat operator for on of my 
> ASM domain.
> Here is what I coded:
>
>           call PCASMSetLocalSubdomains(pcdd,2,isddi,isddi,ierr)
>           call PetscOptionsGetInt(PETSC_NULL_CHARACTER,
>       &        '-n_overlap',n_ol,chk,ierr)
>           if (chk.eqv.PETSC_TRUE) then
>              call PCASMSetOverlap(pcdd,n_ol,ierr)
>           endif
>           call PCSetUp(pcdd,ierr)
>           call KSPSetUp(schurKSP,ierr)
>           call PCASMGetSubKSP(pcdd,nddl,fbl,ddsubksp, ierr)

   Fortran note:
   The output argument 'ksp' must be an array of sufficient length or 
NULL_OBJECT. The latter can be used to learn the necessary length.

Is it allocated and long enough?

>           do i = 1,nddl
>              if(i.eq.1) then
>                 if( (nstep.eq.1).and.(niter.eq.0) ) then
>                    call KSPGetOperators(ddsubksp(i),HKmat,
>       &                 HPmat,ierr)
>                 else
>                    call KSPGetOperators(ddsubksp(i),HKmat,
>       &                 PETSC_NULL_OBJECT,ierr)
>                 endif
>                 call PetscObjectReference(HKmat, ierr)
>                 call PetscObjectReference(HPmat, ierr)
>                 call KSPSetOperators(ddsubksp(i),HKmat,HPmat,ierr)

So you're reusing the Pmat from the first subdomain on each process?
How do you know it's the right size?

>                 call PetscObjectDereference(HKmat, ierr)
>                 call PetscObjectDereference(HPmat, ierr)
>              endif
>              call KSPGetPC(ddsubksp(i),ddsubpc(i),ierr)
>              call PCSetType(ddsubpc(i),PCLU,ierr)
>              call KSPSetType(ddsubksp(i),KSPPREONLY,ierr)
>           enddo
>
> I am suspecting that the PetscObjectReference is not working well based 
> on the following output from valgrind:

Get rid of the PetscObjectReference and PetscObjectDereference
calls. They don't need to be there and could be hiding problems.  Then
send the full Valgrind output.

Attachment: signature.asc
Description: PGP signature

Reply via email to