[petsc-users] Nullspaces

Barry Smith bsmith at petsc.dev
Tue Dec 7 10:53:03 CST 2021


  A side note: The MatNullSpaceTest tells you that the null space you provided is in the null space of the operator, it does not say if you have found the entire null space. In your case with two subdomains the null space is actually two dimensional; all constant on one domain (0 on the other) and 0 on the first domain and all constant on the second. So you need to pass two vectors into the MatNullSpaceCreate().  But regardless the test should work for all constant on both domains.

> On Dec 7, 2021, at 11:19 AM, Marco Cisternino <marco.cisternino at optimad.it> wrote:
> 
> Good morning,
> I’m still struggling with the Poisson equation with Neumann BCs.
> I discretize the equation by finite volume method and I divide every line of the linear system by the volume of the cell. I could avoid this division, but I’m trying to understand.
> My mesh is not uniform, i.e. cells have different volumes (it is an octree mesh).
> Moreover, in my computational domain there are 2 separated sub-domains.
> I build the null space and then I use MatNullSpaceTest to check it.
>  
> If I do this:
> MatNullSpaceCreate(getCommunicator(), PETSC_TRUE, 0, nullptr, &nullspace);
> It works
>  
> If I do this:
> Vec nsp;
> VecDuplicate(m_rhs, &nsp);
> VecSet(nsp,1.0);
> VecNormalize(nsp, nullptr);
> MatNullSpaceCreate(getCommunicator(), PETSC_FALSE, 1, &nsp, &nullspace);
> It does not work
>  
> Probably, I have wrong expectations, but should not it be the same?
>  
> Thanks
>  
> Marco Cisternino, PhD
> marco.cisternino at optimad.it <mailto:marco.cisternino at optimad.it>
> ______________________
> Optimad Engineering Srl
> Via Bligny 5, Torino, Italia.
> +3901119719782
> www.optimad.it <http://www.optimad.it/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20211207/39e23c4c/attachment-0001.html>


More information about the petsc-users mailing list