### boundary condition

236
views
0
10 months ago by
Hello,
I've read the already answered questions on this topic, but I still do not understand why I get this warning. Can anyone help?
warning : found no facets matching domain for bouandary condition

Here is an extract of my code. To give you a little background, I'm trying I tried to apply boundary conditions on the top circle edge and a bottom circle

center1 = [20.,100.]
tol=0.001
def on_circlehaut(x, on_boundary):
on_circlehaut = ((x[0]-center1[0])*(x[0]-center1[0]) + (x[1]-center1[1])*(x[1]-center1[1]))
return abs(on_circlehaut-25.)<= 0.05

center2 = [20.,20.]
def on_circlebas(x, on_boundary):
on_circlebas = ((x[0]-center2[0])*(x[0]-center2[0]) + (x[1]-center2[1])*(x[1]-center2[1]))
return abs(on_circlebas-25.)<= 0.05
Community: FEniCS Project
Have you carefully checked the tolerance value?

Also, consider the following MWE with two options for the return value (on a domain with a circular hole). You are in fact using option 1, but my experience is that option 2 is more robust (it is definitely the preferred option when the interior of the circles do not belong to your domain of interest)
from dolfin import *
from mshr import *

def circle_bound(x, on_boundary):
r_xy = sqrt(x[0]**2 + x[1]**2)
# Tolerance
tolerance = 1e-2

# Option 1: requires relatively large tolerance value
#return on_boundary and abs(r_xy-radius) <=  tolerance

# Option 2: much smaller tolerance allowed
return on_boundary and r_xy <= radius + tolerance

nx =  2
square = Rectangle(Point(-1.,-1.),Point(1.,1.))
circle = Circle(Point(0.,0.),0.2,nx*4)
domain = square - circle
mesh = generate_mesh(domain,nx)

V = FunctionSpace(mesh, 'CG', 1)
bc = DirichletBC(V, Constant(0), circle_bound)

# Define dummy problem
u = TrialFunction(V); v = TestFunction(V)
F = u*v*dx - Constant(0.)*v*dx
A = assemble(lhs(F))
b = assemble(rhs(F))

# Apply bc
bc.apply(A,b)​
written 10 months ago by Jakob Maljaars