← Back to team overview

ffc team mailing list archive

Re: Nonlinear elasticity

 

Anders Logg wrote:
I tried to compile the forms and FFC does indeed consume a lot of
memory. This is a result of the forms having many coefficients (like
F^2) and derivatives and the approach used to evaluate the forms in
FFC (by a special tensor representation) may not be suitable in this
case. A straightforward quadrature-based evaluation may be more
suitable, but it will be a while before I get to implementing it.

In the meanwhile, try isolating the term that takes longest to compile
and consumes the most memory (by removing terms one by one) and maybe
we can find a suitable work-around for it. It's easier to spot the
problem if the form is a simple as possible.


On an Athlon XP 2400+ :

NonlinElasticitys1.form:  5m43.068s compilation time, ~51 Mb
NonlinElasticitys2.form: 28m58.479s compilation time, ~244 Mb
NonlinElasticitys3.form: (no compilation time, sorry),~473 Mb

Let me know if I can do something else

Thanks,

Marco
# Copyright (c) 2005 Johan Jansson (johanjan@xxxxxxxxxxxxxxxx)
# Licensed under the GNU GPL Version 2
#
# The bilinear form for classical linear elasticity (Navier)
# Compile this form with FFC: ffc Elasticity.form.

element = FiniteElement("Vector Lagrange", "tetrahedron", 1)
element1 = FiniteElement("Discontinuous vector Lagrange", "tetrahedron", 0, 9)

v = BasisFunction(element)
u = BasisFunction(element)
w = Function(element)

lmbda = Constant() # Lame coefficient
mu    = Constant() # Lame coefficient

f = Function(element) # Source

# Dimension of domain
d = element.shapedim()

deltaF =  grad(v)

deF =  grad(u)

F = grad(w)

epsilon = 0.5 * (transp(F) * F - Identity(d) )

def E(e, lmbda, mu):
    Ee = 2.0 * mult(mu, e)
    
    return Ee

sigma = E(epsilon, lmbda, mu)


a1 = 0.25 * trace(deltaF * sigma * transp(deF) )
#time a1: user    5m43.068s
#memory: ~51 Mb
#
a = a1 * dx
L1 = f[i] * v[i] 
L = (L1) * dx 
# Copyright (c) 2005 Johan Jansson (johanjan@xxxxxxxxxxxxxxxx)
# Licensed under the GNU GPL Version 2
#
# The bilinear form for classical linear elasticity (Navier)
# Compile this form with FFC: ffc Elasticity.form.

element = FiniteElement("Vector Lagrange", "tetrahedron", 1)
element1 = FiniteElement("Discontinuous vector Lagrange", "tetrahedron", 0, 9)

v = BasisFunction(element)
u = BasisFunction(element)
w = Function(element)

lmbda = Constant() # Lame coefficient
mu    = Constant() # Lame coefficient

f = Function(element) # Source

# Dimension of domain
d = element.shapedim()

deltaF =  grad(v)

deF =  grad(u)

F = grad(w)

delta_epsilon = 0.5 * (transp(deltaF)*F + transp(F)*deltaF)

de_epsilon = 0.5 * (transp(deF)*F + transp(F)*deF)

def E(e, lmbda, mu):
    Ee = 2.0 * mult(mu, e)
    
    return Ee

desigma = E(de_epsilon, lmbda, mu)

a3 = dot(desigma, delta_epsilon)
#time a3: user    28m58.479s
#memory: ~244 Mb
a = a3 * dx
L1 = f[i] * v[i] 
L = (L1) * dx 
# Copyright (c) 2005 Johan Jansson (johanjan@xxxxxxxxxxxxxxxx)
# Licensed under the GNU GPL Version 2
#
# The bilinear form for classical linear elasticity (Navier)
# Compile this form with FFC: ffc Elasticity.form.

element = FiniteElement("Vector Lagrange", "tetrahedron", 1)
element1 = FiniteElement("Discontinuous vector Lagrange", "tetrahedron", 0, 9)

v = BasisFunction(element)
u = BasisFunction(element)
w = Function(element)

lmbda = Constant() # Lame coefficient
mu    = Constant() # Lame coefficient

f = Function(element) # Source

# Dimension of domain
d = element.shapedim()

deltaF =  grad(v)

deF =  grad(u)

F = grad(w)

delta_epsilon = 0.5 * (transp(deltaF)*F + transp(F)*deltaF)

de_epsilon = 0.5 * (transp(deF)*F + transp(F)*deF)

def E(e, lmbda, mu):
    Ee = mult(lmbda, mult(trace(e), Identity(d))) #Ee2
    
    return Ee

desigma = E(de_epsilon, lmbda, mu)

a3 = dot(desigma, delta_epsilon)
#time a3: 
#memory: ~473 Mb
a = a3 * dx
L1 = f[i] * v[i] 
L = (L1) * dx 

Follow ups

References