Skip to content

Commit

Permalink
Merge pull request #142 from CliMA/glw/weno-9
Browse files Browse the repository at this point in the history
Update three layer simulations to use WENO(order=9) and no SGS scheme
  • Loading branch information
glwagner authored Nov 9, 2024
2 parents 145b959 + 9f02cd0 commit e805aa1
Show file tree
Hide file tree
Showing 8 changed files with 1,024 additions and 482 deletions.
955 changes: 685 additions & 270 deletions Manifest.toml

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
authors = ["Climate Modeling Alliance and contributors"]
name = "LESbrary"
uuid = "0d21a966-bb61-11e9-3e8e-8da3363c58dd"
authors = ["Climate Modeling Alliance and contributors"]
version = "0.1.0"

[compat]
julia = "^1.6"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
Expand All @@ -25,10 +28,8 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[compat]
julia = "^1.6"

[extras]
CUDA_Runtime_jll = "76a88914-d11a-5bdc-97e0-2f5a05c973a2"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
117 changes: 103 additions & 14 deletions idealized/run_lesbrary_simulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ using Oceananigans
using Oceananigans.Units

using LESbrary.IdealizedExperiments: three_layer_constant_fluxes_simulation
using LESbrary.IdealizedExperiments: two_day_suite_parameters
using LESbrary.IdealizedExperiments: four_day_suite_parameters
using LESbrary.IdealizedExperiments: six_day_suite_parameters
using LESbrary.IdealizedExperiments: forty_eight_hour_suite_parameters
using LESbrary.IdealizedExperiments: twenty_four_hour_suite_parameters
using LESbrary.IdealizedExperiments: twelve_hour_suite_parameters
using LESbrary.IdealizedExperiments: six_hour_suite_parameters
using LESbrary.IdealizedExperiments: seventy_two_hour_suite_parameters

# LESbrary parameters
# ===================
Expand All @@ -16,30 +18,117 @@ using LESbrary.IdealizedExperiments: six_day_suite_parameters
# The strength of the forcing is tuned roughly so that the boundary layer deepens to roughly
# 128 meters, half the depth of a 256 meter domain.
#
# Each suite has five cases:
# Each suite has seven cases:
#
# * :free_convection
# * :weak_wind_strong_cooling
# * :med_wind_med_cooling
# * :strong_wind_weak_cooling
# * :strong_wind
# * :strong_wind_no_rotation
# * :strong_wind_and_sunny
#
# In addition to selecting the architecture, size, and case to run, we can also tweak
# certain parameters. Below we change the "snapshot_time_interval" (the interval over
# which slices of the simulation is saved) from the default 2 minutes to 1 minute
# (to make pretty movies), and we turn passive tracers off.
# (to make pretty movies).

architecture = GPU()
#size = (32, 32, 32)
#size = (64, 64, 64)
#size = (128, 128, 128)
size = (256, 256, 256)
case = :strong_wind
snapshot_time_interval = 1minute
passive_tracers = false
#size = (256, 256, 384)
# case = :strong_wind
snapshot_time_interval = 10minute
data_directory = "." #/home/greg/Projects/LESbrary.jl/data"

simulation = three_layer_constant_fluxes_simulation(; architecture,
size,
passive_tracers,
snapshot_time_interval,
two_day_suite_parameters[case]...)
cases = [
#:strong_wind_and_sunny,
#:free_convection,
#:strong_wind_no_rotation,
#:strong_wind,
#:weak_wind_strong_cooling,
#:med_wind_med_cooling,
:strong_wind_weak_cooling,
]

run!(simulation)
suites = [
#six_hour_suite_parameters,
#twelve_hour_suite_parameters,
#twenty_four_hour_suite_parameters,
forty_eight_hour_suite_parameters,
#seventy_two_hour_suite_parameters
]

#suite = six_hour_suite_parameters
#suite = twelve_hour_suite_parameters
#suite = twenty_four_hour_suite_parameters
#suite = forty_eight_hour_suite_parameters
#suite = seventy_two_hour_suite_parameters

for suite in suites
for case in cases

#####
##### To run the typical case
#####

suite_parameters = deepcopy(suite[case])
name = suite_parameters[:name]
suite_parameters[:name] = name * "_with_tracer"

