# Cut off functions with UFL

**URL:** <https://fenicsproject.discourse.group/t/cut-off-functions-with-ufl/7598>\
**Category:** Uncategorized\
**Created:** [February 2, 2022, 2:45am UTC](https://fenicsproject.discourse.group/t/cut-off-functions-with-ufl/7598 "2022-02-02T02:45:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![marazzaf](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/marazzaf/32/2778_2.png) [@marazzaf](https://fenicsproject.discourse.group/u/marazzaf)\
**Post date:** [February 2, 2022, 2:45am UTC](https://fenicsproject.discourse.group/t/cut-off-functions-with-ufl/7598/1 "2022-02-02T02:45:26Z")

</div>

Hello,

I’d like to implement some cut off for coefficients of a nonlinear problem.

With u = Function(U), and P=p(u) is a ufl based operation on u.  
I’ve been trying to implement something of the sort:  
if pointwise, P \>= 2, then modify P so that at these specific points P=2.

Any idea how that could be achieved?  
I don’t have a minimal example to offer because I don’t even know how to write the test cited above.  
Thank you for your help y’all!

---

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [February 2, 2022, 7:22am UTC](https://fenicsproject.discourse.group/t/cut-off-functions-with-ufl/7598/2 "2022-02-02T07:22:20Z")

</div>

Consider using a conditional, as described in: [How to implement function with condition? - #3 by dokken](https://fenicsproject.discourse.group/t/how-to-implement-function-with-condition/5817/3)

---

<div class="post-metadata">

**Author:** ![marazzaf](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/marazzaf/32/2778_2.png) [@marazzaf](https://fenicsproject.discourse.group/u/marazzaf)\
**Post date:** [February 2, 2022, 4:20pm UTC](https://fenicsproject.discourse.group/t/cut-off-functions-with-ufl/7598/3 "2022-02-02T16:20:26Z")

</div>

That’s what I had in mind but I did not know how to do it.  
Thank you for your help.
