<div dir="ltr"><div dir="ltr">On Thu, Nov 3, 2022 at 12:16 PM Edoardo alinovi <<a href="mailto:edoardo.alinovi@gmail.com">edoardo.alinovi@gmail.com</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>Hello Jed/Barry/Petsc friends</div><div><br></div><div>I am trying to assemble a block matrix with 3x3 in 2D and 4x4 blocks in 3D coming from the fully coupled NS equation.</div><div><br></div><div>I am not sure I am understanding the example provided here:</div><div><a href="https://petsc.org/main/docs/manualpages/Mat/MatSetValuesBlocked/" target="_blank">https://petsc.org/main/docs/manualpages/Mat/MatSetValuesBlocked/</a><br></div><div><br></div><div>The description says that " <em style="box-sizing:border-box;color:rgb(50,50,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:15px"><span style="box-sizing:border-box;font-weight:bolder">v -</span></em> <span style="color:rgb(50,50,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:15px">a logically two-dimensional array of values</span>", while in the example is passed as a 1D array.</div><div><br></div><div>Should I pass a 2D array like v(1:nComp,1:nComp) or an array v(1:nComp*nComp) to MatSetValuesBlocked (I am using fortran that's why I start form 1 in my arrays) ? </div></div></div></div></div></blockquote><div><br></div><div>No, you pass a contiguous chunk of memory, but it is _logically_ 2D in that the size is (idxm * bs) x (idxn * bs)</div><div><br></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>Are <span style="box-sizing:border-box;color:rgb(50,50,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol""><span style="box-sizing:border-box"><i>idxm </i>and </span></span><span style="box-sizing:border-box;color:rgb(50,50,50);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol""><span style="box-sizing:border-box"><i>idxn </i></span></span>the global index of each block right? I guess PETSc will correctly assign each block row and column as it knows the matrix has a given structure.</div></div></div></div></div></blockquote><div><br></div><div>Yes.</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>Thank you as always! </div><div><br></div><div><br></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>