← Back to team overview

dolfin team mailing list archive

Re: [Question #102995]: marking curved boundary in dolfin by SubDomain

 

Question #102995 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/102995

    Status: Open => Answered

Anders Logg proposed the following answer:
On Tue, Mar 02, 2010 at 08:09:35PM -0000, tedlai wrote:
> New question #102995 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/102995
>
> 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

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.