# Constraining a specific element(s) in P0 space

**URL:** https://community.freefem.org/t/constraining-a-specific-element-s-in-p0-space/1633
**Category:** General Discussion
**Created:** [March 29, 2022, 8:57am UTC](https://community.freefem.org/t/constraining-a-specific-element-s-in-p0-space/1633 "2022-03-29T08:57:22Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![gbwalton](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/gbwalton/32/617_2.png) [@gbwalton](https://community.freefem.org/u/gbwalton)
#### Post date: [March 29, 2022, 8:57am UTC](https://community.freefem.org/t/constraining-a-specific-element-s-in-p0-space/1633/1 "2022-03-29T08:57:22Z")

</div>

Hi all,

Is it possible to constrain a specific elements (or elements) as a Dirichlet reference value using P0 space? I am planning on using the iterative solvers within the PETSc library, so this doesn’t give me the option to search for the required element and set a tgv(=1e30).

Thanks,  
Greg

---

<div class="post-metadata">

### Author: ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)
#### Post date: [March 29, 2022, 6:44pm UTC](https://community.freefem.org/t/constraining-a-specific-element-s-in-p0-space/1633/2 "2022-03-29T18:44:27Z")

</div>

> so this doesn’t give me the option to search for the required element and set a tgv

What are you saying? Also, best to avoid `tgv=1e30`.

---

<div class="post-metadata">

### Author: ![gbwalton](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/gbwalton/32/617_2.png) [@gbwalton](https://community.freefem.org/u/gbwalton)
#### Post date: [March 30, 2022, 8:05am UTC](https://community.freefem.org/t/constraining-a-specific-element-s-in-p0-space/1633/3 "2022-03-30T08:05:11Z")

</div>

I am trying to constraint a specific element using P0 space. How would I go about doing this?

Could I set the `tgv=-1` for the corresponding degree of freedom associated with that element in the system?

Thanks

---

<div class="post-metadata">

### Author: ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)
#### Post date: [March 30, 2022, 12:11pm UTC](https://community.freefem.org/t/constraining-a-specific-element-s-in-p0-space/1633/4 "2022-03-30T12:11:02Z")

</div>

What do you mean by “constraint a specific element using P0 space”? What constraint? You don’t constraint elements, you constraint degrees of freedom.

---

<div class="post-metadata">

### Author: ![gbwalton](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/gbwalton/32/617_2.png) [@gbwalton](https://community.freefem.org/u/gbwalton)
#### Post date: [March 30, 2022, 1:35pm UTC](https://community.freefem.org/t/constraining-a-specific-element-s-in-p0-space/1633/5 "2022-03-30T13:35:24Z")

</div>

Apologies for poor phrasing of the question…

Yes exactly! How does one constrain a degree of freedom in a system when using P0 space? When using P1 space, one simply able to use the `on` function to apply a Dirichlet bc on a specific face etc. Clearly this approach is not feasible for P0 space since the dofs are no longer located on the boundary face. So with the P0 space I would like to constrain a specific dof (or set of), where this dof is identified as the specified element centre.

Thanks again

---

<div class="post-metadata">

### Author: ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)
#### Post date: [March 30, 2022, 1:50pm UTC](https://community.freefem.org/t/constraining-a-specific-element-s-in-p0-space/1633/6 "2022-03-30T13:50:23Z")

</div>

What’s the issue with using `on()` and `tgv` ?
