<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div class="">Hi,</div>
<div class=""><br class="">
</div>
<div class="">During the process to experiment the suggestion Matt made, we ran into some questions regarding to TSSolve vs KSPSolve. We got different initial unpreconditioned residual using two solvers. Let’s say we solve the problem with backward Euler and
there is no rhs. We guess TSSolve solves</div>
<div class="">(U^{n+1}-U^n)/dt = A U^{n+1}.</div>
<div class="">(We only provides IJacobian in this case and turn on TS_LINEAR.)</div>
<div class="">So we guess the initial unpreconditioned residual would be ||U^n/dt||_2, which seems different from the residual we got from a backward Euler stepping we implemented by ourself through KSPSolve.</div>
<div class=""><br class="">
</div>
<div class="">Do we have some misunderstanding on TSSolve? </div>
<div class=""><br class="">
</div>
<div class="">Thanks,</div>
<div class="">
<div>Qi</div>
<div>T5@LANL</div>
<div class=""><br class="">
</div>
<br class="Apple-interchange-newline">
</div>
<div><br class="">
<blockquote type="cite" class="">
<div class="">On Jul 7, 2021, at 3:54 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 16px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<div dir="ltr" class="">On Wed, Jul 7, 2021 at 2:33 PM Jorti, Zakariae <<a href="mailto:zjorti@lanl.gov" class="">zjorti@lanl.gov</a>> wrote:<br class="">
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">
<div class="">
<div id="gmail-m_4217968377908507552divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;" class="">
<p class="">Hi Matt,</p>
<p class=""><br class="">
</p>
<p class="">Thanks for your quick reply. </p>
<p class="">I have not completely understood your suggestion, could you please elaborate a bit more? </p>
<p class="">For your convenience, here is how I am proceeding for the moment in my code: </p>
<p class=""><br class="">
</p>
<p class="">TSGetKSP(ts,&ksp);<br class="">
</p>
<p class="">KSPGetPC(ksp,&pc); <br class="">
</p>
<p class="">PCSetType(pc,PCFIELDSPLIT);</p>
<p class="">PCFieldSplitSetDetectSaddlePoint(pc,PETSC_TRUE);</p>
<p class="">PCSetUp(pc);</p>
<p class="">PCFieldSplitGetSubKSP(pc, &n, &subksp);</p>
<p class="">KSPGetPC(subksp[1], &(subpc[1]));</p>
</div>
</div>
</blockquote>
<div class="">I do not like the two lines above. We should not have to do this. <br class="">
</div>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">
<div class="">
<div id="gmail-m_4217968377908507552divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;" class="">
<p class=""><span style="font-size: 12pt;" class="">KSPSetOperators(subksp[1],T,T);</span></p>
</div>
</div>
</blockquote>
<div class=""> In the above line, I want you to use a separate preconditioning matrix M, instead of T. That way, it will provide<br class="">
</div>
<div class="">the preconditioning matrix for your Schur complement problem.</div>
<div class=""><br class="">
</div>
<div class=""> Thanks,</div>
<div class=""><br class="">
</div>
<div class=""> Matt</div>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">
<div class="">
<div id="gmail-m_4217968377908507552divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;" class="">
<p class=""><span style="font-size: 12pt;" class="">KSPSetUp(subksp[1]);</span><br class="">
</p>
<p class="">PetscFree(subksp);</p>
<p class="">TSSolve(ts,X);<br class="">
</p>
<p class=""><br class="">
</p>
<p class="">Thank you.</p>
<p class="">Best,</p>
<p class=""><br class="">
</p>
<p class="">Zakariae</p>
</div>
<hr style="display: inline-block; width: 1015.21875px;" class="">
<div id="gmail-m_4217968377908507552divRplyFwdMsg" dir="ltr" class=""><font face="Calibri, sans-serif" style="font-size: 11pt;" class=""><b class="">From:</b><span class="Apple-converted-space"> </span>Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank" class="">knepley@gmail.com</a>><br class="">
<b class="">Sent:</b><span class="Apple-converted-space"> </span>Wednesday, July 7, 2021 12:11:10 PM<br class="">
<b class="">To:</b><span class="Apple-converted-space"> </span>Jorti, Zakariae<br class="">
<b class="">Cc:</b><span class="Apple-converted-space"> </span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank" class="">petsc-users@mcs.anl.gov</a>; Tang, Qi; Tang, Xianzhu<br class="">
<b class="">Subject:</b><span class="Apple-converted-space"> </span>[EXTERNAL] Re: [petsc-users] Problem with PCFIELDSPLIT</font>
<div class=""> </div>
</div>
<div class="">
<div dir="ltr" class="">
<div dir="ltr" class="">On Wed, Jul 7, 2021 at 1:51 PM Jorti, Zakariae via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank" class="">petsc-users@mcs.anl.gov</a>> wrote:<br class="">
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">
<div dir="ltr" class="">
<div id="gmail-m_4217968377908507552gmail-m_4230588803823514004divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;" class="">
<p class="">Hi,</p>
<p class=""><br class="">
</p>
<p class="">I am trying to build a PCFIELDSPLIT preconditioner for a matrix </p>
<p class="">J = [A00 A01]</p>
<p class=""> [A10 A11] </p>
<p class="">that has the following shape: </p>
<p class=""><br class="">
</p>
<p class="">M_{user}^{-1} = [I -ksp(A00) A01] [ksp(A00) 0] [I 0]</p>
<p class=""> [0 I] [0 ksp(T)] [-A10 ksp(A00) I ]<br class="">
</p>
<p class=""><br class="">
</p>
<p class="">where T is a user-defined Schur complement approximation that replaces the true Schur complement S:= A11 - A10 ksp(A00) A01.</p>
<p class=""><br class="">
</p>
<p class="">I am trying to do something similar to this example (lines 41--45 and 116--121): <a href="https://urldefense.com/v3/__https://www.mcs.anl.gov/petsc/petsc-current/src/snes/tutorials/ex70.c.html__;!!HXCxUKc!hoEfgnaraTfQoSgAiplsc6GJ_HuPXN88m5AJVy1gb7WVMNkGENDnJ3zToOGlhw$" id="gmail-m_4217968377908507552gmail-m_4230588803823514004LPlnk826214" target="_blank" class="">https://www.mcs.anl.gov/petsc/petsc-current/src/snes/tutorials/ex70.c.html</a></p>
<p class=""><br class="">
</p>
<p class="">The problem I have is that I manage to replace S with T on a separate single linear system but not for the linear systems generated by my time-dependent PDE. Even if I set the preconditioner <span style="font-size: 12pt;" class="">M_{user}^{-1}
correctly, the T matrix gets replaced by S in the preconditioner once I call TSSolve. </span></p>
<p class=""><span style="font-size: 12pt;" class="">Do you have any suggestions how to fix this knowing that the matrix J does not change over time?</span></p>
<div class=""><span style="font-size: 12pt;" class=""></span><br class="webkit-block-placeholder">
</div>
</div>
</div>
</blockquote>
<div class="">I don't like how it is done in that example for this very reason.</div>
<div class=""><br class="">
</div>
<div class="">When I want to use a custom preconditioning matrix for the Schur complement, I always give a preconditioning matrix M to the outer solve.</div>
<div class="">Then PCFIELDSPLIT automatically pulls the correct block from M, (1,1) for the Schur complement, for that preconditioning matrix without</div>
<div class="">extra code. Can you do this?</div>
<div class=""><br class="">
</div>
<div class=""> Thanks,</div>
<div class=""><br class="">
</div>
<div class=""> Matt</div>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">
<div dir="ltr" class="">
<div id="gmail-m_4217968377908507552gmail-m_4230588803823514004divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif, Helvetica, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;" class="">
<p class=""><span style="font-size: 12pt;" class="">Many thanks.</span></p>
<p class=""><span style="font-size: 12pt;" class=""><br class="">
</span></p>
<p class=""><span style="font-size: 12pt;" class="">Best regards,</span></p>
<p class=""><span style="font-size: 12pt;" class=""><br class="">
</span></p>
<p class=""><span style="font-size: 12pt;" class="">Zakariae </span></p>
<div class=""><span style="font-size: 12pt;" class=""></span><br class="webkit-block-placeholder">
</div>
</div>
</div>
</blockquote>
</div>
<br clear="all" class="">
<div class=""><br class="">
</div>
--<span class="Apple-converted-space"> </span><br class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">
-- Norbert Wiener</div>
<div class=""><br class="">
</div>
<div class=""><a href="https://urldefense.com/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!HXCxUKc!hoEfgnaraTfQoSgAiplsc6GJ_HuPXN88m5AJVy1gb7WVMNkGENDnJ3wB3dcMFw$" target="_blank" class="">https://www.cse.buffalo.edu/~knepley/</a><br class="">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br clear="all" class="">
<div class=""><br class="">
</div>
--<span class="Apple-converted-space"> </span><br class="">
<div dir="ltr" class="gmail_signature">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">
-- Norbert Wiener</div>
<div class=""><br class="">
</div>
<div class=""><a href="https://urldefense.com/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!HXCxUKc!hoEfgnaraTfQoSgAiplsc6GJ_HuPXN88m5AJVy1gb7WVMNkGENDnJ3wB3dcMFw$" target="_blank" class="">https://www.cse.buffalo.edu/~knepley/</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</body>
</html>