Dear Floriane, For the beach coupling problem in Firedrake the same remark applies when using symplectic Euler for both shallow water or Benney-Luke, and symplectic Euler for FV shallow water with flooding, in fully coupled mode: - starting with solving the continuity equation as coupled FEM and FV, this equation is linear in eta or h (note that eta can be expressed in terms of the full h too). That means that the entire coupled system is a linear system in h^n+1. The next step is nonlinear but explicit. This should simplify solving matters and thus enhance stability. Best wishes, Onno ________________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Floriane Gidel [RPG] <mmfg@leeds.ac.uk> Sent: Monday, March 14, 2016 2:22 PM To: firedrake@imperial.ac.uk Subject: Re: [firedrake] Debug and Optimised mode Thanks a lot Lawrence! I'll try to reformulate using linear solvers and I'll let you know how it goes. My domain has the shape of the domain attached, where the horizontal side has to be 100-300m (while the wave length is of order 1m which requires a mesh refinement of order 0.1 max). I tried to run the simulations on a faster machine but it did not improve much. But it might indeed after I linearise the solvers. I'll come back to you when it's done. Thanks a lot, Floriane ________________________________________ De : firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> de la part de Lawrence Mitchell <lawrence.mitchell@imperial.ac.uk> Envoyé : lundi 14 mars 2016 13:20 À : firedrake@imperial.ac.uk Objet : Re: [firedrake] Debug and Optimised mode 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