Skip to content

Commit 041fffe

Browse files
Akshay SridharAkshay Sridhar
authored andcommitted
modified: docs/src/plot_profiles.jl
1 parent 4c9ed05 commit 041fffe

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

docs/src/plot_profiles.jl

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,15 @@ q_sfc = FT(0.0107) # kg/kg
5454
θ_sfc = FT(289.7) # K
5555
ts_sfc_test = Thermodynamics.PhaseEquil_pθq(thermo_params, 99340.0, 289.7, 0.0107)
5656
ts_int_test = Thermodynamics.PhaseEquil_pθq(thermo_params, 95342.0, 298.0, 0.0085)
57-
state_in = SF.InteriorValues(FT(350), (FT(0.0), FT(0)), ts_int_test)
57+
state_in = SF.InteriorValues(FT(100), (FT(1.0), FT(0)), ts_int_test)
5858
state_sfc = SF.SurfaceValues(FT(0), (FT(0), FT(0)), ts_sfc_test)
5959
sc = SF.ValuesOnly{FT}(; state_in, state_sfc, z0m, z0b)
60-
rsc = SF.surface_conditions(param_set, sc, SF.FDScheme())
60+
ts_sfc_test = Thermodynamics.PhaseEquil_pθq(thermo_params, 100000.0, 289.7, 0.0)
61+
ts_int_test = Thermodynamics.PhaseEquil_pθq(thermo_params, 99990.0, 298.0, 0.0)
6162
Z = collect(range(FT(d + 10^-10), stop = FT(100), length = 250))
6263

