On Wed, Sep 29, 2021 at 11:53 AM Marco Cisternino < marco.cistern...@optimad.it> wrote:
> Thank you Barry for the quick reply. > > About the null space: I already tried what you suggest, building 2 Vec > (constants) with 0 and 1 chosen by sub-domain, normalizing them and setting > the null space like this > > > MatNullSpaceCreate(PETSC_COMM_WORLD,PETSC_FALSE,nconstants,constants,&nullspace); > > The solution is slightly different in values but it is still different in > the two sub-domains. > > About the solver: I tried BCGS, GMRES and FGMRES. The linear system is a > pressure system in a navier-stokes solver and only solving with FGMRES > makes the CFD stable, with BCGS and GMRES the CFD solution diverges. > Moreover, in the same case but with a single domain, CFD solution is stable > using all the solvers, but FGMRES converges in much less iterations than > the others. > I think this means something is wrong with the implementation. FGMRES is the same as GMRES _if_ the preconditioner is a linear operator. The fact that they are different means that your preconditioner is nonlinear. Is this what you expect? Thanks, Matt > Marco Cisternino > > > > *From:* Barry Smith <bsm...@petsc.dev> > *Sent:* mercoledì 29 settembre 2021 15:59 > *To:* Marco Cisternino <marco.cistern...@optimad.it> > *Cc:* petsc-users@mcs.anl.gov > *Subject:* Re: [petsc-users] Disconnected domains and Poisson equation > > > > > > The problem actually has a two dimensional null space; constant on each > domain but possibly different constants. I think you need to build the > MatNullSpace by explicitly constructing two vectors, one with 0 on one > domain and constant value on the other and one with 0 on the other domain > and constant on the first. > > > > Separate note: why use FGMRES instead of just GMRES? If the problem is > linear and the preconditioner is linear (no GMRES inside the smoother) then > you can just use GMRES and it will save a little space/work and be > conceptually clearer. > > > > Barry > > > > On Sep 29, 2021, at 8:46 AM, Marco Cisternino <marco.cistern...@optimad.it> > wrote: > > > > Good morning, > > I want to solve the Poisson equation on a 3D domain with 2 non-connected > sub-domains. > > I am using FGMRES+GAMG and I have no problem if the two sub-domains see a > Dirichlet boundary condition each. > > On the same domain I would like to solve the Poisson equation imposing > periodic boundary condition in one direction and homogenous Neumann > boundary conditions in the other two directions. The two sub-domains are > symmetric with respect to the separation between them and the operator > discretization and the right hand side are symmetric as well. It would be > nice to have the same solution in both the sub-domains. > > Setting the null space to the constant, the solver converges to a solution > having the same gradients in both sub-domains but different values. > > Am I doing some wrong with the null space? I’m not setting a block matrix > (one block for each sub-domain), should I? > > I tested the null space against the matrix using MatNullSpaceTest and the > answer is true. Can I do something more to have a symmetric solution as > outcome of the solver? > > Thank you in advance for any comments and hints. > > > > Best regards, > > > > Marco Cisternino > > > -- 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/ <http://www.cse.buffalo.edu/~knepley/>