gridap / GridapODEs.jl

Time stepping for Gridap
MIT License
33 stars 7 forks source link

Linear solver on non-linear time-dependant problems #40

Closed ConnorMallon closed 3 years ago

ConnorMallon commented 3 years ago

When solving a non-linear time dependant problem with a manufactured solution that is independent of time, the ls solver gets the solution wrong but the nls solver with 1 iteration gets the solution right.

This is because when we use the nls we use the previous time-step solution to calculate a residual(u_n) and jacobian(u_n). So, if we have a solution which is constant in time then residual(u_n)=0 so the update du = jac/res = 0 for all time-steps independent of what the jac is. We will thus obtain the correct solution: u_n+1 = u_n + du = u_n

The linear solver, however, does not respect the previous time-step solution in any way. It solves a new problem everytime by setting u_n=0 i.e using residual(u_n=0) and jacobian(u_n=0) so the solution at u_n+1 is simply: u_n+1 = du This method is now independent of u_n and now instead dependant on jac even when u is constant in time. This is a problem if the equation is nonlinear and we only have an approximated jacobian and want the solution to be correct in this special case.

I think that the former method should therefore be called even if the user puts in ls as the option when specifying a transient non-linear operator.

santiagobadia commented 3 years ago

The linear solver will work for linear problems. The nonlinear solver will work for nonlinear problems. To pass a linear solver for a nonlinear problem is a hack. We could probably change the implementation in such a way that to pass a linear solver is the same as only one nonlinear iteration with u0 = un. What should work is to pass a nonlinear solver (with a linear solver inside) and enforce 1 iteration for semi-implicit methods.

If the last option is working, we can leave things as they are now. If you put a linear solver for a nonlinear problem, you cannot expect much.

ConnorMallon commented 3 years ago

ok no problem we will leave it then (the last option is working)