<div dir="ltr">Hi, Sawsan,<div> I could build your code and I also could gdb it.</div><div><br></div><div>$ gdb ./GW.exe</div><div>...</div><div>$ Thread 1 "GW.exe" received signal SIGSEGV, Segmentation fault.</div>0x00007ffff1e6d44f in vecgetarray_ (x=0x7fffffffa718, fa=0x0, ia=0x7fffffffa75c, ierr=0x0) at /scratch/jczhang/petsc/src/vec/vec/interface/ftn-custom/zvectorf.c:257<br>257       *ierr = VecGetArray(*x, &lx);<br>(gdb) bt<br>#0  0x00007ffff1e6d44f in vecgetarray_ (x=0x7fffffffa718, fa=0x0, ia=0x7fffffffa75c, ierr=0x0) at /scratch/jczhang/petsc/src/vec/vec/interface/ftn-custom/zvectorf.c:257<br>#1  0x000000000040b6e3 in gw_solver (t_s=1.40129846e-45, n=300) at GW_solver_try.F90:169<br>#2  0x000000000040c6a8 in test_gw () at test_main.F90:35<div> </div><div><font color="#ff0000">ierr=0x0  </font><font color="#000000">caused the segfault.  See </font><a href="https://petsc.org/release/manualpages/Vec/VecGetArray/#vecgetarray">https://petsc.org/release/manualpages/Vec/VecGetArray/#vecgetarray</a>, you should use VecGetArrayF90 instead.<br></div><div><br></div><div>BTW,  Barry,  the code <a href="https://github.com/sshatanawi/SS_GWM/blob/main/GW_solver_try.F90#L169">https://github.com/sshatanawi/SS_GWM/blob/main/GW_solver_try.F90#L169</a> has "call VecGetArray(temp_solution, H_vector, ierr)".    I don't find petsc Fortran examples doing VecGetArray.  Do we still support it?</div><div><br></div><div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">--Junchao Zhang</div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 10, 2024 at 2:38 PM Shatanawi, Sawsan Muhammad via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg5694742774502394814">




<div dir="ltr">
<div><span style="letter-spacing:normal;font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;font-weight:400;color:rgb(0,0,0)">Hello all,</span></div>
<div style="text-align:left;margin:0px"><span style="letter-spacing:normal;font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;font-weight:400;color:rgb(0,0,0)"><br>
</span></div>
<div style="text-align:left;margin:0px"><span style="letter-spacing:normal;font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;font-weight:400;color:rgb(0,0,0)">I hope you are doing well.</span></div>
<div style="text-align:left;margin:0px"><span style="letter-spacing:normal;font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;font-weight:400;color:rgb(0,0,0)"><br>
</span></div>
<div style="text-align:left;margin:0px"><span style="letter-spacing:normal;font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;font-weight:400;color:rgb(0,0,0)">Generally, I use gdb <the
 name of my exe.file> to debug the code.</span></div>
<div style="text-align:left;margin:0px"><span style="letter-spacing:normal;font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;font-weight:400;color:rgb(0,0,0)"> I got the attached error
 message.</span></div>
<div style="text-align:left;margin:0px"><span style="letter-spacing:normal;font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;font-weight:400;color:rgb(0,0,0)"><br>
</span></div>
<div style="text-align:left;margin:0px"><span style="letter-spacing:normal;font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;font-weight:400;color:rgb(0,0,0)">I have tried to add the flag
 -start_in_debugger in the make file, but it didn't work, so it seems I was doing it in the wrong way</span></div>
<div style="text-align:left;margin:0px"><span style="letter-spacing:normal;font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;font-weight:400;color:rgb(0,0,0)"><br>
</span></div>
<div style="text-align:left;margin:0px"><span style="letter-spacing:normal;font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;font-weight:400;color:rgb(0,0,0)">This is the link for the whole
 code: <a href="https://github.com/sshatanawi/SS_GWM" id="m_5694742774502394814OWA37645568-445c-55da-2f91-abc541b1f4d6" style="margin:0px" target="_blank">sshatanawi/SS_GWM (github.com)</a></span></div>
