Re: [petsc-users] Help using FAS as an initial guess

2023-05-02 Thread tt73
Thanks, Barry. I'll look into it. 
 Original message From: Barry Smith  Date: 
5/2/23  6:10 PM  (GMT-05:00) To: "Takahashi, Tadanaga"  Cc: 
PETSc  Subject: Re: [petsc-users] Help using FAS as an 
initial guess   You might consider 
https://petsc.org/release/manualpages/SNES/SNESSetGridSequence/ it does exactly 
what I think you want to do.  FAS is a bit more subtle than that. The "coarse 
grid problem" that FAS builds and solves are dependent on the current fine grid 
solution so you need an "approximate" fine grid solution already in order to 
create a FAS coarse problem. Of course FAS can, and often should, be used also 
with grid sequencing to boot-strap the fine grid solutions.  BarryOn May 2, 
2023, at 5:40 PM, Takahashi, Tadanaga  wrote:Hi, I want to know 
how to configure the FAS so that it solves a problem on a coarse grid of size 
4h, interpolate the solution, and then stop. Here is the context: I am using 
Newton LS to solve a problem on square domain discretized with DMDA meshed with 
step size h. I have a subroutine to compute the initial guess. I want this 
subroutine to first do a Newton solve on a coarse grid of size 4h. Then it 
interpolates the solution to the main mesh. I think this is achievable by using 
one iteration of FAS. Below is the gist of what my subroutine looks like: 
PetscErrorCode InitialState(DM da, Vec u) { // SNES snes; 
SNESCreate(PETSC_COMM_WORLD,);  
SNESSetDM(snes,da);SNESSetType(snes,SNESFAS); // solve with 
multigridSNESSetTolerances(snes,PETSC_DEFAULT,PETSC_DEFAULT,PETSC_DEFAULT,1,PETSC_DEFAULT);
 // just one iterationVecSet(u,0.0);            // start with zeros 
SNESSolve(snes,NULL,u);   // cheap solve SNESGetSolution(snes,); // extract 
solution }For some reason, my initial guess is too accurate. The initial guess 
produced by this subroutine looks exactly like the final solution. My guess is 
that it's doing more than what I want it to do. I'm still new to FAS. How can I 
tell FAS to do just one crude solve and an interpolation?


[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?