[petsc-users] VecCopy fails after VecDuplicate

Smith, Barry F. bsmith at mcs.anl.gov
Thu Jan 17 13:26:41 CST 2019


  It is likely the u vector that is not assembled not the u_abs; the complete error message has this information. If the monitor is called from TS then I cannot imagine how the u could possibly be unassembled. Please send the complete error message.

  Barry


> On Jan 17, 2019, at 1:18 PM, Sajid Ali via petsc-users <petsc-users at mcs.anl.gov> wrote:
> 
> Hi, 
> 
> I have the following 2 lines in a function in my code :
> 
>  ierr = VecDuplicate(u,&u_abs);CHKERRQ(ierr);
>  ierr = VecCopy(u,u_abs);CHKERRQ(ierr);
> 
> The VecCopy fails with the error message : 
> [0]PETSC ERROR: Object is in wrong state
> [0]PETSC ERROR: Not for unassembled vector
> 
> adding the following statements doesn't help either :
> ierr = VecAssemblyBegin(u_abs);CHKERRQ(ierr);
> ierr = VecAssemblyEnd(u_abs);CHKERRQ(ierr);
> 
> If needed, the entire file is at : https://github.com/s-sajid-ali/xwp_petsc/blob/master/1d/free_space/ex_modify.c
> 
> Thank You, 
> Sajid Ali
> Applied Physics
> Northwestern University



More information about the petsc-users mailing list