Skip to content

Commit

Permalink
Merge #575
Browse files Browse the repository at this point in the history
575: Add post-run tests, error if we do not run to t_max r=costachris a=charleskawczynski

Closes #574.

Co-authored-by: Charles Kawczynski <[email protected]>
  • Loading branch information
bors[bot] and charleskawczynski authored Nov 19, 2021
2 parents 691afa8 + c14c067 commit 74f799e
Show file tree
Hide file tree
Showing 17 changed files with 56 additions and 7 deletions.
2 changes: 2 additions & 0 deletions integration_tests/ARM_SGP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ end
end
nothing
end

include(joinpath("utils", "post_run_tests.jl"))
2 changes: 2 additions & 0 deletions integration_tests/Bomex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ end
end
nothing
end

include(joinpath("utils", "post_run_tests.jl"))
2 changes: 2 additions & 0 deletions integration_tests/DYCOMS_RF01.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ end
end
nothing
end

include(joinpath("utils", "post_run_tests.jl"))
2 changes: 2 additions & 0 deletions integration_tests/DryBubble.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ end
end
nothing
end

include(joinpath("utils", "post_run_tests.jl"))
2 changes: 2 additions & 0 deletions integration_tests/GABLS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ end
end
nothing
end

include(joinpath("utils", "post_run_tests.jl"))
2 changes: 2 additions & 0 deletions integration_tests/GATE_III.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ namelist["meta"]["uuid"] = "01"
ds_tc_filename = @time main(namelist; time_run = true)

@testset "GATE_III" begin end

include(joinpath("utils", "post_run_tests.jl"))
2 changes: 2 additions & 0 deletions integration_tests/LES_driven_SCM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ end
nothing

end

include(joinpath("utils", "post_run_tests.jl"))
2 changes: 2 additions & 0 deletions integration_tests/Nieuwstadt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ end
end
nothing
end

include(joinpath("utils", "post_run_tests.jl"))
2 changes: 2 additions & 0 deletions integration_tests/Rico.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ end
end
nothing
end

include(joinpath("utils", "post_run_tests.jl"))
2 changes: 2 additions & 0 deletions integration_tests/SP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ end
end
nothing
end

include(joinpath("utils", "post_run_tests.jl"))
2 changes: 2 additions & 0 deletions integration_tests/Soares.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ end
end
nothing
end

include(joinpath("utils", "post_run_tests.jl"))
2 changes: 2 additions & 0 deletions integration_tests/TRMM_LBA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ end
end
nothing
end

include(joinpath("utils", "post_run_tests.jl"))
2 changes: 2 additions & 0 deletions integration_tests/life_cycle_Tan2018.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ end
end
nothing
end

include(joinpath("utils", "post_run_tests.jl"))
2 changes: 1 addition & 1 deletion integration_tests/utils/generate_namelist.jl
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ function LES_driven_SCM(namelist_defaults)
namelist["grid"]["nz"] = 200

namelist["stats_io"]["frequency"] = 10.0
namelist["time_stepping"]["dt"] = 3.0
namelist["time_stepping"]["dt"] = 2.0
namelist["time_stepping"]["t_max"] = 3600.0 * 6

# use last 6 hours of LES simulation to drive LES
Expand Down
1 change: 1 addition & 0 deletions integration_tests/utils/main.jl
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ function run(sim::Simulation1d)
)

sim.skip_io || TC.close_files(sim.Stats) # #removeVarsHack
first(sol.t) == sim.TS.t_max || error("Could not run to t_max")
return
end

Expand Down
12 changes: 6 additions & 6 deletions integration_tests/utils/mse_tables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ all_best_mse["TRMM_LBA"]["Hvar_mean"] = 4347.874034179779
all_best_mse["TRMM_LBA"]["QTvar_mean"] = 2834.632990323496
#
all_best_mse["LES_driven_SCM"] = OrderedCollections.OrderedDict()
all_best_mse["LES_driven_SCM"]["qt_mean"] = 8.375126616070798
all_best_mse["LES_driven_SCM"]["v_mean"] = 3.234280171966482
all_best_mse["LES_driven_SCM"]["u_mean"] = 1.134423861786145
all_best_mse["LES_driven_SCM"]["temperature_mean"] = 0.0033437098531422594
all_best_mse["LES_driven_SCM"]["ql_mean"] = 412.3892161833214
all_best_mse["LES_driven_SCM"]["thetal_mean"] = 0.003642974955538725
all_best_mse["LES_driven_SCM"]["qt_mean"] = 8.435279342878445
all_best_mse["LES_driven_SCM"]["v_mean"] = 3.2617073734123214
all_best_mse["LES_driven_SCM"]["u_mean"] = 1.148743169726484
all_best_mse["LES_driven_SCM"]["temperature_mean"] = 0.003358421606334859
all_best_mse["LES_driven_SCM"]["ql_mean"] = 609.0141669187923
all_best_mse["LES_driven_SCM"]["thetal_mean"] = 0.003659402887362492
#
#################################
#################################
Expand Down
22 changes: 22 additions & 0 deletions integration_tests/utils/post_run_tests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@testset "Post-run tests" begin
isnan_or_inf(x) = isnan(x) || isinf(x)
NC.Dataset(ds_tc_filename, "r") do ds
profile = ds.group["profiles"]
@test !any(isnan_or_inf.(Array(profile["qt_mean"])))
@test !any(isnan_or_inf.(Array(profile["updraft_area"])))
@test !any(isnan_or_inf.(Array(profile["updraft_w"])))
@test !any(isnan_or_inf.(Array(profile["updraft_qt"])))
@test !any(isnan_or_inf.(Array(profile["updraft_thetal"])))
@test !any(isnan_or_inf.(Array(profile["u_mean"])))
@test !any(isnan_or_inf.(Array(profile["tke_mean"])))
@test !any(isnan_or_inf.(Array(profile["temperature_mean"])))
@test !any(isnan_or_inf.(Array(profile["ql_mean"])))
@test !any(isnan_or_inf.(Array(profile["qi_mean"])))
@test !any(isnan_or_inf.(Array(profile["thetal_mean"])))
@test !any(isnan_or_inf.(Array(profile["Hvar_mean"])))
@test !any(isnan_or_inf.(Array(profile["QTvar_mean"])))
@test !any(isnan_or_inf.(Array(profile["v_mean"])))
@test !any(isnan_or_inf.(Array(profile["qr_mean"])))
end
nothing
end

0 comments on commit 74f799e

Please sign in to comment.