Skip to content

Commit

Permalink
Further refinements for passive tracewr
Browse files Browse the repository at this point in the history
  • Loading branch information
glwagner committed Jun 5, 2024
1 parent 1cfc297 commit 2a8ed01
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 87 deletions.
146 changes: 78 additions & 68 deletions idealized/run_lesbrary_simulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ using LESbrary.IdealizedExperiments: seventy_two_hour_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
Expand All @@ -35,90 +36,99 @@ using LESbrary.IdealizedExperiments: seventy_two_hour_suite_parameters
architecture = GPU()
#size = (32, 32, 32)
#size = (64, 64, 64)
size = (128, 128, 128)
#size = (256, 256, 256)
#size = (128, 128, 128)
size = (256, 256, 256)
#size = (256, 256, 384)
# case = :strong_wind
snapshot_time_interval = 10minute
data_directory = "." #/home/greg/Projects/LESbrary.jl/data"

cases = [
:strong_wind_and_sunny,
#:strong_wind_and_sunny,
#:free_convection,
#:strong_wind_no_rotation,
#:strong_wind,
:free_convection,
#:weak_wind_strong_cooling,
#:med_wind_med_cooling,
#:strong_wind_weak_cooling,
:strong_wind_no_rotation
:strong_wind_weak_cooling,
]

suites = [six_hour_suite_parameters,
twelve_hour_suite_parameters,
twenty_four_hour_suite_parameters,
forty_eight_hour_suite_parameters,
seventy_two_hour_suite_parameters]
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 = 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 case in cases
suite_parameters = deepcopy(suite[case])
name = suite_parameters[:name]
suite_parameters[:name] = name * "_with_tracer"
for suite in suites
for case in cases

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

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 the case 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)
=#
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

18 changes: 9 additions & 9 deletions src/IdealizedExperiments/IdealizedExperiments.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ six_hour_suite_parameters = Dict{Symbol, Any}(
: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 => -5e-7, :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] = 30minutes
set[:tracer_forcing_timescale] = 15minutes
end

twelve_hour_suite_parameters = Dict{Symbol, Any}(
Expand All @@ -45,7 +45,7 @@ for (name, set) in twelve_hour_suite_parameters
set[:name] = string(name)
set[:stop_time] = 12hours
set[:stokes_drift] = true
set[:tracer_forcing_timescale] = 1hours
set[:tracer_forcing_timescale] = 30minutes
end

twenty_four_hour_suite_parameters = Dict{Symbol, Any}(
Expand All @@ -55,14 +55,14 @@ twenty_four_hour_suite_parameters = Dict{Symbol, Any}(
: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 => -5e-7, :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
set[:tracer_forcing_timescale] = 2hours
set[:tracer_forcing_timescale] = 1hours
end

forty_eight_hour_suite_parameters = Dict{Symbol, Any}(
Expand All @@ -72,14 +72,14 @@ forty_eight_hour_suite_parameters = Dict{Symbol, Any}(
: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.4e-4, :penetrating_buoyancy_flux => -5e-7, :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] = 4hours
set[:tracer_forcing_timescale] = 2hours
end

seventy_two_hour_suite_parameters = Dict{Symbol, Any}(
Expand All @@ -89,14 +89,14 @@ seventy_two_hour_suite_parameters = Dict{Symbol, Any}(
: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.5e-4, :penetrating_buoyancy_flux => -5e-7, :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] = 8hours
set[:tracer_forcing_timescale] = 4hours
end

end # module
Expand Down
29 changes: 19 additions & 10 deletions src/IdealizedExperiments/three_layer_constant_fluxes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,18 @@ function three_layer_constant_fluxes_simulation(;
b_deep = b_transition + (z_deep - z_transition) * N²_thermocline

# Passive tracer parameters
λ = 4.0
λ = 8
μ⁺ = 1 / tracer_forcing_timescale
μ₀ = (2π) * λ / grid.Lz * μ⁺ / 2
μ∞ = (2π) * λ / grid.Lz * μ⁺
c_forcing = Forcing(passive_tracer_forcing, parameters=(z₀=-48.0, λ=λ, μ⁺=μ⁺, μ⁻=μ∞))

# Sponge layer for u, v, w, and T
μ⁻ = (2π) * λ / grid.Lz * μ⁺
z₀ = -96
c_forcing_func(x, y, z) = μ⁺ * exp(-(z - z₀)^2 / (2 * λ^2)) - μ⁻
c_forcing_field = CenterField(grid)
set!(c_forcing_field, c_forcing_func)
c_forcing = Forcing(c_forcing_field)

#c_forcing = Forcing(passive_tracer_forcing, parameters=(z₀=-64.0, λ=λ, μ⁺=μ⁺, μ⁻=μ∞))

# Sponge layer for u, v, w, and b
gaussian_mask = GaussianMask{:z}(center=-grid.Lz, width=grid.Lz/10)
u_sponge = v_sponge = w_sponge = Relaxation(rate=4/hour, mask=gaussian_mask)

Expand Down Expand Up @@ -215,10 +220,11 @@ function three_layer_constant_fluxes_simulation(;
tracers = passive_tracers ? (:b, :c) : :b

if explicit_closure
Nz = Base.size(grid, 3)
Δz = CUDA.@allowscalar zspacing(1, 1, Nz, grid, ce, ce, ce)
C = SurfaceEnhancedModelConstant(Δz)
closure = AnisotropicMinimumDissipation(; C)
# Nz = Base.size(grid, 3)
# Δz = CUDA.@allowscalar zspacing(1, 1, Nz, grid, ce, ce, ce)
# C = SurfaceEnhancedModelConstant(Δz)
# closure = AnisotropicMinimumDissipation(; C)
closure = SmagorinskyLilly()
advection = CenteredSecondOrder()
else
closure = nothing
Expand Down Expand Up @@ -359,6 +365,9 @@ function three_layer_constant_fluxes_simulation(;
global_attributes[:penetrating_buoyancy_flux] = penetrating_buoyancy_flux
global_attributes[:momentum_flux] = τˣ
global_attributes[:coriolis_parameter] = f
global_attributes[:tracer_forcing_timescale] = tracer_forcing_timescale
global_attributes[:tracer_forcing_width] = λ
global_attributes[:tracer_forcing_depth] = -z₀
global_attributes[:boundary_condition_b_top] = Jᵇ
global_attributes[:boundary_condition_b_bottom] = N²_deep
global_attributes[:boundary_condition_u_top] = τˣ
Expand Down

0 comments on commit 2a8ed01

Please sign in to comment.