Skip to content

Commit

Permalink
Merge #2121 #2141
Browse files Browse the repository at this point in the history
2121: change edmfx advection r=trontrytel a=trontrytel

Closes #2106 

I wasn't sure if we also want to change the tke advection?

2141: Update dependencies r=charleskawczynski a=charleskawczynski

This PR upgrades the dependencies, including ClimaTimeSteppers. The new version fuses some operations, resulting in precision error differences.

Co-authored-by: Anna Jaruga <ajaruga@caltech.edu>
Co-authored-by: Charles Kawczynski <kawczynski.charles@gmail.com>
  • Loading branch information
3 people authored Sep 22, 2023
3 parents 0298a75 + c988043 + 7361335 commit 7d8a0c8
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 44 deletions.
29 changes: 16 additions & 13 deletions config/model_configs/edmfx_adv_test_box.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
dt_save_to_disk: "100secs"
job_id: "edmfx_adv_test_box"
initial_condition: "MoistAdiabaticProfileEDMFX"
x_max: 10000.0
hyperdiff: "true"
z_elem: 45
dt: "10secs"
t_end: "1000secs"
y_max: 10000.0
y_elem: 2
advection_test: true
turbconv: "edmfx"
x_elem: 2
dz_bottom: 30.0
ode_algo: "SSP33ShuOsher"
edmfx_upwinding: "first_order"
config: "box"
advection_test: true
kappa_4: 1.0e8
job_id: "edmfx_adv_test_box"
moist: "equil"
hyperdiff: "true"
kappa_4: 1e8
x_max: 1e4
y_max: 1e4
z_max: 3e4
x_elem: 2
y_elem: 2
z_elem: 45
dz_bottom: 30.0
dt: "10secs"
t_end: "3600secs"
dt_save_to_disk: "100secs"
toml: [toml/edmfx_box_advection.toml]
25 changes: 17 additions & 8 deletions docs/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,10 @@ uuid = "d414da3d-4745-48bb-8d80-42e94e092884"
version = "0.10.51"

[[deps.ClimaTimeSteppers]]
deps = ["CUDA", "ClimaComms", "DataStructures", "DiffEqBase", "DiffEqCallbacks", "KernelAbstractions", "Krylov", "LinearAlgebra", "LinearOperators", "SciMLBase", "StaticArrays"]
git-tree-sha1 = "54b602435b0107b6c2dfe7664e0f7ff5fc78fb91"
deps = ["CUDA", "ClimaComms", "Colors", "DataStructures", "DiffEqBase", "DiffEqCallbacks", "KernelAbstractions", "Krylov", "LinearAlgebra", "LinearOperators", "NVTX", "SciMLBase", "StaticArrays"]
git-tree-sha1 = "70b0118d12a137550f1626bf4c20ebb66a45f2e0"
uuid = "595c0a79-7f3d-439a-bc5a-b232dc3bde79"
version = "0.7.7"
version = "0.7.8"

[[deps.CloseOpenIntervals]]
deps = ["Static", "StaticArrayInterface"]
Expand Down Expand Up @@ -341,6 +341,11 @@ git-tree-sha1 = "52cb3ec90e8a8bea0e62e275ba577ad0f74821f7"
uuid = "ed09eef8-17a6-5b46-8889-db040fac31e3"
version = "0.3.2"

[[deps.ConcreteStructs]]
git-tree-sha1 = "f749037478283d372048690eb3b5f92a79432b34"
uuid = "2569d6c7-a4a2-43d3-a901-331e8e4be471"
version = "0.2.3"