<div style="font-style:normal;font-weight:400;font-size:medium;margin:0px;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px">
<div id="m_5694742774502394814LPBorder_GTaHR0cHM6Ly9naXRodWIuY29tL3NzaGF0YW5hd2kvU1NfR1dN" style="margin:16px 0px;max-width:800px;min-width:424px">
<table id="m_5694742774502394814LPContainer867037" style="padding:12px 36px 12px 12px;width:600px;border-width:1px;border-style:solid;border-color:rgb(200,200,200);border-radius:2px">
<tbody>
<tr valign="top" style="border-spacing:0px">
<td>
<div id="m_5694742774502394814LPImageContainer867037" style="margin:0px 12px 0px 0px;height:120px;overflow:hidden">
<a id="m_5694742774502394814LPImageAnchor867037" href="https://github.com/sshatanawi/SS_GWM" style="margin:0px" target="_blank"><img id="m_5694742774502394814LPThumbnailImageId867037" alt="" height="120" width="240" style="margin: 0px; display: block;" src="https://opengraph.githubassets.com/9eb6cd14baf12f04848ed209b6f502415eb531bdd7b3a5f9696af68663b870c0/sshatanawi/SS_GWM"></a></div>
</td>
<td style="width:289.6px">
<div id="m_5694742774502394814LPTitle867037" style="font-weight:300;font-size:21px;font-family:wf_segoe-ui_light,"Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;margin:0px 8px 12px 0px">
<a id="m_5694742774502394814LPUrlAnchor867037" href="https://github.com/sshatanawi/SS_GWM" style="margin:0px;text-decoration:none" target="_blank">GitHub - sshatanawi/SS_GWM</a></div>
<div id="m_5694742774502394814LPDescription867037" style="font-size:14px;font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;margin:0px 8px 12px 0px;max-height:100px;overflow:hidden;color:rgb(102,102,102)">
Contribute to sshatanawi/SS_GWM development by creating an account on GitHub.</div>
<div id="m_5694742774502394814LPMetadata867037" style="font-size:14px;font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;margin:0px;color:rgb(166,166,166)">
<a href="http://github.com" target="_blank">github.com</a></div>
</td>
</tr>
</tbody>
</table>
<div id="m_5694742774502394814LPCloseButtonContainer867037" title="Remove link preview" role="button">
<i aria-hidden="true" id="m_5694742774502394814LPCloseButton867037"></i></div>
</div>
</div>
<div style="text-align:left;margin:0px"><span style="letter-spacing:normal;font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;font-weight:400;color:rgb(0,0,0)"><br>
</span></div>
<div style="text-align:left;margin:0px"><span style="letter-spacing:normal;font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;font-weight:400;color:rgb(0,0,0)">You
 can read the description of the code in " </span><span style="letter-spacing:normal;font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;font-weight:400;color:rgb(12,100,192)">Model Desprciption.pdf</span><span style="letter-spacing:normal;font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;font-weight:400;color:rgb(0,0,0)">"</span></div>
<div style="text-align:left;margin:0px"><span style="letter-spacing:normal;font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;font-weight:400;color:rgb(0,0,0)">the compiling file is </span><span style="letter-spacing:normal;font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;font-weight:400;color:rgb(12,100,192)">makefile_f90</span><span style="letter-spacing:normal;font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;font-weight:400;color:rgb(0,0,0)"> where
 you can find the linked code files</span></div>
<div style="text-align:left;margin:0px"><span style="letter-spacing:normal;font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;font-weight:400;color:rgb(0,0,0)"><br>
</span></div>
<div style="text-align:left;margin:0px"><span style="letter-spacing:normal;font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;font-weight:400;color:rgb(0,0,0)">I really
 appreciate your help<br>
