Skip to content

Commit 45519fb

Browse files
Merge pull request #2937 from CliMA/as/deepatmos-init
Deep atmosphere init for baroclinic wave problem
2 parents e3f8fcd + d59924f commit 45519fb

File tree

6 files changed

+142
-21
lines changed

6 files changed

+142
-21
lines changed

config/default_configs/default_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ log_progress:
278278
help: "Log simulation progress, including wall-time estimates"
279279
value: true
280280
deep_atmosphere:
281-
help: "Do not assume that the atmosphere is shallow, where the vertical columns are cylindrical"
281+
help: "If true, use deep atmosphere equations and metric terms, otherwise assume columns are cylindrical (shallow atmosphere) [`true`, `false` (default)]"
282282
value: false
283283
restart_file:
284284
help: "Path to HDF5 file to use as simulation starting point"
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
dt_save_state_to_disk: "2days"
22
initial_condition: "DryBaroclinicWave"
3+
deep_atmosphere: true
34
dt: "400secs"
45
t_end: "10days"
56
job_id: "sphere_baroclinic_wave_rhoe"
67
diagnostics:
7-
- short_name: [pfull, wa, va, rv, ke]
8+
- short_name: [pfull, ua, wa, va, rv, ta, ke]
89
period: 1days
9-
- short_name: [pfull, wa, va, rv]
10+
- short_name: [pfull, ua, wa, va, rv, ta, ke]
1011
period: 1days
1112
writer: h5

post_processing/ci_plots.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,10 @@ function make_plots(
610610
)
611611
end
612612

613-
DryBaroWavePlots = Union{Val{:sphere_baroclinic_wave_rhoe}}
613+
DryBaroWavePlots = Union{
614+
Val{:sphere_baroclinic_wave_rhoe},
615+
Val{:sphere_baroclinic_wave_rhoe_deepatmos},
616+
}
614617

615618
function make_plots(::DryBaroWavePlots, output_paths::Vector{<:AbstractString})
616619
simdirs = SimDir.(output_paths)
@@ -665,6 +668,7 @@ end
665668

666669
function make_plots(
667670
::Val{:sphere_baroclinic_wave_rhoe_equilmoist},
671+
::Val{:sphere_baroclinic_wave_rhoe_equilmoist_deepatmos},
668672
output_paths::Vector{<:AbstractString},
669673
)
670674
simdirs = SimDir.(output_paths)

regression_tests/ref_counter.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
159
1+
160
22

3+
# 160:
4+
# - Introduces initial conditions for the baroclinic-wave
5+
# test case in a deep-atmosphere configuration. Modifies
6+
# existing config to use `deep_atmosphere` mode.
7+
#
38
# 159:
49
# - Changed the boundary condition of edmf updraft properties
510
# to be dependent on the surface area

src/initial_conditions/initial_conditions.jl

Lines changed: 121 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ end
352352
## Baroclinic Wave
353353
##
354354

355-
function baroclinic_wave_values(z, ϕ, λ, params, perturb)
355+
function shallow_atmos_baroclinic_wave_values(z, ϕ, λ, params, perturb)
356356
FT = eltype(params)
357357
R_d = CAP.R_d(params)
358358
MSLP = CAP.MSLP(params)
@@ -418,7 +418,80 @@ function baroclinic_wave_values(z, ϕ, λ, params, perturb)
418418
return (; T_v, p, u, v)
419419
end
420420

