[petsc-users] How to output VTK file with Vec associating with DMPLEX

Tsung-Hsing Chen barrydog505 at gmail.com
Sun Dec 9 16:45:33 CST 2018


Hi,
I want to output a VTK file containing Vec which associate with DMPLEX, but
I keep getting some errors.
I use PetscViewerVTKOpen() to create the vtk file.
Then I saw many examples just use DMCreateGlobalVector() to create the Vec
associate with DM.
However, almost all of them aren't DMPLEX but are DMDA.
I don't know whether it will cause some problems.
These is what I write:

  PetscViewerCreate(PETSC_COMM_WORLD, &viewer);
  PetscViewerVTKOpen(PETSC_COMM_WORLD, "vtk_output_test.vtk",
FILE_MODE_WRITE, &viewer);
  DMCreateGlobalVector(dm, &x);
  VecSetValue();   //Set value for x
  VecView(x, viewer);

Here is the error output:
[0]PETSC ERROR: --------------------- Error Message
--------------------------------------------------------------
[0]PETSC ERROR: Argument out of range
[0]PETSC ERROR: Out of range index value 1 maximum 0
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for
trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.10.2, unknown
[0]PETSC ERROR: ./test3 on a arch-linux2-c-debug named barry-PhysioMech by
barry Mon Dec 10 05:52:19 2018
[0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
--with-fc=gfortran --download-mpich --download-fblaslapack --download-mumps
--download-scalapack --download-ctetgen
[0]PETSC ERROR: #3 VecSetValues_Seq() line 726 in
/home/barry/petsc/src/vec/vec/impls/seq/bvec2.c
[0]PETSC ERROR: #4 VecSetValues() line 856 in
/home/barry/petsc/src/vec/vec/interface/rvector.c

[0]PETSC ERROR: --------------------- Error Message
--------------------------------------------------------------
[0]PETSC ERROR: Invalid argument
[0]PETSC ERROR: Could not classify input Vec for VTK
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for
trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.10.2, unknown
[0]PETSC ERROR: ./test3 on a arch-linux2-c-debug named barry-PhysioMech by
barry Mon Dec 10 05:52:19 2018
[0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++
--with-fc=gfortran --download-mpich --download-fblaslapack --download-mumps
--download-scalapack --download-ctetgen
[0]PETSC ERROR: #17 DMPlexGetFieldType_Internal() line 134 in
/home/barry/petsc/src/dm/impls/plex/plex.c
[0]PETSC ERROR: #18 VecView_Plex_Local_VTK() line 294 in
/home/barry/petsc/src/dm/impls/plex/plex.c
[0]PETSC ERROR: #19 VecView_Plex_Local() line 335 in
/home/barry/petsc/src/dm/impls/plex/plex.c
[0]PETSC ERROR: #20 VecView_Plex() line 382 in
/home/barry/petsc/src/dm/impls/plex/plex.c
[0]PETSC ERROR: #21 VecView() line 590 in
/home/barry/petsc/src/vec/vec/interface/vector.c

I think the first part of the error comes from VecSetValue(), but I don't
know how to fix it.
And I totally don't know what its mean in the second part of the error.

Thank you,
Barry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20181210/cf0143a7/attachment.html>


More information about the petsc-users mailing list