[petsc-users] How do constraint dofs work?

Alexis Marboeuf alexis.marboeuf at hotmail.fr
Mon Dec 7 13:25:08 CST 2020

Hi Matt,

Thank you for your reply.
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? 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?
Thank you again for your time and I apologize if I miss something.


De : Matthew Knepley <knepley at gmail.com>
Envoyé : lundi 7 décembre 2020 02:02
À : Alexis Marboeuf <alexis.marboeuf at hotmail.fr>
Cc : petsc-users at mcs.anl.gov <petsc-users at mcs.anl.gov>
Objet : Re: [petsc-users] How do constraint dofs work?

On Sun, Dec 6, 2020 at 1:46 PM Alexis Marboeuf <alexis.marboeuf at hotmail.fr<mailto:alexis.marboeuf at hotmail.fr>> wrote:

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?

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
unconstrained dofs and no modification of the system is necessary. However, you would be responsible for putting the correct boundary values into
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
do something more involved.

Operationally, SetConstraintDof() keeps track of how many dofs are constrained on each point. Then SetConstraintIndices() tells us which dofs on that
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,
just like ghost dofs.



Alexis Marboeuf
What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20201207/36e2d355/attachment.html>

More information about the petsc-users mailing list