<br>
Bests,<br>
Sawsan</span></div>
<div id="m_5694742774502394814appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="m_5694742774502394814divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>><br>
<b>Sent:</b> Friday, January 5, 2024 4:53 AM<br>
<b>To:</b> Shatanawi, Sawsan Muhammad <<a href="mailto:sawsan.shatanawi@wsu.edu" target="_blank">sawsan.shatanawi@wsu.edu</a>><br>
<b>Cc:</b> Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>>; <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a> <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
<b>Subject:</b> Re: [petsc-users] Help with Integrating PETSc into Fortran Groundwater Flow Simulation Code</font>
<div> </div>
</div>
<div>
<p style="border:1px solid rgb(255,202,202);background-color:rgb(255,235,156);padding:1px">
<span style="font-size:10pt;color:black"><b>[EXTERNAL EMAIL]</b></span></p>
<div>
<div dir="ltr">This is a segv. As Matt said, you need to use a debugger for this or add print statements to narrow down the place where this happens.
<div><br>
</div>
<div>You will need to learn how to use debuggers to do your project so you might as well start now.</div>
<div><br>
</div>
<div>If you have a machine with a GUI debugger that is easier but command line debuggers are good to learn anyway.</div>
<div><br>
</div>
<div>I tend to run debuggers directly (eg, lldb ./a.out -- program-args ...) and use a GUI debugger (eg, Totalview or DDT) if available.</div>
<div><br>
</div>
<div>Mark</div>
<div><br>
</div>
</div>
<br>
<div>
<div dir="ltr">On Wed, Dec 20, 2023 at 10:02 PM Shatanawi, Sawsan Muhammad via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div dir="ltr">
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hello Matthew,<br>
<br>
Thank you for your help. I am sorry that I keep coming back with my error messages, but I reached a point that I don't know how to fix them, and I don't understand them easily.<br>
The list of errors is getting shorter, now I am getting the attached error messages </div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Thank you again,<br>
<br>
</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Sawsan</div>
<div id="m_5694742774502394814x_m_1291163558337743399appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="m_5694742774502394814x_m_1291163558337743399divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>><br>
<b>Sent:</b> Wednesday, December 20, 2023 6:54 PM<br>
<b>To:</b> Shatanawi, Sawsan Muhammad <<a href="mailto:sawsan.shatanawi@wsu.edu" target="_blank">sawsan.shatanawi@wsu.edu</a>><br>
<b>Cc:</b> Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank">bsmith@petsc.dev</a>>;
<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a> <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
<b>Subject:</b> Re: [petsc-users] Help with Integrating PETSc into Fortran Groundwater Flow Simulation Code</font>
<div> </div>
</div>
<div>
<p style="border:1px solid rgb(255,202,202);background-color:rgb(255,235,156);padding:1px">
<span style="font-size:10pt;color:black"><b>[EXTERNAL EMAIL]</b></span></p>
<div>
<div dir="ltr">
<div dir="ltr">On Wed, Dec 20, 2023 at 9:49 PM Shatanawi, Sawsan Muhammad via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br>
</div>
<div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div dir="ltr">
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;color:rgb(0,0,0)">Hello Barry,<br>
<br>
Thank you a lot for your help, Now I am getting the attached error message.</span></div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>Do not destroy the PC from KSPGetPC()</div>
<div><br>
</div>
<div>  THanks,</div>
<div><br>
</div>
<div>     Matt</div>
<div> </div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div dir="ltr">
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;color:rgb(0,0,0)">Bests,<br>
Sawsan</span></div>
<div id="m_5694742774502394814x_m_1291163558337743399x_m_6596943672973964543appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="m_5694742774502394814x_m_1291163558337743399x_m_6596943672973964543divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank">bsmith@petsc.dev</a>><br>
<b>Sent:</b> Wednesday, December 20, 2023 6:32 PM<br>
<b>To:</b> Shatanawi, Sawsan Muhammad <<a href="mailto:sawsan.shatanawi@wsu.edu" target="_blank">sawsan.shatanawi@wsu.edu</a>><br>
<b>Cc:</b> Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>>;
<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a> <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
<b>Subject:</b> Re: [petsc-users] Help with Integrating PETSc into Fortran Groundwater Flow Simulation Code</font>
<div> </div>
</div>
<div>
<p style="border:1px solid rgb(255,202,202);background-color:rgb(255,235,156);padding:1px">
<span style="font-size:10pt;color:black"><b>[EXTERNAL EMAIL]</b></span></p>
<div>
<div><br>
</div>
Instead of 
<div><br>
</div>
<div>
<div>    call PCCreate(PETSC_COMM_WORLD, pc, ierr)</div>
<div>    call PCSetType(pc, PCILU,ierr) ! Choose a preconditioner type (ILU)</div>
<div>    call KSPSetPC(ksp, pc,ierr)  ! Associate the preconditioner with the KSP solver</div>
<div><br>
</div>
<div>do</div>
<div><br>
</div>
<div>    call KSPGetPC(ksp,pc,ierr)</div>
<div>    call PCSetType(pc, PCILU,ierr)</div>
<div><br>
</div>
<div>Do not call KSPSetUp(). It will be taken care of automatically during the solve</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div><br>
<blockquote type="cite">
<div>On Dec 20, 2023, at 8:52 PM, Shatanawi, Sawsan Muhammad via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:</div>
<br>
<div>
<div style="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;font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt">
Hello, <br>
I don't think that I set preallocation values when I created the matrix, would you please have look at my code. It is just the petsc related part from my code.<br>
I was able to fix some of the error messages. Now I have a new set of error messages related to the KSP solver (attached)<br>
<br>
I appreciate your help</div>
<div style="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;font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt">
<br>
</div>
<div style="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;font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt">
Sawsan</div>
<div id="m_5694742774502394814x_m_1291163558337743399x_m_6596943672973964543x_appendonsend" style="font-family:Helvetica;font-size:18px;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">
</div>
<hr style="font-family:Helvetica;font-size:18px;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;display:inline-block;width:934.906px">
<span style="font-family:Helvetica;font-size:18px;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"></span>
<div id="m_5694742774502394814x_m_1291163558337743399x_m_6596943672973964543x_divRplyFwdMsg" dir="ltr" style="font-family:Helvetica;font-size:18px;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">
<font face="Calibri, sans-serif" style="font-size:11pt"><b>From:</b><span> </span>Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>><br>
<b>Sent:</b><span> </span>Wednesday, December 20, 2023 6:44 AM<br>
<b>To:</b><span> </span>Shatanawi, Sawsan Muhammad <<a href="mailto:sawsan.shatanawi@wsu.edu" target="_blank">sawsan.shatanawi@wsu.edu</a>><br>
<b>Cc:</b><span> </span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a><span> </span><<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
<b>Subject:</b><span> </span>Re: [petsc-users] Help with Integrating PETSc into Fortran Groundwater Flow Simulation Code</font>
<div> </div>
</div>
<div style="font-family:Helvetica;font-size:18px;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">
<div style="margin-top:0px;margin-bottom:0px;border:1px solid rgb(255,202,202);background-color:rgb(255,235,156);padding:1px">
<span style="font-size:10pt"><b>[EXTERNAL EMAIL]</b></span></div>
<div>
<div dir="ltr">Did you set preallocation values when you created the matrix?
<div>Don't do that.</div>
</div>
<br>
<div>
<div dir="ltr">On Wed, Dec 20, 2023 at 9:36 AM Shatanawi, Sawsan Muhammad <<a href="mailto:sawsan.shatanawi@wsu.edu" target="_blank">sawsan.shatanawi@wsu.edu</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div dir="ltr">
<div dir="ltr">Hello, </div>
<div dir="ltr"><br>
</div>
<div dir="ltr">I am trying to create a sparse matrix( which is as I believe a zero matrix) then adding some nonzero elements to it over a loop, then assembling it </div>
<div id="m_5694742774502394814x_m_1291163558337743399x_m_6596943672973964543x_x_m_-677654408871201876ms-outlook-mobile-signature">
<div><br>
</div>
Get<span> </span><a href="https://urldefense.com/v3/__https://aka.ms/o0ukef__;!!JmPEgBY0HMszNaDT!uUJ_jeYf45gcXDGR_PeMjhU7hbd_fKcXJPn0pM9eb-YQihKNYuXMYM9x-hglsbXsCFIwNBWgHXdetHODupsOloE$" target="_blank">Outlook
 for iOS</a></div>
