Oceananigans.jl icon indicating copy to clipboard operation
Oceananigans.jl copied to clipboard

Double gyre example

Open navidcy opened this issue 4 years ago • 38 comments

This needs work but following suggestion, I submit a PR and we all work together... :)

Closes #678.

navidcy avatar Oct 20 '20 21:10 navidcy

Codecov Report

:exclamation: No coverage uploaded for pull request base (main@fad81b0). Click here to learn what that means. Patch has no changes to coverable lines.

:exclamation: Current head 32a06cb differs from pull request most recent head 94fdef6. Consider uploading reports for the commit 94fdef6 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1085   +/-   ##
=======================================
  Coverage        ?   57.31%           
=======================================
  Files           ?      162           
  Lines           ?     3882           
  Branches        ?        0           
=======================================
  Hits            ?     2225           
  Misses          ?     1657           
  Partials        ?        0           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Oct 20 '20 22:10 codecov[bot]

This would make an awesome example!

By modifying the parameters it could also be used at https://github.com/CliMA/OceanModelComparison.jl to compare against the double gyre solution produced by ClimateMachine.jl.

ali-ramadhan avatar Oct 20 '20 22:10 ali-ramadhan

By modifying the parameters it could also be used at https://github.com/CliMA/OceanModelComparison.jl to compare against the double gyre solution produced by ClimateMachine.jl.

Indeed. I also want to see if I can get some eddies and do some time-averaging of the barotropic flow for pedagogical purposes.

glwagner avatar Oct 21 '20 17:10 glwagner

Any chance we use vertically stretched grid?

navidcy avatar Oct 24 '20 05:10 navidcy

Stretched grid implementation isn't complete...

glwagner avatar Oct 24 '20 19:10 glwagner

Hint, hint?

navidcy avatar Oct 24 '20 19:10 navidcy

We can't use a vertically stretched grid for this example because Oceananigans does not support vertically stretched grids.

glwagner avatar Oct 25 '20 02:10 glwagner

Does this work without a vertically stretched grid?

francispoulin avatar Nov 23 '20 22:11 francispoulin

Yes, a double gyre simulation can be run on a regular grid.

glwagner avatar Nov 24 '20 19:11 glwagner

@francispoulin, yeah, why not? :) One might require more vertical grid points or what not, but I don't see any reason why it shouldn't.

navidcy avatar Nov 24 '20 20:11 navidcy

Thanks. It seemed that was on the wish list but wasn't sure if anything bad was happening without the stretched grid.

I will hopefully run this example sometime soon and see the resutls myself.

francispoulin avatar Nov 24 '20 20:11 francispoulin

It's been on the wish list. The problem (if I recall correctly) is that we haven't quite yet found the parameters that would make this work and still be relatively "cheap" to add as an example in the Docs that would run automatically with Literate.jl :)

navidcy avatar Nov 24 '20 20:11 navidcy

Last we talked, we decided that the most appropriate way forward with this example would be to pick it up from a checkpoint, and add the checkpointed data to the repository. This would make it so the example could be run in a reasonable amount of time, and also provide an example of checkpointing.

glwagner avatar Nov 24 '20 22:11 glwagner

We should resurrect now with GPU on triply-Bounded topology + VerticallyStretchedGrid. :)

navidcy avatar Mar 14 '21 19:03 navidcy

Out of curiousity, is the plan for this PR to add an example as an eddying baroclinic double gyre on the GPU with IncompressibleModel while #1433 adds a viscous barotropic double gyre with HydrostaticFreeSurfaceModel as a validation experiment?

ali-ramadhan avatar Mar 15 '21 14:03 ali-ramadhan

There's no plan! We should make one.

glwagner avatar Mar 15 '21 15:03 glwagner

Out of curiousity, is the plan for this PR to add an example as an eddying baroclinic double gyre on the GPU with IncompressibleModel while #1433 adds a viscous barotropic double gyre with HydrostaticFreeSurfaceModel as a validation experiment?

