[petsc-users] SNESSetOptionsPrefix usage

Smith, Barry F. bsmith at mcs.anl.gov
Thu Jan 16 08:38:37 CST 2020



> On Jan 16, 2020, at 3:18 AM, Timothée Nicolas <timothee.nicolas at gmail.com> wrote:
> 
> Actually, for the main solver it works. I'm thinking, could it be due to the fact that the second SNES instance is defined in a routine that is called somewhere inside the FormFunction of the main SNES? We are improving our boundary condition, which becomes quite complex, and we have a small problem to solve, so I'm trying to handle it with a SNES. So the two SNES are nested, in a sense.

    This should be fine. We do this.

     Are you sure the inner SNES is actually being called? 

     Run with -help | grep green does it print a help message for your green options?

     Barry

> 
> Timothée
> 
> Le mer. 15 janv. 2020 à 23:24, Timothée Nicolas <timothee.nicolas at gmail.com> a écrit :
> I can actually use some command line arguments. My line arguments actually read
> 
> -snes_mf -green_snes_monitor
> 
> and the first -snes_mf argument (for the main solver snes) is correctly taken into account.
> I will try what Barry suggested, I'll tell you if I find the reason.
> 
> Best regards, thanks for your comments
> 
> Timothée
> 
> Le mer. 15 janv. 2020 à 18:56, Matthew Knepley <knepley at gmail.com> a écrit :
> I think that Mark is suggesting that no command line arguments are getting in.
> 
> Timothee,
> 
> Can you use any command line arguments?
> 
>   Thanks,
> 
>      Matt
> 
> On Wed, Jan 15, 2020 at 12:04 PM Smith, Barry F. via petsc-users <petsc-users at mcs.anl.gov> wrote:
> 
>   Should still work. Run in the debugger and put a break point in snessetoptionsprefix_ and see what it is trying to do
> 
>   Barry
> 
> 
> > On Jan 15, 2020, at 8:58 AM, Timothée Nicolas <timothee.nicolas at gmail.com> wrote:
> > 
> > Hi, thanks for your answer,
> > 
> > I'm using Petsc version 3.10.4
> > 
> > Timothée
> > 
> > Le mer. 15 janv. 2020 à 14:59, Mark Adams <mfadams at lbl.gov> a écrit :
> > I'm guessing a Fortran issue. What version of PETSc are you using?
> > 
> > On Wed, Jan 15, 2020 at 8:36 AM Timothée Nicolas <timothee.nicolas at gmail.com> wrote:
> > Dear PETSc users,
> > 
> > I am confused by the usage of SNESSetOptionsPrefix. I understand this is required if you have for example different SNES in your program and want to set different options for them.
> > So for my second snes I wrote 
> > 
> > call SNESCreate(MPI_COMM_SELF,snes,ierr)
> > call SNESSetOptionsPrefix(snes,'green_',ierr)
> > call SNESSetFromOptions(snes,ierr)
> > 
> > etc.
> > 
> > Then when launching the program I wanted to monitor that snes so I launched it with the option -green_snes_monitor instead of -snes_monitor. But I keep getting the message
> > 
> > WARNING! There are options you set that were not used!
> > WARNING! could be spelling mistake, etc!
> > Option left: name:-green_snes_monitor (no value)
> > 
> > What do I miss here?
> > 
> > Best regards
> > 
> > Timothée NICOLAS
> 
> 
> 
> -- 
> 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/



More information about the petsc-users mailing list