From 21b6d398c29df6b54b91bcfe9ae4038c956d0596 Mon Sep 17 00:00:00 2001 From: Zhaoyi Shen <11598433+szy21@users.noreply.github.com> Date: Fri, 23 Aug 2024 23:12:53 -0700 Subject: [PATCH] update rrtmgp --- NEWS.md | 3 + Project.toml | 4 +- .../longrun_configs/amip_target_diagedmf.yml | 2 +- docs/Manifest.toml | 92 +++++++++++-------- examples/Manifest.toml | 8 +- examples/Project.toml | 1 - perf/Manifest.toml | 75 ++++++++------- perf/Project.toml | 1 - src/callbacks/callbacks.jl | 78 +++++++++++----- .../radiation/RRTMGPInterface.jl | 82 +++++++++++------ .../radiation/radiation.jl | 17 +++- .../radiation/radiation_utilities.jl | 20 +--- test/Project.toml | 1 - 13 files changed, 229 insertions(+), 155 deletions(-) diff --git a/NEWS.md b/NEWS.md index 2a4e33258d..738df9fe1c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,6 +3,9 @@ ClimaAtmos.jl Release Notes Main ------- +- Update RRTMGP and allow multiple aerosols for radiation. + Note: Don't use sea salt as there is an issue with the lookup + table. PR [#3264](https://github.com/CliMA/ClimaAtmos.jl/pull/3264) v0.27.4 ------- diff --git a/Project.toml b/Project.toml index 9e5b3fc141..0456c129a7 100644 --- a/Project.toml +++ b/Project.toml @@ -26,7 +26,6 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab" NVTX = "5da4648a-3479-48b8-97b9-01cb529c0a1f" -Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" RRTMGP = "a01a1ee8-cea4-48fc-987c-fc7878d79da1" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" @@ -58,8 +57,7 @@ LinearAlgebra = "1" Logging = "1" NCDatasets = "0.14.2" NVTX = "0.3" -Pkg = "1.9" -RRTMGP = "0.17" +RRTMGP = "0.19" SciMLBase = "2.12" StaticArrays = "1.7" Statistics = "1" diff --git a/config/longrun_configs/amip_target_diagedmf.yml b/config/longrun_configs/amip_target_diagedmf.yml index 3cb2b3a012..5d1a4301e9 100644 --- a/config/longrun_configs/amip_target_diagedmf.yml +++ b/config/longrun_configs/amip_target_diagedmf.yml @@ -15,7 +15,7 @@ dt_cloud_fraction: "1hours" insolation: "timevarying" prescribe_ozone: true aerosol_radiation: true -prescribed_aerosols: ["CB1", "CB2", "DST01", "OC1", "OC2", "SO4", "SSLT01"] +prescribed_aerosols: ["CB1", "CB2", "DST01", "OC1", "OC2", "SO4"] surface_setup: "DefaultMoninObukhov" turbconv: "diagnostic_edmfx" ode_algo: ARS343 diff --git a/docs/Manifest.toml b/docs/Manifest.toml index 7a0a1597bc..65a9f74bd4 100644 --- a/docs/Manifest.toml +++ b/docs/Manifest.toml @@ -297,7 +297,7 @@ weakdeps = ["SparseArrays"] ChainRulesCoreSparseArraysExt = "SparseArrays" [[deps.ClimaAtmos]] -deps = ["Adapt", "ArgParse", "ArtifactWrappers", "Artifacts", "AtmosphericProfilesLibrary", "ClimaComms", "ClimaCore", "ClimaDiagnostics", "ClimaParams", "ClimaTimeSteppers", "ClimaUtilities", "CloudMicrophysics", "Dates", "DiffEqBase", "FastGaussQuadrature", "Insolation", "Interpolations", "LazyArtifacts", "LinearAlgebra", "Logging", "NCDatasets", "NVTX", "Pkg", "RRTMGP", "SciMLBase", "StaticArrays", "Statistics", "SurfaceFluxes", "Thermodynamics", "YAML"] +deps = ["Adapt", "ArgParse", "ArtifactWrappers", "Artifacts", "AtmosphericProfilesLibrary", "ClimaComms", "ClimaCore", "ClimaDiagnostics", "ClimaParams", "ClimaTimeSteppers", "ClimaUtilities", "CloudMicrophysics", "Dates", "DiffEqBase", "FastGaussQuadrature", "Insolation", "Interpolations", "LazyArtifacts", "LinearAlgebra", "Logging", "NCDatasets", "NVTX", "RRTMGP", "SciMLBase", "StaticArrays", "Statistics", "SurfaceFluxes", "Thermodynamics", "YAML"] path = ".." uuid = "b2c96348-7fb7-4fe0-8da9-78d88439e717" version = "0.27.4" @@ -389,9 +389,9 @@ version = "0.1.13" [[deps.CloudMicrophysics]] deps = ["ClimaParams", "DocStringExtensions", "ForwardDiff", "HCubature", "LazyArtifacts", "QuadGK", "RootSolvers", "SpecialFunctions", "Thermodynamics"] -git-tree-sha1 = "26ae1a08520651f7de266e6c76c06521ce7c54bb" +git-tree-sha1 = "86c154ff7a7850b7a5cb2aa4b409933a865b1de8" uuid = "6a9e3e04-43cd-43ba-94b9-e8782df3c71b" -version = "0.22.2" +version = "0.22.3" [deps.CloudMicrophysics.extensions] EmulatorModelsExt = ["DataFrames", "MLJ"] @@ -497,14 +497,14 @@ uuid = "2569d6c7-a4a2-43d3-a901-331e8e4be471" version = "0.2.3" [[deps.ConstructionBase]] -deps = ["LinearAlgebra"] -git-tree-sha1 = "a33b7ced222c6165f624a3f2b55945fac5a598d9" +git-tree-sha1 = "76219f1ed5771adbb096743bff43fb5fdd4c1157" uuid = "187b0558-2788-49d3-abe0-74a17ed4e7c9" -version = "1.5.7" -weakdeps = ["IntervalSets", "StaticArrays"] +version = "1.5.8" +weakdeps = ["IntervalSets", "LinearAlgebra", "StaticArrays"] [deps.ConstructionBase.extensions] ConstructionBaseIntervalSetsExt = "IntervalSets" + ConstructionBaseLinearAlgebraExt = "LinearAlgebra" ConstructionBaseStaticArraysExt = "StaticArrays" [[deps.Contour]] @@ -524,10 +524,10 @@ uuid = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f" version = "4.1.1" [[deps.CubedSphere]] -deps = ["Elliptic", "FFTW", "Printf", "ProgressBars", "SpecialFunctions", "TaylorSeries", "Test"] -git-tree-sha1 = "10134667d7d3569b191a65801514271b8a93b292" +deps = ["Elliptic", "FFTW", "Printf", "ProgressBars", "SpecialFunctions", "TaylorSeries"] +git-tree-sha1 = "049f692019f52ad3b043edf20ef25ebd7b38eb94" uuid = "7445602f-e544-4518-8976-18f8e8ae6cdb" -version = "0.2.5" +version = "0.2.6" [[deps.DataAPI]] git-tree-sha1 = "abe83f3a2f1b857aac70ef8b269080af17764bbe" @@ -551,9 +551,9 @@ uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" [[deps.DelaunayTriangulation]] deps = ["AdaptivePredicates", "EnumX", "ExactPredicates", "Random"] -git-tree-sha1 = "88a2c530da3dd3bf4282267925d2c16c8efcd3fc" +git-tree-sha1 = "9903123ab7fc5e55053292aff04ff5d7aff92633" uuid = "927a84f5-c5f4-47a5-9785-b46e178433df" -version = "1.1.4" +version = "1.3.0" [[deps.DelimitedFiles]] deps = ["Mmap"] @@ -597,12 +597,13 @@ version = "6.154.0" [[deps.DiffEqCallbacks]] deps = ["DataStructures", "DiffEqBase", "ForwardDiff", "Functors", "LinearAlgebra", "Markdown", "NonlinearSolve", "Parameters", "RecipesBase", "RecursiveArrayTools", "SciMLBase", "StaticArraysCore"] -git-tree-sha1 = "9c802bf34741e2b4942912709321e87b7cbed023" +git-tree-sha1 = "19dbd44d18bbfdfcf5e56c99cea9b0ed23df350a" uuid = "459566f4-90b8-5000-8ac3-15dfb0a30def" -version = "3.9.0" +version = "3.9.1" [deps.DiffEqCallbacks.weakdeps] OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" + OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" Sundials = "c3572dad-4567-51f8-b174-8c6c989267f4" [[deps.DiffResults]] @@ -619,9 +620,9 @@ version = "1.15.1" [[deps.DifferentiationInterface]] deps = ["ADTypes", "Compat", "DocStringExtensions", "FillArrays", "LinearAlgebra", "PackageExtensionCompat", "SparseArrays", "SparseMatrixColorings"] -git-tree-sha1 = "e53e4eb7f8e7b25656ea17263b0c22f129091eeb" +git-tree-sha1 = "9b23f9a816790b8ab9914c3c86321a546e92cbe7" uuid = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63" -version = "0.5.15" +version = "0.5.17" [deps.DifferentiationInterface.extensions] DifferentiationInterfaceChainRulesCoreExt = "ChainRulesCore" @@ -950,11 +951,16 @@ git-tree-sha1 = "eb6f1f48aa994f3018cbd029a17863c6535a266d" uuid = "d54b0c1a-921d-58e0-8e36-89d8069c0969" version = "0.5.8" +[[deps.GeoFormatTypes]] +git-tree-sha1 = "59107c179a586f0fe667024c5eb7033e81333271" +uuid = "68eda718-8dee-11e9-39e7-89f7f65f511f" +version = "0.4.2" + [[deps.GeoInterface]] -deps = ["Extents"] -git-tree-sha1 = "9fff8990361d5127b770e3454488360443019bb3" +deps = ["Extents", "GeoFormatTypes"] +git-tree-sha1 = "5921fc0704e40c024571eca551800c699f86ceb4" uuid = "cf35fbd7-0cd7-5166-be24-54bfbe79505f" -version = "1.3.5" +version = "1.3.6" [[deps.GeometryBasics]] deps = ["EarCut_jll", "Extents", "GeoInterface", "IterTools", "LinearAlgebra", "StaticArrays", "StructArrays", "Tables"] @@ -1045,10 +1051,10 @@ version = "0.17.2" MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195" [[deps.HDF5_jll]] -deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "LazyArtifacts", "LibCURL_jll", "Libdl", "MPICH_jll", "MPIPreferences", "MPItrampoline_jll", "MicrosoftMPI_jll", "OpenMPI_jll", "OpenSSL_jll", "TOML", "Zlib_jll", "libaec_jll"] -git-tree-sha1 = "82a471768b513dc39e471540fdadc84ff80ff997" +deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "LLVMOpenMP_jll", "LazyArtifacts", "LibCURL_jll", "Libdl", "MPICH_jll", "MPIPreferences", "MPItrampoline_jll", "MicrosoftMPI_jll", "OpenMPI_jll", "OpenSSL_jll", "TOML", "Zlib_jll", "libaec_jll"] +git-tree-sha1 = "38c8874692d48d5440d5752d6c74b0c6b0b60739" uuid = "0234f1f7-429e-5d53-9886-15a909be8d59" -version = "1.14.3+3" +version = "1.14.2+1" [[deps.HarfBuzz_jll]] deps = ["Artifacts", "Cairo_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "Graphite2_jll", "JLLWrappers", "Libdl", "Libffi_jll"] @@ -1360,9 +1366,9 @@ version = "1.2.2" [[deps.LazyArrays]] deps = ["ArrayLayouts", "FillArrays", "LinearAlgebra", "MacroTools", "SparseArrays"] -git-tree-sha1 = "507b423197fdd9e77b74aa2532c0a05eb7eb4004" +git-tree-sha1 = "360f6039babd6e4d6364eff0d4fc9120834a2d9a" uuid = "5078a376-72f3-5289-bfd5-ec5146d43c02" -version = "2.2.0" +version = "2.2.1" [deps.LazyArrays.extensions] LazyArraysBandedMatricesExt = "BandedMatrices" @@ -1708,10 +1714,10 @@ uuid = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" version = "1.0.2" [[deps.NetCDF_jll]] -deps = ["Artifacts", "Blosc_jll", "Bzip2_jll", "HDF5_jll", "JLLWrappers", "LazyArtifacts", "LibCURL_jll", "Libdl", "MPICH_jll", "MPIPreferences", "MPItrampoline_jll", "MicrosoftMPI_jll", "OpenMPI_jll", "TOML", "XML2_jll", "Zlib_jll", "Zstd_jll", "libzip_jll"] -git-tree-sha1 = "4686378c4ae1d1948cfbe46c002a11a4265dcb07" +deps = ["Artifacts", "Blosc_jll", "Bzip2_jll", "HDF5_jll", "JLLWrappers", "LibCURL_jll", "Libdl", "OpenMPI_jll", "XML2_jll", "Zlib_jll", "Zstd_jll", "libzip_jll"] +git-tree-sha1 = "a8af1798e4eb9ff768ce7fdefc0e957097793f15" uuid = "7243133f-43d8-5620-bbf4-c2c921802cf3" -version = "400.902.211+1" +version = "400.902.209+0" [[deps.Netpbm]] deps = ["FileIO", "ImageCore", "ImageMetadata"] @@ -1804,16 +1810,16 @@ uuid = "05823500-19ac-5b8b-9628-191a04bc5112" version = "0.8.1+2" [[deps.OpenMPI_jll]] -deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "LazyArtifacts", "Libdl", "MPIPreferences", "TOML"] -git-tree-sha1 = "e25c1778a98e34219a00455d6e4384e017ea9762" +deps = ["Artifacts", "CompilerSupportLibraries_jll", "Hwloc_jll", "JLLWrappers", "LazyArtifacts", "Libdl", "MPIPreferences", "TOML", "Zlib_jll"] +git-tree-sha1 = "bfce6d523861a6c562721b262c0d1aaeead2647f" uuid = "fe0851c0-eecd-5654-98d4-656369965a5c" -version = "4.1.6+0" +version = "5.0.5+0" [[deps.OpenSSL_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] -git-tree-sha1 = "a028ee3cb5641cccc4c24e90c36b0a4f7707bdf5" +git-tree-sha1 = "1b35263570443fdd9e76c76b7062116e2f374ab8" uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95" -version = "3.0.14+0" +version = "3.0.15+0" [[deps.OpenSpecFun_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Pkg"] @@ -2006,9 +2012,9 @@ uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" [[deps.RRTMGP]] deps = ["Adapt", "Artifacts", "ClimaComms", "DocStringExtensions", "Random"] -git-tree-sha1 = "866d94b4cf46fe3a0ffd35d1414a3a4181c9db08" +git-tree-sha1 = "d5be00bea8b5997ab318b2b9f0ca72e9bb9d2997" uuid = "a01a1ee8-cea4-48fc-987c-fc7878d79da1" -version = "0.17.0" +version = "0.19.0" [deps.RRTMGP.extensions] CreateParametersExt = "ClimaParams" @@ -2443,9 +2449,9 @@ weakdeps = ["ClimaParams"] [[deps.SymbolicIndexingInterface]] deps = ["Accessors", "ArrayInterface", "RuntimeGeneratedFunctions", "StaticArraysCore"] -git-tree-sha1 = "c9fce29fb41a10677e24f74421ebe31220b81ad0" +git-tree-sha1 = "988e04b34a4c3b824fb656f542473df99a4f610d" uuid = "2efcf032-c050-4f8e-a9bb-153293bab1f5" -version = "0.3.28" +version = "0.3.30" [[deps.TOML]] deps = ["Dates"] @@ -2471,13 +2477,21 @@ version = "1.10.0" [[deps.TaylorSeries]] deps = ["LinearAlgebra", "Markdown", "Requires", "SparseArrays"] -git-tree-sha1 = "1c7170668366821b0c4c4fe03ee78f8d6cf36e2c" +git-tree-sha1 = "90c9bc500f4c5cdd235c81503ec91b2048f06423" uuid = "6aa5eb33-94cf-58f4-a9d0-e4b2c4fc25ea" -version = "0.16.0" -weakdeps = ["IntervalArithmetic"] +version = "0.17.8" [deps.TaylorSeries.extensions] TaylorSeriesIAExt = "IntervalArithmetic" + TaylorSeriesJLD2Ext = "JLD2" + TaylorSeriesRATExt = "RecursiveArrayTools" + TaylorSeriesSAExt = "StaticArrays" + + [deps.TaylorSeries.weakdeps] + IntervalArithmetic = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253" + JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" + RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" + StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" [[deps.TensorCore]] deps = ["LinearAlgebra"] diff --git a/examples/Manifest.toml b/examples/Manifest.toml index 0b0edeb55d..4cd4a7c694 100644 --- a/examples/Manifest.toml +++ b/examples/Manifest.toml @@ -2,7 +2,7 @@ julia_version = "1.10.4" manifest_format = "2.0" -project_hash = "c1104a002a5c87ddfd3855d6cdf90ee1b0892b0a" +project_hash = "f170b98e0622d3f170fe6045d8258f49ebd31345" [[deps.ADTypes]] git-tree-sha1 = "99a6f5d0ce1c7c6afdb759daa30226f71c54f6b0" @@ -321,7 +321,7 @@ version = "0.5.7" Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" [[deps.ClimaAtmos]] -deps = ["Adapt", "ArgParse", "ArtifactWrappers", "Artifacts", "AtmosphericProfilesLibrary", "ClimaComms", "ClimaCore", "ClimaDiagnostics", "ClimaParams", "ClimaTimeSteppers", "ClimaUtilities", "CloudMicrophysics", "Dates", "DiffEqBase", "FastGaussQuadrature", "Insolation", "Interpolations", "LazyArtifacts", "LinearAlgebra", "Logging", "NCDatasets", "NVTX", "Pkg", "RRTMGP", "SciMLBase", "StaticArrays", "Statistics", "SurfaceFluxes", "Thermodynamics", "YAML"] +deps = ["Adapt", "ArgParse", "ArtifactWrappers", "Artifacts", "AtmosphericProfilesLibrary", "ClimaComms", "ClimaCore", "ClimaDiagnostics", "ClimaParams", "ClimaTimeSteppers", "ClimaUtilities", "CloudMicrophysics", "Dates", "DiffEqBase", "FastGaussQuadrature", "Insolation", "Interpolations", "LazyArtifacts", "LinearAlgebra", "Logging", "NCDatasets", "NVTX", "RRTMGP", "SciMLBase", "StaticArrays", "Statistics", "SurfaceFluxes", "Thermodynamics", "YAML"] path = ".." uuid = "b2c96348-7fb7-4fe0-8da9-78d88439e717" version = "0.27.4" @@ -2147,9 +2147,9 @@ uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" [[deps.RRTMGP]] deps = ["Adapt", "Artifacts", "ClimaComms", "DocStringExtensions", "Random"] -git-tree-sha1 = "866d94b4cf46fe3a0ffd35d1414a3a4181c9db08" +git-tree-sha1 = "d5be00bea8b5997ab318b2b9f0ca72e9bb9d2997" uuid = "a01a1ee8-cea4-48fc-987c-fc7878d79da1" -version = "0.17.0" +version = "0.19.0" weakdeps = ["CUDA", "ClimaParams"] [deps.RRTMGP.extensions] diff --git a/examples/Project.toml b/examples/Project.toml index c89bea3273..9c3319ba41 100644 --- a/examples/Project.toml +++ b/examples/Project.toml @@ -42,7 +42,6 @@ NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab" NCRegressionTests = "1789bc09-29e6-4c93-9c75-fe2179693664" NVTX = "5da4648a-3479-48b8-97b9-01cb529c0a1f" OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" -Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" PoissonRandom = "e409e4f3-bfea-5376-8464-e040bb5c01ab" Poppler_jll = "9c32591e-4766-534b-9725-b71a8799265b" PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d" diff --git a/perf/Manifest.toml b/perf/Manifest.toml index 004d5af568..1c013fadda 100644 --- a/perf/Manifest.toml +++ b/perf/Manifest.toml @@ -2,7 +2,7 @@ julia_version = "1.10.4" manifest_format = "2.0" -project_hash = "ddcac0ed38fc33b661f9c30ef50fd3e33f33a3e0" +project_hash = "3ab1b0110c2d964d6e0dd21cb828e8bc3dc7f429" [[deps.ADTypes]] git-tree-sha1 = "99a6f5d0ce1c7c6afdb759daa30226f71c54f6b0" @@ -332,7 +332,7 @@ version = "0.5.6" GeoMakie = "db073c08-6b98-4ee5-b6a4-5efafb3259c6" [[deps.ClimaAtmos]] -deps = ["Adapt", "ArgParse", "ArtifactWrappers", "Artifacts", "AtmosphericProfilesLibrary", "ClimaComms", "ClimaCore", "ClimaDiagnostics", "ClimaParams", "ClimaTimeSteppers", "ClimaUtilities", "CloudMicrophysics", "Dates", "DiffEqBase", "FastGaussQuadrature", "Insolation", "Interpolations", "LazyArtifacts", "LinearAlgebra", "Logging", "NCDatasets", "NVTX", "Pkg", "RRTMGP", "SciMLBase", "StaticArrays", "Statistics", "SurfaceFluxes", "Thermodynamics", "YAML"] +deps = ["Adapt", "ArgParse", "ArtifactWrappers", "Artifacts", "AtmosphericProfilesLibrary", "ClimaComms", "ClimaCore", "ClimaDiagnostics", "ClimaParams", "ClimaTimeSteppers", "ClimaUtilities", "CloudMicrophysics", "Dates", "DiffEqBase", "FastGaussQuadrature", "Insolation", "Interpolations", "LazyArtifacts", "LinearAlgebra", "Logging", "NCDatasets", "NVTX", "RRTMGP", "SciMLBase", "StaticArrays", "Statistics", "SurfaceFluxes", "Thermodynamics", "YAML"] path = ".." uuid = "b2c96348-7fb7-4fe0-8da9-78d88439e717" version = "0.27.4" @@ -548,14 +548,14 @@ uuid = "2569d6c7-a4a2-43d3-a901-331e8e4be471" version = "0.2.3" [[deps.ConstructionBase]] -deps = ["LinearAlgebra"] -git-tree-sha1 = "a33b7ced222c6165f624a3f2b55945fac5a598d9" +git-tree-sha1 = "76219f1ed5771adbb096743bff43fb5fdd4c1157" uuid = "187b0558-2788-49d3-abe0-74a17ed4e7c9" -version = "1.5.7" -weakdeps = ["IntervalSets", "StaticArrays"] +version = "1.5.8" +weakdeps = ["IntervalSets", "LinearAlgebra", "StaticArrays"] [deps.ConstructionBase.extensions] ConstructionBaseIntervalSetsExt = "IntervalSets" + ConstructionBaseLinearAlgebraExt = "LinearAlgebra" ConstructionBaseStaticArraysExt = "StaticArrays" [[deps.Contour]] @@ -576,15 +576,15 @@ version = "4.1.1" [[deps.Cthulhu]] deps = ["CodeTracking", "FoldingTrees", "InteractiveUtils", "JuliaSyntax", "PrecompileTools", "Preferences", "REPL", "TypedSyntax", "UUIDs", "Unicode", "WidthLimitedIO"] -git-tree-sha1 = "53095dc3aa2c007095a643c1cae5f544d1c960a6" +git-tree-sha1 = "6dd420e944a3be328f91088d6a1af02576ccba4b" uuid = "f68482b8-f384-11e8-15f7-abe071a5a75f" -version = "2.14.0" +version = "2.15.0" [[deps.CubedSphere]] -deps = ["Elliptic", "FFTW", "Printf", "ProgressBars", "SpecialFunctions", "TaylorSeries", "Test"] -git-tree-sha1 = "10134667d7d3569b191a65801514271b8a93b292" +deps = ["Elliptic", "FFTW", "Printf", "ProgressBars", "SpecialFunctions", "TaylorSeries"] +git-tree-sha1 = "049f692019f52ad3b043edf20ef25ebd7b38eb94" uuid = "7445602f-e544-4518-8976-18f8e8ae6cdb" -version = "0.2.5" +version = "0.2.6" [[deps.DataAPI]] git-tree-sha1 = "abe83f3a2f1b857aac70ef8b269080af17764bbe" @@ -614,9 +614,9 @@ uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" [[deps.DelaunayTriangulation]] deps = ["AdaptivePredicates", "EnumX", "ExactPredicates", "Random"] -git-tree-sha1 = "88a2c530da3dd3bf4282267925d2c16c8efcd3fc" +git-tree-sha1 = "9903123ab7fc5e55053292aff04ff5d7aff92633" uuid = "927a84f5-c5f4-47a5-9785-b46e178433df" -version = "1.1.4" +version = "1.3.0" [[deps.DelimitedFiles]] deps = ["Mmap"] @@ -660,12 +660,13 @@ version = "6.154.0" [[deps.DiffEqCallbacks]] deps = ["DataStructures", "DiffEqBase", "ForwardDiff", "Functors", "LinearAlgebra", "Markdown", "NonlinearSolve", "Parameters", "RecipesBase", "RecursiveArrayTools", "SciMLBase", "StaticArraysCore"] -git-tree-sha1 = "9c802bf34741e2b4942912709321e87b7cbed023" +git-tree-sha1 = "19dbd44d18bbfdfcf5e56c99cea9b0ed23df350a" uuid = "459566f4-90b8-5000-8ac3-15dfb0a30def" -version = "3.9.0" +version = "3.9.1" [deps.DiffEqCallbacks.weakdeps] OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" + OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8" Sundials = "c3572dad-4567-51f8-b174-8c6c989267f4" [[deps.DiffEqNoiseProcess]] @@ -694,9 +695,9 @@ version = "1.15.1" [[deps.DifferentiationInterface]] deps = ["ADTypes", "Compat", "DocStringExtensions", "FillArrays", "LinearAlgebra", "PackageExtensionCompat", "SparseArrays", "SparseMatrixColorings"] -git-tree-sha1 = "e53e4eb7f8e7b25656ea17263b0c22f129091eeb" +git-tree-sha1 = "9b23f9a816790b8ab9914c3c86321a546e92cbe7" uuid = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63" -version = "0.5.15" +version = "0.5.17" [deps.DifferentiationInterface.extensions] DifferentiationInterfaceChainRulesCoreExt = "ChainRulesCore" @@ -1037,11 +1038,16 @@ git-tree-sha1 = "eb6f1f48aa994f3018cbd029a17863c6535a266d" uuid = "d54b0c1a-921d-58e0-8e36-89d8069c0969" version = "0.5.8" +[[deps.GeoFormatTypes]] +git-tree-sha1 = "59107c179a586f0fe667024c5eb7033e81333271" +uuid = "68eda718-8dee-11e9-39e7-89f7f65f511f" +version = "0.4.2" + [[deps.GeoInterface]] -deps = ["Extents"] -git-tree-sha1 = "9fff8990361d5127b770e3454488360443019bb3" +deps = ["Extents", "GeoFormatTypes"] +git-tree-sha1 = "5921fc0704e40c024571eca551800c699f86ceb4" uuid = "cf35fbd7-0cd7-5166-be24-54bfbe79505f" -version = "1.3.5" +version = "1.3.6" [[deps.GeometryBasics]] deps = ["EarCut_jll", "Extents", "GeoInterface", "IterTools", "LinearAlgebra", "StaticArrays", "StructArrays", "Tables"] @@ -1356,9 +1362,9 @@ uuid = "9c1d0b0a-7046-5b2e-a33f-ea22f176ac7e" version = "0.2.1+0" [[deps.JuliaSyntax]] -git-tree-sha1 = "956ac689b31cd871a48fbb70978b798c5e95018a" +git-tree-sha1 = "937da4713526b96ac9a178e2035019d3b78ead4a" uuid = "70703baa-626e-46a2-a12c-08ffd08c73b4" -version = "0.4.9" +version = "0.4.10" [[deps.KLU]] deps = ["LinearAlgebra", "SparseArrays", "SuiteSparse_jll"] @@ -1963,9 +1969,9 @@ version = "4.1.6+0" [[deps.OpenSSL_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] -git-tree-sha1 = "a028ee3cb5641cccc4c24e90c36b0a4f7707bdf5" +git-tree-sha1 = "1b35263570443fdd9e76c76b7062116e2f374ab8" uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95" -version = "3.0.14+0" +version = "3.0.15+0" [[deps.OpenSpecFun_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Pkg"] @@ -2222,9 +2228,9 @@ uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" [[deps.RRTMGP]] deps = ["Adapt", "Artifacts", "ClimaComms", "DocStringExtensions", "Random"] -git-tree-sha1 = "866d94b4cf46fe3a0ffd35d1414a3a4181c9db08" +git-tree-sha1 = "d5be00bea8b5997ab318b2b9f0ca72e9bb9d2997" uuid = "a01a1ee8-cea4-48fc-987c-fc7878d79da1" -version = "0.17.0" +version = "0.19.0" weakdeps = ["CUDA", "ClimaParams"] [deps.RRTMGP.extensions] @@ -2686,9 +2692,9 @@ weakdeps = ["ClimaParams"] [[deps.SymbolicIndexingInterface]] deps = ["Accessors", "ArrayInterface", "RuntimeGeneratedFunctions", "StaticArraysCore"] -git-tree-sha1 = "c9fce29fb41a10677e24f74421ebe31220b81ad0" +git-tree-sha1 = "988e04b34a4c3b824fb656f542473df99a4f610d" uuid = "2efcf032-c050-4f8e-a9bb-153293bab1f5" -version = "0.3.28" +version = "0.3.30" [[deps.TOML]] deps = ["Dates"] @@ -2714,13 +2720,16 @@ version = "1.10.0" [[deps.TaylorSeries]] deps = ["LinearAlgebra", "Markdown", "Requires", "SparseArrays"] -git-tree-sha1 = "1c7170668366821b0c4c4fe03ee78f8d6cf36e2c" +git-tree-sha1 = "90c9bc500f4c5cdd235c81503ec91b2048f06423" uuid = "6aa5eb33-94cf-58f4-a9d0-e4b2c4fc25ea" -version = "0.16.0" -weakdeps = ["IntervalArithmetic"] +version = "0.17.8" +weakdeps = ["IntervalArithmetic", "JLD2", "RecursiveArrayTools", "StaticArrays"] [deps.TaylorSeries.extensions] TaylorSeriesIAExt = "IntervalArithmetic" + TaylorSeriesJLD2Ext = "JLD2" + TaylorSeriesRATExt = "RecursiveArrayTools" + TaylorSeriesSAExt = "StaticArrays" [[deps.TempestRemap_jll]] deps = ["Artifacts", "HDF5_jll", "JLLWrappers", "Libdl", "NetCDF_jll", "OpenBLAS32_jll"] @@ -2800,9 +2809,9 @@ version = "1.4.0" [[deps.TypedSyntax]] deps = ["CodeTracking", "JuliaSyntax"] -git-tree-sha1 = "9eb6c7118a6759ed23b22b9d955ab6bd76c98229" +git-tree-sha1 = "1b11092fc9eab26e21402ed313406a75d948634f" uuid = "d265eb64-f81a-44ad-a842-4247ee1503de" -version = "1.4.0" +version = "1.4.1" [[deps.URIs]] git-tree-sha1 = "67db6cc7b3821e19ebe75791a9dd19c9b1188f2b" diff --git a/perf/Project.toml b/perf/Project.toml index 8d62abf7d9..d6d127e780 100644 --- a/perf/Project.toml +++ b/perf/Project.toml @@ -43,7 +43,6 @@ NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab" NVTX = "5da4648a-3479-48b8-97b9-01cb529c0a1f" OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" PProf = "e4faabce-9ead-11e9-39d9-4379958e3056" -Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" PoissonRandom = "e409e4f3-bfea-5376-8464-e040bb5c01ab" Poppler_jll = "9c32591e-4766-534b-9725-b71a8799265b" PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d" diff --git a/src/callbacks/callbacks.jl b/src/callbacks/callbacks.jl index df4a2cd0c2..7aee740fa7 100644 --- a/src/callbacks/callbacks.jl +++ b/src/callbacks/callbacks.jl @@ -128,7 +128,7 @@ NVTX.@annotate function rrtmgp_model_callback!(integrator) thermo_params, TD.PhasePartition(thermo_params, ᶜts), ) - @. ᶜrh = TD.relative_humidity(thermo_params, ᶜts) + @. ᶜrh = min(max(TD.relative_humidity(thermo_params, ᶜts), 0), 1) end end @@ -168,15 +168,65 @@ NVTX.@annotate function rrtmgp_model_callback!(integrator) if !(radiation_mode isa RRTMGPI.GrayRadiation) if radiation_mode.aerosol_radiation ᶜΔz = Fields.Δz_field(Y.c) - ᶜaero_type = - Fields.array2field(rrtmgp_model.center_aerosol_type, axes(Y.c)) - @. ᶜaero_type = - set_aerosol_type(p.tracers.prescribed_aerosols_field) + + ᶜaero_conc = Fields.array2field( + rrtmgp_model.center_dust_column_mass_density, + axes(Y.c), + ) + @. ᶜaero_conc = 0 + for prescribed_aerosol_name in [:DST01, :DST02, :DST03, :DST04] + if prescribed_aerosol_name in + propertynames(p.tracers.prescribed_aerosols_field) + aerosol_field = getproperty( + p.tracers.prescribed_aerosols_field, + prescribed_aerosol_name, + ) + @. ᶜaero_conc += aerosol_field * Y.c.ρ * ᶜΔz + end + end + ᶜaero_conc = Fields.array2field( - rrtmgp_model.center_aerosol_column_mass_density, + rrtmgp_model.center_ss_column_mass_density, axes(Y.c), ) - @. ᶜaero_conc = maximum(p.tracers.prescribed_aerosols_field) * ᶜΔz + @. ᶜaero_conc = 0 + for prescribed_aerosol_name in [:SSLT01, :SSLT02, :SSLT03, :SSLT04] + if prescribed_aerosol_name in + propertynames(p.tracers.prescribed_aerosols_field) + aerosol_field = getproperty( + p.tracers.prescribed_aerosols_field, + prescribed_aerosol_name, + ) + @. ᶜaero_conc += aerosol_field * Y.c.ρ * ᶜΔz + end + end + + aerosol_names_pair = [ + (:center_so4_column_mass_density, :SO4), + (:center_bcpi_column_mass_density, :CB2), + (:center_bcpo_column_mass_density, :CB1), + (:center_ocpi_column_mass_density, :OC2), + (:center_ocpo_column_mass_density, :OC1), + ] + + for (rrtmgp_aerosol_name, prescribed_aerosol_name) in + aerosol_names_pair + ᶜaero_conc = Fields.array2field( + getproperty(rrtmgp_model, rrtmgp_aerosol_name), + axes(Y.c), + ) + if prescribed_aerosol_name in + propertynames(p.tracers.prescribed_aerosols_field) + aerosol_field = getproperty( + p.tracers.prescribed_aerosols_field, + prescribed_aerosol_name, + ) + @. ᶜaero_conc = aerosol_field * Y.c.ρ * ᶜΔz + else + @. ᶜaero_conc = 0 + end + end + end if :o3 in propertynames(p.tracers) ᶜvmr_o3 = Fields.array2field( @@ -273,20 +323,6 @@ function set_insolation_variables!(Y, p, t, ::TimeVaryingInsolation) end end -function set_aerosol_type(; - DST01 = 0, - SSLT01 = 0, - SO4 = 0, - CB1 = 0, - CB2 = 0, - OC1 = 0, - OC2 = 0, - _..., -) - return argmax(n -> (DST01, SSLT01, SO4, CB1, CB2, OC1, OC2)[n], 1:7) -end -set_aerosol_type(nt) = set_aerosol_type(; nt...) - NVTX.@annotate function save_state_to_disk_func(integrator, output_dir) (; t, u, p) = integrator Y = u diff --git a/src/parameterized_tendencies/radiation/RRTMGPInterface.jl b/src/parameterized_tendencies/radiation/RRTMGPInterface.jl index 4046a69209..a0c30fbdcf 100644 --- a/src/parameterized_tendencies/radiation/RRTMGPInterface.jl +++ b/src/parameterized_tendencies/radiation/RRTMGPInterface.jl @@ -500,7 +500,9 @@ function RRTMGPModel( nbnd_lw = 1 else local lookup_lw, idx_gases - data_loader("rrtmgp-gas-lw-g256.nc") do ds + data_loader( + RRTMGP.ArtifactPaths.get_lookup_filename(:gas, :lw), + ) do ds lookup_lw, idx_gases = RRTMGP.LookUpTables.LookUpLW(ds, FT, DA) end lookups = (; lookups..., lookup_lw, idx_gases) @@ -510,7 +512,9 @@ function RRTMGPModel( if !(radiation_mode isa ClearSkyRadiation) local lookup_lw_cld - data_loader(joinpath("rrtmgp-clouds-lw.nc")) do ds + data_loader( + RRTMGP.ArtifactPaths.get_lookup_filename(:cloud, :lw), + ) do ds lookup_lw_cld = use_pade_cloud_optics_mode ? RRTMGP.LookUpTables.PadeCld(ds, FT, DA) : @@ -519,9 +523,11 @@ function RRTMGPModel( lookups = (; lookups..., lookup_lw_cld) end if radiation_mode.aerosol_radiation - local lookup_lw_aero - data_loader(joinpath("rrtmgp-aerosols-merra-lw.nc")) do ds - lookup_lw_aero = + local lookup_lw_aero, idx_aerosol, idx_aerosize + data_loader( + RRTMGP.ArtifactPaths.get_lookup_filename(:aerosol, :lw), + ) do ds + lookup_lw_aero, idx_aerosol, idx_aerosize = RRTMGP.LookUpTables.LookUpAerosolMerra(ds, FT, DA) end else @@ -571,7 +577,9 @@ function RRTMGPModel( nbnd_sw = 1 else local lookup_sw, idx_gases - data_loader("rrtmgp-gas-sw-g224.nc") do ds + data_loader( + RRTMGP.ArtifactPaths.get_lookup_filename(:gas, :sw), + ) do ds lookup_sw, idx_gases = RRTMGP.LookUpTables.LookUpSW(ds, FT, DA) end lookups = (; lookups..., lookup_sw, idx_gases) @@ -581,7 +589,9 @@ function RRTMGPModel( if !(radiation_mode isa ClearSkyRadiation) local lookup_sw_cld - data_loader(joinpath("rrtmgp-clouds-sw.nc")) do ds + data_loader( + RRTMGP.ArtifactPaths.get_lookup_filename(:cloud, :sw), + ) do ds lookup_sw_cld = use_pade_cloud_optics_mode ? RRTMGP.LookUpTables.PadeCld(ds, FT, DA) : @@ -591,9 +601,11 @@ function RRTMGPModel( end if radiation_mode.aerosol_radiation - local lookup_sw_aero - data_loader(joinpath("rrtmgp-aerosols-merra-sw.nc")) do ds - lookup_sw_aero = + local lookup_sw_aero, idx_aerosol, idx_aerosize + data_loader( + RRTMGP.ArtifactPaths.get_lookup_filename(:aerosol, :sw), + ) do ds + lookup_sw_aero, idx_aerosol, idx_aerosize = RRTMGP.LookUpTables.LookUpAerosolMerra(ds, FT, DA) end else @@ -805,17 +817,34 @@ function RRTMGPModel( end if radiation_mode.aerosol_radiation - aero_type = DA{Int}(undef, nlay, ncol) - name = "center_aerosol_type" - set_and_save!(aero_type, name, t..., dict) - aero_size = DA{FT}(undef, nlay, ncol) - name = "center_aerosol_radius" - set_and_save!(aero_size, name, t..., dict) - aero_mass = DA{FT}(undef, nlay, ncol) - name = "center_aerosol_column_mass_density" - set_and_save!(aero_mass, name, t..., dict) + aero_mask = DA{Bool}(undef, nlay, ncol) + + n_aerosol_sizes = maximum(values(idx_aerosize)) + n_aerosols = length(idx_aerosol) + # See the lookup table in RRTMGP for the order of aerosols + aero_size = DA{FT}(undef, n_aerosol_sizes, nlay, ncol) + aero_mass = DA{FT}(undef, n_aerosols, nlay, ncol) + aerosol_size_names = ["dust", "ss"] + aerosol_names = + ["dust", "ss", "so4", "bcpi", "bcpo", "ocpi", "ocpo"] + for (i, name) in enumerate(aerosol_size_names) + set_and_save!( + view(aero_size, i, :, :), + "center_$(name)_radius", + t..., + dict, + ) + end + for (i, name) in enumerate(aerosol_names) + set_and_save!( + view(aero_mass, i, :, :), + "center_$(name)_column_mass_density", + t..., + dict, + ) + end aerosol_state = RRTMGP.AtmosphericStates.AerosolState( - aero_type, + aero_mask, aero_size, aero_mass, ) @@ -835,6 +864,7 @@ function RRTMGPModel( cloud_state, aerosol_state, ) + end if use_one_scalar_mode @@ -1127,12 +1157,10 @@ update_boundary_layer_aerosol!(::Nothing) = nothing function update_boundary_layer_aerosol!( aerosol_state::RRTMGP.AtmosphericStates.AerosolState, ) - @views aerosol_state.aero_type[end, :] .= - aerosol_state.aero_type[end - 1, :] - @views aerosol_state.aero_size[end, :] .= - aerosol_state.aero_size[end - 1, :] - @views aerosol_state.aero_mass[end, :] .= - aerosol_state.aero_mass[end - 1, :] + @views aerosol_state.aero_size[:, end, :] .= + aerosol_state.aero_size[:, end - 1, :] + @views aerosol_state.aero_mass[:, end, :] .= + aerosol_state.aero_mass[:, end - 1, :] end function clip_values!(model) @@ -1245,12 +1273,10 @@ NVTX.@annotate function update_sw_fluxes!( end function update_net_fluxes!(_, model) - FT = eltype(model.face_flux) model.face_flux .= model.face_lw_flux .+ model.face_sw_flux end function update_net_fluxes!(::AllSkyRadiationWithClearSkyDiagnostics, model) - FT = eltype(model.face_flux) model.face_clear_flux .= model.face_clear_lw_flux .+ model.face_clear_sw_flux model.face_flux .= model.face_lw_flux .+ model.face_sw_flux diff --git a/src/parameterized_tendencies/radiation/radiation.jl b/src/parameterized_tendencies/radiation/radiation.jl index 287100be2e..eb6111f087 100644 --- a/src/parameterized_tendencies/radiation/radiation.jl +++ b/src/parameterized_tendencies/radiation/radiation.jl @@ -70,7 +70,9 @@ function radiation_model_cache( "inputs", "multiple_input4MIPs_radiation_RFMIP_UColorado-RFMIP-1-2_none.nc", ) - data_loader(file_name) do input_data + data_loader( + RRTMGP.ArtifactPaths.get_input_filename(:gas, :lw), + ) do input_data if radiation_mode isa RRTMGPI.GrayRadiation kwargs = (; lapse_rate = 3.5, @@ -206,9 +208,16 @@ function radiation_model_cache( if aerosol_radiation kwargs = (; kwargs..., - center_aerosol_type = 0, # initialized in callback - center_aerosol_radius = 0.2, # assuming fixed aerosol radius - center_aerosol_column_mass_density = NaN, # initialized in callback + # assuming fixed aerosol radius + center_dust_radius = 0.2, + center_ss_radius = 0.2, + center_dust_column_mass_density = NaN, # initialized in callback + center_ss_column_mass_density = NaN, # initialized in callback + center_so4_column_mass_density = NaN, # initialized in callback + center_bcpi_column_mass_density = NaN, # initialized in callback + center_bcpo_column_mass_density = NaN, # initialized in callback + center_ocpi_column_mass_density = NaN, # initialized in callback + center_ocpo_column_mass_density = NaN, # initialized in callback ) end end diff --git a/src/parameterized_tendencies/radiation/radiation_utilities.jl b/src/parameterized_tendencies/radiation/radiation_utilities.jl index 117b2280a9..233f424d41 100644 --- a/src/parameterized_tendencies/radiation/radiation_utilities.jl +++ b/src/parameterized_tendencies/radiation/radiation_utilities.jl @@ -1,27 +1,9 @@ -import Pkg import NCDatasets as NC -import RRTMGP ##### ##### RRTMGP ##### -""" - rrtmgp_artifact(file_name) - -Returns the filename of an artifact stored in -`RRTMGPReferenceData/`. -""" -function rrtmgp_artifact(file_name) - artifact_name = "rrtmgp-data" - artifacts_file = joinpath(pkgdir(RRTMGP), "test", "Artifacts.toml") - data_folder = joinpath( - Pkg.Artifacts.ensure_artifact_installed(artifact_name, artifacts_file), - "rrtmgp-data-1.8.1", - ) - return joinpath(data_folder, file_name) -end - """ data_loader(fn, file_name) @@ -30,7 +12,7 @@ Loads data from an `NCDataset` from the `RRTMGP.jl` artifact stored in dataset. """ function rrtmgp_data_loader(fn, file_name) - NC.Dataset(rrtmgp_artifact(file_name), "r") do ds + NC.Dataset(file_name, "r") do ds fn(ds) end end diff --git a/test/Project.toml b/test/Project.toml index 6ff05f4fd1..7e879672ad 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -30,7 +30,6 @@ NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab" NCRegressionTests = "1789bc09-29e6-4c93-9c75-fe2179693664" NVTX = "5da4648a-3479-48b8-97b9-01cb529c0a1f" OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" -Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" Profile = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79"