# Error: Newton solver did not converge

Hello everybody,
I try to run the code below:

from fenics import *
T =Constant(350)
P = 200000  #pressure in [Pa]
R = Constant(8.314462176) # [J*mol/K] universal gas constant
u_in = 0.8
u_out= 0.1
xml_file = "02Mesh.xml"
mesh = Mesh(xml_file)
fd = MeshFunction('size_t', mesh, "02Mesh_facet_region.xml");
materials = MeshFunction('size_t', mesh, "02Mesh_physical_region.xml");

V = FunctionSpace(mesh, 'P', 2)

bc1 = DirichletBC(V, Constant(u_in), fd, 101)
bc2 = DirichletBC(V, Constant(u_out), fd, 202)
bc = [bc1, bc2]

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

dx = Measure('dx', domain=mesh, subdomain_id=3)

EffectiveDiffO2 = 0.001
# Define variational problem
- (u*100)*v*dx

solve(F==0, u, bc)


but unfortunately, I got this error:

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error:   Unable to solve nonlinear system with NewtonSolver.
*** Reason:  Newton solver did not converge because maximum number of iterations reached.
*** Where:   This error was encountered inside NewtonSolver.cpp.
*** Process: 0
***
*** DOLFIN version: 2019.2.0.dev0
*** Git changeset:  unknown


It would be great if somebody can suggest that where is the problem.

I suggest you have a look at:

Also, to me it seems like your problem is linear and Im not certain that your problem is coercive, see for instance: https://www.math.tamu.edu/~guermond/M610_SPRING_2005/lect3.pdf

1 Like