This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

How to set derivative manually for a nonlinear solver

0 votes

I am using projected gradient method and therefore
I want to solve a nonlinear problem in ever iteration step. Now I think that when I am using the "derivate" function - the approximation I get, is too bad. Therefore my algorithm does not converge.

for the following example my form is

$$ min_{x\in X} \| x- \phi \|_{H^1}^2 $$

how can I set my derivate manually?
I am not quite sure what the syntax should look like..

Or is it possible to set the accuracy of the "derivative" function?

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

F = 0.5 * inner(nabla_grad(u - phi_exact),nabla_grad(v)) * dx + 0.5 * (u - phi_exact) * v * dx
problem = Subproblem(derivative(F, u, du), F)
asked Jun 29, 2016 by Whistler FEniCS Novice (460 points)
...