<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div> DMStag may also be useful for your needs (and far simpler to use than DMPLEX) depending on where your Lagrange multipliers live. Note that regardless you should not need to be copying entire large submatrices around into bigger matrices; you can build the entire system in-place in one big matrix. MatNest is also a possibility depending on exactly what you are doing. <div class=""><br class=""></div><div class=""> If you explain what your Lagrange multipliers are (the constraints) we may be able to make more specific suggestions.<br class=""><div class=""><br class=""></div><div class="">Barry</div><div class=""><br class=""><div class=""><br class=""></div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Apr 7, 2022, at 8:26 AM, Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div dir="ltr" class="">On Thu, Apr 7, 2022 at 8:16 AM 高亚贺 via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" class="">petsc-users@mcs.anl.gov</a>> wrote:<br class=""></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="">
<br class="webkit-block-placeholder"></div><p class="MsoNormal">
Dear
Mr./Ms.,
</p><p class="MsoNormal">
<br class="">
</p><p class="MsoNormal" style="text-indent:24pt">
I have used
‘DMCreateMatrix’
to create a matrix <b class="">K</b>, and also the ‘DMCreateGlobalVector’
to create two vectors <b class="">U</b> (to be solved)
and <b class="">F </b>(right-hand side), i.e. <b class="">KU</b>=<b class="">F</b>.
Now, I want to add some complex constraints to this system through lagrangian
multiplier method, and the constraint matrix is <b class="">Q</b>. The <b class="">KU</b>=<b class="">F </b>transforms to
</p><p class="MsoNormal" style="text-align:center;text-indent:24pt">
<span id="cid:18003fc0abddc604b1a1"><1649328463919.png></span>
</p><p class="MsoNormal" align="center" style="text-align:center">
<b class=""></b>
</p><p class="MsoNormal">
How
to create <b class="">K</b><b class=""><sub class="">λ</sub></b>, and how to effectively copy values<b class=""> K</b> and <b class="">Q</b> to <b class="">K</b><b class=""><sub class="">λ</sub></b>? Does the newly created <b class="">K</b><b class=""><sub class="">λ</sub></b> and <b class="">F</b><b class=""><sub class="">λ </sub></b>still have an advantage
of DMDA? Or do you have any other good suggestions for this kind of problem? </p></blockquote><div class=""><br class=""></div><div class="">DMDA can only really handle collocated discretizations, meaning all fields sit on the vertices. If you can discretize your problem this way, then just give it two fields and assemble K_\lambda as normal. If not, then you might look at DMPlex which supports a wider range of discretizations.</div><div class=""><br class=""></div><div class=""> Thanks,</div><div class=""><br class=""></div><div class=""> Matt</div><div class=""> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p class="MsoNormal">
Thank you very
much!
</p><p class="MsoNormal">
<br class="">
</p><p class="MsoNormal">
Best
regards,
</p><p class="MsoNormal">
A
PETSc user
</p>
</blockquote></div><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">-- Norbert Wiener</div><div class=""><br class=""></div><div class=""><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank" class="">https://www.cse.buffalo.edu/~knepley/</a><br class=""></div></div></div></div></div></div></div></div>
</div></blockquote></div><br class=""></div></div></div></body></html>