Dear all,<div><br></div><div>I got a strange petsc error when I am running my code with petsc as a linear sover:</div><div><div>[0]PETSC ERROR: --------------------- Error Message ------------------------------------</div>
<div>[0]PETSC ERROR: Object is in wrong state!</div><div>[0]PETSC ERROR: You cannot call this after you have called VecSetValues() but</div><div> before you have called VecAssemblyBegin/End()!</div><div>[0]PETSC ERROR: ------------------------------------------------------------------------</div>
<div>[0]PETSC ERROR: Petsc Release Version 2.3.3, Patch 15, Tue Sep 23 10:02:49 CDT 2008 HG revision: 31306062cd1a6f6a2496fccb4878f485c9b91760</div><div>[0]PETSC ERROR: See docs/changes/index.html for recent updates.</div>
<div>[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.</div><div>[0]PETSC ERROR: See docs/index.html for manual pages.</div></div><div>I<b> think this error is happening when I want to reset the vector and matrix to zero before solving the Ax=b,</b></div>
<div><b>this is my code:</b></div><div><div><b>PetscScalar zero = 0.;</b></div><div><b><br></b></div><div><b> // Reset J, R and Y</b></div><div><b> cout<<"reset jacobian to zero"<<endl;</b></div><div>
<b> MatZeroEntries(J_);</b></div><div><b> cout<<"reset R to zero"<<endl;</b></div><div><b> VecSet(R_, zero);</b></div><div><b> cout<<"reset Y to zero"<<endl;</b></div><div><b> VecSet(Y_, zero);</b></div>
</div><div><b><br></b></div><div><b>Is anyone have some clue to solve this problem.</b></div><div><b><br></b></div><div><b>Thanks,</b></div><div><b><br></b></div><div><b>Nan</b></div>