Boundary SubDomains setting

Hi all,

I need to set up boundary subdomains for a square whose sides are divided in 3 parts, on 2 of which I have some BCs and on the third i have another BC, more or less like so:

forum_aid

I have already read the tutorial on settin up multiple BCs and my porblem is not on the BCs themselve but more on how to define the limits of the 3 different subdomains highlighted in the picture.

I have set up this SubDomains:

#Black part of the side
class Omega_1(SubDomain):
    def inside(self, x, on_boundary):
        return on_boundary and near(x[1], 0, tol) and x[0] >= (lenght/3)+tol or x[0] <= (lenght*2/3)+tol

#Red part of the side
class Omega_3(SubDomain):
    def inside(self, x, on_boundary):
        return on_boundary and near(x[1], 0, tol) and x[0] < (lenght/3)+tol or x[0] > (lenght*2/3)+tol

The problem is i get the following warning:

`*** Warning: Found no facets matching domain for boundary condition.

Can anyone help?

Thanks!

The error message is quite clear. However, for anyone to help you, you Need to provide a minimal working example including your mesh.