[petsc-users] Question on output vector in vtk file
Gong Yujie
yc17470 at connect.um.edu.mo
Mon Dec 11 03:32:23 CST 2023
Dear PETSc developers,
I have a DMPlex DM with 1 field 1dof. I'd like to output a vector with block size equals to 3. It seems that there is no response using command line option or using some code about PetscViewer.
The DM is generated with (note that I'm not using PetscFE for discretization, just for allocate dof.)
PetscCall(DMPlexCreateExodusFromFile(PETSC_COMM_WORLD,"tube.exo",interpolate,&dm));
PetscCall(PetscFECreateLagrange(PETSC_COMM_SELF,dim,1,PETSC_TRUE,1,PETSC_DETERMINE,&fe));
PetscCall(PetscObjectSetName((PetscObject)fe,"potential_field"));
PetscCall(DMSetField(dm,0,NULL,(PetscObject)fe));
PetscCall(DMPlexDistribute(dm,0,&sf,&dmParallel));
The Vector is created using
PetscCall(DMCreateGlobalVector(dm,&phi_1));
PetscCall(VecSetLocalToGlobalMapping(phi_1,Itog));
PetscCall(VecGetLocalSize(phi_1,&vec_local_size_test));
PetscCall(VecCreateMPI(PETSC_COMM_WORLD, vec_local_size_test*3, PETSC_DETERMINE, &u_grad_psi));
PetscCall(VecSetBlockSize(u_grad_psi, 3));
PetscCall(VecSetLocalToGlobalMapping(u_grad_psi,Itog));
The output command line option is just --vec_view vtk:test.vtk. The PETSc version I'm using is 3.19.5.
Could you please give me some advice?
Best Regards,
Yujie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20231211/c9a4e036/attachment-0001.html>
More information about the petsc-users
mailing list