<div dir="ltr">Thank you SO much for helping me out on this. Dumb error from my part not to notice.<div><br></div><div>This means the common /mypcs/ elements are preconfigure internally in PETSc?</div><div><br></div><div>Regards and happy weekend,</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 9, 2016 at 5:19 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
  The missing third argument to PCApply means that you haven't allocated the vector work?<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
> On Sep 9, 2016, at 3:34 PM, Manuel Valera <<a href="mailto:mvalera@mail.sdsu.edu">mvalera@mail.sdsu.edu</a>> wrote:<br>
><br>
> Hello everyone,<br>
><br>
> I'm having an error with my program that i cannot understand, the weird part is that the same implementation in my main model does not show errors and they are virtually identical.<br>
><br>
> The problematic part of the code is:<br>
><br>
><br>
>   call KSPCreate(PETSC_COMM_WORLD,<wbr>ksp,ierr)<br>
>   call KSPSetOperators(ksp,Ap,Ap,<wbr>ierr)<br>
>   call KSPGetPC(ksp,pc,ierr)<br>
>   tol = 1.e-5<br>
>   call KSPSetTolerances(ksp,tol,<wbr>PETSC_DEFAULT_REAL,PETSC_<wbr>DEFAULT_REAL,PETSC_DEFAULT_<wbr>INTEGER,ierr)<br>
><br>
>   call PCGetOperators(pc,PETSC_NULL_<wbr>OBJECT,pmat,ierr)<br>
>   call PCCreate(PETSC_COMM_WORLD,mg,<wbr>ierr)<br>
>   call PCSetType(mg,PCJACOBI,ierr)<br>
>   call PCSetOperators(mg,pmat,pmat,<wbr>ierr)<br>
>   call PCSetUp(mg,ierr)<br>
><br>
>   call PCApply(mg,xp,work,ierr)<br>
><br>
><br>
> And the errors i get are:<br>
><br>
> [0]PETSC ERROR: --------------------- Error Message ------------------------------<wbr>------------------------------<wbr>--<br>
> [0]PETSC ERROR: Null argument, when expecting valid pointer<br>
> [0]PETSC ERROR: Null Object: Parameter # 3<br>
> [0]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html" rel="noreferrer" target="_blank">http://www.mcs.anl.gov/petsc/<wbr>documentation/faq.html</a> for trouble shooting.<br>
> [0]PETSC ERROR: Petsc Release Version 3.7.3, Jul, 24, 2016<br>
> [0]PETSC ERROR: ./solvelinearmgPETSc                                                                                                                                                                                                                                                       on a arch-linux2-c-debug named valera-HP-xw4600-Workstation by valera Fri Sep  9 12:46:02 2016<br>
> [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --download-fblaslapack=1 --download-mpich=1 --download-ml=1<br>
> [0]PETSC ERROR: #1 PCApply() line 467 in /home/valera/sergcemv4/<wbr>bitbucket/serucoamv4/petsc-3.<wbr>7.3/src/ksp/pc/interface/<wbr>precon.c<br>
> [0]PETSC ERROR: --------------------- Error Message ------------------------------<wbr>------------------------------<wbr>--<br>
> [0]PETSC ERROR: Null argument, when expecting valid pointer<br>
> [0]PETSC ERROR: Null Object: Parameter # 3<br>
> [0]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html" rel="noreferrer" target="_blank">http://www.mcs.anl.gov/petsc/<wbr>documentation/faq.html</a> for trouble shooting.<br>
> [0]PETSC ERROR: Petsc Release Version 3.7.3, Jul, 24, 2016<br>
> [0]PETSC ERROR: ./solvelinearmgPETSc<br>
><br>
><br>
> As i said before, the exact same code in a bigger model does not print errors. I'm trying to solve this before moving into multigrid implementation in my prototype,<br>
><br>
> Thanks for your time,<br>
><br>
><br>
><br>
> On Wed, Sep 7, 2016 at 8:27 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br>
><br>
> > On Sep 7, 2016, at 10:24 PM, Manuel Valera <<a href="mailto:mvalera@mail.sdsu.edu">mvalera@mail.sdsu.edu</a>> wrote:<br>
> ><br>
> > Thank you I will try this. What would be the call if I wanted to use other Multigrid option?<br>
><br>
>    There really isn't any other choices.<br>
><br>
> > Don't worry this is a standalone prototype, it should be fine on the main model. Anyway, any hints would be appreciated. Thanks a lot for your time.<br>
> ><br>
> ><br>
> > On Sep 7, 2016 8:22 PM, "Barry Smith" <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br>
> ><br>
> >   Sorry, this was due to our bug, the fortran function for PCGAMGSetType() was wrong. I have fixed this in the maint and master branch of PETSc in the git repository. But you can simply remove the call to PCGAMGSetType() from your code since what you are setting is the default type.<br>
> ><br>
> >   BTW: there are other problems with your code after that call that you will have to work through.<br>
> ><br>
> >   Barry<br>
> ><br>
> > > On Sep 7, 2016, at 8:46 PM, Manuel Valera <<a href="mailto:mvalera@mail.sdsu.edu">mvalera@mail.sdsu.edu</a>> wrote:<br>
> > ><br>
> > ><br>
> > > ---------- Forwarded message ----------<br>
> > > From: Manuel Valera <<a href="mailto:mvalera@mail.sdsu.edu">mvalera@mail.sdsu.edu</a>><br>
> > > Date: Wed, Sep 7, 2016 at 6:40 PM<br>
> > > Subject: Re: [petsc-users] Sorted CSR Matrix and Multigrid PC.<br>
> > > To:<br>
> > > Cc: PETSc users list <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>><br>
> > ><br>
> > ><br>
> > > Hello,<br>
> > ><br>
> > > I was able to sort the data but the PCGAMG does not seem  to be working.<br>
> > ><br>
> > > I reconfigured everything from scratch as suggested and updated to the latest PETSc version, same results,<br>
> > ><br>
> > > I get the following error:<br>
> > ><br>
> > > [0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range<br>
> > > [...]<br>
> > > [0]PETSC ERROR: ---------------------  Stack Frames ------------------------------<wbr>------<br>
> > > [0]PETSC ERROR: Note: The EXACT line numbers in the stack are not available,<br>
> > > [0]PETSC ERROR:       INSTEAD the line number of the start of the function<br>
> > > [0]PETSC ERROR:       is given.<br>
> > > [0]PETSC ERROR: [0] PetscStrcmp line 524 /home/valera/sergcemv4/<wbr>bitbucket/serucoamv4/petsc-3.<wbr>7.3/src/sys/utils/str.c<br>
> > > [0]PETSC ERROR: [0] PetscFunctionListFind_Private line 352 /home/valera/sergcemv4/<wbr>bitbucket/serucoamv4/petsc-3.<wbr>7.3/src/sys/dll/reg.c<br>
> > > [0]PETSC ERROR: [0] PCGAMGSetType_GAMG line 1157 /home/valera/sergcemv4/<wbr>bitbucket/serucoamv4/petsc-3.<wbr>7.3/src/ksp/pc/impls/gamg/<wbr>gamg.c<br>
> > > [0]PETSC ERROR: [0] PCGAMGSetType line 1102 /home/valera/sergcemv4/<wbr>bitbucket/serucoamv4/petsc-3.<wbr>7.3/src/ksp/pc/impls/gamg/<wbr>gamg.c<br>
> > > [0]PETSC ERROR: --------------------- Error Message ------------------------------<wbr>------------------------------<wbr>--<br>
> > > ....<br>
> > ><br>
> > > You can find the working program attached, sorry for the large files and messy makefile,<br>
> > ><br>
> > > Many thanks,<br>
> > ><br>
> > > Manuel Valera.<br>
> > ><br>
> > ><br>
> > > ​<br>
> > >  MGpetscSolver.tar.gz<br>
> > > ​<br>
> > ><br>
> ><br>
><br>
><br>
<br>
</div></div></blockquote></div><br></div>