I believe you should do the following:


beta = Constant(0.001)

u = Function(Q)


from ufl.mathfunctions import Exp

alpha = Exp(beta*u)


In this case alpha will be a UFL expression, which you can assemble into Function, or simply use it in a form.



From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Justin Chang <jychang48@gmail.com>
Sent: 08 December 2015 22:38
To: firedrake
Subject: [firedrake] Can a Function be used in an Expression?
 
Hi all,

As the title states, can a Function solution be used in an Expression?

Say I have the following:

beta = 0.001
u = Function(Q)
alpha = Expression("exp(Beta*solution)",Beta=Betasolution=u)

When I try to run this, I get an error saying "ValueError: setting an array element with a sequence". Am I not doing something correctly or is it simply not possible to do include u into an Expression?

Thanks,
Justin