Signature of method 'Gamma_L1.inside()' does not match signature of the base method in class 'SubDomain'

Hello everyone. but I have gotten the following error code , any help please

i want to solve stokes
stokes
this is the FV:
2

mesh3 = UnitSquareMesh(n, n, "crossed")

# Define boundary condition
def boundary(x, on_boundary):
    return on_boundary


# Define boundary subdomains
tol = 1e-14


class Gamma_N(SubDomain):
    def inside(self, x, on_boundary):
        return on_boundary and near(x[0], x1, tol)


class Gamma_R(SubDomain):
    def inside(self, x, on_boundary):
        return on_boundary and near(x[0], x2, tol)


class Gamma_L1(SubDomain):
    def inside(self, x, on_boundary):
        return on_boundary and near(x[1], y1, tol)


class Gamma_L2(SubDomain):
    def inside(self, x, on_boundary):
        return on_boundary and near(x[1], y2, tol)


# Mark boundaries
boundary_markers = MeshFunction('size_t', mesh, mesh.topology().dim() - 1)
boundary_markers.set_all(0)
G_N = Gamma_N()
G_R = Gamma_R()
G_L1 = Gamma_L1()
G_L2 = Gamma_L2()
G_N.mark(boundary_markers, 0)
G_R.mark(boundary_markers, 1)
G_L1.mark(boundary_markers, 2)
G_L2.mark(boundary_markers, 3)
# Redefine boundary integration measure
ds = Measure('ds', domain=mesh, subdomain_data=boundary_markers)

Error :Signature of method ‘Gamma_L1.inside()’ does not match signature of the base method in class ‘SubDomain’

When I edit the code into a runnable MWE, I can’t reproduce the problem. The following runs without error for me using FEniCS 2019.2:

from dolfin import *

####### Added #######
x1=0
x2=1
y1=0
y2=1
n=10
#####################

mesh3 = UnitSquareMesh(n, n, "crossed")

# Define boundary condition
def boundary(x, on_boundary):
    return on_boundary

# Define boundary subdomains
tol = 1e-14

class Gamma_N(SubDomain):
    def inside(self, x, on_boundary):
        return on_boundary and near(x[0], x1, tol)

class Gamma_R(SubDomain):
    def inside(self, x, on_boundary):
        return on_boundary and near(x[0], x2, tol)

class Gamma_L1(SubDomain):
    def inside(self, x, on_boundary):
        return on_boundary and near(x[1], y1, tol)

class Gamma_L2(SubDomain):
    def inside(self, x, on_boundary):
        return on_boundary and near(x[1], y2, tol)

# Mark boundaries

####### Changed #######
#boundary_markers = MeshFunction('size_t', mesh, mesh.topology().dim() - 1)
boundary_markers = MeshFunction('size_t', mesh3, mesh3.topology().dim() - 1)
#######################

boundary_markers.set_all(0)
G_N = Gamma_N()
G_R = Gamma_R()
G_L1 = Gamma_L1()
G_L2 = Gamma_L2()
G_N.mark(boundary_markers, 0)
G_R.mark(boundary_markers, 1)
G_L1.mark(boundary_markers, 2)
G_L2.mark(boundary_markers, 3)
# Redefine boundary integration measure
####### Changed #######
#ds = Measure('ds', domain=mesh, subdomain_data=boundary_markers)
ds = Measure('ds', domain=mesh3, subdomain_data=boundary_markers)
#######################
1 Like

See if clearing the cache helps,

$ dijitso clean

or

$ rm -r ~/.cache/dijitso/
1 Like