Skip to content

Commit

Permalink
Merge #123
Browse files Browse the repository at this point in the history
123: organize scalar equations r=yairchn a=yairchn



Co-authored-by: yairchn <[email protected]>
  • Loading branch information
bors[bot] and yairchn authored Aug 13, 2021
2 parents b52b1f9 + adafdeb commit 6a5637d
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 112 deletions.
24 changes: 12 additions & 12 deletions integration_tests/ARM_SGP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ include(joinpath("utils", "compute_mse.jl"))
using .NameList

best_mse = OrderedDict()
best_mse["qt_mean"] = 3.2231237240917160e-01
best_mse["updraft_area"] = 2.0078340302396784e+03
best_mse["updraft_w"] = 3.3936433966850967e+02
best_mse["updraft_qt"] = 1.3509451158258978e+01
best_mse["updraft_thetal"] = 2.7683871839666477e+01
best_mse["u_mean"] = 8.7998547277817920e+01
best_mse["tke_mean"] = 6.9016396604551733e+02
best_mse["temperature_mean"] = 1.3318895186222515e-04
best_mse["ql_mean"] = 3.5021120774412930e+02
best_mse["thetal_mean"] = 1.3800056762098192e-04
best_mse["Hvar_mean"] = 6.2976082776935509e+03
best_mse["QTvar_mean"] = 4.3109900526010560e+03
best_mse["qt_mean"] = 3.7029179410890994e-01
best_mse["updraft_area"] = 2.0066768291734027e+03
best_mse["updraft_w"] = 3.3021026158842852e+02
best_mse["updraft_qt"] = 1.3362770693863471e+01
best_mse["updraft_thetal"] = 2.7682689602916721e+01
best_mse["u_mean"] = 8.7998547277817892e+01
best_mse["tke_mean"] = 6.5902888656341383e+02
best_mse["temperature_mean"] = 1.4835874987504939e-04
best_mse["ql_mean"] = 2.5289195067821601e+02
best_mse["thetal_mean"] = 1.5194012840291993e-04
best_mse["Hvar_mean"] = 3.6200709711739819e+03
best_mse["QTvar_mean"] = 2.5763919693088642e+03

@testset "ARM_SGP" begin
case_name = "ARM_SGP"
Expand Down
26 changes: 13 additions & 13 deletions integration_tests/Bomex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ include(joinpath("utils", "compute_mse.jl"))
using .NameList

best_mse = OrderedDict()
best_mse["qt_mean"] = 1.0525043577985331e-01
best_mse["updraft_area"] = 6.9819789786346007e+02
best_mse["updraft_w"] = 3.2787315815313967e+01
best_mse["updraft_qt"] = 4.2909342180533088e+00
best_mse["updraft_thetal"] = 2.1546675837401239e+01
best_mse["v_mean"] = 6.8303124684318490e+01
best_mse["u_mean"] = 5.3308086120368444e+01
best_mse["tke_mean"] = 4.2971736553362518e+01
best_mse["temperature_mean"] = 5.0980133005003681e-05
best_mse["ql_mean"] = 6.6199873853720544e+02
best_mse["thetal_mean"] = 4.6078132934362555e-05
best_mse["Hvar_mean"] = 3.7127649327550598e+03
best_mse["QTvar_mean"] = 2.0267697132357714e+03
best_mse["qt_mean"] = 9.7923185944396543e-02
best_mse["updraft_area"] = 6.9825342418932712e+02
best_mse["updraft_w"] = 3.2817058320329416e+01
best_mse["updraft_qt"] = 4.2756945036338720e+00
best_mse["updraft_thetal"] = 2.1546731002204076e+01
best_mse["v_mean"] = 6.8320914112603603e+01
best_mse["u_mean"] = 5.3308019185027945e+01
best_mse["tke_mean"] = 4.2619460317296351e+01
best_mse["temperature_mean"] = 4.2264960813453363e-05
best_mse["ql_mean"] = 6.1078690857394591e+00
best_mse["thetal_mean"] = 4.3075669150884208e-05
best_mse["Hvar_mean"] = 1.4320193838595969e+03
best_mse["QTvar_mean"] = 7.4620132655591669e+02

@testset "Bomex" begin
case_name = "Bomex"
Expand Down
27 changes: 14 additions & 13 deletions integration_tests/DYCOMS_RF01.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,21 @@ include(joinpath("utils", "compute_mse.jl"))
using .NameList

