CliMA / LESbrary.jl

📚Generating Oceananigans large eddy simulation (LES) data for calibrating parameterizations
MIT License
27 stars 10 forks source link

Revive realistic SOSE pilot simulation #93

Closed ali-ramadhan closed 3 years ago

ali-ramadhan commented 3 years ago

This PR revives the pilot simulation initialized and forced using SOSE data that's sitting in the observations directory.

Running the pilot_simulation.jl script should produce the movies and plots below.

Obviously first problem in these figures is that the lat, lon I picked has what seems to be a very unstable temperature profile. Must be stable in real life though? Maybe our TEOS-10 equation of state isn't doing the right thing? Or maybe it's due to powerful lateral fluxes?

Was considering adding in the advanced statistics used in three_layer_constant_fluxes.jl but it'll just slow down the simulation right now when we probably want it to be fast for debugging. Let's make sure we can get the first-order statistics right first.

For fleshing out the setup we should probably pick a lat, lon that is nice and stable, preferably with small lateral fluxes.

Right now the script only runs on the CPU because Interpolations.jl is used in the forcing functions. Probably the next thing the script needs is linear interpolation on the GPU to we can actually run the script quickly.

One approach to making the interpolation GPU friendly would be to use Interpolations.jl to interpolate from the SOSE vertically stretched grid to the Oceananigans.jl grid and store the interpolated profiles in a ReducedField, then Oceananigans.Fields.interpolate can be used in the forcing functions as it's already used for Lagrangian particle advection.

cc @sandreza

Top row is surface plots, bottom row is yz slices:

https://user-images.githubusercontent.com/20099589/108284236-d6cdca80-7152-11eb-8d0d-108b5240fbe0.mp4

https://user-images.githubusercontent.com/20099589/108284241-d7fef780-7152-11eb-9c76-376bbafc44d0.mp4

lesbrary_latitude-50_longitude275_days10_surface_forcings

sandreza commented 3 years ago

This looks really awesome!

glwagner commented 3 years ago

Should we write a script that analyzes a site? Eg plots the initial temperature, salinity, and velocity profiles, plots time series of the fluxes... ?

ali-ramadhan commented 3 years ago

I left in some older scripts that analyzes the heat and salt budgets and surface forcings for a patch. We have monthly resolution for the budgets and daily resolution for the surface forcings. We could probably easily adapt them to analyze a specific lat/lon site before setting up the simulation.

https://github.com/CliMA/LESbrary.jl/blob/master/observations/plot_patch_fluxes.py https://github.com/CliMA/LESbrary.jl/blob/master/observations/plot_patch_forcings.py

ali-ramadhan commented 3 years ago

Note to self for when I revisit this PR: We also have a hidden Oceananigans feature that lets us use TimesDates.jl for model.clock.time which immediately makes the movies/plots feel more realistic when the title says "13:45, January 11, 2017"!

glwagner commented 3 years ago

Ah, maybe a simple addition would be to plot the buoyancy profile. I see that the temperature is destabilizing and the salinity is stabilizing, but I don't see how to come to the conclusion that the initial profile is stable. The dynamics do imply that there's instability...

I'm not sure that ECCO uses TEOS10 (maybe they use EOS80?) In that case it could maybe be possible that our initial profile is unstable. Not sure.

ali-ramadhan commented 3 years ago

Added some more analysis/plotting code so we can better understand these simulation. These plots are all automatically generated when you run pilot_simulation.jl.

Looking at the site analysis, I think I picked a pretty bad site (and time). Simulation time is highlighted in yellow. Seems to be a pretty unstable time for the mixed layer just before a big stratification in September 2013. Or rather, the mixed layer was probably capped from above making the model think the mixed layer got very shallow but this is a limitation of the mixed layer depth diagnostic.

Also plotted the buoyancy profile B(z) from Oceananigans and the stratification profile ∂ρ/∂z from SOSE. Might be good to be able to diagnose ∂ρ/∂z from Oceananigans since B(z) doesn't seem particularly useful (seems wrong too, it's lacking structure so I need to check that it does the right thing with TEOS10).

Looking at SOSE's ∂ρ/∂z I'm not sure what I'm looking at either since the numbers suggest it's just ρ - 1000 but the data is described as stratification ∂σ/∂z on the website (and ∂ρ/∂r in the NetCDF file). Either way seems salinity dominated.

I also compare the Oceananigans.jl mixed layer depth with SOSE's MLD diagnostic. The Oceananigans.jl MLD is computed using some code I copy pasted from @glwagner that only gives a grid point so it's a little noisy. Should make more sense when we pick a better site.

And we have realistic date times now!

lesbrary_latitude-50_longitude275_2013-09-08T00^%00^%00 000000000_to2013-09-18T00^%00^%00 000000000_site_analysis

https://user-images.githubusercontent.com/20099589/108714761-f3b62500-74e7-11eb-9ff7-461bd89ae1e7.mp4

lesbrary_latitude-50_longitude275_2013-09-07_to_2013-09-17_surface_forcings

ali-ramadhan commented 3 years ago

Some more useful things we could look at (kind of a TODO list):

  1. Movie of large-scale U, V, T, S, ∂ρ/∂z, U_geo, V_geo using interpolated data before running the simulation so we know what kind of background state we're getting into. Could also do it for the full 5-year SOSE period if we to get an idea of what's happening at this site at depth.
  2. Download SOSE heat and salt budget diagnostics so we can plot lateral vs. vertical fluxes at a particular site before running a simulation.
ali-ramadhan commented 3 years ago

@glwagner @adelinehillier Do you guys think anything is missing before we can merge?

glwagner commented 3 years ago

I say merge, this is a beautifully documented PR!

ali-ramadhan commented 3 years ago

I'll wait until https://github.com/tomchor/Oceanostics.jl becomes a registered package then update and merge this PR.

In the future maybe we can write up a script that runs plot_site_analysis to look at a bunch of different sites for choosing purposes.

Yeah that would be super useful, especially if we download and also plot the lateral vs. vertical fluxes.