[petsc-users] PCSetup() changes between 3.0 and 3.1

Matthew Knepley knepley at gmail.com
Tue Jan 18 22:43:44 CST 2011


On Tue, Jan 18, 2011 at 10:38 PM, Gaetan Kenway <gaetank at gmail.com> wrote:

> 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 "
>

Its impossible to know what is going on here without the full stack from the
error
message. Please send that.

  Thanks,

     Matt


> 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 ****************
>
>


-- 
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110118/68e0d501/attachment.htm>


More information about the petsc-users mailing list