421-
function moist_baroclinic_wave_values(z, ϕ, λ, params, perturb)
421+
function deep_atmos_baroclinic_wave_values(z, ϕ, λ, params, perturb)
422+
FT = eltype(params)
423+
R_d = CAP.R_d(params)
424+
MSLP = CAP.MSLP(params)
425+
grav = CAP.grav(params)
426+
Ω = CAP.Omega(params)
427+
R = CAP.planet_radius(params)
428+
429+
# Constants from paper (See Table 1. in Ullrich et al (2014))
430+
k = 3 # Power for temperature field
431+
T_e = FT(310) # Surface temperature at the equator
432+
T_p = FT(240) # Surface temperature at the pole
433+
T_0 = FT(0.5) * (T_e + T_p)
434+
Γ = FT(0.005) # Lapse rate
435+
A = 1 / Γ # (Eq 16)
436+
B = (T_0 - T_p) / T_0 / T_p # (Eq 17)
437+
C = FT(0.5) * (k + 2) * (T_e - T_p) / T_e / T_p # (Eq 17)
438+
b = 2 # half-width parameter
439+
H = R_d * T_0 / grav
440+
z_t = FT(15e3) # Top of perturbation domain
441+
λ_c = FT(20) # Geographical location (λ dim) of perturbation center
442+
ϕ_c = FT(40) # Geographical location (ϕ dim) of perturbation center
443+
d_0 = R / 6
444+
V_p = FT(1)
445+
446+
# Virtual temperature and pressure
447+
τ̃₁ =
448+
A * Γ / T_0 * exp* z / T_0) +
449+
B * (1 - 2 * (z / b / H)^2) * exp(-(z / b / H)^2)# (Eq 14)
450+
τ̃₂ = C * (1 - 2 * (z / b / H)^2) * exp(-(z / b / H)^2) # (Eq 15)
451+
∫τ̃₁ = (A * (exp* z / T_0) - 1)) + B * z * exp(-(z / b / H)^2) # (Eq A1)
452+
∫τ̃₂ = C * z * exp(-(z / b / H)^2) # (Eq A2)
453+
I_T =
454+
((z + R) / R * cosd(ϕ))^k -
455+
(k / (k + 2)) * ((z + R) / R * cosd(ϕ))^(k + 2)
456+
T_v = FT((R / (z + R))^2 * (τ̃₁ - τ̃₂ * I_T)^(-1)) # (Eq A3)
457+
p = FT(MSLP * exp(-grav / R_d * (∫τ̃₁ - ∫τ̃₂ * I_T))) # (Eq A6)
458+
# Horizontal velocity
459+
U =
460+
grav / R *
461+
k *
462+
T_v *
463+
∫τ̃₂ *
464+
(((z + R) * cosd(ϕ) / R)^(k - 1) - ((R + z) * cosd(ϕ) / R)^(k + 1)) # wind-proxy (Eq A4)
465+
u = FT(
466+
-Ω * (R + z) * cosd(ϕ) +
467+
sqrt((Ω * (R + z) * cosd(ϕ))^2 + (R + z) * cosd(ϕ) * U),
468+
)
469+
v = FT(0)
470+
if perturb
471+
F_z = (1 - 3 * (z / z_t)^2 + 2 * (z / z_t)^3) * (z z_t)
472+
r = R * acos(sind(ϕ_c) * sind(ϕ) + cosd(ϕ_c) * cosd(ϕ) * cosd- λ_c))
473+
c3 = cos* r / 2 / d_0)^3
474+
s1 = sin* r / 2 / d_0)
475+
cond = (0 < r < d_0) * (r != R * pi)
476+
u +=
477+
-16 * V_p / 3 / sqrt(FT(3)) *
478+
F_z *
479+
c3 *
480+
s1 *
481+
(-sind(ϕ_c) * cosd(ϕ) + cosd(ϕ_c) * sind(ϕ) * cosd- λ_c)) /
482+
sin(r / R) * cond
483+
v +=
484+
16 * V_p / 3 / sqrt(FT(3)) *
485+
F_z *
486+
c3 *
487+
s1 *
488+
cosd(ϕ_c) *
489+
sind- λ_c) / sin(r / R) * cond
490+
end
491+
return (; T_v, p, u, v)
492+
end
493+
494+
function moist_baroclinic_wave_values(z, ϕ, λ, params, perturb, deep_atmosphere)
422495
FT = eltype(params)
423496
MSLP = CAP.MSLP(params)
424497

@@ -430,7 +503,14 @@ function moist_baroclinic_wave_values(z, ϕ, λ, params, perturb)
430503
ϕ_w = FT(40)
431504
ε = FT(0.608)
432505

433-
(; T_v, p, u, v) = baroclinic_wave_values(z, ϕ, λ, params, perturb)
506+
if deep_atmosphere
507+
(; p, T_v, u, v) =
508+
deep_atmos_baroclinic_wave_values(z, ϕ, λ, params, perturb)
509+
else
510+
(; p, T_v, u, v) =
511+
shallow_atmos_baroclinic_wave_values(z, ϕ, λ, params, perturb)
512+
end
513+
434514
q_tot =
435515
(p <= p_t) ? q_t : q_0 * exp(-/ ϕ_w)^4) * exp(-((p - MSLP) / p_w)^2)
436516
T = T_v / (1 + ε * q_tot) # This is the formula used in the paper.
@@ -442,21 +522,34 @@ function moist_baroclinic_wave_values(z, ϕ, λ, params, perturb)
442522
end
443523

444524
"""
445-
DryBaroclinicWave(; perturb = true)
525+
DryBaroclinicWave(; perturb = true, deep_atmosphere = false)
446526
447527
An `InitialCondition` with a dry baroclinic wave, and with an optional
448528
perturbation to the horizontal velocity.
449529
"""
450530
Base.@kwdef struct DryBaroclinicWave <: InitialCondition
451531
perturb::Bool = true
532+
deep_atmosphere::Bool = false
452533
end
453534