simulation = three_layer_constant_fluxes_simulation(; architecture,
size,
checkpoint = false,
pickup = false,
passive_tracers = true,
data_directory,
snapshot_time_interval,
suite_parameters...)
run!(simulation)

#####
##### To run with no Stokes drift
#####

#=
suite_parameters = deepcopy(suite[case])
suite_parameters[:stokes_drift] = false
name = suite_parameters[:name]
suite_parameters[:name] = name * "_no_stokes"
simulation = three_layer_constant_fluxes_simulation(; architecture,
size,
checkpoint = false,
pickup = false,
passive_tracers = true,
data_directory,
snapshot_time_interval,
suite_parameters...)
run!(simulation)
=#

#=
#####
##### To run with a subgrid closure
#####
suite_parameters = deepcopy(suite[case])
suite_parameters[:explicit_closure] = true
name = suite_parameters[:name]
suite_parameters[:name] = name * "_explicit_closure"
simulation = three_layer_constant_fluxes_simulation(; architecture,
size,
checkpoint = false,
pickup = false,
passive_tracers = true,
data_directory,
snapshot_time_interval,
suite_parameters...)
run!(simulation)
=#
end
end

101 changes: 41 additions & 60 deletions src/IdealizedExperiments/IdealizedExperiments.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,108 +15,89 @@ include("constant_flux_stokes_drift.jl")
include("three_layer_constant_fluxes.jl")

six_hour_suite_parameters = Dict{Symbol, Any}(
:free_convection => Dict{Symbol, Any}(:momentum_flux => 0.0, :buoyancy_flux => 9.6e-7, :f => 1e-4),
:weak_wind_strong_cooling => Dict{Symbol, Any}(:momentum_flux => -5.0e-4, :buoyancy_flux => 8.0e-7, :f => 1e-4),
:med_wind_med_cooling => Dict{Symbol, Any}(:momentum_flux => -8.0e-4, :buoyancy_flux => 6.4e-7, :f => 1e-4),
:strong_wind_weak_cooling => Dict{Symbol, Any}(:momentum_flux => -1.2e-3, :buoyancy_flux => 4.0e-7, :f => 1e-4),
:strong_wind => Dict{Symbol, Any}(:momentum_flux => -1.4e-3, :buoyancy_flux => 0.0, :f => 1e-4),
:strong_wind_no_rotation => Dict{Symbol, Any}(:momentum_flux => -1.1e-3, :buoyancy_flux => 0.0, :f => 0.0),
:free_convection => Dict{Symbol, Any}(:momentum_flux => 0.0, :buoyancy_flux => 9.6e-7, :f => 1e-4),
:weak_wind_strong_cooling => Dict{Symbol, Any}(:momentum_flux => -5.0e-4, :buoyancy_flux => 8.0e-7, :f => 1e-4),
:med_wind_med_cooling => Dict{Symbol, Any}(:momentum_flux => -8.0e-4, :buoyancy_flux => 6.4e-7, :f => 1e-4),
:strong_wind_weak_cooling => Dict{Symbol, Any}(:momentum_flux => -1.2e-3, :buoyancy_flux => 4.0e-7, :f => 1e-4),
:strong_wind => Dict{Symbol, Any}(:momentum_flux => -1.4e-3, :buoyancy_flux => 0.0, :f => 1e-4),
:strong_wind_no_rotation => Dict{Symbol, Any}(:momentum_flux => -1.1e-3, :buoyancy_flux => 0.0, :f => 0.0),
:strong_wind_and_sunny => Dict{Symbol, Any}(:momentum_flux => -1.5e-3, :penetrating_buoyancy_flux => -6e-7, :f => 0.0),
)

for (name, set) in six_hour_suite_parameters
set[:name] = string(name)
set[:stop_time] = 6hours
set[:stokes_drift] = true
set[:tracer_forcing_timescale] = 15minutes
end

