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

What options are available in FEniCS for solving stiff/non-stiff time-dependent problems? Can I use Method of Lines?

+1 vote

I am currently using my own finite volume code that discretises the advection-diffusion-reaction equation. I only discretise the spatial operators this gives me a system of ODEs which can easily solved the tried and tested solvers (e.g. LSODE, Radau5 etc.). This approach is often called the Method of Lines (MOL). This can be very useful as an adaptive ODE solver can be used which will automatically pick the most appropriate method (e.g. backwards differentiation formula for stiff problems or Runge–Kutta for non-stiff).

I'm interested in exploring FEniCS and was wondering what options are available for time integration for stiff and non-stiff problems? Is a MOL scheme possible? Basically, how would somebody approach this problem using FEniCS?

asked Feb 21, 2014 by boyfarrell FEniCS Novice (360 points)
edited Feb 21, 2014 by boyfarrell

1 Answer

+4 votes
 
Best answer

FEniCS does not have built-in methods for time integration.

The native way, that is also advocated in the tutorials on time-dependent problems, is to discretize in time first, and then solve a sequence of stationary problems. This is often referred to as Rothe's method or horizontal MOL, cf. this scicomp.SE question.

Personally, I use to export the coefficient matrices to scipy arrays and so that I can apply any time integrator. See this code here for Navier-Stokes problems. This approach requires some programming for the treatment of nonlinearities and the boundary conditions.

Also, one probably can apply space-time variational formulations directly in FEniCS. But I don't have any experience with that.

answered Feb 21, 2014 by Jan FEniCS User (8,290 points)
selected Feb 21, 2014 by boyfarrell

Fancy seeing you here!

That's very helpful thanks. The scipy approach, if I understood correctly, would mean writing only the rhs of the equation in weak form (leaving the lhs time derivative continuous) and using FEniCS to provide the spatial discretisation of the rhs which is fed into scipy i the form of arrays and matrices?

For non-stiff problems the native method of time-stepping should work OK. But my concern is that for stiff problems BDFs are needed, it seem like I would have to implement this manually. The Rothe's approach (horizontal MOL) seems to apply the theta-method in time, and solve the system of equation for the next time step.

Not, sure if I understood you correctly. In the 'scipy' approach also the time derivative is discretized in space by FE. In particular you will get a mass matrix in front of it.

Then, the mass matrix and the other discretized operators are exported so that one can solve
$$
M\dot v = Av + K(v) + f
$$
The export of a nonlinear relation can be done either as function, that returns the evaluation of $K(v)$ using FEniCS or as a matrix for a certain linearization. Also, time dependent coefficients cannot be readily exported but as a 'wrapper' that exports at specified time instances.

Finally, with Rothe's method you can apply any time integration scheme. And the nonlinear solvers in FEniCS, in particular, allow for implicit methods.

btw. nice to see you here. :)

...