Boundary conditions

Asked by Dupront

Hello,

 I am trying to play with boundary conditions in the case of
a hyperelastic problem that is proposed in the tutorial.

Surfaces up and down, for an UnitCube(n,n,n), are defined as:

up, down = compile_subdomains(["(fabs(x[2] - 1.0) < DOLFIN_EPS) && on_boundary",
                               "(fabs(x[2]) < DOLFIN_EPS) && on_boundary"])

Here the boundary condition will be applied to a surface.
Is it possible to define a boundary condition on a line or a point ?

Also is it possible to do something like:
size = 2/n
surface = compile_subdomains(["x[0] < size ) && on_boundary",])

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Dupront
Solved:
Last query:
Last reply:
Revision history for this message
Johan Hake (johan-hake) said :
#1

On 02/20/2012 09:06 PM, Dupront wrote:
> New question #188330 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/188330
>
> Hello,
>
> I am trying to play with boundary conditions in the case of
> a hyperelastic problem that is proposed in the tutorial.
>
> Surfaces up and down, for an UnitCube(n,n,n), are defined as:
>
> up, down = compile_subdomains(["(fabs(x[2] - 1.0)< DOLFIN_EPS)&& on_boundary",
> "(fabs(x[2])< DOLFIN_EPS)&& on_boundary"])
>
> Here the boundary condition will be applied to a surface.
> Is it possible to define a boundary condition on a line or a point ?

Yes, you just need to pay attention to create your subdomain correctly.
Also choosing "pointwise" method in the DirichletBC might help.

> Also is it possible to do something like:
> size = 2/n
> surface = compile_subdomains(["x[0]< size )&& on_boundary",])
>

This will work, but size in your string will not have anything to do
with size in your Python namespace. Just add this line after the call
and you should be fine:

   surface.size = size

size is here interpreted as an attribute to surface, and it is
initialized to 0.0. There are unfortunately no warning for this "feature".

Also if n is an integer larger than 2 size will be 0. Change to:

   size = 2./n

and you're fine.

Johan

Revision history for this message
Dupront (michel-dupront) said :
#2

Everything is working fine thanks to your help.
Many thanks