Skip to content

Commit 95991d3

Browse files
committed
Add diagnostics output for NOGW tendencies
Enable diagnostics for non-orographic gravity wave (NOGW) by extending YAML configurations and adding relevant outputs.
1 parent 80826e5 commit 95991d3

File tree

5 files changed

+92
-2
lines changed

5 files changed

+92
-2
lines changed

config/model_configs/single_column_nonorographic_gravity_wave.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,9 @@ t_end: "1500secs"
44
config: "column"
55
hyperdiff: false
66
dt: "400secs"
7+
output_default_diagnostics: true
78
disable_surface_flux_tendency: true
89
non_orographic_gravity_wave: true
10+
# diagnostics:
11+
# - short_name: [ta, rhoa]
12+
# period: 400secs
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
t_end: "1500secs"
2-
dt: "400secs"
1+
t_end: "48hours"
2+
dt: "450secs"
33
disable_surface_flux_tendency: true
44
non_orographic_gravity_wave: true
5+
dt_nogw: "450secs"
6+
diagnostics:
7+
- short_name: [ta, thetaa, ua, va, wa, zg, utendnogw, vtendnogw]
8+
period: 1hours

src/diagnostics/Diagnostics.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ import ..EDOnlyEDMFX
4141
import ..PrognosticEDMFX
4242
import ..DiagnosticEDMFX
4343

44+
# gravitywave_models
45+
import ..NonOrographyGravityWave
46+
import ..OrographicGravityWave
47+
4448
# surface_model
4549
import ..PrognosticSurfaceTemperature
4650

src/diagnostics/diagnostic.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ include("core_diagnostics.jl")
9898
include("radiation_diagnostics.jl")
9999
include("edmfx_diagnostics.jl")
100100
include("tracer_diagnostics.jl")
101+
include("gravitywave_diagnostics.jl")
101102
include("conservation_diagnostics.jl")
102103

104+
103105
# Default diagnostics and higher level interfaces
104106
include("default_diagnostics.jl")
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# This file is included in diagnostics.jl
2+
3+
# Gravity-wave related diagnostics
4+
5+
###
6+
# Eastward Non-Orographic Gravity-Wave Tendency
7+
###
8+
compute_utendnogw!(out, state, cache, time) =
9+
compute_utendnogw!(out, state, cache, time, cache.atmos.non_orographic_gravity_wave)
10+
compute_utendnogw!(_, _, _, _, non_orographic_gravity_wave::T) where {T} =
11+
error_diagnostic_variable("utendnogw", non_orographic_gravity_wave)
12+
13+
function compute_utendnogw!(
14+
out,
15+
state,
16+
cache,
17+
time,
18+
::T,
19+
) where {T <: NonOrographyGravityWave}
20+
if isnothing(out)
21+
# u_waveforcing is not a field:
22+
# return Fields.array2field(
23+
# cache.non_orographic_gravity_wave.u_waveforcing,
24+
# axes(state.c),
25+
# )
26+
return copy(cache.non_orographic_gravity_wave.u_waveforcing)
27+
else
28+
out .= cache.non_orographic_gravity_wave.u_waveforcing
29+
end
30+
end
31+
32+
add_diagnostic_variable!(
33+
short_name = "utendnogw",
34+
long_name = "Eastward Acceleration Due to Non-Orographic Gravity Wave Drag",
35+
standard_name = "tendency_of_eastward_wind_due_to_nonorographic_gravity_wave_drag",
36+
units = "m s-2",
37+
comments = "Eastward Acceleration Due to Non-Orographic Gravity Wave Drag",
38+
compute! = compute_utendnogw!,
39+
)
40+
41+
42+
###
43+
# Northward Non-Orographic Gravity-Wave Tendency
44+
###
45+
compute_vtendnogw!(out, state, cache, time) =
46+
compute_vtendnogw!(out, state, cache, time, cache.atmos.non_orographic_gravity_wave)
47+
compute_vtendnogw!(_, _, _, _, non_orographic_gravity_wave::T) where {T} =
48+
error_diagnostic_variable("vtendnogw", non_orographic_gravity_wave)
49+
50+
function compute_vtendnogw!(
51+
out,
52+
state,
53+
cache,
54+
time,
55+
::T,
56+
) where {T <: NonOrographyGravityWave}
57+
if isnothing(out)
58+
# v_waveforcing is not a Field:
59+
# return Fields.array2field(
60+
# cache.non_orographic_gravity_wave.v_waveforcing,
61+
# axes(state.c),
62+
# )
63+
return copy(cache.non_orographic_gravity_wave.v_waveforcing)
64+
else
65+
out .= cache.non_orographic_gravity_wave.v_waveforcing
66+
end
67+
end
68+
69+
add_diagnostic_variable!(
70+
short_name = "vtendnogw",
71+
long_name = "Northward Acceleration Due to Non-Orographic Gravity Wave Drag",
72+
standard_name = "tendency_of_northward_wind_due_to_nonorographic_gravity_wave_drag",
73+
units = "m s-2",
74+
comments = "Northward Acceleration Due to Non-Orographic Gravity Wave Drag",
75+
compute! = compute_vtendnogw!,
76+
)

0 commit comments

Comments
 (0)