From 2a8ed01ca603a19cac2a48441d3af27b5fd6de53 Mon Sep 17 00:00:00 2001 From: Gregory Wagner Date: Wed, 5 Jun 2024 01:57:15 -0400 Subject: [PATCH] Further refinements for passive tracewr --- idealized/run_lesbrary_simulation.jl | 146 ++++++++++-------- .../IdealizedExperiments.jl | 18 +-- .../three_layer_constant_fluxes.jl | 29 ++-- 3 files changed, 106 insertions(+), 87 deletions(-) diff --git a/idealized/run_lesbrary_simulation.jl b/idealized/run_lesbrary_simulation.jl index d2f587a..43cce5f 100644 --- a/idealized/run_lesbrary_simulation.jl +++ b/idealized/run_lesbrary_simulation.jl @@ -18,7 +18,7 @@ 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 @@ -26,6 +26,7 @@ using LESbrary.IdealizedExperiments: seventy_two_hour_suite_parameters # * :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 @@ -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 diff --git a/src/IdealizedExperiments/IdealizedExperiments.jl b/src/IdealizedExperiments/IdealizedExperiments.jl index 5d17952..6347fa8 100644 --- a/src/IdealizedExperiments/IdealizedExperiments.jl +++ b/src/IdealizedExperiments/IdealizedExperiments.jl @@ -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}( @@ -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}( @@ -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}( @@ -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}( @@ -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 diff --git a/src/IdealizedExperiments/three_layer_constant_fluxes.jl b/src/IdealizedExperiments/three_layer_constant_fluxes.jl index 014ddb6..74b05bd 100644 --- a/src/IdealizedExperiments/three_layer_constant_fluxes.jl +++ b/src/IdealizedExperiments/three_layer_constant_fluxes.jl @@ -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) @@ -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 @@ -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] = τˣ