~njansson/dolfin/hpc

« back to all changes in this revision

Viewing changes to src/demo/scripting/pydolfin/solvers/elasticity/Elasticity.form

  • Committer: Anders Logg
  • Date: 2007-01-10 09:04:44 UTC
  • mfrom: (1689.1.221 trunk)
  • Revision ID: logg@simula.no-20070110090444-ecyux3n1qnei4i8h
RemoveĀ oldĀ head

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (c) 2005 Johan Jansson (johanjan@math.chalmers.se)
2
 
# Licensed under the GNU GPL Version 2
3
 
#
4
 
# The bilinear form for classical linear elasticity (Navier)
5
 
# Compile this form with FFC: ffc Elasticity.form.
6
 
 
7
 
element = FiniteElement("Vector Lagrange", "tetrahedron", 1)
8
 
 
9
 
v = BasisFunction(element)
10
 
u = BasisFunction(element)
11
 
 
12
 
lmbda = Constant() # Lame coefficient
13
 
mu    = Constant() # Lame coefficient
14
 
 
15
 
f = Function(element) # Source
16
 
 
17
 
# Dimension of domain
18
 
d = element.shapedim()
19
 
 
20
 
def epsilon(u):
21
 
    return 0.5 * (grad(u) + transp(grad(u)))
22
 
 
23
 
def E(e, lmbda, mu):
24
 
    Ee = 2.0 * mult(mu, e) + mult(lmbda, mult(trace(e), Identity(d)))
25
 
    
26
 
    return Ee
27
 
        
28
 
sigma = E(epsilon(u), lmbda, mu)
29
 
 
30
 
a = dot(sigma, epsilon(v)) * dx
31
 
L = f[i] * v[i] * dx