This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Assigning Dirichlet boundary condition at a point

0 votes

Hello,

I have a unit square as my domain and I am solving the equations of linear elasticity on it. I want to impose no y-displacement on the lower edge and I want to fix the node located at the middle of the lower edge, that is at (0.5,0). I checked and I have a node at that point.

I am doing

def lower_boundary(x,on_boundary):
    tol = 1E-15
    return (abs(x[1]) < tol)

def lower_boundary_fixed_point(x,on_boundary):
    tol=1E-15
    return (abs(x[1]) < tol) and (abs(x[0]-0.5)<tol)

bc_lower=DirichletBC(V.sub(1),Constant(0),lower_boundary)
bc_lower_fixed_point=DirichletBC(V.sub(0),Constant(0),lower_boundary_fixed_point) 

From bc_lower_fixed_point I am getting

*** Warning: Found no facets matching domain for boundary condition.

Could someone tell me what I am doing wrong?

asked Sep 9, 2016 by gokhalen FEniCS Novice (140 points)

1 Answer

+2 votes

Maybe try

from dolfin import * 
print DirichletBC.__doc__

Then you would know about

bc_lower_fixed_point=DirichletBC(V.sub(0),Constant(0),lower_boundary_fixed_point,method='pointwise') 
answered Sep 9, 2016 by KristianE FEniCS Expert (12,900 points)

Thanks, Kristian. Your solution seems to work. Adding method='pointwise' seems to get rid of the warning. The displacement fields look physical too. However,

print DirichletBC.__doc__

Does not work. I get an error

  File "elasticity_nachiket.py", line 4
    print DirichletBC.__doc__
                    ^        
SyntaxError: invalid syntax

Do you have any suggestions?

Nachiket

You need to use parentheses since from dolfin import * will call from __future__ import print_function:

print(DirichletBC.__doc__)
...