<div dir="ltr">Did you set preallocation values when you created the matrix?<div>Don't do that.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Dec 20, 2023 at 9:36 AM Shatanawi, Sawsan Muhammad <<a href="mailto:sawsan.shatanawi@wsu.edu">sawsan.shatanawi@wsu.edu</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>
<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_-677654408871201876ms-outlook-mobile-signature">
<div><br>
</div>
Get <a href="https://aka.ms/o0ukef" target="_blank">Outlook for iOS</a></div>
<div id="m_-677654408871201876mail-editor-reference-message-container">
<hr style="display:inline-block;width:98%">
<div id="m_-677654408871201876divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif"><b>From:</b> Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>><br>
<b>Sent:</b> Wednesday, December 20, 2023 2:48 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> <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
<div> </div>
</font></div>
<p style="border:1px solid rgb(255,202,202);padding:1px;background-color:rgb(255,235,156)">
<span style="font-size:10pt;color:black"><b>[EXTERNAL EMAIL]</b></span></p>
<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 class="gmail_quote">
<div dir="ltr" class="gmail_attr">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 class="gmail_quote" 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)">
</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="border:0px solid rgb(217,217,227);box-sizing:border-box;margin:1.25em 0px;color:rgb(55,65,81)">
Best regards,</p>
<p style="border:0px solid rgb(217,217,227);box-sizing:border-box;margin:1.25em 0px;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;color:rgb(0,0,0)">
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</blockquote></div>