[petsc-users] binary vtk viewer DMDA

Blaise A Bourdin bourdin at lsu.edu
Wed Jan 9 10:21:55 CST 2013


I can scatter each dof in a separate vec and save it, then.

Thanks,
Blaise
On Jan 9, 2013, at 10:14 AM, Jed Brown <jedbrown at mcs.anl.gov<mailto:jedbrown at mcs.anl.gov>>
 wrote:

Unfortunately, the VTK format does not support multiple <StructuredGrid> entries in the same file. I have no idea why they chose to make the format that way. You can ask them to remove this ridiculous restriction, but until then, you have to write separate files or use a different format.


On Wed, Jan 9, 2013 at 10:10 AM, Blaise A Bourdin <bourdin at lsu.edu<mailto:bourdin at lsu.edu>> wrote:
That's a good start indeed. Is there any way to save files defined on different DMDA (same grid but different number of dof). When I try to do that, I get the following error message:
MacBook-Pro:VTK blaise$ ./TestVTK
[0]PETSC ERROR: --------------------- Error Message ------------------------------------
[0]PETSC ERROR: Arguments are incompatible!
[0]PETSC ERROR: Cannot write a field from more than one grid to the same VTK file!
[0]PETSC ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: Petsc Release Version 3.3.0, Patch 5, unknown
[0]PETSC ERROR: See docs/changes/index.html for recent updates.
[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
[0]PETSC ERROR: See docs/index.html for manual pages.
[0]PETSC ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: ./TestVTK on a Darwin-gc named MacBook-Pro.local by blaise Wed Jan  9 10:09:37 2013
[0]PETSC ERROR: Libraries linked from /opt/HPC/petsc-3.3/Darwin-gcc4.2-mef90-g/lib
[0]PETSC ERROR: Configure run at Thu Jan  3 15:42:04 2013
[0]PETSC ERROR: Configure options --download-boost=1 --download-chaco=1 --download-exodusii=/opt/HPC/src/tarball/exodusii-5.22b.tgz --download-hdf5=1 --download-metis=1 --download-netcdf=1 --download-parmetis=1 --download-sowing=1 --download-triangle=1 --download-yaml=1 --with-clanguage=C++ --with-cmake=cmake --with-debugging=1 --with-fortran-datatypes --with-gnu-compilers=1 --with-mpi-dir=/opt/HPC/mpich2-1.4.1p1-gcc4.2 --with-pic --with-shared-libraries=1 --with-sieve --with-sieve-memory-logging --with-x11=1 PETSC_ARCH=Darwin-gcc4.2-mef90-g
[0]PETSC ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: PetscViewerVTKAddField_VTK() line 126 in /opt/HPC/petsc-3.3/src/sys/viewer/impls/vtk/vtkv.c
[0]PETSC ERROR: PetscViewerVTKAddField() line 32 in /opt/HPC/petsc-3.3/src/sys/viewer/impls/vtk/vtkv.c
[0]PETSC ERROR: VecView_MPI_DA() line 531 in /opt/HPC/petsc-3.3/src/dm/impls/da/gr2.c
[0]PETSC ERROR: VecView() line 776 in /opt/HPC/petsc-3.3/src/vec/vec/interface/vector.c
[0]PETSC ERROR: main() line 46 in TestVTK.c
application called MPI_Abort(MPI_COMM_WORLD, 75) - process 0
[unset]: aborting job:
application called MPI_Abort(MPI_COMM_WORLD, 75) - process 0

Blaise

On Jan 9, 2013, at 9:51 AM, Jed Brown <jedbrown at mcs.anl.gov<mailto:jedbrown at mcs.anl.gov>>
 wrote:

None of that crazy "developer" nonsense is need for users. Just do this:

    PetscViewer viewer;
    /* file name extension sets format by default, see also PetscViewerSetFormat(viewer,PETSC_VIEWER_VTK_VTS) */
    ierr = PetscViewerVTKOpen(comm,"yourfile.vts",FILE_MODE_WRITE,&viewer);CHKERRQ(ierr);
    ierr = VecView(X,viewer);CHKERRQ(ierr);
    ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr);

When using TS, you can do -ts_monitor_draw_solution_vtk 'filename-%03D.vts' to save each time step to a numbered binary file (ready to animate in paraview or visit).


On Wed, Jan 9, 2013 at 9:37 AM, Blaise A Bourdin <bourdin at lsu.edu<mailto:bourdin at lsu.edu>> wrote:
Hi,

I am looking at the documentation and the examples looking for a simple illustration of how to use the new vtk binary viewers for structured data defined by a DMDA, but can't find any straightforward example. Is there a simple example that I am missing?

When I try
PetscViewerVTKAddField(VTKviewer,(PetscObject) dmda1,DMDAVTKWriteAll,PETSC_VTK_POINT_FIELD,(PetscObject) p);CHKERRQ(ierr);
I get a compilation time error:
TestVTK.c:53: error: ‘DMDAVTKWriteAll’ was not declared in this scope
indeed, DMDAVTKWriteAll is defined in a private header. Is this the way it is supposed to be?

Is the xml file describing the content of the binary files generated automatically or do I need to take care of it by myself?

I am using petsc-3.3, latest changeset.

Regards,
Blaise
--
Department of Mathematics and Center for Computation & Technology
Louisiana State University, Baton Rouge, LA 70803, USA
Tel. +1 (225) 578 1612<tel:%2B1%20%28225%29%20578%201612>, Fax  +1 (225) 578 4276<tel:%2B1%20%28225%29%20578%204276> http://www.math.lsu.edu/~bourdin










--
Department of Mathematics and Center for Computation & Technology
Louisiana State University, Baton Rouge, LA 70803, USA
Tel. +1 (225) 578 1612<tel:%2B1%20%28225%29%20578%201612>, Fax  +1 (225) 578 4276<tel:%2B1%20%28225%29%20578%204276> http://www.math.lsu.edu/~bourdin









--
Department of Mathematics and Center for Computation & Technology
Louisiana State University, Baton Rouge, LA 70803, USA
Tel. +1 (225) 578 1612, Fax  +1 (225) 578 4276 http://www.math.lsu.edu/~bourdin







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130109/93a884f4/attachment.html>


More information about the petsc-users mailing list