diff --git a/config/model_configs/edmfx_adv_test_box.yml b/config/model_configs/edmfx_adv_test_box.yml index fc59c7bf964..9a54b0105be 100644 --- a/config/model_configs/edmfx_adv_test_box.yml +++ b/config/model_configs/edmfx_adv_test_box.yml @@ -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] diff --git a/docs/Manifest.toml b/docs/Manifest.toml index ea1ca38dffb..3012f5954e1 100644 --- a/docs/Manifest.toml +++ b/docs/Manifest.toml @@ -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"] @@ -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" @@ -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" @@ -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"] diff --git a/examples/Manifest.toml b/examples/Manifest.toml index 7a88238b0a7..88b22ae3851 100644 --- a/examples/Manifest.toml +++ b/examples/Manifest.toml @@ -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"] @@ -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" @@ -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" diff --git a/perf/Manifest.toml b/perf/Manifest.toml index 1c088e98df6..755e7f46257 100644 --- a/perf/Manifest.toml +++ b/perf/Manifest.toml @@ -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"] @@ -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" @@ -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" diff --git a/regression_tests/ref_counter.jl b/regression_tests/ref_counter.jl index c75acbe2ff1..a949a93dfcc 100644 --- a/regression_tests/ref_counter.jl +++ b/regression_tests/ref_counter.jl @@ -1 +1 @@ -127 +128 diff --git a/src/prognostic_equations/advection.jl b/src/prognostic_equations/advection.jl index 9e73101eaa7..94d4bbfb496 100644 --- a/src/prognostic_equations/advection.jl +++ b/src/prognostic_equations/advection.jl @@ -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 @@ -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, ) @@ -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, ) @@ -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, ) diff --git a/toml/edmfx_box.toml b/toml/edmfx_box.toml index 63ce6f56f85..9eb2be9b120 100644 --- a/toml/edmfx_box.toml +++ b/toml/edmfx_box.toml @@ -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." diff --git a/toml/edmfx_box_advection.toml b/toml/edmfx_box_advection.toml new file mode 100644 index 00000000000..d39ecbfaa8f --- /dev/null +++ b/toml/edmfx_box_advection.toml @@ -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."