diff --git a/docs/Manifest.toml b/docs/Manifest.toml index 2978c58ed..c2d80abff 100644 --- a/docs/Manifest.toml +++ b/docs/Manifest.toml @@ -1,25 +1,19 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.10.2" +julia_version = "1.10.3" manifest_format = "2.0" project_hash = "6c87fe520a2f2573c1d64ad2168076eae19c6786" [[deps.ADTypes]] -git-tree-sha1 = "fcdb00b4d412b80ab08e39978e3bdef579e5e224" +git-tree-sha1 = "daf26bbdec60d9ca1c0003b70f389d821ddb4224" uuid = "47edcb42-4c32-4615-8424-f2b9edc5f35b" -version = "1.0.0" +version = "1.2.1" weakdeps = ["ChainRulesCore", "EnzymeCore"] [deps.ADTypes.extensions] ADTypesChainRulesCoreExt = "ChainRulesCore" ADTypesEnzymeCoreExt = "EnzymeCore" -[[deps.AMD]] -deps = ["LinearAlgebra", "SparseArrays", "SuiteSparse_jll"] -git-tree-sha1 = "45a1272e3f809d36431e57ab22703c6896b8908f" -uuid = "14f7f29c-3bd6-536c-9a0b-7339e30b5a3e" -version = "0.5.3" - [[deps.ANSIColoredPrinters]] git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c" uuid = "a4c015fc-c6ff-483c-b24f-f7ea428134e9" @@ -73,10 +67,10 @@ weakdeps = ["StaticArrays"] AdaptStaticArraysExt = "StaticArrays" [[deps.AliasTables]] -deps = ["Random"] -git-tree-sha1 = "07591db28451b3e45f4c0088a2d5e986ae5aa92d" +deps = ["PtrArrays", "Random"] +git-tree-sha1 = "9876e1e164b144ca45e9e3198d0b689cadfed9ff" uuid = "66dad0bd-aa9a-41b7-9441-69ab47430ed8" -version = "1.1.1" +version = "1.1.3" [[deps.ArgTools]] uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" @@ -112,9 +106,9 @@ version = "7.10.0" [[deps.ArrayLayouts]] deps = ["FillArrays", "LinearAlgebra"] -git-tree-sha1 = "33207a8be6267bc389d0701e97a9bce6a4de68eb" +git-tree-sha1 = "29649b61e0313db0a7ad5ecf41210e4e85aea234" uuid = "4c555306-a7a7-4459-81d9-ec55ddd5c99a" -version = "1.9.2" +version = "1.9.3" weakdeps = ["SparseArrays"] [deps.ArrayLayouts.extensions] @@ -195,19 +189,20 @@ version = "0.5.0" [[deps.CPUSummary]] deps = ["CpuId", "IfElse", "PrecompileTools", "Static"] -git-tree-sha1 = "601f7e7b3d36f18790e2caf83a882d88e9b71ff1" +git-tree-sha1 = "585a387a490f1c4bd88be67eea15b93da5e85db7" uuid = "2a0fbf3d-bb9c-48f3-b0a9-814d99fd7ab9" -version = "0.2.4" +version = "0.2.5" [[deps.CUDA]] deps = ["AbstractFFTs", "Adapt", "BFloat16s", "CEnum", "CUDA_Driver_jll", "CUDA_Runtime_Discovery", "CUDA_Runtime_jll", "Crayons", "DataFrames", "ExprTools", "GPUArrays", "GPUCompiler", "KernelAbstractions", "LLVM", "LLVMLoopInfo", "LazyArtifacts", "Libdl", "LinearAlgebra", "Logging", "NVTX", "Preferences", "PrettyTables", "Printf", "Random", "Random123", "RandomNumbers", "Reexport", "Requires", "SparseArrays", "StaticArrays", "Statistics"] -git-tree-sha1 = "4e33522a036b39fc6f5cb7447ae3b28eb8fbe99b" +git-tree-sha1 = "b8c28cb78014f7ae81a652ce1524cba7667dea5c" uuid = "052768ef-5323-5732-b1bb-66c8b64840ba" -version = "5.3.3" -weakdeps = ["ChainRulesCore", "SpecialFunctions"] +version = "5.3.5" +weakdeps = ["ChainRulesCore", "EnzymeCore", "SpecialFunctions"] [deps.CUDA.extensions] ChainRulesCoreExt = "ChainRulesCore" + EnzymeCoreExt = "EnzymeCore" SpecialFunctionsExt = "SpecialFunctions" [[deps.CUDA_Driver_jll]] @@ -230,9 +225,9 @@ version = "0.12.1+0" [[deps.Cairo_jll]] deps = ["Artifacts", "Bzip2_jll", "CompilerSupportLibraries_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "JLLWrappers", "LZO_jll", "Libdl", "Pixman_jll", "Xorg_libXext_jll", "Xorg_libXrender_jll", "Zlib_jll", "libpng_jll"] -git-tree-sha1 = "a4c43f59baa34011e303e76f5c8c91bf58415aaf" +git-tree-sha1 = "a2f1c8c668c8e3cb4cca4e57a8efdb09067bb3fd" uuid = "83423d85-b0ee-5818-9007-b63ccbeb887a" -version = "1.18.0+1" +version = "1.18.0+2" [[deps.Calculus]] deps = ["LinearAlgebra"] @@ -276,7 +271,17 @@ version = "0.2.8" deps = ["ClimaComms", "Colors", "DataStructures", "DiffEqBase", "DiffEqCallbacks", "KernelAbstractions", "Krylov", "LinearAlgebra", "LinearOperators", "NVTX", "SciMLBase", "StaticArrays"] path = ".." uuid = "595c0a79-7f3d-439a-bc5a-b232dc3bde79" -version = "0.7.20" +version = "0.7.30" + + [deps.ClimaTimeSteppers.extensions] + ClimaTimeSteppersBenchmarkToolsExt = ["CUDA", "BenchmarkTools", "OrderedCollections", "StatsBase", "PrettyTables"] + + [deps.ClimaTimeSteppers.weakdeps] + BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" + CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" + OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" + PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d" + StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" [[deps.CloseOpenIntervals]] deps = ["Static", "StaticArrayInterface"] @@ -292,9 +297,9 @@ version = "0.7.4" [[deps.ColorSchemes]] deps = ["ColorTypes", "ColorVectorSpace", "Colors", "FixedPointNumbers", "PrecompileTools", "Random"] -git-tree-sha1 = "67c1f244b991cad9b0aa4b7540fb758c2488b129" +git-tree-sha1 = "4b270d6465eb21ae89b732182c20dc165f8bf9f2" uuid = "35d6a980-a343-548e-a6ea-1d62b119f2f4" -version = "3.24.0" +version = "3.25.0" [[deps.ColorTypes]] deps = ["FixedPointNumbers", "Random"] @@ -331,9 +336,9 @@ version = "0.3.0" [[deps.Compat]] deps = ["TOML", "UUIDs"] -git-tree-sha1 = "c955881e3c981181362ae4088b35995446298b80" +git-tree-sha1 = "b1c55339b7c6c350ee89f2c1604299660525b248" uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" -version = "4.14.0" +version = "4.15.0" weakdeps = ["Dates", "LinearAlgebra"] [deps.Compat.extensions] @@ -342,7 +347,7 @@ weakdeps = ["Dates", "LinearAlgebra"] [[deps.CompilerSupportLibraries_jll]] deps = ["Artifacts", "Libdl"] uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" -version = "1.1.0+0" +version = "1.1.1+0" [[deps.CompositionsBase]] git-tree-sha1 = "802bb88cd69dfd1509f6670416bd4434015693ad" @@ -574,9 +579,9 @@ version = "0.1.10" [[deps.Expat_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] -git-tree-sha1 = "4558ab818dcceaab612d1bb8c19cee87eda2b83c" +git-tree-sha1 = "1c6317308b9dc757616f0b5cb379db10494443a7" uuid = "2e619515-83b5-522b-bb60-26c02a35a201" -version = "2.5.0+0" +version = "2.6.2+0" [[deps.ExprTools]] git-tree-sha1 = "27415f162e6028e81c72b82ef756bf321213b6ec" @@ -629,9 +634,9 @@ uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" [[deps.FillArrays]] deps = ["LinearAlgebra"] -git-tree-sha1 = "57f08d5665e76397e96b168f9acc12ab17c84a68" +git-tree-sha1 = "0653c0a2396a6da5bc4766c43041ef5fd3efbe57" uuid = "1a297f60-69ca-5386-bcde-b61e274b549b" -version = "1.10.2" +version = "1.11.0" weakdeps = ["PDMats", "SparseArrays", "Statistics"] [deps.FillArrays.extensions] @@ -657,15 +662,15 @@ version = "2.23.1" [[deps.FixedPointNumbers]] deps = ["Statistics"] -git-tree-sha1 = "335bfdceacc84c5cdf16aadc768aa5ddfc5383cc" +git-tree-sha1 = "05882d6995ae5c12bb5f36dd2ed3f61c98cbb172" uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93" -version = "0.8.4" +version = "0.8.5" [[deps.Fontconfig_jll]] -deps = ["Artifacts", "Bzip2_jll", "Expat_jll", "FreeType2_jll", "JLLWrappers", "Libdl", "Libuuid_jll", "Pkg", "Zlib_jll"] -git-tree-sha1 = "21efd19106a55620a188615da6d3d06cd7f6ee03" +deps = ["Artifacts", "Bzip2_jll", "Expat_jll", "FreeType2_jll", "JLLWrappers", "Libdl", "Libuuid_jll", "Zlib_jll"] +git-tree-sha1 = "db16beca600632c95fc8aca29890d83788dd8b23" uuid = "a3f928ae-7b40-5064-980b-68af3947d34b" -version = "2.13.93+0" +version = "2.13.96+0" [[deps.Format]] git-tree-sha1 = "9c68794ef81b08086aeb32eeaf33531668d5f5fc" @@ -684,15 +689,15 @@ weakdeps = ["StaticArrays"] [[deps.FreeType2_jll]] deps = ["Artifacts", "Bzip2_jll", "JLLWrappers", "Libdl", "Zlib_jll"] -git-tree-sha1 = "d8db6a5a2fe1381c1ea4ef2cab7c69c2de7f9ea0" +git-tree-sha1 = "5c1d8ae0efc6c2e7b1fc502cbe25def8f661b7bc" uuid = "d7e528f0-a631-5988-bf34-fe36492bcfd7" -version = "2.13.1+0" +version = "2.13.2+0" [[deps.FriBidi_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "aa31987c2ba8704e23c6c8ba8a4f769d5d7e4f91" +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "1ed150b39aebcc805c26b93a8d0122c940f64ce2" uuid = "559328eb-81f9-559d-9380-de523a88c83c" -version = "1.0.10+0" +version = "1.0.14+0" [[deps.FunctionWrappers]] git-tree-sha1 = "d62485945ce5ae9c0c48f124a84998d755bae00e" @@ -723,9 +728,9 @@ version = "3.3.9+0" [[deps.GPUArrays]] deps = ["Adapt", "GPUArraysCore", "LLVM", "LinearAlgebra", "Printf", "Random", "Reexport", "Serialization", "Statistics"] -git-tree-sha1 = "68e8ff56a4a355a85d2784b94614491f8c900cde" +git-tree-sha1 = "38cb19b8a3e600e509dc36a6396ac74266d108c1" uuid = "0c68f7d7-f131-5f86-a1c3-88cf8149b2d7" -version = "10.1.0" +version = "10.1.1" [[deps.GPUArraysCore]] deps = ["Adapt"] @@ -740,16 +745,16 @@ uuid = "61eb1bfa-7361-4325-ad38-22787b887f55" version = "0.26.4" [[deps.GR]] -deps = ["Artifacts", "Base64", "DelimitedFiles", "Downloads", "GR_jll", "HTTP", "JSON", "Libdl", "LinearAlgebra", "Pkg", "Preferences", "Printf", "Random", "Serialization", "Sockets", "TOML", "Tar", "Test", "UUIDs", "p7zip_jll"] -git-tree-sha1 = "3437ade7073682993e092ca570ad68a2aba26983" +deps = ["Artifacts", "Base64", "DelimitedFiles", "Downloads", "GR_jll", "HTTP", "JSON", "Libdl", "LinearAlgebra", "Preferences", "Printf", "Random", "Serialization", "Sockets", "TOML", "Tar", "Test", "p7zip_jll"] +git-tree-sha1 = "ddda044ca260ee324c5fc07edb6d7cf3f0b9c350" uuid = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71" -version = "0.73.3" +version = "0.73.5" [[deps.GR_jll]] deps = ["Artifacts", "Bzip2_jll", "Cairo_jll", "FFMPEG_jll", "Fontconfig_jll", "FreeType2_jll", "GLFW_jll", "JLLWrappers", "JpegTurbo_jll", "Libdl", "Libtiff_jll", "Pixman_jll", "Qt6Base_jll", "Zlib_jll", "libpng_jll"] -git-tree-sha1 = "a96d5c713e6aa28c242b0d25c1347e258d6541ab" +git-tree-sha1 = "278e5e0f820178e8a26df3184fcb2280717c79b1" uuid = "d2c73de3-f751-5644-a686-071e5b155ba9" -version = "0.73.3+0" +version = "0.73.5+0" [[deps.GaussQuadrature]] deps = ["SpecialFunctions"] @@ -782,9 +787,9 @@ version = "2.44.0+2" [[deps.Glib_jll]] deps = ["Artifacts", "Gettext_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Libiconv_jll", "Libmount_jll", "PCRE2_jll", "Zlib_jll"] -git-tree-sha1 = "359a1ba2e320790ddbe4ee8b4d54a305c0ea2aff" +git-tree-sha1 = "7c82e6a6cd34e9d935e9aa4051b66c6ff3af59ba" uuid = "7746bdde-850d-59dc-9ae8-88ece973131d" -version = "2.80.0+0" +version = "2.80.2+0" [[deps.Graphite2_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -815,9 +820,9 @@ version = "1.14.3+3" [[deps.HTTP]] deps = ["Base64", "CodecZlib", "ConcurrentUtilities", "Dates", "ExceptionUnwrapping", "Logging", "LoggingExtras", "MbedTLS", "NetworkOptions", "OpenSSL", "Random", "SimpleBufferStream", "Sockets", "URIs", "UUIDs"] -git-tree-sha1 = "2c3ec1f90bb4a8f7beafb0cffea8a4c3f4e636ab" +git-tree-sha1 = "d1d712be3164d61d1fb98e7ce9bcbc6cc06b45ed" uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3" -version = "1.10.6" +version = "1.10.8" [[deps.HarfBuzz_jll]] deps = ["Artifacts", "Cairo_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "Graphite2_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Pkg"] @@ -938,9 +943,9 @@ version = "1.3.0" [[deps.JpegTurbo_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] -git-tree-sha1 = "3336abae9a713d2210bb57ab484b1e065edd7d23" +git-tree-sha1 = "c84a835e1a09b289ffcd2271bf2a337bbdda6637" uuid = "aacddb02-875f-59d6-b918-886e6ef4fbf8" -version = "3.0.2+0" +version = "3.0.3+0" [[deps.JuliaNVTXCallbacks_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -950,9 +955,9 @@ version = "0.2.1+0" [[deps.KernelAbstractions]] deps = ["Adapt", "Atomix", "InteractiveUtils", "LinearAlgebra", "MacroTools", "PrecompileTools", "Requires", "SparseArrays", "StaticArrays", "UUIDs", "UnsafeAtomics", "UnsafeAtomicsLLVM"] -git-tree-sha1 = "ed7167240f40e62d97c1f5f7735dea6de3cc5c49" +git-tree-sha1 = "db02395e4c374030c53dc28f3c1d33dec35f7272" uuid = "63c18a36-062a-441e-b654-da1e3ab1ce7c" -version = "0.9.18" +version = "0.9.19" weakdeps = ["EnzymeCore"] [deps.KernelAbstractions.extensions] @@ -971,16 +976,10 @@ uuid = "0b1a1467-8014-51b9-945f-bf0ae24f4b77" version = "0.6.1" [[deps.LAME_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "f6250b16881adf048549549fba48b1161acdac8c" +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "170b660facf5df5de098d866564877e119141cbd" uuid = "c1c5ebd0-6772-5130-a774-d5fcae4a789d" -version = "3.100.1+0" - -[[deps.LDLFactorizations]] -deps = ["AMD", "LinearAlgebra", "SparseArrays", "Test"] -git-tree-sha1 = "70f582b446a1c3ad82cf87e62b878668beef9d13" -uuid = "40e66cde-538c-5869-a4ad-c39174c6795b" -version = "0.10.1" +version = "3.100.2+0" [[deps.LERC_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -1016,10 +1015,10 @@ uuid = "1d63c593-3942-5779-bab2-d838dc0a180e" version = "15.0.7+0" [[deps.LZO_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "e5b909bcf985c5e2605737d2ce278ed791b89be6" +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "70c5da094887fd2cae843b8db33920bac4b6f07d" uuid = "dd4b983a-f0e5-5f8d-a1b7-129d4a5fb1ac" -version = "2.10.1+0" +version = "2.10.2+0" [[deps.LaTeXStrings]] git-tree-sha1 = "50901ebc375ed41dbf8058da26f9de442febbbec" @@ -1101,10 +1100,10 @@ uuid = "7e76a0d4-f3c7-5321-8279-8d96eeed0f29" version = "1.6.0+0" [[deps.Libgpg_error_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "c333716e46366857753e273ce6a69ee0945a6db9" +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "fbb1f2bef882392312feb1ede3615ddc1e9b99ed" uuid = "7add5ba3-2f88-524e-9cd5-f83b8a55f7b8" -version = "1.42.0+0" +version = "1.49.0+0" [[deps.Libiconv_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] @@ -1114,9 +1113,9 @@ version = "1.17.0+0" [[deps.Libmount_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] -git-tree-sha1 = "4b683b19157282f50bfd5dcaa2efe5295814ea22" +git-tree-sha1 = "0c4f9c4f1a50d8f35048fa0532dabbadf702f81e" uuid = "4b2f31a3-9ecc-558c-b454-b3730dcb73e9" -version = "2.40.0+0" +version = "2.40.1+0" [[deps.Libtiff_jll]] deps = ["Artifacts", "JLLWrappers", "JpegTurbo_jll", "LERC_jll", "Libdl", "XZ_jll", "Zlib_jll", "Zstd_jll"] @@ -1126,9 +1125,9 @@ version = "4.5.1+1" [[deps.Libuuid_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] -git-tree-sha1 = "27fd5cc10be85658cacfe11bb81bee216af13eda" +git-tree-sha1 = "5ee6203157c120d79034c748a2acba45b82b8807" uuid = "38a345b3-de98-5d2b-a5d3-14cd9215e700" -version = "2.40.0+0" +version = "2.40.1+0" [[deps.LineSearches]] deps = ["LinearAlgebra", "NLSolversBase", "NaNMath", "Parameters", "Printf"] @@ -1141,14 +1140,20 @@ deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"] uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" [[deps.LinearOperators]] -deps = ["FastClosures", "LDLFactorizations", "LinearAlgebra", "Printf", "Requires", "SparseArrays", "TimerOutputs"] -git-tree-sha1 = "f06df3a46255879cbccae1b5b6dcb16994c31be7" +deps = ["FastClosures", "LinearAlgebra", "Printf", "Requires", "SparseArrays", "TimerOutputs"] +git-tree-sha1 = "ae5d90280094348c32fda8bc8b5a88bb16514d43" uuid = "5c8ed15e-5a4c-59e4-a42b-c7e8811fb125" -version = "2.7.0" -weakdeps = ["ChainRulesCore"] +version = "2.8.0" [deps.LinearOperators.extensions] + LinearOperatorsCUDAExt = "CUDA" LinearOperatorsChainRulesCoreExt = "ChainRulesCore" + LinearOperatorsLDLFactorizationsExt = "LDLFactorizations" + + [deps.LinearOperators.weakdeps] + CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" + ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" + LDLFactorizations = "40e66cde-538c-5869-a4ad-c39174c6795b" [[deps.LogExpFunctions]] deps = ["DocStringExtensions", "IrrationalConstants", "LinearAlgebra"] @@ -1197,21 +1202,21 @@ version = "0.20.19" [[deps.MPICH_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Hwloc_jll", "JLLWrappers", "LazyArtifacts", "Libdl", "MPIPreferences", "TOML"] -git-tree-sha1 = "d8a7bf80c88326ebc98b7d38437208c3a0f20725" +git-tree-sha1 = "4099bb6809ac109bfc17d521dad33763bcf026b7" uuid = "7cb0a576-ebde-5e09-9194-50597f1243b4" -version = "4.2.1+0" +version = "4.2.1+1" [[deps.MPIPreferences]] deps = ["Libdl", "Preferences"] -git-tree-sha1 = "8f6af051b9e8ec597fa09d8885ed79fd582f33c9" +git-tree-sha1 = "c105fe467859e7f6e9a852cb15cb4301126fac07" uuid = "3da0fdf6-3ccc-4f1b-acd9-58baa6c99267" -version = "0.1.10" +version = "0.1.11" [[deps.MPItrampoline_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "LazyArtifacts", "Libdl", "MPIPreferences", "TOML"] -git-tree-sha1 = "3f884417b47a96d87e7c6219f8f7b30ce67f4f2c" +git-tree-sha1 = "ce0ca3dd147c43de175c5aff161315a424f4b8ac" uuid = "f1f71cc9-e9ae-5b93-9b94-4fe0e1ad3748" -version = "5.3.3+0" +version = "5.3.3+1" [[deps.MacroTools]] deps = ["Markdown", "Random"] @@ -1394,9 +1399,9 @@ version = "1.3.0" [[deps.Pixman_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "LLVMOpenMP_jll", "Libdl"] -git-tree-sha1 = "64779bc4c9784fee475689a1752ef4d5747c5e87" +git-tree-sha1 = "35621f10a7531bc8fa58f74610b1bfb70a3cfc6b" uuid = "30392449-352a-5448-841d-b1acce4e97dc" -version = "0.42.2+0" +version = "0.43.4+0" [[deps.Pkg]] deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] @@ -1443,9 +1448,9 @@ version = "1.40.4" [[deps.Polyester]] deps = ["ArrayInterface", "BitTwiddlingConvenienceFunctions", "CPUSummary", "IfElse", "ManualMemory", "PolyesterWeave", "Requires", "Static", "StaticArrayInterface", "StrideArraysCore", "ThreadingUtilities"] -git-tree-sha1 = "2ba5f33cbb51a85ef58a850749492b08f9bf2193" +git-tree-sha1 = "b3e2bae88cf07baf0a051fe09666b8ef97aefe93" uuid = "f517fe37-dbe3-4b94-8317-1923a5111588" -version = "0.7.13" +version = "0.7.14" [[deps.PolyesterWeave]] deps = ["BitTwiddlingConvenienceFunctions", "CPUSummary", "IfElse", "Static", "ThreadingUtilities"] @@ -1499,6 +1504,11 @@ git-tree-sha1 = "b437cdb0385ed38312d91d9c00c20f3798b30256" uuid = "49802e3a-d2f1-5c88-81d8-b72133a6f568" version = "1.5.1" +[[deps.PtrArrays]] +git-tree-sha1 = "f011fbb92c4d401059b2212c05c0601b70f8b759" +uuid = "43287f4e-b6f4-7ad1-bb20-aadabca52c3d" +version = "1.2.0" + [[deps.Qt6Base_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Fontconfig_jll", "Glib_jll", "JLLWrappers", "Libdl", "Libglvnd_jll", "OpenSSL_jll", "Vulkan_Loader_jll", "Xorg_libSM_jll", "Xorg_libXext_jll", "Xorg_libXrender_jll", "Xorg_libxcb_jll", "Xorg_xcb_util_cursor_jll", "Xorg_xcb_util_image_jll", "Xorg_xcb_util_keysyms_jll", "Xorg_xcb_util_renderutil_jll", "Xorg_xcb_util_wm_jll", "Zlib_jll", "libinput_jll", "xkbcommon_jll"] git-tree-sha1 = "37b7bb7aabf9a085e0044307e1717436117f2b3b" @@ -1545,9 +1555,9 @@ version = "0.6.12" [[deps.RecursiveArrayTools]] deps = ["Adapt", "ArrayInterface", "DocStringExtensions", "GPUArraysCore", "IteratorInterfaceExtensions", "LinearAlgebra", "RecipesBase", "SparseArrays", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface", "Tables"] -git-tree-sha1 = "d8f131090f2e44b145084928856a561c83f43b27" +git-tree-sha1 = "758bc86b90e9fee2edc4af2a750b0d3f2d5c02c5" uuid = "731186ca-8d62-57ce-b412-fbd966d074cd" -version = "3.13.0" +version = "3.19.0" [deps.RecursiveArrayTools.extensions] RecursiveArrayToolsFastBroadcastExt = "FastBroadcast" @@ -1597,10 +1607,10 @@ uuid = "79098fc4-a85e-5d69-aa6a-4863f24498fa" version = "0.7.1" [[deps.Rmath_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "6ed52fdd3382cf21947b15e8870ac0ddbff736da" +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "d483cd324ce5cf5d61b77930f0bbd6cb61927d21" uuid = "f50d1b31-88e8-58de-be2c-1cc44531875f" -version = "0.4.0+0" +version = "0.4.2+0" [[deps.RootSolvers]] deps = ["ForwardDiff"] @@ -1625,9 +1635,9 @@ version = "0.1.0" [[deps.SciMLBase]] deps = ["ADTypes", "ArrayInterface", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "EnumX", "FunctionWrappersWrappers", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "Markdown", "PrecompileTools", "Preferences", "Printf", "RecipesBase", "RecursiveArrayTools", "Reexport", "RuntimeGeneratedFunctions", "SciMLOperators", "SciMLStructures", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface", "Tables"] -git-tree-sha1 = "beb1f94b08c4976ed1db0ca01b9e6bac89706faf" +git-tree-sha1 = "265f1a7a804d8093fa0b17e33e45373a77e56ca5" uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462" -version = "2.35.0" +version = "2.38.0" [deps.SciMLBase.extensions] SciMLBaseChainRulesCoreExt = "ChainRulesCore" @@ -1655,9 +1665,9 @@ uuid = "c0aeaf25-5076-4817-a8d5-81caf7dfa961" version = "0.3.8" [[deps.SciMLStructures]] -git-tree-sha1 = "5833c10ce83d690c124beedfe5f621b50b02ba4d" +git-tree-sha1 = "d778a74df2f64059c38453b34abad1953b2b8722" uuid = "53ae85a6-f571-4167-b2af-e1d143709226" -version = "1.1.0" +version = "1.2.0" [[deps.Scratch]] deps = ["Dates"] @@ -1667,9 +1677,9 @@ version = "1.2.1" [[deps.SentinelArrays]] deps = ["Dates", "Random"] -git-tree-sha1 = "0e7508ff27ba32f26cd459474ca2ede1bc10991f" +git-tree-sha1 = "90b4f68892337554d31cdcdbe19e48989f26c7e6" uuid = "91c51154-3ec4-41a3-a24f-3f23e20d615c" -version = "1.4.1" +version = "1.4.3" [[deps.Serialization]] uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" @@ -1707,9 +1717,9 @@ version = "1.10.0" [[deps.SpecialFunctions]] deps = ["IrrationalConstants", "LogExpFunctions", "OpenLibm_jll", "OpenSpecFun_jll"] -git-tree-sha1 = "e2cfc4012a19088254b3950b85c3c1d8882d864d" +git-tree-sha1 = "2f5d4697f21388cbe1ff299430dd169ef97d7e14" uuid = "276daf66-3868-5448-9aa4-cd146d93841b" -version = "2.3.1" +version = "2.4.0" weakdeps = ["ChainRulesCore"] [deps.SpecialFunctions.extensions] @@ -1813,10 +1823,10 @@ uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" version = "7.2.1+1" [[deps.SymbolicIndexingInterface]] -deps = ["Accessors", "ArrayInterface", "MacroTools", "RuntimeGeneratedFunctions", "StaticArraysCore"] -git-tree-sha1 = "7a7be02e16d11c17e2407bab80c2dd1410f774cb" +deps = ["Accessors", "ArrayInterface", "RuntimeGeneratedFunctions", "StaticArraysCore"] +git-tree-sha1 = "b479c7a16803f08779ac5b7f9844a42621baeeda" uuid = "2efcf032-c050-4f8e-a9bb-153293bab1f5" -version = "0.3.17" +version = "0.3.21" [[deps.TOML]] deps = ["Dates"] @@ -1870,14 +1880,14 @@ version = "0.5.2" [[deps.TimerOutputs]] deps = ["ExprTools", "Printf"] -git-tree-sha1 = "f548a9e9c490030e545f72074a41edfd0e5bcdd7" +git-tree-sha1 = "5a13ae8a41237cff5ecf34f73eb1b8f42fff6531" uuid = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f" -version = "0.5.23" +version = "0.5.24" [[deps.TranscodingStreams]] -git-tree-sha1 = "71509f04d045ec714c4748c785a59045c3736349" +git-tree-sha1 = "5d54d076465da49d6746c647022f3b3674e64156" uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa" -version = "0.10.7" +version = "0.10.8" weakdeps = ["Random", "Test"] [deps.TranscodingStreams.extensions] @@ -1924,9 +1934,9 @@ version = "0.4.1" [[deps.Unitful]] deps = ["Dates", "LinearAlgebra", "Random"] -git-tree-sha1 = "3c793be6df9dd77a0cf49d80984ef9ff996948fa" +git-tree-sha1 = "dd260903fdabea27d9b6021689b3cd5401a57748" uuid = "1986cc42-f94f-5a68-af5c-568840ba703d" -version = "1.19.0" +version = "1.20.0" weakdeps = ["ConstructionBase", "InverseFunctions"] [deps.Unitful.extensions] @@ -1952,9 +1962,9 @@ version = "0.2.1" [[deps.UnsafeAtomicsLLVM]] deps = ["LLVM", "UnsafeAtomics"] -git-tree-sha1 = "323e3d0acf5e78a56dfae7bd8928c989b4f3083e" +git-tree-sha1 = "d9f5962fecd5ccece07db1ff006fb0b5271bdfdd" uuid = "d80eeb9a-aca5-4d75-85e5-170c8b632249" -version = "0.1.3" +version = "0.1.4" [[deps.Unzip]] git-tree-sha1 = "ca0969166a028236229f63514992fc073799bb78" @@ -1981,9 +1991,9 @@ version = "1.31.0+0" [[deps.XML2_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Libiconv_jll", "Zlib_jll"] -git-tree-sha1 = "532e22cf7be8462035d092ff21fada7527e2c488" +git-tree-sha1 = "52ff2af32e591541550bd753c0da8b9bc92bb9d9" uuid = "02c8fc9c-b97f-50b9-bbe4-9be30ff0a78a" -version = "2.12.6+0" +version = "2.12.7+0" [[deps.XSLT_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Libgcrypt_jll", "Libgpg_error_jll", "Libiconv_jll", "Pkg", "XML2_jll", "Zlib_jll"] @@ -1998,16 +2008,16 @@ uuid = "ffd25f8a-64ca-5728-b0f7-c24cf3aae800" version = "5.4.6+0" [[deps.Xorg_libICE_jll]] -deps = ["Libdl", "Pkg"] -git-tree-sha1 = "e5becd4411063bdcac16be8b66fc2f9f6f1e8fe5" +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "326b4fea307b0b39892b3e85fa451692eda8d46c" uuid = "f67eecfb-183a-506d-b269-f58e52b52d7c" -version = "1.0.10+1" +version = "1.1.1+0" [[deps.Xorg_libSM_jll]] -deps = ["Libdl", "Pkg", "Xorg_libICE_jll"] -git-tree-sha1 = "4a9d9e4c180e1e8119b5ffc224a7b59d3a7f7e18" +deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libICE_jll"] +git-tree-sha1 = "3796722887072218eabafb494a13c963209754ce" uuid = "c834827a-8449-5923-a945-d239c165b7dd" -version = "1.2.3+0" +version = "1.2.4+0" [[deps.Xorg_libX11_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libxcb_jll", "Xorg_xtrans_jll"] @@ -2034,10 +2044,10 @@ uuid = "a3789734-cfe1-5b06-b2d0-1dd0d9d62d05" version = "1.1.4+0" [[deps.Xorg_libXext_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libX11_jll"] -git-tree-sha1 = "b7c0aa8c376b31e4852b360222848637f481f8c3" +deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libX11_jll"] +git-tree-sha1 = "d2d1a5c49fae4ba39983f63de6afcbea47194e85" uuid = "1082639a-0dae-5f34-9b06-72781eeb8cb3" -version = "1.3.4+4" +version = "1.3.6+0" [[deps.Xorg_libXfixes_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libX11_jll"] @@ -2064,10 +2074,10 @@ uuid = "ec84b674-ba8e-5d96-8ba1-2a689ba10484" version = "1.5.2+4" [[deps.Xorg_libXrender_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libX11_jll"] -git-tree-sha1 = "19560f30fd49f4d4efbe7002a1037f8c43d43b96" +deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libX11_jll"] +git-tree-sha1 = "47e45cd78224c53109495b3e324df0c37bb61fbe" uuid = "ea2f1a96-1ddc-540d-b46f-429655e07cfa" -version = "0.9.10+4" +version = "0.9.11+0" [[deps.Xorg_libpthread_stubs_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] @@ -2143,9 +2153,9 @@ version = "1.5.0+0" [[deps.YAML]] deps = ["Base64", "Dates", "Printf", "StringEncodings"] -git-tree-sha1 = "e6330e4b731a6af7959673621e91645eb1356884" +git-tree-sha1 = "669a78c59a307fa3ebc0a0bffd7ae83bd2184361" uuid = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6" -version = "0.4.9" +version = "0.4.10" [[deps.Zlib_jll]] deps = ["Libdl"] @@ -2183,10 +2193,10 @@ uuid = "477f73a3-ac25-53e9-8cc3-50b2fa2566f0" version = "1.1.2+0" [[deps.libaom_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "3a2ea60308f0996d26f1e5354e10c24e9ef905d4" +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "1827acba325fdcdf1d2647fc8d5301dd9ba43a9d" uuid = "a4ae2306-e953-59d6-aa16-d00cac43593b" -version = "3.4.0+0" +version = "3.9.0+0" [[deps.libass_jll]] deps = ["Artifacts", "Bzip2_jll", "FreeType2_jll", "FriBidi_jll", "HarfBuzz_jll", "JLLWrappers", "Libdl", "Pkg", "Zlib_jll"] diff --git a/docs/make.jl b/docs/make.jl index 259c8bbaf..242849139 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -12,6 +12,7 @@ pages = [ "Algorithm Formulations" => [ "ODE Solvers" => "algorithm_formulations/ode_solvers.md", "Newtons Method" => "algorithm_formulations/newtons_method.md", + "Rosenbrock Method" => "algorithm_formulations/rosenbrock.md", "Old LSRK Formulations" => "algorithm_formulations/lsrk.md", "Old MRRK Formulations" => "algorithm_formulations/mrrk.md", ], diff --git a/docs/src/plotting_utils.jl b/docs/src/plotting_utils.jl index 8b715d500..9c0dc538f 100644 --- a/docs/src/plotting_utils.jl +++ b/docs/src/plotting_utils.jl @@ -59,6 +59,7 @@ imex_convergence_orders(::ARK548L2SA2) = (5, 5, 5) imex_convergence_orders(::SSP22Heuns) = (2, 2, 2) imex_convergence_orders(::SSP33ShuOsher) = (3, 3, 3) imex_convergence_orders(::RK4) = (4, 4, 4) +imex_convergence_orders(::SSPKnoth) = (2, 2, 2) # Compute a confidence interval for the convergence order, returning the # estimated convergence order and its uncertainty. diff --git a/ext/benchmark_utils.jl b/ext/benchmark_utils.jl index 27578d550..2985be781 100644 --- a/ext/benchmark_utils.jl +++ b/ext/benchmark_utils.jl @@ -78,6 +78,7 @@ function get_trial(f, args, name; device, with_cu_prof = :bprofile, trace = fals end get_W(i::CTS.DistributedODEIntegrator) = i.cache.newtons_method_cache.j +get_W(i::CTS.RosenbrockAlgorithm) = i.cache.newtons_method_cache.j get_W(i) = i.cache.W f_args(i, f::CTS.ForwardEulerODEFunction) = (copy(i.u), i.u, i.p, i.t, i.dt) f_args(i, f) = (similar(i.u), i.u, i.p, i.t) diff --git a/src/solvers/rosenbrock.jl b/src/solvers/rosenbrock.jl index ca871dbba..dd0776f4f 100644 --- a/src/solvers/rosenbrock.jl +++ b/src/solvers/rosenbrock.jl @@ -1,73 +1,191 @@ export SSPKnoth +using StaticArrays +import DiffEqBase +import LinearAlgebra: ldiv! -abstract type RosenbrockAlgorithm <: DistributedODEAlgorithm end +abstract type RosenbrockAlgorithmName <: AbstractAlgorithmName end +""" + RosenbrockTableau{N, RT, N²} + +Contains everything that defines a Rosenbrock-type method. + +- N: number of stages, +- N²: number of stages squared, +- RT: real type (Float32, Float64, ...) + +Refer to the documentation for the precise meaning of the symbols below. +""" struct RosenbrockTableau{N, RT, N²} + """A = α Γ⁻¹""" A::SMatrix{N, N, RT, N²} + """Tableau used for the time-dependent part""" + α::SMatrix{N, N, RT, N²} + """Stepping matrix""" C::SMatrix{N, N, RT, N²} + """Substage contribution matrix""" Γ::SMatrix{N, N, RT, N²} + """m = b Γ⁻¹, used to compute the increments k""" m::SMatrix{N, 1, RT, N} end -struct RosenbrockCache{Nstages, RT, N², A} - tableau::RosenbrockTableau{Nstages, RT, N²} +""" + RosenbrockAlgorithm(tableau) + +Constructs a Rosenbrock algorithm for solving ODEs. +""" +struct RosenbrockAlgorithm{T <: RosenbrockTableau} <: ClimaTimeSteppers.DistributedODEAlgorithm + tableau::T +end + +""" + RosenbrockCache{N, A, WT} + +Contains everything that is needed to run a Rosenbrock-type method. + +- Nstages: number of stages, +- A: type of the evolved state (e.g., a ClimaCore.FieldVector), +- WT: type of the Jacobian (Wfact) +""" +struct RosenbrockCache{Nstages, A, WT} + """Preallocated space for the state""" U::A + + """Preallocated space for the tendency""" fU::A + + """Preallocated space for the explicit contribution to the tendency""" + fU_exp::A + + """Preallocated space for the limited contribution to the tendency""" + fU_lim::A + + """Contributions to the state for each stage""" k::NTuple{Nstages, A} - W::Any - linsolve!::Any + + """Preallocated space for the Wfact, dtγJ - 𝕀, or Wfact_t, 𝕀/dtγ - J, with J the Jacobian of the implicit tendency""" + W::WT + + """Preallocated space for the explicit time derivative of the tendency""" + ∂Y∂t::A end function init_cache(prob::DiffEqBase.AbstractODEProblem, alg::RosenbrockAlgorithm; kwargs...) - - tab = tableau(alg, eltype(prob.u0)) - Nstages = length(tab.m) + Nstages = length(alg.tableau.m) U = zero(prob.u0) fU = zero(prob.u0) + fU_exp = zero(prob.u0) + fU_lim = zero(prob.u0) + ∂Y∂t = zero(prob.u0) k = ntuple(n -> similar(prob.u0), Nstages) - W = prob.f.jac_prototype - linsolve! = alg.linsolve(Val{:init}, W, prob.u0; kwargs...) - - return RosenbrockCache(tab, U, fU, k, W, linsolve!) + W = prob.f.T_imp!.jac_prototype + return RosenbrockCache{Nstages, typeof(U), typeof(W)}(U, fU, fU_exp, fU_lim, k, W, ∂Y∂t) end +""" + step_u!(int, cache::RosenbrockCache{Nstages}) + +Take one step with the Rosenbrock-method with the given `cache`. -function step_u!(int, cache::RosenbrockCache{Nstages, RT}) where {Nstages, RT} - (; m, Γ, A, C) = cache.tableau +Some choices are being made here. Most of these are empirically motivated and should be +revisited on different problems. +- We do not update dtγ across stages +- We do not update Wfact across stages +- We apply DSS to the sum of the explicit and implicit tendency at all the stages but the last +- We apply DSS to incremented state (ie, after the final stage is applied) +""" +function step_u!(int, cache::RosenbrockCache{Nstages}) where {Nstages} + (; m, Γ, A, α, C) = int.alg.tableau (; u, p, t, dt) = int - (; W, U, fU, k, linsolve!) = cache - f! = int.sol.prob.f - Wfact_t! = int.sol.prob.f.Wfact_t + (; W, U, fU, fU_exp, fU_lim, k, ∂Y∂t) = cache + T_imp! = int.sol.prob.f.T_imp! + T_exp_lim! = int.sol.prob.f.T_exp_T_lim! + tgrad! = int.sol.prob.f.T_imp!.tgrad + + Wfact! = int.sol.prob.f.T_imp!.Wfact + Wfact_t! = int.sol.prob.f.T_imp!.Wfact_t + if !isnothing(Wfact!) && !isnothing(Wfact_t!) + error("Only one between Wfact and Wfact_t can be non-nothing") + end + + (; post_explicit!, post_implicit!, dss!) = int.sol.prob.f + + dtγ = dt * Γ[1, 1] + + if isnothing(Wfact_t!) + # We have Wfact + Wfact!(W, u, p, dtγ, t) + else + # We have Wfact_t + Wfact_t!(W, u, p, dtγ, t) + end + - # 1) compute jacobian factorization - γ = dt * Γ[1, 1] - Wfact_t!(W, u, p, γ, t) for i in 1:Nstages + αi = sum(α[i, 1:(i - 1)]) + U .= u for j in 1:(i - 1) U .+= A[i, j] .* k[j] end - # TODO: there should be a time modification here (t + c * dt) - # if f does depend on time, would need to add tgrad term as well - f!(fU, U, p, t) + + # NOTE: post_implicit! is a misnomer + post_implicit!(U, p, t) + + if !isnothing(T_imp!) + T_imp!(fU, U, p, t) + end + + if !isnothing(T_exp_lim!) + T_exp_lim!(fU_exp, fU_lim, U, p, t) + fU .+= fU_exp + fU .+= fU_lim + end + + # We dss the tendency at every stage but the last. At the last stage, we + # dss the incremented state + (i != Nstages) && dss!(fU, p, t) + for j in 1:(i - 1) fU .+= (C[i, j] / dt) .* k[j] end - linsolve!(k[i], W, fU) + + if !isnothing(tgrad!) + tgrad!(∂Y∂t, u, p, t) + fU .+= αi .* dt .* ∂Y∂t + end + + if isnothing(Wfact_t!) + fU .*= -dtγ + end + + if W isa Matrix + ldiv!(k[i], lu(W), fU) + else + ldiv!(k[i], W, fU) + end end + for i in 1:Nstages u .+= m[i] .* k[i] end -end -struct SSPKnoth{L} <: RosenbrockAlgorithm - linsolve::L + dss!(u, p, t) + return nothing end -SSPKnoth(; linsolve) = SSPKnoth(linsolve) +""" + SSPKnoth + +`SSPKnoth` is a second-order Rosenbrock method. + +We do not know where the coefficients come from. They are the same as in `CGDycore.jl`. +""" +struct SSPKnoth end + +struct SSPKnoth <: RosenbrockAlgorithmName end function tableau(::SSPKnoth, RT) - # ROS.transformed=true; N = 3 N² = N * N α = @SMatrix RT[ @@ -75,7 +193,6 @@ function tableau(::SSPKnoth, RT) 1 0 0 1/4 1/4 0 ] - # ROS.d=ROS.alpha*ones(ROS.nStage,1); b = @SMatrix RT[1 / 6 1 / 6 2 / 3] Γ = @SMatrix RT[ 1 0 0 @@ -85,9 +202,5 @@ function tableau(::SSPKnoth, RT) A = α / Γ C = -inv(Γ) m = b / Γ - return RosenbrockTableau{N, RT, N²}(A, C, Γ, m) - # ROS.SSP.alpha=[1 0 0 - # 3/4 1/4 0 - # 1/3 0 2/3]; - + return RosenbrockTableau{N, RT, N²}(A, α, C, Γ, m) end diff --git a/test/Project.toml b/test/Project.toml index 4d132ceb0..5eeba094a 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -3,6 +3,7 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" ClimaComms = "3a4d1b5c-c61d-41fd-a00a-5873ba7a1b0d" ClimaCore = "d414da3d-4745-48bb-8d80-42e94e092884" +ClimaCorePlots = "cf7c7e5a-b407-4c48-9047-11a94a308626" ClimaTimeSteppers = "595c0a79-7f3d-439a-bc5a-b232dc3bde79" Colors = "5ae59095-9a9b-59fe-a467-6f913c188581" DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" diff --git a/test/problems.jl b/test/problems.jl index ce15d5fe4..801018e5c 100644 --- a/test/problems.jl +++ b/test/problems.jl @@ -3,7 +3,7 @@ using ClimaCore using ClimaComms import ClimaCore: Domains, Geometry, Meshes, Topologies, Spaces, Fields, Operators, Limiters -@static isdefined(ClimaComms, :device_type) && ClimaComms.@import_required_backends +@static pkgversion(ClimaComms) >= v"0.6" && ClimaComms.@import_required_backends import Krylov # Trigger ClimaCore/ext/KrylovExt @@ -380,6 +380,19 @@ function ark_analytic_nonlin_test_cts(::Type{FT}) where {FT} ) end +function sspknoth_analytic_nonlin_test_cts(::Type{FT}) where {FT} + ClimaIntegratorTestCase(; + test_name = "sspknoth_analytic_nonlin", + linear_implicit = false, + t_end = FT(10), + Y₀ = FT[0], + analytic_sol = (t) -> [log(t^2 / 2 + t + 1)], + tendency! = (Yₜ, Y, _, t) -> Yₜ .= (t + 1) .* exp.(.-Y), + Wfact! = (W, Y, _, Δt, t) -> W .= (-Δt * (t + 1) .* exp.(.-Y) .- 1), + tgrad! = (∂Y∂t, Y, _, t) -> ∂Y∂t .= exp.(.-Y), + ) +end + # From Section 5.1 of "Example Programs for ARKode v4.4.0" by D. R. Reynolds function ark_analytic_sys_test_cts(::Type{FT}) where {FT} λ = FT(-100) # increase magnitude for more stiffness diff --git a/test/test_rosenbrock.jl b/test/test_rosenbrock.jl new file mode 100644 index 000000000..0ed7a8de7 --- /dev/null +++ b/test/test_rosenbrock.jl @@ -0,0 +1,396 @@ +import SciMLBase +import DiffEqBase +import LinearAlgebra +import ClimaTimeSteppers +import ClimaCore.MatrixFields: @name + +WITH_MAKIE = false +WITH_ATMOS = false + +try + import CairoMakie + global WITH_MAKIE = true +finally +end + +try + import ClimaCore + import ClimaCore.MatrixFields: @name, ⋅ + global WITH_CORE = true +finally +end + + +# function sspknoth_analytic_linear(::Type{FT}; dt = FT(0.01)) where {FT} +# Y₀ = FT[1] +# t0 = zero(FT) +# t_end = FT(10) +# λ = FT(-1) + +# T_imp! = SciMLBase.ODEFunction( +# (Yₜ, Y, _, t) -> Yₜ .= λ .* Y; +# jac_prototype = zeros(1, 1), +# Wfact = (W, Y, p, dtγ, t) -> W .= λ * dtγ - 1, +# ) + +# T_exp! = nothing + +# analytic_sol = (t) -> exp(λ*t) + +# prob = DiffEqBase.ODEProblem( +# ClimaTimeSteppers.ClimaODEFunction(T_exp! = T_exp!, +# T_imp! = T_imp!), +# Y₀, +# (t0, t_end), +# nothing, +# ) +# algo = ClimaTimeSteppers.RosenbrockAlgorithm(ClimaTimeSteppers.tableau(ClimaTimeSteppers.SSPKnoth(), FT)) +# integrator = SciMLBase.init(prob, algo; dt, saveat = dt) +# SciMLBase.solve!(integrator) + +# times = integrator.sol.t +# values = [u[1] for u in integrator.sol.u] + +# relative_error = abs.((values .- analytic_sol.(times))./analytic_sol.(times)) + +# return maximum(relative_error) +# end + +struct MyImplicitJacobian{M, S} + matrix::M + solver::S +end + +Base.similar(myimplicitjac::MyImplicitJacobian) = myimplicitjac + +function ImplicitJacobian(matrix, Y) + alg = ClimaCore.MatrixFields.BlockDiagonalSolve() + + return MyImplicitJacobian(matrix, ClimaCore.MatrixFields.FieldMatrixSolver(alg, matrix, Y)) +end + +function LinearAlgebra.ldiv!(x, a::MyImplicitJacobian, b) + ClimaCore.MatrixFields.field_matrix_solve!(a.solver, x, a.matrix, b) + return nothing +end + +function sspknoth_analytic_linear_climacore_finitedifferences(::Type{FT}; dt = FT(0.0001)) where {FT} + height = 1 + zelem = 10000 + n_z = 1 + + vertdomain = ClimaCore.Domains.IntervalDomain( + ClimaCore.Geometry.ZPoint(FT(0)), + ClimaCore.Geometry.ZPoint(FT(height)); + boundary_names = (:bottom, :top), + ) + vertmesh = ClimaCore.Meshes.IntervalMesh(vertdomain; nelems = zelem) + vertspace = ClimaCore.Spaces.FaceFiniteDifferenceSpace(vertmesh) + + (; z) = ClimaCore.Fields.coordinate_field(vertspace) + φ_sin = @. sin(2 * FT(π) * n_z * z) + + λ = (2 * FT(π) * n_z)^2 + + Y₀ = ClimaCore.Fields.FieldVector(; my_var = copy(φ_sin)) + t0 = zero(FT) + t_end = FT(0.1) + + diverg = ClimaCore.Operators.DivergenceC2F(; + bottom = ClimaCore.Operators.SetDivergence(FT(0)), + top = ClimaCore.Operators.SetDivergence(FT(0)), + ) + grad = ClimaCore.Operators.GradientF2C() + + div_matrix = ClimaCore.MatrixFields.operator_matrix(diverg) + grad_matrix = ClimaCore.MatrixFields.operator_matrix(grad) + + function Wfact_t(W, Y, p, dtγ, t) + name = @name(my_var) + @. W.matrix[name, name] = (LinearAlgebra.I,) / dtγ - div_matrix() ⋅ grad_matrix() + return nothing + end + + function Wfact(W, Y, p, dtγ, t) + name = @name(my_var) + @. W.matrix[name, name] = dtγ * div_matrix() ⋅ grad_matrix() - (LinearAlgebra.I,) + return nothing + end + + jacobian = ClimaCore.MatrixFields.FieldMatrix( + (@name(my_var), @name(my_var)) => similar(φ_sin, ClimaCore.MatrixFields.TridiagonalMatrixRow{FT}), + ) + + jac_prototype = ImplicitJacobian(jacobian, Y₀) + + T_imp! = SciMLBase.ODEFunction( + (Yₜ, Y, _, t) -> Yₜ.my_var .= diverg.(grad.(Y.my_var)); + jac_prototype = jac_prototype, + Wfact = Wfact, + # Wfact_t = Wfact_t + ) + + function analytic_sol(t) + state = similar(Y₀) + @. state.my_var = 1 * exp(-λ * t) * φ_sin + return state + end + + prob = DiffEqBase.ODEProblem(ClimaTimeSteppers.ClimaODEFunction(T_imp! = T_imp!), Y₀, (t0, t_end), nothing) + algo = ClimaTimeSteppers.RosenbrockAlgorithm(ClimaTimeSteppers.tableau(ClimaTimeSteppers.SSPKnoth(), FT)) + # algo = ClimaTimeSteppers.IMEXAlgorithm(ClimaTimeSteppers.ARS343(), ClimaTimeSteppers.NewtonsMethod()) + integrator = SciMLBase.init(prob, algo; dt, saveat = dt) + return integrator + + SciMLBase.solve!(integrator) + + times = integrator.sol.t + values = integrator.sol.u + + THRESHOLD = 1e-6 + relative_error = map(zip(times, values)) do (t, v) + parent_analytic = parent(analytic_sol.(t).my_var) + parent_numeric = parent(v.my_var) + bitmask = abs.(parent_analytic) .> THRESHOLD + rel_err = @. abs(parent_analytic .- parent_numeric) / abs(parent_analytic) + return maximum(rel_err[bitmask]) + end + + return maximum(relative_error) +end + + + + +function sspknoth_analytic_linear_climacore_extruded_diffiusion(::Type{FT}; dt = FT(0.001)) where {FT} + radius = FT(6000) + nelems = 10 + npoly = 3 + + height = 1 + zelem = 20 + + vertdomain = ClimaCore.Domains.IntervalDomain( + ClimaCore.Geometry.ZPoint(FT(0)), + ClimaCore.Geometry.ZPoint(FT(height)); + boundary_names = (:bottom, :top), + ) + vertmesh = ClimaCore.Meshes.IntervalMesh(vertdomain; nelems = zelem) + vertspace = ClimaCore.Spaces.FaceFiniteDifferenceSpace(vertmesh) + + horzdomain = ClimaCore.Domains.SphereDomain(radius) + horzmesh = ClimaCore.Meshes.EquiangularCubedSphere(horzdomain, nelems) + horztopology = ClimaCore.Topologies.Topology2D(ClimaCore.ClimaComms.context(), horzmesh) + horzquad = ClimaCore.Spaces.Quadratures.GLL{npoly + 1}() + + horzspace = ClimaCore.Spaces.SpectralElementSpace2D(horztopology, horzquad) + + space = ClimaCore.Spaces.ExtrudedFiniteDifferenceSpace(horzspace, vertspace) + + # Gaussian perturbation + + (; lat, long, z) = ClimaCore.Fields.coordinate_field(space) + φ_gauss = @. exp(-(lat^2 + long^2) / (200)) * (z < 0.005) + + Y₀ = ClimaCore.Fields.FieldVector(; my_var = copy(φ_gauss)) + + t0 = zero(FT) + t_end = FT(10) + + diverg = ClimaCore.Operators.WeakDivergence() + grad = ClimaCore.Operators.Gradient() + + diverg_vert = ClimaCore.Operators.DivergenceC2F(; + bottom = ClimaCore.Operators.SetDivergence(FT(0)), + top = ClimaCore.Operators.SetDivergence(FT(0)), + ) + grad_vert = ClimaCore.Operators.GradientF2C() + + div_matrix_vert = ClimaCore.MatrixFields.operator_matrix(diverg_vert) + grad_matrix_vert = ClimaCore.MatrixFields.operator_matrix(grad_vert) + + K = 10_000.0 + + function Wfact(W, Y, p, dtγ, t) + name = @name(my_var) + @. W.matrix[name, name] = K * dtγ * div_matrix_vert() ⋅ grad_matrix_vert() - (LinearAlgebra.I,) + return nothing + end + + jacobian = ClimaCore.MatrixFields.FieldMatrix( + (@name(my_var), @name(my_var)) => similar(φ_gauss, ClimaCore.MatrixFields.TridiagonalMatrixRow{FT}), + ) + + jac_prototype = ImplicitJacobian(jacobian, Y₀) + + T_imp! = SciMLBase.ODEFunction( + (Yₜ, Y, _, t) -> Yₜ.my_var .= K .* diverg.(grad.(Y.my_var)); + jac_prototype = jac_prototype, + Wfact = Wfact, + # Wfact_t = Wfact_t + ) + + # function Wfact(W, Y, p, dtγ, t) + # return nothing + # end + + # jacobian = ClimaCore.MatrixFields.FieldMatrix( + # (@name(my_var), @name(my_var) ) => FT(-1) * LinearAlgebra.I, + # ) + + jac_prototype = ImplicitJacobian(jacobian, Y₀) + + # T_imp! = SciMLBase.ODEFunction( + # (Yₜ, Y, _, t) -> Yₜ .= 0; + # jac_prototype = jac_prototype, + # Wfact = Wfact + # ) + + function T_exp_T_lim!(fU_exp, fU_lim, U, p, t) + @. fU_lim = 0 + # @. fU_exp.my_var = K * diverg(grad(U.my_var)) + # @. fU_exp.my_var = - 0.001 * U.my_var + end + + function dss!(state, _, t) + @info "DSS" + ClimaCore.Spaces.weighted_dss!(state.my_var) + end + + # function analytic_sol(t) + # state = similar(Y₀) + # @. state.my_var = 1 * exp(-λ * t) * φ_sin + # return state + # end + + prob = DiffEqBase.ODEProblem( + ClimaTimeSteppers.ClimaODEFunction(T_imp! = T_imp!, T_exp_T_lim! = T_exp_T_lim!, dss! = dss!), + Y₀, + (t0, t_end), + nothing, + ) + # algo = ClimaTimeSteppers.RosenbrockAlgorithm(ClimaTimeSteppers.tableau(ClimaTimeSteppers.SSPKnoth(), FT)) + algo = ClimaTimeSteppers.IMEXAlgorithm(ClimaTimeSteppers.ARS343(), ClimaTimeSteppers.NewtonsMethod()) + integrator = SciMLBase.init(prob, algo; dt, saveat = dt) + + # SciMLBase.solve!(integrator) + + return integrator + + times = integrator.sol.t + values = integrator.sol.u + + return (times, values) + + # THRESHOLD = 1e-6 + # relative_error = map(zip(times, values)) do (t, v) + # parent_analytic = parent(analytic_sol.(t).my_var) + # parent_numeric = parent(v.my_var) + # bitmask = abs.(parent_analytic) .> THRESHOLD + # rel_err = @. abs(parent_analytic .- parent_numeric) / abs(parent_analytic) + # return maximum(rel_err[bitmask]) + # end + + return maximum(relative_error) +end + + +# function sspknoth_analytic_linear_timedependent(::Type{FT}; dt = FT(0.01)) where {FT} +# Y₀ = FT[0] +# t0 = zero(FT) +# t_end = FT(1) +# λ = FT(-100) +# source(t) = 1 / (1 + t^2) - λ * atan(t) + +# T_imp! = SciMLBase.ODEFunction( +# (Yₜ, Y, _, t) -> Yₜ .= λ .* Y .+ source(t); +# jac_prototype = zeros(1, 1), +# Wfact = (W, Y, p, dtγ, t) -> W .= λ * dtγ - 1, +# tgrad = (∂Y∂t, Y, _, t) -> ∂Y∂t .= -(λ + 2 * t + λ * t^2) / (1 + t^2)^2, +# ) + +# T_exp! = nothing + +# analytic_sol = (t) -> atan(t) + +# prob = DiffEqBase.ODEProblem( +# ClimaTimeSteppers.ClimaODEFunction(T_exp! = T_exp!, +# T_imp! = T_imp!), +# Y₀, +# (t0, t_end), +# nothing, +# ) +# algo = ClimaTimeSteppers.RosenbrockAlgorithm(ClimaTimeSteppers.tableau(ClimaTimeSteppers.SSPKnoth(), FT)) +# integrator = SciMLBase.init(prob, algo; dt, saveat = dt) +# SciMLBase.solve!(integrator) + +# times = integrator.sol.t[2:end] +# wvalues = [u[1] for u in integrator.sol.u[2:end]] + +# relative_error = abs.((wvalues .- analytic_sol.(times))./analytic_sol.(times)) + +# return maximum(relative_error) +# end + +# function sspknoth_analytic_nonlinear(::Type{FT}; dt = FT(0.1)) where {FT} +# Y₀ = FT[1] +# t0 = zero(FT) +# t_end = FT(10) + +# T_imp! = SciMLBase.ODEFunction( +# (Yₜ, Y, _, t) -> Yₜ .= 1 ./Y ; +# jac_prototype = zeros(1, 1), +# Wfact = (W, Y, p, dtγ, t) -> W .= dtγ ./ Y .- 1, +# ) + +# T_exp! = nothing + +# analytic_sol = (t) -> sqrt(2t + 1) + +# prob = DiffEqBase.ODEProblem( +# ClimaTimeSteppers.ClimaODEFunction(T_exp! = T_exp!, +# T_imp! = T_imp!), +# Y₀, +# (t0, t_end), +# nothing, +# ) +# algo = ClimaTimeSteppers.RosenbrockAlgorithm(ClimaTimeSteppers.tableau(ClimaTimeSteppers.SSPKnoth(), FT)) +# integrator = SciMLBase.init(prob, algo; dt, saveat = dt) +# SciMLBase.solve!(integrator) + +# times = integrator.sol.t +# values = [u[1] for u in integrator.sol.u] + +# relative_error = abs.((values .- analytic_sol.(times))./analytic_sol.(times)) + +# return maximum(relative_error) +# end + + +# mean(x) = sum(x) / length(x) + +# function linear_regression(x, y) +# mean_x, mean_y = mean(x), mean(y) +# m = sum( (x .- mean_x) .* (y .- mean_y) ) / sum((x .- mean_x).^2) +# q = mean_y - m * mean_x +# return (m, q) +# end + +# function extract_convergence_order(::Type{FT}, problem = sspknoth_analytic_linear_climacore_finitedifferences) where {FT} +# dts = map(i -> one(FT)/2^i, 5:16) +# max_rel_errors = map((dt) -> problem(FT; dt), dts) +# m, q = linear_regression(log.(dts), log.(max_rel_errors)) +# return dts, max_rel_errors, m, q +# end + +# if WITH_MAKIE +# f = CairoMakie.Figure() +# dts, max_rel_errors, conv_m, conv_q = extract_convergence_order(Float64) +# ax = CairoMakie.Axis(f[1, 1], xlabel = "log dt", ylabel = "log maximum relative error vs analytical", title = "SSPKnoth, extracted convergence order: $conv_m") +# CairoMakie.lines!(ax, log.(dts), log.(max_rel_errors), label = "Error") +# lin_func(x) = conv_m * x + conv_q +# Ts = log.(dts) +# CairoMakie.lines!(ax, Ts, lin_func.(Ts), label = "Fit") +# CairoMakie.Legend(f, ax) +# CairoMakie.save("rosenbrock_conv.pdf", f) +# end