On Sat, 18 May 2013 13:29:39 +0200
Jan Blechta <[email protected]> wrote:
> On 16 May 2013 18:50:13 +0200
> "Niraj Jha" <[email protected]> wrote:
> > Dear team members
> >
> > I am working on a problem which has an obstacle defined as domain
> > (midplane region)and I need to apply Dirichlet BC in that region
> > (z direction displacement is zer0) but really donot have any idea to
> > apply BC for obstacle region ..
> >
> >
> >
> >
> >
> > class Midplane(SubDomain):
> > def inside(self, x, on_boundary):
> > return on_boundary and(((x[0]/3.25)**2 + (x[1]/2.75)**2 )
> > -1.0 < DOLFIN_EPS) and near (x[2], 0.60)
>
> Well, the question should go to scicomp.stackexchange.com with label
> 'fenics'. Anyway, this subdomain consists of very tiny neighbourhood
> of ellipse. There's almost no chance that you hit some facets by this
> subdomain.
Sorry, I was wrong - it is of course not ellipse but whole its interior;
more precisely it's elliptic cylinder but very flat, so it remains true
that barely there are facets entirely located within it unless x[2] =
0.60 is boundary of the domain. In this case your entire code seems OK.
In case that x[2]=0.60 plane is interior you need to remove on_boundary.
You probably also need to enlarge the region
return (((x[0]/3.25)**2 + (x[1]/2.75)**2 ) -1.0 < DOLFIN_EPS)
and abs(x[2]-0.60) < TOL
where TOL depends on mesh resolution but should be much larger than
DOLFIN_EPS.
Another option (and better) would to adapt your mesh to include
x[2]=0.60 plane facets.
Jan
>
> >
> >
> > midplane = Midplane()
> >
> >
> > # Initialize mesh function for interior domains
> > domains = CellFunction("uint", mesh)
> > domains.set_all(0)
> > midplane.mark(domains, 1)
> >
> > # Initialize mesh function for boundary domains
> > boundaries = FacetFunction("uint", mesh)
> > boundaries.set_all(0)
> > left.mark(boundaries, 1)
> >
> >
> > # Define function space and basis functions
> > V = VectorFunctionSpace(mesh, "Lagrange", 1)
> > U = TrialFunction(V)
> > v = TestFunction(V)
> >
> > # Define boundary conditions
> >
> > c = Constant(("0.0"))
> > bc1 = DirichletBC(V.sub(0), c, boundaries, 1)
> > bc2 = DirichletBC(V.sub(2), c, domains, 1)
> > bc = [bc1,bc2]
> >
> >
> >
> >
> > thnks
> > Niraj
> >
> > _______________________________________________
> > fenics mailing list
> > [email protected]
> > http://fenicsproject.org/mailman/listinfo/fenics
>
> _______________________________________________
> fenics mailing list
> [email protected]
> http://fenicsproject.org/mailman/listinfo/fenics
_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics