<div dir="ltr">I've run into this problem in the past, but it never got resolved.<br><div>Part of the issue is that there is no clarity on whether DM is "just geometry" or</div><div>"physics as well". Another view expressed in the past was "one DM-one Matrix",</div><div>so we'd need another DM for the preconditioning matrix. That quickly gets unwieldy.</div><div><br></div><div>My feeling is that, since <span style="line-height:1.5;font-size:13.1999998092651px">these issues haven't gotten resolved up to now, there is no clean </span></div><div><span style="line-height:1.5;font-size:13.1999998092651px">resolution and the best way forward is the straightforward one that keeps coming up: allow the</span></div><div><span style="line-height:1.5;font-size:13.1999998092651px">DM to construct two matrices. I think the best way is to add </span><span style="font-size:13.1999998092651px;line-height:1.5">DMCreateMatrices(DM,Mat*,Mat*) </span></div><div><span style="font-size:13.1999998092651px;line-height:1.5">to the API and fall onto DMCreateMatrix(DM,Mat*) if the former </span><span style="font-size:13.1999998092651px;line-height:1.5">fails to create any matrices.</span></div><div><span style="font-size:13.1999998092651px;line-height:1.5"><br></span></div><div><span style="font-size:13.1999998092651px;line-height:1.5">Dmitry.</span></div><div><span style="font-size:13.1999998092651px;line-height:1.5"><br></span></div><br><div class="gmail_quote">On Mon, Mar 2, 2015 at 5:27 AM Lawrence Mitchell <<a href="mailto:lawrence.mitchell@imperial.ac.uk">lawrence.mitchell@imperial.ac.uk</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
On 24 Feb 2015, at 19:27, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:<br>
<br>
> That is what happens. It does check for snes->jacobian, but that would not<br>
> be<br>
> set on coarse levels anyway. I think we should have an option that makes<br>
> SNESSetUpMatrices() create two matrices.<br>
<br>
In the general case, snes->jacobian and snes->jacobian_pre will have different sparsity, but if I just call back to DMCreateMatrix twice I won't know which one to make. One way to fix this would be for DMCreateMatrix to have the option of creating two matrices at once:<br>
<br>
DMCreateMatrix(dm, Mat *mat, Mat *pmat)<br>
<br>
One could then call<br>
<br>
DMSetCreateMatricesSeparately(<u></u>PETSC_TRUE)<br>
<br>
(better names much appreciated).<br>
<br>
to indicate that one wants separate matrices for the jacobian and its pmat.<br>
<br>
Thoughts?<br>
<br>
Lawrence<br>
</blockquote></div></div>