Hello Jemma, Thanks for the suggestion, that helps a lot. You're right that if F = 1.0 it does work without a problem. I tried F = 0.0001 and that also seems to work very well. There is something about the purely barotropic (rigid-lid) problem that the solver does not like. In the case of a channel the F=0.0 case works without a problem. In pseudo-spectral codes I know that inverting an ellitpic operator has a problem with F = 0 because of the zero wavenumber. Not sure if there is an analogue in FE. With this I will happily consider F = 1.0 or really, really small but not zero. I will try to make a nice animation of 2D turbulence. When I do I will send it along, in case people are curious to see the results. Cheers, Francis ------------------ Francis Poulin Associate Professor Department of Applied Mathematics University of Waterloo email: fpoulin@uwaterloo.ca Web: https://uwaterloo.ca/poulin-research-group/ Telephone: +1 519 888 4567 x32637 ________________________________ From: firedrake-bounces@imperial.ac.uk [firedrake-bounces@imperial.ac.uk] on behalf of Shipton, Jemma [j.shipton@imperial.ac.uk] Sent: Tuesday, May 10, 2016 12:22 PM To: firedrake Subject: Re: [firedrake] periodic boundary conditions? Hi Francis, The first difference that jumped out at me is that you have set your Froude number to 0.0 - it is 1.0 in the original code. The code runs very nicely with F=1.0 again, although I'm not sure you should be setting Dirichlet BCs on a doubly periodic mesh. Hope that helps, Jemma ________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Francis Poulin <fpoulin@uwaterloo.ca> Sent: 10 May 2016 17:14:10 To: firedrake Subject: Re: [firedrake] periodic boundary conditions? Hello again, Sorry to bother you again with this but I thought I might send a copy of my code that tries to enforce periodic BCs, in case someone wanted to look it over and see if I've done anything clearly wrong. I think it's done correctly but for some reason even when I reduce Dt by 10^5, it still does not converge. Any ideas of things I can try would be greatly appreciated. Cheers, Francis ------------------ Francis Poulin Associate Professor Department of Applied Mathematics University of Waterloo email: fpoulin@uwaterloo.ca Web: https://uwaterloo.ca/poulin-research-group/ Telephone: +1 519 888 4567 x32637 ________________________________ From: Francis Poulin Sent: Sunday, May 08, 2016 8:52 AM To: firedrake@imperial.ac.uk Subject: RE: [firedrake] periodic boundary conditions? Hello Colin, I agree that the solver should work and if you think the problem is something else I am happy to investigate other avenues. As for your 3 options: (1) The initial conditions are random. When I use the channel version it does converge fine. (2) Maybe. Below you will see how the mesh is defined in two cases. (3) I haven't touched the equations and thought they were set up correctly but maybe not. When I look at the diff between my two versions, channel vs doubly periodic, I get < mesh = PeriodicRectangleMesh(n0, n0, Lx, Ly, direction="both", quadrilateral=True, reorder=None) ---
mesh = PeriodicRectangleMesh(n0, n0, Lx, Ly, direction="x", quadrilateral=True, reorder=None)
59c59 < psi_problem = LinearVariationalProblem(Apsi,Lpsi,psi0) ---
psi_problem = LinearVariationalProblem(Apsi,Lpsi,psi0,bcs=bc1)
It could be that the channel geometry is more forgiving to an error that is there but I am not sure why that would be or how to check it out. If anyone has any ideas of tests I can do please let me know. I can also share the code somehow if anyone wanted to take look at what it does. Cheers, Francis ------------------ Francis Poulin Associate Professor Department of Applied Mathematics University of Waterloo email: fpoulin@uwaterloo.ca Web: https://uwaterloo.ca/poulin-research-group/ Telephone: +1 519 888 4567 x32637 ________________________________ From: firedrake-bounces@imperial.ac.uk [firedrake-bounces@imperial.ac.uk] on behalf of Colin Cotter [colin.cotter@imperial.ac.uk] Sent: Sunday, May 08, 2016 2:57 AM To: firedrake Subject: Re: [firedrake] periodic boundary conditions? Hi Francis, I'm very sceptical that it is anything to do with the solver. Either: (1) The input to the solver is already bad, or, (2) The mesh is messed up somehow, or (3) The equations are messed up somehow. Just checking, you didn't keep non-zero beta did you? That would not work with double periodic. all the best --cjc On 7 May 2016 at 22:33, Francis Poulin <fpoulin@uwaterloo.ca<mailto:fpoulin@uwaterloo.ca>> wrote: Hello, Sorry Lawrence for sending my email to the wrong address but thanks for forwarding it. I will be more careful in the future. Thanks for the suggestion Colin. I had tried reducing it by a factor of 10 and it still failed. Now I tried a factor of 10^5 and it still fails. If my implementation is correct, which is a big if, then I wonder if the Helmholtz problem that I'm solving is much more poorly conditioned on a doubly periodic domain than just a periodic domain. Is there another solver that might be a bit better at converging? Cheers, Francis ------------------ Francis Poulin Associate Professor Department of Applied Mathematics University of Waterloo email: fpoulin@uwaterloo.ca<mailto:fpoulin@uwaterloo.ca> Web: https://uwaterloo.ca/poulin-research-group/ Telephone: +1 519 888 4567 x32637<tel:%2B1%20519%20888%204567%20x32637> ________________________________________ From: firedrake-bounces@imperial.ac.uk<mailto:firedrake-bounces@imperial.ac.uk> [firedrake-bounces@imperial.ac.uk<mailto:firedrake-bounces@imperial.ac.uk>] on behalf of Lawrence Mitchell [lawrence.mitchell@imperial.ac.uk<mailto:lawrence.mitchell@imperial.ac.uk>] Sent: Saturday, May 07, 2016 11:41 AM To: <firedrake@imperial.ac.uk<mailto:firedrake@imperial.ac.uk>> Subject: [firedrake] periodic boundary conditions? This message reached me as a list administrator from Francis Poulin (but I couldn't figure out how to release it onto the list, so instead, it's copied below). Lawrence Hello, Glad to see the posters are looking great. Sorry that I won't get to see them in person this year but glad I could contribute a little. Hopefully I'll get to attend next year with a grad student. I have a question on how to convert the QG code from a channel to periodic boundary conditions. You can find a demo version of the code at https://github.com/francispoulin/firedrake/blob/qg_demo/demos/quasigeostroph... I have removed the jet and only have random initial conditions. The good news is that 2D turbulence does happen and structures merge but in a channel. To reproduce classical results I would like it to be doubly periodic. I made two changes: 1) I asked it to be periodic in this line by switching "x" to "both". mesh = PeriodicRectangleMesh(n0, n0, Lx, Ly, direction="both", quadrilateral=True, reorder=None ) 2) We should not impose Dirichlet boundary conditions. To do this I removed bcs=bc1 in the following psi_problem = LinearVariationalProblem(Apsi,Lpsi,psi0) It occurs to me that perhaps one needs to explicitly impose periodic boundary conditions. Is that the case? If yes then do I need to change the following somehow? bc1 = [DirichletBC(Vcg, 0., 1 ), DirichletBC(Vcg, 0., 2 )] When I run the code it does run but it doesn't converge (after 42 steps) and dies. This is for the same resolution and everything else that does converge for the channel case. Could it be that the periodic case is not as well conditioned if it is periodic in both directions? I hope to make a nice simulation of this to see the structures merging and increasing in size. What's really nice is that if I wanted to do 3D turbulence in the context of 3D the changes are pretty small. I need to define the grid to be 3D and impose Neumann BCs at the top and bottom. That I will ask about at a later time. Cheers, Francis ------------------ Francis Poulin Associate Professor Department of Applied Mathematics University of Waterloo email: fpoulin@uwaterloo.ca<mailto:fpoulin@uwaterloo.ca> Web: https://uwaterloo.ca/poulin-research-group/ Telephone: +1 519 888 4567 x32637<tel:%2B1%20519%20888%204567%20x32637> _______________________________________________ firedrake mailing list firedrake@imperial.ac.uk<mailto:firedrake@imperial.ac.uk> https://mailman.ic.ac.uk/mailman/listinfo/firedrake -- http://www.imperial.ac.uk/people/colin.cotter www.cambridge.org/9781107663916<http://www.cambridge.org/9781107663916> [http://assets.cambridge.org/97811076/63916/cover/9781107663916.jpg]