← Back to team overview

dolfin team mailing list archive

Re: [Question #154628]: Dirichlet boundary condition

 

On Thu, Apr 28, 2011 at 09:48:05PM -0000, Marcos Samudio wrote:
> New question #154628 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/154628
>
> Hello, I'm a beginner on Fenics, and I'm having some trouble understanding the examples.
> The particular issue I'm dealing with is the definition of Dirichlet boundary conditions.
>
> In the first demo:
>
> def u0_boundary(x, on_boundary):
> 	return on_boundary
> bc = DirichletBC(V, u0, u0_boundary)
>
> The function u0_boundary returns on_boundary, but what value does
> on_boundary take??? It acts like a boolean, right? But what
> influence has the 'x' variable on it? I tried to track the path
> along debugging, but got lost...

x and on_boundary are inputs and your task should be to return a value
(True or False) that tells DOLFIN whether the point x is inside the
domain you consider as your boundary. The on_boundary argument is a
piece of extra information (to you from DOLFIN) that tells you whether
the point x is on the actual boundary of the domain. (Note that you may
very well specify a boundary condition inside the domain.)

Here are a couple of examples:

  return on_boundary

  return x[0] < 0.5

  return x[0] < 0.5 and on_boundary

This is discussed in some detail in an upcoming book which you can get
a copy of by

  bzr branch lp:fenics-book

--
Anders



Follow ups

References