<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div><div><div><div>Hi PETSc team:<br><br></div>I am trying to create a SIMPLE type approximation for the Schur complement. It is a nonlinear code, so I have to update the Schur matrix once the tangent jacobian is updated. I am trying to figure out the best way of doing that.<br><br></div>In terms of generating an algebraic form of Schur S, I am trying to do the following.<br> <br><span style="color:rgb(0,0,255)">// S = A10 x A01, I have performed a diagonal scaling on all matrices, so the diag(A00) = I.<br></span></div><span style="color:rgb(0,0,255)">MatMatMult(A10, A01, MAT_INITIAL_MATRIX, S);<br></span></div><span style="color:rgb(0,0,255)">MatScale(S, -1.0); // S = -1 x S<br></span></div><span style="color:rgb(0,0,255)">MatAXPY(S, 1.0, A11, S, DIFFERENT_NONZERO_PATTERN); // S = A11 + S</span><br><br></div><font color="#000000">My questions are:<br></font></div><font color="#000000">(1) When I update the Schur complement, do I need to call <br></font></div><font color="#000000">MatDestroy(&S);<br></font></div><font color="#000000">MatMatMult(A10, A01, MAT_INITIAL_MATRIX, S);<br></font></div><font color="#000000">or shall I just call <br><font color="#000000">MatMatMult(A10, A01, MAT_REUSE_MATRIX, S);</font><br><br></font></div><font color="#000000">Basically, I am not sure how to properly use the flag MAT_REUSE_MATRIX.<br><br></font></div><font color="#000000">(2) When I update the Schur complement, the initial call of MatAXPY already incorporated the contribution of A00 in terms of nonzero patterns. So in my second call of MatAXPY, shall I use the flag SUBSET_NONZERO_PATTERN?<br><br></font></div><font color="#000000">Best regards,<br><br></font></div><font color="#000000">John<br></font></div>