best_mse = OrderedDict()
best_mse["qt_mean"] = 1.6511493474010635e-02
best_mse["ql_mean"] = 5.2388152471828944e+00
best_mse["updraft_area"] = 2.3937655332711455e+02
best_mse["updraft_w"] = 4.2950818025070792e+00
best_mse["updraft_qt"] = 1.1670622065147132e+00
best_mse["updraft_thetal"] = 1.2740701334370417e+01
best_mse["v_mean"] = 3.9746921720554738e+01
best_mse["u_mean"] = 3.7046560343557694e+01
best_mse["tke_mean"] = 1.4700070268032464e+01
best_mse["temperature_mean"] = 2.1532443068564967e-05
best_mse["thetal_mean"] = 2.2397858587086213e-05
best_mse["Hvar_mean"] = 8.2677316057727712e+03
best_mse["QTvar_mean"] = 6.0266525106233109e+02
best_mse["qt_mean"] = 1.6511493474924487e-02
best_mse["ql_mean"] = 5.2388152463600228e+00
best_mse["updraft_area"] = 2.3937655332711191e+02
best_mse["updraft_w"] = 4.2950818025166271e+00
best_mse["updraft_qt"] = 1.1670622064912242e+00
best_mse["updraft_thetal"] = 1.2740701334370282e+01
best_mse["v_mean"] = 3.9746921720562241e+01
best_mse["u_mean"] = 3.7046560343565211e+01
best_mse["tke_mean"] = 1.4700070268008988e+01
best_mse["temperature_mean"] = 2.1532443073348772e-05
best_mse["thetal_mean"] = 2.2397858591617206e-05
best_mse["Hvar_mean"] = 8.2677316059854074e+03
best_mse["QTvar_mean"] = 6.0266525107346490e+02

key = "Hvar_mean"
@testset "DYCOMS_RF01" begin
case_name = "DYCOMS_RF01"
println("Running $case_name...")
Expand Down
16 changes: 8 additions & 8 deletions integration_tests/Nieuwstadt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ include(joinpath("utils", "compute_mse.jl"))
using .NameList

best_mse = OrderedDict()
best_mse["updraft_area"] = 5.9567300767628603e+02
best_mse["updraft_w"] = 2.6450206724736585e+01
best_mse["updraft_thetal"] = 3.0475209174453841e+01
best_mse["u_mean"] = 1.5244498024181507e+02
best_mse["tke_mean"] = 7.3585023416210106e+01
best_mse["temperature_mean"] = 1.1872216864529184e-05
best_mse["thetal_mean"] = 1.2035239354080019e-05
best_mse["Hvar_mean"] = 1.8640507000456412e+02
best_mse["updraft_area"] = 5.9567286602931904e+02
best_mse["updraft_w"] = 2.6450205443296568e+01
best_mse["updraft_thetal"] = 3.0475209174359087e+01
best_mse["u_mean"] = 1.5244498152508007e+02
best_mse["tke_mean"] = 7.3585026092564277e+01
best_mse["temperature_mean"] = 1.1872218655217143e-05
best_mse["thetal_mean"] = 1.2035241147904184e-05
best_mse["Hvar_mean"] = 1.8640506843913366e+02

@testset "Nieuwstadt" begin
case_name = "Nieuwstadt"
Expand Down
26 changes: 13 additions & 13 deletions integration_tests/Rico.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ include(joinpath("utils", "compute_mse.jl"))
using .NameList

best_mse = OrderedDict()
best_mse["qt_mean"] = 3.5489212020759542e-01
best_mse["updraft_area"] = 1.9189473424865719e+03
best_mse["updraft_w"] = 1.6330042256516663e+02
best_mse["updraft_qt"] = 1.5365813368597401e+01
best_mse["updraft_thetal"] = 6.3601413658374895e+01
best_mse["v_mean"] = 1.0634033027478135e+02
best_mse["u_mean"] = 1.1440791317739802e+02
best_mse["tke_mean"] = 3.4396944042394813e+02
best_mse["temperature_mean"] = 1.7375385006813271e-04
best_mse["ql_mean"] = 1.2777774668393246e+02
best_mse["thetal_mean"] = 1.4818668975836064e-04
best_mse["Hvar_mean"] = 5.4593421490878145e+03
best_mse["QTvar_mean"] = 2.4103920470177113e+03
best_mse["qt_mean"] = 3.6183738581707564e-01
best_mse["updraft_area"] = 1.9158389580482219e+03
best_mse["updraft_w"] = 1.7058718197542106e+02
best_mse["updraft_qt"] = 1.5449827839901584e+01
best_mse["updraft_thetal"] = 6.3602297256853468e+01
best_mse["v_mean"] = 1.0630514621668171e+02
best_mse["u_mean"] = 1.1443613156137732e+02
best_mse["tke_mean"] = 3.1910880264617197e+02
best_mse["temperature_mean"] = 1.8245777363727451e-04
best_mse["ql_mean"] = 2.2808514972615623e+02
best_mse["thetal_mean"] = 1.5458919462734390e-04
best_mse["Hvar_mean"] = 1.0744099006973258e+04
best_mse["QTvar_mean"] = 4.7454844707739849e+03