454535
function (initial_condition::DryBaroclinicWave)(params)
455-
(; perturb) = initial_condition
536+
(; perturb, deep_atmosphere) = initial_condition
456537
function local_state(local_geometry)
457538
thermo_params = CAP.thermodynamics_params(params)
458539
(; z, lat, long) = local_geometry.coordinates
459-
(; p, T_v, u, v) = baroclinic_wave_values(z, lat, long, params, perturb)
540+
if deep_atmosphere
541+
(; p, T_v, u, v) =
542+
deep_atmos_baroclinic_wave_values(z, lat, long, params, perturb)
543+
else
544+
(; p, T_v, u, v) = shallow_atmos_baroclinic_wave_values(
545+
z,
546+
lat,
547+
long,
548+
params,
549+
perturb,
550+
)
551+
end
552+
460553
return LocalState(;
461554
params,
462555
geometry = local_geometry,
@@ -468,22 +561,29 @@ function (initial_condition::DryBaroclinicWave)(params)
468561
end
469562

470563
"""
471-
MoistBaroclinicWave(; perturb = true)
564+
MoistBaroclinicWave(; perturb = true, deep_atmosphere = false)
472565
473566
An `InitialCondition` with a moist baroclinic wave, and with an optional
474567
perturbation to the horizontal velocity.
475568
"""
476569
Base.@kwdef struct MoistBaroclinicWave <: InitialCondition
477570
perturb::Bool = true
571+
deep_atmosphere::Bool = false
478572
end
479573

480574
function (initial_condition::MoistBaroclinicWave)(params)
481-
(; perturb) = initial_condition
575+
(; perturb, deep_atmosphere) = initial_condition
482576
function local_state(local_geometry)
483577
thermo_params = CAP.thermodynamics_params(params)
484578
(; z, lat, long) = local_geometry.coordinates
485-
(; p, T, q_tot, u, v) =
486-
moist_baroclinic_wave_values(z, lat, long, params, perturb)
579+
(; p, T, q_tot, u, v) = moist_baroclinic_wave_values(
580+
z,
581+
lat,
582+
long,
583+
params,
584+
perturb,
585+
deep_atmosphere,
586+
)
487587
return LocalState(;
488588
params,
489589
geometry = local_geometry,
@@ -495,23 +595,30 @@ function (initial_condition::MoistBaroclinicWave)(params)
495595
end
496596

497597
"""
498-
MoistBaroclinicWaveWithEDMF(; perturb = true)
598+
MoistBaroclinicWaveWithEDMF(; perturb = true, deep_atmosphere = false)
499599
500600
The same `InitialCondition` as `MoistBaroclinicWave`, except with an initial TKE
501601
of 0 and an initial draft area fraction of 0.2.
502602
"""
503603
Base.@kwdef struct MoistBaroclinicWaveWithEDMF <: InitialCondition
504604
perturb::Bool = true
605+
deep_atmosphere::Bool = false
505606
end
506607

507608
function (initial_condition::MoistBaroclinicWaveWithEDMF)(params)
508-
(; perturb) = initial_condition
609+
(; perturb, deep_atmosphere) = initial_condition
509610
function local_state(local_geometry)
510611
FT = eltype(params)
511612
thermo_params = CAP.thermodynamics_params(params)
512613
(; z, lat, long) = local_geometry.coordinates
513-
(; p, T, q_tot, u, v) =
514-
moist_baroclinic_wave_values(z, lat, long, params, perturb)
614+
(; p, T, q_tot, u, v) = moist_baroclinic_wave_values(
615+
z,
616+
lat,
617+
long,
618+
params,
619+
perturb,
620+
deep_atmosphere,
621+
)
515622
return LocalState(;
516623
params,
517624
geometry = local_geometry,

src/solver/type_getters.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,14 @@ function get_initial_condition(parsed_args)
318318
if parsed_args["initial_condition"] in [
319319
"DryBaroclinicWave",
320320
"MoistBaroclinicWave",
321-
"DecayingProfile",
322321
"MoistBaroclinicWaveWithEDMF",
323-
"MoistAdiabaticProfileEDMFX",
324322
]
323+
return getproperty(ICs, Symbol(parsed_args["initial_condition"]))(
324+
parsed_args["perturb_initstate"],
325+
parsed_args["deep_atmosphere"],
326+
)
327+
elseif parsed_args["initial_condition"] in
328+
["DecayingProfile", "MoistAdiabaticProfileEDMFX"]
325329
return getproperty(ICs, Symbol(parsed_args["initial_condition"]))(
326330
parsed_args["perturb_initstate"],
327331
)

0 commit comments

Comments
 (0)