1D Cantilever Beam problem

Hello,

I am a new FEniCS user. I have a problem with a 1D cantilever problem which would be very easy for you. My problem is as blow:

u’’[x] == - M/EI

BC: u[0] = 0 u’[0] = 0

And my code is as below:

    > from fenics import *
> 
>     E = 200e9
>     I = 1/12*0.0001
>     M = 500e3 
>     tol = 1e-14
> 
>     # build up mesh
> 
>     mesh = IntervalMesh(20, 0, 1)
>     V = FunctionSpace(mesh, 'P', 1)
> 
>     # define bundary condition
> 
>     u_D = Constant(0.0)
>     def boundary(x, on_boundary):
>         if near(x[0], 0, ):
>             return on_boundary
>         else:
>             return False
> 
>     bc = DirichletBC(V, u_D, boundary)
> 
>     # define variational equation
>     u = TrialFunction(V)
>     v = TestFunction(V)
>     f = Constant(-M/(E*I))
>     a = dot(grad(u), grad(v))*dx
>     L = f*v*dx
> 
>     # compute
>     u = Function(V)
>     solve(a == L, u, bc)
> 
>     # plot
>     plot(u)

I plotted it out and find it very different as what it should be in real. I guess I have made a wrong Boundary condition or maybe my variational equation is wrong. Could someone please help me out?

Thanks a lot

Bili

You cannot prescribe both a Neuman and Dirichlet condition at the same point. See for instance stackexchange and the old Q&A

1 Like

I see. Thanks a lot!