Re: [petsc-users] Customizing NASM subsnes

2022-06-17 Thread Matthew Knepley
On Fri, Jun 17, 2022 at 11:02 AM Barry Smith wrote: > > You do not need the loop over size. Each rank sets options and options > prefix for its local objects and never anyone elses. > >char prefix[10]; > >sprintf(prefix,"sub_%d_",rank); > >SNESNASMGetSNES(snes,0,&subsnes

Re: [petsc-users] Customizing NASM subsnes

2022-06-17 Thread Takahashi, Tadanaga
Ahh, I understand now. I got rid of the loop. Adding SNESSetFromOptions(subsnes) right after SNESSetOptionsPrefix(subsnes,prefix) did not fix the issue. On Fri, Jun 17, 2022 at 11:02 AM Barry Smith wrote: > > You do not need the loop over size. Each rank sets options and options > prefix for i

Re: [petsc-users] Customizing NASM subsnes

2022-06-17 Thread Barry Smith
You do not need the loop over size. Each rank sets options and options prefix for its local objects and never anyone elses. >char prefix[10]; >sprintf(prefix,"sub_%d_",rank); >SNESNASMGetSNES(snes,0,&subsnes); > if (rank SNESSetType(subsnes,SNESNE

Re: [petsc-users] Customizing NASM subsnes

2022-06-17 Thread Takahashi, Tadanaga
Thank you. I am now able to pull each subsnes, change its snes type through the API, and set a prefix. This is my updated code: SNES snes, subsnes; PetscMPIIntrank, size; ... ierr = SNESCreate(PETSC_COMM_WORLD,&snes); CHKERRQ(ierr); ierr = SNESSetType(snes,SNESNASM); C

Re: [petsc-users] Customizing NASM subsnes

2022-06-17 Thread Barry Smith
MPI_Comm_size(PETSC_COMM_WORLD,&size); MPI_Comm_rank(PETSC_COMM_WORLD,&rank); > SNESNASMGetSNES(snes,0,&subsnes); > char prefix[10]; > sprintf(prefix,"sub_%d_",rank); > SNESSetOptionsPrefix(subsnes,prefix); > On Jun 17, 2022, at 9:35 AM, Matthew Knepley wrote: > > On Fri, Jun 17,

Re: [petsc-users] Customizing NASM subsnes

2022-06-17 Thread Matthew Knepley
On Fri, Jun 17, 2022 at 9:22 AM Takahashi, Tadanaga wrote: > I'm having some trouble pulling out the subsolver. I tried to use > SNESNASMGetSNES in a loop over each subdomain. However I get an error when > I run the code with more than one MPI processors. Here is a snippet from my > code: > >

Re: [petsc-users] Customizing NASM subsnes

2022-06-17 Thread Takahashi, Tadanaga
I'm having some trouble pulling out the subsolver. I tried to use SNESNASMGetSNES in a loop over each subdomain. However I get an error when I run the code with more than one MPI processors. Here is a snippet from my code: SNES snes, subsnes; PetscMPIIntrank, size; ... ie

Re: [petsc-users] Customizing NASM subsnes

2022-06-16 Thread Matthew Knepley
On Thu, Jun 16, 2022 at 5:57 PM tt73 wrote: > > Hi, > > I am using NASM as the outer solver for a nonlinear problem. For one of > the subdomains, I want to run the local solve with a different set of > options form the others. Is there any way to set options for each > subdomain? > I can see tw

[petsc-users] Customizing NASM subsnes

2022-06-16 Thread tt73
Hi, I am using  NASM as the outer solver for a nonlinear problem. For one of the subdomains, I want to run the local solve with a different set of options form the others. Is there any way to set options for each subdomain?