<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><div class=""></div><div class=""><br class=""></div>
<!--EndFragment--><div class="">
<meta charset="UTF-8" class=""><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">--</div><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Dr. Sami BEN ELHAJ SALAH<br class="">Ingénieur de Recherche (CNRS)<br class="">Institut Pprime - ISAE - ENSMA<br class="">Mobile: 06.62.51.26.74<br class=""><a href="mailto:sami.ben-elhaj-salah@ensma.fr" class="">Email: sami.ben-elhaj-salah@ensma.fr</a></div><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><a href="https://samiben91.github.io/samibenelhajsalah/index.html" class="">www.samibenelhajsalah.com</a><br class=""><br class=""><br class=""></div></div></div></div>
</div>
<div><br class=""><blockquote type="cite" class=""><div class="">Le 8 juin 2022 à 17:57, Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>> a écrit :</div><br class="Apple-interchange-newline"><div class=""><meta charset="UTF-8" class=""><div dir="ltr" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><div dir="ltr" class="">On Wed, Jun 8, 2022 at 11:24 AM Sami BEN ELHAJ SALAH <<a href="mailto:sami.ben-elhaj-salah@ensma.fr" class="">sami.ben-elhaj-salah@ensma.fr</a>> wrote:<br class=""></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="overflow-wrap: break-word;" class="">Yes, the file "sami.vtu" is loaded correctly in paraview and I have the good output like you.<div class=""><br class=""></div><div class="">In my code, I tried with the same command given in your last answer and I still have the wrong .vtu file.</div></div></blockquote><div class=""><br class=""></div><div class="">Hi Sami,</div><div class=""><br class=""></div><div class="">What do you mean by wrong?</div><div class=""><br class=""></div><div class="">Can you just use the simple procedure:</div><div class=""><br class=""></div><div class=""> PetscCall(DMCreate(comm, dm));<br class=""> PetscCall(DMSetType(*dm, DMPLEX));<br class=""> PetscCall(DMSetFromOptions(*dm));<br class=""> PetscCall(DMViewFromOptions(*dm, NULL, "-dm_view"));<br class=""></div><div class=""><br class=""></div><div class="">This is the one that works for us. Then we can change it in your code one step at a time until you get what you need.</div><div class=""><br class=""></div><div class=""> Thanks,</div><div class=""><br class=""></div><div class=""> Matt</div><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="overflow-wrap: break-word;" class=""><div class="">I use this:<br class=""><div class="">mpirun -np 1 /home/benelhasa/fox_petsc/build_test/bin/Debug/FoXtroT -snes_test_jacobian_view -snes_converged_reason -snes_monitor -ksp_monitor -ksp_xmonitor -dm_plex_filename cub_2C3D8_msh.msh -dm_view vtk:cub_2C3D8_msh.vtu cub_8C3D8.fxt</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Sami,</div><div class=""><br class=""><div class=""><div dir="auto" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class=""><div dir="auto" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class=""><div dir="auto" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class=""><div dir="auto" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class="">--</div><div dir="auto" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class="">Dr. Sami BEN ELHAJ SALAH<br class="">Ingénieur de Recherche (CNRS)<br class="">Institut Pprime - ISAE - ENSMA<br class="">Mobile: 06.62.51.26.74<br class=""><a href="mailto:sami.ben-elhaj-salah@ensma.fr" target="_blank" class="">Email: sami.ben-elhaj-salah@ensma.fr</a></div><div dir="auto" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class=""><a href="https://samiben91.github.io/samibenelhajsalah/index.html" target="_blank" class="">www.samibenelhajsalah.com</a><br class=""><br class=""><br class=""></div></div></div></div></div><div class=""><br class=""><blockquote type="cite" class=""><div class="">Le 8 juin 2022 à 16:25, Jed Brown <<a href="mailto:jed@jedbrown.org" target="_blank" class="">jed@jedbrown.org</a>> a écrit :</div><br class=""><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; float: none; display: inline;" class="">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.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class=""><span id="gmail-m_2080728392201155584cid:9141E41F-766F-4335-99D2-04F631D6CB6F" class=""><sami.vtu></span><span id="gmail-m_2080728392201155584cid:0CECECD3-7616-4FB0-A886-99D8B7F7FC11" class=""><sami.png></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; float: none; display: inline;" class="">Sami BEN ELHAJ SALAH <</span><a href="mailto:sami.ben-elhaj-salah@ensma.fr" target="_blank" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class="">sami.ben-elhaj-salah@ensma.fr</a><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; float: none; display: inline;" class="">> writes:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class="">Hi Jed,<br class=""><br class="">Thank you for your answer.<br class=""><br class="">When I use a ‘’solution.vtu'', I obtain a wrong file.<span class=""> </span><br class=""><br class=""><?xml version="1.0"?><br class=""><VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian"><br class=""><UnstructuredGrid><br class=""><Piece NumberOfPoints="12" NumberOfCells="2"><br class=""><Points><br class=""><DataArray type="Float64" Name="Position" NumberOfComponents="3" format="appended" offset="0" /><br class=""></Points><br class=""><Cells><br class=""><DataArray type="Int32" Name="connectivity" NumberOfComponents="1" format="appended" offset="292" /><br class=""><DataArray type="Int32" Name="offsets" NumberOfComponents="1" format="appended" offset="360" /><br class=""><DataArray type="UInt8" Name="types" NumberOfComponents="1" format="appended" offset="372" /><br class=""></Cells><br class=""><CellData><br class=""><DataArray type="Int32" Name="Rank" NumberOfComponents="1" format="appended" offset="378" /><br class=""></CellData><br class=""><PointData><br class=""><DataArray type="Float64" Name="dU_x(null)" NumberOfComponents="3" format="appended" offset="390" /><br class=""></PointData><br class=""></Piece><br class=""></UnstructuredGrid><br class=""><AppendedData encoding="raw"><br class="">_ $@$@$@$@$@$@$@$@$@$@$@$@4@$@$@4@$@4@4@$@@<span class="Apple-converted-space"> </span><span class="Apple-converted-space"> </span><span style="white-space: pre-wrap;" class=""> </span><br class="">�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��_#�����?<span style="white-space: pre-wrap;" class=""> </span>�333�?��333��b#�����?(�333�?'�333�?a#�����?�333��>�333�?<br class=""></AppendedData><br class=""></VTKFile><br class=""><br class=""><br class="">If I understand your answer, to solve my problem, should just upgrade all my software ?<br class=""><br class="">Thanks,<br class="">Sami,<br class=""><br class=""><br class="">--<br class="">Dr. Sami BEN ELHAJ SALAH<br class="">Ingénieur de Recherche (CNRS)<br class="">Institut Pprime - ISAE - ENSMA<br class="">Mobile: 06.62.51.26.74<br class=""><a href="mailto:sami.ben-elhaj-salah@ensma.fr" target="_blank" class="">Email: sami.ben-elhaj-salah@ensma.fr</a><br class=""><a href="http://www.samibenelhajsalah.com/" target="_blank" class="">www.samibenelhajsalah.com</a><span class=""> </span><<a href="https://samiben91.github.io/samibenelhajsalah/index.html" target="_blank" class="">https://samiben91.github.io/samibenelhajsalah/index.html</a>><br class=""><br class=""><br class=""><br class=""><blockquote type="cite" class="">Le 8 juin 2022 à 15:37, Jed Brown <<a href="mailto:jed@jedbrown.org" target="_blank" class="">jed@jedbrown.org</a>> a écrit :<br class=""><br class="">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?<br class=""><br class="">Sami BEN ELHAJ SALAH <<a href="mailto:sami.ben-elhaj-salah@ensma.fr" target="_blank" class="">sami.ben-elhaj-salah@ensma.fr</a>> writes:<br class=""><br class=""><blockquote type="cite" class="">Dear Petsc Developer team,<br class=""><br class="">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.<br class=""><br class="">1) Algorithm 1<span class=""> </span><br class="">err = SNESSolve(_snes, bc_vec_test, solution);<br class="">CHKERRABORT(FOX::Parallel::COMM_WORLD,err);<br class="">PetscViewer vtk;<span class=""> </span><br class="">PetscViewerVTKOpen(FOX::Parallel::COMM_WORLD,"solution.vtk",FILE_MODE_WRITE,&vtk);<span class=""> </span><br class="">VecView(solution,vtk);<br class="">PetscViewerDestroy(&vtk);<br class=""><br class=""><br class="">2) Algorithm 2<br class="">err = SNESSolve(_snes, bc_vec_test, solution);<br class="">CHKERRABORT(FOX::Parallel::COMM_WORLD,err);<br class="">PetscViewer vtk;<span class=""> </span><br class="">PetscViewerCreate(FOX::Parallel::COMM_WORLD, &vtk);<span class=""> </span><br class="">PetscViewerSetType(vtk, PETSCVIEWERVTK);<span class=""> </span><br class="">PetscViewerFileSetName(vtk, "sol.vtk");<span class=""> </span><br class="">VecView(solution, vtk);<span class=""> </span><br class="">PetscViewerDestroy(&vtk);<br class=""><br class="">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?<br class=""><br class="">Other information used:<br class="">- gmsh format 2.2<span class=""> </span><br class="">- Vtk version: 7.1.1<br class="">- Petsc version: 3.13/opt<span class=""> </span><br class=""><br class="">Below my two files gmsh and vtk:<br class=""><br class="">Gmsh file:<br class="">$MeshFormat<br class="">2.2 0 8<br class="">$EndMeshFormat<br class="">$Nodes<br class="">12<br class="">1 0.0 10.0 10.0<br class="">2 0.0 0.0 10.0<br class="">3 0.0 0.0 0.0<br class="">4 0.0 10.0 0.0<br class="">5 10.0 10.0 10.0<br class="">6 10.0 0.0 10.0<br class="">7 10.0 0.0 0.0<br class="">8 10.0 10.0 0.0<br class="">9 20.0 10.0 10.0<br class="">10 20.0 0.0 10.0<br class="">11 20.0 0.0 0.0<br class="">12 20.0 10.0 0.0<br class="">$EndNodes<br class="">$Elements<br class="">2<br class="">1 5 2 68 60 1 2 3 4 5 6 7 8<br class="">2 5 2 68 60 5 6 7 8 9 10 11 12<br class="">$EndElements<br class=""><br class="">Vtk file :<br class=""># vtk DataFile Version 2.0<br class="">Simplicial Mesh Example<br class="">ASCII<br class="">DATASET UNSTRUCTURED_GRID<br class="">POINTS 12 double<br class="">0.000000e+00 1.000000e+01 1.000000e+01<br class="">0.000000e+00 0.000000e+00 1.000000e+01<br class="">0.000000e+00 0.000000e+00 0.000000e+00<br class="">0.000000e+00 1.000000e+01 0.000000e+00<br class="">1.000000e+01 1.000000e+01 1.000000e+01<br class="">1.000000e+01 0.000000e+00 1.000000e+01<br class="">1.000000e+01 0.000000e+00 0.000000e+00<br class="">1.000000e+01 1.000000e+01 0.000000e+00<br class="">2.000000e+01 1.000000e+01 1.000000e+01<br class="">2.000000e+01 0.000000e+00 1.000000e+01<br class="">2.000000e+01 0.000000e+00 0.000000e+00<br class="">2.000000e+01 1.000000e+01 0.000000e+00<br class="">CELLS 2 18<br class="">8 0 3 2 1 4 5 6 7<br class="">8 4 7 6 5 8 9 10 11<br class="">CELL_TYPES 2<br class="">12<br class="">12<br class="">POINT_DATA 12<br class="">VECTORS dU_x double<br class="">2.754808e-10 -8.653846e-11 -8.653846e-11<br class="">2.754808e-10 8.653846e-11 -8.653846e-11<br class="">2.754808e-10 8.653846e-11 8.653846e-11<br class="">2.754808e-10 -8.653846e-11 8.653846e-11<br class="">4.678571e-01 -9.107143e-02 -9.107143e-02<br class="">4.678571e-01 9.107143e-02 -9.107143e-02<br class="">4.678571e-01 9.107143e-02 9.107143e-02<br class="">4.678571e-01 -9.107143e-02 9.107143e-02<br class="">1.000000e+00 -7.500000e-02 -7.500000e-02<br class="">1.000000e+00 7.500000e-02 -7.500000e-02<br class="">1.000000e+00 7.500000e-02 7.500000e-02<br class="">1.000000e+00 -7.500000e-02 7.500000e-02<br class=""><br class="">Thank you in advance and have a good day !<br class=""><br class="">Sami,<br class=""><br class="">--<br class="">Dr. Sami BEN ELHAJ SALAH<br class="">Ingénieur de Recherche (CNRS)<br class="">Institut Pprime - ISAE - ENSMA<br class="">Mobile: 06.62.51.26.74<br class="">Email:<span class="Apple-converted-space"> </span><a href="mailto:sami.ben-elhaj-salah@ensma.fr" target="_blank" class="">sami.ben-elhaj-salah@ensma.fr</a><br class=""><a href="http://www.samibenelhajsalah.com/" target="_blank" class="">www.samibenelhajsalah.com</a><span class="Apple-converted-space"> </span><<a href="https://samiben91.github.io/samibenelhajsalah/index.html" target="_blank" class="">https://samiben91.github.io/samibenelhajsalah/index.html</a>></blockquote></blockquote></blockquote></div></blockquote></div><br class=""></div></div></div></blockquote></div><br clear="all" class=""><div class=""><br class=""></div>--<span class="Apple-converted-space"> </span><br class=""><div dir="ltr" class="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">-- Norbert Wiener</div><div class=""><br class=""></div><div class=""><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank" class="">https://www.cse.buffalo.edu/~knepley/</a></div></div></div></div></div></div></div></div></div></blockquote></div><br class=""></div></body></html>