<div dir="ltr"><div><div>Hi Matt,<br><br>Bumping this thread. I have a similar question. The lines you wrote for testnum 39 have also worked perfectly for me. However, when I change a couple parameters, namely not interpolating the mesh and using -petscspace_order 1:<br><br>./ex12 -run_type full -refinement_limit 0.015625 -petscspace_order 1 -pc_type gamg -ksp_rtol 1.0e-10 -ksp_monitor_short -ksp_converged_reason -snes_monitor_short -snes_converged_reason -dm_view hdf5:sol.h5 -snes_view_solution hdf5:sol.h5::append<br><br></div>I get the following error after I run the xdmf script:<br><br>Traceback (most recent call last):<br> File "./bin/pythonscripts/petsc_gen_xdmf.py", line 223, in <module><br> generateXdmf(sys.argv[1])<br> File "./bin/pythonscripts/petsc_gen_xdmf.py", line 218, in generateXdmf<br> Xdmf(xdmfFilename).write(hdfFilename, topoPath, numCells, numCorners, cellDim, geomPath, numVertices, spaceDim, time, vfields, cfields)<br> File "./bin/pythonscripts/petsc_gen_xdmf.py", line 176, in write<br> self.writeSpaceGridHeader(fp, numCells, numCorners, cellDim, spaceDim)<br> File "./bin/pythonscripts/petsc_gen_xdmf.py", line 75, in writeSpaceGridHeader<br> ''' % (self.cellMap[cellDim][numCorners], numCells, "XYZ" if spaceDim > 2 else "XY"))<br><br></div>Does the script so far only work for interpolated meshes/problems?<br><br>Thanks,<br>Justin<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Sep 28, 2014 at 11:15 AM, subramanya sadasiva <span dir="ltr"><<a href="mailto:potaman@outlook.com" target="_blank">potaman@outlook.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div dir="ltr">Thanks Matt, <div>That worked perfectly. </div><div><br></div><div>Subramanya <br><br><div><hr>Date: Fri, 26 Sep 2014 14:52:52 -0500<span class=""><br>Subject: Re: [petsc-users] Generating xdmf from h5 file.<br>From: <a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a><br>To: <a href="mailto:potaman@outlook.com" target="_blank">potaman@outlook.com</a><br></span>CC: <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a><div><div class="h5"><br><br><div dir="ltr"><div><div>On Thu, Sep 25, 2014 at 10:29 PM, subramanya sadasiva <span dir="ltr"><<a href="mailto:potaman@outlook.com" target="_blank">potaman@outlook.com</a>></span> wrote:<br><blockquote style="border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div dir="ltr">Hi Matt, <div>Sorry about that, </div><div>I changed </div><div><div>if 'time' in h5:</div><div> time = np.array(h5['time']).flatten()</div><div> else:</div><div> time = np.empty(1)</div><div><br></div>The code now fails in the writeSpaceGridHeader function. with the error, </div>
<br><br>Traceback (most recent call last):<br>
File "/Users/ssadasiv/software/petsc/bin/pythonscripts/petsc_gen_xdmf.py", line 232, in <module><br>
generateXdmf(sys.argv[1])<br>
File "/Users/ssadasiv/software/petsc/bin/pythonscripts/petsc_gen_xdmf.py", line 227, in generateXdmf<br>
Xdmf(xdmfFilename).write(hdfFilename, topoPath, numCells, numCorners, cellDim, geomPath, numVertices, spaceDim, time, vfields, cfields)<br>
File "/Users/ssadasiv/software/petsc/bin/pythonscripts/petsc_gen_xdmf.py", line 180, in write<br>
self.writeSpaceGridHeader(fp, numCells, numCorners, cellDim, spaceDim)<br>
File "/Users/ssadasiv/software/petsc/bin/pythonscripts/petsc_gen_xdmf.py", line 64, in writeSpaceGridHeader<br>
<div><span style="font-size:12pt"> </span><span style="font-size:12pt">print self.cellMap[cellDim][numCorners]</span><span style="font-size:12pt"> </span></div><div><span style="font-size:12pt"><br></span></div><div><span style="font-size:12pt">The error is due to the fact that numCorners is set to be 1 , while celldim=2. cellMap has the following elements. </span></div><div>
{1: {1: 'Polyvertex', 2: 'Polyline'}, 2: {3: 'Triangle', 4: 'Quadrilateral'}, 3: {8: 'Hexahedron', 4: 'Tetrahedron'}}<br><br><br>I also tried <br>./ex12 -dm_view vtk:my.vtk:vtk_vtu . This doesn't seem to do anything. Is there any specific option I need to build petsc with to get vtk output? My current build has hdf5 and netcdf enabled. <br></div></div></div></blockquote><div>I made the change in a branch, and merged to 'next', so it will work if you pull. Here is a test from ex12 (testnum 39 in builder.py):</div><div><br></div><div> ./ex12 -run_type full -refinement_limit 0.015625 -interpolate 1 -petscspace_order 2 -pc_type gamg -ksp_rtol 1.0e-10 -ksp_monitor_short -ksp_converged_reason -snes_monitor_short -snes_converged_reason -dm_view hdf5:sol.h5 -snes_view_solution hdf5:sol.h5::append<br></div><div><br></div><div>which makes sol.h5. Then I run</div><div><br></div><div> ./bin/pythonscripts/petsc_gen_xdmf.py sol.h5</div><div><br></div><div>which makes sol.xmf. I load it up in Paraview and it makes the attached picture.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote style="border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div dir="ltr"><div>Thanks,<br>Subramanya <br></div><div><span style="font-size:12pt"><br></span></div><div><span style="font-size:12pt">Date: Wed, 24 Sep 2014 17:36:52 -0500</span><div>Subject: Re: [petsc-users] Generating xdmf from h5 file.<br>From: <a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a><br>To: <a href="mailto:potaman@outlook.com" target="_blank">potaman@outlook.com</a>; <a href="mailto:petsc-maint@mcs.anl.gov" target="_blank">petsc-maint@mcs.anl.gov</a>; <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a><br><br><div dir="ltr"><div><div>On Wed, Sep 24, 2014 at 5:29 PM, subramanya sadasiva <span dir="ltr"><<a href="mailto:potaman@outlook.com" target="_blank">potaman@outlook.com</a>></span> wrote:<br><blockquote style="border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div dir="ltr">Hi Matt, <br>That did not help.</div></div></blockquote><div><br></div><div>That's not enough description to fix anything, and fixing it will require programming.</div><div> </div><blockquote style="border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div dir="ltr"> Is there any other way to output the mesh to something that paraview can view? I tried outputting the file to a vtk file using <br>ex12 -dm_view vtk:my.vtk:ascii_vtk <br><br>which, I saw in another post on the forums, but that did not give me any output. <br></div></div></blockquote><div><br></div><div>This is mixing two different things. PETSc has a diagnostic ASCII vtk output, so the type would be ascii, not vtk,</div><div>and format ascii_vtk . It also has a production VTU output, which is type vtk with format vtk_vtu.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote style="border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div dir="ltr"><br>Subramanya<br><br><div><hr>Date: Wed, 24 Sep 2014 17:19:51 -0500<br>Subject: Re: [petsc-users] Generating xdmf from h5 file.<br>From: <a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a><br>To: <a href="mailto:potaman@outlook.com" target="_blank">potaman@outlook.com</a><br>CC: <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a><br><br><div dir="ltr"><div><div>On Wed, Sep 24, 2014 at 5:08 PM, subramanya sadasiva <span dir="ltr"><<a href="mailto:potaman@outlook.com" target="_blank">potaman@outlook.com</a>></span> wrote:<br><blockquote style="border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div dir="ltr">Hi, <br>i was trying to use petsc_gen_xdmf.py to convert a h5 file to a xdmf file. The h5 file was generated by snes/ex12 which was run as, <br><br>ex12 -dm_view hdf5:my.h5 <br><br>When I do, <br>petsc_gen_xdmf.py my.h5 <br><br>I get the following error, <br><br> File "/home/ssadasiv/software/petsc/bin/pythonscripts/petsc_gen_xdmf.py", line 220, in <module><br> generateXdmf(sys.argv[1])<br> File "/home/ssadasiv/software/petsc/bin/pythonscripts/petsc_gen_xdmf.py", line 208, in generateXdmf<br> time = np.array(h5['time']).flatten()<br> File "/usr/lib/python2.7/dist-packages/h5py/_hl/group.py", line 153, in __getitem__<br> oid = h5o.open(<a href="http://self.id" target="_blank">self.id</a>, self._e(name), lapl=self._lapl)<br> File "h5o.pyx", line 173, in h5py.h5o.open (h5py/h5o.c:3403)<br>KeyError: "unable to open object (Symbol table: Can't open object)"<br><br>I am not sure if the error is on my end. This is on Ubuntu 14.04 with the serial version of hdf5. I built petsc with --download-hdf5, is it necessary to use the same version of hdf5 to generate the xdmf file? <br></div></div></blockquote><div><br></div><div>That code is alpha, and mainly built for me to experiment with an application here, so it is not user-friendly. In your</div><div>HDF5 file, there is no 'time' since you are not running a TS. This access to h5['time'] should just be protected, and</div><div>an empty array should be put in if its not there.</div><div><br></div><div> Matt</div><div> </div><blockquote style="border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div dir="ltr">Thanks<span><font color="#888888"><br>Subramanya <br><span><font color="#888888"> </font></span></font></span></div></div><span><font color="#888888">
</font></span></blockquote></div><span><font color="#888888"><br><br clear="all"><span><font color="#888888"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener
</font></span></font></span></div></div></div><span><font color="#888888"> </font></span></div></div><span><font color="#888888">
</font></span></blockquote></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener
</font></span></div></div></div></div> </div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener
</div></div></div></div></div></div> </div></div>
</blockquote></div><br></div>