<div dir="ltr"><div dir="ltr">On Wed, Jul 14, 2021 at 3:47 PM Alfredo J Duarte Gomez <<a href="mailto:aduarteg@utexas.edu">aduarteg@utexas.edu</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Good morning,</div><div><br></div><div>We are currently developing a PETSC application on a structured grid, however, we are applying a curvilinear transformation so that the physical domain is not a rectangle (the computational domain is).</div><div><br></div><div>As a result we are trying to load in a mesh into the PETSC dmda object to create easy visualizations. I have successfully done this through the following code:</div><div><br></div><div> ierr=VecCreateMPI(PETSC_COMM_WORLD,PETSC_DECIDE,6400,&co);CHKERRQ(ierr);<br> ierr=PetscObjectSetName((PetscObject) co, "coordinates");CHKERRQ(ierr);<br> ierr=PetscViewerHDF5Open(PETSC_COMM_WORLD,"coord2d.h5",FILE_MODE_READ,&viewer);CHKERRQ(ierr);<br> ierr=VecLoad(co,viewer);CHKERRQ(ierr);<br> ierr=PetscViewerDestroy(&viewer);CHKERRQ(ierr);<br> ierr=DMSetCoordinates(da,co);CHKERRQ(ierr);</div><div><br></div><div>Where my coordinate vector in HDF5 format is a single column vector in the order x1,y1,x2,y2,...xN,yN,etc. where 1 is the lower left corner and N. However this seems like a rather crude way of doing it, it seems like using the DMGetCoordinateDM() and DMCreateGlobalVector() is a more sophisticated way of leveraging the dmda object, however when I use:</div><div><br></div><div>DMGetCoordinateDM(da, &cda);<br>DMCreateGlobalVector(cda, &co);<br>ierr=PetscObjectSetName((PetscObject) co, "coordinates");CHKERRQ(ierr);<br>ierr=PetscViewerHDF5Open(PETSC_COMM_WORLD,"coord2d.h5",FILE_MODE_READ,&viewer);CHKERRQ(ierr);<br>ierr=VecLoad(co,viewer);CHKERRQ(ierr);<br>ierr=PetscViewerDestroy(&viewer);CHKERRQ(ierr);<br>ierr=DMSetCoordinates(da,co);CHKERRQ(ierr);</div><div><br></div><div>The loading function complains about the structure/format of my data. I haven't been able to find the format that this coordinate dmda expects from an HDF5 file in any of the documentation. Is there anywhere I could find this information?</div></div></div></div></blockquote><div><br></div><div>Yes, I agree that it should work that way. You have to show me the complaint, or a small example that I can run. Perhaps</div><div>it is the fact that the coordinate vector will have a block size (the spatial dimension), which your HDF5 data may be missing.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Thank you,</div><div><br></div><div>-Alfredo <br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><font face="arial, sans-serif">Alfredo Duarte</font><div><font face="arial, sans-serif">Graduate Research Assistant</font></div><div><font face="arial, sans-serif">The University of Texas at Austin</font></div></div></div></div></div></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>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><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>