Skip to content

Commit

Permalink
Merge #517
Browse files Browse the repository at this point in the history
517: use latent heat const with T r=trontrytel a=trontrytel

As discussed today, to be consistent with the definition of `theta_liq_ice` we should use constant latent heat.

Co-authored-by: Anna Jaruga <ajaruga@caltech.edu>
  • Loading branch information
bors[bot] and trontrytel committed Nov 5, 2021
2 parents a605b63 + 1d1ffbb commit 1114df3
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 92 deletions.
10 changes: 5 additions & 5 deletions integration_tests/utils/Cases.jl
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ function initialize_surface(self::CasesBase{Soares}, grid::Grid, state, param_se
qt_flux = 2.5e-5
ts = TD.PhaseEquil_pTq(param_set, p0_f_surf, self.Sur.Tsurface, self.Sur.qsurface)
theta_surface = TD.liquid_ice_pottemp(ts)
self.Sur.lhf = qt_flux * ρ0_f_surf * TD.latent_heat_vapor(ts)
self.Sur.lhf = qt_flux * ρ0_f_surf * CPP.LH_v0(param_set)
self.Sur.shf = θ_flux * TD.cp_m(ts) * ρ0_f_surf
self.Sur.ustar_fixed = false
self.Sur.ustar = 0.28 # just to initilize grid mean covariances
Expand Down Expand Up @@ -361,7 +361,7 @@ function initialize_surface(self::CasesBase{Bomex}, grid::Grid, state, param_set
theta_surface = 299.1
ts = TC.thermo_state_pθq(param_set, p0_f_surf, theta_surface, self.Sur.qsurface)
self.Sur.Tsurface = TD.air_temperature(ts)
self.Sur.lhf = 5.2e-5 * ρ0_f_surf * TD.latent_heat_vapor(ts)
self.Sur.lhf = 5.2e-5 * ρ0_f_surf * CPP.LH_v0(param_set)
self.Sur.shf = 8.0e-3 * TD.cp_m(ts) * ρ0_f_surf
self.Sur.ustar_fixed = true
self.Sur.ustar = 0.28 # m/s
Expand Down Expand Up @@ -490,7 +490,7 @@ function initialize_surface(self::CasesBase{life_cycle_Tan2018}, grid::Grid, sta
theta_surface = 299.1
ts = TC.thermo_state_pθq(param_set, p0_f_surf, theta_surface, self.Sur.qsurface)
self.Sur.Tsurface = TD.air_temperature(ts)
self.Sur.lhf = 5.2e-5 * ρ0_f_surf * TD.latent_heat_vapor(ts)
self.Sur.lhf = 5.2e-5 * ρ0_f_surf * CPP.LH_v0(param_set)
self.Sur.shf = 8.0e-3 * TD.cp_m(ts) * ρ0_f_surf
self.lhf0 = self.Sur.lhf
self.shf0 = self.Sur.shf
Expand Down Expand Up @@ -772,7 +772,7 @@ function initialize_surface(self::CasesBase{TRMM_LBA}, grid::Grid, state, param_
theta_surface = (273.15 + 23)
ts = TC.thermo_state_pθq(param_set, p0_f_surf, theta_surface, self.Sur.qsurface)
self.Sur.Tsurface = TD.air_temperature(ts)
self.Sur.lhf = 5.2e-5 * ρ0_f_surf * TD.latent_heat_vapor(ts)
self.Sur.lhf = 5.2e-5 * ρ0_f_surf * CPP.LH_v0(param_set)
self.Sur.shf = 8.0e-3 * TD.cp_m(ts) * ρ0_f_surf
self.Sur.ustar_fixed = true
self.Sur.ustar = 0.28 # this is taken from Bomex -- better option is to approximate from LES tke above the surface
Expand Down Expand Up @@ -1277,7 +1277,7 @@ function initialize_surface(self::CasesBase{DYCOMS_RF01}, grid::Grid, state, par
ts = TD.PhaseEquil_pTq(param_set, p0_f_surf, self.Sur.Tsurface, self.Sur.qsurface)
theta_surface = TD.liquid_ice_pottemp(ts)
θ_flux = self.Sur.shf / TD.cp_m(ts) / ρ0_f_surf
qt_flux = self.Sur.lhf / TD.latent_heat_vapor(ts) / ρ0_f_surf
qt_flux = self.Sur.lhf / CPP.LH_v0(param_set) / ρ0_f_surf

self.Sur.bflux =
g * (
Expand Down
160 changes: 80 additions & 80 deletions integration_tests/utils/mse_tables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,35 @@
all_best_mse = OrderedCollections.OrderedDict()
#
all_best_mse["ARM_SGP"] = OrderedCollections.OrderedDict()
all_best_mse["ARM_SGP"]["qt_mean"] = 0.22336972794853463
all_best_mse["ARM_SGP"]["updraft_area"] = 335.39395304218874
all_best_mse["ARM_SGP"]["updraft_w"] = 142.04595107815257
all_best_mse["ARM_SGP"]["updraft_qt"] = 27.608269061958264
all_best_mse["ARM_SGP"]["updraft_thetal"] = 170.98104312978447
all_best_mse["ARM_SGP"]["qt_mean"] = 0.21817127036407066
all_best_mse["ARM_SGP"]["updraft_area"] = 332.9750777959169
all_best_mse["ARM_SGP"]["updraft_w"] = 149.90689029484517
all_best_mse["ARM_SGP"]["updraft_qt"] = 27.790879884358098
all_best_mse["ARM_SGP"]["updraft_thetal"] = 170.9809335102771
all_best_mse["ARM_SGP"]["u_mean"] = 1.3375737467153984e-5
all_best_mse["ARM_SGP"]["tke_mean"] = 1318.6602293296348
all_best_mse["ARM_SGP"]["temperature_mean"] = 0.000109470808468741
all_best_mse["ARM_SGP"]["ql_mean"] = 174.19144829957503
all_best_mse["ARM_SGP"]["tke_mean"] = 1316.6971780664883
all_best_mse["ARM_SGP"]["temperature_mean"] = 0.00010811858257494586
all_best_mse["ARM_SGP"]["ql_mean"] = 197.09039813329593
all_best_mse["ARM_SGP"]["qi_mean"] = "NA"
all_best_mse["ARM_SGP"]["thetal_mean"] = 0.0001008500529941707
all_best_mse["ARM_SGP"]["Hvar_mean"] = 10272.025247957436
all_best_mse["ARM_SGP"]["QTvar_mean"] = 6520.655602593681
all_best_mse["ARM_SGP"]["thetal_mean"] = 0.00010013919054848816
all_best_mse["ARM_SGP"]["Hvar_mean"] = 3642.484059229097
all_best_mse["ARM_SGP"]["QTvar_mean"] = 2238.846224644519
#
all_best_mse["Bomex"] = OrderedCollections.OrderedDict()
all_best_mse["Bomex"]["qt_mean"] = 0.11089388922127488
all_best_mse["Bomex"]["updraft_area"] = 129.55617165620623
all_best_mse["Bomex"]["updraft_w"] = 18.114902960628168
all_best_mse["Bomex"]["updraft_qt"] = 6.271258519434218
all_best_mse["Bomex"]["updraft_thetal"] = 69.45693156497397
all_best_mse["Bomex"]["v_mean"] = 66.90416426051955
all_best_mse["Bomex"]["u_mean"] = 0.3230366720242709
all_best_mse["Bomex"]["tke_mean"] = 74.24050507191417
all_best_mse["Bomex"]["temperature_mean"] = 4.3987566397998385e-5
all_best_mse["Bomex"]["ql_mean"] = 8.158894286617398
all_best_mse["Bomex"]["qt_mean"] = 0.11182740845648569
all_best_mse["Bomex"]["updraft_area"] = 129.53616527474082
all_best_mse["Bomex"]["updraft_w"] = 18.416745975347123
all_best_mse["Bomex"]["updraft_qt"] = 6.542663334628368
all_best_mse["Bomex"]["updraft_thetal"] = 69.46303896220819
all_best_mse["Bomex"]["v_mean"] = 66.91032899202142
all_best_mse["Bomex"]["u_mean"] = 0.3230385479294943
all_best_mse["Bomex"]["tke_mean"] = 74.25793202702893
all_best_mse["Bomex"]["temperature_mean"] = 4.4406298083075524e-5
all_best_mse["Bomex"]["ql_mean"] = 8.613520894850032
all_best_mse["Bomex"]["qi_mean"] = "NA"
all_best_mse["Bomex"]["thetal_mean"] = 4.4643405606181006e-5
all_best_mse["Bomex"]["Hvar_mean"] = 4145.578933520064
all_best_mse["Bomex"]["QTvar_mean"] = 1546.7494339261843
all_best_mse["Bomex"]["thetal_mean"] = 4.508993768738419e-5
all_best_mse["Bomex"]["Hvar_mean"] = 3995.598813344771
all_best_mse["Bomex"]["QTvar_mean"] = 1493.0736349368244
#
all_best_mse["DryBubble"] = OrderedCollections.OrderedDict()
all_best_mse["DryBubble"]["updraft_area"] = 0.0
Expand All @@ -46,19 +46,19 @@ all_best_mse["DryBubble"]["thetal_mean"] = 0.0
all_best_mse["DryBubble"]["Hvar_mean"] = 3.6376577831233795e-14
#
all_best_mse["DYCOMS_RF01"] = OrderedCollections.OrderedDict()
all_best_mse["DYCOMS_RF01"]["qt_mean"] = 0.02266768949492931
all_best_mse["DYCOMS_RF01"]["ql_mean"] = 10.279853226025203
all_best_mse["DYCOMS_RF01"]["updraft_area"] = 30.546343419259646
all_best_mse["DYCOMS_RF01"]["updraft_w"] = 4.13860507148924
all_best_mse["DYCOMS_RF01"]["updraft_qt"] = 2.151491944788959
all_best_mse["DYCOMS_RF01"]["updraft_thetal"] = 46.18691270440001
all_best_mse["DYCOMS_RF01"]["v_mean"] = 0.003007505042897622
all_best_mse["DYCOMS_RF01"]["u_mean"] = 0.07909085313193075
all_best_mse["DYCOMS_RF01"]["tke_mean"] = 21.33883567622849
all_best_mse["DYCOMS_RF01"]["temperature_mean"] = 8.085863436032554e-5
all_best_mse["DYCOMS_RF01"]["thetal_mean"] = 8.15893797083448e-5
all_best_mse["DYCOMS_RF01"]["Hvar_mean"] = 1243.0781411983992
all_best_mse["DYCOMS_RF01"]["QTvar_mean"] = 483.9134520366122
all_best_mse["DYCOMS_RF01"]["qt_mean"] = 0.021041262151441528
all_best_mse["DYCOMS_RF01"]["ql_mean"] = 9.054869054539482
all_best_mse["DYCOMS_RF01"]["updraft_area"] = 30.52228318360981
all_best_mse["DYCOMS_RF01"]["updraft_w"] = 4.126520550679194
all_best_mse["DYCOMS_RF01"]["updraft_qt"] = 2.146524041593182
all_best_mse["DYCOMS_RF01"]["updraft_thetal"] = 46.1869318755156
all_best_mse["DYCOMS_RF01"]["v_mean"] = 0.003044421415838277
all_best_mse["DYCOMS_RF01"]["u_mean"] = 0.07909196641990117
all_best_mse["DYCOMS_RF01"]["tke_mean"] = 21.375987604667543
all_best_mse["DYCOMS_RF01"]["temperature_mean"] = 7.939079026175405e-5
all_best_mse["DYCOMS_RF01"]["thetal_mean"] = 8.017909111294316e-5
all_best_mse["DYCOMS_RF01"]["Hvar_mean"] = 1243.1140664624975
all_best_mse["DYCOMS_RF01"]["QTvar_mean"] = 483.5047037827438
#
all_best_mse["GABLS"] = OrderedCollections.OrderedDict()
all_best_mse["GABLS"]["updraft_thetal"] = 0.0
Expand Down Expand Up @@ -97,57 +97,57 @@ all_best_mse["Nieuwstadt"]["thetal_mean"] = 1.0038730380773907e-5
all_best_mse["Nieuwstadt"]["Hvar_mean"] = 1277.483163122067
#
all_best_mse["Rico"] = OrderedCollections.OrderedDict()
all_best_mse["Rico"]["qt_mean"] = 1.2392247687753224
all_best_mse["Rico"]["updraft_area"] = 477.4683069566954
all_best_mse["Rico"]["updraft_w"] = 107.96494548428919
all_best_mse["Rico"]["updraft_qt"] = 12.285794976409074
all_best_mse["Rico"]["updraft_thetal"] = 133.3636738078372
all_best_mse["Rico"]["v_mean"] = 0.6105612797683235
all_best_mse["Rico"]["u_mean"] = 0.694913566440449
all_best_mse["Rico"]["tke_mean"] = 82.27596130048735
all_best_mse["Rico"]["temperature_mean"] = 0.0005733072300361976
all_best_mse["Rico"]["ql_mean"] = 63.36370009749748
all_best_mse["Rico"]["qt_mean"] = 1.2296754182989873
all_best_mse["Rico"]["updraft_area"] = 477.86526623716037
all_best_mse["Rico"]["updraft_w"] = 108.28709508589668
all_best_mse["Rico"]["updraft_qt"] = 12.265151011382661
all_best_mse["Rico"]["updraft_thetal"] = 133.36404515044276
all_best_mse["Rico"]["v_mean"] = 0.6119055385243262
all_best_mse["Rico"]["u_mean"] = 0.6928334892733075
all_best_mse["Rico"]["tke_mean"] = 82.13854119046518
all_best_mse["Rico"]["temperature_mean"] = 0.0005702262467539995
all_best_mse["Rico"]["ql_mean"] = 63.86435082427102
all_best_mse["Rico"]["qi_mean"] = "NA"
all_best_mse["Rico"]["qr_mean"] = 760.8095424564954
all_best_mse["Rico"]["thetal_mean"] = 0.0005657435436849961
all_best_mse["Rico"]["Hvar_mean"] = 179281.32561909297
all_best_mse["Rico"]["QTvar_mean"] = 40233.81857158096
all_best_mse["Rico"]["qr_mean"] = 760.874714262076
all_best_mse["Rico"]["thetal_mean"] = 0.0005626606199463073
all_best_mse["Rico"]["Hvar_mean"] = 172320.8692694
all_best_mse["Rico"]["QTvar_mean"] = 38845.047004701286
#
all_best_mse["Soares"] = OrderedCollections.OrderedDict()
all_best_mse["Soares"]["qt_mean"] = 0.12623520584762954
all_best_mse["Soares"]["updraft_area"] = 96.34014526986842
all_best_mse["Soares"]["updraft_w"] = 11.390128916096858
all_best_mse["Soares"]["updraft_qt"] = 23.080877966322717
all_best_mse["Soares"]["updraft_thetal"] = 65.25330119519995
all_best_mse["Soares"]["u_mean"] = 96.34451750277604
all_best_mse["Soares"]["tke_mean"] = 241.27289775855488
all_best_mse["Soares"]["temperature_mean"] = 1.0977617337130468e-5
all_best_mse["Soares"]["thetal_mean"] = 1.0405848721480761e-5
all_best_mse["Soares"]["Hvar_mean"] = 1121.220961389257
all_best_mse["Soares"]["qt_mean"] = 0.12625952571135643
all_best_mse["Soares"]["updraft_area"] = 96.32723090512386
all_best_mse["Soares"]["updraft_w"] = 11.389526965173335
all_best_mse["Soares"]["updraft_qt"] = 23.08106187567548
all_best_mse["Soares"]["updraft_thetal"] = 65.25330106290761
all_best_mse["Soares"]["u_mean"] = 96.34481548893412
all_best_mse["Soares"]["tke_mean"] = 241.31046279100968
all_best_mse["Soares"]["temperature_mean"] = 1.0978382042850359e-5
all_best_mse["Soares"]["thetal_mean"] = 1.0406751282033165e-5
all_best_mse["Soares"]["Hvar_mean"] = 1121.1787309460738
#
all_best_mse["TRMM_LBA"] = OrderedCollections.OrderedDict()
all_best_mse["TRMM_LBA"]["qt_mean"] = 3.963977389784696
all_best_mse["TRMM_LBA"]["updraft_area"] = 7590.512428035854
all_best_mse["TRMM_LBA"]["updraft_w"] = 29117.789630261195
all_best_mse["TRMM_LBA"]["updraft_qt"] = 264.37439468421894
all_best_mse["TRMM_LBA"]["updraft_thetal"] = 1962.1733128842723
all_best_mse["TRMM_LBA"]["v_mean"] = 286.64250267320165
all_best_mse["TRMM_LBA"]["u_mean"] = 113.79784954567049
all_best_mse["TRMM_LBA"]["tke_mean"] = 25954.332707352492
all_best_mse["TRMM_LBA"]["temperature_mean"] = 0.00112576565688425
all_best_mse["TRMM_LBA"]["ql_mean"] = 11335.71595959235
all_best_mse["TRMM_LBA"]["qt_mean"] = 4.007171391544698
all_best_mse["TRMM_LBA"]["updraft_area"] = 7581.029018257358
all_best_mse["TRMM_LBA"]["updraft_w"] = 26989.4425424332
all_best_mse["TRMM_LBA"]["updraft_qt"] = 258.3852392754657
all_best_mse["TRMM_LBA"]["updraft_thetal"] = 1960.7207193767483
all_best_mse["TRMM_LBA"]["v_mean"] = 287.43462781046196
all_best_mse["TRMM_LBA"]["u_mean"] = 113.99150465821123
all_best_mse["TRMM_LBA"]["tke_mean"] = 21909.64511808943
all_best_mse["TRMM_LBA"]["temperature_mean"] = 0.0010911926591953545
all_best_mse["TRMM_LBA"]["ql_mean"] = 10685.88328095032
all_best_mse["TRMM_LBA"]["qi_mean"] = "NA"
all_best_mse["TRMM_LBA"]["thetal_mean"] = 0.021118882573307667
all_best_mse["TRMM_LBA"]["Hvar_mean"] = 4343.288145343326
all_best_mse["TRMM_LBA"]["QTvar_mean"] = 2834.894441259608
all_best_mse["TRMM_LBA"]["thetal_mean"] = 0.021163620364113005
all_best_mse["TRMM_LBA"]["Hvar_mean"] = 3891.4562706300694
all_best_mse["TRMM_LBA"]["QTvar_mean"] = 2801.9147313622316
#
all_best_mse["LES_driven_SCM"] = OrderedCollections.OrderedDict()
all_best_mse["LES_driven_SCM"]["qt_mean"] = 6.6848941301202665
all_best_mse["LES_driven_SCM"]["v_mean"] = 3.7461500362773097
all_best_mse["LES_driven_SCM"]["u_mean"] = 1.2502583540896357
all_best_mse["LES_driven_SCM"]["temperature_mean"] = 0.0029087535232275095
all_best_mse["LES_driven_SCM"]["ql_mean"] = 1640.9315832454179
all_best_mse["LES_driven_SCM"]["thetal_mean"] = 0.0032160005045022413
all_best_mse["LES_driven_SCM"]["qt_mean"] = 6.921226169837171
all_best_mse["LES_driven_SCM"]["v_mean"] = 3.752626675003321
all_best_mse["LES_driven_SCM"]["u_mean"] = 1.254491203611036
all_best_mse["LES_driven_SCM"]["temperature_mean"] = 0.0029869356415974683
all_best_mse["LES_driven_SCM"]["ql_mean"] = 4489.820222662858
all_best_mse["LES_driven_SCM"]["thetal_mean"] = 0.003310204761927009
#
#################################
#################################
Expand Down
10 changes: 5 additions & 5 deletions src/Surface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function update(surf::SurfaceBase{SurfaceFixedFlux}, grid, state, gm::GridMeanVa
rho_tflux = surf.shf / TD.cp_m(ts)

surf.windspeed = sqrt(u_gm_surf^2 + v_gm_surf^2)
surf.rho_qtflux = surf.lhf / TD.latent_heat_vapor(param_set, surf.Tsurface)
surf.rho_qtflux = surf.lhf / CPP.LH_v0(param_set)

ts = thermo_state_pθq(param_set, p0_f_surf, θ_liq_ice_gm_surf, q_tot_gm_surf)
Π = TD.exner(ts)
Expand Down Expand Up @@ -105,7 +105,7 @@ function update(surf::SurfaceBase{SurfaceFixedCoeffs}, grid, state, gm::GridMean
ts = thermo_state_pθq(param_set, p0_f_surf, surf.Tsurface, surf.qsurface)
surf.windspeed = max(sqrt(u_gm_surf^2 + v_gm_surf^2), 0.01)
cp_ = TD.cp_m(ts)
lv = TD.latent_heat_vapor(ts)
lv = CPP.LH_v0(param_set)

surf.rho_qtflux = -surf.cq * surf.windspeed * (q_tot_gm_surf - surf.qsurface) * ρ0_f_surf
surf.lhf = lv * surf.rho_qtflux
Expand Down Expand Up @@ -143,7 +143,7 @@ function update(surf::SurfaceBase{SurfaceMoninObukhov}, grid, state, gm::GridMea

pvg = TD.saturation_vapor_pressure(param_set, TD.PhaseEquil, surf.Tsurface)
surf.qsurface = TD.q_vap_saturation_from_density(param_set, surf.Tsurface, ρ0_f_surf, pvg)
lv = TD.latent_heat_vapor(param_set, T_gm_surf)
lv = CPP.LH_v0(param_set)

phase_part = TD.PhasePartition(surf.qsurface, 0.0, 0.0)
h_star = TD.liquid_ice_pottemp_given_pressure(param_set, surf.Tsurface, Pg, phase_part)
Expand Down Expand Up @@ -196,7 +196,7 @@ function update(surf::SurfaceBase{SurfaceMoninObukhovDry}, grid, state, gm::Grid

pvg = TD.saturation_vapor_pressure(param_set, TD.PhaseEquil, surf.Tsurface)
surf.qsurface = TD.q_vap_saturation_from_density(param_set, surf.Tsurface, ρ0_f_surf, pvg)
lv = TD.latent_heat_vapor(param_set, T_gm_surf)
lv = CPP.LH_v0(param_set)

phase_part = TD.PhasePartition(surf.qsurface, 0.0, 0.0)
h_star = TD.liquid_ice_pottemp_given_pressure(param_set, surf.Tsurface, Pg, phase_part)
Expand Down Expand Up @@ -248,7 +248,7 @@ function update(surf::SurfaceBase{SurfaceSullivanPatton}, grid, state, gm::GridM
Pg = surf.ref_params.Pg

ts = thermo_state_pθq(param_set, p0_f_surf, surf.Tsurface, surf.qsurface)
lv = TD.latent_heat_vapor(param_set, T_gm_surf)
lv = CPP.LH_v0(param_set)
T0 = p0_c_surf * α0_c_surf / R_d # TODO: can we use a thermo state here?

θ_flux = 0.24
Expand Down
2 changes: 1 addition & 1 deletion src/microphysics_coupling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Computes the tendency to θ_liq_ice due to qt moving between
the working fluid and precipitation
"""
function θ_liq_ice_helper(ts, qt_tendency::FT) where {FT}
L = TD.latent_heat_vapor(ts)
L = FT(CPP.LH_v0(ts.param_set))
Π = TD.exner(ts)
return -L * qt_tendency / Π / FT(CPP.cp_d(ts.param_set))
end
Expand Down
2 changes: 1 addition & 1 deletion src/surface_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
function buoyancy_flux(param_set, shf::FT, lhf, T_b, qt_b, α0_b, ts) where {FT}
g = FT(CPP.grav(param_set))
molmass_ratio = FT(CPP.molmass_ratio(param_set))
lv = TD.latent_heat_vapor(param_set, T_b)
lv = CPP.LH_v0(param_set)
cp_m = TD.cp_m(ts)
return (g * α0_b / cp_m / T_b * (shf + (molmass_ratio - 1) * cp_m * T_b * lhf / lv))
end
Expand Down

0 comments on commit 1114df3

Please sign in to comment.