@testset "Rico" begin
case_name = "Rico"
Expand Down
24 changes: 12 additions & 12 deletions integration_tests/SP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ include(joinpath("utils", "compute_mse.jl"))
using .NameList

best_mse = OrderedDict()
best_mse["qt_mean"] = 3.5073036120908645e+00
best_mse["updraft_area"] = 3.9071035000833305e+00
best_mse["updraft_w"] = 9.3648209543530914e-01
best_mse["updraft_qt"] = 1.3868858638582151e+00
best_mse["updraft_thetal"] = 1.0515272505644875e-01
best_mse["v_mean"] = 4.6000262198139841e-01
best_mse["u_mean"] = 7.3724093159641325e-05
best_mse["tke_mean"] = 4.7833665690724869e-01
best_mse["temperature_mean"] = 6.8550010655096847e-07
best_mse["thetal_mean"] = 5.1299556224606434e-07
best_mse["Hvar_mean"] = 3.1719858004705035e+01
best_mse["QTvar_mean"] = 3.9762684967056670e+00
best_mse["qt_mean"] = 3.5073036121827599e+00
best_mse["updraft_area"] = 3.9071034998892715e+00
best_mse["updraft_w"] = 9.3648209541424188e-01
best_mse["updraft_qt"] = 1.3868858637940826e+00
best_mse["updraft_thetal"] = 1.0515272505644156e-01
best_mse["v_mean"] = 4.6000262200176228e-01
best_mse["u_mean"] = 7.3724093159961937e-05
best_mse["tke_mean"] = 4.7833665685836724e-01
best_mse["temperature_mean"] = 6.8550010657332516e-07
best_mse["thetal_mean"] = 5.1299556226337377e-07
best_mse["Hvar_mean"] = 3.1719859098824500e+01
best_mse["QTvar_mean"] = 3.9762684439302052e+00

@testset "SP" begin
case_name = "SP"
Expand Down
26 changes: 13 additions & 13 deletions integration_tests/TRMM_LBA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ using .NameList
CLIMAParameters.Planet.T_freeze(::EarthParameterSet) = 100.0

best_mse = OrderedDict()
best_mse["qt_mean"] = 2.1123818316732890e+00
best_mse["updraft_area"] = 2.2936100671417156e+04
best_mse["updraft_w"] = 9.7871834635955668e+02
best_mse["updraft_qt"] = 3.0602076179776624e+01
best_mse["updraft_thetal"] = 1.1001487658207374e+02
best_mse["v_mean"] = 2.9250821023927989e+02
best_mse["u_mean"] = 1.6873198920592913e+03
best_mse["tke_mean"] = 9.3648065032327702e+02
best_mse["temperature_mean"] = 8.1826613367091830e-04
best_mse["ql_mean"] = 7.2432912180809672e+02
best_mse["thetal_mean"] = 8.2748526944961612e-03
best_mse["Hvar_mean"] = 3.5701761097981662e+03
best_mse["QTvar_mean"] = 1.7865858571838050e+03
best_mse["qt_mean"] = 2.1123818327762196e+00
best_mse["updraft_area"] = 2.2936100671363765e+04
best_mse["updraft_w"] = 9.7871834647382809e+02
best_mse["updraft_qt"] = 3.0602076184487512e+01
best_mse["updraft_thetal"] = 1.1001487658208509e+02
best_mse["v_mean"] = 2.9250821023986430e+02
best_mse["u_mean"] = 1.6873198920581733e+03
best_mse["tke_mean"] = 9.3648065006898219e+02
best_mse["temperature_mean"] = 8.1826613372337135e-04
best_mse["ql_mean"] = 7.2432912110535301e+02
best_mse["thetal_mean"] = 8.2748526945473598e-03
best_mse["Hvar_mean"] = 3.5701761092936244e+03
best_mse["QTvar_mean"] = 1.7865858561907439e+03

@testset "TRMM_LBA" begin
case_name = "TRMM_LBA"
Expand Down
26 changes: 13 additions & 13 deletions integration_tests/life_cycle_Tan2018.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ include(joinpath("utils", "compute_mse.jl"))
using .NameList