[[deps.ConstructionBase]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "c53fc348ca4d40d7b371e71fd52251839080cbc9"
Expand Down Expand Up @@ -960,24 +965,28 @@ uuid = "5c8ed15e-5a4c-59e4-a42b-c7e8811fb125"
version = "2.5.2"

[[deps.LinearSolve]]
deps = ["ArrayInterface", "DocStringExtensions", "EnumX", "FastLapackInterface", "GPUArraysCore", "InteractiveUtils", "KLU", "Krylov", "Libdl", "LinearAlgebra", "PrecompileTools", "Preferences", "RecursiveFactorization", "Reexport", "Requires", "SciMLBase", "SciMLOperators", "Setfield", "SparseArrays", "Sparspak", "SuiteSparse", "UnPack"]
git-tree-sha1 = "69cbd612e6e67ba2f8121bc8725bc9d04d803599"
deps = ["ArrayInterface", "ConcreteStructs", "DocStringExtensions", "EnumX", "FastLapackInterface", "GPUArraysCore", "InteractiveUtils", "KLU", "Krylov", "Libdl", "LinearAlgebra", "PrecompileTools", "Preferences", "RecursiveFactorization", "Reexport", "Requires", "SciMLBase", "SciMLOperators", "Setfield", "SparseArrays", "Sparspak", "SuiteSparse", "UnPack"]
git-tree-sha1 = "dd70543d3c4fc712c14d67e2d35b90817e8bc37d"
uuid = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae"
version = "2.5.1"
version = "2.6.0"

[deps.LinearSolve.extensions]
LinearSolveBlockDiagonalsExt = "BlockDiagonals"
LinearSolveCUDAExt = "CUDA"
LinearSolveHYPREExt = "HYPRE"
LinearSolveIterativeSolversExt = "IterativeSolvers"
LinearSolveKernelAbstractionsExt = "KernelAbstractions"
LinearSolveKrylovKitExt = "KrylovKit"
LinearSolveMKLExt = "MKL_jll"
LinearSolveMetalExt = "Metal"
LinearSolvePardisoExt = "Pardiso"

[deps.LinearSolve.weakdeps]
BlockDiagonals = "0a1fb500-61f7-11e9-3c65-f5ef3456f9f0"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
HYPRE = "b5ffcf37-a2bd-41ab-a3da-4bd9bc8ad771"
IterativeSolvers = "42fd0dbc-a981-5370-80f2-aaf504508153"
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
MKL_jll = "856f044c-d86e-5d09-b602-aeab76dc8ba7"
Metal = "dde4c033-4e86-420c-a63e-0dd931031962"
Expand Down Expand Up @@ -1182,9 +1191,9 @@ version = "4.1.5+0"

[[deps.OpenSSL_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
git-tree-sha1 = "e78db7bd5c26fc5a6911b50a47ee302219157ea8"
git-tree-sha1 = "ceeda72c9fd6bbebc4f4f598560789145a8b6c4c"
uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95"
version = "3.0.10+0"
version = "3.0.11+0"

[[deps.OpenSpecFun_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Pkg"]
Expand Down
21 changes: 15 additions & 6 deletions examples/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,10 @@ uuid = "c8b6d40d-e815-466f-95ae-c48aefa668fa"
version = "0.7.1"

[[deps.ClimaTimeSteppers]]
deps = ["CUDA", "ClimaComms", "DataStructures", "DiffEqBase", "DiffEqCallbacks", "KernelAbstractions", "Krylov", "LinearAlgebra", "LinearOperators", "SciMLBase", "StaticArrays"]
git-tree-sha1 = "54b602435b0107b6c2dfe7664e0f7ff5fc78fb91"
deps = ["CUDA", "ClimaComms", "Colors", "DataStructures", "DiffEqBase", "DiffEqCallbacks", "KernelAbstractions", "Krylov", "LinearAlgebra", "LinearOperators", "NVTX", "SciMLBase", "StaticArrays"]
git-tree-sha1 = "70b0118d12a137550f1626bf4c20ebb66a45f2e0"
uuid = "595c0a79-7f3d-439a-bc5a-b232dc3bde79"
version = "0.7.7"
version = "0.7.8"

[[deps.CloseOpenIntervals]]
deps = ["Static", "StaticArrayInterface"]
Expand Down Expand Up @@ -429,6 +429,11 @@ git-tree-sha1 = "52cb3ec90e8a8bea0e62e275ba577ad0f74821f7"
uuid = "ed09eef8-17a6-5b46-8889-db040fac31e3"
version = "0.3.2"

[[deps.ConcreteStructs]]
git-tree-sha1 = "f749037478283d372048690eb3b5f92a79432b34"
uuid = "2569d6c7-a4a2-43d3-a901-331e8e4be471"
version = "0.2.3"

[[deps.ConcurrentUtilities]]
deps = ["Serialization", "Sockets"]
git-tree-sha1 = "5372dbbf8f0bdb8c700db5367132925c0771ef7e"
Expand Down Expand Up @@ -1389,24 +1394,28 @@ uuid = "5c8ed15e-5a4c-59e4-a42b-c7e8811fb125"
version = "2.5.2"

[[deps.LinearSolve]]
deps = ["ArrayInterface", "DocStringExtensions", "EnumX", "FastLapackInterface", "GPUArraysCore", "InteractiveUtils", "KLU", "Krylov", "Libdl", "LinearAlgebra", "PrecompileTools", "Preferences", "RecursiveFactorization", "Reexport", "Requires", "SciMLBase", "SciMLOperators", "Setfield", "SparseArrays", "Sparspak", "SuiteSparse", "UnPack"]
git-tree-sha1 = "69cbd612e6e67ba2f8121bc8725bc9d04d803599"
deps = ["ArrayInterface", "ConcreteStructs", "DocStringExtensions", "EnumX", "FastLapackInterface", "GPUArraysCore", "InteractiveUtils", "KLU", "Krylov", "Libdl", "LinearAlgebra", "PrecompileTools", "Preferences", "RecursiveFactorization", "Reexport", "Requires", "SciMLBase", "SciMLOperators", "Setfield", "SparseArrays", "Sparspak", "SuiteSparse", "UnPack"]
git-tree-sha1 = "dd70543d3c4fc712c14d67e2d35b90817e8bc37d"
uuid = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae"
version = "2.5.1"
version = "2.6.0"

[deps.LinearSolve.extensions]
LinearSolveBlockDiagonalsExt = "BlockDiagonals"
LinearSolveCUDAExt = "CUDA"
LinearSolveHYPREExt = "HYPRE"
LinearSolveIterativeSolversExt = "IterativeSolvers"
LinearSolveKernelAbstractionsExt = "KernelAbstractions"
LinearSolveKrylovKitExt = "KrylovKit"
LinearSolveMKLExt = "MKL_jll"
LinearSolveMetalExt = "Metal"
LinearSolvePardisoExt = "Pardiso"

[deps.LinearSolve.weakdeps]
BlockDiagonals = "0a1fb500-61f7-11e9-3c65-f5ef3456f9f0"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
HYPRE = "b5ffcf37-a2bd-41ab-a3da-4bd9bc8ad771"
IterativeSolvers = "42fd0dbc-a981-5370-80f2-aaf504508153"
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
MKL_jll = "856f044c-d86e-5d09-b602-aeab76dc8ba7"
Metal = "dde4c033-4e86-420c-a63e-0dd931031962"
Expand Down
21 changes: 15 additions & 6 deletions perf/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -345,10 +345,10 @@ uuid = "c8b6d40d-e815-466f-95ae-c48aefa668fa"
version = "0.7.1"

[[deps.ClimaTimeSteppers]]
deps = ["CUDA", "ClimaComms", "DataStructures", "DiffEqBase", "DiffEqCallbacks", "KernelAbstractions", "Krylov", "LinearAlgebra", "LinearOperators", "SciMLBase", "StaticArrays"]
git-tree-sha1 = "54b602435b0107b6c2dfe7664e0f7ff5fc78fb91"
deps = ["CUDA", "ClimaComms", "Colors", "DataStructures", "DiffEqBase", "DiffEqCallbacks", "KernelAbstractions", "Krylov", "LinearAlgebra", "LinearOperators", "NVTX", "SciMLBase", "StaticArrays"]
git-tree-sha1 = "70b0118d12a137550f1626bf4c20ebb66a45f2e0"
uuid = "595c0a79-7f3d-439a-bc5a-b232dc3bde79"
version = "0.7.7"
version = "0.7.8"

[[deps.CloseOpenIntervals]]
deps = ["Static", "StaticArrayInterface"]
Expand Down Expand Up @@ -440,6 +440,11 @@ git-tree-sha1 = "52cb3ec90e8a8bea0e62e275ba577ad0f74821f7"
uuid = "ed09eef8-17a6-5b46-8889-db040fac31e3"
version = "0.3.2"

[[deps.ConcreteStructs]]
git-tree-sha1 = "f749037478283d372048690eb3b5f92a79432b34"
uuid = "2569d6c7-a4a2-43d3-a901-331e8e4be471"
version = "0.2.3"

[[deps.ConcurrentUtilities]]
deps = ["Serialization", "Sockets"]
git-tree-sha1 = "5372dbbf8f0bdb8c700db5367132925c0771ef7e"
Expand Down Expand Up @@ -1441,24 +1446,28 @@ uuid = "5c8ed15e-5a4c-59e4-a42b-c7e8811fb125"
version = "2.5.2"

[[deps.LinearSolve]]
deps = ["ArrayInterface", "DocStringExtensions", "EnumX", "FastLapackInterface", "GPUArraysCore", "InteractiveUtils", "KLU", "Krylov", "Libdl", "LinearAlgebra", "PrecompileTools", "Preferences", "RecursiveFactorization", "Reexport", "Requires", "SciMLBase", "SciMLOperators", "Setfield", "SparseArrays", "Sparspak", "SuiteSparse", "UnPack"]
git-tree-sha1 = "69cbd612e6e67ba2f8121bc8725bc9d04d803599"
deps = ["ArrayInterface", "ConcreteStructs", "DocStringExtensions", "EnumX", "FastLapackInterface", "GPUArraysCore", "InteractiveUtils", "KLU", "Krylov", "Libdl", "LinearAlgebra", "PrecompileTools", "Preferences", "RecursiveFactorization", "Reexport", "Requires", "SciMLBase", "SciMLOperators", "Setfield", "SparseArrays", "Sparspak", "SuiteSparse", "UnPack"]
git-tree-sha1 = "dd70543d3c4fc712c14d67e2d35b90817e8bc37d"
uuid = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae"
version = "2.5.1"
version = "2.6.0"

[deps.LinearSolve.extensions]
LinearSolveBlockDiagonalsExt = "BlockDiagonals"
LinearSolveCUDAExt = "CUDA"
LinearSolveHYPREExt = "HYPRE"
LinearSolveIterativeSolversExt = "IterativeSolvers"
LinearSolveKernelAbstractionsExt = "KernelAbstractions"
LinearSolveKrylovKitExt = "KrylovKit"
LinearSolveMKLExt = "MKL_jll"
LinearSolveMetalExt = "Metal"
LinearSolvePardisoExt = "Pardiso"

[deps.LinearSolve.weakdeps]
BlockDiagonals = "0a1fb500-61f7-11e9-3c65-f5ef3456f9f0"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
HYPRE = "b5ffcf37-a2bd-41ab-a3da-4bd9bc8ad771"
IterativeSolvers = "42fd0dbc-a981-5370-80f2-aaf504508153"
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
MKL_jll = "856f044c-d86e-5d09-b602-aeab76dc8ba7"
Metal = "dde4c033-4e86-420c-a63e-0dd931031962"
Expand Down
2 changes: 1 addition & 1 deletion regression_tests/ref_counter.jl
Original file line number Diff line number Diff line change
@@ -1 +1 @@
127
128
30 changes: 20 additions & 10 deletions src/prognostic_equations/advection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ NVTX.@annotate function explicit_vertical_advection_tendency!(Yₜ, Y, p, t)
(; ᶜh_totʲs) = n > 0 && is_total_energy ? p : all_nothing
(; ᶠu³⁰) = advect_tke ? p : all_nothing
ᶜρa⁰ = advect_tke ? (n > 0 ? p.ᶜρa⁰ : Y.c.ρ) : nothing
ᶜρ⁰ = advect_tke ? (n > 0 ? p.ᶜρ⁰ : Y.c.ρ) : nothing
ᶜtke⁰ = advect_tke ? (n > 0 ? p.ᶜspecific⁰.tke : p.ᶜtke⁰) : nothing
ᶜ1 = p.ᶜtemp_scalar
ᶜa_scalar = p.ᶜtemp_scalar
ᶜω³ = p.ᶜtemp_CT3
ᶠω¹² = p.ᶠtemp_CT12
ᶠω¹²ʲs = p.ᶠtemp_CT12ʲs
Expand Down Expand Up @@ -139,24 +140,28 @@ NVTX.@annotate function explicit_vertical_advection_tendency!(Yₜ, Y, p, t)

# TODO: Move this to implicit_vertical_advection_tendency!.
for j in 1:n
@. ᶜ1[colidx] = one(Y.c.ρ[colidx])
@. ᶜa_scalar[colidx] =
draft_area(Y.c.sgsʲs.:($$j).ρa[colidx], ᶜρʲs.:($$j)[colidx])
vertical_transport!(
Yₜ.c.sgsʲs.:($j).ρa[colidx],
ᶜJ[colidx],
Y.c.sgsʲs.:($j).ρa[colidx],
ᶜρʲs.:($j)[colidx],
ᶠu³ʲs.:($j)[colidx],
ᶜ1[colidx],
ᶜa_scalar[colidx],
dt,
edmfx_upwinding,
)

if :ρae_tot in propertynames(Yₜ.c.sgsʲs.:($j))
@. ᶜa_scalar[colidx] =
ᶜh_totʲs.:($$j)[colidx] *
draft_area(Y.c.sgsʲs.:($$j).ρa[colidx], ᶜρʲs.:($$j)[colidx])
vertical_transport!(
Yₜ.c.sgsʲs.:($j).ρae_tot[colidx],
ᶜJ[colidx],
Y.c.sgsʲs.:($j).ρa[colidx],
ᶜρʲs.:($j)[colidx],
ᶠu³ʲs.:($j)[colidx],
ᶜh_totʲs.:($j)[colidx],
ᶜa_scalar[colidx],
dt,
edmfx_upwinding,
)
Expand All @@ -165,12 +170,15 @@ NVTX.@annotate function explicit_vertical_advection_tendency!(Yₜ, Y, p, t)
for (ᶜρaχʲₜ, ᶜχʲ, χ_name) in
matching_subfields(Yₜ.c.sgsʲs.:($j), ᶜspecificʲs.:($j))
χ_name == :e_tot && continue
@. ᶜa_scalar[colidx] =
ᶜχʲ[colidx] *
draft_area(Y.c.sgsʲs.:($$j).ρa[colidx], ᶜρʲs.:($$j)[colidx])
vertical_transport!(
ᶜρaχʲₜ[colidx],
ᶜJ[colidx],
Y.c.sgsʲs.:($j).ρa[colidx],
ᶜρʲs.:($j)[colidx],
ᶠu³ʲs.:($j)[colidx],
ᶜχʲ[colidx],
ᶜa_scalar[colidx],
dt,
edmfx_upwinding,
)
Expand All @@ -179,12 +187,14 @@ NVTX.@annotate function explicit_vertical_advection_tendency!(Yₜ, Y, p, t)

# TODO: Move this to implicit_vertical_advection_tendency!.
if use_prognostic_tke(turbconv_model) # advect_tke triggers allocations
@. ᶜa_scalar[colidx] =
ᶜtke⁰[colidx] * draft_area(ᶜρa⁰[colidx], ᶜρ⁰[colidx])
vertical_transport!(
Yₜ.c.sgs⁰.ρatke[colidx],
ᶜJ[colidx],
ᶜρa⁰[colidx],
ᶜρ⁰[colidx],
ᶠu³⁰[colidx],
ᶜtke⁰[colidx],
ᶜa_scalar[colidx],
dt,
edmfx_upwinding,
)
Expand Down
6 changes: 6 additions & 0 deletions toml/edmfx_box.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ type = "float"
alias = "surface_area"
value = 0.1
type = "float"

[EDMF_min_area]
alias = "min_area"
value = 1.0e-2
type = "float"
description = "Minimum area fraction per updraft. Parameter not described in the literature."
10 changes: 10 additions & 0 deletions toml/edmfx_box_advection.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[EDMF_surface_area]
alias = "surface_area"
value = 0
type = "float"

[EDMF_min_area]
alias = "min_area"
value = 1.0e-2
type = "float"
description = "Minimum area fraction per updraft. Parameter not described in the literature."

0 comments on commit 7d8a0c8

Please sign in to comment.