<div>Jed this is output from gdb:</div><div><br></div><div>#0  0x0000000000000000 in ?? ()</div><div>#1  0x00000000009857fd in VecGetArrayRead (x=0x33ba0b0, a=0x7fff1f0cf100) at /home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/include/petsc-private/vecimpl.h:350</div>

<div>#2  0x000000000098f67f in VecGetArray_Nest (X=0x33c0850, x=0x7fff1f0cf200) at /home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/src/vec/vec/impls/nest/vecnest.c:719</div><div>#3  0x0000000000a3f4df in VecGetArrayRead (x=0x33c0850, a=0x7fff1f0cf200) at /home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/include/petsc-private/vecimpl.h:350</div>

<div>#4  0x0000000000a51d83 in MatMult (mat=0x326e480, x=0x33150c0, y=0x33c0850) at /home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/src/mat/interface/matrix.c:2092</div><div>#5  0x00000000012b2b78 in KSPInitialResidual (ksp=0x32f6bb0, vsoln=0x33150c0, vt1=0x33c0850, vt2=0x33d3c60, vres=0x33e6d30, vb=0x3328710) at /home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/src/ksp/ksp/interface/itres.c:54</div>

<div>#6  0x0000000000da2faa in KSPSolve_GMRES (ksp=0x32f6bb0) at /home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/src/ksp/ksp/impls/gmres/gmres.c:230</div><div>#7  0x0000000000d1ae6b in KSPSolve (ksp=0x32f6bb0, b=0x3328710, x=0x33150c0) at /home/amneet/SOFTWARES/LIBRARIESIBAMR/PETSc-3.3-Lite/src/ksp/ksp/interface/itfunc.c:446</div>

<div>#8  0x00000000006b8b0a in IBTK::PETScBlockKrylovLinearSolver::solveSystem (this=0x31f4310, x=0x329ed20, b=0x32b75d0) at PETScBlockKrylovLinearSolver.C:381</div><div>#9  0x00000000005777e3 in main (argc=5, argv=0x7fff1f0d3468) at main.C:274</div>

<div><br></div><div>In frame 5, there is call to function  </div><div> PetscErrorCode  KSPInitialResidual(KSP ksp,Vec vsoln,Vec vt1,Vec vt2,Vec vres,Vec vb)</div><div><br></div><div>which calls the matrix-vector function in frame 4, i.e,  </div>

<div>ierr = KSP_MatMult(ksp,Amat,vsoln,vt1);CHKERRQ(ierr);</div><div><br></div><div>Now the error comes in frame 4, where there is call to </div><div>VecValidValues(y,3,PETSC_FALSE); y being vt1, a temporary left Vec to hold value</div>

<div>of user-defined matrix vector product. </div><div><br></div><div>I have passed a user-defined function to tell MatShell how to create left/right Vec(s);</div><div>where I also set left/right->ops->getarray = PETSC_NULL. If vt1 was created using</div>

<div>this routine, there would not have been any error related to  VecGetArrayRead routine</div><div>and should have printed some tracer printf statements. So my guess is that this temporary </div><div>vector is created by directly calling VecDuplicate routine which sets</div>

<div> vec->ops->getarray = VecGetArray_Nest by default.</div><div><br></div><div><br></div><div class="gmail_quote">On Fri, Mar 1, 2013 at 1:07 PM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@mcs.anl.gov</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Where should this routine be added and how should it look like for shell vectors? I had assumed that<div>

such changes should be done in user defined MatGetVecs routine. Clearly this is not happening.</div></blockquote><div><br></div></div><div>Please explain.</div></blockquote></div><br><br><br clear="all"><div><br></div>-- <br>

<div>Amneet <br><br></div><div><br></div><div><br></div>