Neumann boundary condition on both sides of a boundary

I would like to impose a Neumann (normal derivative specified) boundary condition such that the normal derivative points away from the boundary on one side but into it on the other.

Consider a square box with a “boundary” (label = CUT) that extends halfway across the box, starting at the left edge. I have solved Laplace’s equation in this box. I have imposed Neumann BCs on the CUT border by using int1d(Th, CUT)(w) in the problem statement.

The figure shows the vector field [dx(phi), dy(phi)]. You can see that the BC is such that the the derivative points out of the cut on both sides. I would like the vectors to point “up” on both sides, so that the vector field flows smoothly up through the cut.

Yes, no problem,

but be careful,
it you cut is a real cut, ( the cut line is form with 2 line) in this cas you can put 2 labels and
2 Boundary condition on the 2 bord). To do than the coordinate mush be not exactly the same.
and you can do : int1d(Th, CUTtop)(w) -int1d(Th, CUTbottom)(w)

Otherwise if you have only one boundary, not a real cut, then
when you add term
int1d(Th, CUT)(w)
the solution is jump[dn(u)) = 1 on CUT

the get on curve CUT

example of this mesh with crack:

CrackSliding.edp (766 Bytes)

Thanks for the ideas. I tried the two-cut method, but it’s difficult to keep the mesh points from becoming too close to each other, especially when the number of points on the border becomes moderately large (20 fails in the CrackSliding example).

I would like to try the method with only one boundary or cut, but I don’t really understand Frederic’s suggestion. How do I implement the jump() function? I did a lot of reading on jump, but I still don’t understand it. Am I supposed to try something like

    int1d(Th, CUT)(w*jump(dy(u)))

How do I properly incorporate the jump command into my boundary conditions?