<div id="m_5694742774502394814x_m_1291163558337743399x_m_6596943672973964543x_x_m_-677654408871201876mail-editor-reference-message-container">
<hr style="display:inline-block;width:917.344px">
<div id="m_5694742774502394814x_m_1291163558337743399x_m_6596943672973964543x_x_m_-677654408871201876divRplyFwdMsg" dir="ltr">
<font face="Calibri, sans-serif"><b>From:</b><span> </span>Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>><br>
<b>Sent:</b><span> </span>Wednesday, December 20, 2023 2:48 AM<br>
<b>To:</b><span> </span>Shatanawi, Sawsan Muhammad <<a href="mailto:sawsan.shatanawi@wsu.edu" target="_blank">sawsan.shatanawi@wsu.edu</a>><br>
<b>Cc:</b><span> </span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a><span> </span><<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
<b>Subject:</b><span> </span>Re: [petsc-users] Help with Integrating PETSc into Fortran Groundwater Flow Simulation Code
<div> </div>
</font></div>
<div style="margin-top:0px;margin-bottom:0px;border:1px solid rgb(255,202,202);padding:1px;background-color:rgb(255,235,156)">
<span style="font-size:10pt"><b>[EXTERNAL EMAIL]</b></span></div>
<div>
<div dir="ltr">I am guessing that you are creating a matrix, adding to it, finalizing it ("assembly"), and then adding to it again, which is fine, but you are adding new non-zeros to the sparsity pattern.
<div>If this is what you want then you can tell the matrix to let you do that.</div>
<div>Otherwise you have a bug.</div>
<div><br>
</div>
<div>Mark</div>
</div>
<br>
<div>
<div dir="ltr">On Tue, Dec 19, 2023 at 9:50 PM Shatanawi, Sawsan Muhammad via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div dir="ltr">
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt">
</div>
Hello everyone,
<div><br>
</div>
<div>I hope this email finds you well.</div>
<div><span><br>
</span></div>
<div><span> My Name is Sawsan Shatanawi,</span><span><span style="display:inline;color:rgb(55,65,81)"> and I am currently working on developing a Fortran code for simulating groundwater flow in a 3D system. The code involves solving a nonlinear system, and
 I have created the matrix to be solved using the PCG solver and Picard iteration. However, </span></span><span>when I tried to assign it as a PETSc matrix I started getting a lot of error messages.</span></div>
