[Paraview] help with scalar field over moving mesh coming from PETSc code

Luca Pavarino luca.pavarino at unimi.it
Wed Mar 30 05:06:02 EDT 2016


I need to visualize in Paraview at every time step a scalar field (in my PETSc code Vec cc_1 below) over a moving structured mesh (Vec um). Both the field and the mesh are solutions of some a parallel PETSc time-dependent PDE code. Do you have a simple PETSc example to output these vectors at each time step and see them in Paraview (either each snapshot separately or with a movie)?

I tried with the simple PETSc code (Vec cc_1 is the scalar field and Vec uum_1 is the vector of 3D coordinates):

 write (filename,"(A, I4.4, A)") "uuvtk", int(k*dt),".vts"
 call PetscViewerVTKOpen(PETSC_COMM_WORLD,filename,
 & FILE_MODE_WRITE,view_out_vtk,ierr);
 call VecView(cc_1,view_out_vtk,ierr)
 call PetscViewerDestroy(view_out_vtk,ierr)

 write (filename,"(A, I4.4, A)") "uumvtk", int(k*dt),".vts"
 call PetscViewerVTKOpen(PETSC_COMM_WORLD,filename,
 & FILE_MODE_WRITE,view_out_vtk,ierr);
 call VecView(uum_1,view_out_vtk,ierr)
 call PetscViewerDestroy(view_out_vtk,ierr)

but I get 2 separate vectors and I do not know how to make Paraview see that the scalar field is defined over the coordinate mesh. Thanks for any help,

 Luca


More information about the ParaView mailing list