Hello there, I’ve been trying to solve a non-linear (scalar) problem with FeniCS.

The first thing I did was “follow the demo tutorial” .

In my script the compiler complaint that there was no Jacobian matrix defined, so I went after two pages original post that helped me and the reference from a response, Now my code runs but fails to converge. I will share a minimal description. The script is based 90% on the demo file ft09_reaction_system.py,

I just change the reaction function for a non-linear one and deleted the advection terms…

```
# Define variational problem as follows F = a(u,v) - f
F = ((u_1 - u_n1) / dt)*v_1*dx + Dr*dot(grad(u_1), grad(v_1))*dx + (u_1 / (u_1 - C)) * e * nu * u_2*v_1*dx \
+ ((u_2 - u_n2) / dt)*v_2*dx + Dn*dot(grad(u_2), grad(v_2))*dx + (u_1 / (u_1 - C)) * nu * u_2*v_2*dx
J = derivative(F, u)
problem = NonlinearVariationalProblem(F, u, [], J)
solver = NonlinearVariationalSolver(problem)
prm = solver.parameters
prm['nonlinear_solver'] = 'newton'
prm['newton_solver']['linear_solver'] = 'gmres'
prm['newton_solver']['preconditioner'] = 'jacobi'
prm['newton_solver']['relaxation_parameter'] = 1.0
prm['newton_solver']['krylov_solver']['maximum_iterations'] = int(1e3)
prm['newton_solver']['krylov_solver']['absolute_tolerance'] = 1e-20
solver.solve()
```

After the solver.solve() I receive diverging results and failure, Does anybody has an idea on how to tackle the problem?

Just to test my script, the code snippet shared before is located before the temporal loop… So the nonlinear problem takes data from the initial condition…