[petsc-users] Error when trying to write solution to a file

Jed Brown jed at jedbrown.org
Tue Oct 7 11:50:19 CDT 2014


Miguel Angel Salazar de Troya <salazardetroya at gmail.com> writes:

> Hi all
>
> I'm solving a discretized PDE with TS. Inside my MonitorFunction(), hooked
> up with TSMonitorSet(), I process the solution at each time step to write
> another PETSc Vec. Then, I write this Vec to a matlab binary file. The name
> of the binary file is the time step. I save it inside of the folder
> "ForceHistory"
>
> // File name
> PetscViewer    viewer;
> std::string filehistory("ForceHistory/");
> std::ostringstream temp;
> temp << step;
> filehistory.append(temp.str());
> filehistory.append(".mat");
>
> // Open and set Binary file
>  PetscViewerBinaryOpen(PETSC_COMM_WORLD,filehistory.c_str(),FILE_MODE_WRITE,&viewer);
> PetscViewerSetFormat(viewer, PETSC_VIEWER_BINARY_MATLAB);
>
> // Print
> VecView(Context->Felement,viewer);

Are you destroying the viewer (to close the file)?  It looks like either
a max number of file descriptors or a disk quota problem.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20141007/83bb9aba/attachment.pgp>


More information about the petsc-users mailing list