[petsc-users] Saving binary output at every tilmestep in ts/ex3.c

Barry Smith bsmith at mcs.anl.gov
Tue Mar 3 23:00:34 CST 2015


  What you have done sounds like it is reasonable.

  You need to run in the debugger and put a break point in VecView() to make sure it is being called multiple times and it is writing each time.

   Barry

> On Mar 3, 2015, at 10:41 PM, Mohammad Imtiaz <M.Imtiaz at victorchang.edu.au> wrote:
> 
> Hi 
> I am trying to save output at every time step in ts/ex3.c.  But all that gets saved is the final output.  I have changed example ts/ex3.c as follows:
> 
> 
> Added a new viewer
> Line 77: PetscViewer viewer1,viewer2,viewer3;  /* viewers for the solution and error */
> 
> Added
> Line 161: PetscViewerBinaryOpen(PETSC_COMM_WORLD,"out.bin",FILE_MODE_WRITE,&appctx.viewer3);
> 
> 
> Added
> Line 271: ierr = PetscViewerDestroy(&appctx.viewer3);CHKERRQ(ierr);
> 
> 
> In Monitor function added:
> VecView(u,appctx->viewer3);CHKERRQ(ierr);
> 
> 
> I will be thankful for any help understanding what I am missing.
> 
> Thanks
> Imtiaz
> 
> 
> 
> 



More information about the petsc-users mailing list