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
On Mon, Dec 11, 2023 at 4:32 AM Gong Yujie <[email protected]> wrote:
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.
I am not sure how we can do this. If you only have 1 dof per cell (I assume), how can we have a blocksize of 3? Thanks, Matt
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
-- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
participants (2)
-
Gong Yujie -
Matthew Knepley