<div dir="ltr"><div dir="ltr">On Thu, Aug 13, 2020 at 3:17 AM Anthony Paul Haas <<a href="mailto:aph@email.arizona.edu">aph@email.arizona.edu</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font face="arial, sans-serif">Hello,</font><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">I am using MatZeroRows for imposing a known forcing into my equations in conjunction with rhs and by setting the diagonal of the matrix to 1.</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">I am using Fortran. I have used:</font></div><div><font face="arial, sans-serif"><br></font></div><div><p style="margin:0px;font-stretch:normal;line-height:normal;color:rgb(203,36,24)"><span style="font-variant-ligatures:no-common-ligatures"><font face="arial, sans-serif">! only local processors set their own zeros </font></span></p>
<p style="margin:0px;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><font face="arial, sans-serif"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(194,0,255)">call</span><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(74,0,255)">MatSetOption</span><span style="font-variant-ligatures:no-common-ligatures">(self%fieldLHSMat_ps, MAT_NO_OFF_PROC_ZERO_ROWS, PETSC_TRUE, ierr)</span></font></p><p style="margin:0px;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><font face="arial, sans-serif"><span style="font-variant-ligatures:no-common-ligatures"><br></span></font></p>
<p style="margin:0px;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><font face="arial, sans-serif"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(194,0,255)">call</span><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(74,0,255)">MatSetOption</span><span style="font-variant-ligatures:no-common-ligatures">(self%fieldLHSMat_ps, MAT_KEEP_NONZERO_PATTERN, PETSC_TRUE, ierr)</span></font></p>
<p style="margin:0px;font-stretch:normal;line-height:normal;color:rgb(0,0,0);min-height:13px"><font face="arial, sans-serif"><br><span style="font-variant-ligatures:no-common-ligatures"></span></font></p>
<p style="margin:0px;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><font face="arial, sans-serif"><span style="font-variant-ligatures:no-common-ligatures;color:rgb(194,0,255)">call</span><span style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(74,0,255)">MatZeroRows</span><span style="font-variant-ligatures:no-common-ligatures">(self%fieldLHSMat_ps, numrows, glob_row_idx, diag, PETSC_NULL_OBJECT, PETSC_NULL_OBJECT, ierr)</span></font></p><p style="margin:0px;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><font face="arial, sans-serif"><br></font></span></p><p style="margin:0px;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><font face="arial, sans-serif"><br></font></span></p><p style="margin:0px;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><font face="arial, sans-serif">Is numrows above the local (on each proc.) number of rows to remove, or is it the global number of rows to remove?</font></span></p></div></div></div></div></div></div></div></div></blockquote><div><br></div><div>Local.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><p style="margin:0px;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><font face="arial, sans-serif"><span style="font-variant-ligatures:no-common-ligatures">Also on some processors, I have no rows to remove, hence the array </span>glob_row_idx is not allocated. How can I tell Petsc? Should I pass PETSC_NULL_OBJECT instead of glob_row_idx in this case? </font></p></div></div></div></div></div></div></div></div></blockquote><div><br></div><div>If you pass numrows = 0, it should not matter what is in the next slot, as long as it type checks.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><p style="margin:0px;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><font face="arial, sans-serif">Finally, does using the option MAT_KEEP_NONZERO_PATTERN have an influence on the time the MatZeroRows call will take?</font></p></div></div></div></div></div></div></div></div></blockquote><div><br></div><div>I don't think it makes much of a difference, but I have not measured it.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><p style="margin:0px;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><font face="arial, sans-serif">Thanks,</font></p><p style="margin:0px;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><font face="arial, sans-serif"><br></font></p><p style="margin:0px;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><font face="arial, sans-serif">Best regards,</font></p><p style="margin:0px;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><font face="arial, sans-serif"><br></font></p><p style="margin:0px;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><font face="arial, sans-serif">Anthony</font></p>
<p style="margin:0px;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><font face="arial, sans-serif"><br></font></p>
<p style="margin:0px;font-stretch:normal;line-height:normal;color:rgb(0,0,0)"><font face="arial, sans-serif"><br></font></p></div><div><span style="font-variant-ligatures:no-common-ligatures"><br></span></div></div></div></div></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>