Possible to treat some terms in a form as constant for derivative evaluation

Asked by Praveen C

Hello

If I have a form like this

u = Function(V)
v = TestFunction(V)

mu = u**2
L = mu*inner(grad(u), grad(v))*dx

While finding derivative of L wrt u, I would like "mu" to be treated as constant. Is it possible to achieve this somehow ?

praveen

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Johan Hake
Solved:
Last query:
Last reply:
Revision history for this message
Best Johan Hake (johan-hake) said :
#1

On Saturday October 15 2011 07:21:06 Praveen C wrote:
> New question #174497 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/174497
>
> Hello
>
> If I have a form like this
>

Try:

u = Function(V)
u0 = Function(V)
v = TestFunction(V)

mu = u0**2
F = mu*inner(grad(u), grad(v))*dx
J = derivative(F, u)
J = replace(J, {u0:u})

Johan

> While finding derivative of L wrt u, I would like "mu" to be treated as
> constant. Is it possible to achieve this somehow ?

Revision history for this message
Praveen C (cpraveen) said :
#2

Thanks Johan Hake, that solved my question.