Hi
I’m not very familiar with FEniCS and have encountered a problem when trying to solve a system of advection-diffusion equations. I can’t seem to get the system to converge. I have tried changing the solver and providing a good initial guess (which I gauged from an image off of the paper I copied the equation from), but nothing seemed to work.
Here is the problem:
u2v = c_3*u_1*u_2*u_1
F1 = D_u*inner(grad(u_1), grad(v_1))*dx - (c_1*v_1 - c__1*u_1*v_1 + u2v*v_1)*dx
F2 = D_v*inner(grad(u_2), grad(v_2))*dx - (c_2*v_2 - u2v*v_2)*dx
F = F1 + F2
where c_
are all constants, u_
are the trial functions (though they come from Function
) and v_
are the TestFunctions
.
This is the solver at the moment:
J = derivative(F, u)
problem = NonlinearVariationalProblem(F_init, 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
and the initial guess:
u_init = Expression(('2.9*pow(sin(.25*x[0])*sin(.25*x[1]), 10)', '0.25*pow(cos(.25*x[0])*cos(.25*x[1]), 10)'), degree=3)
But all I manage to get is the error message:
*** Error: Unable to solve linear system using PETSc Krylov solver.
*** Reason: Solution failed to converge in 1000 iterations (PETSc reason DIVERGED_ITS, residual norm ||r|| = 7.644914e-01).
I would appreciate any help in understanding how I can debug my problem or known solutions. Thank you very much for your time.