# Dirichlet boundary function not defined over entire face

**URL:** <https://community.freefem.org/t/dirichlet-boundary-function-not-defined-over-entire-face/2226>\
**Category:** General Discussion\
**Created:** [January 16, 2023, 10:55pm UTC](https://community.freefem.org/t/dirichlet-boundary-function-not-defined-over-entire-face/2226 "2023-01-16T22:55:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsmacd](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jsmacd](https://community.freefem.org/u/jsmacd)\
**Post date:** [January 16, 2023, 10:55pm UTC](https://community.freefem.org/t/dirichlet-boundary-function-not-defined-over-entire-face/2226/1 "2023-01-16T22:55:14Z")

</div>

I am trying to impose Dirichlet boundary conditions along the faces of a cube built with the cube command. On faces 5 and 6 there is a single point where the function defining the boundary condition is not defined. It seems like this is causing me issues in obtaining a solution.

I get no solution if I write:

+on(1,2,3,4,5,6, u = g)

where g is the Dirichlet boundary condition I want to impose.

I can get solutions if I just add

- on(1,2,3,4, u = g)

or if I write

- on(1,2,3,4, u = g) + on(5, 6, u = g1)  
where g1 is smooth.

This makes me think that the problem is the discontinuity on faces 5 and 6. How can I properly impose such a boundary condition?

---

<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:** [January 17, 2023, 6:56am UTC](https://community.freefem.org/t/dirichlet-boundary-function-not-defined-over-entire-face/2226/2 "2023-01-17T06:56:57Z")

</div>

Do you mean the BC is _undefined_ or the BC is _discontinuous_? Discontinuity should not be an issue, but an undefined point on g should be.

---

<div class="post-metadata">

**Author:** ![jsmacd](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jsmacd](https://community.freefem.org/u/jsmacd)\
**Post date:** [January 17, 2023, 4:15pm UTC](https://community.freefem.org/t/dirichlet-boundary-function-not-defined-over-entire-face/2226/3 "2023-01-17T16:15:36Z")

</div>

right, yes sorry, it’s not a discontinuity. The function g is smooth everywhere where it is defined. But there is a single point on both of the faces 5 and 6 where it is not defined.

Maybe I can replace it with some clever function.

But I’m just wondering if it’s possible to impose the boundary conditions as they are stated.

---

<div class="post-metadata">

**Author:** ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)\
**Post date:** [January 18, 2023, 9:01pm UTC](https://community.freefem.org/t/dirichlet-boundary-function-not-defined-over-entire-face/2226/4 "2023-01-18T21:01:49Z")

</div>

I think you make a mistake  
with +on(1,2,3,4,5,6, u = g) =\> you have Dirichlet BC on all point of face with label in 1,2,3,4,5,6, .

---

<div class="post-metadata">

**Author:** ![jsmacd](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jsmacd](https://community.freefem.org/u/jsmacd)\
**Post date:** [January 19, 2023, 9:30pm UTC](https://community.freefem.org/t/dirichlet-boundary-function-not-defined-over-entire-face/2226/5 "2023-01-19T21:30:27Z")

</div>

Thank you for your reply! And, yes, I agree that was definitely causing a problem, due to the function g being undefined at a single point on both the faces z = 0, 1.

I do want to apply Dirichelt BC to all of the 6 faces. I decided to use a regularisation of g on the faces z = 0, 1. Also, it seems I needed to use P1 elements rather than P2. Now, I like the solution I’m getting on a coarser mesh, but when I try to run a finer mesh I’m getting a weird error.

Have you seen this before?

FALLBACK (log once): Fallback to SW vertex processing (lineMode && (localGroupInfo & GLRGroupInfoPrimitiveEmulatedFill))  
FALLBACK (log once): Fallback to SW vertex processing, m\_disable\_code: 800  
FALLBACK (log once): Fallback to SW vertex processing in drawCore, m\_disable\_code: 800  
FALLBACK (log once): Fallback to SW vertex for line stipple

I’m also getting some weird plots of cuts of the regularised g in my finer mesh. On the finer mesh, it’s not plotting anything in the middle. I’ve uploaded the plots. Do you have an idea if these issues are somehow related?

 ![coarse](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/c/c32d1fc63cf7dc3006b0a7959e5e6c2286a9153a.jpeg)  
 ![fine](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/a/ae81251272c8ba819c240c46745a6fa38dde50cc.jpeg)

---

<div class="post-metadata">

**Author:** ![jsmacd](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jsmacd](https://community.freefem.org/u/jsmacd)\
**Post date:** [January 24, 2023, 7:33pm UTC](https://community.freefem.org/t/dirichlet-boundary-function-not-defined-over-entire-face/2226/6 "2023-01-24T19:33:08Z")

</div>

Hi @cmd, I’ve been working on a solution to my problem and I think I’ve isolated where my issues are. Would you mind taking a look at this post?

> [@Piecewise function to eliminate singularity but singularity still causing problem](https://community.freefem.org/t/piecewise-function-to-eliminate-singularity-but-singularity-still-causing-problem/2235):
>
> Dear community, I am trying to eliminate a singularity within a cube by replacing the function with the singularity with a piecewise function that has no singularity. However, I’m getting some funky errors including an attempt to divide by 0. But I’m trying very hard not to divide by zero. Can someone see where I’ve gone wrong? Here is the code that’s giving me the error. load "msh3" // to use cube load "MUMPS" // real myRadius = 0.3; func uBC = (1/(((x - 0.5)^2 + (y - 0.5)^2)^0.5))\*(((x - 0…
