Hello Barry, Thank you a lot for your help, Now I am getting the attached error message.
Bests, Sawsan ________________________________ From: Barry Smith <[email protected]> Sent: Wednesday, December 20, 2023 6:32 PM To: Shatanawi, Sawsan Muhammad <[email protected]> Cc: Mark Adams <[email protected]>; [email protected] <[email protected]> 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 <[email protected]> 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 <[email protected]<mailto:[email protected]>> Sent: Wednesday, December 20, 2023 6:44 AM To: Shatanawi, Sawsan Muhammad <[email protected]<mailto:[email protected]>> Cc: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>> 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 <[email protected]<mailto:[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://urldefense.com/v3/__https://aka.ms/o0ukef__;!!JmPEgBY0HMszNaDT!uUJ_jeYf45gcXDGR_PeMjhU7hbd_fKcXJPn0pM9eb-YQihKNYuXMYM9x-hglsbXsCFIwNBWgHXdetHODupsOloE$> ________________________________ From: Mark Adams <[email protected]<mailto:[email protected]>> Sent: Wednesday, December 20, 2023 2:48 AM To: Shatanawi, Sawsan Muhammad <[email protected]<mailto:[email protected]>> Cc: [email protected]<mailto:[email protected]> <[email protected]<mailto:[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]<mailto:[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 <Matrix_RHS.F90><out.txt><solver.F90>
[sawsan.shatanawi@login-p2n04 code_allocate]$ ./compile.sh mpif90 -fPIC -g -O0 -cpp -I/opt/apps/petsc/3.20.0/intel/20.2/mpich/3.3.2/include -c -o GW_solver_try.o GW_solver_try.F90 mpif90 -fPIC -g -O0 -cpp -I/opt/apps/petsc/3.20.0/intel/20.2/mpich/3.3.2/include -L/opt/apps/petsc/3.20.0/intel/20.2/mpich/3.3.2/lib -Wl,-rpath,/opt/apps/petsc/3.20.0/intel/20.2/mpich/3.3.2/lib -o GW.exe GW_constants.o GW_properties.o GW_initial.o GW_boundary_conditions.o GW_elevation.o GW_conductance.o GW_recharge.o GW_pumping.o GW_SW_TEST.o GW_AMatrix_RHS_TRY_2.o GW_solver_try.o test_main.o -lpetsc -lm 5.2000000E-03 50.00000 10.00000 0.0000000E+00 [0]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [0]PETSC ERROR: Corrupt argument: https://petsc.org/release/faq/#valgrind [0]PETSC ERROR: Object already free: Parameter # 1 [0]PETSC ERROR: See https://petsc.org/release/faq/ for trouble shooting. [0]PETSC ERROR: Petsc Release Version 3.20.0, Sep 28, 2023 [0]PETSC ERROR: ./GW.exe on a named login-p2n04.kamiak.wsu.edu by sawsan.shatanawi Wed Dec 20 18:45:25 2023 [0]PETSC ERROR: Configure options --prefix=/opt/apps/petsc/3.20.0/intel/20.2/mpich/3.3.2 --with-blaslapack-dir=/opt/apps/intel/20.2/compilers_and_libraries_2020.2.254/linux/mkl --with-cc=mpicc --with-cxx=mpicxx --with-fc=mpif90 [0]PETSC ERROR: #1 PCDestroy() at /weka/data/kamiak/rohit.dhariwal/software_installs/petsc/3.20.0/petsc-3.20.0/src/ksp/pc/interface/precon.c:101 [0]PETSC ERROR: ------------------------------------------------------------------------ [0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range [0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger [0]PETSC ERROR: or see https://petsc.org/release/faq/#valgrind and https://petsc.org/release/faq/ [0]PETSC ERROR: --------------------- Stack Frames ------------------------------------ [0]PETSC ERROR: No error traceback is available, the problem could be in the main program. application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0 [unset]: write_line error; fd=-1 buf=:cmd=abort exitcode=59 : system msg for write_line failure : Bad file descriptor [sawsan.shatanawi@login-p2n04 code_allocate]$
