[petsc-users] [Fortran] VTK viewer error

Jed Brown jedbrown at mcs.anl.gov
Thu Apr 18 19:43:43 CDT 2013


Please always use "reply-all" so that your messages go to the list.
This is standard mailing list etiquette.  It is important to preserve
threading for people who find this discussion later and so that we do
not waste our time re-answering the same questions that have already
been answered in private side-conversations.  You'll likely get an
answer faster that way too.

Dharmendar Reddy <dharmareddy84 at gmail.com> writes:

> Thanks. It works now. And i like the binary-appended XML. Few questions
> though.
>
> I see that the data in vtu has Field Names liek this :
> Vec_0xyyyyyyyy_0Point0
>
> It would be nice to have the data with Field Names set in then default
> section of DMPlex.

call PetscObjectSetName(U, 'myfield', ierr)

> Also, I do not see the Boundary values, How do I get that data in to the
> vector before viewing?

Did you remove the boundary nodes when setting DMPlex's section?

> I need to added to the viewer some auxiliary data which depends on the
> solution of the snes problem, If do the following will that do ?

If the 'auxdm' is different from the original DM, you currently have to
write it to a different file or have a single big "visualization DM"
that contains all the fields you ever want to look at (including
boundary values as appropriate).  This may be the simplest solution for
you and for us.

> DMGetGlobalVector(dm,u,ierr)
>
> DMGetGlobalVector(auxdm,v,ierr)
>
>  <Some how update boundary data in u>
>
> v = f(u)  ! compute the aux data...
>
> PetscViewerCreate(PETSC_COMM_WORLD, viewer, ierr); CHKERRQ(ierr)
>  PetscViewerSetType(viewer, PETSCVIEWERVTK, ierr); CHKERRQ(ierr)
> PetscViewerFileSetName(viewer, 'sol.vtu', ierr)
>
> VecView(u,viewer,ierr)
> VecView(v,viewer,ierr)
>
>
>
>
> On Thu, Apr 18, 2013 at 11:37 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
>
>> Matthew Knepley <knepley at gmail.com> writes:
>>
>> > On Thu, Apr 18, 2013 at 9:25 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
>> >
>> >> Dharmendar Reddy <dharmareddy84 at gmail.com> writes:
>> >>
>> >> > ! This line gives a compile error, as PETSCVIEWERVTK is not defined
>> for
>> >> > FORTRAN
>> >> > !  !call PetscViewerSetType(viewer, PETSCVIEWERVTK)
>> >>
>> >
>> > I have pushed a Fortran example of this now:
>> >
>> >   src/dm/impls/plex/example/tutorials/ex1f90
>>
>> Relative to Matt's example, you can use the following for
>> binary-appended XML, which is fast and works in parallel.
>>
>> diff --git i/src/dm/impls/plex/examples/tutorials/ex1f90.F
>> w/src/dm/impls/plex/examples/tutorials/ex1f90.F
>> index d6954e6..570ad9f 100644
>> --- i/src/dm/impls/plex/examples/tutorials/ex1f90.F
>> +++ w/src/dm/impls/plex/examples/tutorials/ex1f90.F
>> @@ -82,9 +82,7 @@
>>        CHKERRQ(ierr)
>>        call PetscViewerSetType(viewer, PETSCVIEWERVTK, ierr)
>>        CHKERRQ(ierr)
>> -      call PetscViewerSetFormat(viewer, PETSC_VIEWER_ASCII_VTK, ierr)
>> -      CHKERRQ(ierr)
>> -      call PetscViewerFileSetName(viewer, 'sol.vtk', ierr)
>> +      call PetscViewerFileSetName(viewer, 'sol.vtu', ierr)
>>        CHKERRQ(ierr)
>>        call VecView(u, viewer, ierr)
>>        CHKERRQ(ierr)
>>
>>
>> The example also leaks memory.  (Matt is fixing that.)
>>
>
>
>
> -- 
> -----------------------------------------------------
> 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


More information about the petsc-users mailing list