As a first step why not set up both IncompressibleModel and HydrostaticFreeSurfaceModel for a barotropic double gyre? Since there will be much in the way of nonhydrostatic effects, it would be a way to compare the two models in terms of the accuracy and the efficiency. Then it should be easy to change both to do a baroclinic double gyre.

francispoulin avatar Mar 15 '21 16:03 francispoulin

@glwagner, this should be feasible now with the but in the VerticallyStretchedRectilinearGrid and also with the HydrostaticFreeSurfaceModel with ImplicitFreeSurface().

I made some changes. Should we zoom and finish it off?

navidcy avatar Sep 12 '21 06:09 navidcy

@glwagner, this should be feasible now with the but in the VerticallyStretchedRectilinearGrid and also with the HydrostaticFreeSurfaceModel with ImplicitFreeSurface().

I made some changes. Should we zoom and finish it off?

This would be nice to have. Let's do it.

Should we run a short spin-up, or illustrate checkpointing with an equilibrated solution?

glwagner avatar Sep 12 '21 11:09 glwagner

Yes. But before doing that let's make sure it runs! It was blowing up when I was trying before. I may have done something wrong with forcing/bcs?

navidcy avatar Sep 12 '21 11:09 navidcy

Yes. But before doing that let's make sure it runs! It was blowing up when I was trying before. I may have done something wrong with forcing/bcs?

That's a good starting point...

glwagner avatar Sep 12 '21 11:09 glwagner

Some progress here...

https://user-images.githubusercontent.com/7112768/151718447-2a5fd619-3c4c-43c8-9aa5-29c97e0129b4.mp4

navidcy avatar Jan 30 '22 21:01 navidcy

double_gyre_circulation

navidcy avatar Jan 30 '22 21:01 navidcy

We need to think how we do this. We need a long run to produce a good figure. E.g., 100 years?

Should we run this somewhere and save output and then in this example show how we can load the output and plot?

Or should we run this somewhere for 95 years and save a checkpoint and then use this example to demonstrate how we can restart from a checkpoint and run for 5 years to produce animations/plots?

navidcy avatar Jan 30 '22 21:01 navidcy

If we use checkpointer then the PR will close #1136.

navidcy avatar Jan 30 '22 22:01 navidcy

Great to see you working on this @navidcy !

Some questions/comments:

I think having an animation is a great idea. Any particular reason you are plotting u? Traditionally, people plot the streamfunction (pressure) and or the voriticty. What do you think of including the streamfunction in the animation?

From looking at the animation I was surprised that we don't see a double gyre. But from your next image we see there is a double gyre in the barotropic streamfunction. This makes me think that if we plot the total streamfunction (or maybe even the barotropic and baroclinic components) we should get images that are more like what I've seen in papers.

How long did this take you to run and what resolution did you use?

francispoulin avatar Jan 31 '22 13:01 francispoulin

I think we should run it at a reasonably high resolution to produce eddies, and then checkpoint the run and upload it to OceananigansArtifacts.jl. Then we can download the checkpoint in the example, restart from there and run maybe 100 iterations to make a (short) animation?

It might make sense to revisit some of the more expensive examples and reduce their cost too (until we find a way to run examples on tartarus, or some other way to make them less expensive).

glwagner avatar Jan 31 '22 14:01 glwagner

@francispoulin, I agree! I'd like to plot movie of barotropic streamfunction or free surface and the relative vorticity. Perhaps total speed also. (I just plotted u and v because it was the easiest... just wanted to see whether things blow up or have grid-scale noise and what not.)

navidcy avatar Jan 31 '22 20:01 navidcy

How long did this take you to run and what resolution did you use?

The animation above is a 10 year run starting from rest.

With a resolution of Nx = 160, Ny = 240, and Nz = 50 it took bit less than an hour on the GPU (or something like that).

navidcy avatar Jan 31 '22 20:01 navidcy

Would it make sense to initialize with the analytical solution to the (linear or weakly nonlinear) barotropic problem? Even if a simple Laplacian viscosity is a poor parameterization for eddy effects, it should dramatically accelerate the equilibration process, right?

hdrake avatar Feb 07 '22 21:02 hdrake