# marking curved boundary in dolfin by SubDomain

I am trying to mark a curved boundary which is a PHYSICAL boundary, but it seems
dolfin does not take the boundary into account.

my curved boundary is just a semi-circle with a radius 0.5 and the center locates at (0, 0)

What I do is below,

class Cboundary(SubDomain):
def inside(self,x,on_boundary):
return on_boundary and (abs(x[0]*x[0]+x[1]*x[1]-0.25)<tol)

bc = DirichletBC(W.sub(0), noslip, Cboundary(), 'pointwise')

Changing the value of tol is not useful as I tried.

## Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
tedlai
Solved:
2010-03-03
Last query:
2010-03-03
2010-03-02
 Anders Logg (logg) said on 2010-03-02: #1

On Tue, Mar 02, 2010 at 08:09:35PM -0000, tedlai wrote:
> New question #102995 on DOLFIN:
>
> I am trying to mark a curved boundary which is a PHYSICAL boundary, but it seems
> dolfin does not take the boundary into account.
>
> my curved boundary is just a semi-circle with a radius 0.5 and the center locates at (0, 0)
>
> What I do is below,
>
> class Cboundary(SubDomain):
> def inside(self,x,on_boundary):
> return on_boundary and (abs(x[0]*x[0]+x[1]*x[1]-0.25)<tol)
>
> bc = DirichletBC(W.sub(0), noslip, Cboundary(), 'pointwise')
>
> Changing the value of tol is not useful as I tried.

Try changing to

return abs(x[0]*x[0] + x[1]*x[1] - 0.25) < tol

on_boundary will only be True on the actual boundary of the mesh and
as I understand it your "boundary" is inside the domain.

--
Anders

 tedlai (lailai) said on 2010-03-03: #2