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

Providing initial guess for newton_solver

+2 votes

Hi,

I'm trying to solve a nonlinear heat equation,

$$ T \dot{T} = (T T')' ,$$
where $f$ is a constant and $T$ is to be solved. Boundary values are $T(t,x=0) = T(t,x=1) = 1$ and I also have some initial value for for T. The lattice is just a square lattice. I define the equation as follows:

F = (v*T*Dx(T,1)+T*Dx(v,0)*Dx(T,0))*dx - Constant(0.)*v*dx

and use the solver:

solve(F == 0, T, [bc,bc2], solver_parameters={"newton_solver":{"relative_tolerance": 1e-6}})

Newton solver doesn't seem to converge no matter what the initial conditions are (not even in the trivial case where solution is just $T= 1$). Linearized version of the equation solves just fine. I'd guess that providing the solver with a good initial guess would solve the problem. How do I do this?

I know that an initial value problem can be solved more easily by starting from the initial value and propagating the solution forward in time, but I want to solve it this way as a preparation for a more complicated problem that is not an initial value problem anymore.

asked May 26, 2014 by Ech FEniCS Novice (570 points)

Hi Ech,

Can you pls. post your full code. I am working on earthquake wave equation but learning the working of time dependent problems. Your non linear heat equation code will be very helpful. Thanks in advance.

1 Answer

+1 vote
 
Best answer

I found a partial solution to this myself. I can provide an initial condition by first solving the linear equation:

F0 = (v*Dx(T,1)+Dx(v,0)*Dx(T,0))*dx - Constant(0.)*v*dx
solve(F0 == 0, T, [bc,bc2], solver_parameters={"newton_solver":{"relative_tolerance": 1e-6}})

After I've done this, the solution to the linear problem is stored to $T$ and I can run what I wrote above and the solution converges.

I still didn't find how to start the solution from a user provided, analytical function, though.

answered May 26, 2014 by Ech FEniCS Novice (570 points)
selected May 28, 2014 by Ech

Interpolate an Expression.

...