##### UniBwM Tabs
UniBwM » LRT » LRT 1 » Uebung7_A29_vorl

# Uebung7_A29_vorl

```from dolfin import *

#Gitter einlesen
mesh=Mesh("bookshelf.xml");

#Def. FE-Raum
V=VectorFunctionSpace( ... )

#Gitter auf Randfacetten getrennt ansprechen
boundary_parts=MeshFunction("uint", mesh, 1)

#Def. Materialdaten etc.
rho=0.0 #g/cm^3
g=... #N/cm^2
E=... #50.0E6*(0.01**2) #in N/cm^2
nu=...
G=... #Druck in N/cm #11 kg

class Gamma_l(SubDomain):
def inside(self, x, on_boundary):
tol = 1E-14
return on_boundary and x[0] < tol

GammaL=Gamma_l()
GammaL.mark(boundary_parts, 1)

u_l=Constant((0.0, 0.0))
bcd=DirichletBC(V,u_l,GammaL)

#Def. Neumann-Rand oben
class Gamma_o(SubDomain):
def inside(self, x, on_boundary):
tol = 1E-14
return on_boundary and x[1] > 11.0-tol

GammaO=Gamma_o()
GammaO.mark(boundary_parts, 0)

#Variationsproblem
lambdaC=Constant(E*nu/((1.0 + nu)*(1.0 - 2.0*nu)))
muC=...

u=TrialFunction(V)
v=...

f=Constant((0.0,-rho*g))
g=...

def sigma(v):

a=...
L=...

#LGS loesen

u=Function(V)
solve(a == L, u, bcd)

#Visualisierung
plot(mesh)
plot(u, mode="displacement")
#file=File("Displ.pvd")
#file << u
interactive()
```