~njansson/dolfin/hpc

« back to all changes in this revision

Viewing changes to src/demo/pde/elasticity/cpp/Elasticity.form

  • Committer: Johannes Ring
  • Date: 2008-03-05 22:43:06 UTC
  • Revision ID: johannr@simula.no-20080305224306-2npsdyhfdpl2esji
The BIG commit!

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 LGPL Version 2.1
3
 
#
4
 
# Modified by Anders Logg 2006-2007
5
 
#
6
 
# First added:  2005
7
 
# Last changed: 2007-04-18
8
 
#
9
 
# The bilinear form for classical linear elasticity (Navier).
10
 
# Compile this form with FFC: ffc Elasticity.form.
11
 
 
12
 
element = VectorElement("Lagrange", "tetrahedron", 1)
13
 
 
14
 
v = TestFunction(element)
15
 
u = TrialFunction(element)
16
 
f = Function(element)
17
 
 
18
 
E  = 10.0
19
 
nu = 0.3
20
 
 
21
 
mu    = E / (2*(1 + nu))
22
 
lmbda = E*nu / ((1 + nu)*(1 - 2*nu))
23
 
 
24
 
def epsilon(v):
25
 
    return 0.5*(grad(v) + transp(grad(v)))
26
 
 
27
 
def sigma(v):
28
 
    return 2*mu*epsilon(v) + lmbda*mult(trace(epsilon(v)), Identity(len(v)))
29
 
 
30
 
a = dot(grad(v), sigma(u))*dx
31
 
L = dot(v, f)*dx