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

Takahashi, Tadanaga tt73 at njit.edu
Tue May 2 16:40:37 CDT 2023


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,&snes);
SNESSetDM(snes,da);
SNESSetType(snes,SNESFAS); // solve with multigrid
SNESSetTolerances(snes,PETSC_DEFAULT,PETSC_DEFAULT,PETSC_DEFAULT,1,PETSC_DEFAULT);
// just one iteration
VecSet(u,0.0);            // start with zeros
SNESSolve(snes,NULL,u);   // cheap solve
SNESGetSolution(snes,&u); // 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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230502/d9924fc5/attachment.html>


More information about the petsc-users mailing list