Skip to content

Commit 8466ca3

Browse files
authored
Fixes for Oceananigans v0.102 (#705)
* fixes for Oceananigans v0.102 * bump patch release * revert * some more updates to OS Papa exampe * remove ClimaOcean * back to n = Observable(1) * fix doctests * remove redundancy
1 parent e6e99fb commit 8466ca3

File tree

6 files changed

+51
-54
lines changed

6 files changed

+51
-54
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ClimaOcean"
22
uuid = "0376089a-ecfe-4b0e-a64f-9c555d74d754"
33
license = "MIT"
4-
version = "0.8.9"
4+
version = "0.8.10"
55
authors = ["Climate Modeling Alliance and contributors"]
66

77
[deps]

docs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ XESMF = "2e0b0046-e7a1-486f-88de-807ee8ffabe5"
1616
[compat]
1717
Documenter = "1"
1818
DocumenterCitations = "1.3"
19-
XESMF = "0.1.6"
2019
Literate = "2.2"
20+
XESMF = "0.1.6"

docs/make.jl

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@ bib = CitationBibliography(bib_filepath, style=:authoryear)
1717
const EXAMPLES_DIR = joinpath(@__DIR__, "..", "examples")
1818
const OUTPUT_DIR = joinpath(@__DIR__, "src/literated")
1919

20-
to_be_literated = [
21-
"single_column_os_papa_simulation.jl",
22-
"one_degree_simulation.jl",
23-
"near_global_ocean_simulation.jl",
24-
"global_climate_simulation.jl",
20+
examples_pages = [
21+
"Single-column ocean simulation" => "literated/single_column_os_papa_simulation.md",
22+
"One-degree ocean--sea ice simulation" => "literated/one_degree_simulation.md",
23+
"Near-global ocean simulation" => "literated/near_global_ocean_simulation.md",
24+
"Global climate simulation" => "literated/global_climate_simulation.md",
2525
]
2626

27+
to_be_literated = map(examples_pages) do (_, mdpath)
28+
replace(basename(mdpath), ".md" => ".jl")
29+
end
30+
2731
for file in to_be_literated
2832
filepath = joinpath(EXAMPLES_DIR, file)
2933
withenv("JULIA_DEBUG" => "Literate") do
@@ -44,12 +48,7 @@ format = Documenter.HTML(collapselevel = 2,
4448
pages = [
4549
"Home" => "index.md",
4650

47-
"Examples" => [
48-
"Single-column ocean simulation" => "literated/single_column_os_papa_simulation.md",
49-
"One-degree ocean--sea ice simulation" => "literated/one_degree_simulation.md",
50-
"Near-global ocean simulation" => "literated/near_global_ocean_simulation.md",
51-
"Global climate simulation" => "literated/global_climate_simulation.md",
52-
],
51+
"Examples" => examples_pages,
5352

5453
"Vertical grids" => "vertical_grids.md",
5554

examples/single_column_os_papa_simulation.jl

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
# In this example, we simulate the evolution of an ocean water column
44
# forced by an atmosphere derived from the JRA55 re-analysis.
55
# The simulated column is located at ocean station
6-
# Papa (144.9ᵒ W and 50.1ᵒ N)
6+
# Papa (144.9ᵒ W and 50.1ᵒ N).
77
#
88
# ## Install dependencies
99
#
1010
# First let's make sure we have all required packages installed.
1111

1212
# ```julia
1313
# using Pkg
14-
# pkg"add Oceananigans, ClimaOcean, CairoMakie"
14+
# pkg"add Oceananigans, ClimaOcean, Dates, CairoMakie"
1515
# ```
1616

1717
using ClimaOcean
1818
using Oceananigans
1919
using Oceananigans.Units
20-
using Oceananigans.BuoyancyFormulations: buoyancy_frequency
20+
using Oceananigans.Models: buoyancy_frequency
2121
using Dates
2222
using Printf
2323

@@ -54,7 +54,7 @@ set!(ocean.model, T=Metadatum(:temperature, dataset=ECCO4Monthly()),
5454

5555
# # A prescribed atmosphere based on JRA55 re-analysis
5656
#
57-
# We build a PrescribedAtmosphere at the same location as the single-colunm grid
57+
# We build a `JRA55PrescribedAtmosphere` at the same location as the single-colunm grid
5858
# which is based on the JRA55 reanalysis.
5959

6060
atmosphere = JRA55PrescribedAtmosphere(longitude = λ★,
@@ -72,7 +72,7 @@ ua = interior(atmosphere.velocities.u, 1, 1, 1, :)
7272
va = interior(atmosphere.velocities.v, 1, 1, 1, :)
7373
Ta = interior(atmosphere.tracers.T, 1, 1, 1, :)
7474
qa = interior(atmosphere.tracers.q, 1, 1, 1, :)
75-
t_days = atmosphere.times[1:length(ua)] / days
75+
t_days = atmosphere.times / days
7676

7777
using CairoMakie
7878

@@ -169,6 +169,8 @@ simulation.output_writers[:jld2] = JLD2Writer(ocean.model, outputs; filename,
169169

170170
run!(simulation)
171171

172+
# Now let's load the saved output and visualise.
173+
172174
filename *= ".jld2"
173175

174176
u = FieldTimeSeries(filename, "u")
@@ -208,14 +210,14 @@ Qlwt = zeros(Nt)
208210
Pt = zeros(Nt)
209211

210212
for n = 1:Nt
211-
t = times[n]
212-
uat[n] = ua[1, 1, 1, Time(t)]
213-
vat[n] = va[1, 1, 1, Time(t)]
214-
Tat[n] = Ta[1, 1, 1, Time(t)]
215-
qat[n] = qa[1, 1, 1, Time(t)]
216-
Qswt[n] = Qsw[1, 1, 1, Time(t)]
217-
Qlwt[n] = Qlw[1, 1, 1, Time(t)]
218-
Pt[n] = Pr[1, 1, 1, Time(t)] + Ps[1, 1, 1, Time(t)]
213+
t = Oceananigans.Units.Time(times[n])
214+
uat[n] = ua[1, 1, 1, t]
215+
vat[n] = va[1, 1, 1, t]
216+
Tat[n] = Ta[1, 1, 1, t]
217+
qat[n] = qa[1, 1, 1, t]
218+
Qswt[n] = Qsw[1, 1, 1, t]
219+
Qlwt[n] = Qlw[1, 1, 1, t]
220+
Pt[n] = Pr[1, 1, 1, t] + Ps[1, 1, 1, t]
219221
end
220222

221223
fig = Figure(size=(1800, 1800))
@@ -281,44 +283,40 @@ axislegend(axF)
281283
lines!(axS, times, interior(S, 1, 1, Nz, :))
282284
vlines!(axS, tn, linewidth=4, color=(:black, 0.5))
283285

284-
zc = znodes(T)
285-
zf = znodes(κ)
286-
un = @lift interior(u[$n], 1, 1, :)
287-
vn = @lift interior(v[$n], 1, 1, :)
288-
Tn = @lift interior(T[$n], 1, 1, :)
289-
Sn = @lift interior(S[$n], 1, 1, :)
290-
κn = @lift interior(κ[$n], 1, 1, :)
291-
en = @lift interior(e[$n], 1, 1, :)
292-
N²n = @lift interior(N²[$n], 1, 1, :)
293-
294-
scatterlines!(axuz, un, zc, label="u")
295-
scatterlines!(axuz, vn, zc, label="v")
296-
scatterlines!(axTz, Tn, zc)
297-
scatterlines!(axSz, Sn, zc)
298-
scatterlines!(axez, en, zc)
299-
scatterlines!(axNz, N²n, zf)
300-
scatterlines!(axκz, κn, zf)
286+
un = @lift u[$n]
287+
vn = @lift v[$n]
288+
Tn = @lift T[$n]
289+
Sn = @lift S[$n]
290+
κn = @lift κ[$n]
291+
en = @lift e[$n]
292+
N²n = @lift N²[$n]
293+
294+
scatterlines!(axuz, un, label="u")
295+
scatterlines!(axuz, vn, label="v")
296+
scatterlines!(axTz, Tn)
297+
scatterlines!(axSz, Sn)
298+
scatterlines!(axez, en)
299+
scatterlines!(axNz, N²n)
300+
scatterlines!(axκz, κn)
301301

302302
axislegend(axuz)
303303

304304
ulim = max(maximum(abs, u), maximum(abs, v))
305305
xlims!(axuz, -ulim, ulim)
306306

307-
Tmax = maximum(interior(T))
308-
Tmin = minimum(interior(T))
307+
Tmin, Tmax = extrema(T)
309308
xlims!(axTz, Tmin - 0.1, Tmax + 0.1)
310309

311-
Nmax = maximum(interior(N²))
310+
Nmax = maximum()
312311
xlims!(axNz, -Nmax/10, Nmax * 1.05)
313312

314-
κmax = maximum(interior(κ))
313+
κmax = maximum(κ)
315314
xlims!(axκz, 1e-9, κmax * 1.1)
316315

317-
emax = maximum(interior(e))
316+
emax = maximum(e)
318317
xlims!(axez, 1e-11, emax * 1.1)
319318

320-
Smax = maximum(interior(S))
321-
Smin = minimum(interior(S))
319+
Smin, Smax = extrema(S)
322320
xlims!(axSz, Smin - 0.2, Smax + 0.2)
323321

324322
CairoMakie.record(fig, "single_column_profiles.mp4", 1:Nt, framerate=24) do nn

src/OceanSeaIceModels/InterfaceComputations/coefficient_based_turbulent_fluxes.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ interfaces = ComponentInterfaces(nothing, ocean; atmosphere_ocean_fluxes=ao_flux
7171
7272
# output
7373
┌ Warning: Split barotropic-baroclinic time stepping with SplitRungeKutta3TimeStepper is experimental.
74-
│ Use at own risk, and report any issues encountered at [https://github.com/CliMA/Oceananigans.jl/issues](https://github.com/CliMA/Oceananigans.jl/issues).
75-
└ @ Oceananigans.TimeSteppers ~/.julia/packages/Oceananigans/fI8pm/src/TimeSteppers/split_hydrostatic_runge_kutta_3.jl:59
74+
│ Use at own risk, and report any issues encountered at https://github.com/CliMA/Oceananigans.jl/issues.
75+
└ @ Oceananigans.TimeSteppers ~/.julia/packages/Oceananigans/cQglC/src/TimeSteppers/split_hydrostatic_runge_kutta_3.jl:59
7676
ComponentInterfaces
7777
```
7878
"""

src/OceanSeaIceModels/ocean_sea_ice_model.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ model = OceanSeaIceModel(ocean; interfaces)
138138
139139
# output
140140
┌ Warning: Split barotropic-baroclinic time stepping with SplitRungeKutta3TimeStepper is experimental.
141-
│ Use at own risk, and report any issues encountered at [https://github.com/CliMA/Oceananigans.jl/issues](https://github.com/CliMA/Oceananigans.jl/issues).
142-
└ @ Oceananigans.TimeSteppers ~/.julia/packages/Oceananigans/fI8pm/src/TimeSteppers/split_hydrostatic_runge_kutta_3.jl:59
141+
│ Use at own risk, and report any issues encountered at https://github.com/CliMA/Oceananigans.jl/issues.
142+
└ @ Oceananigans.TimeSteppers ~/.julia/packages/Oceananigans/cQglC/src/TimeSteppers/split_hydrostatic_runge_kutta_3.jl:59
143143
OceanSeaIceModel{CPU}(time = 0 seconds, iteration = 0)
144144
├── ocean: HydrostaticFreeSurfaceModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = 0)
145145
├── atmosphere: Nothing

0 commit comments

Comments
 (0)