<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Matt,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I'm not used to this formulation for a linear system so I don't get it sorry. It is actually simpler. I will write my example and if someting goes wrong, I will continue this thread.
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thank you very much for your help.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Alexis<br>
</div>
<div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>De :</b> Matthew Knepley <knepley@gmail.com><br>
<b>Envoyé :</b> lundi 7 décembre 2020 21:06<br>
<b>À :</b> Alexis Marboeuf <alexis.marboeuf@hotmail.fr><br>
<b>Cc :</b> petsc-users@mcs.anl.gov <petsc-users@mcs.anl.gov><br>
<b>Objet :</b> Re: [petsc-users] How do constraint dofs work?</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div dir="ltr">On Mon, Dec 7, 2020 at 2:25 PM Alexis Marboeuf <<a href="mailto:alexis.marboeuf@hotmail.fr">alexis.marboeuf@hotmail.fr</a>> wrote:<br>
</div>
<div class="x_gmail_quote">
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hi Matt,</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Thank you for your reply. <br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I don't understand how unconstrained dofs in the neighborhood of a Dirichlet boundary can see non-zero constrained dofs in a finite element framework. To me, known non-zero terms due to non-zero imposed dofs are added in the RHS of the unconstrained dofs system?</div>
</div>
</blockquote>
<div><br>
</div>
<div>I see now. I never do this, so I misunderstood your question. Yes, if you are assembling A and b separately, then you need the terms you constrained in b. You can</div>
<div>do that, but I think it is needlessly complex and error prone. I phrase everything as a nonlinear system, forming the residual and Jacobian</div>
<div><br>
</div>
<div>  F(u) = A u - b</div>
<div>  J(u) = A</div>
<div><br>
</div>
<div>Since you have the boundary values in u, your residual will automatically create the correct RHS for the Newton equation, which you only solve once. There is no</div>
<div>overhead relative to the linear case, it is simpler, and you can automatically do things like iterative refinement.</div>
<div><br>
</div>
<div>  Thanks,</div>
<div><br>
</div>
<div>      Matt</div>
<div> </div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Or the proper terms are automatically added in the RHS and no modification of the system is necessary? But, in that case, I don't know how to set imposed non-zero values to tell Petsc what terms to include?</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Thank you again for your time and I apologize if I miss something.</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Regards,</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Alexis<br>
</div>
<div>
<div id="x_gmail-m_-7896688584099349048appendonsend"></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr style="display:inline-block; width:98%">
<div id="x_gmail-m_-7896688584099349048divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>De :</b> Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>><br>
<b>Envoyé :</b> lundi 7 décembre 2020 02:02<br>
<b>À :</b> Alexis Marboeuf <<a href="mailto:alexis.marboeuf@hotmail.fr" target="_blank">alexis.marboeuf@hotmail.fr</a>><br>
<b>Cc :</b> <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a> <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
<b>Objet :</b> Re: [petsc-users] How do constraint dofs work?</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div dir="ltr">On Sun, Dec 6, 2020 at 1:46 PM Alexis Marboeuf <<a href="mailto:alexis.marboeuf@hotmail.fr" target="_blank">alexis.marboeuf@hotmail.fr</a>> wrote:<br>
</div>
<div>
<blockquote style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hello,</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I intend to contribute to the Petsc documentation, especially on PetscSF and PetscSection objects. I'm writing an example where I solve a linear elasticity problem in parallel on unstructured meshes. I discretize the system with a finite element method and
 P1 Lagrange base functions. I only use Petsc basics such as PetscSF, PetscSection, Mat, Vec and SNES objects and I need to implement Dirichlet and/or Neuman boundary conditions. PetscSectionSetConstraintDof and related routines allow to define which dofs are
 removed from the global system but are kept in local Vec. I don't find much more information about constraint dofs. Can someone explain me how it works? In particular, do I have to manually add terms related to inhomogeneous Dirichlet boundary condition in
 the RHS? Am I missing something?</div>
</div>
</blockquote>
<div><br>
</div>
<div>The way this mechanism is intended to work is to support removal of constrained dofs from the global system. This means it solves for only</div>
<div>unconstrained dofs and no modification of the system is necessary. However, you would be responsible for putting the correct boundary values into</div>
<div>any local vector you use. Note that this mechanism is really only effective when you can constrain a dof itself, not a linear combination. For that, we</div>
<div>do something more involved.</div>
<div><br>
</div>
<div>Operationally, SetConstraintDof() keeps track of how many dofs are constrained on each point. Then SetConstraintIndices() tells us which dofs on that</div>
<div>point are constrained, where the indices are in [0, n) if there are n dofs on that point. If you make a global Section, constrained dofs have negative offsets,</div>
<div>just like ghost dofs.</div>
<div><br>
</div>
<div>  Thanks,</div>
<div><br>
</div>
<div>     Matt</div>
<div> </div>
<blockquote style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Regards,</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Alexis Marboeuf</div>
</div>
</blockquote>
</div>
-- <br>
<div dir="ltr">
<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>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr" class="x_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>
</body>
</html>