twelve_hour_suite_parameters = Dict{Symbol, Any}(
:free_convection => Dict{Symbol, Any}(:momentum_flux => 0.0, :buoyancy_flux => 4.8e-7, :f => 1e-4),
:weak_wind_strong_cooling => Dict{Symbol, Any}(:momentum_flux => -4.0e-4, :buoyancy_flux => 4.0e-7, :f => 1e-4),
:med_wind_med_cooling => Dict{Symbol, Any}(:momentum_flux => -6.0e-4, :buoyancy_flux => 3.2e-7, :f => 1e-4),
:strong_wind_weak_cooling => Dict{Symbol, Any}(:momentum_flux => -8.0e-4, :buoyancy_flux => 2.0e-7, :f => 1e-4),
:strong_wind => Dict{Symbol, Any}(:momentum_flux => -9.0e-4, :buoyancy_flux => 0.0, :f => 1e-4),
:strong_wind_no_rotation => Dict{Symbol, Any}(:momentum_flux => -6.0e-4, :buoyancy_flux => 0.0, :f => 0.0),
:free_convection => Dict{Symbol, Any}(:momentum_flux => 0.0, :buoyancy_flux => 4.8e-7, :f => 1e-4),
:weak_wind_strong_cooling => Dict{Symbol, Any}(:momentum_flux => -4.0e-4, :buoyancy_flux => 4.0e-7, :f => 1e-4),
:med_wind_med_cooling => Dict{Symbol, Any}(:momentum_flux => -6.0e-4, :buoyancy_flux => 3.2e-7, :f => 1e-4),
:strong_wind_weak_cooling => Dict{Symbol, Any}(:momentum_flux => -8.0e-4, :buoyancy_flux => 2.0e-7, :f => 1e-4),
:strong_wind => Dict{Symbol, Any}(:momentum_flux => -9.0e-4, :buoyancy_flux => 0.0, :f => 1e-4),
:strong_wind_no_rotation => Dict{Symbol, Any}(:momentum_flux => -6.0e-4, :buoyancy_flux => 0.0, :f => 0.0),
:strong_wind_and_sunny => Dict{Symbol, Any}(:momentum_flux => -9.0e-4, :penetrating_buoyancy_flux => -5e-7, :f => 0.0),
)

for (name, set) in twelve_hour_suite_parameters
set[:name] = string(name)
set[:stop_time] = 12hours
set[:stokes_drift] = true
end

eighteen_hour_suite_parameters = Dict{Symbol, Any}(
:free_convection => Dict{Symbol, Any}(:momentum_flux => 0.0, :buoyancy_flux => 3.6e-7, :f => 1e-4),
:weak_wind_strong_cooling => Dict{Symbol, Any}(:momentum_flux => -3.5e-4, :buoyancy_flux => 3.0e-7, :f => 1e-4),
:med_wind_med_cooling => Dict{Symbol, Any}(:momentum_flux => -5.0e-4, :buoyancy_flux => 2.4e-7, :f => 1e-4),
:strong_wind_weak_cooling => Dict{Symbol, Any}(:momentum_flux => -7.0e-4, :buoyancy_flux => 1.5e-7, :f => 1e-4),
:strong_wind => Dict{Symbol, Any}(:momentum_flux => -8.0e-4, :buoyancy_flux => 0.0, :f => 1e-4),
:strong_wind_no_rotation => Dict{Symbol, Any}(:momentum_flux => -4.2e-4, :buoyancy_flux => 0.0, :f => 0.0),
)

for (name, set) in eighteen_hour_suite_parameters
set[:name] = string(name)
set[:stop_time] = 18hours
set[:stokes_drift] = true
set[:tracer_forcing_timescale] = 30minutes
end

