<div dir="ltr"><div dir="ltr">On Sun, Jun 18, 2023 at 2:49 PM Duan Junming <<a href="mailto:junming.duan@epfl.ch">junming.duan@epfl.ch</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 class="msg-1560233025222100243">
<div dir="ltr">
<div id="m_-1560233025222100243divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif" dir="ltr">
<div id="m_-1560233025222100243divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<p></p>
<div style="color:rgb(0,0,0)">
<div id="m_-1560233025222100243divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> <a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a> <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>><br>
<b>Sent:</b> Sunday, June 18, 2023 20:35<br>
<b>To:</b> Duan Junming<br>
<b>Cc:</b> <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a><br>
<b>Subject:</b> Re: [petsc-users] Advice on small block matrix vector multiplication</font>
<div> </div>
</div>
</div>
</div>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<div dir="ltr">On Sun, Jun 18, 2023 at 2:13 PM Duan Junming via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:</div>
</div>
</div>
</div>
</div>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<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>
<div dir="ltr">
<div id="m_-1560233025222100243m_4742194475290155037divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
Dear all, </div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<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>
<div dir="ltr">
<div id="m_-1560233025222100243m_4742194475290155037divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div><br>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<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>
<div dir="ltr">
<div id="m_-1560233025222100243m_4742194475290155037divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div>I am using DMPlex to manage the unknowns, two fields, one for pressure, and one for velocities with two/three components, defined in each cell. They're represented by polynomials, with N (10~50) dofs for each component.</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<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>
<div dir="ltr">
<div id="m_-1560233025222100243m_4742194475290155037divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div>I have an operator which can be written in a matrix form (N-by-N, dense), to be applied on the pressure field or each component of the velocities in each cell (the same for each cell and also for each component).</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<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>
<div dir="ltr">
<div id="m_-1560233025222100243m_4742194475290155037divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div>I was wondering which matrix should be defined to implement the block matrix-vector multiplication, here block means the pressure or the component of the velocities. Maybe a sequential block mat? Could you recommend any example?</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<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>
<div dir="ltr">
<div id="m_-1560233025222100243m_4742194475290155037divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div>Or I just implement this matrix-vector multiplication by hand?</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<div class="gmail_quote">
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
Dear Matt,<br>
<br>
Thank you for your quick reply!<br>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div dir="ltr">
<div class="gmail_quote"><br>
</div>
</div>
</div>
</div>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<div class="gmail_quote">
<div>1) It sounds like you have a collocated discretization, meaning p,u,v,w are all at the same spots. Is this true?</div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<span style="font-size:12pt">You're right. They're collocated at the same position.</span><br>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div dir="ltr">
<div class="gmail_quote"></div>
</div>
</div>
</div>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<div class="gmail_quote">
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div dir="ltr">
<div class="gmail_quote">
<div>2) You have a dense operator, like FFT, that can act on each component</div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<span style="font-size:12pt">Right, a dense operator applied on each component.</span><br>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<div class="gmail_quote">
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<div class="gmail_quote">
<div>3) I think you should make a vector with blocksize d+1 and extract the components with</div>
</div>
</div>
</div>
</div>
</div>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<div class="gmail_quote">
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<div class="gmail_quote">
<div> <a href="https://petsc.org/main/manualpages/Vec/VecStrideGather/" target="_blank">https://petsc.org/main/manualpages/Vec/VecStrideGather/</a></div>
</div>
</div>
</div>
</div>
</div>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<div class="gmail_quote">
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<div class="gmail_quote">
<div>then act on them, then restore with</div>
</div>
</div>
</div>
</div>
</div>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<div class="gmail_quote">
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<div class="gmail_quote">
<div> <a href="https://petsc.org/main/manualpages/Vec/VecStrideScatter/" target="_blank">https://petsc.org/main/manualpages/Vec/VecStrideScatter/</a></div>
</div>
</div>
</div>
</div>
</div>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<div class="gmail_quote">
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<div class="gmail_quote">
<div>You can use the *All() versions to do all the components at once.</div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<span style="font-size:12pt">Does this function work with the global/local vector generated from DMPlex?</span></div></div></div></blockquote><div><br></div><div>It should. By default, Plex orders all unknowns on a mesh point by field.</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 class="msg-1560233025222100243"><div dir="ltr"><div id="m_-1560233025222100243divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif" dir="ltr"><span style="font-size:12pt"> Now the vector is like: p_1, p_2, ..., p_N, u_1, v_1, w_1, ..., u_N, v_N, w_N.</span></div></div></div></blockquote><div><br></div><div>When you extract a component, it will have one field in order, as above.</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 class="msg-1560233025222100243"><div dir="ltr"><div id="m_-1560233025222100243divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif" dir="ltr"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<div class="gmail_quote">
<div> Thanks,</div>
</div>
</div>
</div>
</div>
</div>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<div class="gmail_quote">
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<div class="gmail_quote">
<div> Matt</div>
</div>
</div>
</div>
</div>
</div>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<div class="gmail_quote">
<div> </div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<div style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<div style="color:rgb(0,0,0)">
<div>
<div dir="ltr">
<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>
<div dir="ltr">
<div id="m_-1560233025222100243m_4742194475290155037divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:rgb(0,0,0);font-family:"Times New Roman",Times,serif,Times,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div>Thanks!</div>
<div>Junming</div>
</div>
</div>
</div>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
<span class="gmail_signature_prefix">-- </span><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>
</div>
</div>
</div>
</div>
</div>
</div></blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><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>