[petsc-users] SNESSetOptionsPrefix usage
Smith, Barry F.
bsmith at mcs.anl.gov
Wed Jan 15 07:59:50 CST 2020
Works for me with PETSc 12, what version of PETSc are you using?
program main
#include <petsc/finclude/petsc.h>
use petsc
implicit none
! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PetscErrorCode ierr
SNES snes1
call PetscInitialize(PETSC_NULL_CHARACTER,ierr)
if (ierr .ne. 0) then
print*,'Unable to initialize PETSc'
stop
endif
call SNESCreate(MPI_COMM_SELF,snes1,ierr)
call SNESSetOptionsPrefix(snes1,'green_',ierr)
call SNESSetFromOptions(snes1,ierr)
call SNESDestroy(snes1,ierr)
call PetscFinalize(ierr)
end
$ ./ex1f -green_snes_monitor
~/Src/petsc/src/snes/examples/tutorials (oanam/sem-pde-optimization *=)
$ ./ex1f -green_snes_monitor -options_left
#PETSc Option Table entries:
-check_pointer_intensity 0
-green_snes_monitor
-malloc_dump
-options_left
#End of PETSc Option Table entries
There are no unused options.
~/Src/petsc/src/snes/examples/tutorials (oanam/sem-pde-optimization *=)
> On Jan 15, 2020, at 4:03 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
More information about the petsc-users
mailing list