From 30e5ef4c12c4f8387ce2f5ebe65896c4e7497645 Mon Sep 17 00:00:00 2001 From: kmdeck Date: Thu, 8 Sep 2022 11:42:15 -0700 Subject: [PATCH] began transition to using new bucket model version issue with atmos u bugs fixed but not well formatting and should run, psnow zero swap boundary space for horizontal space updated utils revert change cli typo cleanup review comment --- .../AMIP/moist_mpi_earth/Manifest.toml | 165 ++++++++-------- .../moist_mpi_earth/bucket/bucket_init.jl | 181 ++++++++---------- .../moist_mpi_earth/bucket/bucket_utils.jl | 140 ++++++++++++++ .../AMIP/moist_mpi_earth/coupler_driver.jl | 9 +- .../coupler_utils/conservation_checker.jl | 21 +- .../coupler_utils/flux_calculator.jl | 2 +- .../coupler_utils/viz_explorer.jl | 14 +- experiments/AMIP/moist_mpi_earth/push_pull.jl | 27 +-- .../AMIP/moist_mpi_earth/slab/slab_utils.jl | 2 +- 9 files changed, 333 insertions(+), 228 deletions(-) create mode 100644 experiments/AMIP/moist_mpi_earth/bucket/bucket_utils.jl diff --git a/experiments/AMIP/moist_mpi_earth/Manifest.toml b/experiments/AMIP/moist_mpi_earth/Manifest.toml index 8acdfd55d5..5b4c843631 100644 --- a/experiments/AMIP/moist_mpi_earth/Manifest.toml +++ b/experiments/AMIP/moist_mpi_earth/Manifest.toml @@ -1,6 +1,6 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.7.3" +julia_version = "1.7.0" manifest_format = "2.0" [[deps.AbstractFFTs]] @@ -120,9 +120,9 @@ version = "0.1.2" [[deps.CLIMAParameters]] deps = ["DocStringExtensions", "TOML", "Test"] -git-tree-sha1 = "d245240fff94b4cc8f397504b3906731def4fb07" +git-tree-sha1 = "3f7f117335784536f2c07f54d1da0b60acb29c28" uuid = "6eacf6c3-8458-43b9-ae03-caf5306d3d53" -version = "0.6.1" +version = "0.6.6" [[deps.CPUSummary]] deps = ["CpuId", "IfElse", "Static"] @@ -198,10 +198,10 @@ uuid = "5f86816e-8b66-43b2-912e-75384f99de49" version = "0.3.2" [[deps.ClimaCore]] -deps = ["Adapt", "BlockArrays", "CUDA", "ClimaComms", "CubedSphere", "DataStructures", "DiffEqBase", "DocStringExtensions", "ForwardDiff", "GaussQuadrature", "GilbertCurves", "InteractiveUtils", "IntervalSets", "LinearAlgebra", "RecursiveArrayTools", "RootSolvers", "Rotations", "SparseArrays", "Static", "StaticArrays", "Statistics", "UnPack"] -git-tree-sha1 = "39b0b723ff68c0a718653aebaa672aee5556c09f" +deps = ["Adapt", "BlockArrays", "CUDA", "ClimaComms", "CubedSphere", "DataStructures", "DiffEqBase", "DocStringExtensions", "ForwardDiff", "GaussQuadrature", "GilbertCurves", "HDF5", "InteractiveUtils", "IntervalSets", "LinearAlgebra", "PkgVersion", "RecursiveArrayTools", "RootSolvers", "Rotations", "SparseArrays", "Static", "StaticArrays", "Statistics", "UnPack"] +git-tree-sha1 = "1db2de9a08d67e4495146f152899dcf14d98fd2a" uuid = "d414da3d-4745-48bb-8d80-42e94e092884" -version = "0.10.7" +version = "0.10.12" [[deps.ClimaCorePlots]] deps = ["ClimaCore", "RecipesBase", "StaticArrays", "TriplotBase"] @@ -211,12 +211,9 @@ version = "0.2.4" [[deps.ClimaCoreTempestRemap]] deps = ["ClimaCore", "Dates", "LinearAlgebra", "NCDatasets", "PkgVersion", "TempestRemap_jll", "Test"] -git-tree-sha1 = "01cbd3aeb208a2d63e450b07ae0046d5e9a9da84" -repo-rev = "6a2baa1fa6b2422691786986eecd77909c8f136b" -repo-subdir = "lib/ClimaCoreTempestRemap" -repo-url = "https://github.com/CliMA/ClimaCore.jl.git" +git-tree-sha1 = "12713936cdc28a3442f61d92d782d5bd329ded7e" uuid = "d934ef94-cdd4-4710-83d6-720549644b70" -version = "0.3.4" +version = "0.3.5" [[deps.ClimaCoreVTK]] deps = ["ClimaCore", "WriteVTK"] @@ -231,10 +228,10 @@ uuid = "4ade58fe-a8da-486c-bd89-46df092ec0c7" version = "0.1.0" [[deps.ClimaLSM]] -deps = ["ClimaCore", "DocStringExtensions", "IntervalSets", "StaticArrays", "SurfaceFluxes", "Thermodynamics", "UnPack"] -git-tree-sha1 = "8f0993dfd5fd41d86115e5e97e26109d7f9e2819" -repo-rev = "6eb24d9c4bff13225cac08f68de5ed9eef9bd52b" -repo-url = "https://github.com/CliMA/ClimaLSM.jl" +deps = ["CLIMAParameters", "ClimaCore", "DocStringExtensions", "IntervalSets", "StaticArrays", "SurfaceFluxes", "Thermodynamics", "UnPack"] +git-tree-sha1 = "9c7373a5d2bee75fb64a8aaecdb4cfd7d5eadfef" +repo-rev = "compat_with_atmos" +repo-url = "https://github.com/CliMA/ClimaLSM.jl.git" uuid = "7884a58f-fab6-4fd0-82bb-ecfedb2d8430" version = "0.1.0" @@ -384,10 +381,10 @@ uuid = "2b5f629d-d688-5b77-993f-72d75c75574e" version = "6.84.0" [[deps.DiffEqCallbacks]] -deps = ["DataStructures", "DiffEqBase", "ForwardDiff", "LinearAlgebra", "NLsolve", "Parameters", "RecipesBase", "RecursiveArrayTools", "SciMLBase", "StaticArrays"] -git-tree-sha1 = "cfef2afe8d73ed2d036b0e4b14a3f9b53045c534" +deps = ["DataStructures", "DiffEqBase", "ForwardDiff", "LinearAlgebra", "Markdown", "NLsolve", "Parameters", "RecipesBase", "RecursiveArrayTools", "SciMLBase", "StaticArrays"] +git-tree-sha1 = "f8cc1ad62a87988225a07524ef84c7df7264c232" uuid = "459566f4-90b8-5000-8ac3-15dfb0a30def" -version = "2.23.1" +version = "2.24.1" [[deps.DiffEqJump]] deps = ["ArrayInterfaceCore", "DataStructures", "DiffEqBase", "DocStringExtensions", "FunctionWrappers", "Graphs", "LinearAlgebra", "Markdown", "PoissonRandom", "Random", "RandomNumbers", "RecursiveArrayTools", "Reexport", "SciMLBase", "StaticArrays", "TreeViews", "UnPack"] @@ -425,9 +422,9 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" [[deps.Distributions]] deps = ["ChainRulesCore", "DensityInterface", "FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "SparseArrays", "SpecialFunctions", "Statistics", "StatsBase", "StatsFuns", "Test"] -git-tree-sha1 = "8579b5cdae93e55c0cff50fbb0c2d1220efd5beb" +git-tree-sha1 = "ee407ce31ab2f1bacadc3bd987e96de17e00aed3" uuid = "31c24e10-a181-5473-b8eb-7969acd0382f" -version = "0.25.70" +version = "0.25.71" [[deps.DocStringExtensions]] deps = ["LibGit2"] @@ -436,7 +433,7 @@ uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" version = "0.8.6" [[deps.Downloads]] -deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] +deps = ["ArgTools", "LibCURL", "NetworkOptions"] uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" [[deps.DualNumbers]] @@ -445,12 +442,6 @@ git-tree-sha1 = "5837a837389fccf076445fce071c8ddaea35a566" uuid = "fa6b7ba4-c1ee-5f82-b5fc-ecf0adba8f74" version = "0.6.8" -[[deps.EarCut_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "3f3a2501fa7236e9b911e0f7a588c657e822bb6d" -uuid = "5ae413db-bbd1-5e63-b57d-d24a61df00f5" -version = "2.2.3+0" - [[deps.Elliptic]] git-tree-sha1 = "71c79e77221ab3a29918aaf6db4f217b89138608" uuid = "b305315f-e792-5b7a-8f41-49f472929428" @@ -473,11 +464,6 @@ git-tree-sha1 = "56559bbef6ca5ea0c0818fa5c90320398a6fbf8d" uuid = "e2ba6199-217a-4e67-a87a-7c52f15ade04" version = "0.1.8" -[[deps.Extents]] -git-tree-sha1 = "5e1e4c53fa39afe63a7d356e30452249365fba99" -uuid = "411431e0-e8b7-467b-b5e0-f676ba4f2910" -version = "0.1.1" - [[deps.FFMPEG]] deps = ["FFMPEG_jll"] git-tree-sha1 = "b57e3acbe22f8484b4b5ff66a7499717fe1a9cc8" @@ -525,9 +511,6 @@ git-tree-sha1 = "94f5101b96d2d968ace56f7f2db19d0a5f592e28" uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" version = "1.15.0" -[[deps.FileWatching]] -uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" - [[deps.FillArrays]] deps = ["LinearAlgebra", "Random", "SparseArrays", "Statistics"] git-tree-sha1 = "deed294cde3de20ae0b2e0355a6c4e1c6a5ceffc" @@ -572,9 +555,9 @@ version = "0.4.2" [[deps.ForwardDiff]] deps = ["CommonSubexpressions", "DiffResults", "DiffRules", "LinearAlgebra", "LogExpFunctions", "NaNMath", "Preferences", "Printf", "Random", "SpecialFunctions", "StaticArrays"] -git-tree-sha1 = "2f18915445b248731ec5db4e4a17e451020bf21e" +git-tree-sha1 = "187198a4ed8ccd7b5d99c41b69c679269ea2b2d4" uuid = "f6369f11-7733-5829-9624-2563aa707210" -version = "0.10.30" +version = "0.10.32" [[deps.FreeType2_jll]] deps = ["Artifacts", "Bzip2_jll", "JLLWrappers", "Libdl", "Pkg", "Zlib_jll"] @@ -593,6 +576,12 @@ git-tree-sha1 = "241552bc2209f0fa068b6415b1942cc0aa486bcc" uuid = "069b7b12-0de2-55c6-9aab-29f3d0a68a2e" version = "1.1.2" +[[deps.FunctionWrappersWrappers]] +deps = ["FunctionWrappers"] +git-tree-sha1 = "a5e6e7f12607e90d71b09e6ce2c965e41b337968" +uuid = "77dc65aa-8811-40c2-897b-53d922fa7daf" +version = "0.1.1" + [[deps.Functors]] git-tree-sha1 = "223fffa49ca0ff9ce4f875be001ffe173b2b7de4" uuid = "d9f16b24-f501-4c13-a1f2-28368ffc5196" @@ -628,15 +617,15 @@ version = "0.16.4" [[deps.GR]] deps = ["Base64", "DelimitedFiles", "GR_jll", "HTTP", "JSON", "Libdl", "LinearAlgebra", "Pkg", "Printf", "Random", "RelocatableFolders", "Serialization", "Sockets", "Test", "UUIDs"] -git-tree-sha1 = "c98aea696662d09e215ef7cda5296024a9646c75" +git-tree-sha1 = "cf0a9940f250dc3cb6cc6c6821b4bf8a4286cf9c" uuid = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71" -version = "0.64.4" +version = "0.66.2" [[deps.GR_jll]] deps = ["Artifacts", "Bzip2_jll", "Cairo_jll", "FFMPEG_jll", "Fontconfig_jll", "GLFW_jll", "JLLWrappers", "JpegTurbo_jll", "Libdl", "Libtiff_jll", "Pixman_jll", "Pkg", "Qt5Base_jll", "Zlib_jll", "libpng_jll"] -git-tree-sha1 = "2d908286d120c584abbe7621756c341707096ba4" +git-tree-sha1 = "3697c23d09d5ec6f2088faa68f0d926b6889b5be" uuid = "d2c73de3-f751-5644-a686-071e5b155ba9" -version = "0.66.2+0" +version = "0.67.0+0" [[deps.GaussQuadrature]] deps = ["SpecialFunctions"] @@ -650,18 +639,6 @@ git-tree-sha1 = "fb69b2a645fa69ba5f474af09221b9308b160ce6" uuid = "c145ed77-6b09-5dd9-b285-bf645a82121e" version = "0.5.3" -[[deps.GeoInterface]] -deps = ["Extents"] -git-tree-sha1 = "fb28b5dc239d0174d7297310ef7b84a11804dfab" -uuid = "cf35fbd7-0cd7-5166-be24-54bfbe79505f" -version = "1.0.1" - -[[deps.GeometryBasics]] -deps = ["EarCut_jll", "GeoInterface", "IterTools", "LinearAlgebra", "StaticArrays", "StructArrays", "Tables"] -git-tree-sha1 = "a7a97895780dab1085a97769316aa348830dc991" -uuid = "5c1252a2-5f33-56bf-86c9-59e7332b4326" -version = "0.4.3" - [[deps.Gettext_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Libiconv_jll", "Pkg", "XML2_jll"] git-tree-sha1 = "9b02998aba7bf074d14de89f9d37ca24a1a0b046" @@ -696,6 +673,12 @@ git-tree-sha1 = "53bb909d1151e57e2484c3d1b53e19552b887fb2" uuid = "42e2da0e-8278-4e71-bc24-59509adca0fe" version = "1.0.2" +[[deps.HDF5]] +deps = ["Compat", "HDF5_jll", "Libdl", "Mmap", "Random", "Requires"] +git-tree-sha1 = "899f041bf330ebeead3637073b2ca7477760edde" +uuid = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f" +version = "0.16.11" + [[deps.HDF5_jll]] deps = ["Artifacts", "JLLWrappers", "LibCURL_jll", "Libdl", "OpenSSL_jll", "Pkg", "Zlib_jll"] git-tree-sha1 = "4cc2bb72df6ff40b055295fdef6d92955f9dede8" @@ -703,10 +686,10 @@ uuid = "0234f1f7-429e-5d53-9886-15a909be8d59" version = "1.12.2+2" [[deps.HTTP]] -deps = ["Base64", "Dates", "IniFile", "Logging", "MbedTLS", "NetworkOptions", "Sockets", "URIs"] -git-tree-sha1 = "0fa77022fe4b511826b39c894c90daf5fce3334a" +deps = ["Base64", "CodecZlib", "Dates", "IniFile", "Logging", "LoggingExtras", "MbedTLS", "NetworkOptions", "Random", "SimpleBufferStream", "Sockets", "URIs", "UUIDs"] +git-tree-sha1 = "59ba44e0aa49b87a8c7a8920ec76f8afe87ed502" uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3" -version = "0.9.17" +version = "1.3.3" [[deps.HarfBuzz_jll]] deps = ["Artifacts", "Cairo_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "Graphite2_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Pkg"] @@ -786,11 +769,6 @@ git-tree-sha1 = "7fd44fd4ff43fc60815f8e764c0f352b83c49151" uuid = "92d709cd-6900-40b7-9082-c6be49f344b6" version = "0.1.1" -[[deps.IterTools]] -git-tree-sha1 = "fa6287a4469f5e048d763df38279ee729fbd44e5" -uuid = "c8e1da08-722c-5040-9ed9-7db0dc04731e" -version = "1.4.0" - [[deps.IterativeSolvers]] deps = ["LinearAlgebra", "Printf", "Random", "RecipesBase", "SparseArrays"] git-tree-sha1 = "1169632f425f79429f245113b775a0e3d121457c" @@ -804,9 +782,9 @@ version = "1.0.0" [[deps.JLD2]] deps = ["FileIO", "MacroTools", "Mmap", "OrderedCollections", "Pkg", "Printf", "Reexport", "TranscodingStreams", "UUIDs"] -git-tree-sha1 = "81b9477b49402b47fbe7f7ae0b252077f53e4a08" +git-tree-sha1 = "6c38bbe47948f74d63434abed68bdfc8d2c46b99" uuid = "033835bb-8acc-5ee8-8aae-3f567f8a3819" -version = "0.4.22" +version = "0.4.23" [[deps.JLLWrappers]] deps = ["Preferences"] @@ -998,6 +976,12 @@ version = "0.3.18" [[deps.Logging]] uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" +[[deps.LoggingExtras]] +deps = ["Dates", "Logging"] +git-tree-sha1 = "5d4d2d9904227b8bd66386c1138cf4d5ffa826bf" +uuid = "e6f89c97-d47a-5376-807f-9c37f3926c36" +version = "0.4.9" + [[deps.LoopVectorization]] deps = ["ArrayInterface", "CPUSummary", "ChainRulesCore", "CloseOpenIntervals", "DocStringExtensions", "ForwardDiff", "HostCPUFeatures", "IfElse", "LayoutPointers", "LinearAlgebra", "OffsetArrays", "PolyesterWeave", "SIMDDualNumbers", "SLEEFPirates", "SpecialFunctions", "Static", "ThreadingUtilities", "UnPack", "VectorizationBase"] git-tree-sha1 = "4392c19f0203df81512b6790a0a67446650bdce0" @@ -1119,9 +1103,9 @@ version = "0.2.4" [[deps.NVTX]] deps = ["Colors"] -git-tree-sha1 = "bf350bf3a8f837b3d8fac433721ed4f3f9742a7f" +git-tree-sha1 = "1aa34e3ee03f7253c9381c794e452e7af895b7ec" uuid = "5da4648a-3479-48b8-97b9-01cb529c0a1f" -version = "0.1.0" +version = "0.1.2" [[deps.NaNMath]] deps = ["OpenLibm_jll"] @@ -1139,10 +1123,10 @@ version = "400.902.5+1" uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" [[deps.NonlinearSolve]] -deps = ["ArrayInterfaceCore", "FiniteDiff", "ForwardDiff", "IterativeSolvers", "LinearAlgebra", "RecursiveArrayTools", "RecursiveFactorization", "Reexport", "SciMLBase", "Setfield", "StaticArrays", "UnPack"] -git-tree-sha1 = "a754a21521c0ab48d37f44bbac1eefd1387bdcfc" +deps = ["ArrayInterfaceCore", "FiniteDiff", "ForwardDiff", "LinearAlgebra", "RecursiveArrayTools", "Reexport", "SciMLBase", "Setfield", "StaticArrays", "UnPack"] +git-tree-sha1 = "12ea26dc2d8d8f6773bccfe7e616b129b9705380" uuid = "8913a72c-1f9b-4ce2-8d82-65094dcecaec" -version = "0.3.22" +version = "0.3.23" [[deps.OffsetArrays]] deps = ["Adapt"] @@ -1270,10 +1254,10 @@ uuid = "995b91a9-d308-5afd-9ec6-746e21dbc043" version = "1.3.1" [[deps.Plots]] -deps = ["Base64", "Contour", "Dates", "Downloads", "FFMPEG", "FixedPointNumbers", "GR", "GeometryBasics", "JSON", "Latexify", "LinearAlgebra", "Measures", "NaNMath", "Pkg", "PlotThemes", "PlotUtils", "Printf", "REPL", "Random", "RecipesBase", "RecipesPipeline", "Reexport", "Requires", "Scratch", "Showoff", "SparseArrays", "Statistics", "StatsBase", "UUIDs", "UnicodeFun", "Unzip"] -git-tree-sha1 = "93e82cebd5b25eb33068570e3f63a86be16955be" +deps = ["Base64", "Contour", "Dates", "Downloads", "FFMPEG", "FixedPointNumbers", "GR", "JSON", "LaTeXStrings", "Latexify", "LinearAlgebra", "Measures", "NaNMath", "Pkg", "PlotThemes", "PlotUtils", "Printf", "REPL", "Random", "RecipesBase", "RecipesPipeline", "Reexport", "RelocatableFolders", "Requires", "Scratch", "Showoff", "SparseArrays", "Statistics", "StatsBase", "UUIDs", "UnicodeFun", "Unzip"] +git-tree-sha1 = "6062b3b25ad3c58e817df0747fc51518b9110e5f" uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" -version = "1.31.1" +version = "1.33.0" [[deps.PoissonRandom]] deps = ["Random"] @@ -1394,9 +1378,9 @@ version = "1.2.1" [[deps.RecipesPipeline]] deps = ["Dates", "NaNMath", "PlotUtils", "RecipesBase"] -git-tree-sha1 = "dc1e451e15d90347a7decc4221842a022b011714" +git-tree-sha1 = "e7eac76a958f8664f2718508435d058168c7953d" uuid = "01d81517-befc-4cb6-b9ec-a95719d0359c" -version = "0.5.2" +version = "0.6.3" [[deps.RecursiveArrayTools]] deps = ["Adapt", "ArrayInterfaceCore", "ArrayInterfaceStaticArraysCore", "ChainRulesCore", "DocStringExtensions", "FillArrays", "GPUArraysCore", "IteratorInterfaceExtensions", "LinearAlgebra", "RecipesBase", "StaticArraysCore", "Statistics", "Tables", "ZygoteRules"] @@ -1417,9 +1401,9 @@ version = "1.2.2" [[deps.RelocatableFolders]] deps = ["SHA", "Scratch"] -git-tree-sha1 = "cdbd3b1338c72ce29d9584fdbe9e9b70eeb5adca" +git-tree-sha1 = "22c5201127d7b243b9ee1de3b43c408879dff60f" uuid = "05181044-ff0b-4ac5-8273-598c1e38db00" -version = "0.1.3" +version = "0.3.0" [[deps.Requires]] deps = ["UUIDs"] @@ -1484,10 +1468,10 @@ uuid = "476501e8-09a2-5ece-8869-fb82de89a1fa" version = "0.6.35" [[deps.SciMLBase]] -deps = ["ArrayInterfaceCore", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "Markdown", "RecipesBase", "RecursiveArrayTools", "StaticArrays", "Statistics", "Tables", "TreeViews"] -git-tree-sha1 = "e74049cca1ff273cc62697dd3739f7d43e029d93" +deps = ["ArrayInterfaceCore", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "FunctionWrappersWrappers", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "Markdown", "Preferences", "RecipesBase", "RecursiveArrayTools", "StaticArraysCore", "Statistics", "Tables"] +git-tree-sha1 = "8c7acbc1a974db5f533b59ab74b69042fa05b002" uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462" -version = "1.41.4" +version = "1.57.0" [[deps.Scratch]] deps = ["Dates"] @@ -1514,6 +1498,11 @@ git-tree-sha1 = "91eddf657aca81df9ae6ceb20b959ae5653ad1de" uuid = "992d4aef-0814-514b-bc4d-f2e9a6c4116f" version = "1.0.3" +[[deps.SimpleBufferStream]] +git-tree-sha1 = "874e8867b33a00e784c8a7e4b60afe9e037b74e1" +uuid = "777ac1f9-54b0-4bf8-805c-2214025038e7" +version = "1.1.0" + [[deps.SimpleTraits]] deps = ["InteractiveUtils", "MacroTools"] git-tree-sha1 = "5d7e3f4e11935503d3ecaf7186eac40602e7d231" @@ -1558,9 +1547,9 @@ version = "0.4.1" [[deps.StaticArrays]] deps = ["LinearAlgebra", "Random", "StaticArraysCore", "Statistics"] -git-tree-sha1 = "9f8a5dc5944dc7fbbe6eb4180660935653b0a9d9" +git-tree-sha1 = "efa8acd030667776248eabb054b1836ac81d92f0" uuid = "90137ffa-7385-5640-81b9-e52037218182" -version = "1.5.0" +version = "1.5.7" [[deps.StaticArraysCore]] git-tree-sha1 = "ec2bd695e905a3c755b33026954b119ea17f2d22" @@ -1613,9 +1602,9 @@ uuid = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9" [[deps.SurfaceFluxes]] deps = ["DocStringExtensions", "KernelAbstractions", "RootSolvers", "StaticArrays", "Thermodynamics"] -git-tree-sha1 = "e688b5ce8576e1ff2d33efde2e5fab05db56aba9" +git-tree-sha1 = "28ed92a757032b1e85a839ac48316dc9c2688de0" uuid = "49b00bb7-8bd4-4f2b-b78c-51cd0450215f" -version = "0.4.0" +version = "0.4.6" [[deps.TOML]] deps = ["Dates"] @@ -1657,9 +1646,9 @@ version = "0.1.1" [[deps.TerminalLoggers]] deps = ["LeftChildRightSiblingTrees", "Logging", "Markdown", "Printf", "ProgressLogging", "UUIDs"] -git-tree-sha1 = "62846a48a6cd70e63aa29944b8c4ef704360d72f" +git-tree-sha1 = "f53e34e784ae771eb9ccde4d72e578aa453d0554" uuid = "5d786b92-1e48-4d6f-9151-6b4477ca9bed" -version = "0.1.5" +version = "0.1.6" [[deps.Test]] deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] @@ -1672,9 +1661,9 @@ version = "1.0.1" [[deps.Thermodynamics]] deps = ["DocStringExtensions", "KernelAbstractions", "Random", "RootSolvers"] -git-tree-sha1 = "64d0bb54626e3b898dc73087e39fd89820b6322f" +git-tree-sha1 = "0151b1a971fdd9438a6341ffde927efecfe275c1" uuid = "b60c26fb-14c3-4610-9d3e-2d17fe7ff00c" -version = "0.9.0" +version = "0.9.5" [[deps.ThreadingUtilities]] deps = ["ManualMemory"] @@ -1747,9 +1736,9 @@ uuid = "1cfade01-22cf-5700-b092-accc4b62d6e1" version = "0.4.1" [[deps.Unzip]] -git-tree-sha1 = "34db80951901073501137bdbc3d5a8e7bbd06670" +git-tree-sha1 = "ca0969166a028236229f63514992fc073799bb78" uuid = "41fe7b60-77ed-43a1-b4f0-825fd5a5650d" -version = "0.1.2" +version = "0.2.0" [[deps.VectorizationBase]] deps = ["ArrayInterface", "CPUSummary", "HostCPUFeatures", "IfElse", "LayoutPointers", "Libdl", "LinearAlgebra", "SIMDTypes", "Static"] diff --git a/experiments/AMIP/moist_mpi_earth/bucket/bucket_init.jl b/experiments/AMIP/moist_mpi_earth/bucket/bucket_init.jl index 6b6cdaedda..a454f255f7 100644 --- a/experiments/AMIP/moist_mpi_earth/bucket/bucket_init.jl +++ b/experiments/AMIP/moist_mpi_earth/bucket/bucket_init.jl @@ -5,11 +5,16 @@ import ClimaLSM include(joinpath(pkgdir(ClimaLSM), "parameters", "create_parameters.jl")) using ClimaLSM.Bucket: BucketModel, BucketModelParameters, AbstractAtmosphericDrivers, AbstractRadiativeDrivers -import ClimaLSM.Bucket: surface_fluxes, surface_air_density, liquid_precipitation, BulkAlbedo, surface_albedo +import ClimaLSM.Bucket: + surface_fluxes, + net_radiation, + surface_air_density, + liquid_precipitation, + BulkAlbedo, + surface_albedo, + snow_precipitation -using ClimaLSM: make_ode_function, initialize_prognostic, initialize_auxiliary - -import ClimaLSM: initialize +using ClimaLSM: make_ode_function, initialize, obtain_surface_space """ BucketSimulation{P, Y, D, I} @@ -23,19 +28,7 @@ struct BucketSimulation{P, Y, D, I} integrator::I end - -""" - initialize(model::BucketModel, space::ClimaCore.Spaces.AbstractSpace) - -A method for initializing land model variables from a predefined space. -""" -function initialize(model::BucketModel, space::ClimaCore.Spaces.AbstractSpace) - coords = ClimaCore.Fields.coordinate_field(space) - Y = initialize_prognostic(model, coords) - p = initialize_auxiliary(model, coords) - return Y, p, coords -end - +include("./bucket_utils.jl") """ CoupledRadiativeFluxes{FT} <: AbstractRadiativeDrivers{FT} @@ -58,14 +51,9 @@ struct CoupledAtmosphere{FT} <: AbstractAtmosphericDrivers{FT} end t::FT, parameters::P, atmos::PA, - radiation::PR, p, - ) where {FT <: AbstractFloat, P <: BucketModelParameters{FT}, PA <: CoupledAtmosphere{FT}, PR <: CoupledRadiativeFluxes{FT}} + ) where {FT <: AbstractFloat, P <: BucketModelParameters{FT}, PA <: CoupledAtmosphere{FT}} -Computes the surface flux terms at the ground for a coupled simulation: -net radiation, SHF, LHF, -as well as the water vapor flux (in units of m^3/m^2/s of water). -Positive fluxes indicate flow from the ground to the atmosphere. -Currently, we only support soil covered surfaces. +Computes the turbulent surface fluxes terms at the ground for a coupled simulation. """ function ClimaLSM.Bucket.surface_fluxes( Y::ClimaCore.Fields.FieldVector, @@ -73,12 +61,34 @@ function ClimaLSM.Bucket.surface_fluxes( t::FT, parameters::BucketModelParameters{FT, P}, atmos::CoupledAtmosphere{FT}, +) where {FT <: AbstractFloat, P} + # coupler has done its thing behind the scenes already + return (turbulent_energy_flux = p.bucket.turbulent_energy_flux, evaporation = p.bucket.evaporation) +end + + + +""" + net_radiation(Y, p, + t::FT, + parameters::P, + radiation::PR, p, + ) where {FT <: AbstractFloat, P <: BucketModelParameters{FT}, PR <: CoupledRadiativeFluxes{FT}} + +Computes the net radiative flux at the ground for a coupled simulation. +""" +function ClimaLSM.Bucket.net_radiation( + Y::ClimaCore.Fields.FieldVector, + p::ClimaCore.Fields.FieldVector, + t::FT, + parameters::BucketModelParameters{FT, P}, radiation::CoupledRadiativeFluxes{FT}, ) where {FT <: AbstractFloat, P} # coupler has done its thing behind the scenes already - return (R_n = p.bucket.R_n, LHF = p.bucket.LHF, SHF = p.bucket.SHF, E = p.bucket.E) + return p.bucket.R_n end + """ ClimaLSM.Bucket.surface_air_density(p, atmos::CoupledAtmosphere) @@ -102,75 +112,36 @@ function liquid_precipitation(p, atmos::CoupledAtmosphere, t) end """ - get_land_energy(slab_sim::BucketSimulation, T_sfc) - -Returns the volumetric internal energy of the bucket; a method for the -bucket model when used as the land model. -""" -function get_land_energy(slab_sim::BucketSimulation, T_sfc) - return get_bucket_energy(slab_sim, T_sfc) -end - -""" - get_land_temp(slab_sim::BucketSimulation) - -Returns the surface temperature of the earth; -a method for the bucket model -when used as the land model. -""" -function get_land_temp(slab_sim::BucketSimulation) - return slab_sim.integrator.u.bucket.T_sfc -end - -""" - get_land_roughness(slab_sim::BucketSimulation) - -Returns the roughness length parameters of the bucket; -a method for the bucket model -when used as the land model. -""" -function get_land_roughness(slab_sim::BucketSimulation) - return slab_sim.params.z_0m, slab_sim.params.z_0b -end - -""" - land_albedo(slab_sim::BucketSimulation) - -Returns the surface albedo of the earth; -a method for the bucket model -when used as the land model. -""" -function land_albedo(slab_sim::BucketSimulation) - coords = ClimaCore.Fields.coordinate_field(axes(slab_sim.integrator.u.bucket.S)) - α_land = surface_albedo.(Ref(slab_sim.params.albedo), coords, slab_sim.integrator.u.bucket.S, slab_sim.params.S_c) - return parent(α_land) -end - -""" - get_land_q(slab_sim::Bucketimulation, _...) + ClimaLSM.Bucket.snow_precipitation(p, atmos::CoupledAtmosphere, t) -Returns the surface specific humidity of the earth; -a method for the bucket -when used as the land model. +an extension of the bucket model method which returns the precipitation +(m/s) in the case of a coupled simulation. """ -function get_land_q(slab_sim::BucketSimulation, _...) - return slab_sim.integrator.p.bucket.q_sfc +function snow_precipitation(p, atmos::CoupledAtmosphere, t) + # coupler has filled this in + return p.bucket.P_snow end -""" - get_bucket_energy(bucket_sim, T_sfc) - -Returns the volumetric internal energy of the bucket land model. -""" -get_bucket_energy(bucket_sim, T_sfc) = bucket_sim.params.ρc_soil .* T_sfc .* bucket_sim.params.d_soil - - """ bucket_init -Initizliaes the bucket model variables. -""" -function bucket_init(::Type{FT}, tspan::Tuple{FT, FT}; space, dt::FT, saveat::FT, stepper = Euler()) where {FT} +Initializes the bucket model variables. +""" +function bucket_init( + ::Type{FT}, + tspan::Tuple{FT, FT}, + config::String; + space, + dt::FT, + saveat::FT, + stepper = Euler(), +) where {FT} + if config != "sphere" + println( + "Currently only spherical shell domains are supported; single column set-up will be addressed in future PR.", + ) + @assert config == "sphere" + end earth_param_set = create_lsm_parameters(FT) function α_soil(coordinate_point) @@ -180,24 +151,29 @@ function bucket_init(::Type{FT}, tspan::Tuple{FT, FT}; space, dt::FT, saveat::FT α_snow = FT(0.8) # snow albedo albedo = BulkAlbedo{FT}(α_snow, α_soil) - S_c = FT(0.2) + σS_c = FT(0.2) W_f = FT(0.15) d_soil = FT(3.5) # soil depth - T0 = FT(280.0) z_0m = FT(1e-2) z_0b = FT(1e-3) - κ_soil = FT(0.0)# setting this to zero allows us to test energy conservation; zero flux in soil column at bottom + κ_soil = FT(0.7) ρc_soil = FT(2e6) - params = BucketModelParameters(d_soil, T0, κ_soil, ρc_soil, albedo, S_c, W_f, z_0m, z_0b, earth_param_set) - - args = (params, CoupledAtmosphere{FT}(), CoupledRadiativeFluxes{FT}(), nothing) + t_crit = dt # This is the timescale on which snow exponentially damps to zero, in the case where all + # the snow would melt in time t_crit. It prevents us from having to specially time step in cases where + # all the snow melts in a single timestep. + params = BucketModelParameters(κ_soil, ρc_soil, albedo, σS_c, W_f, z_0m, z_0b, t_crit, earth_param_set) + n_vertical_elements = 7 + # Note that this does not take into account topography of the surface, which is OK for this land model. + # But it must be taken into account when computing surface fluxes, for Δz. + domain = make_lsm_domain(space, (-d_soil, FT(0.0)), n_vertical_elements) + args = (params, CoupledAtmosphere{FT}(), CoupledRadiativeFluxes{FT}(), domain) model = BucketModel{FT, typeof.(args)...}(args...) # Initial conditions with no moisture - Y, p, coords = initialize(model, space) + Y, p, coords = initialize(model) anomaly = true hs_sfc = false - Y.bucket.T_sfc = map(coords) do coord + Y.bucket.T = map(coords.subsurface) do coord T_sfc_0 = FT(280.0) radlat = coord.lat / FT(180) * pi ΔT = FT(0) @@ -216,14 +192,13 @@ function bucket_init(::Type{FT}, tspan::Tuple{FT, FT}; space, dt::FT, saveat::FT Y.bucket.W .= 0.14 Y.bucket.Ws .= 0.0 - Y.bucket.S .= 0.0 # no snow - # add ρ_sfc to cache - # this needs to be initialized!!! Turbulent surface fluxes need this set to be computed. - ρ_sfc = zeros(space) .+ FT(1.1) - P_liq = zeros(space) .+ FT(0.0) - variable_names = (propertynames(p.bucket)..., :ρ_sfc, :P_liq) + Y.bucket.σS .= 0.0 + ρ_sfc = zeros(axes(Y.bucket.W)) .+ FT(1.1) + P_liq = zeros(axes(Y.bucket.W)) .+ FT(0.0) + P_snow = zeros(axes(Y.bucket.W)) .+ FT(0.0) + variable_names = (propertynames(p.bucket)..., :ρ_sfc, :P_liq, :P_snow) orig_fields = map(x -> getproperty(p.bucket, x), propertynames(p.bucket)) - fields = (orig_fields..., ρ_sfc, P_liq) + fields = (orig_fields..., ρ_sfc, P_liq, P_snow) p_new = ClimaCore.Fields.FieldVector(; :bucket => (; zip(variable_names, fields)...)) ode_function! = make_ode_function(model) @@ -231,5 +206,5 @@ function bucket_init(::Type{FT}, tspan::Tuple{FT, FT}; space, dt::FT, saveat::FT prob = ODEProblem(ode_function!, Y, tspan, p_new) integrator = init(prob, stepper; dt = dt, saveat = saveat) - BucketSimulation(params, Y, space, integrator) + BucketSimulation(params, Y, (; domain = domain, soil_depth = d_soil), integrator) end diff --git a/experiments/AMIP/moist_mpi_earth/bucket/bucket_utils.jl b/experiments/AMIP/moist_mpi_earth/bucket/bucket_utils.jl new file mode 100644 index 0000000000..2f519ded8e --- /dev/null +++ b/experiments/AMIP/moist_mpi_earth/bucket/bucket_utils.jl @@ -0,0 +1,140 @@ +""" + get_land_temp(slab_sim::BucketSimulation) + +Returns the surface temperature of the earth; +a method for the bucket model +when used as the land model. +""" +function get_land_temp(slab_sim::BucketSimulation) + return slab_sim.integrator.p.bucket.T_sfc +end + + +""" + get_land_temp_from_state(land_sim, u) + +Returns the surface temperature of the earth, computed +from the state u. +""" +function get_land_temp_from_state(land_sim, u) + face_space = ClimaLSM.Domains.obtain_face_space(land_sim.domain.domain.subsurface.space) + N = ClimaCore.Spaces.nlevels(face_space) + interp_c2f = ClimaCore.Operators.InterpolateC2F( + top = ClimaCore.Operators.Extrapolate(), + bottom = ClimaCore.Operators.Extrapolate(), + ) + surface_space = land_sim.domain.domain.surface.space + return ClimaCore.Fields.Field( + ClimaCore.Fields.field_values( + ClimaCore.Fields.level(interp_c2f.(u.bucket.T), ClimaCore.Utilities.PlusHalf(N - 1)), + ), + surface_space, + ) +end + +""" + get_land_roughness(slab_sim::BucketSimulation) + +Returns the roughness length parameters of the bucket; +a method for the bucket model +when used as the land model. +""" +function get_land_roughness(slab_sim::BucketSimulation) + return slab_sim.params.z_0m, slab_sim.params.z_0b +end + +""" + land_albedo(slab_sim::BucketSimulation) + +Returns the surface albedo of the earth; +a method for the bucket model +when used as the land model. +""" +function land_albedo(slab_sim::BucketSimulation) + coords = ClimaCore.Fields.coordinate_field(axes(slab_sim.integrator.u.bucket.σS)) + α_land = surface_albedo.(Ref(slab_sim.params.albedo), coords, slab_sim.integrator.u.bucket.σS, slab_sim.params.σS_c) + return parent(α_land) +end + + +""" + get_land_q(slab_sim::Bucketimulation, _...) + +Returns the surface specific humidity of the earth; +a method for the bucket +when used as the land model. +""" +function get_land_q(slab_sim::BucketSimulation, _...) + return slab_sim.integrator.p.bucket.q_sfc +end + +""" + get_bucket_energy(bucket_sim) + +Returns the volumetric internal energy of the bucket land model. +""" +function get_land_energy(bucket_sim::BucketSimulation, e_per_area) + + e_per_area .= zeros(axes(bucket_sim.integrator.u.bucket.W)) + soil_depth = FT = eltype(bucket_sim.integrator.u.bucket.W) + ClimaCore.Fields.bycolumn(axes(bucket_sim.integrator.u.bucket.T)) do colidx + e_per_area[colidx] .= + bucket_sim.params.ρc_soil .* mean(bucket_sim.integrator.u.bucket.T[colidx]) .* bucket_sim.domain.soil_depth + end + + e_per_area .+= + -LSMP.LH_f0(bucket_sim.params.earth_param_set) .* LSMP.ρ_cloud_liq(bucket_sim.params.earth_param_set) .* + bucket_sim.integrator.u.bucket.σS + return e_per_area +end + + +""" + make_lsm_domain( + atmos_boundary_space::ClimaCore.Spaces.SpectralElementSpace2D, + zlim::Tuple{FT, FT}, + nelements_vert::Int,) where {FT} + +Creates the LSM Domain from the horizontal space of the atmosphere, and information +about the number of elements and extent of the vertical domain. +""" +function make_lsm_domain( + atmos_boundary_space::ClimaCore.Spaces.SpectralElementSpace2D, + zlim::Tuple{FT, FT}, + nelements_vert::Int, +) where {FT} + @assert zlim[1] < zlim[2] + height = zlim[2] - zlim[1] + radius = atmos_boundary_space.topology.mesh.domain.radius + npolynomial = ClimaCore.Spaces.Quadratures.polynomial_degree(atmos_boundary_space.quadrature_style) + nelements_horz = atmos_boundary_space.topology.mesh.ne + nelements = (nelements_horz, nelements_vert) + vertdomain = ClimaCore.Domains.IntervalDomain( + ClimaCore.Geometry.ZPoint(FT(zlim[1])), + ClimaCore.Geometry.ZPoint(FT(zlim[2])); + boundary_tags = (:bottom, :top), + ) + + vertmesh = ClimaCore.Meshes.IntervalMesh(vertdomain, ClimaCore.Meshes.Uniform(), nelems = nelements[2]) + verttopology = ClimaCore.Topologies.IntervalTopology(vertmesh) + vert_center_space = ClimaCore.Spaces.CenterFiniteDifferenceSpace(verttopology) + subsurface_space = ClimaCore.Spaces.ExtrudedFiniteDifferenceSpace(atmos_boundary_space, vert_center_space) + + surface_domain = ClimaLSM.Domains.SphericalSurface{FT, typeof(atmos_boundary_space)}( + radius, + nelements[1], + npolynomial, + atmos_boundary_space, + ) + subsurface_domain = ClimaLSM.Domains.SphericalShell{FT, typeof(subsurface_space)}( + radius, + height, + nelements, + npolynomial, + subsurface_space, + ) + return ClimaLSM.Domains.LSMSphericalShellDomain{FT, typeof(subsurface_space), typeof(atmos_boundary_space)}( + subsurface_domain, + surface_domain, + ) +end diff --git a/experiments/AMIP/moist_mpi_earth/coupler_driver.jl b/experiments/AMIP/moist_mpi_earth/coupler_driver.jl index 6d51254e47..c572b48901 100644 --- a/experiments/AMIP/moist_mpi_earth/coupler_driver.jl +++ b/experiments/AMIP/moist_mpi_earth/coupler_driver.jl @@ -21,7 +21,6 @@ include("cli_options.jl") mode_name = parsed_args["mode_name"] energy_check = parsed_args["energy_check"] const FT = parsed_args["FLOAT_TYPE"] == "Float64" ? Float64 : Float32 -land_sim_name = "bucket" t_end = FT(time_to_seconds(parsed_args["t_end"])) tspan = (0, t_end) Δt_cpl = FT(parsed_args["dt_cpl"]) @@ -42,6 +41,7 @@ parsed_args["config"] = "sphere" parsed_args["moist"] = "equil" parsed_args["nh_poly"] = 4 + import ClimaCoupler pkg_dir = pkgdir(ClimaCoupler) coupler_output_dir = joinpath(pkg_dir, "experiments/AMIP/moist_mpi_earth") @@ -66,7 +66,7 @@ include("atmos/atmos_init.jl") atmos_sim = atmos_init(FT, Y, integrator, params = params); # init a 2D bounary space at the surface, assuming the same instance (and MPI distribution if applicable) as the atmos domain above -boundary_space = ClimaCore.Fields.level(atmos_sim.domain.face_space, half) # global surface grid +boundary_space = atmos_sim.domain.face_space.horizontal_space # init land-sea mask land_mask = LandSeaMask(FT, mask_data, "LSMASK", boundary_space) @@ -79,7 +79,8 @@ include("slab/slab_init.jl") include("slab_ocean/slab_init.jl") include("slab_ice/slab_init.jl") -land_sim = bucket_init(FT, FT.(tspan); dt = FT(Δt_cpl), space = boundary_space, saveat = FT(saveat)) +land_sim = + bucket_init(FT, FT.(tspan), parsed_args["config"]; dt = FT(Δt_cpl), space = boundary_space, saveat = FT(saveat)) if mode_name == "amip" println("No ocean sim - do not expect energy conservation") @@ -132,7 +133,7 @@ elseif mode_name == "slabplanet" end # init coupler -coupler_field_names = (:T_S, :z0m_S, :z0b_S, :ρ_sfc, :q_sfc, :albedo, :F_A, :F_E, :F_R, :P_liq) +coupler_field_names = (:T_S, :z0m_S, :z0b_S, :ρ_sfc, :q_sfc, :albedo, :F_A, :F_E, :F_R, :P_liq, :P_snow) coupler_fields = NamedTuple{coupler_field_names}(ntuple(i -> ClimaCore.Fields.zeros(boundary_space), length(coupler_field_names))) model_sims = (atmos_sim = atmos_sim, ice_sim = ice_sim, land_sim = land_sim, ocean_sim = ocean_sim) diff --git a/experiments/AMIP/moist_mpi_earth/coupler_utils/conservation_checker.jl b/experiments/AMIP/moist_mpi_earth/coupler_utils/conservation_checker.jl index 2ebcec4421..62d29d9973 100644 --- a/experiments/AMIP/moist_mpi_earth/coupler_utils/conservation_checker.jl +++ b/experiments/AMIP/moist_mpi_earth/coupler_utils/conservation_checker.jl @@ -45,14 +45,14 @@ function check_conservation( ) @assert seaice_sim != nothing @assert atmos_sim != nothing - face_space = axes(atmos_sim.integrator.u.f) FT = eltype(coupler_sim.land_mask) - z = parent(Fields.coordinate_field(face_space).z) - Δz_bot = FT(0.5) * (z[2, 1, 1, 1, 1] - z[1, 1, 1, 1, 1]) u_atm = atmos_sim.integrator.u.c.ρe_tot - T_land = land_sim !== nothing ? get_land_temp(land_sim) : nothing - u_lnd = land_sim !== nothing ? swap_space!(T_land, coupler_sim.boundary_space) : nothing + if land_sim !== nothing + e_per_area_land = zeros(axes(land_sim.integrator.u.bucket.W)) + get_land_energy(land_sim, e_per_area_land) + end + u_ocn = ocean_sim !== nothing ? swap_space!(ocean_sim.integrator.u.T_sfc, coupler_sim.boundary_space) : nothing u_ice = seaice_sim !== nothing ? swap_space!(seaice_sim.integrator.u.T_sfc, coupler_sim.boundary_space) : nothing @@ -60,7 +60,8 @@ function check_conservation( atmos_e = sum(u_atm) if radiation - + face_space = axes(atmos_sim.integrator.u.f) + z = parent(Fields.coordinate_field(face_space).z) Δz_top = FT(0.5) * (z[end, 1, 1, 1, 1] - z[end - 1, 1, 1, 1, 1]) n_faces = length(z[:, 1, 1, 1, 1]) @@ -95,17 +96,17 @@ function check_conservation( ocean_mask(u_ocn_1, univ_mask) = (univ_mask ≈ FT(0) ? u_ocn_1 : FT(0)) # Save land - parent(u_lnd) .= land_mask.(parent(u_lnd), univ_mask) - land_e = land_sim !== nothing ? sum(get_land_energy(land_sim, u_lnd)) ./ Δz_bot : FT(0) + parent(e_per_area_land) .= land_mask.(parent(e_per_area_land), univ_mask) + land_e = land_sim !== nothing ? sum(e_per_area_land) : FT(0) push!(cc.ρe_tot_land, land_e) parent(u_ice) .= ice_mask.(parent(u_ice), univ_mask) - seaice_e = seaice_sim !== nothing ? sum(get_slab_energy(seaice_sim, u_ice)) ./ Δz_bot : FT(0) + seaice_e = seaice_sim !== nothing ? sum(get_slab_energy(seaice_sim, u_ice)) : FT(0) push!(cc.ρe_tot_seaice, seaice_e) if ocean_sim != nothing parent(u_ocn) .= ocean_mask.(parent(u_ocn), univ_mask) - ocean_e = sum(get_slab_energy(ocean_sim, u_ocn)) ./ Δz_bot + ocean_e = sum(get_slab_energy(ocean_sim, u_ocn)) else ocean_e = FT(0) end diff --git a/experiments/AMIP/moist_mpi_earth/coupler_utils/flux_calculator.jl b/experiments/AMIP/moist_mpi_earth/coupler_utils/flux_calculator.jl index 3c3a5db05d..75f5cf2576 100644 --- a/experiments/AMIP/moist_mpi_earth/coupler_utils/flux_calculator.jl +++ b/experiments/AMIP/moist_mpi_earth/coupler_utils/flux_calculator.jl @@ -127,7 +127,7 @@ function constant_T_saturated_surface_coefs_coupled( # calculate all fluxes tsf = SF.surface_conditions(surface_flux_params, sc) - E = SF.evaporation(sc, surface_flux_params, tsf.Ch) + E = SF.evaporation(surface_flux_params, sc, tsf.Ch) return (; shf = tsf.shf, lhf = tsf.lhf, E = E, ρτxz = tsf.ρτxz, ρτyz = tsf.ρτyz) end diff --git a/experiments/AMIP/moist_mpi_earth/coupler_utils/viz_explorer.jl b/experiments/AMIP/moist_mpi_earth/coupler_utils/viz_explorer.jl index 64746856e3..a380b7e460 100644 --- a/experiments/AMIP/moist_mpi_earth/coupler_utils/viz_explorer.jl +++ b/experiments/AMIP/moist_mpi_earth/coupler_utils/viz_explorer.jl @@ -41,15 +41,17 @@ function plot_anim(cs, out_dir = ".") sol_slab_ocean = slab_ocean_sim.integrator.sol anim = Plots.@animate for (bucketu, oceanu, iceu) in zip(sol_slab.u, sol_slab_ocean.u, sol_slab_ice.u) + land_T_sfc = get_land_temp_from_state(cs.model_sims.land_sim, bucketu) parent(combined_field) .= - combine_surface.(FT, univ_mask, parent(bucketu.bucket.T_sfc), parent(oceanu.T_sfc), parent(iceu.T_sfc)) + combine_surface.(FT, univ_mask, parent(land_T_sfc), parent(oceanu.T_sfc), parent(iceu.T_sfc)) Plots.plot(combined_field) end elseif mode_name == "amip" anim = Plots.@animate for (bucketu, iceu) in zip(sol_slab.u, sol_slab_ice.u) + land_T_sfc = get_land_temp_from_state(cs.model_sims.land_sim, bucketu) parent(combined_field) .= - combine_surface.(FT, univ_mask, parent(bucketu.bucket.T_sfc), parent(SST), parent(iceu.T_sfc)) + combine_surface.(FT, univ_mask, parent(land_T_sfc), parent(SST), parent(iceu.T_sfc)) Plots.plot(combined_field) end @@ -64,6 +66,14 @@ function plot_anim(cs, out_dir = ".") end Plots.mp4(anim, joinpath(out_dir, "bucket_W.mp4"), fps = 10) + combined_field = zeros(boundary_space) + anim = Plots.@animate for bucketu in sol_slab.u + parent(combined_field) .= combine_surface.(FT, univ_mask, parent(bucketu.bucket.σS), 0.0, 0.0) + + Plots.plot(combined_field) + end + Plots.mp4(anim, joinpath(out_dir, "bucket_snow.mp4"), fps = 10) + # plot surface fluxes # TODO as part of the flux accumulation PR end diff --git a/experiments/AMIP/moist_mpi_earth/push_pull.jl b/experiments/AMIP/moist_mpi_earth/push_pull.jl index 67705c9bb8..426ce50dd8 100644 --- a/experiments/AMIP/moist_mpi_earth/push_pull.jl +++ b/experiments/AMIP/moist_mpi_earth/push_pull.jl @@ -8,23 +8,11 @@ function atmos_push!(cs) csf = cs.fields dummmy_remap!(csf.F_A, atmos_sim.integrator.p.dif_flux_energy) dummmy_remap!(csf.F_E, atmos_sim.integrator.p.dif_flux_ρq_tot) - dummmy_remap!(csf.P_liq, atmos_sim.integrator.p.col_integrated_rain) + dummmy_remap!(csf.P_liq, atmos_sim.integrator.p.col_integrated_rain .+ atmos_sim.integrator.p.col_integrated_snow) cs.parsed_args["rad"] == "gray" ? dummmy_remap!(csf.F_R, level(atmos_sim.integrator.p.ᶠradiation_flux, half)) : nothing end -""" - land_pull!(cs) - -Updates the land_sim cache state in place with the current values of F_A and F_R. -""" -function land_pull!(cs) - land_sim = cs.model_sims.land_sim - csf = cs.fields - @. land_sim.integrator.p.F_aero = csf.F_A - @. land_sim.integrator.p.F_rad = csf.F_R -end - """ land_pull!(cs) @@ -37,13 +25,14 @@ function land_pull!(cs) land_sim = cs.model_sims.land_sim csf = cs.fields FT = cs.FT - @. land_sim.integrator.p.bucket.ρ_sfc = csf.ρ_sfc - @. land_sim.integrator.p.bucket.SHF = csf.F_A - @. land_sim.integrator.p.bucket.LHF = FT(0.0) + parent(land_sim.integrator.p.bucket.ρ_sfc) .= parent(csf.ρ_sfc) + parent(land_sim.integrator.p.bucket.turbulent_energy_flux) .= parent(csf.F_A) ρ_liq = (LSMP.ρ_cloud_liq(land_sim.params.earth_param_set)) - @. land_sim.integrator.p.bucket.E = csf.F_E / ρ_liq - @. land_sim.integrator.p.bucket.R_n = csf.F_R - @. land_sim.integrator.p.bucket.P_liq = FT(-1.0) .* csf.P_liq # land expects this to be positive + parent(land_sim.integrator.p.bucket.evaporation) .= parent(csf.F_E) ./ ρ_liq + parent(land_sim.integrator.p.bucket.R_n) .= parent(csf.F_R) + parent(land_sim.integrator.p.bucket.P_liq) .= FT(-1.0) .* parent(csf.P_liq) # land expects this to be positive + parent(land_sim.integrator.p.bucket.P_snow) .= FT(0.0) .* parent(csf.P_snow) + end """ diff --git a/experiments/AMIP/moist_mpi_earth/slab/slab_utils.jl b/experiments/AMIP/moist_mpi_earth/slab/slab_utils.jl index 8f0b83386a..d511c9bbf4 100644 --- a/experiments/AMIP/moist_mpi_earth/slab/slab_utils.jl +++ b/experiments/AMIP/moist_mpi_earth/slab/slab_utils.jl @@ -13,7 +13,7 @@ end """ get_slab_energy(slab_sim, T_sfc) -Returns the volumetric internal energy of the slab. +Returns the internal energy per unit area of the slab. """ get_slab_energy(slab_sim, T_sfc) = slab_sim.integrator.p.params.ρ .* slab_sim.integrator.p.params.c .* T_sfc .* slab_sim.integrator.p.params.h