[petsc-users] PCSetup() changes between 3.0 and 3.1
Gaetan Kenway
gaetank at gmail.com
Tue Jan 18 22:38:44 CST 2011
Hello
I've run across a somewhat curious problem. I have included a snipped of
code below, that is from a Newton-Krylov flow solver. The code is from
the "FormJacobian" function for a snes. The code works fine with PETSc
3.1 but when I tried it with Petsc 3.0, I get a PETSc Error code 73:
"object in argument is in wrong state, e.g. unassembled mat "
on the PCSetup(pc,ierr) call. The subroutine setupNK_KSP_PC(dRdwPre)
assembled the preconditioner matrix (dRdwPre) and performs the
MatAssemblyBegin/End functions. I do realize, it is possible to just use
PETSc 3.1, but I would like to know if its just a fluke that it works,
or I've done something incorrect. I also realize, it is not typical to
set options like this directly in code, but is is necessary for our
code. I apologize I don't have a minimum representative example, but
this section of code is quite buried and an example would have to be
coded from scratch.
Any suggestions are greatly appreciated
Gaetan Kenway
*********** BEGIN CODE ****************
! Dummy assembly begin/end calls for the matrix-free Matrx
call MatAssemblyBegin(dRdw,MAT_FINAL_ASSEMBLY,ierr)
call EChk(ierr,__FILE__,__LINE__)
call MatAssemblyEnd(dRdw,MAT_FINAL_ASSEMBLY,ierr)
call EChk(ierr,__FILE__,__LINE__)
! Assemble the approximate PC
call setupNK_KSP_PC(dRdwPre)
! Setup the required options for the KSP solver
call SNESGetKSP(snes,ksp,ierr);
call KSPSetType(ksp,ksp_solver_type,ierr);
call KSPGMRESSetRestart(ksp, ksp_subspace,ierr);
call KSPSetPreconditionerSide(ksp,PC_RIGHT,ierr);
! Setup the required options for the Global PC
call KSPGetPC(ksp,pc,ierr);
call PCSetType(pc,global_pc_type,ierr);
if (trim(global_pc_type) == 'asm') then
call PCASMSetOverlap(pc,asm_overlap,ierr);
call PCSetup(pc,ierr);
call PCASMGetSubKSP( pc, nlocal, first, subksp, ierr );
end if
************** END CODE ****************
More information about the petsc-users
mailing list