Sepideh Kavousi <[email protected]> writes: > Dear Petsc users, > I am trying to write VTK output file every few steps. When I was using the > petsc 3.7 I used the following lines: > if (user->ts_write % 500 ==0) { > ierr= > PetscSNPrintf(user->filename,sizeof(user->filename),"one-%03d.vts",user->ts_write);CHKERRQ(ierr); > ierr= > TSMonitorSolutionVTK(user->ts,user->ts_write,t,user->sol_old,&user->filename);CHKERRQ(ierr);} > user->ts_write+=1; > } > and it worked fine, but when I use the same line in Petsc 3.9 and 3.10, > using these lines it still outputs the files but when I open them with Visit > and try to visualize the individual field component, it does not show them.
Do they not exist or are just unnamed? I believe we had a couple regressions with this output style circa 3.10 (side-effect of better handling vector fields), but I believe it was fixed by 3.11 or certainly 3.12. Would it be possible for you to upgrade? Note that you can (and should) pass the format specifier directly, as in: TSMonitorSolutionVTK(user->ts,user->ts_write,t,user->sol_old,"one-%03D.vts"); Visit won't care about the numbers not being contiguous. If you want to name them manually, just handle the viewer yourself; body of TSMonitorSolutionVTK: ierr = PetscSNPrintf(filename,sizeof(filename),(const char*)filenametemplate,step);CHKERRQ(ierr); ierr = PetscViewerVTKOpen(PetscObjectComm((PetscObject)ts),filename,FILE_MODE_WRITE,&viewer);CHKERRQ(ierr); ierr = VecView(u,viewer);CHKERRQ(ierr); ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr);
