On Fri, Feb 9, 2024 at 7:04 AM Jeremy Theler (External) <jeremy.theler-ext@ansys.com> wrote:
Hi all

Because of a combination of settings, our code passes through this line:


i.e. the matrices associated with each of the sub-KSPs of a fieldsplit are destroyed and then re-created later.
The thing is that one of these destroyed matrices had a near nullspace attached, which is lost because the new matrix does not have it anymore.

Is this a bug or are we missing something?

I just want to get a clear picture. You create a PCFIELDSPLIT, set it up, then pull out the matrices and attach a nullspace before the solve. At a later time, you start another solve with this PC, and it has the DIFFERENT_NONZERO_PATTERN flag, so it recreates these matrices and loses your attached nullspace.

First, does the matrix really change?

Second, I had the same problem. I added callbacks to DM which allow a nullspace to be automatically attached if you extract a certain subfield. Are you using a DM?

  Thanks,

    Matt
 
I'll need some time to come up with a MWE showing how the near nullspace is lost, but if its needed I can take a stab at it.

--
jeremy




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