I would like to numerically find a mutual capacitance of two stripes of metal on the opposites sides of a cylinder. The problem is obviously a 2D Laplace equation. I would like to find the potential outside the cylinder as well. Therefore I have something like this:
mesh = UnitCircleMesh(50) V = FunctionSpace(mesh, 'Lagrange', 1) u_L = Constant(-1) def left_boundary(x, on_boundary): r = math.sqrt(x * x + x * x) return near(r, 0.7) and x < 0 and between(x, (-0.5, 0.5)) u_R = Constant(1) def right_boundary(x, on_boundary): r = math.sqrt(x * x + x * x) return near(r, 0.7) and x > 0 and between(x, (-0.5, 0.5)) leftPlate = DirichletBC(V, u_L, left_boundary) rightPlate = DirichletBC(V, u_R, right_boundary) bcs = [leftPlate, rightPlate] u = TrialFunction(V) v = TestFunction(V) a = dot(grad(u), grad(v)) * dx u = Function(V) solve(a == Constant(0) * v * dx, u, bcs)
When I run it, I receive
*** Warning: Found no facets matching domain for boundary condition.. And the found solution is 0. What is wrong?