Does the file load in paraview? When I load your *.msh in a tutorial with -dm_plex_filename sami.msh -dm_view vtk:sami.vtu, I get this good output.
sami.vtu
Description: model/vnd.vtu
Sami BEN ELHAJ SALAH <[email protected]> writes: > Hi Jed, > > Thank you for your answer. > > When I use a ‘’solution.vtu'', I obtain a wrong file. > > <?xml version="1.0"?> > <VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian"> > <UnstructuredGrid> > <Piece NumberOfPoints="12" NumberOfCells="2"> > <Points> > <DataArray type="Float64" Name="Position" NumberOfComponents="3" > format="appended" offset="0" /> > </Points> > <Cells> > <DataArray type="Int32" Name="connectivity" NumberOfComponents="1" > format="appended" offset="292" /> > <DataArray type="Int32" Name="offsets" NumberOfComponents="1" > format="appended" offset="360" /> > <DataArray type="UInt8" Name="types" NumberOfComponents="1" > format="appended" offset="372" /> > </Cells> > <CellData> > <DataArray type="Int32" Name="Rank" NumberOfComponents="1" > format="appended" offset="378" /> > </CellData> > <PointData> > <DataArray type="Float64" Name="dU_x(null)" NumberOfComponents="3" > format="appended" offset="390" /> > </PointData> > </Piece> > </UnstructuredGrid> > <AppendedData encoding="raw"> > _ > $@ $@ $@ $@ $@ $@ $@ $@ $@ $@ $@ $@ 4@ $@ $@ 4@ $@ 4@ 4@ $@ @ > > > �p�O��=��sT����sT���p�O��=��sT���=��sT���p�O��=��sT���=��sT���=�p�O��=��sT����sT���=o_��?��uP����uP��o_��?��uP�?��uP��o_��?��uP�?��uP�?o_��?��uP����uP�?b#�����?�333����333��_#�����? > �333�?��333��b#�����?(�333�?'�333�?a#�����?�333��>�333�? > </AppendedData> > </VTKFile> > > > If I understand your answer, to solve my problem, should just upgrade all my > software ? > > Thanks, > Sami, > > > -- > Dr. Sami BEN ELHAJ SALAH > Ingénieur de Recherche (CNRS) > Institut Pprime - ISAE - ENSMA > Mobile: 06.62.51.26.74 > Email: [email protected] > www.samibenelhajsalah.com > <https://samiben91.github.io/samibenelhajsalah/index.html> > > > >> Le 8 juin 2022 à 15:37, Jed Brown <[email protected]> a écrit : >> >> You're using pretty old versions of all software; I'd recommend upgrading. I >> recommend choosing the file name "solution.vtu" to use the modern >> (non-legacy) format. Does that work for you? >> >> Sami BEN ELHAJ SALAH <[email protected]> writes: >> >>> Dear Petsc Developer team, >>> >>> I solved a linear elastic problem in 3D using a DMPLEX. My system is >>> converging, then I would like to write out my solution vector to a vtk file >>> where I use unstructured mesh. Currently, I tried two algorithms and I have >>> the same result. >>> >>> 1) Algorithm 1 >>> err = SNESSolve(_snes, bc_vec_test, solution); >>> CHKERRABORT(FOX::Parallel::COMM_WORLD,err); >>> PetscViewer vtk; >>> PetscViewerVTKOpen(FOX::Parallel::COMM_WORLD,"solution.vtk",FILE_MODE_WRITE,&vtk); >>> >>> VecView(solution,vtk); >>> PetscViewerDestroy(&vtk); >>> >>> >>> 2) Algorithm 2 >>> err = SNESSolve(_snes, bc_vec_test, solution); >>> CHKERRABORT(FOX::Parallel::COMM_WORLD,err); >>> PetscViewer vtk; >>> PetscViewerCreate(FOX::Parallel::COMM_WORLD, &vtk); >>> PetscViewerSetType(vtk, PETSCVIEWERVTK); >>> PetscViewerFileSetName(vtk, "sol.vtk"); >>> VecView(solution, vtk); >>> PetscViewerDestroy(&vtk); >>> >>> The result seems correct except for the rotation order of the nodes (see >>> the red lines on gmsh and vtk file respectively). Then, I visualized my vtk >>> file with paraview, and I remarked that my geometry is not correct and not >>> conserved when comparing it with my gmsh file. So, I didn’t understand why >>> the rotation order of nodes is not conserved when saving my result to a >>> vtk file? >>> >>> Other information used: >>> - gmsh format 2.2 >>> - Vtk version: 7.1.1 >>> - Petsc version: 3.13/opt >>> >>> Below my two files gmsh and vtk: >>> >>> Gmsh file: >>> $MeshFormat >>> 2.2 0 8 >>> $EndMeshFormat >>> $Nodes >>> 12 >>> 1 0.0 10.0 10.0 >>> 2 0.0 0.0 10.0 >>> 3 0.0 0.0 0.0 >>> 4 0.0 10.0 0.0 >>> 5 10.0 10.0 10.0 >>> 6 10.0 0.0 10.0 >>> 7 10.0 0.0 0.0 >>> 8 10.0 10.0 0.0 >>> 9 20.0 10.0 10.0 >>> 10 20.0 0.0 10.0 >>> 11 20.0 0.0 0.0 >>> 12 20.0 10.0 0.0 >>> $EndNodes >>> $Elements >>> 2 >>> 1 5 2 68 60 1 2 3 4 5 6 7 8 >>> 2 5 2 68 60 5 6 7 8 9 10 11 12 >>> $EndElements >>> >>> Vtk file : >>> # vtk DataFile Version 2.0 >>> Simplicial Mesh Example >>> ASCII >>> DATASET UNSTRUCTURED_GRID >>> POINTS 12 double >>> 0.000000e+00 1.000000e+01 1.000000e+01 >>> 0.000000e+00 0.000000e+00 1.000000e+01 >>> 0.000000e+00 0.000000e+00 0.000000e+00 >>> 0.000000e+00 1.000000e+01 0.000000e+00 >>> 1.000000e+01 1.000000e+01 1.000000e+01 >>> 1.000000e+01 0.000000e+00 1.000000e+01 >>> 1.000000e+01 0.000000e+00 0.000000e+00 >>> 1.000000e+01 1.000000e+01 0.000000e+00 >>> 2.000000e+01 1.000000e+01 1.000000e+01 >>> 2.000000e+01 0.000000e+00 1.000000e+01 >>> 2.000000e+01 0.000000e+00 0.000000e+00 >>> 2.000000e+01 1.000000e+01 0.000000e+00 >>> CELLS 2 18 >>> 8 0 3 2 1 4 5 6 7 >>> 8 4 7 6 5 8 9 10 11 >>> CELL_TYPES 2 >>> 12 >>> 12 >>> POINT_DATA 12 >>> VECTORS dU_x double >>> 2.754808e-10 -8.653846e-11 -8.653846e-11 >>> 2.754808e-10 8.653846e-11 -8.653846e-11 >>> 2.754808e-10 8.653846e-11 8.653846e-11 >>> 2.754808e-10 -8.653846e-11 8.653846e-11 >>> 4.678571e-01 -9.107143e-02 -9.107143e-02 >>> 4.678571e-01 9.107143e-02 -9.107143e-02 >>> 4.678571e-01 9.107143e-02 9.107143e-02 >>> 4.678571e-01 -9.107143e-02 9.107143e-02 >>> 1.000000e+00 -7.500000e-02 -7.500000e-02 >>> 1.000000e+00 7.500000e-02 -7.500000e-02 >>> 1.000000e+00 7.500000e-02 7.500000e-02 >>> 1.000000e+00 -7.500000e-02 7.500000e-02 >>> >>> Thank you in advance and have a good day ! >>> >>> Sami, >>> >>> -- >>> Dr. Sami BEN ELHAJ SALAH >>> Ingénieur de Recherche (CNRS) >>> Institut Pprime - ISAE - ENSMA >>> Mobile: 06.62.51.26.74 >>> Email: [email protected] >>> www.samibenelhajsalah.com >>> <https://samiben91.github.io/samibenelhajsalah/index.html>
