[petsc-users] DMPlex Filed data to VTK file

Dharmendar Reddy dharmareddy84 at gmail.com
Wed Apr 17 19:34:43 CDT 2013


Hello,
         I think i finally was able to go thorugh the process of solving a
poisson problem using DMPlex object. Now i need to visualize the data.

I was looking at following lines from exmple 62:

733:   if (user.runType == RUN_FULL) {734:     PetscViewer
<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Viewer/PetscViewer.html#PetscViewer>
viewer;735:     Vec
<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Vec/Vec.html#Vec>
        uLocal;
737:     PetscViewerCreate
<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Viewer/PetscViewerCreate.html#PetscViewerCreate>(PETSC_COMM_WORLD
<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Sys/PETSC_COMM_WORLD.html#PETSC_COMM_WORLD>,
&viewer);738:     PetscViewerSetType
<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Viewer/PetscViewerSetType.html#PetscViewerSetType>(viewer,
PETSCVIEWERVTK);739:     PetscViewerSetFormat
<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Viewer/PetscViewerSetFormat.html#PetscViewerSetFormat>(viewer,
PETSC_VIEWER_ASCII_VTK);740:     PetscViewerFileSetName
<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Viewer/PetscViewerFileSetName.html#PetscViewerFileSetName>(viewer,
"ex62_sol.vtk");
742:     DMGetLocalVector
<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/DM/DMGetLocalVector.html#DMGetLocalVector>(user.dm,
&uLocal);743:     DMGlobalToLocalBegin
<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/DM/DMGlobalToLocalBegin.html#DMGlobalToLocalBegin>(user.dm,
u, INSERT_VALUES
<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Sys/INSERT_VALUES.html#INSERT_VALUES>,
uLocal);744:     DMGlobalToLocalEnd
<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/DM/DMGlobalToLocalEnd.html#DMGlobalToLocalEnd>(user.dm,
u, INSERT_VALUES
<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Sys/INSERT_VALUES.html#INSERT_VALUES>,
uLocal);
746:     PetscObjectReference
<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Sys/PetscObjectReference.html#PetscObjectReference>((PetscObject
<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Sys/PetscObject.html#PetscObject>)
user.dm); /* Needed because viewer destroys the DM */747:
PetscObjectReference
<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Sys/PetscObjectReference.html#PetscObjectReference>((PetscObject
<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Sys/PetscObject.html#PetscObject>)
uLocal); /* Needed because viewer destroys the Vec
<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Vec/Vec.html#Vec>
*/748:     PetscViewerVTKAddField
<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Viewer/PetscViewerVTKAddField.html#PetscViewerVTKAddField>(viewer,
(PetscObject <http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Sys/PetscObject.html#PetscObject>)
user.dm, DMPlexVTKWriteAll
<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/DM/DMPlexVTKWriteAll.html#DMPlexVTKWriteAll>,
PETSC_VTK_POINT_FIELD, (PetscObject
<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Sys/PetscObject.html#PetscObject>)
uLocal);749:     DMRestoreLocalVector
<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/DM/DMRestoreLocalVector.html#DMRestoreLocalVector>(user.dm,
&uLocal);750:     PetscViewerDestroy
<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Viewer/PetscViewerDestroy.html#PetscViewerDestroy>(&viewer);751:
  }

Can i do the same or some thing similar from fortran ? Some calls seem to
have type casting.

Othere wise if you can give me some idea on how to get the solution vector,
including the boundary values.

As of now, i access the solution using solution vector passed to snes
object but that does not give values at boundary nodes.

Thanks
Reddy
-- 
-----------------------------------------------------
Dharmendar Reddy Palle
Graduate Student
Microelectronics Research center,
University of Texas at Austin,
10100 Burnet Road, Bldg. 160
MER 2.608F, TX 78758-4445
e-mail: dharmareddy84 at gmail.com
Phone: +1-512-350-9082
United States of America.
Homepage: https://webspace.utexas.edu/~dpr342
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130417/f0d28c9c/attachment.html>


More information about the petsc-users mailing list