<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Fri, Nov 30, 2018 at 10:19 AM NENNIG Benoit via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Dear petsc users,<br>
<br>
I have parallel matrix A (mpiaij) and I would like to create a matrix B like<br>
B = [A v <br>
wT 0 ]<br>
where wT and v are vectors.<br>
A is involved in eigenvalue computation (slepc4py) and B will be used by a direct solver.<br>
Currently, the matrix A is built from a sparse scipy matrix thanks to A.createAIJ, but I would like to avoid to create B from scipy. I am looking for a more _petscic_ way to solve this problem.<br></blockquote><div><br></div><div>For this case, we have support for</div><div><br></div><div> <a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateLRC.html">https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateLRC.html</a></div><div><br></div><div>Please let us know if it does not support all the operations you need.</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">
I have read that it seems not possible to change a matrix structure after its assembly. However<br>
<br>
- Is there a way to build directly in petsc this kind of block matrix B to reuse A ?<br>
- Is there a way to convert the petsc matrix A into csr form and to create B as new petsc matrix ?<br>
- Is there a way to copy a matrix into another one with a different structure ?<br>
- ...<br>
<br>
My second question is similar, suppose I have three matrices A1, A2, C resulting form coupled 2 FEM problems, what is the good way to create the coupled global system <br>
B = [A1 C<br>
CT A2]<br>
to use it with direct solver.<br></blockquote><div><br></div><div>For bigger, non-dense blocks you could use</div><div><br></div><div> <a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateNest.html">https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateNest.html</a></div><div><br></div><div>However, we recommend assembling into the big matrix directly using</div><div><br></div><div> <a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatGetLocalSubMatrix.html">https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatGetLocalSubMatrix.html</a></div><div><br></div><div>That way you can get the matrix as a fully assembled thing that can be factored for testing, and also</div><div>in the MatNest format so that you can extract blocks for string preconditioning.</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">
Thanks a lot,<br>
<br>
Benoit<br>
</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></div></div></div>