twenty_four_hour_suite_parameters = Dict{Symbol, Any}(
:free_convection => Dict{Symbol, Any}(:momentum_flux => 0.0, :buoyancy_flux => 2.4e-7, :f => 1e-4),
:weak_wind_strong_cooling => Dict{Symbol, Any}(:momentum_flux => -3.0e-4, :buoyancy_flux => 2.0e-7, :f => 1e-4),
:med_wind_med_cooling => Dict{Symbol, Any}(:momentum_flux => -4.5e-4, :buoyancy_flux => 1.6e-7, :f => 1e-4),
:strong_wind_weak_cooling => Dict{Symbol, Any}(:momentum_flux => -5.9e-4, :buoyancy_flux => 1.0e-7, :f => 1e-4),
:strong_wind => Dict{Symbol, Any}(:momentum_flux => -6.8e-4, :buoyancy_flux => 0.0, :f => 1e-4),
:strong_wind_no_rotation => Dict{Symbol, Any}(:momentum_flux => -3.0e-4, :buoyancy_flux => 0.0, :f => 0.0),
:free_convection => Dict{Symbol, Any}(:momentum_flux => 0.0, :buoyancy_flux => 2.4e-7, :f => 1e-4),
:weak_wind_strong_cooling => Dict{Symbol, Any}(:momentum_flux => -3.0e-4, :buoyancy_flux => 2.0e-7, :f => 1e-4),
:med_wind_med_cooling => Dict{Symbol, Any}(:momentum_flux => -4.5e-4, :buoyancy_flux => 1.6e-7, :f => 1e-4),
:strong_wind_weak_cooling => Dict{Symbol, Any}(:momentum_flux => -5.9e-4, :buoyancy_flux => 1.0e-7, :f => 1e-4),
:strong_wind => Dict{Symbol, Any}(:momentum_flux => -6.8e-4, :buoyancy_flux => 0.0, :f => 1e-4),
:strong_wind_no_rotation => Dict{Symbol, Any}(:momentum_flux => -3.0e-4, :buoyancy_flux => 0.0, :f => 0.0),
:strong_wind_and_sunny => Dict{Symbol, Any}(:momentum_flux => -4.5e-4, :penetrating_buoyancy_flux => -3e-7, :f => 0.0),
)

for (name, set) in twenty_four_hour_suite_parameters
set[:name] = string(name)
set[:stop_time] = 24hours
set[:stokes_drift] = true
end

thirty_six_hour_suite_parameters = Dict{Symbol, Any}(
:free_convection => Dict{Symbol, Any}(:momentum_flux => 0.0, :buoyancy_flux => 1.8e-7, :f => 1e-4),
:weak_wind_strong_cooling => Dict{Symbol, Any}(:momentum_flux => -2.5e-4, :buoyancy_flux => 1.5e-7, :f => 1e-4),
:med_wind_med_cooling => Dict{Symbol, Any}(:momentum_flux => -3.9e-4, :buoyancy_flux => 1.2e-7, :f => 1e-4),
:strong_wind_weak_cooling => Dict{Symbol, Any}(:momentum_flux => -4.8e-4, :buoyancy_flux => 7.5e-8, :f => 1e-4),
:strong_wind => Dict{Symbol, Any}(:momentum_flux => -5.6e-4, :buoyancy_flux => 0.0, :f => 1e-4),
:strong_wind_no_rotation => Dict{Symbol, Any}(:momentum_flux => -2.3e-4, :buoyancy_flux => 0.0, :f => 0.0),
)

for (name, set) in thirty_six_hour_suite_parameters
set[:name] = string(name)
set[:stop_time] = 36hours
set[:stokes_drift] = true
set[:tracer_forcing_timescale] = 1hours
end

forty_eight_hour_suite_parameters = Dict{Symbol, Any}(
:free_convection => Dict{Symbol, Any}(:momentum_flux => 0.0, :buoyancy_flux => 1.2e-7, :f => 1e-4),
:weak_wind_strong_cooling => Dict{Symbol, Any}(:momentum_flux => -2.0e-4, :buoyancy_flux => 1.0e-7, :f => 1e-4),
:med_wind_med_cooling => Dict{Symbol, Any}(:momentum_flux => -3.4e-4, :buoyancy_flux => 8.0e-8, :f => 1e-4),
:strong_wind_weak_cooling => Dict{Symbol, Any}(:momentum_flux => -3.8e-4, :buoyancy_flux => 5.0e-8, :f => 1e-4),
:strong_wind => Dict{Symbol, Any}(:momentum_flux => -4.5e-4, :buoyancy_flux => 0.0, :f => 1e-4),
:strong_wind_no_rotation => Dict{Symbol, Any}(:momentum_flux => -1.6e-4, :buoyancy_flux => 0.0, :f => 0.0),
:free_convection => Dict{Symbol, Any}(:momentum_flux => 0.0, :buoyancy_flux => 1.2e-7, :f => 1e-4),
:weak_wind_strong_cooling => Dict{Symbol, Any}(:momentum_flux => -2.0e-4, :buoyancy_flux => 1.0e-7, :f => 1e-4),
:med_wind_med_cooling => Dict{Symbol, Any}(:momentum_flux => -3.4e-4, :buoyancy_flux => 8.0e-8, :f => 1e-4),
:strong_wind_weak_cooling => Dict{Symbol, Any}(:momentum_flux => -3.8e-4, :buoyancy_flux => 5.0e-8, :f => 1e-4),
:strong_wind => Dict{Symbol, Any}(:momentum_flux => -4.5e-4, :buoyancy_flux => 0.0, :f => 1e-4),
:strong_wind_no_rotation => Dict{Symbol, Any}(:momentum_flux => -1.6e-4, :buoyancy_flux => 0.0, :f => 0.0),
:strong_wind_and_sunny => Dict{Symbol, Any}(:momentum_flux => -2.0e-4, :penetrating_buoyancy_flux => -1e-7, :f => 0.0),
)

