<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="">Yes, it compiles and run correctly<div class=""><span class="Apple-tab-span" style="white-space:pre">      </span>Monica<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 30 Jun 2023, at 12:50, Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>> wrote:</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: 14px; 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 Fri, Jun 30, 2023 at 6:47 AM Ngoc Mai Monica Huynh <<a href="mailto:ngocmaimonica.huynh@unipv.it" class="">ngocmaimonica.huynh@unipv.it</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="">Hi,<div class=""><br class=""></div><div class="">I have no problem now in compiling, thank you for providing the Fortran interface.</div><div class="">I have a follow up question.</div><div class="">When running the code, I get this error, which I’m pretty sure it is related to DMDAGetElements(), since up to that line everything works fine.</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">[0]PETSC ERROR: ------------------------------------------------------------------------</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">[0]PETSC ERROR: or see<span class="Apple-converted-space"> </span><a href="https://petsc.org/release/faq/#valgrind" target="_blank" class="">https://petsc.org/release/faq/#valgrind</a><span class="Apple-converted-space"> </span>and<span class="Apple-converted-space"> </span><a href="https://petsc.org/release/faq/" target="_blank" class="">https://petsc.org/release/faq/</a></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">[0]PETSC ERROR: ---------------------  Stack Frames ------------------------------------</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">[0]PETSC ERROR: No error traceback is available, the problem could be in the main program. </span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">--------------------------------------------------------------------------</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">with errorcode 59.</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; min-height: 20px;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""></span><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">You may or may not see output from other processes, depending on</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">exactly when Open MPI kills them.</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">—————————————————————————————————————</span></div></div><div style="margin: 0px; font-stretch: normal; font-size: 17px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div style="margin: 0px; font-stretch: normal; font-size: 17px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><span style="font-family: Helvetica; font-size: 14px;" class="">The lines of code I’m working on are the following:</span></span></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">      integer ierr</span></div></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">      MPI_Comm comm</span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">      DM da3d</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">      ISLocalToGlobalMapping map</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">     <span class="Apple-converted-space"> </span>PetscInt nel,nen</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">     <span class="Apple-converted-space"> </span>PetscInt, pointer :: e_loc(:)</span></div></span></div></div></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">      </span><span style="font-variant-ligatures: no-common-ligatures;" class="">call</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>DMDACreate3d(comm,DM_BOUNDARY_NONE,DM_BOUNDARY_NONE,</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">    <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">&</span><span style="font-variant-ligatures: no-common-ligatures;" class="">                 <span class="Apple-converted-space"> </span>DM_BOUNDARY_NONE,DMDA_STENCIL_BOX,433,41,29,</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">    <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">&</span><span style="font-variant-ligatures: no-common-ligatures;" class="">                 <span class="Apple-converted-space"> </span>8,2,1,</span><span style="font-variant-ligatures: no-common-ligatures;" class="">3</span><span style="font-variant-ligatures: no-common-ligatures;" class="">,</span><span style="font-variant-ligatures: no-common-ligatures;" class="">1</span><span style="font-variant-ligatures: no-common-ligatures;" class="">,PETSC_NULL_INTEGER,</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">    <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">&</span><span style="font-variant-ligatures: no-common-ligatures;" class="">                 <span class="Apple-converted-space"> </span>PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">    <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">&</span><span style="font-variant-ligatures: no-common-ligatures;" class="">                 <span class="Apple-converted-space"> </span>da3d,ierr)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">      </span><span style="font-variant-ligatures: no-common-ligatures;" class="">call</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>DMSetMatType(da3d,MATIS,ierr)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">     <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">call</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>DMSetFromOptions(da3d,ierr)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">     <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">call</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>DMDASetElementType(da3d,DMDA_ELEMENT_Q1,ierr)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">     <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">call</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>DMSetUp(da3d,ierr)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">     <span class="Apple-converted-space"> </span></span><span style="font-variant-ligatures: no-common-ligatures;" class="">call</span><span style="font-variant-ligatures: no-common-ligatures;" class=""><span class="Apple-converted-space"> </span>DMGetLocalToGlobalMapping(da3d,map,ierr)</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class=""></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">     <span class="Apple-converted-space"> </span><span style="font-variant-ligatures: no-common-ligatures;" class="">call</span><span class="Apple-converted-space"> </span>DMDAGetElements(da3d,nel,nen,e_loc,ierr)</span></div></span></div></div></div><div class=""><div class=""><br class=""></div><div class="">By printing in a dummy way any kind of message before and after DMDAGetElements(), I cannot pass over it.</div><div class="">Unfortunately, I cannot run with the debug option on this machine.</div><div class="">Am I calling the routine in a wrong way?</div></div></div></blockquote><div class=""><br class=""></div><div class="">Does</div><div class=""><br class=""></div><div class="">  src/dm/tutorials/ex11f90.F90</div><div class=""><br class=""></div><div class="">run for you?</div><div class=""><br class=""></div><div class=""> <span class="Apple-converted-space"> </span>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=""><div class="">Thanks,</div><div class=""><span style="white-space: pre-wrap;" class="">        </span>Monica</div><div class=""><br class=""></div><div class=""><br class=""><blockquote type="cite" class=""><div class="">On 29 Jun 2023, at 21:09, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank" class="">knepley@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 14px; 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=""><div dir="ltr" class="">On Thu, Jun 29, 2023 at 3:05 PM Ngoc Mai Monica Huynh <<a href="mailto:ngocmaimonica.huynh@unipv.it" target="_blank" class="">ngocmaimonica.huynh@unipv.it</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 dir="auto" class=""><div dir="ltr" class=""></div><div dir="ltr" class="">Thank you.</div><div dir="ltr" class="">Does this mean that DMDARestoreElements() is supported as well now? </div><div dir="ltr" class=""></div></div></blockquote><div class=""><br class=""></div><div class="">Yes.</div><div class=""><br class=""></div><div class=""> Thanks,</div><div class=""><br class=""></div><div class="">   <span class="Apple-converted-space"> </span>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 dir="auto" class=""><div dir="ltr" class="">Monica</div><div dir="ltr" class=""><br class=""></div><div dir="ltr" class=""><br class=""><blockquote type="cite" class="">Il giorno 29 giu 2023, alle ore 20:17, Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank" class="">bsmith@petsc.dev</a>> ha scritto:<br class=""><br class=""></blockquote></div><blockquote type="cite" class=""><div dir="ltr" class=""><div class=""><br class=""></div> <span class=""> </span>The code is ready in the branch <b style="color: rgb(200, 20, 201); font-family: Menlo; font-size: 14px;" class="">barry/2023-06-29/add-dmdagetelements-fortran </b><a href="https://gitlab.com/petsc/petsc/-/merge_requests/6647" target="_blank" class="">https://gitlab.com/petsc/petsc/-/merge_requests/6647</a><div class=""><br class=""></div><div class=""> <span class=""> </span>Barry</div><div class=""><br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Jun 29, 2023, at 12:41 PM, Ngoc Mai Monica Huynh <<a href="mailto:ngocmaimonica.huynh@unipv.it" target="_blank" class="">ngocmaimonica.huynh@unipv.it</a>> wrote:</div><br class=""><div class=""><div class="">That would be amazing, thank you very much!<br class=""><span style="white-space: pre-wrap;" class="">  </span>Monica<br class=""><br class=""><blockquote type="cite" class="">On 29 Jun 2023, at 18:38, Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank" class="">bsmith@petsc.dev</a>> wrote:<br class=""><br class=""><br class="">I can provide the Fortran interface this afternoon.<br class=""><br class=""> Barry<br class=""><br class=""><br class=""><blockquote type="cite" class="">On Jun 29, 2023, at 10:48 AM, Ngoc Mai Monica Huynh <<a href="mailto:ngocmaimonica.huynh@unipv.it" target="_blank" class="">ngocmaimonica.huynh@unipv.it</a>> wrote:<br class=""><br class="">Hi everyone,<span class=""> </span><br class=""><br class="">I would need to use the routine DMDAGetElements() in our Fortran code.<br class="">However, as I read from the manual, there is no Fortran support for this routine.<br class="">Is there any similar alternative there?<br class=""><br class="">Many thanks!<br class="">Best regards,<br class=""><span style="white-space: pre-wrap;" class="">      </span>Monica Huynh<br class=""></blockquote><br class=""></blockquote><br class=""></div></div></blockquote></div><br class=""></div></div></blockquote></div></blockquote></div><br clear="all" class=""><div class=""><br class=""></div><span class="gmail_signature_prefix">--<span class=""> </span></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></div></blockquote></div><br clear="all" class=""><div class=""><br class=""></div><span class="gmail_signature_prefix">--<span class="Apple-converted-space"> </span></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>