How to calculate to the jacobian of $n(u, u_n, u_p)$? That is
$$dn_{ij} = \frac{\delta n_i}{\delta (u, u_n, u_p)_j}$$
I am considering the following snippet
Q = FunctionSpace(mesh,'CG',1)
element = Q.ufl_element()
mixed_element = MixedElement(element,element,element)
W = FunctionSpace(mesh, mixed_element)
u_mixed = Function(W)
v_mixed = TestFunction(W)
v, vn, vp = split(v_mixed)
du_mixed = TrialFunction(W)
u, un, up = split(u_mixed)
n = exp((u-un))
dx = Measure("dx")
I'd like to calculate the jacobian with something like this but I don't know if that's correct:
dn = derivative(n*v*dx(), u_mixed, du_mixed)
dn += derivative(n*vn*dx(), u_mixed, du_mixed)
J = assemble(dn)
Any help is appreciated.