<div><br>
</div>
<div>I am kindly asking if someone can help me,<span style="display:inline;color:rgb(55,65,81)"> I would be happy to share my code with him/her.</span></div>
<div><span><br>
</span></div>
<div><span>Please find the attached file contains a list of errors I have gotten</span></div>
<div><span style="color:rgb(55,65,81)"><br>
</span></div>
<div><span style="color:rgb(55,65,81)">Thank you in advance for your time and assistance.</span><br>
</div>
<div><span>
<p style="margin:1.25em 0px;border:0px solid rgb(217,217,227);box-sizing:border-box;color:rgb(55,65,81)">
Best regards,</p>
<p style="margin:1.25em 0px;border:0px solid rgb(217,217,227);box-sizing:border-box;color:rgb(55,65,81)">
 Sawsan</p>
<br>
</span></div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt">
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
<span id="m_5694742774502394814x_m_1291163558337743399x_m_6596943672973964543x_cid:66357E60-6F0B-4E28-9883-5421A4F75577"><Matrix_RHS.F90></span><span id="m_5694742774502394814x_m_1291163558337743399x_m_6596943672973964543x_cid:FB95EDCC-3170-4E85-BBFB-5804756A9022"><out.txt></span><span id="m_5694742774502394814x_m_1291163558337743399x_m_6596943672973964543x_cid:8AF6D377-8CA5-4FFF-81AC-12EFB1837766"><solver.F90></span></div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
<span>-- </span><br>
<div dir="ltr">
<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="https://urldefense.com/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!JmPEgBY0HMszNaDT!uskvAyF0pMMWDbMIexr9g4qN46V7Rea17GQdNIVG2vH_HMaX7mXgie4ZYgusmPpss_DS7H1_8vn8arGQNSkC$" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>

</div></blockquote></div>