Subject: [FFC-dev] inverting constants

From: "Garth N. Wells" <[email-masked]>
Date: Tue, 23 Jan 2007 14:25:55 -0600

I used to be able to invert constants in a FFC file, but this now 
returns an error. Has something changed?

Garth

---

From: Anders Logg <[email-masked]>
Date: Wed, 24 Jan 2007 09:46:05 +0100

> returns an error. Has something changed?

Probably so... could you give an example?

/Anders

---

From: "Garth N. Wells" <[email-masked]>
Date: Wed, 24 Jan 2007 09:02:44 -0600

> Probably so... could you give an example?

element = FiniteElement("Vector Lagrange", "tetrahedron", 1)

v = TestFunction(element)  # test function
U = TrialFunction(element) # trial function

E  = Constant()
nu = Constant()

mu    = E / (2*(1 + nu))
lmbda = E*nu / ((1 + nu) * (1 - 2*nu))

def epsilon(v):
     return 0.5 * (grad(v) + transp(grad(v)))

def sigma(v):
     return 2*mu*epsilon(v) + lmbda*mult(trace(epsilon(v)), 
Identity(len(v)))

a = dot(grad(v), sigma(U))*dx

Garth

> /Anders
> _______________________________________________
> FFC-dev mailing list
> [email-masked]
> http://www.fenics.org/mailman/listinfo/ffc-dev
>

---

From: Anders Logg <[email-masked]>
Date: Wed, 24 Jan 2007 21:59:47 +0100

> a = dot(grad(v), sigma(U))*dx

Aha. I don't think this has ever worked. 1 + nu is a Form (previously
known as Sum) and not a Constant so you can't invert it.

Try the following:

nu = Constant()
mu = 1 + nu

print mu

if isinstance(mu, Form):
    print "It's a Form, not a constant!"

You can do things like

    a = v*u/c*dx

but not

    a = v*u/(1+c)*dx

/Anders