[petsc-users] fieldsplit: Unhandled case, must have at least two fields, not 1!

Mark Adams mfadams at lbl.gov
Sun Dec 1 12:23:56 CST 2013


>
>
> >   ! setup solver now that matrix is complete
> >   call KSPSetUp( solver%ksp, ierr )  !!! poisson.F90:213
>
> Where does your code call PCFieldSplitSetIS() or similar?


I use DM's.  I've appended some of the code and attached the whole file.


> How is the
> PCFieldSplit supposed to know about the splits?  What runtime options
> are you passing?
>

I just use the petsc.rc files that I sent before.  We don't usually use
command line options.

Mark

! lambda DM
  call VecCreate(comm,x2Vec,ierr)
  call VecSetSizes(x2Vec,N2loc,nflux,ierr)
  call VecSetFromOptions(x2Vec,ierr)

  call DMShellCreate(comm,solver%dalam,ierr)
  call DMShellSetGlobalVector(solver%dalam,x2Vec,ierr)
  call DMShellSetMatrix(solver%dalam,solver%Dmat,ierr)

  call VecCreate(PETSC_COMM_SELF,x2Vecloc,ierr)
  call VecSetSizes(x2Vecloc,N2loc,N2loc,ierr)
  call VecSetFromOptions(x2Vecloc,ierr)
  call DMShellSetLocalVector(solver%dalam,x2Vecloc,ierr)
  call VecDestroy(x2Vec,ierr)
  call VecDestroy(x2Vecloc,ierr)

  ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  !  Create field split DM
  ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  call DMCompositeCreate(comm,solver%da,ierr)
  CHKERRQ(ierr)
  call DMSetOptionsPrefix(solver%daphi,'phi_',ierr)
  call DMCompositeAddDM(solver%da,solver%daphi,ierr)
  CHKERRQ(ierr)
  call DMSetOptionsPrefix(solver%dalam,'lambda_',ierr)
  call DMCompositeAddDM(solver%da,solver%dalam,ierr)
  CHKERRQ(ierr)

  matArray(1) = solver%Amat
  matArray(2) = solver%Bmat
  matArray(3) = solver%Cmat
  matArray(4) = solver%Dmat
  call
MatCreateNest(comm,itwo,PETSC_NULL_OBJECT,itwo,PETSC_NULL_OBJECT,matArray,solver%KKTmat,ierr)
  call MatSetFromOptions(solver%KKTmat,ierr)

  !  Extract global and local vectors from DM; then duplicate for remaining
  !     vectors that are the same types
  call MatGetVecs(solver%KKTmat,solver%xVec2,solver%bVec2,ierr)
  call VecDuplicate(solver%bVec2,solver%rVec2,ierr)

  ! create SNES
  call SNESCreate(comm,solver%snes,ierr)
  CHKERRQ(ierr)
  call SNESSetDM(solver%snes,solver%da,ierr)
  CHKERRQ(ierr)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131201/89062191/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: poisson.F90
Type: application/octet-stream
Size: 90388 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131201/89062191/attachment-0001.obj>


More information about the petsc-users mailing list