for (name, set) in forty_eight_hour_suite_parameters
set[:name] = string(name)
set[:stop_time] = 48hours
set[:stokes_drift] = true
set[:tracer_forcing_timescale] = 2hours
end

seventy_two_hour_suite_parameters = Dict{Symbol, Any}(
:free_convection => Dict{Symbol, Any}(:momentum_flux => 0.0, :buoyancy_flux => 8.7e-8, :f => 1e-4),
:weak_wind_strong_cooling => Dict{Symbol, Any}(:momentum_flux => -1.8e-4, :buoyancy_flux => 7.5e-8, :f => 1e-4),
:med_wind_med_cooling => Dict{Symbol, Any}(:momentum_flux => -2.9e-4, :buoyancy_flux => 6.0e-8, :f => 1e-4),
:strong_wind_weak_cooling => Dict{Symbol, Any}(:momentum_flux => -3.4e-4, :buoyancy_flux => 3.8e-8, :f => 1e-4),
:strong_wind => Dict{Symbol, Any}(:momentum_flux => -4.1e-4, :buoyancy_flux => 0.0, :f => 1e-4),
:strong_wind_no_rotation => Dict{Symbol, Any}(:momentum_flux => -1.1e-4, :buoyancy_flux => 0.0, :f => 0.0),
:free_convection => Dict{Symbol, Any}(:momentum_flux => 0.0, :buoyancy_flux => 8.7e-8, :f => 1e-4),
:weak_wind_strong_cooling => Dict{Symbol, Any}(:momentum_flux => -1.8e-4, :buoyancy_flux => 7.5e-8, :f => 1e-4),
:med_wind_med_cooling => Dict{Symbol, Any}(:momentum_flux => -2.9e-4, :buoyancy_flux => 6.0e-8, :f => 1e-4),
:strong_wind_weak_cooling => Dict{Symbol, Any}(:momentum_flux => -3.4e-4, :buoyancy_flux => 3.8e-8, :f => 1e-4),
:strong_wind => Dict{Symbol, Any}(:momentum_flux => -4.1e-4, :buoyancy_flux => 0.0, :f => 1e-4),
:strong_wind_no_rotation => Dict{Symbol, Any}(:momentum_flux => -1.1e-4, :buoyancy_flux => 0.0, :f => 0.0),
:strong_wind_and_sunny => Dict{Symbol, Any}(:momentum_flux => -1.3e-4, :penetrating_buoyancy_flux => -5e-8, :f => 0.0),
)

for (name, set) in seventy_two_hour_suite_parameters
set[:name] = string(name)
set[:stop_time] = 72hours
set[:stokes_drift] = true
set[:tracer_forcing_timescale] = 4hours
end

end # module

9 changes: 4 additions & 5 deletions src/IdealizedExperiments/constant_flux_stokes_drift.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ using CUDA
using SpecialFunctions
using Adapt

import Oceananigans.StokesDrift: AbstractStokesDrift
import Oceananigans.StokesDrift: ∂t_uˢ, ∂t_vˢ, ∂t_wˢ,
x_curl_Uˢ_cross_U,
y_curl_Uˢ_cross_U,
z_curl_Uˢ_cross_U
import Oceananigans.StokesDrifts: ∂t_uˢ, ∂t_vˢ, ∂t_wˢ,
x_curl_Uˢ_cross_U,
y_curl_Uˢ_cross_U,
z_curl_Uˢ_cross_U

struct ConstantFluxStokesDrift{T, K, U, UZ}
Cᵝ :: T # 1, Toba's constant
Expand Down
Loading

0 comments on commit e805aa1

Please sign in to comment.