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

Mohammad Imtiaz M.Imtiaz at victorchang.edu.au
Thu Mar 5 01:42:27 CST 2015


Hi Barry,

Thank you for this advice, it solved my problem.

I was able to see that VecVeiw() wrote all the time and narrowed down my
problem to reading back the binary files.

Sorry, I should have done that before posting.

Mohammad





On 4/03/2015 4:00 pm, "Barry Smith" <bsmith at mcs.anl.gov> wrote:

>
>  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
>> 
>> 
>> 
>> 
>
>Scanned by Messagelabs ***



More information about the petsc-users mailing list