Did you set preallocation values when you created the matrix? Don't do that.
On Wed, Dec 20, 2023 at 9:36 AM Shatanawi, Sawsan Muhammad < [email protected]> wrote: > Hello, > > 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 > > Get Outlook for iOS <https://aka.ms/o0ukef> > ------------------------------ > *From:* Mark Adams <[email protected]> > *Sent:* Wednesday, December 20, 2023 2:48 AM > *To:* Shatanawi, Sawsan Muhammad <[email protected]> > *Cc:* [email protected] <[email protected]> > *Subject:* Re: [petsc-users] Help with Integrating PETSc into Fortran > Groundwater Flow Simulation Code > > > *[EXTERNAL EMAIL]* > 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. > If this is what you want then you can tell the matrix to let you do that. > Otherwise you have a bug. > > Mark > > On Tue, Dec 19, 2023 at 9:50 PM Shatanawi, Sawsan Muhammad via petsc-users > <[email protected]> wrote: > >> Hello everyone, >> >> I hope this email finds you well. >> >> My Name is Sawsan Shatanawi, 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, when I tried >> to assign it as a PETSc matrix I started getting a lot of error messages. >> >> I am kindly asking if someone can help me, I would be happy to share my >> code with him/her. >> >> Please find the attached file contains a list of errors I have gotten >> >> Thank you in advance for your time and assistance. >> >> Best regards, >> >> Sawsan >> >>
