[petsc-users] Help with Integrating PETSc into Fortran Groundwater Flow Simulation Code

Shatanawi, Sawsan Muhammad sawsan.shatanawi at wsu.edu
Wed Dec 20 21:02:17 CST 2023


Hello Matthew,

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.
The list of errors is getting shorter, now I am getting the attached error messages

Thank you again,

Sawsan
________________________________
From: Matthew Knepley <knepley at gmail.com>
Sent: Wednesday, December 20, 2023 6:54 PM
To: Shatanawi, Sawsan Muhammad <sawsan.shatanawi at wsu.edu>
Cc: Barry Smith <bsmith at petsc.dev>; petsc-users at mcs.anl.gov <petsc-users at mcs.anl.gov>
Subject: Re: [petsc-users] Help with Integrating PETSc into Fortran Groundwater Flow Simulation Code


[EXTERNAL EMAIL]

On Wed, Dec 20, 2023 at 9:49 PM Shatanawi, Sawsan Muhammad via petsc-users <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>> wrote:
Hello Barry,

Thank you a lot for your help, Now I am getting the attached error message.

Do not destroy the PC from KSPGetPC()

  THanks,

     Matt

Bests,
Sawsan
________________________________
From: Barry Smith <bsmith at petsc.dev<mailto:bsmith at petsc.dev>>
Sent: Wednesday, December 20, 2023 6:32 PM
To: Shatanawi, Sawsan Muhammad <sawsan.shatanawi at wsu.edu<mailto:sawsan.shatanawi at wsu.edu>>
Cc: Mark Adams <mfadams at lbl.gov<mailto:mfadams at lbl.gov>>; petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: Re: [petsc-users] Help with Integrating PETSc into Fortran Groundwater Flow Simulation Code


[EXTERNAL EMAIL]

Instead of

    call PCCreate(PETSC_COMM_WORLD, pc, ierr)
    call PCSetType(pc, PCILU,ierr) ! Choose a preconditioner type (ILU)
    call KSPSetPC(ksp, pc,ierr)  ! Associate the preconditioner with the KSP solver

do

    call KSPGetPC(ksp,pc,ierr)
    call PCSetType(pc, PCILU,ierr)

Do not call KSPSetUp(). It will be taken care of automatically during the solve



On Dec 20, 2023, at 8:52 PM, Shatanawi, Sawsan Muhammad via petsc-users <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>> wrote:

Hello,
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.
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)

I appreciate your help

Sawsan
________________________________
From: Mark Adams <mfadams at lbl.gov<mailto:mfadams at lbl.gov>>
Sent: Wednesday, December 20, 2023 6:44 AM
To: Shatanawi, Sawsan Muhammad <sawsan.shatanawi at wsu.edu<mailto:sawsan.shatanawi at wsu.edu>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: Re: [petsc-users] Help with Integrating PETSc into Fortran Groundwater Flow Simulation Code

[EXTERNAL EMAIL]
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 <sawsan.shatanawi at wsu.edu<mailto:sawsan.shatanawi at wsu.edu>> 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://urldefense.com/v3/__https://aka.ms/o0ukef__;!!JmPEgBY0HMszNaDT!uUJ_jeYf45gcXDGR_PeMjhU7hbd_fKcXJPn0pM9eb-YQihKNYuXMYM9x-hglsbXsCFIwNBWgHXdetHODupsOloE$>
________________________________
From: Mark Adams <mfadams at lbl.gov<mailto:mfadams at lbl.gov>>
Sent: Wednesday, December 20, 2023 2:48 AM
To: Shatanawi, Sawsan Muhammad <sawsan.shatanawi at wsu.edu<mailto:sawsan.shatanawi at wsu.edu>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
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 <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>> 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

<Matrix_RHS.F90><out.txt><solver.F90>



--
What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/<https://urldefense.com/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!JmPEgBY0HMszNaDT!uskvAyF0pMMWDbMIexr9g4qN46V7Rea17GQdNIVG2vH_HMaX7mXgie4ZYgusmPpss_DS7H1_8vn8arGQNSkC$>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20231221/36930023/attachment-0001.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: out3.txt
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20231221/36930023/attachment-0001.txt>


More information about the petsc-users mailing list