From 4e3b2665ac0394146c04d77992bd0db44bfc4dea Mon Sep 17 00:00:00 2001 From: jbuffo <33759152+jbuffo@users.noreply.github.com> Date: Thu, 29 Jun 2023 12:39:08 -0400 Subject: [PATCH 1/2] Add file for idealized BCs --- test/IdealBCs.jl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/IdealBCs.jl diff --git a/test/IdealBCs.jl b/test/IdealBCs.jl new file mode 100644 index 00000000..562ac1ea --- /dev/null +++ b/test/IdealBCs.jl @@ -0,0 +1,21 @@ +# Information about the diurnal temperature fluctuations and cooling trends at the atmosphere boundary +top_T_initial = -5 +top_T_amplitude = 5 +top_T_slope = -0.5/86400 #degree C/sec + +# Information about ocean cooling +bottom_T_initial = 0 +bottom_T_slope = -0.5/86400 #degree C/sec + +# Information about time steps +dt = 1000 +tf = 864000 +time = collect(0:dt:tf) + +# Calculate BCs +top_T_BC=top_T_slope*time.+top_T_amplitude*sin.((2*pi*time)/86400).+top_T_initial +bottom_T_BC=bottom_T_slope*time.+bottom_T_initial + +# Plot boundary conditions +using Plots +plot(time, [top_T_BC bottom_T_BC], title="Boundary Conditions", label=["Atmosphere Temp." "Ocean Temp."], linewidth=3, xlabel="Time (s)", ylabel="Temperature (C)") From 89ede6a71a91c2300635141574bc26c62ae6367e Mon Sep 17 00:00:00 2001 From: Gregory Wagner Date: Thu, 29 Jun 2023 12:02:17 -0600 Subject: [PATCH 2/2] Some updates by Greg --- examples/idealized_boundary_conditions.jl | 35 +++++++++++++++++++++++ test/IdealBCs.jl | 21 -------------- 2 files changed, 35 insertions(+), 21 deletions(-) create mode 100644 examples/idealized_boundary_conditions.jl delete mode 100644 test/IdealBCs.jl diff --git a/examples/idealized_boundary_conditions.jl b/examples/idealized_boundary_conditions.jl new file mode 100644 index 00000000..37bdd310 --- /dev/null +++ b/examples/idealized_boundary_conditions.jl @@ -0,0 +1,35 @@ +using Oceananigans.Units +using GLMakie + +# This file creates idealized ice-interface temperatures +# for driving an ice column model. + +# Information about the diurnal temperature fluctuations and cooling trends at the atmosphere boundary +top_T_initial = -5 +top_T_amplitude = 5 +top_T_slope = -0.5 / day # ᵒC s⁻¹ + +# Information about ocean cooling +bottom_T_initial = 0 +bottom_T_slope = -0.5 / day # ᵒC s⁻¹ + +# Information about time steps +dt = 1000 +tf = 864000 +time = 0:dt:tf + +# Calculate BCs +top_T_BC = @. top_T_slope * time + top_T_amplitude * sin(2π*time/day) + top_T_initial +bottom_T_BC = @. bottom_T_slope * time + bottom_T_initial + +# Plot boundary conditions + +set_theme!(Theme(fontsize=24, linewidth=3)) +fig = Figure() +ax = Axis(fig[1, 1], title="Boundary Conditions", xlabel="Time (s)", ylabel="Temperature (ᵒC)") +lines!(ax, time, top_T_BC, label="Air-ice surface temperature") +lines!(ax, time, bottom_T_BC, label="Ice-ocean temperature") +axislegend(ax) + +display(fig) + diff --git a/test/IdealBCs.jl b/test/IdealBCs.jl deleted file mode 100644 index 562ac1ea..00000000 --- a/test/IdealBCs.jl +++ /dev/null @@ -1,21 +0,0 @@ -# Information about the diurnal temperature fluctuations and cooling trends at the atmosphere boundary -top_T_initial = -5 -top_T_amplitude = 5 -top_T_slope = -0.5/86400 #degree C/sec - -# Information about ocean cooling -bottom_T_initial = 0 -bottom_T_slope = -0.5/86400 #degree C/sec - -# Information about time steps -dt = 1000 -tf = 864000 -time = collect(0:dt:tf) - -# Calculate BCs -top_T_BC=top_T_slope*time.+top_T_amplitude*sin.((2*pi*time)/86400).+top_T_initial -bottom_T_BC=bottom_T_slope*time.+bottom_T_initial - -# Plot boundary conditions -using Plots -plot(time, [top_T_BC bottom_T_BC], title="Boundary Conditions", label=["Atmosphere Temp." "Ocean Temp."], linewidth=3, xlabel="Time (s)", ylabel="Temperature (C)")