Hallo, I have a form a=inner(q(u)*grad(u),grad(v)) with u Trialfunction and v Testfunction. Now I want to calculate the derivative of a with respect to u. In a second step I want to evaluate this function at a function u_k (from an iterativ solve). Is this possible with fenics? Thanks for you help!
Please could you use the proper formatting?
Yes, but u should be a Function rather than a TrialFunction.
So (untested) suggestion:
u = Function(V) v = TestFunction(V) F = inner(q(u)*grad(u),grad(v))*dx a = derivative(F, u) u_k = Function(V) b = replace(a, {u: u_k})