<div class="gmail_quote">On Tue, Jan 18, 2011 at 10:38 PM, Gaetan Kenway <span dir="ltr"><<a href="mailto:gaetank@gmail.com">gaetank@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hello<br>
<br>
I've run across a somewhat curious problem. I have included a snipped of<br>
code below, that is from a Newton-Krylov flow solver. The code is from<br>
the "FormJacobian" function for a snes. The code works fine with PETSc<br>
3.1 but when I tried it with Petsc 3.0, I get a PETSc Error code 73:<br>
<br>
"object in argument is in wrong state, e.g. unassembled mat "<br></blockquote><div><br></div><div>Its impossible to know what is going on here without the full stack from the error</div><div>message. Please send that.</div>
<div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
on the PCSetup(pc,ierr) call. The subroutine setupNK_KSP_PC(dRdwPre)<br>
assembled the preconditioner matrix (dRdwPre) and performs the<br>
MatAssemblyBegin/End functions. I do realize, it is possible to just use<br>
PETSc 3.1, but I would like to know if its just a fluke that it works,<br>
or I've done something incorrect. I also realize, it is not typical to<br>
set options like this directly in code, but is is necessary for our<br>
code. I apologize I don't have a minimum representative example, but<br>
this section of code is quite buried and an example would have to be<br>
coded from scratch.<br>
<br>
Any suggestions are greatly appreciated<br>
<br>
Gaetan Kenway<br>
<br>
<br>
<br>
*********** BEGIN CODE ****************<br>
<br>
! Dummy assembly begin/end calls for the matrix-free Matrx<br>
call MatAssemblyBegin(dRdw,MAT_FINAL_ASSEMBLY,ierr)<br>
call EChk(ierr,__FILE__,__LINE__)<br>
call MatAssemblyEnd(dRdw,MAT_FINAL_ASSEMBLY,ierr)<br>
call EChk(ierr,__FILE__,__LINE__)<br>
<br>
! Assemble the approximate PC<br>
call setupNK_KSP_PC(dRdwPre)<br>
<br>
! Setup the required options for the KSP solver<br>
call SNESGetKSP(snes,ksp,ierr);<br>
call KSPSetType(ksp,ksp_solver_type,ierr);<br>
call KSPGMRESSetRestart(ksp, ksp_subspace,ierr);<br>
call KSPSetPreconditionerSide(ksp,PC_RIGHT,ierr);<br>
<br>
! Setup the required options for the Global PC<br>
call KSPGetPC(ksp,pc,ierr);<br>
call PCSetType(pc,global_pc_type,ierr);<br>
<br>
if (trim(global_pc_type) == 'asm') then<br>
call PCASMSetOverlap(pc,asm_overlap,ierr);<br>
call PCSetup(pc,ierr);<br>
call PCASMGetSubKSP( pc, nlocal, first, subksp, ierr );<br>
end if<br>
<br>
************** END CODE ****************<br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener<br>