# [petsc-users] Nullspaces

Tue Dec 7 12:36:11 CST 2021

```I will, as soon as possible...

Scarica Outlook per Android<https://aka.ms/AAb9ysg>
________________________________
From: Matthew Knepley <knepley at gmail.com>
Sent: Tuesday, December 7, 2021 7:25:43 PM
To: Marco Cisternino <marco.cisternino at optimad.it>
Cc: petsc-users <petsc-users at mcs.anl.gov>
Subject: Re: [petsc-users] Nullspaces

On Tue, Dec 7, 2021 at 11:19 AM Marco Cisternino <marco.cisternino at optimad.it<mailto: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

This produces the normalized constant vector.

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

This is also the normalized constant vector.

So you are saying that these two vectors give different results with MatNullSpaceTest()?
Something must be wrong in the code. Can you send a minimal example of this? I will go
through and debug it.

Thanks,

Matt

Probably, I have wrong expectations, but should not it be the same?

Thanks

Marco Cisternino, PhD

______________________

Via Bligny 5, Torino, Italia.
+3901119719782

--
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/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20211207/39bf8872/attachment.html>
```