This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

boundary condition

0 votes

How I can apply a condition to the limit within a circle.
I tried with this code but I have always received a message

center1 = [20,100]
radius = 5
tol=0.001
def on_circlehaut(x, on_boundary):
oncirclehaut = ((x[0]-center1[0])(x[0]-center1[0]) + (x[1]-center1[1])(x[1]-center1[1]))
return oncirclehaut >= (radius-tol)(radius-tol) and oncirclehaut<=(radius+tol)(radius+tol)
center2 = [20,20]

"Warning: Found no facets matching domain for boundary condition."

asked Jul 13, 2017 by maro FEniCS Novice (220 points)

1 Answer

0 votes

Try

from fenics import *
from mshr import Circle, generate_mesh
from math import hypot

center = Point(20.0, 100.0)
radius = 5.0

domain = Circle(center, radius)
mesh   = generate_mesh(domain, 10)

def on_circlehaut(x, on_boundary): 
    oncirclehaut = hypot(x[0]-center[0], x[1]-center[1]) 
    return oncirclehaut > radius/2.0 and on_boundary
answered Jul 14, 2017 by jandas FEniCS Novice (500 points)
...