<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hi, <br><br></div>I have the following 2 lines in a function in my code :<br><br> ierr = VecDuplicate(u,&u_abs);CHKERRQ(ierr);<br> ierr = VecCopy(u,u_abs);CHKERRQ(ierr);<br><br></div><div>The VecCopy fails with the error message : <br>[0]PETSC ERROR: Object is in wrong state<br>[0]PETSC ERROR: Not for unassembled vector<br><br></div><div>adding the following statements doesn't help either :<br>ierr = VecAssemblyBegin(u_abs);CHKERRQ(ierr);<br>ierr = VecAssemblyEnd(u_abs);CHKERRQ(ierr);<br><br></div><div>If needed, the entire file is at : <a href="https://github.com/s-sajid-ali/xwp_petsc/blob/master/1d/free_space/ex_modify.c">https://github.com/s-sajid-ali/xwp_petsc/blob/master/1d/free_space/ex_modify.c</a><br clear="all"></div><div dir="ltr"><div><div><br></div><div>Thank You, <br></div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div style="font-size:12.8px">Sajid Ali<br></div><div style="font-size:12.8px">Applied Physics<br></div><div style="font-size:12.8px">Northwestern University</div></div></div></div></div></div></div></div></div></div>