# Non-homogeneous Dirichlet BC at a point

**URL:** <https://community.freefem.org/t/non-homogeneous-dirichlet-bc-at-a-point/2410>\
**Category:** General Discussion\
**Created:** [April 20, 2023, 5:10pm UTC](https://community.freefem.org/t/non-homogeneous-dirichlet-bc-at-a-point/2410 "2023-04-20T17:10:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sumantkr](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/sumantkr/32/2681_2.png) [@sumantkr](https://community.freefem.org/u/sumantkr)\
**Post date:** [April 20, 2023, 5:10pm UTC](https://community.freefem.org/t/non-homogeneous-dirichlet-bc-at-a-point/2410/1 "2023-04-20T17:10:52Z")

</div>

Dear All,  
can we impose a non-homogeneous Dirichlet boundary condition at a point in a square domain?

Ex:  
u\_xx + u\_yy = f(x, y) over a square

AB, BC, CD, and DA are four boundaries of a square.

So, how to impose, u(A) = non-zero value in FreeFEM

Thanks!!!

---

<div class="post-metadata">

**Author:** ![cmd](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/cmd/32/67_2.png) [@cmd](https://community.freefem.org/u/cmd)\
**Post date:** [April 25, 2023, 7:21am UTC](https://community.freefem.org/t/non-homogeneous-dirichlet-bc-at-a-point/2410/2 "2023-04-25T07:21:06Z")

</div>

As far as I know, this cannot be done using the `on()` function. However, when solving a linear system, Ax=b you can always lock a DOF to a value by setting a row of the matrix A to all zeros except for a one at the point corresponding your DOF of interest. Then set the corresponding DOF in b to the desired value of the Dirichlet condition.

---

<div class="post-metadata">

**Author:** ![sumantkr](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/sumantkr/32/2681_2.png) [@sumantkr](https://community.freefem.org/u/sumantkr)\
**Post date:** [April 25, 2023, 11:17am UTC](https://community.freefem.org/t/non-homogeneous-dirichlet-bc-at-a-point/2410/3 "2023-04-25T11:17:08Z")

</div>

Thanks @cmd. This makes sense. I’ll implement it further.
