On 14/03/16 12:30, Floriane Gidel [RPG] wrote:
Dear Lawrence,
I actually solve the Benney-Luke equations so my code is very similar to the Benney-Luke demo. I define the same functions, weak formulations, problems and variational solvers. They are defined out of my time loop. Only the domain, mesh and initial conditions are different from the demo. In the time loop, I only call the solvers (e.g. eta.solve() ) and save the data. I solve it on my laptop which is a MacBook Pro with OSX version 10.9.5, and processor 2.5 GHz Intel Core i5.
OK. So one thing that may well speed things up (assuming you are not already doing so) is not to output the data at every time step. I also note that the benney-luke demo uses nonlinear solvers to compute the updates: \phi^{n+1/2}, \eta^{n+1} and then \phi^{n+1}. However, the implicit equations defining these problems look to be linear in the respective implicit variables. So I think you should be able to get away with using linear solvers instead. This will mean you won't need to assemble the Jacobians all the time, but just once, which should signficantly reduce the run time. Notice that given the residual form, you can compute the appropriate Jacobian simply: Fphi_h = ... Jphi_h = derivative(Fphi_h, phi_h) If you can reformulate using linear solvers the jacobian evaluation time should drop significantly (run with -log_summary to confirm). If this turns out to be correct, we'd love a patch to the existing benney-luke demo updating it! Finally, how large is the domain? It's possible that if you want this to go much faster, once we've addressed the issues above, you'll need to run on a slightly beefier machine. Cheers, Lawrence