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

Elasticity tutorial problem

0 votes

I am facing the below error while i am running elasticity tutorial problem: i.e. (ft06_elasticity.py).
I have changed the boundary condition from the Dirichlet on just x=0 face to all Dirichlet boundary on all the faces on the surface of the body.

Here is the snippet of the code in that field:
# Define Dirichlet boundary (x = 0 and x = 1)=Constant(0.0)
def boundaryX0(x):
return x[0] < DOLFIN_EPS and x[0] > 1.0 - DOLFIN_EPS and x[1]< DOLFIN_EPS and x[1]> 1- DOLFIN_EPS
u0 = Constant(0.0)
bc = DirichletBC(V, u0, boundaryX0)

However, this is the error that it is showing me:

**** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at


*** fenics-support@googlegroups.com


*** Remember to include the error message listed below and, if possible,
*** include a minimal running example to reproduce the error.


*** -------------------------------------------------------------------------
*** Error: Unable to create Dirichlet boundary condition.
*** Reason: Expecting a vector-valued boundary value but given function is scalar.
*** Where: This error was encountered inside DirichletBC.cpp.
*** Process: 0


*** DOLFIN version: 2016.2.0
*** Git changeset: unknown
*** -------------------------------------------------------------------------*
I am not able to understand what I am doing wrong.

Please let me know what I should do to correct it.

Thanks
Ratnesh

asked Feb 2, 2017 by ratnesh FEniCS Novice (190 points)

1 Answer

0 votes
 
Best answer

u0 would be defined as

u0 = Constant((0.0, 0.0))        # if u lives in a 2d vector function space or
u0 = Constant((0.0, 0.0, 0.0))   # if u lives in a 3d vector function space
answered Feb 2, 2017 by hernan_mella FEniCS Expert (19,460 points)
edited Feb 2, 2017 by hernan_mella

Thanks. That worked

...