6364
"""
64-
save_profile(param_set, sc, ca, L_MOs, Z, X_in, X_sfc, transport, uft, scheme, x_star, d)
65+
save_profile(param_set, sc, ca, L_MOs, Z, X_sfc, transport, uft, scheme, x_star, d)
6566
6667
Saves profiles of variable X given values of Z coordinates. Follows Nishizawa equation (21,22)
6768
@@ -71,7 +72,7 @@ Saves profiles of variable X given values of Z coordinates. Follows Nishizawa eq
7172
of the state vector, and {fluxes, friction velocity, exchange coefficients} for a given experiment
7273
- L_MOs: Monin-Obukhov length(s)
7374
- Z: Z coordinate(s) (within surface layer) for which variable values are required
74-
- X_in, X_sfc: For variable X, values at interior and surface nodes
75+
- X_sfc: For variable X, values at interior and surface nodes
7576
- transport: Transport type, (e.g. Momentum or Heat, used to determine physical scale coefficients)
7677
- uft: A Universal Function type, (returned by, e.g., Businger())
7778
- scheme: Discretization scheme (currently supports FD and FV)
@@ -85,7 +86,6 @@ function save_profile(
8586
sc::SF.AbstractSurfaceConditions,
8687
L_MOs::Array{FT, 1},
8788
Z::Array{FT, 1},
88-
X_in,
8989
X_sfc,
9090
transport,
9191
uft::UF.AUFT,
@@ -96,7 +96,7 @@ function save_profile(
9696
title = nothing,
9797
xlims = nothing,
9898
ylims = nothing,
99-
xlabel = "u/u_star",
99+
xlabel = "u(z)",
100100
ylabel = "z",
101101
fig_prefix = "",
102102
xaxis = :identity,
@@ -106,13 +106,17 @@ function save_profile(
106106
for L_MO in L_MOs
107107
x_i = map(Z) do z
108108
Zi = typeof(rsl) == SF.NoRSL ? FT(z - d) : FT(z)
109-
dx = SF.recover_profile(param_set, sc, L_MO, Zi, X_in, X_sfc, transport, uft, scheme, rsl)
109+
state_in = SF.InteriorValues(FT(Zi), (FT(1.0), FT(0)), ts_int_test)
110+
state_sfc = SF.SurfaceValues(FT(0), (FT(0), FT(0)), ts_sfc_test)
111+
sc = SF.ValuesOnly{FT}(; state_in, state_sfc, z0m, z0b)
112+
rsc = SF.surface_conditions(param_set, sc, SF.FDScheme())
113+
dx = SF.recover_profile(param_set, sc, L_MO, Zi, X_sfc, x_star, transport, uft, scheme, rsl)
110114
end
111115

112116
uf = UF.universal_func(uft, L_MO, SFP.uf_params(param_set))
113117
_π_group = FT(UF.π_group(uf, transport))
114118

115-
Δx = @. κ * (x_i - X_sfc) / (_π_group * x_star)
119+
Δx = @. (x_i - X_sfc) #/ (_π_group * x_star)
116120

117121
Plots.plot!(Δx, Z, label = "L_MO = $L_MO")
118122
Plots.plot!(; title, xlabel, ylabel, ylims, xlims, grid = :off, legend = :outerright, titlefontalign = :center)
@@ -138,7 +142,6 @@ save_profile(
138142
sc,
139143
Unstable_L_MOs,
140144
Z,
141-
FT(3.7),
142145
FT(0),
143146
UF.MomentumTransport(),
144147
uft,
@@ -158,7 +161,6 @@ save_profile(
158161
sc,
159162
Unstable_L_MOs,
160163
Z,
161-
FT(3.7),
162164
FT(0),
163165
UF.MomentumTransport(),
164166
uft,
@@ -178,7 +180,6 @@ save_profile(
178180
sc,
179181
Unstable_L_MOs,
180182
Z,
181-
FT(298.0),
182183
θ_sfc,
183184
UF.HeatTransport(),
184185
uft,
@@ -188,7 +189,7 @@ save_profile(
188189
d;
189190
xlims = (-8, 0),
190191
ylims = (15, 50),
191-
xlabel = "θ/θ_star",
192+
xlabel = "θ - θ_sfc",
192193
fig_prefix = "Fig6.4b_canopy",
193194
title = "Vertical Profile of Temperature (Canopy)",
194195
)
@@ -199,7 +200,6 @@ save_profile(
199200
sc,
200201
Unstable_L_MOs,
201202
Z,
202-
FT(298.0),
203203
θ_sfc,
204204
UF.HeatTransport(),
205205
uft,
@@ -209,7 +209,7 @@ save_profile(
209209
d;
210210
xlims = (-8, 0),
211211
ylims = (15, 50),
212-
xlabel = "θ/θ_star",
212+
xlabel = "θ- θ_sfc",
213213
fig_prefix = "Fig6.4b",
214214
title = "Vertical Profile of Temperature (No Canopy)",
215215
)
@@ -220,7 +220,6 @@ save_profile(
220220
sc,
221221
Stable_L_MOs,
222222
Z,
223-
FT(3.7),
224223
FT(0),
225224
UF.MomentumTransport(),
226225
uft,
@@ -240,7 +239,6 @@ save_profile(
240239
sc,
241240
Stable_L_MOs,
242241
Z,
243-
FT(3.7),
244242
FT(0),
245243
UF.MomentumTransport(),
246244
uft,
@@ -260,7 +258,6 @@ save_profile(
260258
sc,
261259
Stable_L_MOs,
262260
Z,
263-
FT(298.0),
264261
θ_sfc,
265262
UF.HeatTransport(),
266263
uft,
@@ -270,7 +267,7 @@ save_profile(
270267
d;
271268
xlims = (0, 2),
272269
ylims = (15, 50),
273-
xlabel = "θ/θ_star",
270+
xlabel = "θ-θ_sfc",
274271
fig_prefix = "Fig6.4d_canopy",
275272
title = "Vertical Profile of Temperature (Canopy)",
276273
)
@@ -281,7 +278,6 @@ save_profile(
281278
sc,
282279
Stable_L_MOs,
283280
Z,
284-
FT(298.0),
285281
θ_sfc,
286282
UF.HeatTransport(),
287283
uft,
@@ -291,7 +287,7 @@ save_profile(
291287
d;
292288
xlims = (0, 2),
293289
ylims = (15, 50),
294-
xlabel = "θ/θ_star",
290+
xlabel = "θ-θ_sfc",
295291
fig_prefix = "Fig6.4d",
296292
title = "Vertical Profile of Temperature (No Canopy)",
297293
)

0 commit comments

Comments
 (0)