Hi, everyone.
I have read most of the articles regarding the "no factet matching" listed above, but still have no clue of what went wrong with my very simple program. I have 4 different taged lines on the geometry. It seems that somehow subdomain labeling system does not work at all.
Thank you for your input.
The geometry: 2dtest4.xml
cl__1 = 1;
Point(1) = {0, 0, 0, 1};
Point(2) = {10, 0, 0, 1};
Point(3) = {20, 0, 0, 1};
Point(4) = {0, 10, 0, 1};
Point(5) = {0, 20, 0, 1};
Line(1) = {2, 3};
Line(2) = {4, 5};
Circle(3) = {4, 1, 2};
Circle(4) = {5, 1, 3};
Line Loop(6) = {2, 4, -1, -3};
Plane Surface(7) = {6};
Physical Surface(1) = {7};
Physical Line(1) = {2};
Physical Line(2) = {1};
Physical Line(3) = {3};
Physical Line(4) = {4};
====================================================
from dolfin import *
set_log_level(1)
Create mesh and define function space
mesh = Mesh("2dtest4.xml")
boundaries = MeshFunction("size_t",mesh,mesh.topology().dim()-1)
boundaries.set_all(0)
V = FunctionSpace(mesh, "CG", 1)
Define variational problem
u = TrialFunction(V)
v = TestFunction(V)
f = Constant(0.0)
a = dot(grad(u), grad(v))dx
L = fv*dx
Define boundary condition values
u1 = Constant(100.0)
u2 = Constant(50.0)
u3 = Constant(0.0)
u4 = Constant(0.0)
Define boundary conditions
bc1 = DirichletBC(V, u1, boundaries, 0) - last argument must match with number (or label) of Physical Surface(0)
bc1 = DirichletBC(V, u1, boundaries, 1)
bc2 = DirichletBC(V, u2, boundaries, 2)
bc3 = DirichletBC(V, u3, boundaries, 3)
bc4 = DirichletBC(V, u4, boundaries, 4)
Compute solution
u = Function(V)
solve(a == L, u, [bc1, bc2, bc3, bc4])
Plot solution
plot(u, interactive=True)