Hello, I am solving an advection-reaction equation:
F = mu*inner(nabla_grad(u), nabla_grad(v))*dx +R*inner(u,v)*dx
solve(F == 0, u, bcs)
With Dirichlet boundary conditions (u=1 on the left, u=0 on the right). U is a CG 1 function.
With the following reactive term, everything works:
R=Expression('cos((x[0]-0.5)*pi/0.2)*cos((x[1]-0.5)*pi/0.2)\
*(pow((x[0]-0.5)*(x[0]-0.5)+(x[1]-0.5)*(x[1]-0.5),0.5)<=0.1)+0.01')
On the other hand, with this (similarly shaped, and smoother) reactive term, the newton solver does not converge.
R=Expression('exp(1.0-1.0/(1.0-((x[0]-0.5)*(x[0]-0.5)+(x[1]-0.5)*(x[1]-0.5))/(0.1*0.1)))\
*(pow((x[0]-0.5)*(x[0]-0.5)/+(x[1]-0.5)*(x[1]-0.5),0.5)<=0.1)+1.0')
I noticed that, for coarse meshes (less than 100x100), if I add
R=interpolate(R,FunctionSpace(M,'DG',0))
Then the solver will converge. For a bit finer meshes the same is true if I interpolate R onto a CG1 space, but for very fine meshes the solver will never converge.
The first reactive term always works without any need of interpolating it.
Any idea?
Thanks.