From 9511f2232ed750809eb5f56e959f837a7e436224 Mon Sep 17 00:00:00 2001 From: Jago Strong-Wright Date: Tue, 26 Mar 2024 12:41:47 -0400 Subject: [PATCH 1/3] Update README.md I've added a figure and some detail to the readme but not sure what else needs to be included. --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 0743a5a..cb71c93 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,19 @@ Currently, it contains a script for a repeat year forcing/free runing near globa **Please note** this is a work in progress and the scripts were written as demonstrations - the physics and biogeochemistry are not complete or calibrated. +https://github.com/OceanBioME/GlobalOceanBioME/assets/26657828/ca2dd956-5fa5-4bb3-b564-743cbd379bd7 + +
+ More detailed description of proof of concept above + This proof of concept is a 1°x1° near global run between 75°N and 75°S with 48 vertical levels. + + The physics includes isopycnal skew-symmetric diffusivity and a convective adjustment boundary layer closure, and the biogeochemistry is a simple 4-variable nutrient, phytoplankton, zooplankton, detritus model (detailed here). + + The physics is initialised with temperature and salinity, and the top boundary is forced with data, from ECCO v4 (as per ClimaOcean NearGlobalSimulation), but the biogeochemistry in this simple example is initialised to be uniform across the globe (hence the abrupt change at the start). The surface photosynthetically available radiation for the biogeochemical model is interpolated from NASA ocean colour data. + + This model runs in around 45 minutes per year to run on an Nvidia A100 GPU. +
+ ## To run the proof of concept script ``` From 1f64b86f9ff050cd4074e9f8d25f2ff6f39f7b9b Mon Sep 17 00:00:00 2001 From: Jago Strong-Wright Date: Tue, 26 Mar 2024 13:54:36 -0400 Subject: [PATCH 2/3] Update README.md Co-authored-by: Navid C. Constantinou --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cb71c93..db37f77 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ https://github.com/OceanBioME/GlobalOceanBioME/assets/26657828/ca2dd956-5fa5-4bb
More detailed description of proof of concept above - This proof of concept is a 1°x1° near global run between 75°N and 75°S with 48 vertical levels. + This proof of concept is a 1°x1° near-global run between 75°N and 75°S with 48 vertical levels. The physics includes isopycnal skew-symmetric diffusivity and a convective adjustment boundary layer closure, and the biogeochemistry is a simple 4-variable nutrient, phytoplankton, zooplankton, detritus model (detailed here). From 931cfeafc42c145605f429313f2748330acd1339 Mon Sep 17 00:00:00 2001 From: Jago Stong-Wright Date: Tue, 26 Mar 2024 13:57:56 -0400 Subject: [PATCH 3/3] updated scripts and added plotting script --- scripts/one_degree_proof_of_concept.jl | 39 +++++++++++++++++--------- scripts/plot_one_degree.jl | 22 +++++++++++++++ 2 files changed, 48 insertions(+), 13 deletions(-) create mode 100644 scripts/plot_one_degree.jl diff --git a/scripts/one_degree_proof_of_concept.jl b/scripts/one_degree_proof_of_concept.jl index 501684a..c69af4c 100644 --- a/scripts/one_degree_proof_of_concept.jl +++ b/scripts/one_degree_proof_of_concept.jl @@ -53,13 +53,13 @@ simulation = one_degree_near_global_simulation(architecture; interior_background_vertical_viscosity = 1e-4, surface_background_vertical_viscosity = 1e-4, biogeochemistry, - biogeochemistry_kwargs = (surface_photosynthetically_active_radiation = OneDegreeSurfacePAR(architecture), scale_negatives = true), + biogeochemistry_kwargs = (surface_photosynthetically_active_radiation = OneDegreeSurfacePAR(architecture), scale_negatives = true, invalid_fill_value = 0), tracers = (:N, :P, :Z, :D, :T, :S) # have to specify since NPZD adds T but not S, and buoyancy requires both ) # Define output slices_save_interval = 2day -fields_save_interval = 1days +fields_save_interval = 3hour Nx, Ny, Nz = size(simulation.model.grid) dir = "bgc" @@ -69,7 +69,7 @@ with_isopycnal_skew_symmetric_diffusivity || (output_prefix *= "_no_gm") simulation.output_writers[:checkpointer] = Checkpointer(simulation.model; dir, prefix = output_prefix * "_checkpointer", - schedule = TimeInterval(365days), + schedule = TimeInterval(5days), cleanup = true, overwrite_existing = true) @@ -79,26 +79,39 @@ simulation.output_writers[:fields] = JLD2OutputWriter(model, merge(model.velocit schedule = TimeInterval(fields_save_interval), filename = output_prefix * "_fields", with_halos = true, - overwrite_existing = true) + overwrite_existing = true, +indices = (:, :, model.grid.Nz)) +#= +""" Load initial conditions from Copernicus models. -set!(model, N = 10.0, P = 0.1, Z = 0.01) +P and N are a direct downsampling and unit conversion from https://doi.org/10.48670/moi-00015 +Z is downsampled and unit converted from https://doi.org/10.48670/moi-00020 and then divided by +the mixed layer depth from https://doi.org/10.48670/moi-00024, and then applied uniformly over +the mixed region -simulation.Δt = 20minute -simulation.stop_time = time(simulation) + 1days +I think the units are wrong still. For now assume zooplankton are 138:106:16:1 O₂:C:N:P redfield ratio. +""" +file = jldopen(datadep"2010_near_global_bgc/initial_conditions.jld2") -@info "Running a simulation with Δt = $(prettytime(simulation.Δt)) from $(prettytime(simulation.model.clock.time)) until $(prettytime(simulation.stop_time))" +N_init = on_architecture(architecture, file["N"]) +P_init = on_architecture(architecture, file["P"].*16/106)# mmolC -> mmolN +Z_init = on_architecture(architecture, file["Z"].*16/(138*16*2+106*12+16*14+1*31)) # mg -> mmolN + +close(file) + +set!(model, N = N_init, P = P_init, Z = Z_init) +=# +set!(model, N = 10.0, P = 0.1, Z = 0.01) prog(sim) = @info "$(prettytime(time(sim))) in $(prettytime(sim.run_wall_time)) with Δt = $(prettytime(sim.Δt))" add_callback!(simulation, prog, IterationInterval(10)) -run!(simulation) - simulation.callbacks[:nan_checker] = Callback(Oceananigans.Simulations.NaNChecker(; fields = merge(model.tracers, model.velocities), erroring = true), IterationInterval(10)) -simulation.Δt = 10minutes -simulation.stop_time = start_time + 3 * 365days +simulation.Δt = 20minute +simulation.stop_time = 345days + 365days*3 @info "Running a simulation with Δt = $(prettytime(simulation.Δt)) from $(prettytime(simulation.model.clock.time)) until $(prettytime(simulation.stop_time))" -run!(simulation; pickup = false) +run!(simulation; pickup = false) \ No newline at end of file diff --git a/scripts/plot_one_degree.jl b/scripts/plot_one_degree.jl new file mode 100644 index 0000000..ae9c091 --- /dev/null +++ b/scripts/plot_one_degree.jl @@ -0,0 +1,22 @@ +using Oceananigans, CairoMakie, GeoMakie + +P = FieldTimeSeries("bgc/near_global_360_150_48_ConvectiveAdjustmentVerticalDiffusivity_fields.jld2", "P"); + +n = Observable(1) + +P_plt = @lift interior(P[$n], :, :, 1) + +fig = Figure() + +ax = GeoAxis(fig[1, 1];title, dest = "+proj=natearth2") + +xc, yc, zf = nodes(P.grid, Center(), Center(), Face()) + +hm = heatmap!(ax, xc, yc, P_plt, colorrange = (0.0001, 5), colorscale = log10) + +Colorbar(fig[2, 1], hm, vertical= false, label = "Phytoplankton (mmolN/m³)") + +CairoMakie.record(fig, "P.mp4", 1:10:length(P.times)) do i; + n[] = i; + @info "$(n.val)"; +end \ No newline at end of file