best_mse = OrderedDict()
best_mse["qt_mean"] = 5.2649432939457785e-03
best_mse["ql_mean"] = 8.3701044168155769e-01
best_mse["updraft_area"] = 7.0432678120046099e-01
best_mse["updraft_w"] = 5.8558890544083542e-01
best_mse["updraft_qt"] = 1.1615774393933681e-01
best_mse["updraft_thetal"] = 6.2885864461831401e-05
best_mse["v_mean"] = 2.4748668041280980e-01
best_mse["u_mean"] = 7.1361727014691585e-04
best_mse["tke_mean"] = 2.0664613598760551e-01
best_mse["temperature_mean"] = 2.5719775476904971e-06
best_mse["thetal_mean"] = 2.4566433106218294e-06
best_mse["Hvar_mean"] = 2.1515325662209743e+03
best_mse["QTvar_mean"] = 1.1458060992053790e+03
best_mse["qt_mean"] = 5.2649429859732335e-03
best_mse["ql_mean"] = 8.3701130817214975e-01
best_mse["updraft_area"] = 7.0432677991444692e-01
best_mse["updraft_w"] = 5.8558890484998805e-01
best_mse["updraft_qt"] = 1.1615774284759468e-01
best_mse["updraft_thetal"] = 6.2885863821116435e-05
best_mse["v_mean"] = 2.4748668316753225e-01
best_mse["u_mean"] = 7.1361729071471190e-04
best_mse["tke_mean"] = 2.0664613818639557e-01
best_mse["temperature_mean"] = 2.5719773912461363e-06
best_mse["thetal_mean"] = 2.4566431564965449e-06
best_mse["Hvar_mean"] = 2.1515252048343000e+03
best_mse["QTvar_mean"] = 1.1458013034475746e+03

@testset "life_cycle_Tan2018" begin
case_name = "life_cycle_Tan2018"
Expand Down
27 changes: 12 additions & 15 deletions src/Turbulence_PrognosticTKE.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1201,26 +1201,23 @@ function solve_updraft_scalars(self::EDMF_PrognosticTKE, GMV::GridMeanVariables)
self.UpdVar.Area.values[i, k - 1] *
interp2pt(self.UpdVar.W.values[i, k - 2], self.UpdVar.W.values[i, k - 1])
)
c1 = ref_state.rho0_half[k] * self.UpdVar.Area.new[i, k] * dti_
c2 = (
ref_state.rho0_half[k] * self.UpdVar.Area.values[i, k] * dti_ -
m_k * (dzi + self.detr_sc[i, k] + self.frac_turb_entr[i, k])
)
c3 = m_km * dzi
c4 = m_k * (self.entr_sc[i, k] + self.frac_turb_entr[i, k])

adv = (m_k * self.UpdVar.H.values[i, k] - m_km * self.UpdVar.H.values[i, k - 1]) * dzi
entr = (self.entr_sc[i, k] + self.frac_turb_entr[i, k]) * self.EnvVar.H.values[k]
detr = (self.detr_sc[i, k] + self.frac_turb_entr[i, k]) * self.UpdVar.H.values[i, k]
self.UpdVar.H.new[i, k] =
(
c2 * self.UpdVar.H.values[i, k] +
c3 * self.UpdVar.H.values[i, k - 1] +
c4 * self.EnvVar.H.values[k]
) / c1
ref_state.rho0_half[k] * self.UpdVar.Area.values[i, k] * dti_ * self.UpdVar.H.values[i, k] -
adv + m_k * (entr - detr)
) / (ref_state.rho0_half[k] * self.UpdVar.Area.new[i, k] * dti_)

adv = (m_k * self.UpdVar.QT.values[i, k] - m_km * self.UpdVar.QT.values[i, k - 1]) * dzi
entr = (self.entr_sc[i, k] + self.frac_turb_entr[i, k]) * self.EnvVar.QT.values[k]
detr = (self.detr_sc[i, k] + self.frac_turb_entr[i, k]) * self.UpdVar.QT.values[i, k]
self.UpdVar.QT.new[i, k] = max(
(
c2 * self.UpdVar.QT.values[i, k] +
c3 * self.UpdVar.QT.values[i, k - 1] +
c4 * self.EnvVar.QT.values[k]
) / c1,
ref_state.rho0_half[k] * self.UpdVar.Area.values[i, k] * dti_ * self.UpdVar.QT.values[i, k] - adv + m_k * (entr - detr)
) / (ref_state.rho0_half[k] * self.UpdVar.Area.new[i, k] * dti_),
0.0,
)

Expand Down

0 comments on commit 6a5637d

Please sign in to comment.