From 6c2d25e31340192f4249565b106a76b8fcb39397 Mon Sep 17 00:00:00 2001 From: louis Date: Tue, 2 Jul 2024 18:11:40 +0100 Subject: [PATCH 01/27] some stuff --- Manifest.toml | 909 +++++++++++++++++++++++++++++++++++++++++++++++++- Project.toml | 2 + 2 files changed, 903 insertions(+), 8 deletions(-) diff --git a/Manifest.toml b/Manifest.toml index 8babc3a20..6d2bfbfbc 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -1,8 +1,13 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.10.2" +julia_version = "1.10.4" manifest_format = "2.0" -project_hash = "4319b71589d68d891265adf31b9a9017f2b1b326" +project_hash = "d1e46ace99d85a0b6e3708b6e3a131b205012458" + +[[deps.ANSIColoredPrinters]] +git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c" +uuid = "a4c015fc-c6ff-483c-b24f-f7ea428134e9" +version = "0.0.1" [[deps.AbstractFFTs]] deps = ["LinearAlgebra"] @@ -15,6 +20,11 @@ weakdeps = ["ChainRulesCore", "Test"] AbstractFFTsChainRulesCoreExt = "ChainRulesCore" AbstractFFTsTestExt = "Test" +[[deps.AbstractTrees]] +git-tree-sha1 = "2d9c9a55f9c93e8887ad391fbae72f8ef55e1177" +uuid = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" +version = "0.4.5" + [[deps.Accessors]] deps = ["CompositionsBase", "ConstructionBase", "Dates", "InverseFunctions", "LinearAlgebra", "MacroTools", "Markdown", "Test"] git-tree-sha1 = "c0d491ef0b135fd7d63cbc6404286bc633329425" @@ -46,6 +56,18 @@ weakdeps = ["StaticArrays"] [deps.Adapt.extensions] AdaptStaticArraysExt = "StaticArrays" +[[deps.AliasTables]] +deps = ["PtrArrays", "Random"] +git-tree-sha1 = "9876e1e164b144ca45e9e3198d0b689cadfed9ff" +uuid = "66dad0bd-aa9a-41b7-9441-69ab47430ed8" +version = "1.1.3" + +[[deps.Animations]] +deps = ["Colors"] +git-tree-sha1 = "e81c509d2c8e49592413bfb0bb3b08150056c79d" +uuid = "27a7e980-b3e6-11e9-2bcd-0b925532e340" +version = "0.4.1" + [[deps.ArgTools]] uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" version = "1.1.1" @@ -87,6 +109,24 @@ git-tree-sha1 = "c06a868224ecba914baa6942988e2f2aade419be" uuid = "a9b6321e-bd34-4604-b9c9-b65b8de01458" version = "0.1.0" +[[deps.Automa]] +deps = ["PrecompileTools", "TranscodingStreams"] +git-tree-sha1 = "588e0d680ad1d7201d4c6a804dcb1cd9cba79fbb" +uuid = "67c07d97-cdcb-5c2c-af73-a7f9c32a568b" +version = "1.0.3" + +[[deps.AxisAlgorithms]] +deps = ["LinearAlgebra", "Random", "SparseArrays", "WoodburyMatrices"] +git-tree-sha1 = "01b8ccb13d68535d73d2b0c23e39bd23155fb712" +uuid = "13072b0f-2c55-5437-9ae7-d433b7a33950" +version = "1.1.0" + +[[deps.AxisArrays]] +deps = ["Dates", "IntervalSets", "IterTools", "RangeArrays"] +git-tree-sha1 = "16351be62963a67ac4083f748fdb3cca58bfd52f" +uuid = "39de3d68-74b9-583c-8d2d-e117c070f3a9" +version = "0.4.7" + [[deps.BFloat16s]] deps = ["LinearAlgebra", "Printf", "Random", "Test"] git-tree-sha1 = "2c7cc21e8678eff479978a0a2ef5ce2f51b63dff" @@ -119,6 +159,21 @@ git-tree-sha1 = "5afb5c5ba2688ca43a9ad2e5a91cbb93921ccfa1" uuid = "179af706-886a-5703-950a-314cd64e0468" version = "0.1.3" +[[deps.CRC32c]] +uuid = "8bf52ea8-c179-5cab-976a-9e18b702a9bc" + +[[deps.CRlibm]] +deps = ["CRlibm_jll"] +git-tree-sha1 = "32abd86e3c2025db5172aa182b982debed519834" +uuid = "96374032-68de-5a5b-8d9e-752f78720389" +version = "1.0.1" + +[[deps.CRlibm_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "e329286945d0cfc04456972ea732551869af1cfc" +uuid = "4e9b3aee-d8a1-5a3d-ad8b-7d824db253f0" +version = "1.0.1+0" + [[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 = "6e945e876652f2003e6ca74e19a3c45017d3e9f6" @@ -153,6 +208,30 @@ git-tree-sha1 = "bcba305388e16aa5c879e896726db9e71b4942c6" uuid = "76a88914-d11a-5bdc-97e0-2f5a05c973a2" version = "0.14.0+1" +[[deps.Cairo]] +deps = ["Cairo_jll", "Colors", "Glib_jll", "Graphics", "Libdl", "Pango_jll"] +git-tree-sha1 = "d0b3f8b4ad16cb0a2988c6788646a5e6a17b6b1b" +uuid = "159f3aea-2a34-519c-b102-8c37f9878175" +version = "1.0.5" + +[[deps.CairoMakie]] +deps = ["CRC32c", "Cairo", "Cairo_jll", "Colors", "FileIO", "FreeType", "GeometryBasics", "LinearAlgebra", "Makie", "PrecompileTools"] +git-tree-sha1 = "3441d68ea63944a2b9b6de76603ec1c8b0fd4e3e" +uuid = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" +version = "0.12.3" + +[[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 = "a2f1c8c668c8e3cb4cca4e57a8efdb09067bb3fd" +uuid = "83423d85-b0ee-5818-9007-b63ccbeb887a" +version = "1.18.0+2" + +[[deps.Calculus]] +deps = ["LinearAlgebra"] +git-tree-sha1 = "f641eb0a4f00c343bbc32346e1217b86f3ce9dad" +uuid = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9" +version = "0.5.1" + [[deps.ChainRulesCore]] deps = ["Compat", "LinearAlgebra"] git-tree-sha1 = "71acdbf594aab5bbb2cec89b208c41b4c411e49f" @@ -163,12 +242,40 @@ weakdeps = ["SparseArrays"] [deps.ChainRulesCore.extensions] ChainRulesCoreSparseArraysExt = "SparseArrays" +[[deps.CodecZlib]] +deps = ["TranscodingStreams", "Zlib_jll"] +git-tree-sha1 = "59939d8a997469ee05c4b4944560a820f9ba0d73" +uuid = "944b1d66-785c-5afd-91f1-9de20f533193" +version = "0.7.4" + +[[deps.ColorBrewer]] +deps = ["Colors", "JSON", "Test"] +git-tree-sha1 = "61c5334f33d91e570e1d0c3eb5465835242582c4" +uuid = "a2cac450-b92f-5266-8821-25eda20663c8" +version = "0.4.0" + +[[deps.ColorSchemes]] +deps = ["ColorTypes", "ColorVectorSpace", "Colors", "FixedPointNumbers", "PrecompileTools", "Random"] +git-tree-sha1 = "4b270d6465eb21ae89b732182c20dc165f8bf9f2" +uuid = "35d6a980-a343-548e-a6ea-1d62b119f2f4" +version = "3.25.0" + [[deps.ColorTypes]] deps = ["FixedPointNumbers", "Random"] git-tree-sha1 = "b10d0b65641d57b8b4d5e234446582de5047050d" uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f" version = "0.11.5" +[[deps.ColorVectorSpace]] +deps = ["ColorTypes", "FixedPointNumbers", "LinearAlgebra", "Requires", "Statistics", "TensorCore"] +git-tree-sha1 = "a1f44953f2382ebb937d60dafbe2deea4bd23249" +uuid = "c3611d14-8923-5661-9e6a-0046d554d3a4" +version = "0.10.0" +weakdeps = ["SpecialFunctions"] + + [deps.ColorVectorSpace.extensions] + SpecialFunctionsExt = "SpecialFunctions" + [[deps.Colors]] deps = ["ColorTypes", "FixedPointNumbers", "Reexport"] git-tree-sha1 = "362a287c3aa50601b0bc359053d5c2468f0e7ce0" @@ -204,7 +311,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" @@ -220,14 +327,16 @@ deps = ["LinearAlgebra"] git-tree-sha1 = "260fd2400ed2dab602a7c15cf10c1933c59930a2" uuid = "187b0558-2788-49d3-abe0-74a17ed4e7c9" version = "1.5.5" +weakdeps = ["IntervalSets", "StaticArrays"] [deps.ConstructionBase.extensions] ConstructionBaseIntervalSetsExt = "IntervalSets" ConstructionBaseStaticArraysExt = "StaticArrays" - [deps.ConstructionBase.weakdeps] - IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953" - StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" +[[deps.Contour]] +git-tree-sha1 = "439e35b0b36e2e5881738abc8857bd92ad6ff9a8" +uuid = "d38c429a-6771-53c6-b99e-75d170b6e991" +version = "0.6.3" [[deps.Crayons]] git-tree-sha1 = "249fe38abf76d48563e2f4556bebd215aa317e15" @@ -266,6 +375,12 @@ version = "1.0.0" deps = ["Printf"] uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" +[[deps.DelaunayTriangulation]] +deps = ["EnumX", "ExactPredicates", "Random"] +git-tree-sha1 = "1755070db557ec2c37df2664c75600298b0c1cfc" +uuid = "927a84f5-c5f4-47a5-9785-b46e178433df" +version = "1.0.3" + [[deps.DiskArrays]] deps = ["LRUCache", "OffsetArrays"] git-tree-sha1 = "ef25c513cad08d7ebbed158c91768ae32f308336" @@ -287,27 +402,94 @@ weakdeps = ["ChainRulesCore", "SparseArrays"] deps = ["Random", "Serialization", "Sockets"] uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" +[[deps.Distributions]] +deps = ["AliasTables", "FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "SpecialFunctions", "Statistics", "StatsAPI", "StatsBase", "StatsFuns"] +git-tree-sha1 = "9c405847cc7ecda2dc921ccf18b47ca150d7317e" +uuid = "31c24e10-a181-5473-b8eb-7969acd0382f" +version = "0.25.109" + + [deps.Distributions.extensions] + DistributionsChainRulesCoreExt = "ChainRulesCore" + DistributionsDensityInterfaceExt = "DensityInterface" + DistributionsTestExt = "Test" + + [deps.Distributions.weakdeps] + ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" + DensityInterface = "b429d917-457f-4dbc-8f4c-0cc954292b1d" + Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + [[deps.DocStringExtensions]] deps = ["LibGit2"] git-tree-sha1 = "2fb1e02f2b635d0845df5d7c167fec4dd739b00d" uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" version = "0.9.3" +[[deps.Documenter]] +deps = ["ANSIColoredPrinters", "AbstractTrees", "Base64", "CodecZlib", "Dates", "DocStringExtensions", "Downloads", "Git", "IOCapture", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "MarkdownAST", "Pkg", "PrecompileTools", "REPL", "RegistryInstances", "SHA", "TOML", "Test", "Unicode"] +git-tree-sha1 = "76deb8c15f37a3853f13ea2226b8f2577652de05" +uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +version = "1.5.0" + [[deps.Downloads]] deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" version = "1.6.0" +[[deps.DualNumbers]] +deps = ["Calculus", "NaNMath", "SpecialFunctions"] +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 = "e3290f2d49e661fbd94046d7e3726ffcb2d41053" +uuid = "5ae413db-bbd1-5e63-b57d-d24a61df00f5" +version = "2.2.4+0" + [[deps.Elliptic]] git-tree-sha1 = "71c79e77221ab3a29918aaf6db4f217b89138608" uuid = "b305315f-e792-5b7a-8f41-49f472929428" version = "1.0.1" +[[deps.EnumX]] +git-tree-sha1 = "bdb1942cd4c45e3c678fd11569d5cccd80976237" +uuid = "4e289a0a-7415-4d19-859d-a7e5c4648b56" +version = "1.0.4" + +[[deps.ErrorfreeArithmetic]] +git-tree-sha1 = "d6863c556f1142a061532e79f611aa46be201686" +uuid = "90fa49ef-747e-5e6f-a989-263ba693cf1a" +version = "0.5.2" + +[[deps.ExactPredicates]] +deps = ["IntervalArithmetic", "Random", "StaticArraysCore", "Test"] +git-tree-sha1 = "276e83bc8b21589b79303b9985c321024ffdf59c" +uuid = "429591f6-91af-11e9-00e2-59fbe8cec110" +version = "2.2.5" + +[[deps.Expat_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "1c6317308b9dc757616f0b5cb379db10494443a7" +uuid = "2e619515-83b5-522b-bb60-26c02a35a201" +version = "2.6.2+0" + [[deps.ExprTools]] git-tree-sha1 = "27415f162e6028e81c72b82ef756bf321213b6ec" uuid = "e2ba6199-217a-4e67-a87a-7c52f15ade04" version = "0.1.10" +[[deps.Extents]] +git-tree-sha1 = "94997910aca72897524d2237c41eb852153b0f65" +uuid = "411431e0-e8b7-467b-b5e0-f676ba4f2910" +version = "0.1.3" + +[[deps.FFMPEG_jll]] +deps = ["Artifacts", "Bzip2_jll", "FreeType2_jll", "FriBidi_jll", "JLLWrappers", "LAME_jll", "Libdl", "Ogg_jll", "OpenSSL_jll", "Opus_jll", "PCRE2_jll", "Zlib_jll", "libaom_jll", "libass_jll", "libfdk_aac_jll", "libvorbis_jll", "x264_jll", "x265_jll"] +git-tree-sha1 = "ab3f7e1819dba9434a3a5126510c8fda3a4e7000" +uuid = "b22a6f82-2f65-5046-a5b2-351ab43fb4e5" +version = "6.1.1+0" + [[deps.FFTW]] deps = ["AbstractFFTs", "FFTW_jll", "LinearAlgebra", "MKL_jll", "Preferences", "Reexport"] git-tree-sha1 = "4820348781ae578893311153d69049a93d05f39d" @@ -320,21 +502,86 @@ git-tree-sha1 = "c6033cc3892d0ef5bb9cd29b7f2f0331ea5184ea" uuid = "f5851436-0d7a-5f13-b9de-f02708fd171a" version = "3.3.10+0" +[[deps.FastRounding]] +deps = ["ErrorfreeArithmetic", "LinearAlgebra"] +git-tree-sha1 = "6344aa18f654196be82e62816935225b3b9abe44" +uuid = "fa42c844-2597-5d31-933b-ebd51ab2693f" +version = "0.3.1" + [[deps.FileIO]] deps = ["Pkg", "Requires", "UUIDs"] git-tree-sha1 = "82d8afa92ecf4b52d78d869f038ebfb881267322" uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" version = "1.16.3" +[[deps.FilePaths]] +deps = ["FilePathsBase", "MacroTools", "Reexport", "Requires"] +git-tree-sha1 = "919d9412dbf53a2e6fe74af62a73ceed0bce0629" +uuid = "8fc22ac5-c921-52a6-82fd-178b2807b824" +version = "0.8.3" + +[[deps.FilePathsBase]] +deps = ["Compat", "Dates", "Mmap", "Printf", "Test", "UUIDs"] +git-tree-sha1 = "9f00e42f8d99fdde64d40c8ea5d14269a2e2c1aa" +uuid = "48062228-2e41-5def-b9a4-89aafe57970f" +version = "0.9.21" + [[deps.FileWatching]] uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" +[[deps.FillArrays]] +deps = ["LinearAlgebra"] +git-tree-sha1 = "0653c0a2396a6da5bc4766c43041ef5fd3efbe57" +uuid = "1a297f60-69ca-5386-bcde-b61e274b549b" +version = "1.11.0" +weakdeps = ["PDMats", "SparseArrays", "Statistics"] + + [deps.FillArrays.extensions] + FillArraysPDMatsExt = "PDMats" + FillArraysSparseArraysExt = "SparseArrays" + FillArraysStatisticsExt = "Statistics" + [[deps.FixedPointNumbers]] deps = ["Statistics"] git-tree-sha1 = "05882d6995ae5c12bb5f36dd2ed3f61c98cbb172" uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93" version = "0.8.5" +[[deps.Fontconfig_jll]] +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.96+0" + +[[deps.Format]] +git-tree-sha1 = "9c68794ef81b08086aeb32eeaf33531668d5f5fc" +uuid = "1fa38f19-a742-5d3f-a2b9-30dd87b9d5f8" +version = "1.3.7" + +[[deps.FreeType]] +deps = ["CEnum", "FreeType2_jll"] +git-tree-sha1 = "907369da0f8e80728ab49c1c7e09327bf0d6d999" +uuid = "b38be410-82b0-50bf-ab77-7b57e271db43" +version = "4.1.1" + +[[deps.FreeType2_jll]] +deps = ["Artifacts", "Bzip2_jll", "JLLWrappers", "Libdl", "Zlib_jll"] +git-tree-sha1 = "5c1d8ae0efc6c2e7b1fc502cbe25def8f661b7bc" +uuid = "d7e528f0-a631-5988-bf34-fe36492bcfd7" +version = "2.13.2+0" + +[[deps.FreeTypeAbstraction]] +deps = ["ColorVectorSpace", "Colors", "FreeType", "GeometryBasics"] +git-tree-sha1 = "2493cdfd0740015955a8e46de4ef28f49460d8bc" +uuid = "663a7486-cb36-511b-a19d-713bb74d65c9" +version = "0.10.3" + +[[deps.FriBidi_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "1ed150b39aebcc805c26b93a8d0122c940f64ce2" +uuid = "559328eb-81f9-559d-9380-de523a88c83c" +version = "1.0.14+0" + [[deps.Future]] deps = ["Random"] uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820" @@ -362,6 +609,42 @@ git-tree-sha1 = "518ebd058c9895de468a8c255797b0c53fdb44dd" uuid = "61eb1bfa-7361-4325-ad38-22787b887f55" version = "0.26.5" +[[deps.GeoInterface]] +deps = ["Extents"] +git-tree-sha1 = "9fff8990361d5127b770e3454488360443019bb3" +uuid = "cf35fbd7-0cd7-5166-be24-54bfbe79505f" +version = "1.3.5" + +[[deps.GeometryBasics]] +deps = ["EarCut_jll", "Extents", "GeoInterface", "IterTools", "LinearAlgebra", "StaticArrays", "StructArrays", "Tables"] +git-tree-sha1 = "b62f2b2d76cee0d61a2ef2b3118cd2a3215d3134" +uuid = "5c1252a2-5f33-56bf-86c9-59e7332b4326" +version = "0.4.11" + +[[deps.Gettext_jll]] +deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Libiconv_jll", "Pkg", "XML2_jll"] +git-tree-sha1 = "9b02998aba7bf074d14de89f9d37ca24a1a0b046" +uuid = "78b55507-aeef-58d4-861c-77aaff3498b1" +version = "0.21.0+0" + +[[deps.Git]] +deps = ["Git_jll"] +git-tree-sha1 = "04eff47b1354d702c3a85e8ab23d539bb7d5957e" +uuid = "d7ba0133-e1db-5d97-8f8c-041e4b3a1eb2" +version = "1.3.1" + +[[deps.Git_jll]] +deps = ["Artifacts", "Expat_jll", "JLLWrappers", "LibCURL_jll", "Libdl", "Libiconv_jll", "OpenSSL_jll", "PCRE2_jll", "Zlib_jll"] +git-tree-sha1 = "d18fb8a1f3609361ebda9bf029b60fd0f120c809" +uuid = "f8c6e375-362e-5223-8a59-34ff63f689eb" +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 = "7c82e6a6cd34e9d935e9aa4051b66c6ff3af59ba" +uuid = "7746bdde-850d-59dc-9ae8-88ece973131d" +version = "2.80.2+0" + [[deps.Glob]] git-tree-sha1 = "97285bbd5230dd766e9ef6749b80fc617126d496" uuid = "c27321d9-0574-5035-807b-f59d2c89b15c" @@ -373,29 +656,116 @@ git-tree-sha1 = "383db7d3f900f4c1f47a8a04115b053c095e48d3" uuid = "0951126a-58fd-58f1-b5b3-b08c7c4a876d" version = "3.8.4+0" +[[deps.Graphics]] +deps = ["Colors", "LinearAlgebra", "NaNMath"] +git-tree-sha1 = "d61890399bc535850c4bf08e4e0d3a7ad0f21cbd" +uuid = "a2bd30eb-e257-5431-a919-1863eab51364" +version = "1.1.2" + +[[deps.Graphite2_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "344bf40dcab1073aca04aa0df4fb092f920e4011" +uuid = "3b182d85-2403-5c21-9c21-1e1f0cc25472" +version = "1.3.14+0" + +[[deps.GridLayoutBase]] +deps = ["GeometryBasics", "InteractiveUtils", "Observables"] +git-tree-sha1 = "fc713f007cff99ff9e50accba6373624ddd33588" +uuid = "3955a311-db13-416c-9275-1d80ed98e5e9" +version = "0.11.0" + +[[deps.Grisu]] +git-tree-sha1 = "53bb909d1151e57e2484c3d1b53e19552b887fb2" +uuid = "42e2da0e-8278-4e71-bc24-59509adca0fe" +version = "1.0.2" + [[deps.HDF5_jll]] 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.2+1" +[[deps.HarfBuzz_jll]] +deps = ["Artifacts", "Cairo_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "Graphite2_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Pkg"] +git-tree-sha1 = "129acf094d168394e80ee1dc4bc06ec835e510a3" +uuid = "2e76f6c2-a576-52d4-95c1-20adfe4de566" +version = "2.8.1+1" + [[deps.Hwloc_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] git-tree-sha1 = "1d334207121865ac8c1c97eb7f42d0339e4635bf" uuid = "e33a78d0-f292-5ffc-b300-72abe9b543c8" version = "2.11.0+0" +[[deps.HypergeometricFunctions]] +deps = ["DualNumbers", "LinearAlgebra", "OpenLibm_jll", "SpecialFunctions"] +git-tree-sha1 = "f218fe3736ddf977e0e772bc9a586b2383da2685" +uuid = "34004b35-14d8-5ef3-9330-4cdb6864b03a" +version = "0.3.23" + +[[deps.IOCapture]] +deps = ["Logging", "Random"] +git-tree-sha1 = "b6d6bfdd7ce25b0f9b2f6b3dd56b2673a66c8770" +uuid = "b5f81e59-6552-4d32-b1f0-c071b021bf89" +version = "0.2.5" + [[deps.IfElse]] git-tree-sha1 = "debdd00ffef04665ccbb3e150747a77560e8fad1" uuid = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173" version = "0.1.1" +[[deps.ImageAxes]] +deps = ["AxisArrays", "ImageBase", "ImageCore", "Reexport", "SimpleTraits"] +git-tree-sha1 = "2e4520d67b0cef90865b3ef727594d2a58e0e1f8" +uuid = "2803e5a7-5153-5ecf-9a86-9b4c37f5f5ac" +version = "0.6.11" + +[[deps.ImageBase]] +deps = ["ImageCore", "Reexport"] +git-tree-sha1 = "eb49b82c172811fd2c86759fa0553a2221feb909" +uuid = "c817782e-172a-44cc-b673-b171935fbb9e" +version = "0.1.7" + +[[deps.ImageCore]] +deps = ["ColorVectorSpace", "Colors", "FixedPointNumbers", "MappedArrays", "MosaicViews", "OffsetArrays", "PaddedViews", "PrecompileTools", "Reexport"] +git-tree-sha1 = "b2a7eaa169c13f5bcae8131a83bc30eff8f71be0" +uuid = "a09fc81d-aa75-5fe9-8630-4744c3626534" +version = "0.10.2" + +[[deps.ImageIO]] +deps = ["FileIO", "IndirectArrays", "JpegTurbo", "LazyModules", "Netpbm", "OpenEXR", "PNGFiles", "QOI", "Sixel", "TiffImages", "UUIDs"] +git-tree-sha1 = "437abb322a41d527c197fa800455f79d414f0a3c" +uuid = "82e4d734-157c-48bb-816b-45c225c6df19" +version = "0.6.8" + +[[deps.ImageMetadata]] +deps = ["AxisArrays", "ImageAxes", "ImageBase", "ImageCore"] +git-tree-sha1 = "355e2b974f2e3212a75dfb60519de21361ad3cb7" +uuid = "bc367c6b-8a6b-528e-b4bd-a4b897500b49" +version = "0.9.9" + +[[deps.Imath_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "0936ba688c6d201805a83da835b55c61a180db52" +uuid = "905a6f67-0a94-5f89-b386-d35d92009cd1" +version = "3.1.11+0" + [[deps.IncompleteLU]] deps = ["LinearAlgebra", "SparseArrays"] git-tree-sha1 = "6c676e79f98abb6d33fa28122cad099f1e464afe" uuid = "40713840-3770-5561-ab4c-a76e7d0d7895" version = "0.2.1" +[[deps.IndirectArrays]] +git-tree-sha1 = "012e604e1c7458645cb8b436f8fba789a51b257f" +uuid = "9b13fd28-a010-5f03-acff-a1bbcff69959" +version = "1.0.0" + +[[deps.Inflate]] +git-tree-sha1 = "d1b1b796e47d94588b3757fe84fbf65a5ec4a80d" +uuid = "d25df0c9-e2be-5dd7-82c8-3ad0b3e990b9" +version = "0.1.5" + [[deps.InlineStrings]] deps = ["Parsers"] git-tree-sha1 = "86356004f30f8e737eff143d57d41bd580e437aa" @@ -418,6 +788,33 @@ version = "2024.1.0+0" deps = ["Markdown"] uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" +[[deps.Interpolations]] +deps = ["Adapt", "AxisAlgorithms", "ChainRulesCore", "LinearAlgebra", "OffsetArrays", "Random", "Ratios", "Requires", "SharedArrays", "SparseArrays", "StaticArrays", "WoodburyMatrices"] +git-tree-sha1 = "88a101217d7cb38a7b481ccd50d21876e1d1b0e0" +uuid = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59" +version = "0.15.1" +weakdeps = ["Unitful"] + + [deps.Interpolations.extensions] + InterpolationsUnitfulExt = "Unitful" + +[[deps.IntervalArithmetic]] +deps = ["CRlibm", "FastRounding", "LinearAlgebra", "Markdown", "Random", "RecipesBase", "RoundingEmulator", "SetRounding", "StaticArrays"] +git-tree-sha1 = "5ab7744289be503d76a944784bac3f2df7b809af" +uuid = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253" +version = "0.20.9" + +[[deps.IntervalSets]] +git-tree-sha1 = "dba9ddf07f77f60450fe5d2e2beb9854d9a49bd0" +uuid = "8197267c-284f-5f27-9208-e0e47529a953" +version = "0.7.10" +weakdeps = ["Random", "RecipesBase", "Statistics"] + + [deps.IntervalSets.extensions] + IntervalSetsRandomExt = "Random" + IntervalSetsRecipesBaseExt = "RecipesBase" + IntervalSetsStatisticsExt = "Statistics" + [[deps.InverseFunctions]] deps = ["Test"] git-tree-sha1 = "e7cbed5032c4c397a6ac23d1493f3289e01231c4" @@ -438,6 +835,17 @@ git-tree-sha1 = "630b497eafcc20001bba38a4651b327dcfc491d2" uuid = "92d709cd-6900-40b7-9082-c6be49f344b6" version = "0.2.2" +[[deps.Isoband]] +deps = ["isoband_jll"] +git-tree-sha1 = "f9b6d97355599074dc867318950adaa6f9946137" +uuid = "f1662d9f-8043-43de-a69a-05efc1cc6ff4" +version = "0.1.1" + +[[deps.IterTools]] +git-tree-sha1 = "42d5f897009e7ff2cf88db414a389e5ed1bdd023" +uuid = "c8e1da08-722c-5040-9ed9-7db0dc04731e" +version = "1.10.0" + [[deps.IterativeSolvers]] deps = ["LinearAlgebra", "Printf", "Random", "RecipesBase", "SparseArrays"] git-tree-sha1 = "59545b0a2b27208b0650df0a46b8e3019f85055b" @@ -461,6 +869,12 @@ git-tree-sha1 = "7e5d6779a1e09a36db2a7b6cff50942a0a7d0fca" uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210" version = "1.5.0" +[[deps.JSON]] +deps = ["Dates", "Mmap", "Parsers", "Unicode"] +git-tree-sha1 = "31e996f0a15c7b280ba9f76636b3ff9e2ae58c9a" +uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" +version = "0.21.4" + [[deps.JSON3]] deps = ["Dates", "Mmap", "Parsers", "PrecompileTools", "StructTypes", "UUIDs"] git-tree-sha1 = "eb3edce0ed4fa32f75a0a11217433c31d56bd48b" @@ -473,6 +887,18 @@ version = "1.14.0" [deps.JSON3.weakdeps] ArrowTypes = "31f734f8-188a-4ce0-8406-c8a06bd891cd" +[[deps.JpegTurbo]] +deps = ["CEnum", "FileIO", "ImageCore", "JpegTurbo_jll", "TOML"] +git-tree-sha1 = "fa6d0bcff8583bac20f1ffa708c3913ca605c611" +uuid = "b835a17e-a41a-41e7-81f0-2f016b05efe0" +version = "0.1.5" + +[[deps.JpegTurbo_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "c84a835e1a09b289ffcd2271bf2a337bbdda6637" +uuid = "aacddb02-875f-59d6-b918-886e6ef4fbf8" +version = "3.0.3+0" + [[deps.JuliaNVTXCallbacks_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] git-tree-sha1 = "af433a10f3942e882d3c671aacb203e006a5808f" @@ -491,6 +917,18 @@ version = "0.9.22" [deps.KernelAbstractions.weakdeps] EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869" +[[deps.KernelDensity]] +deps = ["Distributions", "DocStringExtensions", "FFTW", "Interpolations", "StatsBase"] +git-tree-sha1 = "7d703202e65efa1369de1279c162b915e245eed1" +uuid = "5ab0869b-81aa-558d-bb23-cbf5423bbe9b" +version = "0.6.9" + +[[deps.LAME_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "170b660facf5df5de098d866564877e119141cbd" +uuid = "c1c5ebd0-6772-5130-a774-d5fcae4a789d" +version = "3.100.2+0" + [[deps.LLVM]] deps = ["CEnum", "LLVMExtra_jll", "Libdl", "Preferences", "Printf", "Requires", "Unicode"] git-tree-sha1 = "389aea28d882a40b5e1747069af71bdbd47a1cae" @@ -527,15 +965,31 @@ weakdeps = ["Serialization"] [deps.LRUCache.extensions] SerializationExt = ["Serialization"] +[[deps.LZO_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "70c5da094887fd2cae843b8db33920bac4b6f07d" +uuid = "dd4b983a-f0e5-5f8d-a1b7-129d4a5fb1ac" +version = "2.10.2+0" + [[deps.LaTeXStrings]] git-tree-sha1 = "50901ebc375ed41dbf8058da26f9de442febbbec" uuid = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" version = "1.3.1" +[[deps.LazilyInitializedFields]] +git-tree-sha1 = "8f7f3cabab0fd1800699663533b6d5cb3fc0e612" +uuid = "0e77f7df-68c5-4e49-93ce-4cd80f5598bf" +version = "1.2.2" + [[deps.LazyArtifacts]] deps = ["Artifacts", "Pkg"] uuid = "4af54fe1-eca0-43a8-85a7-787d91b784e3" +[[deps.LazyModules]] +git-tree-sha1 = "a560dd966b386ac9ae60bdd3a3d3a326062d3c3e" +uuid = "8cdb02fc-e678-4876-92c5-9defec4f444e" +version = "0.3.1" + [[deps.LibCURL]] deps = ["LibCURL_jll", "MozillaCACerts_jll"] uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" @@ -563,12 +1017,42 @@ version = "1.11.0+1" [[deps.Libdl]] uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" +[[deps.Libffi_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "0b4a5d71f3e5200a7dff793393e09dfc2d874290" +uuid = "e9f186c6-92d2-5b65-8a66-fee21dc1b490" +version = "3.2.2+1" + +[[deps.Libgcrypt_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Libgpg_error_jll"] +git-tree-sha1 = "9fd170c4bbfd8b935fdc5f8b7aa33532c991a673" +uuid = "d4300ac3-e22c-5743-9152-c294e39db1e4" +version = "1.8.11+0" + +[[deps.Libgpg_error_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "fbb1f2bef882392312feb1ede3615ddc1e9b99ed" +uuid = "7add5ba3-2f88-524e-9cd5-f83b8a55f7b8" +version = "1.49.0+0" + [[deps.Libiconv_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] git-tree-sha1 = "f9557a255370125b405568f9767d6d195822a175" uuid = "94ce4f54-9a6c-5748-9c1c-f9c7231a4531" version = "1.17.0+0" +[[deps.Libmount_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "0c4f9c4f1a50d8f35048fa0532dabbadf702f81e" +uuid = "4b2f31a3-9ecc-558c-b454-b3730dcb73e9" +version = "2.40.1+0" + +[[deps.Libuuid_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "5ee6203157c120d79034c748a2acba45b82b8807" +uuid = "38a345b3-de98-5d2b-a5d3-14cd9215e700" +version = "2.40.1+0" + [[deps.LinearAlgebra]] deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"] uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" @@ -642,10 +1126,39 @@ git-tree-sha1 = "2fa9ee3e63fd3a4f7a9a4f4744a52f4856de82df" uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" version = "0.5.13" +[[deps.Makie]] +deps = ["Animations", "Base64", "CRC32c", "ColorBrewer", "ColorSchemes", "ColorTypes", "Colors", "Contour", "Dates", "DelaunayTriangulation", "Distributions", "DocStringExtensions", "Downloads", "FFMPEG_jll", "FileIO", "FilePaths", "FixedPointNumbers", "Format", "FreeType", "FreeTypeAbstraction", "GeometryBasics", "GridLayoutBase", "ImageIO", "InteractiveUtils", "IntervalSets", "Isoband", "KernelDensity", "LaTeXStrings", "LinearAlgebra", "MacroTools", "MakieCore", "Markdown", "MathTeXEngine", "Observables", "OffsetArrays", "Packing", "PlotUtils", "PolygonOps", "PrecompileTools", "Printf", "REPL", "Random", "RelocatableFolders", "Scratch", "ShaderAbstractions", "Showoff", "SignedDistanceFields", "SparseArrays", "Statistics", "StatsBase", "StatsFuns", "StructArrays", "TriplotBase", "UnicodeFun", "Unitful"] +git-tree-sha1 = "e11b0666b457e3bb60119f2ed4d063d2b68954d3" +uuid = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" +version = "0.21.3" + +[[deps.MakieCore]] +deps = ["ColorTypes", "GeometryBasics", "IntervalSets", "Observables"] +git-tree-sha1 = "638bc817096742e8302f7b0b972ee5701fe00e97" +uuid = "20f20a25-4f0e-4fdf-b5d1-57303727442b" +version = "0.8.3" + +[[deps.MappedArrays]] +git-tree-sha1 = "2dab0221fe2b0f2cb6754eaa743cc266339f527e" +uuid = "dbb5928d-eab1-5f90-85c2-b9b0edb7c900" +version = "0.4.2" + [[deps.Markdown]] deps = ["Base64"] uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" +[[deps.MarkdownAST]] +deps = ["AbstractTrees", "Markdown"] +git-tree-sha1 = "465a70f0fc7d443a00dcdc3267a497397b8a3899" +uuid = "d0879d2d-cac2-40c8-9cee-1863dc0c7391" +version = "0.1.2" + +[[deps.MathTeXEngine]] +deps = ["AbstractTrees", "Automa", "DataStructures", "FreeTypeAbstraction", "GeometryBasics", "LaTeXStrings", "REPL", "RelocatableFolders", "UnicodeFun"] +git-tree-sha1 = "1865d0b8a2d91477c8b16b49152a32764c7b1f5f" +uuid = "0a4f8689-d25c-4efe-a92b-7142dfc1aa53" +version = "0.6.0" + [[deps.MbedTLS_jll]] deps = ["Artifacts", "Libdl"] uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" @@ -666,6 +1179,12 @@ version = "1.2.0" [[deps.Mmap]] uuid = "a63ad114-7e13-5084-954f-fe012c677804" +[[deps.MosaicViews]] +deps = ["MappedArrays", "OffsetArrays", "PaddedViews", "StackViews"] +git-tree-sha1 = "7b86a5d4d70a9f5cdf2dacb3cbe6d251d1a61dbe" +uuid = "e94cdb99-869f-56ef-bcf0-1ae2bcbe0389" +version = "0.3.4" + [[deps.MozillaCACerts_jll]] uuid = "14a3606d-f60d-562e-9121-12d972cd8159" version = "2023.1.10" @@ -688,12 +1207,24 @@ git-tree-sha1 = "ce3269ed42816bf18d500c9f63418d4b0d9f5a3b" uuid = "e98f9f5b-d649-5603-91fd-7774390e6439" version = "3.1.0+2" +[[deps.NaNMath]] +deps = ["OpenLibm_jll"] +git-tree-sha1 = "0877504529a3e5c3343c6f8b4c0381e57e4387e4" +uuid = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" +version = "1.0.2" + [[deps.NetCDF_jll]] 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.209+0" +[[deps.Netpbm]] +deps = ["FileIO", "ImageCore", "ImageMetadata"] +git-tree-sha1 = "d92b107dbb887293622df7697a2223f9f8176fcd" +uuid = "f09324ee-3d7c-5217-9330-fc30815ba969" +version = "1.1.1" + [[deps.Nettle_jll]] deps = ["Artifacts", "GMP_jll", "JLLWrappers", "Libdl", "Pkg"] git-tree-sha1 = "eca63e3847dad608cfa6a3329b95ef674c7160b4" @@ -704,6 +1235,11 @@ version = "3.7.2+0" uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" version = "1.2.0" +[[deps.Observables]] +git-tree-sha1 = "7438a59546cf62428fc9d1bc94729146d37a7225" +uuid = "510215fc-4207-5dde-b226-833fc4488ee2" +version = "0.5.5" + [[deps.Oceananigans]] deps = ["Adapt", "CUDA", "Crayons", "CubedSphere", "Dates", "Distances", "DocStringExtensions", "FFTW", "Glob", "IncompleteLU", "InteractiveUtils", "IterativeSolvers", "JLD2", "KernelAbstractions", "LinearAlgebra", "Logging", "MPI", "NCDatasets", "OffsetArrays", "OrderedCollections", "PencilArrays", "PencilFFTs", "Pkg", "Printf", "Random", "Rotations", "SeawaterPolynomials", "SparseArrays", "Statistics", "StructArrays"] git-tree-sha1 = "745b1c19221e09886cae331450a2a4ea73708a38" @@ -725,11 +1261,29 @@ weakdeps = ["Adapt"] [deps.OffsetArrays.extensions] OffsetArraysAdaptExt = "Adapt" +[[deps.Ogg_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "887579a3eb005446d514ab7aeac5d1d027658b8f" +uuid = "e7412a2a-1a6e-54c0-be00-318e2571c051" +version = "1.3.5+1" + [[deps.OpenBLAS_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" version = "0.3.23+4" +[[deps.OpenEXR]] +deps = ["Colors", "FileIO", "OpenEXR_jll"] +git-tree-sha1 = "327f53360fdb54df7ecd01e96ef1983536d1e633" +uuid = "52e1d378-f018-4a11-a4be-720524705ac7" +version = "0.3.2" + +[[deps.OpenEXR_jll]] +deps = ["Artifacts", "Imath_jll", "JLLWrappers", "Libdl", "Zlib_jll"] +git-tree-sha1 = "8292dd5c8a38257111ada2174000a33745b06d4e" +uuid = "18a262bb-aa17-5467-a713-aee519bc75cb" +version = "3.2.4+0" + [[deps.OpenLibm_jll]] deps = ["Artifacts", "Libdl"] uuid = "05823500-19ac-5b8b-9628-191a04bc5112" @@ -753,6 +1307,12 @@ git-tree-sha1 = "13652491f6856acfd2db29360e1bbcd4565d04f1" uuid = "efe28fd5-8261-553b-a9e1-b2916fc3738e" version = "0.5.5+0" +[[deps.Opus_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "51a08fb14ec28da2ec7a927c4337e4332c2a4720" +uuid = "91d4177d-7536-5919-b921-800302f37372" +version = "1.3.2+0" + [[deps.OrderedCollections]] git-tree-sha1 = "dfdf5519f235516220579f949664f1bf44e741c5" uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" @@ -764,12 +1324,47 @@ git-tree-sha1 = "2cd396108e178f3ae8dedbd8e938a18726ab2fbf" uuid = "c2071276-7c44-58a7-b746-946036e04d0a" version = "0.24.1+0" +[[deps.PCRE2_jll]] +deps = ["Artifacts", "Libdl"] +uuid = "efcefdf7-47ab-520b-bdef-62a2eaa19f15" +version = "10.42.0+1" + +[[deps.PDMats]] +deps = ["LinearAlgebra", "SparseArrays", "SuiteSparse"] +git-tree-sha1 = "949347156c25054de2db3b166c52ac4728cbad65" +uuid = "90014a1f-27ba-587c-ab20-58faa44d9150" +version = "0.11.31" + +[[deps.PNGFiles]] +deps = ["Base64", "CEnum", "ImageCore", "IndirectArrays", "OffsetArrays", "libpng_jll"] +git-tree-sha1 = "67186a2bc9a90f9f85ff3cc8277868961fb57cbd" +uuid = "f57f5aa1-a3ce-4bc8-8ab9-96f992907883" +version = "0.4.3" + [[deps.PackageExtensionCompat]] git-tree-sha1 = "fb28e33b8a95c4cee25ce296c817d89cc2e53518" uuid = "65ce6f38-6b18-4e1d-a461-8949797d7930" version = "1.0.2" weakdeps = ["Requires", "TOML"] +[[deps.Packing]] +deps = ["GeometryBasics"] +git-tree-sha1 = "ec3edfe723df33528e085e632414499f26650501" +uuid = "19eb6ba3-879d-56ad-ad62-d5c202156566" +version = "0.5.0" + +[[deps.PaddedViews]] +deps = ["OffsetArrays"] +git-tree-sha1 = "0fac6313486baae819364c52b4f483450a9d793f" +uuid = "5432bcbf-9aad-5242-b902-cca2824c8663" +version = "0.5.12" + +[[deps.Pango_jll]] +deps = ["Artifacts", "Cairo_jll", "Fontconfig_jll", "FreeType2_jll", "FriBidi_jll", "Glib_jll", "HarfBuzz_jll", "JLLWrappers", "Libdl"] +git-tree-sha1 = "cb5a2ab6763464ae0f19c86c56c63d4a2b0f5bda" +uuid = "36c8627f-9965-5494-a995-c6b170f724f3" +version = "1.52.2+0" + [[deps.Parsers]] deps = ["Dates", "PrecompileTools", "UUIDs"] git-tree-sha1 = "8489905bcdbcfac64d1daa51ca07c0d8f0283821" @@ -798,6 +1393,12 @@ git-tree-sha1 = "bd69f3f0ee248cfb4241800aefb705b5ded592ff" uuid = "4a48f351-57a6-4416-9ec4-c37015456aae" version = "0.15.1" +[[deps.Pixman_jll]] +deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "LLVMOpenMP_jll", "Libdl"] +git-tree-sha1 = "35621f10a7531bc8fa58f74610b1bfb70a3cfc6b" +uuid = "30392449-352a-5448-841d-b1acce4e97dc" +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"] uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" @@ -809,6 +1410,17 @@ git-tree-sha1 = "f9501cc0430a26bc3d156ae1b5b0c1b47af4d6da" uuid = "eebad327-c553-4316-9ea0-9fa01ccd7688" version = "0.3.3" +[[deps.PlotUtils]] +deps = ["ColorSchemes", "Colors", "Dates", "PrecompileTools", "Printf", "Random", "Reexport", "Statistics"] +git-tree-sha1 = "7b1a9df27f072ac4c9c7cbe5efb198489258d1f5" +uuid = "995b91a9-d308-5afd-9ec6-746e21dbc043" +version = "1.4.1" + +[[deps.PolygonOps]] +git-tree-sha1 = "77b3d3605fc1cd0b42d95eba87dfcd2bf67d5ff6" +uuid = "647866c9-e3ac-4575-94e7-e3d426903924" +version = "0.1.2" + [[deps.PooledArrays]] deps = ["DataAPI", "Future"] git-tree-sha1 = "36d8b4b899628fb92c2749eb488d884a926614d3" @@ -843,6 +1455,29 @@ git-tree-sha1 = "b437cdb0385ed38312d91d9c00c20f3798b30256" uuid = "49802e3a-d2f1-5c88-81d8-b72133a6f568" version = "1.5.1" +[[deps.ProgressMeter]] +deps = ["Distributed", "Printf"] +git-tree-sha1 = "763a8ceb07833dd51bb9e3bbca372de32c0605ad" +uuid = "92933f4c-e287-5a05-a399-4b506db050ca" +version = "1.10.0" + +[[deps.PtrArrays]] +git-tree-sha1 = "f011fbb92c4d401059b2212c05c0601b70f8b759" +uuid = "43287f4e-b6f4-7ad1-bb20-aadabca52c3d" +version = "1.2.0" + +[[deps.QOI]] +deps = ["ColorTypes", "FileIO", "FixedPointNumbers"] +git-tree-sha1 = "18e8f4d1426e965c7b532ddd260599e1510d26ce" +uuid = "4b34888f-f399-49d4-9bb3-47ed5cae4e65" +version = "1.0.0" + +[[deps.QuadGK]] +deps = ["DataStructures", "LinearAlgebra"] +git-tree-sha1 = "9b23c31e76e333e6fb4c1595ae6afa74966a729e" +uuid = "1fd47b50-473d-5c70-9696-f719f8f3bcdc" +version = "2.9.4" + [[deps.Quaternions]] deps = ["LinearAlgebra", "Random", "RealDot"] git-tree-sha1 = "994cc27cdacca10e68feb291673ec3a76aa2fae9" @@ -869,6 +1504,21 @@ git-tree-sha1 = "043da614cc7e95c703498a491e2c21f58a2b8111" uuid = "e6cf234a-135c-5ec9-84dd-332b85af5143" version = "1.5.3" +[[deps.RangeArrays]] +git-tree-sha1 = "b9039e93773ddcfc828f12aadf7115b4b4d225f5" +uuid = "b3c3ace0-ae52-54e7-9d0b-2c1406fd6b9d" +version = "0.3.2" + +[[deps.Ratios]] +deps = ["Requires"] +git-tree-sha1 = "1342a47bf3260ee108163042310d26f2be5ec90b" +uuid = "c84ed2f1-dad5-54f0-aa8e-dbefe2724439" +version = "0.4.5" +weakdeps = ["FixedPointNumbers"] + + [deps.Ratios.extensions] + RatiosFixedPointNumbersExt = "FixedPointNumbers" + [[deps.RealDot]] deps = ["LinearAlgebra"] git-tree-sha1 = "9f0a1b71baaf7650f4fa8a1d168c7fb6ee41f0c9" @@ -886,12 +1536,36 @@ git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b" uuid = "189a3867-3050-52da-a836-e630ba90ab69" version = "1.2.2" +[[deps.RegistryInstances]] +deps = ["LazilyInitializedFields", "Pkg", "TOML", "Tar"] +git-tree-sha1 = "ffd19052caf598b8653b99404058fce14828be51" +uuid = "2792f1a3-b283-48e8-9a74-f99dce5104f3" +version = "0.1.0" + +[[deps.RelocatableFolders]] +deps = ["SHA", "Scratch"] +git-tree-sha1 = "ffdaf70d81cf6ff22c2b6e733c900c3321cab864" +uuid = "05181044-ff0b-4ac5-8273-598c1e38db00" +version = "1.0.1" + [[deps.Requires]] deps = ["UUIDs"] git-tree-sha1 = "838a3a4188e2ded87a4f9f184b4b0d78a1e91cb7" uuid = "ae029012-a4dd-5104-9daa-d747884805df" version = "1.3.0" +[[deps.Rmath]] +deps = ["Random", "Rmath_jll"] +git-tree-sha1 = "f65dcb5fa46aee0cf9ed6274ccbd597adc49aa7b" +uuid = "79098fc4-a85e-5d69-aa6a-4863f24498fa" +version = "0.7.1" + +[[deps.Rmath_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "d483cd324ce5cf5d61b77930f0bbd6cb61927d21" +uuid = "f50d1b31-88e8-58de-be2c-1cc44531875f" +version = "0.4.2+0" + [[deps.Roots]] deps = ["Accessors", "ChainRulesCore", "CommonSolve", "Printf"] git-tree-sha1 = "1ab580704784260ee5f45bffac810b152922747b" @@ -920,10 +1594,21 @@ weakdeps = ["RecipesBase"] [deps.Rotations.extensions] RotationsRecipesBaseExt = "RecipesBase" +[[deps.RoundingEmulator]] +git-tree-sha1 = "40b9edad2e5287e05bd413a38f61a8ff55b9557b" +uuid = "5eaf0fd0-dfba-4ccb-bf02-d820a40db705" +version = "0.2.1" + [[deps.SHA]] uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" version = "0.7.0" +[[deps.SIMD]] +deps = ["PrecompileTools"] +git-tree-sha1 = "2803cab51702db743f3fda07dd1745aadfbf43bd" +uuid = "fdea26ae-647d-5447-a871-4b548cad5224" +version = "3.5.0" + [[deps.Scratch]] deps = ["Dates"] git-tree-sha1 = "3bac05bc7e74a75fd9cba4295cde4045d9fe2386" @@ -944,6 +1629,45 @@ version = "1.4.3" [[deps.Serialization]] uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" +[[deps.SetRounding]] +git-tree-sha1 = "d7a25e439d07a17b7cdf97eecee504c50fedf5f6" +uuid = "3cc68bcd-71a2-5612-b932-767ffbe40ab0" +version = "0.2.1" + +[[deps.ShaderAbstractions]] +deps = ["ColorTypes", "FixedPointNumbers", "GeometryBasics", "LinearAlgebra", "Observables", "StaticArrays", "StructArrays", "Tables"] +git-tree-sha1 = "79123bc60c5507f035e6d1d9e563bb2971954ec8" +uuid = "65257c39-d410-5151-9873-9b3e5be5013e" +version = "0.4.1" + +[[deps.SharedArrays]] +deps = ["Distributed", "Mmap", "Random", "Serialization"] +uuid = "1a1011a3-84de-559e-8e89-a11a2f7dc383" + +[[deps.Showoff]] +deps = ["Dates", "Grisu"] +git-tree-sha1 = "91eddf657aca81df9ae6ceb20b959ae5653ad1de" +uuid = "992d4aef-0814-514b-bc4d-f2e9a6c4116f" +version = "1.0.3" + +[[deps.SignedDistanceFields]] +deps = ["Random", "Statistics", "Test"] +git-tree-sha1 = "d263a08ec505853a5ff1c1ebde2070419e3f28e9" +uuid = "73760f76-fbc4-59ce-8f25-708e95d2df96" +version = "0.4.0" + +[[deps.SimpleTraits]] +deps = ["InteractiveUtils", "MacroTools"] +git-tree-sha1 = "5d7e3f4e11935503d3ecaf7186eac40602e7d231" +uuid = "699a6c99-e7fa-54fc-8d76-47d257e15c1d" +version = "0.9.4" + +[[deps.Sixel]] +deps = ["Dates", "FileIO", "ImageCore", "IndirectArrays", "OffsetArrays", "REPL", "libsixel_jll"] +git-tree-sha1 = "2da10356e31327c7096832eb9cd86307a50b1eb6" +uuid = "45858cf5-a6b0-47a3-bbea-62219f50df47" +version = "0.1.3" + [[deps.Sockets]] uuid = "6462fe0b-24de-5631-8697-dd941f90decc" @@ -968,6 +1692,12 @@ weakdeps = ["ChainRulesCore"] [deps.SpecialFunctions.extensions] SpecialFunctionsChainRulesCoreExt = "ChainRulesCore" +[[deps.StackViews]] +deps = ["OffsetArrays"] +git-tree-sha1 = "46e589465204cd0c08b4bd97385e4fa79a0c770c" +uuid = "cae243ae-269e-4f55-b966-ac2d0dc13c15" +version = "0.1.1" + [[deps.Static]] deps = ["CommonWorldInvalidations", "IfElse", "PrecompileTools"] git-tree-sha1 = "0bbff21027dd8a107551847528127b62a35f7594" @@ -1017,6 +1747,23 @@ git-tree-sha1 = "1ff449ad350c9c4cbc756624d6f8a8c3ef56d3ed" uuid = "82ae8749-77ed-4fe6-ae5f-f523153014b0" version = "1.7.0" +[[deps.StatsBase]] +deps = ["DataAPI", "DataStructures", "LinearAlgebra", "LogExpFunctions", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics", "StatsAPI"] +git-tree-sha1 = "5cf7606d6cef84b543b483848d4ae08ad9832b21" +uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" +version = "0.34.3" + +[[deps.StatsFuns]] +deps = ["HypergeometricFunctions", "IrrationalConstants", "LogExpFunctions", "Reexport", "Rmath", "SpecialFunctions"] +git-tree-sha1 = "cef0472124fab0695b58ca35a77c6fb942fdab8a" +uuid = "4c63d2b9-4356-54db-8cca-17b64c39e42c" +version = "1.3.1" +weakdeps = ["ChainRulesCore", "InverseFunctions"] + + [deps.StatsFuns.extensions] + StatsFunsChainRulesCoreExt = "ChainRulesCore" + StatsFunsInverseFunctionsExt = "InverseFunctions" + [[deps.Strided]] deps = ["LinearAlgebra", "StridedViews", "TupleTools"] git-tree-sha1 = "bd9bd1c70cfc115cc3a30213fc725125a6b43652" @@ -1094,17 +1841,27 @@ deps = ["LinearAlgebra", "Markdown", "Requires", "SparseArrays"] git-tree-sha1 = "1c7170668366821b0c4c4fe03ee78f8d6cf36e2c" uuid = "6aa5eb33-94cf-58f4-a9d0-e4b2c4fc25ea" version = "0.16.0" +weakdeps = ["IntervalArithmetic"] [deps.TaylorSeries.extensions] TaylorSeriesIAExt = "IntervalArithmetic" - [deps.TaylorSeries.weakdeps] - IntervalArithmetic = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253" +[[deps.TensorCore]] +deps = ["LinearAlgebra"] +git-tree-sha1 = "1feb45f88d133a655e001435632f019a9a1bcdb6" +uuid = "62fd8b95-f654-4bbd-a8a5-9c27f68ccd50" +version = "0.1.1" [[deps.Test]] deps = ["InteractiveUtils", "Logging", "Random", "Serialization"] uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +[[deps.TiffImages]] +deps = ["ColorTypes", "DataStructures", "DocStringExtensions", "FileIO", "FixedPointNumbers", "IndirectArrays", "Inflate", "Mmap", "OffsetArrays", "PkgVersion", "ProgressMeter", "SIMD", "UUIDs"] +git-tree-sha1 = "bc7fd5c91041f44636b2c134041f7e5263ce58ae" +uuid = "731e570b-9d59-4bfa-96dc-6df516fadf69" +version = "0.10.0" + [[deps.TimerOutputs]] deps = ["ExprTools", "Printf"] git-tree-sha1 = "5a13ae8a41237cff5ecf34f73eb1b8f42fff6531" @@ -1120,6 +1877,11 @@ weakdeps = ["Random", "Test"] [deps.TranscodingStreams.extensions] TestExt = ["Test", "Random"] +[[deps.TriplotBase]] +git-tree-sha1 = "4d4ed7f294cda19382ff7de4c137d24d16adc89b" +uuid = "981d1d27-644d-49a2-9326-4793e63143c3" +version = "0.1.0" + [[deps.TupleTools]] git-tree-sha1 = "41d61b1c545b06279871ef1a4b5fcb2cac2191cd" uuid = "9d95972d-f1c8-5527-a6e0-b4b365fa01f6" @@ -1132,6 +1894,23 @@ uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" [[deps.Unicode]] uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" +[[deps.UnicodeFun]] +deps = ["REPL"] +git-tree-sha1 = "53915e50200959667e78a92a418594b428dffddf" +uuid = "1cfade01-22cf-5700-b092-accc4b62d6e1" +version = "0.4.1" + +[[deps.Unitful]] +deps = ["Dates", "LinearAlgebra", "Random"] +git-tree-sha1 = "dd260903fdabea27d9b6021689b3cd5401a57748" +uuid = "1986cc42-f94f-5a68-af5c-568840ba703d" +version = "1.20.0" +weakdeps = ["ConstructionBase", "InverseFunctions"] + + [deps.Unitful.extensions] + ConstructionBaseUnitfulExt = "ConstructionBase" + InverseFunctionsUnitfulExt = "InverseFunctions" + [[deps.UnsafeAtomics]] git-tree-sha1 = "6331ac3440856ea1988316b46045303bef658278" uuid = "013be700-e6cd-48c3-b4a1-df204f14c38f" @@ -1148,18 +1927,78 @@ git-tree-sha1 = "58d6e80b4ee071f5efd07fda82cb9fbe17200868" uuid = "81def892-9a0e-5fdd-b105-ffc91e053289" version = "1.3.0" +[[deps.WoodburyMatrices]] +deps = ["LinearAlgebra", "SparseArrays"] +git-tree-sha1 = "c1a7aa6219628fcd757dede0ca95e245c5cd9511" +uuid = "efce3f68-66dc-5838-9240-27a6d6f5f9b6" +version = "1.0.0" + [[deps.XML2_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Libiconv_jll", "Zlib_jll"] git-tree-sha1 = "d9717ce3518dc68a99e6b96300813760d887a01d" uuid = "02c8fc9c-b97f-50b9-bbe4-9be30ff0a78a" version = "2.13.1+0" +[[deps.XSLT_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Libgcrypt_jll", "Libgpg_error_jll", "Libiconv_jll", "XML2_jll", "Zlib_jll"] +git-tree-sha1 = "a54ee957f4c86b526460a720dbc882fa5edcbefc" +uuid = "aed1982a-8fda-507f-9586-7b0439959a61" +version = "1.1.41+0" + [[deps.XZ_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] git-tree-sha1 = "ac88fb95ae6447c8dda6a5503f3bafd496ae8632" uuid = "ffd25f8a-64ca-5728-b0f7-c24cf3aae800" version = "5.4.6+0" +[[deps.Xorg_libX11_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libxcb_jll", "Xorg_xtrans_jll"] +git-tree-sha1 = "afead5aba5aa507ad5a3bf01f58f82c8d1403495" +uuid = "4f6342f7-b3d2-589e-9d20-edeb45f2b2bc" +version = "1.8.6+0" + +[[deps.Xorg_libXau_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "6035850dcc70518ca32f012e46015b9beeda49d8" +uuid = "0c0b7dd1-d40b-584c-a123-a41640f87eec" +version = "1.0.11+0" + +[[deps.Xorg_libXdmcp_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "34d526d318358a859d7de23da945578e8e8727b7" +uuid = "a3789734-cfe1-5b06-b2d0-1dd0d9d62d05" +version = "1.1.4+0" + +[[deps.Xorg_libXext_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libX11_jll"] +git-tree-sha1 = "d2d1a5c49fae4ba39983f63de6afcbea47194e85" +uuid = "1082639a-0dae-5f34-9b06-72781eeb8cb3" +version = "1.3.6+0" + +[[deps.Xorg_libXrender_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Xorg_libX11_jll"] +git-tree-sha1 = "47e45cd78224c53109495b3e324df0c37bb61fbe" +uuid = "ea2f1a96-1ddc-540d-b46f-429655e07cfa" +version = "0.9.11+0" + +[[deps.Xorg_libpthread_stubs_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "8fdda4c692503d44d04a0603d9ac0982054635f9" +uuid = "14d82f49-176c-5ed1-bb49-ad3f5cbd8c74" +version = "0.1.1+0" + +[[deps.Xorg_libxcb_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "XSLT_jll", "Xorg_libXau_jll", "Xorg_libXdmcp_jll", "Xorg_libpthread_stubs_jll"] +git-tree-sha1 = "bcd466676fef0878338c61e655629fa7bbc69d8e" +uuid = "c7cfdc94-dc32-55de-ac96-5a1b8d977c5b" +version = "1.17.0+0" + +[[deps.Xorg_xtrans_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "e92a1a012a10506618f10b7047e478403a046c77" +uuid = "c5fb5394-a638-5e4d-96e5-b29de1b5cf10" +version = "1.5.0+0" + [[deps.Zlib_jll]] deps = ["Libdl"] uuid = "83775a58-1f1d-513f-b197-d71354ab007a" @@ -1171,17 +2010,59 @@ git-tree-sha1 = "e678132f07ddb5bfa46857f0d7620fb9be675d3b" uuid = "3161d3a3-bdf6-5164-811a-617609db77b4" version = "1.5.6+0" +[[deps.isoband_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "51b5eeb3f98367157a7a12a1fb0aa5328946c03c" +uuid = "9a68df92-36a6-505f-a73e-abb412b6bfb4" +version = "0.2.3+0" + [[deps.libaec_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] git-tree-sha1 = "46bf7be2917b59b761247be3f317ddf75e50e997" uuid = "477f73a3-ac25-53e9-8cc3-50b2fa2566f0" version = "1.1.2+0" +[[deps.libaom_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "1827acba325fdcdf1d2647fc8d5301dd9ba43a9d" +uuid = "a4ae2306-e953-59d6-aa16-d00cac43593b" +version = "3.9.0+0" + +[[deps.libass_jll]] +deps = ["Artifacts", "Bzip2_jll", "FreeType2_jll", "FriBidi_jll", "HarfBuzz_jll", "JLLWrappers", "Libdl", "Pkg", "Zlib_jll"] +git-tree-sha1 = "5982a94fcba20f02f42ace44b9894ee2b140fe47" +uuid = "0ac62f75-1d6f-5e53-bd7c-93b484bb37c0" +version = "0.15.1+0" + [[deps.libblastrampoline_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" version = "5.8.0+1" +[[deps.libfdk_aac_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "daacc84a041563f965be61859a36e17c4e4fcd55" +uuid = "f638f0a6-7fb0-5443-88ba-1cc74229b280" +version = "2.0.2+0" + +[[deps.libpng_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Zlib_jll"] +git-tree-sha1 = "d7015d2e18a5fd9a4f47de711837e980519781a4" +uuid = "b53b4c65-9356-5827-b1ea-8c7a1a84506f" +version = "1.6.43+1" + +[[deps.libsixel_jll]] +deps = ["Artifacts", "JLLWrappers", "JpegTurbo_jll", "Libdl", "Pkg", "libpng_jll"] +git-tree-sha1 = "d4f63314c8aa1e48cd22aa0c17ed76cd1ae48c3c" +uuid = "075b6546-f08a-558a-be8f-8157d0f608a5" +version = "1.10.3+0" + +[[deps.libvorbis_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Ogg_jll", "Pkg"] +git-tree-sha1 = "b910cb81ef3fe6e78bf6acee440bda86fd6ae00c" +uuid = "f27f6e37-5d2b-51aa-960f-b287f2bc3b7a" +version = "1.3.7+1" + [[deps.libzip_jll]] deps = ["Artifacts", "Bzip2_jll", "GnuTLS_jll", "JLLWrappers", "Libdl", "XZ_jll", "Zlib_jll", "Zstd_jll"] git-tree-sha1 = "3282b7d16ae7ac3e57ec2f3fa8fafb564d8f9f7f" @@ -1203,3 +2084,15 @@ version = "2021.12.0+0" deps = ["Artifacts", "Libdl"] uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" version = "17.4.0+2" + +[[deps.x264_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "4fea590b89e6ec504593146bf8b988b2c00922b2" +uuid = "1270edf5-f2f9-52d2-97e9-ab00b5d0237a" +version = "2021.5.5+0" + +[[deps.x265_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "ee567a171cce03570d77ad3a43e90218e38937a9" +uuid = "dfaa095f-4041-5dcd-9319-2fabd8486b76" +version = "3.5.0+0" diff --git a/Project.toml b/Project.toml index 2cfd1e0cb..68b20d575 100644 --- a/Project.toml +++ b/Project.toml @@ -6,6 +6,8 @@ version = "0.10.3" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" +CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c" Oceananigans = "9e8cae18-63c1-5223-a75c-80ca9d6e9a09" From 693630fbd21690418f6ec33ff9b75b7a807e9d59 Mon Sep 17 00:00:00 2001 From: louis Date: Tue, 2 Jul 2024 18:14:33 +0100 Subject: [PATCH 02/27] made some column stuff --- src/LDNtesting.jl | 136 +++++++++++++++++++++++++++++++++++++++++++++ src/LDNtesting2.jl | 43 ++++++++++++++ src/LDNtesting3.jl | 0 src/LDNtesting4.jl | 61 ++++++++++++++++++++ 4 files changed, 240 insertions(+) create mode 100644 src/LDNtesting.jl create mode 100644 src/LDNtesting2.jl create mode 100644 src/LDNtesting3.jl create mode 100644 src/LDNtesting4.jl diff --git a/src/LDNtesting.jl b/src/LDNtesting.jl new file mode 100644 index 000000000..f4088e5f2 --- /dev/null +++ b/src/LDNtesting.jl @@ -0,0 +1,136 @@ +using OceanBioME, Test, CUDA, Oceananigans, JLD2, Documenter + +using OceanBioME.Sediments: SimpleMultiG, InstantRemineralisation +using Oceananigans.Units + +using OceanBioME.Sediments: sediment_tracers, sediment_fields +using Oceananigans: Field +using Oceananigans.Fields: TracerFields + +using Oceananigans.Operators: volume, Azᶠᶜᶜ + +using OceanBioME.LOBSTERModel: VariableRedfieldLobster + + + +architecture = CUDA.has_cuda() ? GPU() : CPU() + +function intercept_tracer_tendencies!(model, intercepted_tendencies) + for (name, field) in enumerate(intercepted_tendencies) + field .= Array(interior(model.timestepper.Gⁿ[name + 3])) + end +end + +function set_defaults!(sediment::SimpleMultiG) + set!(sediment.fields.N_fast, 0.0230) + set!(sediment.fields.N_slow, 0.0807) + + set!(sediment.fields.C_fast, 0.5893) + set!(sediment.fields.C_slow, 0.1677) +end + + + +function set_defaults!(::VariableRedfieldLobster, model) + + set!(model, Z = 0.5363, + NO₃ = 2.3103, NH₄ = 0.0010, + DIC = 2106.9, Alk = 2408.9, + O₂ = 258.92, + DOC = 5.3390, DON = 0.8115, + sPON = 0.2299, sPOC = 1.5080, + bPON = 0.0103, bPOC = 0.0781) + + + + kick = 0.05 + uᵢ(x, y, z) = kick * randn() + vᵢ(x, y, z) = kick * randn() + wᵢ(x, y, z) = kick * randn() + bᵢ(x, y, z) = kick * randn() + Pᵢ(x, y, z) = (1000-z)/1500 + #Pᵢ(x, y, z) = 0.4686 + exp(-((z - 500) / 50)^2) + + set!(model, u = uᵢ, v = vᵢ, w = wᵢ, b = bᵢ, P = Pᵢ) + @info "flag" + +end + + +total_nitrogen(sed::SimpleMultiG) = sum(sed.fields.N_fast) + + sum(sed.fields.N_slow) + + sum(sed.fields.N_ref) + + +total_nitrogen(::VariableRedfieldLobster, model) = sum(model.tracers.NO₃) + + sum(model.tracers.NH₄) + + sum(model.tracers.P) + + sum(model.tracers.Z) + + sum(model.tracers.DON) + + sum(model.tracers.sPON) + + sum(model.tracers.bPON) + + + +function test_flat_sediment(grid, biogeochemistry, model; timestepper = :QuasiAdamsBashforth2) + Re = 5000 + model = model(; grid, + biogeochemistry, + closure = (ScalarDiffusivity(ν = 1 / Re, κ = 1 / Re)), + buoyancy = Buoyancy(model=BuoyancyTracer()), + tracers = :b) + + set_defaults!(model.biogeochemistry.sediment) + + set_defaults!(biogeochemistry.underlying_biogeochemistry, model) + + simulation = Simulation(model, Δt = 50, stop_time = 1day) + + intercepted_tendencies = Tuple(Array(interior(field)) for field in values(TracerFields(keys(model.tracers), grid))) + + simulation.callbacks[:intercept_tendencies] = Callback(intercept_tracer_tendencies!; callsite = TendencyCallsite(), parameters = intercepted_tendencies) + + simulation.output_writers[:tracers] = JLD2OutputWriter(model, model.tracers, + filename = "LDNtesting.jld2", + schedule = TimeInterval(24minute), + overwrite_existing = true) + + + run!(simulation) + return nothing +end + +bottom_height(x, y) = -1500 + 1000 * exp(- (x^2 + y^2) / 250) # a perfect hill + +display_name(::LOBSTER) = "LOBSTER" +display_name(::NutrientPhytoplanktonZooplanktonDetritus) = "NPZD" +display_name(::SimpleMultiG) = "Multi-G" +display_name(::InstantRemineralisation) = "Instant remineralisation" +display_name(::RectilinearGrid) = "Rectilinear grid" +display_name(::LatitudeLongitudeGrid) = "Latitude longitude grid" +display_name(::ImmersedBoundaryGrid) = "Immersed boundary grid" + + + grid = #RectilinearGrid(architecture; size=(3, 3, 50), extent=(10, 10, 500)) + ImmersedBoundaryGrid( + LatitudeLongitudeGrid(architecture; size = (10, 10, 50), latitude = (-10, 10), longitude = (-10, 10), z = (-1000, 0)), + GridFittedBottom(bottom_height)) + + timestepper = :QuasiAdamsBashforth2 + sediment_model = SimpleMultiG(; grid) + model = HydrostaticFreeSurfaceModel + biogeochemistry = LOBSTER(; grid, + carbonates = ifelse(isa(sediment_model, SimpleMultiG), true, false), + oxygen = ifelse(isa(sediment_model, SimpleMultiG), true, false), + variable_redfield = ifelse(isa(sediment_model, SimpleMultiG), true, false), + sediment_model) + + @info "Running sediment on $(typeof(architecture)) with $timestepper and $(display_name(sediment_model)) on $(display_name(biogeochemistry.underlying_biogeochemistry)) with $(display_name(grid))" + test_flat_sediment(grid, biogeochemistry, model; timestepper) + + + + + + + diff --git a/src/LDNtesting2.jl b/src/LDNtesting2.jl new file mode 100644 index 000000000..ec354081a --- /dev/null +++ b/src/LDNtesting2.jl @@ -0,0 +1,43 @@ +T = FieldTimeSeries("buoyancy_front.jld2", "T") +N = FieldTimeSeries("buoyancy_front.jld2", "N") +P = FieldTimeSeries("buoyancy_front.jld2", "P") + +xc, yc, zc = nodes(T) + +times = T.times + +using CairoMakie + +n = Observable(1) + +T_lims = (8.94, 9.06) +N_lims = (0, 4.5) +P_lims = (0.007, 0.02) + +Tₙ = @lift interior(T[$n], :, 1, :) +Nₙ = @lift interior(N[$n], :, 1, :) +Pₙ = @lift interior(P[$n], :, 1, :) + +fig = Figure(size = (1000, 520), fontsize = 20) + +title = @lift "t = $(prettytime(times[$n]))" +Label(fig[0, :], title) + +axis_kwargs = (xlabel = "x (m)", ylabel = "z (m)", width = 770, yticks = [-400, -200, 0]) +ax1 = Axis(fig[1, 1]; title = "Temperature (°C)", axis_kwargs...) +ax2 = Axis(fig[2, 1]; title = "Nutrients concentration (mmol N / m³)",axis_kwargs...) +ax3 = Axis(fig[3, 1]; title = "Phytoplankton concentration (mmol N / m³)", axis_kwargs...) + +hm1 = heatmap!(ax1, xc, zc, Tₙ, colorrange = T_lims, colormap = Reverse(:lajolla), interpolate = true) +hm2 = heatmap!(ax2, xc, zc, Nₙ, colorrange = N_lims, colormap = Reverse(:bamako), interpolate = true) +hm3 = heatmap!(ax3, xc, zc, Pₙ, colorrange = P_lims, colormap = Reverse(:bamako), interpolate = true) + +Colorbar(fig[1, 2], hm1, ticks = [8.95, 9.0, 9.05]) +Colorbar(fig[2, 2], hm2, ticks = [0, 2, 4]) +Colorbar(fig[3, 2], hm3, ticks = [0.01, 0.02, 0.03]) + +rowgap!(fig.layout, 0) + +record(fig, "buoyancy_front.gif", 1:length(times)) do i + n[] = i +end \ No newline at end of file diff --git a/src/LDNtesting3.jl b/src/LDNtesting3.jl new file mode 100644 index 000000000..e69de29bb diff --git a/src/LDNtesting4.jl b/src/LDNtesting4.jl new file mode 100644 index 000000000..5b4a4a81b --- /dev/null +++ b/src/LDNtesting4.jl @@ -0,0 +1,61 @@ +using OceanBioME, Test, CUDA, Oceananigans, JLD2, Documenter + +using OceanBioME.Sediments: SimpleMultiG, InstantRemineralisation +using Oceananigans.Units + +using OceanBioME.Sediments: sediment_tracers, sediment_fields +using Oceananigans: Field +using Oceananigans.Fields: TracerFields + +using Oceananigans.Operators: volume, Azᶠᶜᶜ + +using OceanBioME.LOBSTERModel: VariableRedfieldLobster + +using CairoMakie +using CairoMakie: record + +Z = FieldTimeSeries("LDNtesting.jld2", "Z") +N = FieldTimeSeries("LDNtesting.jld2", "NO₃") +P = FieldTimeSeries("LDNtesting.jld2", "P") + +xc, yc, zc = nodes(Z) + +times = Z.times + +print(nodes(Z)) +9 +Z_lims = (findmin(Z.data)[1], findmax(Z.data)[1]) +N_lims = (findmin(N.data)[1], findmax(N.data)[1]) +P_lims = (findmin(P.data)[1], findmax(P.data)[1]) + +n = Observable(1) + +Zₙ = @lift interior(Z[$n], :, 2, :) +Nₙ = @lift interior(N[$n], :, 2, :) +Pₙ = @lift interior(P[$n], :, 2, :) + +println(Pₙ) + +fig = Figure(size = (1000, 520), fontsize = 20) + +title = @lift "t = $(prettytime(times[$n]))" +Label(fig[2, 3], title) + +axis_kwargs = (xlabel = "x (m)", ylabel = "z (m)", width = 150) #, yticks = [-400, -200, 0]) +ax1 = Axis(fig[1, 1]; title = "Zooplankton concentration\n (mmol N / m³)", axis_kwargs...) +ax2 = Axis(fig[1, 3]; title = "NO₃ concentration\n (mmol N / m³)",axis_kwargs...) +ax3 = Axis(fig[1, 5]; title = "Phytoplankton concentration\n (mmol N / m³)", axis_kwargs...) + +hm1 = heatmap!(ax1, xc, zc, Zₙ, colorrange = Z_lims, colormap = Reverse(:bamako), interpolate = true) +hm2 = heatmap!(ax2, xc, zc, Nₙ, colorrange = N_lims, colormap = Reverse(:lajolla), interpolate = true) +hm3 = heatmap!(ax3, xc, zc, Pₙ, colorrange = P_lims, colormap = Reverse(:bamako), interpolate = true) + +Colorbar(fig[1, 2], hm1) +Colorbar(fig[1, 4], hm2) +Colorbar(fig[1, 6], hm3) + +rowgap!(fig.layout, 0) + +record(fig, "LDNtesting.gif", 1:length(times)) do i + n[] = i +end \ No newline at end of file From b88ab72c3530a1f7bcca6d8b09a4388096f34be2 Mon Sep 17 00:00:00 2001 From: louis Date: Fri, 12 Jul 2024 14:08:05 +0100 Subject: [PATCH 03/27] committing last testing pre sediment changes --- src/LDNtesting.jl | 13 +++++++------ src/LDNtesting4.jl | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/LDNtesting.jl b/src/LDNtesting.jl index f4088e5f2..832f8aea9 100644 --- a/src/LDNtesting.jl +++ b/src/LDNtesting.jl @@ -47,7 +47,7 @@ function set_defaults!(::VariableRedfieldLobster, model) uᵢ(x, y, z) = kick * randn() vᵢ(x, y, z) = kick * randn() wᵢ(x, y, z) = kick * randn() - bᵢ(x, y, z) = kick * randn() + bᵢ(x, y, z) = kick * randn() + 1 Pᵢ(x, y, z) = (1000-z)/1500 #Pᵢ(x, y, z) = 0.4686 + exp(-((z - 500) / 50)^2) @@ -75,17 +75,18 @@ total_nitrogen(::VariableRedfieldLobster, model) = sum(model.tracers.NO₃) + function test_flat_sediment(grid, biogeochemistry, model; timestepper = :QuasiAdamsBashforth2) Re = 5000 model = model(; grid, - biogeochemistry, - closure = (ScalarDiffusivity(ν = 1 / Re, κ = 1 / Re)), + biogeochemistry, + closure = nothing, buoyancy = Buoyancy(model=BuoyancyTracer()), tracers = :b) - + + @info "flag1" set_defaults!(model.biogeochemistry.sediment) set_defaults!(biogeochemistry.underlying_biogeochemistry, model) simulation = Simulation(model, Δt = 50, stop_time = 1day) - + @info "flag2" intercepted_tendencies = Tuple(Array(interior(field)) for field in values(TracerFields(keys(model.tracers), grid))) simulation.callbacks[:intercept_tendencies] = Callback(intercept_tracer_tendencies!; callsite = TendencyCallsite(), parameters = intercepted_tendencies) @@ -94,7 +95,7 @@ function test_flat_sediment(grid, biogeochemistry, model; timestepper = :QuasiAd filename = "LDNtesting.jld2", schedule = TimeInterval(24minute), overwrite_existing = true) - +@info "flag3" run!(simulation) return nothing diff --git a/src/LDNtesting4.jl b/src/LDNtesting4.jl index 5b4a4a81b..71efeefe9 100644 --- a/src/LDNtesting4.jl +++ b/src/LDNtesting4.jl @@ -14,8 +14,8 @@ using OceanBioME.LOBSTERModel: VariableRedfieldLobster using CairoMakie using CairoMakie: record -Z = FieldTimeSeries("LDNtesting.jld2", "Z") -N = FieldTimeSeries("LDNtesting.jld2", "NO₃") +Z = FieldTimeSeries("LDNtesting.jld2", "b") +N = FieldTimeSeries("LDNtesting.jld2", "Z") P = FieldTimeSeries("LDNtesting.jld2", "P") xc, yc, zc = nodes(Z) From f68b78381577be55812efb715421cfa85c84ffc3 Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 15 Jul 2024 10:32:45 +0100 Subject: [PATCH 04/27] added very start of ironphos --- src/Boundaries/Sediments/Sediments.jl | 2 ++ src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/Boundaries/Sediments/Sediments.jl b/src/Boundaries/Sediments/Sediments.jl index 044df4956..af90e9003 100644 --- a/src/Boundaries/Sediments/Sediments.jl +++ b/src/Boundaries/Sediments/Sediments.jl @@ -62,6 +62,8 @@ end @inline nitrogen_flux() = 0 @inline carbon_flux() = 0 +@inline inorg_phosphate_flux() = 0 +@inline org_phosphate_flux() = 0 @inline remineralisation_receiver() = nothing @inline sinking_tracers() = nothing @inline required_tracers() = nothing diff --git a/src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl b/src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl index b24017e8f..548d41a41 100644 --- a/src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl +++ b/src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl @@ -486,6 +486,16 @@ const VariableRedfieldLobster = Union{LOBSTER{<:Any, <:Val{(false, false, true)} sinking_flux(i, j, k, grid, advection, Val(:sPOC), bgc, tracers) + sinking_flux(i, j, k, grid, advection, Val(:bPOC), bgc, tracers) +proportion_of_phosphor_as_ferric_phosphate = 0.5 + +@inline inorg_phosphate_flux(i, j, k, grid, advection, bgc::VariableRedfieldLobster, tracers) = + sinking_flux(i, j, k, grid, advection, Val(:DIC), bgc, tracers) * (1/106) * proportion_of_phosphor_as_ferric_phosphate + +@inline org_phosphate_flux(i, j, k, grid, advection, bgc::VariableRedfieldLobster, tracers) = + (sinking_flux(i, j, k, grid, advection, Val(:sPON), bgc, tracers) + + sinking_flux(i, j, k, grid, advection, Val(:bPON), bgc, tracers)) * (1/16) + + @inline remineralisation_receiver(::LOBSTER) = :NH₄ @inline conserved_tracers(::LOBSTER) = (:NO₃, :NH₄, :P, :Z, :sPOM, :bPOM, :DOM) From 627ef65700ea96bc7769f4ca8d07a7d19de54cd0 Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 15 Jul 2024 10:35:22 +0100 Subject: [PATCH 05/27] added IronPhos --- src/Boundaries/Sediments/IronPhosphate.jl | 243 ++++++++++++++++++++++ 1 file changed, 243 insertions(+) create mode 100644 src/Boundaries/Sediments/IronPhosphate.jl diff --git a/src/Boundaries/Sediments/IronPhosphate.jl b/src/Boundaries/Sediments/IronPhosphate.jl new file mode 100644 index 000000000..0f0ed59e8 --- /dev/null +++ b/src/Boundaries/Sediments/IronPhosphate.jl @@ -0,0 +1,243 @@ +import Base: show, summary + +""" + struct IronPhosphate + +Hold the parameters and fields for a single-layer sediment model including Iron and Phosphate. +Based on the Level 3 model described by [Soetaert2000](@citet) and the Iron and Phosphate +interactions described in A. Dale et al 2012 Biogeosciences. +""" +struct IronPhosphate{FT, P1, P2, P3, P4, F, TE, B} <: FlatSediment + fast_decay_rate :: FT + slow_decay_rate :: FT + + fast_redfield :: FT + slow_redfield :: FT + + fast_fraction :: FT + slow_fraction :: FT + refactory_fraction :: FT + + nitrate_oxidation_params :: P1 + denitrification_params :: P2 + anoxic_params :: P3 + solid_dep_params :: P4 + + fields :: F + tendencies :: TE + bottom_indices :: B + + IronPhosphate(fast_decay_rate::FT, slow_decay_rate::FT, + fast_redfield::FT, slow_redfield::FT, + fast_fraction::FT, slow_fraction::FT, refactory_fraction::FT, + nitrate_oxidation_params::P1, + denitrification_params::P2, + anoxic_params::P3, + solid_dep_params::P4, + fields::F, tendencies::TE, + bottom_indices::B) where {FT, P1, P2, P3, P4, F, TE, B} = + new{FT, P1, P2, P3, P4, F, TE, B}(fast_decay_rate, slow_decay_rate, + fast_redfield, slow_redfield, + fast_fraction, slow_fraction, refactory_fraction, + nitrate_oxidation_params, + denitrification_params, + anoxic_params, + solid_dep_params, + fields, tendencies, + bottom_indices) +end + +""" + IronPhosphate(; grid + fast_decay_rate = 2/day, + slow_decay_rate = 0.2/day, + fast_redfield = 0.1509, + slow_redfield = 0.13, + fast_fraction = 0.74, + slow_fraction = 0.26, + refactory_fraction = 0.1, + nitrate_oxidation_params = on_architecture(architecture(grid), [- 1.9785, 0.2261, -0.0615, -0.0289, - 0.36109, - 0.0232]), + denitrification_params = on_architecture(architecture(grid), [- 3.0790, 1.7509, 0.0593, - 0.1923, 0.0604, 0.0662]), + anoxic_params = on_architecture(architecture(grid), [- 3.9476, 2.6269, - 0.2426, -1.3349, 0.1826, - 0.0143]), + solid_dep_params = on_architecture(architecture(grid), [0.233, 0.336, 982.0, - 1.548])) + +Return a single-layer "multi G" + Iron + Phosphate sediment model (`SimpleMultiG`) on `grid`, where parameters +can be optionally specified. + +The model is a single layer (i.e. does not include porous diffusion) model with three classes +of sediment organic matter which decay at three different rates (fast, slow, refactory). +The nitrification/denitrification/anoxic mineralisation fractions default to the parameterisation +of Soetaert et al. 2000; doi:[10.1016/S0012-8252(00)00004-0](https://doi.org/10.1016/S0012-8252(00)00004-0). + +Additionally, Iron and Phosphate reactions are computed to adjust O2, NO3 and POC fluxes + +This model has not yet been validated or compared to observational data. The variety of degridation +processes is likely to be strongly dependent on oxygen availability (see +[https://bg.copernicus.org/articles/6/1273/2009/bg-6-1273-2009.pdf](https://bg.copernicus.org/articles/6/1273/2009/bg-6-1273-2009.pdf)) +so it will therefore be important to also thoroughly validate the oxygen model (also currently limited). + +Example +======= + +```jldoctest simplemultig; filter = r".*@ OceanBioME.Boundaries.Sediments.*" +julia> using OceanBioME, Oceananigans, OceanBioME.Sediments + +julia> grid = RectilinearGrid(size=(3, 3, 30), extent=(10, 10, 200)); + +julia> sediment_model = SimpleMultiG(; grid) +┌ Warning: Sediment models are an experimental feature and have not yet been validated. +└ @ OceanBioME.Boundaries.Sediments ~/OceanBioME.jl/src/Boundaries/Sediments/simple_multi_G.jl:102 +[ Info: This sediment model is currently only compatible with models providing NH₄, NO₃, O₂, and DIC. +Single-layer multi-G + Iron + Phosphate sediment model (Float64) +``` +""" +function IronPhosphate(; grid, + fast_decay_rate = 2/day, + slow_decay_rate = 0.2/day, + fast_redfield = 0.1509, + slow_redfield = 0.13, + fast_fraction = 0.74, + slow_fraction = 0.26, + refactory_fraction = 0.1, + nitrate_oxidation_params = on_architecture(architecture(grid), [- 1.9785, 0.2261, -0.0615, -0.0289, - 0.36109, - 0.0232]), + denitrification_params = on_architecture(architecture(grid), [- 3.0790, 1.7509, 0.0593, - 0.1923, 0.0604, 0.0662]), + anoxic_params = on_architecture(architecture(grid), [- 3.9476, 2.6269, - 0.2426, -1.3349, 0.1826, - 0.0143]), + solid_dep_params = on_architecture(architecture(grid), [0.233, 0.336, 982.0, - 1.548])) + + @warn "Sediment models are an experimental feature and have not yet been validated." + @info "This sediment model is currently only compatible with models providing NH₄, NO₃, O₂, and DIC." + + tracer_names = (:C_slow, :C_fast, :N_slow, :N_fast, :C_ref, :N_ref, :Fe_III, :Fe_II, :PO4_dissolved, :P_org) + + # add field slicing back ( indices = (:, :, 1)) when output writer can cope + fields = NamedTuple{tracer_names}(Tuple(CenterField(grid) for tracer in tracer_names)) + tendencies = (Gⁿ = NamedTuple{tracer_names}(Tuple(CenterField(grid) for tracer in tracer_names)), + G⁻ = NamedTuple{tracer_names}(Tuple(CenterField(grid) for tracer in tracer_names))) + + bottom_indices = on_architecture(architecture(grid), calculate_bottom_indices(grid)) + + return IronPhosphate(fast_decay_rate, slow_decay_rate, + fast_redfield, slow_redfield, + fast_fraction, slow_fraction, refactory_fraction, + nitrate_oxidation_params, + denitrification_params, + anoxic_params, + solid_dep_params, + fields, + tendencies, + bottom_indices) +end + +adapt_structure(to, sediment::IronPhosphate) = + IronPhosphate(adapt(to, sediment.fast_decay_rate), + adapt(to, sediment.slow_decay_rate), + adapt(to, sediment.fast_redfield), + adapt(to, sediment.slow_redfield), + adapt(to, sediment.fast_fraction), + adapt(to, sediment.slow_fraction), + adapt(to, sediment.refactory_fraction), + adapt(to, sediment.nitrate_oxidation_params), + adapt(to, sediment.denitrification_params), + adapt(to, sediment.anoxic_params), + adapt(to, sediment.solid_dep_params), + adapt(to, sediment.fields), + nothing, + adapt(to, sediment.bottom_indices)) + +sediment_tracers(::IronPhosphate) = (:C_slow, :C_fast, :C_ref, :N_slow, :N_fast, :N_ref, :Fe_III, :Fe_II, :PO4_dissolved, :P_org) +sediment_fields(model::IronPhosphate) = (C_slow = model.fields.C_slow, + C_fast = model.fields.C_fast, + N_slow = model.fields.N_slow, + N_fast = model.fields.N_fast, + C_ref = model.fields.C_ref, + N_ref = model.fields.N_ref, + Fe_III = model.fields.Fe_III, + Fe_II = model.fields.Fe_II, + PO4_dissolved = model.fields.PO4_dissolved, + P_org = model.fields.P_org) + +@inline required_tracers(::IronPhosphate, bgc, tracers) = tracers[(:NO₃, :NH₄, :O₂, :DOC, sinking_tracers(bgc)...)] +@inline required_tendencies(::IronPhosphate, bgc, tracers) = tracers[(:NO₃, :NH₄, :O₂, :DIC, :DOC)] # TODO add effluxes of PO4 and Fe once PISCES is working + +@inline bottom_index_array(sediment::IronPhosphate) = sediment.bottom_indices + +function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, grid, advection, tracers, tendencies, sediment_tendencies, t) + k = bottom_index(i, j, sediment) + depth = @inbounds -znodes(grid, Center(), Center(), Center())[k] + + Δz = zspacing(i, j, k, grid, Center(), Center(), Center()) + + @inbounds begin + carbon_deposition = carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz + + nitrogen_deposition = nitrogen_flux(i, j, k, grid, advection, bgc, tracers) * Δz + + phosphate_deposition = phosphate_flux(i, j, k, grid, advection, bgc, tracers) * Δz + + iron_deposition = phosphate_flux(i, j, k, grid, advection, bgc, tracers) * Δz * 0.1 # molar ratio from Dale et al 2012, p. 633 + + # rates + C_min_slow = sediment.fields.C_slow[i, j, 1] * sediment.slow_decay_rate + C_min_fast = sediment.fields.C_fast[i, j, 1] * sediment.fast_decay_rate + + N_min_slow = sediment.fields.N_slow[i, j, 1] * sediment.slow_decay_rate + N_min_fast = sediment.fields.N_fast[i, j, 1] * sediment.fast_decay_rate + + Cᵐⁱⁿ = C_min_slow + C_min_fast + Nᵐⁱⁿ = N_min_slow + N_min_fast + + reactivity = Cᵐⁱⁿ * day / (sediment.fields.C_slow[i, j, 1] + sediment.fields.C_fast[i, j, 1]) + + # sediment evolution + sediment_tendencies.C_slow[i, j, 1] = (1 - sediment.refactory_fraction) * sediment.slow_fraction * carbon_deposition - C_min_slow + sediment_tendencies.C_fast[i, j, 1] = (1 - sediment.refactory_fraction) * sediment.fast_fraction * carbon_deposition - C_min_fast + sediment_tendencies.C_ref[i, j, 1] = sediment.refactory_fraction * carbon_deposition + + sediment_tendencies.N_slow[i, j, 1] = (1 - sediment.refactory_fraction) * sediment.slow_fraction * nitrogen_deposition - N_min_slow + sediment_tendencies.N_fast[i, j, 1] = (1 - sediment.refactory_fraction) * sediment.fast_fraction * nitrogen_deposition - N_min_fast + sediment_tendencies.N_ref[i, j, 1] = sediment.refactory_fraction * nitrogen_deposition + + # efflux/influx + O₂ = tracers.O₂[i, j, k] + NO₃ = tracers.NO₃[i, j, k] + NH₄ = tracers.NH₄[i, j, k] + + A, B, C, D, E, F = sediment.nitrate_oxidation_params + + pₙᵢₜ = exp(A + + B * log(Cᵐⁱⁿ * day) * log(O₂) + + C * log(Cᵐⁱⁿ * day) ^ 2 + + D * log(reactivity) * log(NH₄) + + E * log(Cᵐⁱⁿ * day) + + F * log(Cᵐⁱⁿ * day) * log(NH₄)) / (Nᵐⁱⁿ * day) + + #= + pᵈᵉⁿⁱᵗ = exp(sediment.denitrification_params.A + + sediment.denitrification_params.B * log(Cᵐⁱⁿ * day) + + sediment.denitrification_params.C * log(NO₃) ^ 2 + + sediment.denitrification_params.D * log(Cᵐⁱⁿ * day) ^ 2 + + sediment.denitrification_params.E * log(reactivity) ^ 2 + + sediment.denitrification_params.F * log(O₂) * log(reactivity)) / (Cᵐⁱⁿ * day) + =# + + A, B, C, D, E, F = sediment.anoxic_params + + pₐₙₒₓ = exp(A + + B * log(Cᵐⁱⁿ * day) + + C * log(Cᵐⁱⁿ * day) ^ 2 + + D * log(reactivity) + + E * log(O₂) * log(reactivity) + + F * log(NO₃) ^ 2) / (Cᵐⁱⁿ * day) + + A, B, C, D = sediment.solid_dep_params + pₛₒₗᵢ = A * (C * depth ^ D) ^ B + + tendencies.NH₄[i, j, k] += Nᵐⁱⁿ * (1 - pₙᵢₜ) / Δz + tendencies.NO₃[i, j, k] += Nᵐⁱⁿ * pₙᵢₜ / Δz + tendencies.DIC[i, j, k] += Cᵐⁱⁿ / Δz + tendencies.O₂[i, j, k] -= max(0, ((1 - pₐₙₒₓ * pₛₒₗᵢ) * Cᵐⁱⁿ + 2 * Nᵐⁱⁿ * pₙᵢₜ)/ Δz) # this seems dodge but this model doesn't cope with anoxia properly (I think) + end +end + +summary(::IronPhosphate{FT, P1, P2, P3, P4, F, TE}) where {FT, P1, P2, P3, P4, F, TE} = string("Single-layer multi-G + Iron + Phosphate sediment model ($FT)") +show(io::IO, model::IronPhosphate) = print(io, summary(model)) From 3cfbe7861ed12723f38da0858eb2a8cf103266ce Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 15 Jul 2024 12:52:12 +0100 Subject: [PATCH 06/27] added rate expressions --- src/Boundaries/Sediments/IronPhosphate.jl | 171 ++++++++++-------- src/Boundaries/Sediments/Sediments.jl | 4 +- .../AdvectedPopulations/LOBSTER/LOBSTER.jl | 12 +- 3 files changed, 105 insertions(+), 82 deletions(-) diff --git a/src/Boundaries/Sediments/IronPhosphate.jl b/src/Boundaries/Sediments/IronPhosphate.jl index 0f0ed59e8..d8a8bdaf7 100644 --- a/src/Boundaries/Sediments/IronPhosphate.jl +++ b/src/Boundaries/Sediments/IronPhosphate.jl @@ -107,7 +107,8 @@ function IronPhosphate(; grid, @warn "Sediment models are an experimental feature and have not yet been validated." @info "This sediment model is currently only compatible with models providing NH₄, NO₃, O₂, and DIC." - tracer_names = (:C_slow, :C_fast, :N_slow, :N_fast, :C_ref, :N_ref, :Fe_III, :Fe_II, :PO4_dissolved, :P_org) + tracer_names = (:O2, :NH4, :NO3, :NO2, :N2, :TPO4, :FeOHP, :FeII, :FeS2, :SO4, :TH2S, :CH4, :TCO2, :Gi) + #:C_slow, :C_fast, :N_slow, :N_fast, :C_ref, :N_ref, :Fe_III, :Fe_II, :PO4_dissolved, :P_org) # add field slicing back ( indices = (:, :, 1)) when output writer can cope fields = NamedTuple{tracer_names}(Tuple(CenterField(grid) for tracer in tracer_names)) @@ -144,20 +145,24 @@ adapt_structure(to, sediment::IronPhosphate) = nothing, adapt(to, sediment.bottom_indices)) -sediment_tracers(::IronPhosphate) = (:C_slow, :C_fast, :C_ref, :N_slow, :N_fast, :N_ref, :Fe_III, :Fe_II, :PO4_dissolved, :P_org) -sediment_fields(model::IronPhosphate) = (C_slow = model.fields.C_slow, - C_fast = model.fields.C_fast, - N_slow = model.fields.N_slow, - N_fast = model.fields.N_fast, - C_ref = model.fields.C_ref, - N_ref = model.fields.N_ref, - Fe_III = model.fields.Fe_III, - Fe_II = model.fields.Fe_II, - PO4_dissolved = model.fields.PO4_dissolved, - P_org = model.fields.P_org) - -@inline required_tracers(::IronPhosphate, bgc, tracers) = tracers[(:NO₃, :NH₄, :O₂, :DOC, sinking_tracers(bgc)...)] -@inline required_tendencies(::IronPhosphate, bgc, tracers) = tracers[(:NO₃, :NH₄, :O₂, :DIC, :DOC)] # TODO add effluxes of PO4 and Fe once PISCES is working +sediment_tracers(::IronPhosphate) = (:O2, :NH4, :NO3, :NO2, :N2, :TPO4, :FeOHP, :FeII, :FeS2, :SO4, :TH2S, :CH4, :TCO2, :Gi) +sediment_fields(model::IronPhosphate) = (O2 = model.fields.O2, + NH4 = model.fields.NH4, + NO3 = model.fields.NO3, + NO2 = model.fields.NO2, + N2 = model.fields.N2, + TPO4 = model.fields.TPO4, + FeOHP = model.fields.FeOHP, + FeII = model.fields.FeII, + FeS2 = model.fields.FeS2, + SO4 = model.fields.SO4, + TH2S = model.fields.TH2S, + CH4 = model.fields.CH4, + TCO2 = model.fields.TCO2, + Gi = model.fields.Gi) + +@inline required_tracers(::IronPhosphate, bgc, tracers) = tracers[(:NO₃, :NH₄, :O₂, :DIC, :POC, :Feᴾ, sinking_tracers(bgc)...)] +@inline required_tendencies(::IronPhosphate, bgc, tracers) = tracers[(:NO₃, :NH₄, :O₂, :DIC, :POC, :Feᴾ)] # TODO add effluxes of PO4 and Fe once PISCES is working @inline bottom_index_array(sediment::IronPhosphate) = sediment.bottom_indices @@ -168,6 +173,8 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri Δz = zspacing(i, j, k, grid, Center(), Center(), Center()) @inbounds begin + oxygen_deposition = oxygen_flux(i, j, k, grid, advection, bgc, tracers) * Δz + carbon_deposition = carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz nitrogen_deposition = nitrogen_flux(i, j, k, grid, advection, bgc, tracers) * Δz @@ -176,66 +183,84 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri iron_deposition = phosphate_flux(i, j, k, grid, advection, bgc, tracers) * Δz * 0.1 # molar ratio from Dale et al 2012, p. 633 - # rates - C_min_slow = sediment.fields.C_slow[i, j, 1] * sediment.slow_decay_rate - C_min_fast = sediment.fields.C_fast[i, j, 1] * sediment.fast_decay_rate - - N_min_slow = sediment.fields.N_slow[i, j, 1] * sediment.slow_decay_rate - N_min_fast = sediment.fields.N_fast[i, j, 1] * sediment.fast_decay_rate - - Cᵐⁱⁿ = C_min_slow + C_min_fast - Nᵐⁱⁿ = N_min_slow + N_min_fast + O2 = sediment.fields.O2[i, j, 1] + NH4 = sediment.fields.NH4[i, j, 1] + NO3 = sediment.fields.NO3[i, j, 1] + NO2 = sediment.fields.NO2[i, j, 1] + N2 = sediment.fields.N2[i, j, 1] + TPO4 = sediment.fields.TPO4[i, j, 1] + FeOHP = sediment.fields.FeOHP[i, j, 1] + FeII = sediment.fields.FeII[i, j, 1] + FeS2 = sediment.fields.FeS2[i, j, 1] + SO4 = sediment.fields.SO4[i, j, 1] + TH2S = sediment.fields.TH2S[i, j, 1] + CH4 = sediment.fields.CH4[i, j, 1] + TCO2 = sediment.fields.TCO2[i, j, 1] + Gi = sediment.fields.Gi[i, j, 1] + + ##### + ##### RATES + ##### + + @inline KO2 = 1 # μM, Half–saturation constant for O2 + @inline KNO3 = 10 # μM, Half–saturation constant for NO3 + @inline KNO2 = 10 # μM, Half–saturation constant for NO2 + @inline KFe = 0.028 # wt-%, Half–saturation constant for Fe + @inline KSO4 = 0.1 # μM, Half–saturation constant for SO4 + @inline KTPO4 = 10 # μM, Half–saturation constant for TPO4 - reactivity = Cᵐⁱⁿ * day / (sediment.fields.C_slow[i, j, 1] + sediment.fields.C_fast[i, j, 1]) - - # sediment evolution - sediment_tendencies.C_slow[i, j, 1] = (1 - sediment.refactory_fraction) * sediment.slow_fraction * carbon_deposition - C_min_slow - sediment_tendencies.C_fast[i, j, 1] = (1 - sediment.refactory_fraction) * sediment.fast_fraction * carbon_deposition - C_min_fast - sediment_tendencies.C_ref[i, j, 1] = sediment.refactory_fraction * carbon_deposition + @inline kGi = 0.016 # day⁻¹, Rate constant for G0 degradation, Dale et al + @inline fT = 1 # TODO temperature correction for rates + @inline fox = 10 # Enhancement factor for POM degradation by O2 + + fK_O2 = O2 / (O2 + KO2) # kinetic limiting term + fK_NO3 = NO3 / (NO3 + KNO3) # kinetic limiting term + fK_NO2 = NO2 / (NO2 + KNO2) # kinetic limiting term + fK_Fe = FeOHP / (FeOHP + KFe) # kinetic limiting term + fK_SO4 = SO4 / (SO4 + KSO4) # kinetic limiting term + fK_TPO4 = TPO4 / (TPO4 + KTPO4) # kinetic limiting term + + RO2 = Gi * (fT * kGi * fox * fK_O2) + RNO3 = Gi * (fT * kGi * fK_NO3 * (1 - fK_NO2) * (1 - fk_O2)) + RNO2 = Gi * (fT * kGi * fK_NO2 * (1 - fk_O2)) + RFe = Gi * (fT * kGi * fK_Fe * (1 - fK_NO3) * (1 - fK_NO2) * (1 - fk_NO2)) + RSO4 = Gi * (fT * kGi * fK_SO4 * (1 - fK_Fe) *(1 - fK_NO3) * (1 - fK_NO2) * (1 - fK_NO2)) + RCH4 = Gi * (fT * kGi * (1 - fK_SO4) * (1 - fK_Fe) *(1 - fK_NO3) * (1 - fK_NO3) * (1 - fK_NO2)) + + @inline kDNRA = 2.7e5 # M-1 day-1 + @inline kamx = 2.7e4 # M-1 day-1 + @inline kNH4ox = 2.7e4# M-1 day-1 + @inline kNO2ox = 2.7e4 # M-1 day-1 + @inline kAOM = 0.27 # day-1 + @inline kH2Sox = 2.7e4 # M-1 day-1 + @inline kFe2ox = 2.7e5 # M-1 day-1 + @inline kFeS2ox = 2.7e3 # M-1 day-1 + @inline kFeS2p = 2.7e4 # M-1 day-1 + @inline kFe3red = 0.82 # cm1.5 mmol−0.5 day−1 + + RDNRA = TH2S * NO3 * fT * kDNRA + Ramx = NH4 * NO2 * fT * kamx + RNH4ox = NH4 * O2 * fT * kNH4ox + RNO2ox = NO2 * O2 * fT * kNO2ox + RAOM = CH4 * SO4 * fT * kAOM + RH2Sox = TH2S * O2 * fT * kH2Sox + RFe2ox = FeII * O2 * fT * kFe2ox + RFeS2ox = FeS2 * O2 * fT * kFeS2ox + RFeS2p = TH2S * FeII * fT * kFeS2p + RFe3red = TH2S ^ 0.5 * FeOHP * fT * kFe3red * (2 / (O2 + 2)) + + ratio_NC = 9.5/106 + ratio_PC = 1/106 + ratio_FeP = 0.1 + + ##### + ##### sediment evolution + ##### + + sediment_tendencies.Gi = carbon_deposition - RO2 - RNO3 - RNO2 - RFe - RSO4 - RCH4 + + tendencies.PO4[i, j, k] = 0.1 * fK_TPO4 * RFe2ox - sediment_tendencies.N_slow[i, j, 1] = (1 - sediment.refactory_fraction) * sediment.slow_fraction * nitrogen_deposition - N_min_slow - sediment_tendencies.N_fast[i, j, 1] = (1 - sediment.refactory_fraction) * sediment.fast_fraction * nitrogen_deposition - N_min_fast - sediment_tendencies.N_ref[i, j, 1] = sediment.refactory_fraction * nitrogen_deposition - - # efflux/influx - O₂ = tracers.O₂[i, j, k] - NO₃ = tracers.NO₃[i, j, k] - NH₄ = tracers.NH₄[i, j, k] - - A, B, C, D, E, F = sediment.nitrate_oxidation_params - - pₙᵢₜ = exp(A + - B * log(Cᵐⁱⁿ * day) * log(O₂) + - C * log(Cᵐⁱⁿ * day) ^ 2 + - D * log(reactivity) * log(NH₄) + - E * log(Cᵐⁱⁿ * day) + - F * log(Cᵐⁱⁿ * day) * log(NH₄)) / (Nᵐⁱⁿ * day) - - #= - pᵈᵉⁿⁱᵗ = exp(sediment.denitrification_params.A + - sediment.denitrification_params.B * log(Cᵐⁱⁿ * day) + - sediment.denitrification_params.C * log(NO₃) ^ 2 + - sediment.denitrification_params.D * log(Cᵐⁱⁿ * day) ^ 2 + - sediment.denitrification_params.E * log(reactivity) ^ 2 + - sediment.denitrification_params.F * log(O₂) * log(reactivity)) / (Cᵐⁱⁿ * day) - =# - - A, B, C, D, E, F = sediment.anoxic_params - - pₐₙₒₓ = exp(A + - B * log(Cᵐⁱⁿ * day) + - C * log(Cᵐⁱⁿ * day) ^ 2 + - D * log(reactivity) + - E * log(O₂) * log(reactivity) + - F * log(NO₃) ^ 2) / (Cᵐⁱⁿ * day) - - A, B, C, D = sediment.solid_dep_params - pₛₒₗᵢ = A * (C * depth ^ D) ^ B - - tendencies.NH₄[i, j, k] += Nᵐⁱⁿ * (1 - pₙᵢₜ) / Δz - tendencies.NO₃[i, j, k] += Nᵐⁱⁿ * pₙᵢₜ / Δz - tendencies.DIC[i, j, k] += Cᵐⁱⁿ / Δz - tendencies.O₂[i, j, k] -= max(0, ((1 - pₐₙₒₓ * pₛₒₗᵢ) * Cᵐⁱⁿ + 2 * Nᵐⁱⁿ * pₙᵢₜ)/ Δz) # this seems dodge but this model doesn't cope with anoxia properly (I think) end end diff --git a/src/Boundaries/Sediments/Sediments.jl b/src/Boundaries/Sediments/Sediments.jl index af90e9003..edc0ec1d9 100644 --- a/src/Boundaries/Sediments/Sediments.jl +++ b/src/Boundaries/Sediments/Sediments.jl @@ -62,8 +62,8 @@ end @inline nitrogen_flux() = 0 @inline carbon_flux() = 0 -@inline inorg_phosphate_flux() = 0 -@inline org_phosphate_flux() = 0 +@inline phosphate_flux() = 0 +@inline oxygen_flux() = 0 @inline remineralisation_receiver() = nothing @inline sinking_tracers() = nothing @inline required_tracers() = nothing diff --git a/src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl b/src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl index 548d41a41..7d8f74122 100644 --- a/src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl +++ b/src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl @@ -486,14 +486,12 @@ const VariableRedfieldLobster = Union{LOBSTER{<:Any, <:Val{(false, false, true)} sinking_flux(i, j, k, grid, advection, Val(:sPOC), bgc, tracers) + sinking_flux(i, j, k, grid, advection, Val(:bPOC), bgc, tracers) -proportion_of_phosphor_as_ferric_phosphate = 0.5 +@inline phosphate_flux(i, j, k, grid, advection, bgc::VariableRedfieldLobster, tracers) = + (sinking_flux(i, j, k, grid, advection, Val(:sPOC), bgc, tracers) + + sinking_flux(i, j, k, grid, advection, Val(:bPOC), bgc, tracers)) * (1/106) -@inline inorg_phosphate_flux(i, j, k, grid, advection, bgc::VariableRedfieldLobster, tracers) = - sinking_flux(i, j, k, grid, advection, Val(:DIC), bgc, tracers) * (1/106) * proportion_of_phosphor_as_ferric_phosphate - -@inline org_phosphate_flux(i, j, k, grid, advection, bgc::VariableRedfieldLobster, tracers) = - (sinking_flux(i, j, k, grid, advection, Val(:sPON), bgc, tracers) + - sinking_flux(i, j, k, grid, advection, Val(:bPON), bgc, tracers)) * (1/16) +@inline oxygen_flux(i, j, k, grid, advection, bgc::VariableRedfieldLobster, tracers) = + (sinking_flux(i, j, k, grid, advection, Val(:O2), bgc, tracers)) @inline remineralisation_receiver(::LOBSTER) = :NH₄ From aec42cad58237aeecf18986f25743dc4e7e37b60 Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 15 Jul 2024 15:17:51 +0100 Subject: [PATCH 07/27] added tendencies - in theory should run with PISCES? --- src/Boundaries/Sediments/IronPhosphate.jl | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/Boundaries/Sediments/IronPhosphate.jl b/src/Boundaries/Sediments/IronPhosphate.jl index d8a8bdaf7..99fb31539 100644 --- a/src/Boundaries/Sediments/IronPhosphate.jl +++ b/src/Boundaries/Sediments/IronPhosphate.jl @@ -195,7 +195,6 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri SO4 = sediment.fields.SO4[i, j, 1] TH2S = sediment.fields.TH2S[i, j, 1] CH4 = sediment.fields.CH4[i, j, 1] - TCO2 = sediment.fields.TCO2[i, j, 1] Gi = sediment.fields.Gi[i, j, 1] ##### @@ -246,7 +245,7 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri RH2Sox = TH2S * O2 * fT * kH2Sox RFe2ox = FeII * O2 * fT * kFe2ox RFeS2ox = FeS2 * O2 * fT * kFeS2ox - RFeS2p = TH2S * FeII * fT * kFeS2p + RFeS2p = TH2S * FeII * fT * kFeS2p # H2 should be produced here but I assume it dissociates... RFe3red = TH2S ^ 0.5 * FeOHP * fT * kFe3red * (2 / (O2 + 2)) ratio_NC = 9.5/106 @@ -258,9 +257,19 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri ##### sediment_tendencies.Gi = carbon_deposition - RO2 - RNO3 - RNO2 - RFe - RSO4 - RCH4 - - tendencies.PO4[i, j, k] = 0.1 * fK_TPO4 * RFe2ox - + sediment_tendencies.O2 = oxygen_deposition - RO2 - 1.5 * RNH4ox - 0.5 * RNO2ox - 2 * RH2Sox - 0.25 * RFe2ox - 3.5 * RFeS2ox + sediment_tendencies.TCO2 = RO2 + RNO3 + RNO2 + RFe + RSO4 + RCH4 + RAOM + sediment_tendencies.NH4 = ratio_NC * (RO2 + RNO3 + RNO2 + RFe + RSO4 + RCH4) + RDNRA - Ramx - RNH4ox + sediment_tendencies.NO3 = -2 * RNO3 - RDNRA + RNO2ox + sediment_tendencies.NO2 = 2 * RNO3 - 1.33 * RNO2 - Ramx + RNH4ox - RNO2ox + sediment_tendencies.N2 = Ramx + 0.66 * RNO2 + sediment_tendencies.TPO4 = ratio_PC * (RO2 + RNO3 + RNO2 + RFe + RSO4 + RCH4) + RFe * ratio_FeP - ratio_FeP * RFe2ox * fK_TPO4 + ratio_FeP * RFe3red + sediment_tendencies.FeOHP = -4 * RFe + RFe2ox - RFe3red + sediment_tendencies.FeII = 4 * RFe - RFe2ox + RFeS2ox - RFeS2p + RFe3red + sediment_tendencies.FeS2 = RFeS2p - RFeS2ox + sediment_tendencies.SO4 = -0.5 * RSO4 + RDNRA - RAOM + RH2Sox + 2 * RFeS2ox + (RFe3red / 8) + sediment_tendencies.TH2S = 0.5 * RSO4 - RDNRA + RAOM - RH2Sox - 2 * RFeS2p - (RFe3red / 8) + sediment_tendencies.CH4 = 0.5 * RCH4 - RAOM end end From 5fabd5897fcc220249e65d23a69cc00444177794 Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 15 Jul 2024 15:24:08 +0100 Subject: [PATCH 08/27] tweaks --- src/Boundaries/Sediments/IronPhosphate.jl | 18 +++++++----------- src/Boundaries/Sediments/Sediments.jl | 3 ++- .../AdvectedPopulations/LOBSTER/LOBSTER.jl | 5 +++++ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/Boundaries/Sediments/IronPhosphate.jl b/src/Boundaries/Sediments/IronPhosphate.jl index 99fb31539..efc7c28e3 100644 --- a/src/Boundaries/Sediments/IronPhosphate.jl +++ b/src/Boundaries/Sediments/IronPhosphate.jl @@ -175,13 +175,9 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri @inbounds begin oxygen_deposition = oxygen_flux(i, j, k, grid, advection, bgc, tracers) * Δz - carbon_deposition = carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz - - nitrogen_deposition = nitrogen_flux(i, j, k, grid, advection, bgc, tracers) * Δz + POC_deposition = poc_flux(i, j, k, grid, advection, bgc, tracers) * Δz - phosphate_deposition = phosphate_flux(i, j, k, grid, advection, bgc, tracers) * Δz - - iron_deposition = phosphate_flux(i, j, k, grid, advection, bgc, tracers) * Δz * 0.1 # molar ratio from Dale et al 2012, p. 633 + iron_deposition = iron_flux(i, j, k, grid, advection, bgc, tracers) * Δz O2 = sediment.fields.O2[i, j, 1] NH4 = sediment.fields.NH4[i, j, 1] @@ -248,15 +244,15 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri RFeS2p = TH2S * FeII * fT * kFeS2p # H2 should be produced here but I assume it dissociates... RFe3red = TH2S ^ 0.5 * FeOHP * fT * kFe3red * (2 / (O2 + 2)) - ratio_NC = 9.5/106 - ratio_PC = 1/106 - ratio_FeP = 0.1 + @inline ratio_NC = 9.5/106 + @inline ratio_PC = 1/106 + @inline ratio_FeP = 0.1 ##### ##### sediment evolution ##### - sediment_tendencies.Gi = carbon_deposition - RO2 - RNO3 - RNO2 - RFe - RSO4 - RCH4 + sediment_tendencies.Gi = POC_deposition - RO2 - RNO3 - RNO2 - RFe - RSO4 - RCH4 sediment_tendencies.O2 = oxygen_deposition - RO2 - 1.5 * RNH4ox - 0.5 * RNO2ox - 2 * RH2Sox - 0.25 * RFe2ox - 3.5 * RFeS2ox sediment_tendencies.TCO2 = RO2 + RNO3 + RNO2 + RFe + RSO4 + RCH4 + RAOM sediment_tendencies.NH4 = ratio_NC * (RO2 + RNO3 + RNO2 + RFe + RSO4 + RCH4) + RDNRA - Ramx - RNH4ox @@ -264,7 +260,7 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri sediment_tendencies.NO2 = 2 * RNO3 - 1.33 * RNO2 - Ramx + RNH4ox - RNO2ox sediment_tendencies.N2 = Ramx + 0.66 * RNO2 sediment_tendencies.TPO4 = ratio_PC * (RO2 + RNO3 + RNO2 + RFe + RSO4 + RCH4) + RFe * ratio_FeP - ratio_FeP * RFe2ox * fK_TPO4 + ratio_FeP * RFe3red - sediment_tendencies.FeOHP = -4 * RFe + RFe2ox - RFe3red + sediment_tendencies.FeOHP = iron_deposition - 4 * RFe + RFe2ox - RFe3red sediment_tendencies.FeII = 4 * RFe - RFe2ox + RFeS2ox - RFeS2p + RFe3red sediment_tendencies.FeS2 = RFeS2p - RFeS2ox sediment_tendencies.SO4 = -0.5 * RSO4 + RDNRA - RAOM + RH2Sox + 2 * RFeS2ox + (RFe3red / 8) diff --git a/src/Boundaries/Sediments/Sediments.jl b/src/Boundaries/Sediments/Sediments.jl index edc0ec1d9..cf8f2a178 100644 --- a/src/Boundaries/Sediments/Sediments.jl +++ b/src/Boundaries/Sediments/Sediments.jl @@ -62,8 +62,9 @@ end @inline nitrogen_flux() = 0 @inline carbon_flux() = 0 -@inline phosphate_flux() = 0 +@inline iron_flux() = 0 @inline oxygen_flux() = 0 +@inline poc_flux() = 0 @inline remineralisation_receiver() = nothing @inline sinking_tracers() = nothing @inline required_tracers() = nothing diff --git a/src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl b/src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl index 7d8f74122..6dea6c870 100644 --- a/src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl +++ b/src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl @@ -493,6 +493,11 @@ const VariableRedfieldLobster = Union{LOBSTER{<:Any, <:Val{(false, false, true)} @inline oxygen_flux(i, j, k, grid, advection, bgc::VariableRedfieldLobster, tracers) = (sinking_flux(i, j, k, grid, advection, Val(:O2), bgc, tracers)) +@inline poc_flux(i, j, k, grid, advection, bgc::VariableRedfieldLobster, tracers) = + (sinking_flux(i, j, k, grid, advection, Val(:sPOC), bgc, tracers) + + sinking_flux(i, j, k, grid, advection, Val(:bPOC), bgc, tracers)) + + @inline remineralisation_receiver(::LOBSTER) = :NH₄ From c216646c3c937ea6d668472584bc5705dab88803 Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 15 Jul 2024 15:39:34 +0100 Subject: [PATCH 09/27] refactoring pt.1 --- src/Boundaries/Sediments/IronPhosphate.jl | 117 +++++++++++----------- 1 file changed, 59 insertions(+), 58 deletions(-) diff --git a/src/Boundaries/Sediments/IronPhosphate.jl b/src/Boundaries/Sediments/IronPhosphate.jl index efc7c28e3..e4fb51e62 100644 --- a/src/Boundaries/Sediments/IronPhosphate.jl +++ b/src/Boundaries/Sediments/IronPhosphate.jl @@ -107,7 +107,7 @@ function IronPhosphate(; grid, @warn "Sediment models are an experimental feature and have not yet been validated." @info "This sediment model is currently only compatible with models providing NH₄, NO₃, O₂, and DIC." - tracer_names = (:O2, :NH4, :NO3, :NO2, :N2, :TPO4, :FeOHP, :FeII, :FeS2, :SO4, :TH2S, :CH4, :TCO2, :Gi) + tracer_names = (:O₂, :NH₄, :NO₃, :NO₂, :N₂, :TPO₄, :FeOHP, :Feᴵᴵ, :FeS₂, :SO₄, :TH₂S, :CH₄, :TCO₂, :Gi) #:C_slow, :C_fast, :N_slow, :N_fast, :C_ref, :N_ref, :Fe_III, :Fe_II, :PO4_dissolved, :P_org) # add field slicing back ( indices = (:, :, 1)) when output writer can cope @@ -145,7 +145,7 @@ adapt_structure(to, sediment::IronPhosphate) = nothing, adapt(to, sediment.bottom_indices)) -sediment_tracers(::IronPhosphate) = (:O2, :NH4, :NO3, :NO2, :N2, :TPO4, :FeOHP, :FeII, :FeS2, :SO4, :TH2S, :CH4, :TCO2, :Gi) +sediment_tracers(::IronPhosphate) = (:O₂, :NH₄, :NO₃, :NO₂, :N₂, :TPO₄, :FeOHP, :Feᴵᴵ, :FeS₂, :SO₄, :TH₂S, :CH₄, :TCO₂, :Gi) sediment_fields(model::IronPhosphate) = (O2 = model.fields.O2, NH4 = model.fields.NH4, NO3 = model.fields.NO3, @@ -179,48 +179,49 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri iron_deposition = iron_flux(i, j, k, grid, advection, bgc, tracers) * Δz - O2 = sediment.fields.O2[i, j, 1] - NH4 = sediment.fields.NH4[i, j, 1] - NO3 = sediment.fields.NO3[i, j, 1] - NO2 = sediment.fields.NO2[i, j, 1] - N2 = sediment.fields.N2[i, j, 1] - TPO4 = sediment.fields.TPO4[i, j, 1] + #(:O₂, :NH₄, :NO₃, :NO₂, :N₂, :TPO₄, :FeOHP, :Feᴵᴵ, :FeS₂, :SO₄, :TH₂S, :CH₄, :TCO₂, :Gi) + O₂ = sediment.fields.O₂[i, j, 1] + NH₄ = sediment.fields.NH₄[i, j, 1] + NO₃ = sediment.fields.NO₃[i, j, 1] + NO₂ = sediment.fields.NO₂[i, j, 1] + TPO₄ = sediment.fields.TPO₄[i, j, 1] FeOHP = sediment.fields.FeOHP[i, j, 1] - FeII = sediment.fields.FeII[i, j, 1] - FeS2 = sediment.fields.FeS2[i, j, 1] - SO4 = sediment.fields.SO4[i, j, 1] - TH2S = sediment.fields.TH2S[i, j, 1] - CH4 = sediment.fields.CH4[i, j, 1] + Feᴵᴵ = sediment.fields.Feᴵᴵ[i, j, 1] + FeS₂ = sediment.fields.FeS₂[i, j, 1] + SO₄ = sediment.fields.SO₄[i, j, 1] + TH₂S = sediment.fields.TH₂S[i, j, 1] + CH₄ = sediment.fields.CH₄[i, j, 1] Gi = sediment.fields.Gi[i, j, 1] ##### ##### RATES ##### - @inline KO2 = 1 # μM, Half–saturation constant for O2 - @inline KNO3 = 10 # μM, Half–saturation constant for NO3 - @inline KNO2 = 10 # μM, Half–saturation constant for NO2 - @inline KFe = 0.028 # wt-%, Half–saturation constant for Fe - @inline KSO4 = 0.1 # μM, Half–saturation constant for SO4 - @inline KTPO4 = 10 # μM, Half–saturation constant for TPO4 - + @inline K_O₂ = 1 # μM, Half–saturation constant for O2 + @inline K_NO₃ = 10 # μM, Half–saturation constant for NO3 + @inline K_NO₂ = 10 # μM, Half–saturation constant for NO2 + @inline K_Fe = 0.028 # wt-%, Half–saturation constant for Fe + @inline K_SO₄ = 0.1 # μM, Half–saturation constant for SO4 + @inline K_TPO₄ = 10 # μM, Half–saturation constant for TPO4 + #(:O₂, :NH₄, :NO₃, :NO₂, :N₂, :TPO₄, :FeOHP, :Feᴵᴵ, :FeS₂, :SO₄, :TH₂S, :CH₄, :TCO₂, :Gi) + @inline kGi = 0.016 # day⁻¹, Rate constant for G0 degradation, Dale et al @inline fT = 1 # TODO temperature correction for rates - @inline fox = 10 # Enhancement factor for POM degradation by O2 - - fK_O2 = O2 / (O2 + KO2) # kinetic limiting term - fK_NO3 = NO3 / (NO3 + KNO3) # kinetic limiting term - fK_NO2 = NO2 / (NO2 + KNO2) # kinetic limiting term - fK_Fe = FeOHP / (FeOHP + KFe) # kinetic limiting term - fK_SO4 = SO4 / (SO4 + KSO4) # kinetic limiting term - fK_TPO4 = TPO4 / (TPO4 + KTPO4) # kinetic limiting term - - RO2 = Gi * (fT * kGi * fox * fK_O2) - RNO3 = Gi * (fT * kGi * fK_NO3 * (1 - fK_NO2) * (1 - fk_O2)) - RNO2 = Gi * (fT * kGi * fK_NO2 * (1 - fk_O2)) - RFe = Gi * (fT * kGi * fK_Fe * (1 - fK_NO3) * (1 - fK_NO2) * (1 - fk_NO2)) - RSO4 = Gi * (fT * kGi * fK_SO4 * (1 - fK_Fe) *(1 - fK_NO3) * (1 - fK_NO2) * (1 - fK_NO2)) - RCH4 = Gi * (fT * kGi * (1 - fK_SO4) * (1 - fK_Fe) *(1 - fK_NO3) * (1 - fK_NO3) * (1 - fK_NO2)) + @inline fₒₓ = 10 # Enhancement factor for POM degradation by O2 + + fₖ₋ₒ₂ = O₂ / (O₂ + K_O₂) # kinetic limiting term + fₖ₋ₙₒ₃ = NO₃ / (NO₃ + K_NO₃) # kinetic limiting term + fₖ₋ₙₒ₂ = NO₂ / (NO₂ + K_NO₂) # kinetic limiting term + fK_Fe = FeOHP / (FeOHP + K_Fe) # kinetic limiting term + fₖ₋ₛₒ₄ = SO₄ / (SO₄ + K_SO₄) # kinetic limiting term + fₖ₋ₜₚₒ₄ = TPO₄ / (TPO₄ + K_TPO₄) # kinetic limiting term + + RO₂ = Gi * (fT * kGi * fₒₓ * fₖ₋ₒ₂) + RNO₃ = Gi * (fT * kGi * fₖ₋ₙₒ₃ * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₒ₂)) + RNO₂ = Gi * (fT * kGi * fₖ₋ₙₒ₂ * (1 - fₖ₋ₒ₂)) + RFe = Gi * (fT * kGi * fK_Fe * (1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₙₒ₂)) + RSO₄ = Gi * (fT * kGi * fₖ₋ₛₒ₄ * (1 - fK_Fe) *(1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₙₒ₂)) + RCH₄ = Gi * (fT * kGi * (1 - fₖ₋ₛₒ₄) * (1 - fK_Fe) *(1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂)) @inline kDNRA = 2.7e5 # M-1 day-1 @inline kamx = 2.7e4 # M-1 day-1 @@ -233,16 +234,16 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri @inline kFeS2p = 2.7e4 # M-1 day-1 @inline kFe3red = 0.82 # cm1.5 mmol−0.5 day−1 - RDNRA = TH2S * NO3 * fT * kDNRA - Ramx = NH4 * NO2 * fT * kamx - RNH4ox = NH4 * O2 * fT * kNH4ox - RNO2ox = NO2 * O2 * fT * kNO2ox - RAOM = CH4 * SO4 * fT * kAOM - RH2Sox = TH2S * O2 * fT * kH2Sox - RFe2ox = FeII * O2 * fT * kFe2ox - RFeS2ox = FeS2 * O2 * fT * kFeS2ox - RFeS2p = TH2S * FeII * fT * kFeS2p # H2 should be produced here but I assume it dissociates... - RFe3red = TH2S ^ 0.5 * FeOHP * fT * kFe3red * (2 / (O2 + 2)) + RDNRA = TH₂S * NO₃ * fT * kDNRA + Ramx = NH₄ * NO₂ * fT * kamx + RNH4ox = NH₄ * O₂ * fT * kNH4ox + RNO2ox = NO₂ * O₂ * fT * kNO2ox + RAOM = CH₄ * SO₄ * fT * kAOM + RH2Sox = TH₂S * O₂ * fT * kH2Sox + RFe2ox = Feᴵᴵ * O₂ * fT * kFe2ox + RFeS2ox = FeS₂ * O₂ * fT * kFeS2ox + RFeS2p = TH₂S * Feᴵᴵ * fT * kFeS2p # H2 should be produced here but I assume it dissociates... + RFe3red = TH₂S ^ 0.5 * FeOHP * fT * kFe3red * (2 / (O₂ + 2)) @inline ratio_NC = 9.5/106 @inline ratio_PC = 1/106 @@ -252,20 +253,20 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri ##### sediment evolution ##### - sediment_tendencies.Gi = POC_deposition - RO2 - RNO3 - RNO2 - RFe - RSO4 - RCH4 - sediment_tendencies.O2 = oxygen_deposition - RO2 - 1.5 * RNH4ox - 0.5 * RNO2ox - 2 * RH2Sox - 0.25 * RFe2ox - 3.5 * RFeS2ox - sediment_tendencies.TCO2 = RO2 + RNO3 + RNO2 + RFe + RSO4 + RCH4 + RAOM - sediment_tendencies.NH4 = ratio_NC * (RO2 + RNO3 + RNO2 + RFe + RSO4 + RCH4) + RDNRA - Ramx - RNH4ox - sediment_tendencies.NO3 = -2 * RNO3 - RDNRA + RNO2ox - sediment_tendencies.NO2 = 2 * RNO3 - 1.33 * RNO2 - Ramx + RNH4ox - RNO2ox - sediment_tendencies.N2 = Ramx + 0.66 * RNO2 - sediment_tendencies.TPO4 = ratio_PC * (RO2 + RNO3 + RNO2 + RFe + RSO4 + RCH4) + RFe * ratio_FeP - ratio_FeP * RFe2ox * fK_TPO4 + ratio_FeP * RFe3red + sediment_tendencies.Gi = POC_deposition - RO₂ - RNO₃ - RNO₂ - RFe - RSO₄ - RCH₄ + sediment_tendencies.O₂ = oxygen_deposition - RO₂ - 1.5 * RNH4ox - 0.5 * RNO2ox - 2 * RH2Sox - 0.25 * RFe2ox - 3.5 * RFeS2ox + sediment_tendencies.TCO₂ = RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄ + RAOM + sediment_tendencies.NH₄ = ratio_NC * (RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄) + RDNRA - Ramx - RNH4ox + sediment_tendencies.NO₃ = -2 * RNO₃ - RDNRA + RNO2ox + sediment_tendencies.NO₂ = 2 * RNO₃ - 1.33 * RNO₂ - Ramx + RNH4ox - RNO2ox + sediment_tendencies.N₂ = Ramx + 0.66 * RNO₂ + sediment_tendencies.TPO₄ = ratio_PC * (RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄) + RFe * ratio_FeP - ratio_FeP * RFe2ox * fₖ₋ₜₚₒ₄ + ratio_FeP * RFe3red sediment_tendencies.FeOHP = iron_deposition - 4 * RFe + RFe2ox - RFe3red - sediment_tendencies.FeII = 4 * RFe - RFe2ox + RFeS2ox - RFeS2p + RFe3red - sediment_tendencies.FeS2 = RFeS2p - RFeS2ox - sediment_tendencies.SO4 = -0.5 * RSO4 + RDNRA - RAOM + RH2Sox + 2 * RFeS2ox + (RFe3red / 8) - sediment_tendencies.TH2S = 0.5 * RSO4 - RDNRA + RAOM - RH2Sox - 2 * RFeS2p - (RFe3red / 8) - sediment_tendencies.CH4 = 0.5 * RCH4 - RAOM + sediment_tendencies.Feᴵᴵ = 4 * RFe - RFe2ox + RFeS2ox - RFeS2p + RFe3red + sediment_tendencies.FeS₂ = RFeS2p - RFeS2ox + sediment_tendencies.SO₄ = -0.5 * RSO₄ + RDNRA - RAOM + RH2Sox + 2 * RFeS2ox + (RFe3red / 8) + sediment_tendencies.TH₂S = 0.5 * RSO₄ - RDNRA + RAOM - RH2Sox - 2 * RFeS2p - (RFe3red / 8) + sediment_tendencies.CH₄ = 0.5 * RCH₄ - RAOM end end From 301fddc4843fd6241b05b6eff47b8247243d9864 Mon Sep 17 00:00:00 2001 From: louis Date: Mon, 15 Jul 2024 15:47:00 +0100 Subject: [PATCH 10/27] tweaks --- src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl b/src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl index 6dea6c870..84b6d33ed 100644 --- a/src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl +++ b/src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl @@ -486,9 +486,9 @@ const VariableRedfieldLobster = Union{LOBSTER{<:Any, <:Val{(false, false, true)} sinking_flux(i, j, k, grid, advection, Val(:sPOC), bgc, tracers) + sinking_flux(i, j, k, grid, advection, Val(:bPOC), bgc, tracers) -@inline phosphate_flux(i, j, k, grid, advection, bgc::VariableRedfieldLobster, tracers) = +@inline iron_flux(i, j, k, grid, advection, bgc::VariableRedfieldLobster, tracers) = (sinking_flux(i, j, k, grid, advection, Val(:sPOC), bgc, tracers) + - sinking_flux(i, j, k, grid, advection, Val(:bPOC), bgc, tracers)) * (1/106) + sinking_flux(i, j, k, grid, advection, Val(:bPOC), bgc, tracers)) * (1/106) * 0.1 # molar ratio from Dale et al 2012, p. 633 @inline oxygen_flux(i, j, k, grid, advection, bgc::VariableRedfieldLobster, tracers) = (sinking_flux(i, j, k, grid, advection, Val(:O2), bgc, tracers)) From 1c8e56090ee561af2dd0a69f646b4f2c8a84edd1 Mon Sep 17 00:00:00 2001 From: louis Date: Tue, 16 Jul 2024 12:47:02 +0100 Subject: [PATCH 11/27] added test? for ironphos --- src/Boundaries/Sediments/IronPhosphate.jl | 47 +++---- src/Boundaries/Sediments/Sediments.jl | 3 +- test/test_IronPhos.jl | 145 ++++++++++++++++++++++ 3 files changed, 171 insertions(+), 24 deletions(-) create mode 100644 test/test_IronPhos.jl diff --git a/src/Boundaries/Sediments/IronPhosphate.jl b/src/Boundaries/Sediments/IronPhosphate.jl index e4fb51e62..fccf6cbf2 100644 --- a/src/Boundaries/Sediments/IronPhosphate.jl +++ b/src/Boundaries/Sediments/IronPhosphate.jl @@ -223,6 +223,7 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri RSO₄ = Gi * (fT * kGi * fₖ₋ₛₒ₄ * (1 - fK_Fe) *(1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₙₒ₂)) RCH₄ = Gi * (fT * kGi * (1 - fₖ₋ₛₒ₄) * (1 - fK_Fe) *(1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂)) + @inline kDNRA = 2.7e5 # M-1 day-1 @inline kamx = 2.7e4 # M-1 day-1 @inline kNH4ox = 2.7e4# M-1 day-1 @@ -234,16 +235,16 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri @inline kFeS2p = 2.7e4 # M-1 day-1 @inline kFe3red = 0.82 # cm1.5 mmol−0.5 day−1 - RDNRA = TH₂S * NO₃ * fT * kDNRA - Ramx = NH₄ * NO₂ * fT * kamx - RNH4ox = NH₄ * O₂ * fT * kNH4ox - RNO2ox = NO₂ * O₂ * fT * kNO2ox - RAOM = CH₄ * SO₄ * fT * kAOM - RH2Sox = TH₂S * O₂ * fT * kH2Sox - RFe2ox = Feᴵᴵ * O₂ * fT * kFe2ox - RFeS2ox = FeS₂ * O₂ * fT * kFeS2ox - RFeS2p = TH₂S * Feᴵᴵ * fT * kFeS2p # H2 should be produced here but I assume it dissociates... - RFe3red = TH₂S ^ 0.5 * FeOHP * fT * kFe3red * (2 / (O₂ + 2)) + R_DNRA = TH₂S * NO₃ * fT * kDNRA + R_amx = NH₄ * NO₂ * fT * kamx + R_NH4ox = NH₄ * O₂ * fT * kNH4ox + R_NO2ox = NO₂ * O₂ * fT * kNO2ox + R_AOM = CH₄ * SO₄ * fT * kAOM + R_H2Sox = TH₂S * O₂ * fT * kH2Sox + R_Fe2ox = Feᴵᴵ * O₂ * fT * kFe2ox + R_FeS2ox = FeS₂ * O₂ * fT * kFeS2ox + R_FeS2p = TH₂S * Feᴵᴵ * fT * kFeS2p # H2 should be produced here but I assume it dissociates... + R_Fe3red = TH₂S ^ 0.5 * FeOHP * fT * kFe3red * (2 / (O₂ + 2)) @inline ratio_NC = 9.5/106 @inline ratio_PC = 1/106 @@ -254,19 +255,19 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri ##### sediment_tendencies.Gi = POC_deposition - RO₂ - RNO₃ - RNO₂ - RFe - RSO₄ - RCH₄ - sediment_tendencies.O₂ = oxygen_deposition - RO₂ - 1.5 * RNH4ox - 0.5 * RNO2ox - 2 * RH2Sox - 0.25 * RFe2ox - 3.5 * RFeS2ox - sediment_tendencies.TCO₂ = RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄ + RAOM - sediment_tendencies.NH₄ = ratio_NC * (RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄) + RDNRA - Ramx - RNH4ox - sediment_tendencies.NO₃ = -2 * RNO₃ - RDNRA + RNO2ox - sediment_tendencies.NO₂ = 2 * RNO₃ - 1.33 * RNO₂ - Ramx + RNH4ox - RNO2ox - sediment_tendencies.N₂ = Ramx + 0.66 * RNO₂ - sediment_tendencies.TPO₄ = ratio_PC * (RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄) + RFe * ratio_FeP - ratio_FeP * RFe2ox * fₖ₋ₜₚₒ₄ + ratio_FeP * RFe3red - sediment_tendencies.FeOHP = iron_deposition - 4 * RFe + RFe2ox - RFe3red - sediment_tendencies.Feᴵᴵ = 4 * RFe - RFe2ox + RFeS2ox - RFeS2p + RFe3red - sediment_tendencies.FeS₂ = RFeS2p - RFeS2ox - sediment_tendencies.SO₄ = -0.5 * RSO₄ + RDNRA - RAOM + RH2Sox + 2 * RFeS2ox + (RFe3red / 8) - sediment_tendencies.TH₂S = 0.5 * RSO₄ - RDNRA + RAOM - RH2Sox - 2 * RFeS2p - (RFe3red / 8) - sediment_tendencies.CH₄ = 0.5 * RCH₄ - RAOM + sediment_tendencies.O₂ = oxygen_deposition - RO₂ - 1.5 * R_NH4ox - 0.5 * R_NO2ox - 2 * R_H2Sox - 0.25 * R_Fe2ox - 3.5 * R_FeS2ox + sediment_tendencies.TCO₂ = RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄ + R_AOM + sediment_tendencies.NH₄ = ratio_NC * (RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄) + R_DNRA - R_amx - R_NH4ox + sediment_tendencies.NO₃ = -2 * RNO₃ - R_DNRA + R_NO2ox + sediment_tendencies.NO₂ = 2 * RNO₃ - 1.33 * RNO₂ - R_amx + R_NH4ox - R_NO2ox + sediment_tendencies.N₂ = R_amx + 0.66 * RNO₂ + sediment_tendencies.TPO₄ = ratio_PC * (RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄) + RFe * ratio_FeP - ratio_FeP * R_Fe2ox * fₖ₋ₜₚₒ₄ + ratio_FeP * R_Fe3red + sediment_tendencies.FeOHP = iron_deposition - 4 * RFe + R_Fe2ox - R_Fe3red + sediment_tendencies.Feᴵᴵ = 4 * RFe - R_Fe2ox + R_FeS2ox - R_FeS2p + R_Fe3red + sediment_tendencies.FeS₂ = R_FeS2p - R_FeS2ox + sediment_tendencies.SO₄ = -0.5 * RSO₄ + R_DNRA - R_AOM + R_H2Sox + 2 * R_FeS2ox + (R_Fe3red / 8) + sediment_tendencies.TH₂S = 0.5 * RSO₄ - R_DNRA + R_AOM - R_H2Sox - 2 * R_FeS2p - (R_Fe3red / 8) + sediment_tendencies.CH₄ = 0.5 * RCH₄ - R_AOM end end diff --git a/src/Boundaries/Sediments/Sediments.jl b/src/Boundaries/Sediments/Sediments.jl index cf8f2a178..13a88b312 100644 --- a/src/Boundaries/Sediments/Sediments.jl +++ b/src/Boundaries/Sediments/Sediments.jl @@ -1,6 +1,6 @@ module Sediments -export SimpleMultiG, InstantRemineralisation +export SimpleMultiG, InstantRemineralisation, IronPhosphate using KernelAbstractions @@ -109,5 +109,6 @@ end include("coupled_timesteppers.jl") include("simple_multi_G.jl") include("instant_remineralization.jl") +include("IronPhosphate.jl") end # module diff --git a/test/test_IronPhos.jl b/test/test_IronPhos.jl new file mode 100644 index 000000000..a2fc8934e --- /dev/null +++ b/test/test_IronPhos.jl @@ -0,0 +1,145 @@ +include("dependencies_for_runtests.jl") + +using OceanBioME.Sediments: SimpleMultiG, InstantRemineralisation, IronPhosphate +using Oceananigans.Units + +using OceanBioME.Sediments: sediment_tracers, sediment_fields +using Oceananigans: Field +using Oceananigans.Fields: TracerFields + +using Oceananigans.Operators: volume, Azᶠᶜᶜ + +using OceanBioME.LOBSTERModel: VariableRedfieldLobster + +function intercept_tracer_tendencies!(model, intercepted_tendencies) + for (name, field) in enumerate(intercepted_tendencies) + field .= Array(interior(model.timestepper.Gⁿ[name + 3])) + end +end + +function set_defaults!(sediment::SimpleMultiG) + set!(sediment.fields.N_fast, 0.0230) + set!(sediment.fields.N_slow, 0.0807) + + set!(sediment.fields.C_fast, 0.5893) + set!(sediment.fields.C_slow, 0.1677) +end + +set_defaults!(::InstantRemineralisation) = nothing + +set_defaults!(::LOBSTER, model) = + set!(model, P = 0.4686, Z = 0.5363, + NO₃ = 2.3103, NH₄ = 0.0010, + DOM = 0.8115, + sPOM = 0.2299, bPOM = 0.0103) + + +set_defaults!(::VariableRedfieldLobster, model) = + set!(model, P = 0.4686, Z = 0.5363, + NO₃ = 2.3103, NH₄ = 0.0010, + DIC = 2106.9, Alk = 2408.9, + O₂ = 258.92, + DOC = 5.3390, DON = 0.8115, + sPON = 0.2299, sPOC = 1.5080, + bPON = 0.0103, bPOC = 0.0781) + + +set_defaults!(::NutrientPhytoplanktonZooplanktonDetritus, model) = set!(model, N = 2.3, P = 0.4, Z = 0.5, D = 0.2) + +total_nitrogen(sed::SimpleMultiG) = sum(sed.fields.N_fast) + + sum(sed.fields.N_slow) + + sum(sed.fields.N_ref) + +total_nitrogen(sed::InstantRemineralisation) = sum(sed.fields.N_storage) + +total_nitrogen(::LOBSTER, model) = sum(model.tracers.NO₃) + + sum(model.tracers.NH₄) + + sum(model.tracers.P) + + sum(model.tracers.Z) + + sum(model.tracers.DOM) + + sum(model.tracers.sPOM) + + sum(model.tracers.bPOM) + +total_nitrogen(::VariableRedfieldLobster, model) = sum(model.tracers.NO₃) + + sum(model.tracers.NH₄) + + sum(model.tracers.P) + + sum(model.tracers.Z) + + sum(model.tracers.DON) + + sum(model.tracers.sPON) + + sum(model.tracers.bPON) + +total_nitrogen(::NutrientPhytoplanktonZooplanktonDetritus, model) = sum(model.tracers.N) + + sum(model.tracers.P) + + sum(model.tracers.Z) + + sum(model.tracers.D) + +function test_flat_sediment(grid, biogeochemistry, model; timestepper = :QuasiAdamsBashforth2) + model = isa(model, NonhydrostaticModel) ? model(; grid, + biogeochemistry, + closure = nothing, + timestepper, + buoyancy = nothing) : + model(; grid, + biogeochemistry, + closure = nothing, + buoyancy = nothing, + tracers = nothing) + + set_defaults!(model.biogeochemistry.sediment) + + set_defaults!(biogeochemistry.underlying_biogeochemistry, model) + + simulation = Simulation(model, Δt = 50, stop_time = 1day) + + intercepted_tendencies = Tuple(Array(interior(field)) for field in values(TracerFields(keys(model.tracers), grid))) + + simulation.callbacks[:intercept_tendencies] = Callback(intercept_tracer_tendencies!; callsite = TendencyCallsite(), parameters = intercepted_tendencies) + + N₀ = CUDA.@allowscalar total_nitrogen(biogeochemistry.underlying_biogeochemistry, model) * volume(1, 1, 1, grid, Center(), Center(), Center()) + total_nitrogen(biogeochemistry.sediment) * Azᶠᶜᶜ(1, 1, 1, grid) + + run!(simulation) + + # the model is changing the tracer tendencies + @test any([any(intercepted_tendencies[idx] .!= Array(interior(model.timestepper.Gⁿ[tracer]))) for (idx, tracer) in enumerate(keys(model.tracers))]) + + # the sediment tendencies are being updated + @test all([any(Array(interior(tend)) .!= 0.0) for tend in model.biogeochemistry.sediment.tendencies.Gⁿ]) + @test all([any(Array(interior(tend)) .!= 0.0) for tend in model.biogeochemistry.sediment.tendencies.G⁻]) + + # the sediment values are being integrated + initial_values = (N_fast = 0.0230, N_slow = 0.0807, C_fast = 0.5893, C_slow = 0.1677, N_ref = 0.0, C_ref = 0.0, N_storage = 0.0) + @test all([any(Array(interior(field)) .!= initial_values[name]) for (name, field) in pairs(model.biogeochemistry.sediment.fields)]) + + N₁ = CUDA.@allowscalar total_nitrogen(biogeochemistry.underlying_biogeochemistry, model) * volume(1, 1, 1, grid, Center(), Center(), Center()) + total_nitrogen(biogeochemistry.sediment) * Azᶠᶜᶜ(1, 1, 1, grid) + + # conservations + rtol = ifelse(isa(architecture, CPU), max(√eps(N₀), √eps(N₁)), 5e-7) + @test isapprox(N₀, N₁; rtol) + + return nothing +end + +display_name(::LOBSTER) = "LOBSTER" +display_name(::NutrientPhytoplanktonZooplanktonDetritus) = "NPZD" +display_name(::SimpleMultiG) = "Multi-G" +display_name(::InstantRemineralisation) = "Instant remineralisation" +display_name(::RectilinearGrid) = "Rectilinear grid" +display_name(::LatitudeLongitudeGrid) = "Latitude longitude grid" +display_name(::ImmersedBoundaryGrid) = "Immersed boundary grid" + + +bottom_height(x, y) = -1000 + 500 * exp(- (x^2 + y^2) / 250) # a perfect hill + +@testset "Sediment integration" begin + grid = RectilinearGrid(architecture; size=(3, 3, 50), extent=(10, 10, 500)) + sediment_model in (IronPhosphate(; grid)), + biogeochemistry = LOBSTER(; grid, + carbonates = true, + oxygen = true, + variable_redfield = true, + sediment_model) + + test_flat_sediment(grid, biogeochemistry, NonhydrostaticModel; :RungeKutta3) + + +end From a7489ee2dbdc409707ac6e90636d29f6b4827126 Mon Sep 17 00:00:00 2001 From: louis Date: Tue, 16 Jul 2024 13:18:55 +0100 Subject: [PATCH 12/27] it broke --- src/Boundaries/Sediments/IronPhosphate.jl | 4 +- .../AdvectedPopulations/LOBSTER/LOBSTER.jl | 2 +- test/test_IronPhos.jl | 113 ++++++------------ 3 files changed, 39 insertions(+), 80 deletions(-) diff --git a/src/Boundaries/Sediments/IronPhosphate.jl b/src/Boundaries/Sediments/IronPhosphate.jl index fccf6cbf2..ee453b4d7 100644 --- a/src/Boundaries/Sediments/IronPhosphate.jl +++ b/src/Boundaries/Sediments/IronPhosphate.jl @@ -161,8 +161,8 @@ sediment_fields(model::IronPhosphate) = (O2 = model.fields.O2, TCO2 = model.fields.TCO2, Gi = model.fields.Gi) -@inline required_tracers(::IronPhosphate, bgc, tracers) = tracers[(:NO₃, :NH₄, :O₂, :DIC, :POC, :Feᴾ, sinking_tracers(bgc)...)] -@inline required_tendencies(::IronPhosphate, bgc, tracers) = tracers[(:NO₃, :NH₄, :O₂, :DIC, :POC, :Feᴾ)] # TODO add effluxes of PO4 and Fe once PISCES is working +@inline required_tracers(::IronPhosphate, bgc, tracers) = tracers[(sinking_tracers(bgc)...)] +@inline required_tendencies(::IronPhosphate, bgc, tracers) = tracers[] # TODO add effluxes of PO4 and Fe once PISCES is working @inline bottom_index_array(sediment::IronPhosphate) = sediment.bottom_indices diff --git a/src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl b/src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl index 84b6d33ed..49d503b5e 100644 --- a/src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl +++ b/src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl @@ -64,7 +64,7 @@ import OceanBioME: maximum_sinking_velocity import Adapt: adapt_structure, adapt import Base: show, summary -import OceanBioME.Boundaries.Sediments: nitrogen_flux, carbon_flux, remineralisation_receiver, sinking_tracers +import OceanBioME.Boundaries.Sediments: nitrogen_flux, carbon_flux, iron_flux, oxygen_flux, poc_flux, remineralisation_receiver, sinking_tracers struct LOBSTER{FT, B, W} <: AbstractContinuousFormBiogeochemistry phytoplankton_preference :: FT diff --git a/test/test_IronPhos.jl b/test/test_IronPhos.jl index a2fc8934e..2127d9577 100644 --- a/test/test_IronPhos.jl +++ b/test/test_IronPhos.jl @@ -25,15 +25,6 @@ function set_defaults!(sediment::SimpleMultiG) set!(sediment.fields.C_slow, 0.1677) end -set_defaults!(::InstantRemineralisation) = nothing - -set_defaults!(::LOBSTER, model) = - set!(model, P = 0.4686, Z = 0.5363, - NO₃ = 2.3103, NH₄ = 0.0010, - DOM = 0.8115, - sPOM = 0.2299, bPOM = 0.0103) - - set_defaults!(::VariableRedfieldLobster, model) = set!(model, P = 0.4686, Z = 0.5363, NO₃ = 2.3103, NH₄ = 0.0010, @@ -43,48 +34,34 @@ set_defaults!(::VariableRedfieldLobster, model) = sPON = 0.2299, sPOC = 1.5080, bPON = 0.0103, bPOC = 0.0781) +#total_nitrogen(sed::SimpleMultiG) = sum(sed.fields.N_fast) + +# sum(sed.fields.N_slow) + +# sum(sed.fields.N_ref) -set_defaults!(::NutrientPhytoplanktonZooplanktonDetritus, model) = set!(model, N = 2.3, P = 0.4, Z = 0.5, D = 0.2) - -total_nitrogen(sed::SimpleMultiG) = sum(sed.fields.N_fast) + - sum(sed.fields.N_slow) + - sum(sed.fields.N_ref) - -total_nitrogen(sed::InstantRemineralisation) = sum(sed.fields.N_storage) - -total_nitrogen(::LOBSTER, model) = sum(model.tracers.NO₃) + - sum(model.tracers.NH₄) + - sum(model.tracers.P) + - sum(model.tracers.Z) + - sum(model.tracers.DOM) + - sum(model.tracers.sPOM) + - sum(model.tracers.bPOM) - -total_nitrogen(::VariableRedfieldLobster, model) = sum(model.tracers.NO₃) + - sum(model.tracers.NH₄) + - sum(model.tracers.P) + - sum(model.tracers.Z) + - sum(model.tracers.DON) + - sum(model.tracers.sPON) + - sum(model.tracers.bPON) - -total_nitrogen(::NutrientPhytoplanktonZooplanktonDetritus, model) = sum(model.tracers.N) + - sum(model.tracers.P) + - sum(model.tracers.Z) + - sum(model.tracers.D) - -function test_flat_sediment(grid, biogeochemistry, model; timestepper = :QuasiAdamsBashforth2) - model = isa(model, NonhydrostaticModel) ? model(; grid, - biogeochemistry, - closure = nothing, - timestepper, - buoyancy = nothing) : - model(; grid, - biogeochemistry, - closure = nothing, - buoyancy = nothing, - tracers = nothing) +#total_nitrogen(::VariableRedfieldLobster, model) = sum(model.tracers.NO₃) + +# sum(model.tracers.NH₄) + +# sum(model.tracers.P) + +# sum(model.tracers.Z) + +# sum(model.tracers.DON) + +# sum(model.tracers.sPON) + +# sum(model.tracers.bPON) +function test_flat_sediment(timestepper = :QuasiAdamsBashforth2) + + grid = RectilinearGrid(architecture; size=(3, 3, 50), extent=(10, 10, 500)) + sediment_model = IronPhosphate(; grid) + biogeochemistry = LOBSTER(; grid, + carbonates = true, + oxygen = true, + variable_redfield = true, + sediment_model) + model = NonhydrostaticModel + + model = model(; grid, + biogeochemistry, + closure = nothing, + timestepper, + buoyancy = nothing) set_defaults!(model.biogeochemistry.sediment) set_defaults!(biogeochemistry.underlying_biogeochemistry, model) @@ -95,51 +72,33 @@ function test_flat_sediment(grid, biogeochemistry, model; timestepper = :QuasiAd simulation.callbacks[:intercept_tendencies] = Callback(intercept_tracer_tendencies!; callsite = TendencyCallsite(), parameters = intercepted_tendencies) - N₀ = CUDA.@allowscalar total_nitrogen(biogeochemistry.underlying_biogeochemistry, model) * volume(1, 1, 1, grid, Center(), Center(), Center()) + total_nitrogen(biogeochemistry.sediment) * Azᶠᶜᶜ(1, 1, 1, grid) + #N₀ = CUDA.@allowscalar total_nitrogen(biogeochemistry.underlying_biogeochemistry, model) * volume(1, 1, 1, grid, Center(), Center(), Center()) + total_nitrogen(biogeochemistry.sediment) * Azᶠᶜᶜ(1, 1, 1, grid) run!(simulation) # the model is changing the tracer tendencies - @test any([any(intercepted_tendencies[idx] .!= Array(interior(model.timestepper.Gⁿ[tracer]))) for (idx, tracer) in enumerate(keys(model.tracers))]) + #@test any([any(intercepted_tendencies[idx] .!= Array(interior(model.timestepper.Gⁿ[tracer]))) for (idx, tracer) in enumerate(keys(model.tracers))]) # the sediment tendencies are being updated - @test all([any(Array(interior(tend)) .!= 0.0) for tend in model.biogeochemistry.sediment.tendencies.Gⁿ]) - @test all([any(Array(interior(tend)) .!= 0.0) for tend in model.biogeochemistry.sediment.tendencies.G⁻]) + #@test all([any(Array(interior(tend)) .!= 0.0) for tend in model.biogeochemistry.sediment.tendencies.Gⁿ]) + #@test all([any(Array(interior(tend)) .!= 0.0) for tend in model.biogeochemistry.sediment.tendencies.G⁻]) # the sediment values are being integrated - initial_values = (N_fast = 0.0230, N_slow = 0.0807, C_fast = 0.5893, C_slow = 0.1677, N_ref = 0.0, C_ref = 0.0, N_storage = 0.0) - @test all([any(Array(interior(field)) .!= initial_values[name]) for (name, field) in pairs(model.biogeochemistry.sediment.fields)]) + #initial_values = (N_fast = 0.0230, N_slow = 0.0807, C_fast = 0.5893, C_slow = 0.1677, N_ref = 0.0, C_ref = 0.0, N_storage = 0.0) + #@test all([any(Array(interior(field)) .!= initial_values[name]) for (name, field) in pairs(model.biogeochemistry.sediment.fields)]) - N₁ = CUDA.@allowscalar total_nitrogen(biogeochemistry.underlying_biogeochemistry, model) * volume(1, 1, 1, grid, Center(), Center(), Center()) + total_nitrogen(biogeochemistry.sediment) * Azᶠᶜᶜ(1, 1, 1, grid) + #N₁ = CUDA.@allowscalar total_nitrogen(biogeochemistry.underlying_biogeochemistry, model) * volume(1, 1, 1, grid, Center(), Center(), Center()) + total_nitrogen(biogeochemistry.sediment) * Azᶠᶜᶜ(1, 1, 1, grid) # conservations - rtol = ifelse(isa(architecture, CPU), max(√eps(N₀), √eps(N₁)), 5e-7) - @test isapprox(N₀, N₁; rtol) + # rtol = ifelse(isa(architecture, CPU), max(√eps(N₀), √eps(N₁)), 5e-7) + #@test isapprox(N₀, N₁; rtol) return nothing end -display_name(::LOBSTER) = "LOBSTER" -display_name(::NutrientPhytoplanktonZooplanktonDetritus) = "NPZD" -display_name(::SimpleMultiG) = "Multi-G" -display_name(::InstantRemineralisation) = "Instant remineralisation" -display_name(::RectilinearGrid) = "Rectilinear grid" -display_name(::LatitudeLongitudeGrid) = "Latitude longitude grid" -display_name(::ImmersedBoundaryGrid) = "Immersed boundary grid" - bottom_height(x, y) = -1000 + 500 * exp(- (x^2 + y^2) / 250) # a perfect hill @testset "Sediment integration" begin - grid = RectilinearGrid(architecture; size=(3, 3, 50), extent=(10, 10, 500)) - sediment_model in (IronPhosphate(; grid)), - biogeochemistry = LOBSTER(; grid, - carbonates = true, - oxygen = true, - variable_redfield = true, - sediment_model) - - test_flat_sediment(grid, biogeochemistry, NonhydrostaticModel; :RungeKutta3) - - + test_flat_sediment(:RungeKutta3) end From 8f5ee587d9efaa12c17c8684a6149022b2a088c5 Mon Sep 17 00:00:00 2001 From: louis Date: Tue, 16 Jul 2024 13:42:24 +0100 Subject: [PATCH 13/27] it broken --- test/test_IronPhos.jl | 41 +++++++++++------------------------------ 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/test/test_IronPhos.jl b/test/test_IronPhos.jl index 2127d9577..e3ef848b6 100644 --- a/test/test_IronPhos.jl +++ b/test/test_IronPhos.jl @@ -17,12 +17,12 @@ function intercept_tracer_tendencies!(model, intercepted_tendencies) end end -function set_defaults!(sediment::SimpleMultiG) - set!(sediment.fields.N_fast, 0.0230) - set!(sediment.fields.N_slow, 0.0807) +function set_defaults!(sediment::IronPhosphate) + #set!(sediment.fields.N_fast, 0.0230) + #set!(sediment.fields.N_slow, 0.0807) - set!(sediment.fields.C_fast, 0.5893) - set!(sediment.fields.C_slow, 0.1677) + #set!(sediment.fields.C_fast, 0.5893) + #set!(sediment.fields.C_slow, 0.1677) end set_defaults!(::VariableRedfieldLobster, model) = @@ -55,16 +55,16 @@ function test_flat_sediment(timestepper = :QuasiAdamsBashforth2) oxygen = true, variable_redfield = true, sediment_model) - model = NonhydrostaticModel - - model = model(; grid, + + model = NonhydrostaticModel(; grid, biogeochemistry, closure = nothing, - timestepper, + :RungeKutta3, buoyancy = nothing) - set_defaults!(model.biogeochemistry.sediment) + # set_defaults!(model.biogeochemistry.sediment) - set_defaults!(biogeochemistry.underlying_biogeochemistry, model) + # set_defaults!(biogeochemistry.underlying_biogeochemistry, model) + println("test") simulation = Simulation(model, Δt = 50, stop_time = 1day) @@ -72,27 +72,8 @@ function test_flat_sediment(timestepper = :QuasiAdamsBashforth2) simulation.callbacks[:intercept_tendencies] = Callback(intercept_tracer_tendencies!; callsite = TendencyCallsite(), parameters = intercepted_tendencies) - #N₀ = CUDA.@allowscalar total_nitrogen(biogeochemistry.underlying_biogeochemistry, model) * volume(1, 1, 1, grid, Center(), Center(), Center()) + total_nitrogen(biogeochemistry.sediment) * Azᶠᶜᶜ(1, 1, 1, grid) - run!(simulation) - # the model is changing the tracer tendencies - #@test any([any(intercepted_tendencies[idx] .!= Array(interior(model.timestepper.Gⁿ[tracer]))) for (idx, tracer) in enumerate(keys(model.tracers))]) - - # the sediment tendencies are being updated - #@test all([any(Array(interior(tend)) .!= 0.0) for tend in model.biogeochemistry.sediment.tendencies.Gⁿ]) - #@test all([any(Array(interior(tend)) .!= 0.0) for tend in model.biogeochemistry.sediment.tendencies.G⁻]) - - # the sediment values are being integrated - #initial_values = (N_fast = 0.0230, N_slow = 0.0807, C_fast = 0.5893, C_slow = 0.1677, N_ref = 0.0, C_ref = 0.0, N_storage = 0.0) - #@test all([any(Array(interior(field)) .!= initial_values[name]) for (name, field) in pairs(model.biogeochemistry.sediment.fields)]) - - #N₁ = CUDA.@allowscalar total_nitrogen(biogeochemistry.underlying_biogeochemistry, model) * volume(1, 1, 1, grid, Center(), Center(), Center()) + total_nitrogen(biogeochemistry.sediment) * Azᶠᶜᶜ(1, 1, 1, grid) - - # conservations - # rtol = ifelse(isa(architecture, CPU), max(√eps(N₀), √eps(N₁)), 5e-7) - #@test isapprox(N₀, N₁; rtol) - return nothing end From 79c04835bc0b2a89facf8594a330a02845704b4d Mon Sep 17 00:00:00 2001 From: louis Date: Tue, 16 Jul 2024 13:43:56 +0100 Subject: [PATCH 14/27] it brokey --- test/test_IronPhos.jl | 53 ++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/test/test_IronPhos.jl b/test/test_IronPhos.jl index e3ef848b6..d7fe7b5c0 100644 --- a/test/test_IronPhos.jl +++ b/test/test_IronPhos.jl @@ -46,40 +46,31 @@ set_defaults!(::VariableRedfieldLobster, model) = # sum(model.tracers.sPON) + # sum(model.tracers.bPON) -function test_flat_sediment(timestepper = :QuasiAdamsBashforth2) - - grid = RectilinearGrid(architecture; size=(3, 3, 50), extent=(10, 10, 500)) - sediment_model = IronPhosphate(; grid) - biogeochemistry = LOBSTER(; grid, - carbonates = true, - oxygen = true, - variable_redfield = true, - sediment_model) - - model = NonhydrostaticModel(; grid, - biogeochemistry, - closure = nothing, - :RungeKutta3, - buoyancy = nothing) - # set_defaults!(model.biogeochemistry.sediment) - - # set_defaults!(biogeochemistry.underlying_biogeochemistry, model) - println("test") - - simulation = Simulation(model, Δt = 50, stop_time = 1day) - - intercepted_tendencies = Tuple(Array(interior(field)) for field in values(TracerFields(keys(model.tracers), grid))) +bottom_height(x, y) = -1000 + 500 * exp(- (x^2 + y^2) / 250) # a perfect hill - simulation.callbacks[:intercept_tendencies] = Callback(intercept_tracer_tendencies!; callsite = TendencyCallsite(), parameters = intercepted_tendencies) +grid = RectilinearGrid(architecture; size=(3, 3, 50), extent=(10, 10, 500)) +sediment_model = IronPhosphate(; grid) +biogeochemistry = LOBSTER(; grid, + carbonates = true, + oxygen = true, + variable_redfield = true, + sediment_model) + +model = NonhydrostaticModel(; grid, + biogeochemistry, + closure = nothing, + timestepper = :RungeKutta3, + buoyancy = nothing) +# set_defaults!(model.biogeochemistry.sediment) - run!(simulation) +# set_defaults!(biogeochemistry.underlying_biogeochemistry, model) + println("test") - return nothing -end +simulation = Simulation(model, Δt = 50, stop_time = 1day) +intercepted_tendencies = Tuple(Array(interior(field)) for field in values(TracerFields(keys(model.tracers), grid))) -bottom_height(x, y) = -1000 + 500 * exp(- (x^2 + y^2) / 250) # a perfect hill +simulation.callbacks[:intercept_tendencies] = Callback(intercept_tracer_tendencies!; callsite = TendencyCallsite(), parameters = intercepted_tendencies) -@testset "Sediment integration" begin - test_flat_sediment(:RungeKutta3) -end +run!(simulation +) \ No newline at end of file From 299079358e5f653f89607f725d728a200098ca78 Mon Sep 17 00:00:00 2001 From: louis Date: Tue, 16 Jul 2024 14:27:17 +0100 Subject: [PATCH 15/27] kind of less broken --- Manifest.toml | 91 +++++++++++++++-------- Project.toml | 1 + src/Boundaries/Sediments/IronPhosphate.jl | 4 +- test/test_IronPhos.jl | 2 +- 4 files changed, 63 insertions(+), 35 deletions(-) diff --git a/Manifest.toml b/Manifest.toml index 6d2bfbfbc..c8dd6af60 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -2,7 +2,7 @@ julia_version = "1.10.4" manifest_format = "2.0" -project_hash = "d1e46ace99d85a0b6e3708b6e3a131b205012458" +project_hash = "4cb225b69286ccd00493e4a72c2e50d217baf2e4" [[deps.ANSIColoredPrinters]] git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c" @@ -74,9 +74,9 @@ version = "1.1.1" [[deps.ArrayInterface]] deps = ["Adapt", "LinearAlgebra", "SparseArrays", "SuiteSparse"] -git-tree-sha1 = "ed2ec3c9b483842ae59cd273834e5b46206d6dda" +git-tree-sha1 = "5c9b74c973181571deb6442d41e5c902e6b9f38e" uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" -version = "7.11.0" +version = "7.12.0" [deps.ArrayInterface.extensions] ArrayInterfaceBandedMatricesExt = "BandedMatrices" @@ -111,9 +111,9 @@ version = "0.1.0" [[deps.Automa]] deps = ["PrecompileTools", "TranscodingStreams"] -git-tree-sha1 = "588e0d680ad1d7201d4c6a804dcb1cd9cba79fbb" +git-tree-sha1 = "014bc22d6c400a7703c0f5dc1fdc302440cf88be" uuid = "67c07d97-cdcb-5c2c-af73-a7f9c32a568b" -version = "1.0.3" +version = "1.0.4" [[deps.AxisAlgorithms]] deps = ["LinearAlgebra", "Random", "SparseArrays", "WoodburyMatrices"] @@ -192,9 +192,9 @@ version = "5.4.2" [[deps.CUDA_Driver_jll]] deps = ["Artifacts", "JLLWrappers", "LazyArtifacts", "Libdl", "Pkg"] -git-tree-sha1 = "c48f9da18efd43b6b7adb7ee1f93fe5f2926c339" +git-tree-sha1 = "97df9d4d6be8ac6270cb8fd3b8fc413690820cbd" uuid = "4ee394cb-3365-5eb0-8335-949819d2adfc" -version = "0.9.0+0" +version = "0.9.1+1" [[deps.CUDA_Runtime_Discovery]] deps = ["Libdl"] @@ -204,9 +204,9 @@ version = "0.3.4" [[deps.CUDA_Runtime_jll]] deps = ["Artifacts", "CUDA_Driver_jll", "JLLWrappers", "LazyArtifacts", "Libdl", "TOML"] -git-tree-sha1 = "bcba305388e16aa5c879e896726db9e71b4942c6" +git-tree-sha1 = "afea94249b821dc754a8ca6695d3daed851e1f5a" uuid = "76a88914-d11a-5bdc-97e0-2f5a05c973a2" -version = "0.14.0+1" +version = "0.14.1+0" [[deps.Cairo]] deps = ["Cairo_jll", "Colors", "Glib_jll", "Graphics", "Libdl", "Pango_jll"] @@ -244,9 +244,9 @@ weakdeps = ["SparseArrays"] [[deps.CodecZlib]] deps = ["TranscodingStreams", "Zlib_jll"] -git-tree-sha1 = "59939d8a997469ee05c4b4944560a820f9ba0d73" +git-tree-sha1 = "b8fe8546d52ca154ac556809e10c75e6e7430ac8" uuid = "944b1d66-785c-5afd-91f1-9de20f533193" -version = "0.7.4" +version = "0.7.5" [[deps.ColorBrewer]] deps = ["Colors", "JSON", "Test"] @@ -377,9 +377,9 @@ uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" [[deps.DelaunayTriangulation]] deps = ["EnumX", "ExactPredicates", "Random"] -git-tree-sha1 = "1755070db557ec2c37df2664c75600298b0c1cfc" +git-tree-sha1 = "078c716cbb032242df18b960e8b1fec6b1b0b9f9" uuid = "927a84f5-c5f4-47a5-9785-b46e178433df" -version = "1.0.3" +version = "1.0.5" [[deps.DiskArrays]] deps = ["LRUCache", "OffsetArrays"] @@ -547,6 +547,12 @@ git-tree-sha1 = "05882d6995ae5c12bb5f36dd2ed3f61c98cbb172" uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93" version = "0.8.5" +[[deps.FoldingTrees]] +deps = ["AbstractTrees", "REPL"] +git-tree-sha1 = "d94efd85f2fe192cdf664aa8b7c431592faed59e" +uuid = "1eca21be-9b9b-4ed8-839a-6d8ae26b1781" +version = "1.2.1" + [[deps.Fontconfig_jll]] deps = ["Artifacts", "Bzip2_jll", "Expat_jll", "FreeType2_jll", "JLLWrappers", "Libdl", "Libuuid_jll", "Zlib_jll"] git-tree-sha1 = "db16beca600632c95fc8aca29890d83788dd8b23" @@ -593,9 +599,9 @@ version = "6.2.1+6" [[deps.GPUArrays]] deps = ["Adapt", "GPUArraysCore", "LLVM", "LinearAlgebra", "Printf", "Random", "Reexport", "Serialization", "Statistics"] -git-tree-sha1 = "5c9de6d5af87acd2cf719e214ed7d51e14017b7a" +git-tree-sha1 = "04661708f5301394a1f1be86a07a89e835900db6" uuid = "0c68f7d7-f131-5f86-a1c3-88cf8149b2d7" -version = "10.2.2" +version = "10.2.3" [[deps.GPUArraysCore]] deps = ["Adapt"] @@ -767,22 +773,43 @@ uuid = "d25df0c9-e2be-5dd7-82c8-3ad0b3e990b9" version = "0.1.5" [[deps.InlineStrings]] -deps = ["Parsers"] -git-tree-sha1 = "86356004f30f8e737eff143d57d41bd580e437aa" +git-tree-sha1 = "45521d31238e87ee9f9732561bfee12d4eebd52d" uuid = "842dd82b-1e85-43dc-bf29-5d0ee9dffc48" -version = "1.4.1" +version = "1.4.2" [deps.InlineStrings.extensions] ArrowTypesExt = "ArrowTypes" + ParsersExt = "Parsers" [deps.InlineStrings.weakdeps] ArrowTypes = "31f734f8-188a-4ce0-8406-c8a06bd891cd" + Parsers = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" [[deps.IntelOpenMP_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] -git-tree-sha1 = "be50fe8df3acbffa0274a744f1a99d29c45a57f4" +git-tree-sha1 = "14eb2b542e748570b56446f4c50fbfb2306ebc45" uuid = "1d5cc7b8-4909-519e-a0f8-d0f5ad9712d0" -version = "2024.1.0+0" +version = "2024.2.0+0" + +[[deps.InteractiveErrors]] +deps = ["FoldingTrees", "InteractiveUtils", "IterTools", "PackageExtensionCompat", "PrecompileTools", "REPL"] +git-tree-sha1 = "5ed2f06644b4cdc96f25b2f8527cebde1ec77506" +uuid = "6cff3a6f-7015-4b3b-b269-4b312a73b9bf" +version = "1.0.1" + + [deps.InteractiveErrors.extensions] + InteractiveErrorsCthulhuExt = "Cthulhu" + InteractiveErrorsDebuggerExt = "Debugger" + InteractiveErrorsJETExt = "JET" + InteractiveErrorsJuliaFormatterExt = "JuliaFormatter" + InteractiveErrorsOhMyREPLExt = "OhMyREPL" + + [deps.InteractiveErrors.weakdeps] + Cthulhu = "f68482b8-f384-11e8-15f7-abe071a5a75f" + Debugger = "31a5f54b-26ea-5ae9-a837-f05ce5417438" + JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" + JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899" + OhMyREPL = "5fb14364-9ced-5910-84b2-373655c76a03" [[deps.InteractiveUtils]] deps = ["Markdown"] @@ -1084,9 +1111,9 @@ version = "1.9.4+0" [[deps.MKL_jll]] deps = ["Artifacts", "IntelOpenMP_jll", "JLLWrappers", "LazyArtifacts", "Libdl", "oneTBB_jll"] -git-tree-sha1 = "80b2833b56d466b3858d565adcd16a4a05f2089b" +git-tree-sha1 = "f046ccd0c6db2832a9f639e2c669c6fe867e5f4f" uuid = "856f044c-d86e-5d09-b602-aeab76dc8ba7" -version = "2024.1.0+0" +version = "2024.2.0+0" [[deps.MPI]] deps = ["Distributed", "DocStringExtensions", "Libdl", "MPICH_jll", "MPIPreferences", "MPItrampoline_jll", "MicrosoftMPI_jll", "OpenMPI_jll", "PkgVersion", "PrecompileTools", "Requires", "Serialization", "Sockets"] @@ -1253,9 +1280,9 @@ version = "0.91.3" Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9" [[deps.OffsetArrays]] -git-tree-sha1 = "e64b4f5ea6b7389f6f046d13d4896a8f9c1ba71e" +git-tree-sha1 = "1a27764e945a152f7ca7efa04de513d473e9542e" uuid = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" -version = "1.14.0" +version = "1.14.1" weakdeps = ["Adapt"] [deps.OffsetArrays.extensions] @@ -1457,9 +1484,9 @@ version = "1.5.1" [[deps.ProgressMeter]] deps = ["Distributed", "Printf"] -git-tree-sha1 = "763a8ceb07833dd51bb9e3bbca372de32c0605ad" +git-tree-sha1 = "80686d28ecb3ee7fb3ac5371cacaa0d673eb0d4a" uuid = "92933f4c-e287-5a05-a399-4b506db050ca" -version = "1.10.0" +version = "1.10.1" [[deps.PtrArrays]] git-tree-sha1 = "f011fbb92c4d401059b2212c05c0601b70f8b759" @@ -1622,9 +1649,9 @@ version = "0.3.4" [[deps.SentinelArrays]] deps = ["Dates", "Random"] -git-tree-sha1 = "90b4f68892337554d31cdcdbe19e48989f26c7e6" +git-tree-sha1 = "ff11acffdb082493657550959d4feb4b6149e73a" uuid = "91c51154-3ec4-41a3-a24f-3f23e20d615c" -version = "1.4.3" +version = "1.4.5" [[deps.Serialization]] uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" @@ -1700,9 +1727,9 @@ version = "0.1.1" [[deps.Static]] deps = ["CommonWorldInvalidations", "IfElse", "PrecompileTools"] -git-tree-sha1 = "0bbff21027dd8a107551847528127b62a35f7594" +git-tree-sha1 = "87d51a3ee9a4b0d2fe054bdd3fc2436258db2603" uuid = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" -version = "1.1.0" +version = "1.1.1" [[deps.StaticArrayInterface]] deps = ["ArrayInterface", "Compat", "IfElse", "LinearAlgebra", "PrecompileTools", "Requires", "SparseArrays", "Static", "SuiteSparse"] @@ -1717,9 +1744,9 @@ weakdeps = ["OffsetArrays", "StaticArrays"] [[deps.StaticArrays]] deps = ["LinearAlgebra", "PrecompileTools", "Random", "StaticArraysCore"] -git-tree-sha1 = "20833c5b7f7edf0e5026f23db7f268e4f23ec577" +git-tree-sha1 = "eeafab08ae20c62c44c8399ccb9354a04b80db50" uuid = "90137ffa-7385-5640-81b9-e52037218182" -version = "1.9.6" +version = "1.9.7" weakdeps = ["ChainRulesCore", "Statistics"] [deps.StaticArrays.extensions] diff --git a/Project.toml b/Project.toml index 68b20d575..7178318d8 100644 --- a/Project.toml +++ b/Project.toml @@ -8,6 +8,7 @@ Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +InteractiveErrors = "6cff3a6f-7015-4b3b-b269-4b312a73b9bf" JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c" Oceananigans = "9e8cae18-63c1-5223-a75c-80ca9d6e9a09" diff --git a/src/Boundaries/Sediments/IronPhosphate.jl b/src/Boundaries/Sediments/IronPhosphate.jl index ee453b4d7..3bafb888a 100644 --- a/src/Boundaries/Sediments/IronPhosphate.jl +++ b/src/Boundaries/Sediments/IronPhosphate.jl @@ -161,8 +161,8 @@ sediment_fields(model::IronPhosphate) = (O2 = model.fields.O2, TCO2 = model.fields.TCO2, Gi = model.fields.Gi) -@inline required_tracers(::IronPhosphate, bgc, tracers) = tracers[(sinking_tracers(bgc)...)] -@inline required_tendencies(::IronPhosphate, bgc, tracers) = tracers[] # TODO add effluxes of PO4 and Fe once PISCES is working +@inline required_tracers(::IronPhosphate, bgc, tracers) = tracers[(:NO₃, :NH₄, :O₂, :DIC, sinking_tracers(bgc)...)] # need :Gi, :FeOHP +@inline required_tendencies(::IronPhosphate, bgc, tracers) = tracers[(:NO₃, :NH₄, :O₂, :DIC)] # TODO add effluxes of PO4 and Fe once PISCES is working @inline bottom_index_array(sediment::IronPhosphate) = sediment.bottom_indices diff --git a/test/test_IronPhos.jl b/test/test_IronPhos.jl index d7fe7b5c0..b08ab0115 100644 --- a/test/test_IronPhos.jl +++ b/test/test_IronPhos.jl @@ -69,7 +69,7 @@ model = NonhydrostaticModel(; grid, simulation = Simulation(model, Δt = 50, stop_time = 1day) intercepted_tendencies = Tuple(Array(interior(field)) for field in values(TracerFields(keys(model.tracers), grid))) - +POC simulation.callbacks[:intercept_tendencies] = Callback(intercept_tracer_tendencies!; callsite = TendencyCallsite(), parameters = intercepted_tendencies) run!(simulation From 3301173d81cbeb40ada6e04b01ad79baf59d9c3d Mon Sep 17 00:00:00 2001 From: louis Date: Tue, 16 Jul 2024 15:16:01 +0100 Subject: [PATCH 16/27] it works? --- src/Boundaries/Sediments/IronPhosphate.jl | 58 +++++++++---------- .../AdvectedPopulations/LOBSTER/LOBSTER.jl | 12 ---- test/test_IronPhos.jl | 33 +++++++---- 3 files changed, 52 insertions(+), 51 deletions(-) diff --git a/src/Boundaries/Sediments/IronPhosphate.jl b/src/Boundaries/Sediments/IronPhosphate.jl index 3bafb888a..3666cb371 100644 --- a/src/Boundaries/Sediments/IronPhosphate.jl +++ b/src/Boundaries/Sediments/IronPhosphate.jl @@ -146,19 +146,19 @@ adapt_structure(to, sediment::IronPhosphate) = adapt(to, sediment.bottom_indices)) sediment_tracers(::IronPhosphate) = (:O₂, :NH₄, :NO₃, :NO₂, :N₂, :TPO₄, :FeOHP, :Feᴵᴵ, :FeS₂, :SO₄, :TH₂S, :CH₄, :TCO₂, :Gi) -sediment_fields(model::IronPhosphate) = (O2 = model.fields.O2, - NH4 = model.fields.NH4, - NO3 = model.fields.NO3, - NO2 = model.fields.NO2, - N2 = model.fields.N2, - TPO4 = model.fields.TPO4, +sediment_fields(model::IronPhosphate) = (O₂ = model.fields.O₂, + NH₄ = model.fields.NH₄, + NO₃ = model.fields.NO₃, + NO₂ = model.fields.NO₂, + N₂ = model.fields.N₂, + TPO₄ = model.fields.TPO₄, FeOHP = model.fields.FeOHP, - FeII = model.fields.FeII, - FeS2 = model.fields.FeS2, - SO4 = model.fields.SO4, - TH2S = model.fields.TH2S, - CH4 = model.fields.CH4, - TCO2 = model.fields.TCO2, + Feᴵᴵ = model.fields.Feᴵᴵ, + FeS₂ = model.fields.FeS₂, + SO₄ = model.fields.SO₄, + TH₂S = model.fields.TH₂S, + CH₄ = model.fields.CH₄, + TCO₂ = model.fields.TCO₂, Gi = model.fields.Gi) @inline required_tracers(::IronPhosphate, bgc, tracers) = tracers[(:NO₃, :NH₄, :O₂, :DIC, sinking_tracers(bgc)...)] # need :Gi, :FeOHP @@ -173,11 +173,11 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri Δz = zspacing(i, j, k, grid, Center(), Center(), Center()) @inbounds begin - oxygen_deposition = oxygen_flux(i, j, k, grid, advection, bgc, tracers) * Δz + oxygen_deposition = 0 #oxygen_flux(i, j, k, grid, advection, bgc, tracers) * Δz - POC_deposition = poc_flux(i, j, k, grid, advection, bgc, tracers) * Δz + POC_deposition = carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz - iron_deposition = iron_flux(i, j, k, grid, advection, bgc, tracers) * Δz + iron_deposition = carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz * (1/106) * 0.1 #(:O₂, :NH₄, :NO₃, :NO₂, :N₂, :TPO₄, :FeOHP, :Feᴵᴵ, :FeS₂, :SO₄, :TH₂S, :CH₄, :TCO₂, :Gi) O₂ = sediment.fields.O₂[i, j, 1] @@ -254,20 +254,20 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri ##### sediment evolution ##### - sediment_tendencies.Gi = POC_deposition - RO₂ - RNO₃ - RNO₂ - RFe - RSO₄ - RCH₄ - sediment_tendencies.O₂ = oxygen_deposition - RO₂ - 1.5 * R_NH4ox - 0.5 * R_NO2ox - 2 * R_H2Sox - 0.25 * R_Fe2ox - 3.5 * R_FeS2ox - sediment_tendencies.TCO₂ = RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄ + R_AOM - sediment_tendencies.NH₄ = ratio_NC * (RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄) + R_DNRA - R_amx - R_NH4ox - sediment_tendencies.NO₃ = -2 * RNO₃ - R_DNRA + R_NO2ox - sediment_tendencies.NO₂ = 2 * RNO₃ - 1.33 * RNO₂ - R_amx + R_NH4ox - R_NO2ox - sediment_tendencies.N₂ = R_amx + 0.66 * RNO₂ - sediment_tendencies.TPO₄ = ratio_PC * (RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄) + RFe * ratio_FeP - ratio_FeP * R_Fe2ox * fₖ₋ₜₚₒ₄ + ratio_FeP * R_Fe3red - sediment_tendencies.FeOHP = iron_deposition - 4 * RFe + R_Fe2ox - R_Fe3red - sediment_tendencies.Feᴵᴵ = 4 * RFe - R_Fe2ox + R_FeS2ox - R_FeS2p + R_Fe3red - sediment_tendencies.FeS₂ = R_FeS2p - R_FeS2ox - sediment_tendencies.SO₄ = -0.5 * RSO₄ + R_DNRA - R_AOM + R_H2Sox + 2 * R_FeS2ox + (R_Fe3red / 8) - sediment_tendencies.TH₂S = 0.5 * RSO₄ - R_DNRA + R_AOM - R_H2Sox - 2 * R_FeS2p - (R_Fe3red / 8) - sediment_tendencies.CH₄ = 0.5 * RCH₄ - R_AOM + sediment_tendencies.Gi[i, j, 1] = POC_deposition - RO₂ - RNO₃ - RNO₂ - RFe - RSO₄ - RCH₄ + sediment_tendencies.O₂[i, j, 1] = oxygen_deposition - RO₂ - 1.5 * R_NH4ox - 0.5 * R_NO2ox - 2 * R_H2Sox - 0.25 * R_Fe2ox - 3.5 * R_FeS2ox + sediment_tendencies.TCO₂[i, j, 1] = RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄ + R_AOM + sediment_tendencies.NH₄[i, j, 1] = ratio_NC * (RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄) + R_DNRA - R_amx - R_NH4ox + sediment_tendencies.NO₃[i, j, 1] = -2 * RNO₃ - R_DNRA + R_NO2ox + sediment_tendencies.NO₂[i, j, 1] = 2 * RNO₃ - 1.33 * RNO₂ - R_amx + R_NH4ox - R_NO2ox + sediment_tendencies.N₂[i, j, 1] = R_amx + 0.66 * RNO₂ + sediment_tendencies.TPO₄[i, j, 1] = ratio_PC * (RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄) + RFe * ratio_FeP - ratio_FeP * R_Fe2ox * fₖ₋ₜₚₒ₄ + ratio_FeP * R_Fe3red + sediment_tendencies.FeOHP[i, j, 1] = iron_deposition - 4 * RFe + R_Fe2ox - R_Fe3red + sediment_tendencies.Feᴵᴵ[i, j, 1] = 4 * RFe - R_Fe2ox + R_FeS2ox - R_FeS2p + R_Fe3red + sediment_tendencies.FeS₂[i, j, 1] = R_FeS2p - R_FeS2ox + sediment_tendencies.SO₄[i, j, 1] = -0.5 * RSO₄ + R_DNRA - R_AOM + R_H2Sox + 2 * R_FeS2ox + (R_Fe3red / 8) + sediment_tendencies.TH₂S[i, j, 1] = 0.5 * RSO₄ - R_DNRA + R_AOM - R_H2Sox - 2 * R_FeS2p - (R_Fe3red / 8) + sediment_tendencies.CH₄[i, j, 1] = 0.5 * RCH₄ - R_AOM end end diff --git a/src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl b/src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl index 49d503b5e..c4c605111 100644 --- a/src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl +++ b/src/Models/AdvectedPopulations/LOBSTER/LOBSTER.jl @@ -486,18 +486,6 @@ const VariableRedfieldLobster = Union{LOBSTER{<:Any, <:Val{(false, false, true)} sinking_flux(i, j, k, grid, advection, Val(:sPOC), bgc, tracers) + sinking_flux(i, j, k, grid, advection, Val(:bPOC), bgc, tracers) -@inline iron_flux(i, j, k, grid, advection, bgc::VariableRedfieldLobster, tracers) = - (sinking_flux(i, j, k, grid, advection, Val(:sPOC), bgc, tracers) + - sinking_flux(i, j, k, grid, advection, Val(:bPOC), bgc, tracers)) * (1/106) * 0.1 # molar ratio from Dale et al 2012, p. 633 - -@inline oxygen_flux(i, j, k, grid, advection, bgc::VariableRedfieldLobster, tracers) = - (sinking_flux(i, j, k, grid, advection, Val(:O2), bgc, tracers)) - -@inline poc_flux(i, j, k, grid, advection, bgc::VariableRedfieldLobster, tracers) = - (sinking_flux(i, j, k, grid, advection, Val(:sPOC), bgc, tracers) + - sinking_flux(i, j, k, grid, advection, Val(:bPOC), bgc, tracers)) - - @inline remineralisation_receiver(::LOBSTER) = :NH₄ diff --git a/test/test_IronPhos.jl b/test/test_IronPhos.jl index b08ab0115..ffb1cf35f 100644 --- a/test/test_IronPhos.jl +++ b/test/test_IronPhos.jl @@ -18,11 +18,20 @@ function intercept_tracer_tendencies!(model, intercepted_tendencies) end function set_defaults!(sediment::IronPhosphate) - #set!(sediment.fields.N_fast, 0.0230) - #set!(sediment.fields.N_slow, 0.0807) - - #set!(sediment.fields.C_fast, 0.5893) - #set!(sediment.fields.C_slow, 0.1677) + set!(sediment.fields.O₂, 0.5) + set!(sediment.fields.NH₄, 0.5) + set!(sediment.fields.NO₃, 0.5) + set!(sediment.fields.NO₂, 0.5) + set!(sediment.fields.N₂, 0.5) + set!(sediment.fields.TPO₄, 0.5) + set!(sediment.fields.FeOHP, 0.5) + set!(sediment.fields.Feᴵᴵ, 0.5) + set!(sediment.fields.FeS₂, 0.5) + set!(sediment.fields.SO₄, 0.5) + set!(sediment.fields.TH₂S, 0.5) + set!(sediment.fields.CH₄, 0.5) + set!(sediment.fields.TCO₂, 0.5) + set!(sediment.fields.Gi, 0.5) end set_defaults!(::VariableRedfieldLobster, model) = @@ -55,7 +64,8 @@ biogeochemistry = LOBSTER(; grid, oxygen = true, variable_redfield = true, sediment_model) - + + model = NonhydrostaticModel(; grid, biogeochemistry, closure = nothing, @@ -64,13 +74,16 @@ model = NonhydrostaticModel(; grid, # set_defaults!(model.biogeochemistry.sediment) # set_defaults!(biogeochemistry.underlying_biogeochemistry, model) - println("test") + +simulation.output_writers[:tracers] = JLD2OutputWriter(model, model.tracers, + filename = "temp_plotting_data.jld2", + schedule = TimeInterval(24minute), + overwrite_existing = true) simulation = Simulation(model, Δt = 50, stop_time = 1day) intercepted_tendencies = Tuple(Array(interior(field)) for field in values(TracerFields(keys(model.tracers), grid))) -POC + simulation.callbacks[:intercept_tendencies] = Callback(intercept_tracer_tendencies!; callsite = TendencyCallsite(), parameters = intercepted_tendencies) -run!(simulation -) \ No newline at end of file +run!(simulation) \ No newline at end of file From e39b7e65ba1a9f644c1e7e0c7d365039993bc22a Mon Sep 17 00:00:00 2001 From: louis Date: Tue, 16 Jul 2024 15:22:19 +0100 Subject: [PATCH 17/27] success message --- test/test_IronPhos.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/test_IronPhos.jl b/test/test_IronPhos.jl index ffb1cf35f..5a5583bc8 100644 --- a/test/test_IronPhos.jl +++ b/test/test_IronPhos.jl @@ -86,4 +86,6 @@ intercepted_tendencies = Tuple(Array(interior(field)) for field in values(Tracer simulation.callbacks[:intercept_tendencies] = Callback(intercept_tracer_tendencies!; callsite = TendencyCallsite(), parameters = intercepted_tendencies) -run!(simulation) \ No newline at end of file +run!(simulation) + +@info "Success!" \ No newline at end of file From 8380e9cbf5b40c7726938835efe933a2dd63f56e Mon Sep 17 00:00:00 2001 From: louis Date: Thu, 18 Jul 2024 10:34:32 +0100 Subject: [PATCH 18/27] tweaks --- test/test_IronPhos.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_IronPhos.jl b/test/test_IronPhos.jl index 5a5583bc8..f9405739a 100644 --- a/test/test_IronPhos.jl +++ b/test/test_IronPhos.jl @@ -75,13 +75,13 @@ model = NonhydrostaticModel(; grid, # set_defaults!(biogeochemistry.underlying_biogeochemistry, model) -simulation.output_writers[:tracers] = JLD2OutputWriter(model, model.tracers, +simulation = Simulation(model, Δt = 50, stop_time = 1day) + +simulation.output_writers[:tracers] = JLD2OutputWriter(model, model.biogeochemistry.sediment.tendencies.G⁻, filename = "temp_plotting_data.jld2", schedule = TimeInterval(24minute), overwrite_existing = true) -simulation = Simulation(model, Δt = 50, stop_time = 1day) - intercepted_tendencies = Tuple(Array(interior(field)) for field in values(TracerFields(keys(model.tracers), grid))) simulation.callbacks[:intercept_tendencies] = Callback(intercept_tracer_tendencies!; callsite = TendencyCallsite(), parameters = intercepted_tendencies) From 90aedaf0180696b25e7756616f1f0287b6715a8f Mon Sep 17 00:00:00 2001 From: louis Date: Fri, 19 Jul 2024 14:04:03 +0100 Subject: [PATCH 19/27] sediment works without exploding! --- src/Boundaries/Sediments/IronPhosphate.jl | 47 +++++++++++++---------- test/test_IronPhos.jl | 34 ++++++++-------- 2 files changed, 43 insertions(+), 38 deletions(-) diff --git a/src/Boundaries/Sediments/IronPhosphate.jl b/src/Boundaries/Sediments/IronPhosphate.jl index 3666cb371..a2937b340 100644 --- a/src/Boundaries/Sediments/IronPhosphate.jl +++ b/src/Boundaries/Sediments/IronPhosphate.jl @@ -84,10 +84,10 @@ julia> using OceanBioME, Oceananigans, OceanBioME.Sediments julia> grid = RectilinearGrid(size=(3, 3, 30), extent=(10, 10, 200)); -julia> sediment_model = SimpleMultiG(; grid) +julia> sediment_model = IronPhosphate(; grid) ┌ Warning: Sediment models are an experimental feature and have not yet been validated. └ @ OceanBioME.Boundaries.Sediments ~/OceanBioME.jl/src/Boundaries/Sediments/simple_multi_G.jl:102 -[ Info: This sediment model is currently only compatible with models providing NH₄, NO₃, O₂, and DIC. +[ Info: This sediment model is currently only compatible with models providing lots of different things. Single-layer multi-G + Iron + Phosphate sediment model (Float64) ``` """ @@ -175,9 +175,9 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri @inbounds begin oxygen_deposition = 0 #oxygen_flux(i, j, k, grid, advection, bgc, tracers) * Δz - POC_deposition = carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz + POC_deposition = 0#carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz - iron_deposition = carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz * (1/106) * 0.1 + iron_deposition = 0#carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz * (1/106) * 0.1 #(:O₂, :NH₄, :NO₃, :NO₂, :N₂, :TPO₄, :FeOHP, :Feᴵᴵ, :FeS₂, :SO₄, :TH₂S, :CH₄, :TCO₂, :Gi) O₂ = sediment.fields.O₂[i, j, 1] @@ -193,6 +193,10 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri CH₄ = sediment.fields.CH₄[i, j, 1] Gi = sediment.fields.Gi[i, j, 1] + #println(FeOHP + FeS₂ + Feᴵᴵ) # iron is conserved + #println(2*FeS₂+SO₄+TH₂S) # sulfur is conserved + println(TPO₄) + ##### ##### RATES ##### @@ -208,6 +212,7 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri @inline kGi = 0.016 # day⁻¹, Rate constant for G0 degradation, Dale et al @inline fT = 1 # TODO temperature correction for rates @inline fₒₓ = 10 # Enhancement factor for POM degradation by O2 + @inline per_day_to_per_seconds = 1 / (60 * 60 * 24) fₖ₋ₒ₂ = O₂ / (O₂ + K_O₂) # kinetic limiting term fₖ₋ₙₒ₃ = NO₃ / (NO₃ + K_NO₃) # kinetic limiting term @@ -216,12 +221,12 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri fₖ₋ₛₒ₄ = SO₄ / (SO₄ + K_SO₄) # kinetic limiting term fₖ₋ₜₚₒ₄ = TPO₄ / (TPO₄ + K_TPO₄) # kinetic limiting term - RO₂ = Gi * (fT * kGi * fₒₓ * fₖ₋ₒ₂) - RNO₃ = Gi * (fT * kGi * fₖ₋ₙₒ₃ * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₒ₂)) - RNO₂ = Gi * (fT * kGi * fₖ₋ₙₒ₂ * (1 - fₖ₋ₒ₂)) - RFe = Gi * (fT * kGi * fK_Fe * (1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₙₒ₂)) - RSO₄ = Gi * (fT * kGi * fₖ₋ₛₒ₄ * (1 - fK_Fe) *(1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₙₒ₂)) - RCH₄ = Gi * (fT * kGi * (1 - fₖ₋ₛₒ₄) * (1 - fK_Fe) *(1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂)) + RO₂ = Gi * (fT * kGi * fₒₓ * fₖ₋ₒ₂) * per_day_to_per_seconds + RNO₃ = Gi * (fT * kGi * fₖ₋ₙₒ₃ * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₒ₂)) * per_day_to_per_seconds + RNO₂ = Gi * (fT * kGi * fₖ₋ₙₒ₂ * (1 - fₖ₋ₒ₂)) * per_day_to_per_seconds + RFe = Gi * (fT * kGi * fK_Fe * (1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₙₒ₂)) * per_day_to_per_seconds + RSO₄ = Gi * (fT * kGi * fₖ₋ₛₒ₄ * (1 - fK_Fe) *(1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₙₒ₂)) * per_day_to_per_seconds + RCH₄ = Gi * (fT * kGi * (1 - fₖ₋ₛₒ₄) * (1 - fK_Fe) *(1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂)) * per_day_to_per_seconds @inline kDNRA = 2.7e5 # M-1 day-1 @@ -235,16 +240,16 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri @inline kFeS2p = 2.7e4 # M-1 day-1 @inline kFe3red = 0.82 # cm1.5 mmol−0.5 day−1 - R_DNRA = TH₂S * NO₃ * fT * kDNRA - R_amx = NH₄ * NO₂ * fT * kamx - R_NH4ox = NH₄ * O₂ * fT * kNH4ox - R_NO2ox = NO₂ * O₂ * fT * kNO2ox - R_AOM = CH₄ * SO₄ * fT * kAOM - R_H2Sox = TH₂S * O₂ * fT * kH2Sox - R_Fe2ox = Feᴵᴵ * O₂ * fT * kFe2ox - R_FeS2ox = FeS₂ * O₂ * fT * kFeS2ox - R_FeS2p = TH₂S * Feᴵᴵ * fT * kFeS2p # H2 should be produced here but I assume it dissociates... - R_Fe3red = TH₂S ^ 0.5 * FeOHP * fT * kFe3red * (2 / (O₂ + 2)) + R_DNRA = TH₂S * NO₃ * fT * kDNRA * per_day_to_per_seconds + R_amx = NH₄ * NO₂ * fT * kamx * per_day_to_per_seconds + R_NH4ox = NH₄ * O₂ * fT * kNH4ox * per_day_to_per_seconds + R_NO2ox = NO₂ * O₂ * fT * kNO2ox * per_day_to_per_seconds + R_AOM = CH₄ * SO₄ * fT * kAOM * per_day_to_per_seconds + R_H2Sox = TH₂S * O₂ * fT * kH2Sox * per_day_to_per_seconds + R_Fe2ox = Feᴵᴵ * O₂ * fT * kFe2ox * per_day_to_per_seconds + R_FeS2ox = FeS₂ * O₂ * fT * kFeS2ox * per_day_to_per_seconds + R_FeS2p = TH₂S * Feᴵᴵ * fT * kFeS2p * per_day_to_per_seconds # H2 should be produced here but I assume it dissociates... + R_Fe3red = max(0, TH₂S) ^ 0.5 * FeOHP * fT * kFe3red * (2 / (O₂ + 2)) @inline ratio_NC = 9.5/106 @inline ratio_PC = 1/106 @@ -261,7 +266,7 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri sediment_tendencies.NO₃[i, j, 1] = -2 * RNO₃ - R_DNRA + R_NO2ox sediment_tendencies.NO₂[i, j, 1] = 2 * RNO₃ - 1.33 * RNO₂ - R_amx + R_NH4ox - R_NO2ox sediment_tendencies.N₂[i, j, 1] = R_amx + 0.66 * RNO₂ - sediment_tendencies.TPO₄[i, j, 1] = ratio_PC * (RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄) + RFe * ratio_FeP - ratio_FeP * R_Fe2ox * fₖ₋ₜₚₒ₄ + ratio_FeP * R_Fe3red + sediment_tendencies.TPO₄[i, j, 1] = ratio_PC * (RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄) + RFe * ratio_FeP - ratio_FeP * R_Fe2ox * fₖ₋ₜₚₒ₄ + ratio_FeP * R_Fe3red # TODO P not conserved??? sediment_tendencies.FeOHP[i, j, 1] = iron_deposition - 4 * RFe + R_Fe2ox - R_Fe3red sediment_tendencies.Feᴵᴵ[i, j, 1] = 4 * RFe - R_Fe2ox + R_FeS2ox - R_FeS2p + R_Fe3red sediment_tendencies.FeS₂[i, j, 1] = R_FeS2p - R_FeS2ox diff --git a/test/test_IronPhos.jl b/test/test_IronPhos.jl index f9405739a..ffd21e62c 100644 --- a/test/test_IronPhos.jl +++ b/test/test_IronPhos.jl @@ -18,20 +18,20 @@ function intercept_tracer_tendencies!(model, intercepted_tendencies) end function set_defaults!(sediment::IronPhosphate) - set!(sediment.fields.O₂, 0.5) - set!(sediment.fields.NH₄, 0.5) - set!(sediment.fields.NO₃, 0.5) - set!(sediment.fields.NO₂, 0.5) - set!(sediment.fields.N₂, 0.5) - set!(sediment.fields.TPO₄, 0.5) - set!(sediment.fields.FeOHP, 0.5) - set!(sediment.fields.Feᴵᴵ, 0.5) - set!(sediment.fields.FeS₂, 0.5) - set!(sediment.fields.SO₄, 0.5) - set!(sediment.fields.TH₂S, 0.5) - set!(sediment.fields.CH₄, 0.5) - set!(sediment.fields.TCO₂, 0.5) - set!(sediment.fields.Gi, 0.5) + set!(sediment.fields.O₂, 0.00005) + set!(sediment.fields.NH₄, 0.00005) + set!(sediment.fields.NO₃, 0.00005) + set!(sediment.fields.NO₂, 0.00005) + set!(sediment.fields.N₂, 0.00005) + set!(sediment.fields.TPO₄, 0.00005) + set!(sediment.fields.FeOHP, 0.00005) + set!(sediment.fields.Feᴵᴵ, 0.00005) + set!(sediment.fields.FeS₂, 0.00005) + set!(sediment.fields.SO₄, 0.00005) + set!(sediment.fields.TH₂S, 0.00005) + set!(sediment.fields.CH₄, 0.00005) + set!(sediment.fields.TCO₂, 0.00005) + set!(sediment.fields.Gi, 0.00005) end set_defaults!(::VariableRedfieldLobster, model) = @@ -65,15 +65,15 @@ biogeochemistry = LOBSTER(; grid, variable_redfield = true, sediment_model) - model = NonhydrostaticModel(; grid, biogeochemistry, closure = nothing, timestepper = :RungeKutta3, buoyancy = nothing) -# set_defaults!(model.biogeochemistry.sediment) -# set_defaults!(biogeochemistry.underlying_biogeochemistry, model) +set_defaults!(model.biogeochemistry.sediment) + +set_defaults!(biogeochemistry.underlying_biogeochemistry, model) simulation = Simulation(model, Δt = 50, stop_time = 1day) From 49147508d3baf5170a8d3069c633b775fac38359 Mon Sep 17 00:00:00 2001 From: louis Date: Tue, 23 Jul 2024 10:20:57 +0100 Subject: [PATCH 20/27] a --- src/Boundaries/Sediments/IronPhosphate.jl | 83 +++++++++++------------ test/test_IronPhos.jl | 7 +- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/Boundaries/Sediments/IronPhosphate.jl b/src/Boundaries/Sediments/IronPhosphate.jl index 3666cb371..e4fb51e62 100644 --- a/src/Boundaries/Sediments/IronPhosphate.jl +++ b/src/Boundaries/Sediments/IronPhosphate.jl @@ -146,23 +146,23 @@ adapt_structure(to, sediment::IronPhosphate) = adapt(to, sediment.bottom_indices)) sediment_tracers(::IronPhosphate) = (:O₂, :NH₄, :NO₃, :NO₂, :N₂, :TPO₄, :FeOHP, :Feᴵᴵ, :FeS₂, :SO₄, :TH₂S, :CH₄, :TCO₂, :Gi) -sediment_fields(model::IronPhosphate) = (O₂ = model.fields.O₂, - NH₄ = model.fields.NH₄, - NO₃ = model.fields.NO₃, - NO₂ = model.fields.NO₂, - N₂ = model.fields.N₂, - TPO₄ = model.fields.TPO₄, +sediment_fields(model::IronPhosphate) = (O2 = model.fields.O2, + NH4 = model.fields.NH4, + NO3 = model.fields.NO3, + NO2 = model.fields.NO2, + N2 = model.fields.N2, + TPO4 = model.fields.TPO4, FeOHP = model.fields.FeOHP, - Feᴵᴵ = model.fields.Feᴵᴵ, - FeS₂ = model.fields.FeS₂, - SO₄ = model.fields.SO₄, - TH₂S = model.fields.TH₂S, - CH₄ = model.fields.CH₄, - TCO₂ = model.fields.TCO₂, + FeII = model.fields.FeII, + FeS2 = model.fields.FeS2, + SO4 = model.fields.SO4, + TH2S = model.fields.TH2S, + CH4 = model.fields.CH4, + TCO2 = model.fields.TCO2, Gi = model.fields.Gi) -@inline required_tracers(::IronPhosphate, bgc, tracers) = tracers[(:NO₃, :NH₄, :O₂, :DIC, sinking_tracers(bgc)...)] # need :Gi, :FeOHP -@inline required_tendencies(::IronPhosphate, bgc, tracers) = tracers[(:NO₃, :NH₄, :O₂, :DIC)] # TODO add effluxes of PO4 and Fe once PISCES is working +@inline required_tracers(::IronPhosphate, bgc, tracers) = tracers[(:NO₃, :NH₄, :O₂, :DIC, :POC, :Feᴾ, sinking_tracers(bgc)...)] +@inline required_tendencies(::IronPhosphate, bgc, tracers) = tracers[(:NO₃, :NH₄, :O₂, :DIC, :POC, :Feᴾ)] # TODO add effluxes of PO4 and Fe once PISCES is working @inline bottom_index_array(sediment::IronPhosphate) = sediment.bottom_indices @@ -173,11 +173,11 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri Δz = zspacing(i, j, k, grid, Center(), Center(), Center()) @inbounds begin - oxygen_deposition = 0 #oxygen_flux(i, j, k, grid, advection, bgc, tracers) * Δz + oxygen_deposition = oxygen_flux(i, j, k, grid, advection, bgc, tracers) * Δz - POC_deposition = carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz + POC_deposition = poc_flux(i, j, k, grid, advection, bgc, tracers) * Δz - iron_deposition = carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz * (1/106) * 0.1 + iron_deposition = iron_flux(i, j, k, grid, advection, bgc, tracers) * Δz #(:O₂, :NH₄, :NO₃, :NO₂, :N₂, :TPO₄, :FeOHP, :Feᴵᴵ, :FeS₂, :SO₄, :TH₂S, :CH₄, :TCO₂, :Gi) O₂ = sediment.fields.O₂[i, j, 1] @@ -223,7 +223,6 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri RSO₄ = Gi * (fT * kGi * fₖ₋ₛₒ₄ * (1 - fK_Fe) *(1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₙₒ₂)) RCH₄ = Gi * (fT * kGi * (1 - fₖ₋ₛₒ₄) * (1 - fK_Fe) *(1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂)) - @inline kDNRA = 2.7e5 # M-1 day-1 @inline kamx = 2.7e4 # M-1 day-1 @inline kNH4ox = 2.7e4# M-1 day-1 @@ -235,16 +234,16 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri @inline kFeS2p = 2.7e4 # M-1 day-1 @inline kFe3red = 0.82 # cm1.5 mmol−0.5 day−1 - R_DNRA = TH₂S * NO₃ * fT * kDNRA - R_amx = NH₄ * NO₂ * fT * kamx - R_NH4ox = NH₄ * O₂ * fT * kNH4ox - R_NO2ox = NO₂ * O₂ * fT * kNO2ox - R_AOM = CH₄ * SO₄ * fT * kAOM - R_H2Sox = TH₂S * O₂ * fT * kH2Sox - R_Fe2ox = Feᴵᴵ * O₂ * fT * kFe2ox - R_FeS2ox = FeS₂ * O₂ * fT * kFeS2ox - R_FeS2p = TH₂S * Feᴵᴵ * fT * kFeS2p # H2 should be produced here but I assume it dissociates... - R_Fe3red = TH₂S ^ 0.5 * FeOHP * fT * kFe3red * (2 / (O₂ + 2)) + RDNRA = TH₂S * NO₃ * fT * kDNRA + Ramx = NH₄ * NO₂ * fT * kamx + RNH4ox = NH₄ * O₂ * fT * kNH4ox + RNO2ox = NO₂ * O₂ * fT * kNO2ox + RAOM = CH₄ * SO₄ * fT * kAOM + RH2Sox = TH₂S * O₂ * fT * kH2Sox + RFe2ox = Feᴵᴵ * O₂ * fT * kFe2ox + RFeS2ox = FeS₂ * O₂ * fT * kFeS2ox + RFeS2p = TH₂S * Feᴵᴵ * fT * kFeS2p # H2 should be produced here but I assume it dissociates... + RFe3red = TH₂S ^ 0.5 * FeOHP * fT * kFe3red * (2 / (O₂ + 2)) @inline ratio_NC = 9.5/106 @inline ratio_PC = 1/106 @@ -254,20 +253,20 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri ##### sediment evolution ##### - sediment_tendencies.Gi[i, j, 1] = POC_deposition - RO₂ - RNO₃ - RNO₂ - RFe - RSO₄ - RCH₄ - sediment_tendencies.O₂[i, j, 1] = oxygen_deposition - RO₂ - 1.5 * R_NH4ox - 0.5 * R_NO2ox - 2 * R_H2Sox - 0.25 * R_Fe2ox - 3.5 * R_FeS2ox - sediment_tendencies.TCO₂[i, j, 1] = RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄ + R_AOM - sediment_tendencies.NH₄[i, j, 1] = ratio_NC * (RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄) + R_DNRA - R_amx - R_NH4ox - sediment_tendencies.NO₃[i, j, 1] = -2 * RNO₃ - R_DNRA + R_NO2ox - sediment_tendencies.NO₂[i, j, 1] = 2 * RNO₃ - 1.33 * RNO₂ - R_amx + R_NH4ox - R_NO2ox - sediment_tendencies.N₂[i, j, 1] = R_amx + 0.66 * RNO₂ - sediment_tendencies.TPO₄[i, j, 1] = ratio_PC * (RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄) + RFe * ratio_FeP - ratio_FeP * R_Fe2ox * fₖ₋ₜₚₒ₄ + ratio_FeP * R_Fe3red - sediment_tendencies.FeOHP[i, j, 1] = iron_deposition - 4 * RFe + R_Fe2ox - R_Fe3red - sediment_tendencies.Feᴵᴵ[i, j, 1] = 4 * RFe - R_Fe2ox + R_FeS2ox - R_FeS2p + R_Fe3red - sediment_tendencies.FeS₂[i, j, 1] = R_FeS2p - R_FeS2ox - sediment_tendencies.SO₄[i, j, 1] = -0.5 * RSO₄ + R_DNRA - R_AOM + R_H2Sox + 2 * R_FeS2ox + (R_Fe3red / 8) - sediment_tendencies.TH₂S[i, j, 1] = 0.5 * RSO₄ - R_DNRA + R_AOM - R_H2Sox - 2 * R_FeS2p - (R_Fe3red / 8) - sediment_tendencies.CH₄[i, j, 1] = 0.5 * RCH₄ - R_AOM + sediment_tendencies.Gi = POC_deposition - RO₂ - RNO₃ - RNO₂ - RFe - RSO₄ - RCH₄ + sediment_tendencies.O₂ = oxygen_deposition - RO₂ - 1.5 * RNH4ox - 0.5 * RNO2ox - 2 * RH2Sox - 0.25 * RFe2ox - 3.5 * RFeS2ox + sediment_tendencies.TCO₂ = RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄ + RAOM + sediment_tendencies.NH₄ = ratio_NC * (RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄) + RDNRA - Ramx - RNH4ox + sediment_tendencies.NO₃ = -2 * RNO₃ - RDNRA + RNO2ox + sediment_tendencies.NO₂ = 2 * RNO₃ - 1.33 * RNO₂ - Ramx + RNH4ox - RNO2ox + sediment_tendencies.N₂ = Ramx + 0.66 * RNO₂ + sediment_tendencies.TPO₄ = ratio_PC * (RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄) + RFe * ratio_FeP - ratio_FeP * RFe2ox * fₖ₋ₜₚₒ₄ + ratio_FeP * RFe3red + sediment_tendencies.FeOHP = iron_deposition - 4 * RFe + RFe2ox - RFe3red + sediment_tendencies.Feᴵᴵ = 4 * RFe - RFe2ox + RFeS2ox - RFeS2p + RFe3red + sediment_tendencies.FeS₂ = RFeS2p - RFeS2ox + sediment_tendencies.SO₄ = -0.5 * RSO₄ + RDNRA - RAOM + RH2Sox + 2 * RFeS2ox + (RFe3red / 8) + sediment_tendencies.TH₂S = 0.5 * RSO₄ - RDNRA + RAOM - RH2Sox - 2 * RFeS2p - (RFe3red / 8) + sediment_tendencies.CH₄ = 0.5 * RCH₄ - RAOM end end diff --git a/test/test_IronPhos.jl b/test/test_IronPhos.jl index 5a5583bc8..c87eb0940 100644 --- a/test/test_IronPhos.jl +++ b/test/test_IronPhos.jl @@ -75,13 +75,14 @@ model = NonhydrostaticModel(; grid, # set_defaults!(biogeochemistry.underlying_biogeochemistry, model) -simulation.output_writers[:tracers] = JLD2OutputWriter(model, model.tracers, +simulation = Simulation(model, Δt = 50, stop_time = 1day) + + +simulation.output_writers[:tracers] = JLD2OutputWriter(model, model.biogeochemistry.sediment_model.fields, filename = "temp_plotting_data.jld2", schedule = TimeInterval(24minute), overwrite_existing = true) -simulation = Simulation(model, Δt = 50, stop_time = 1day) - intercepted_tendencies = Tuple(Array(interior(field)) for field in values(TracerFields(keys(model.tracers), grid))) simulation.callbacks[:intercept_tendencies] = Callback(intercept_tracer_tendencies!; callsite = TendencyCallsite(), parameters = intercepted_tendencies) From 95acbb253ba309ab604499df4f1c8b5510ad8e0f Mon Sep 17 00:00:00 2001 From: Louis Date: Tue, 23 Jul 2024 17:04:57 +0100 Subject: [PATCH 21/27] it doesnt explode! --- src/Boundaries/Sediments/IronPhosphate.jl | 46 ++++++++++++----------- test/test_IronPhos.jl | 35 +++++++---------- 2 files changed, 38 insertions(+), 43 deletions(-) diff --git a/src/Boundaries/Sediments/IronPhosphate.jl b/src/Boundaries/Sediments/IronPhosphate.jl index 0e06aaf8f..af216cd71 100644 --- a/src/Boundaries/Sediments/IronPhosphate.jl +++ b/src/Boundaries/Sediments/IronPhosphate.jl @@ -146,23 +146,21 @@ adapt_structure(to, sediment::IronPhosphate) = adapt(to, sediment.bottom_indices)) sediment_tracers(::IronPhosphate) = (:O₂, :NH₄, :NO₃, :NO₂, :N₂, :TPO₄, :FeOHP, :Feᴵᴵ, :FeS₂, :SO₄, :TH₂S, :CH₄, :TCO₂, :Gi) -sediment_fields(model::IronPhosphate) = (O2 = model.fields.O2, - NH4 = model.fields.NH4, - NO3 = model.fields.NO3, - NO2 = model.fields.NO2, - N2 = model.fields.N2, - TPO4 = model.fields.TPO4, - FeOHP = model.fields.FeOHP, - FeII = model.fields.FeII, - FeS2 = model.fields.FeS2, - SO4 = model.fields.SO4, - TH2S = model.fields.TH2S, - CH4 = model.fields.CH4, - TCO2 = model.fields.TCO2, - Gi = model.fields.Gi) - -@inline required_tracers(::IronPhosphate, bgc, tracers) = tracers[(:NO₃, :NH₄, :O₂, :DIC, :POC, :Feᴾ, sinking_tracers(bgc)...)] -@inline required_tendencies(::IronPhosphate, bgc, tracers) = tracers[(:NO₃, :NH₄, :O₂, :DIC, :POC, :Feᴾ)] # TODO add effluxes of PO4 and Fe once PISCES is working +sediment_fields(model::IronPhosphate) = (O₂ = model.fields.O₂, + NH₄ = model.fields.NH₄, + NO₃ = model.fields.NO₃, + NO₂ = model.fields.NO₂, + TPO₄ = model.fields.TPO₄, + FeOHP = model.fields.FeOHP, + Feᴵᴵ = model.fields.Feᴵᴵ, + FeS₂ = model.fields.FeS₂, + SO₄ = model.fields.SO₄, + TH₂S = model.fields.TH₂S, + CH₄ = model.fields.CH₄, + Gi = model.fields.Gi) + +@inline required_tracers(::IronPhosphate, bgc, tracers) = tracers[(:NO₃, :NH₄, :O₂, :DIC)] #, sinking_tracers(bgc)...)] +@inline required_tendencies(::IronPhosphate, bgc, tracers) = tracers[(:NO₃, :NH₄, :O₂, :DIC)] # TODO add effluxes of PO4 and Fe once PISCES is working @inline bottom_index_array(sediment::IronPhosphate) = sediment.bottom_indices @@ -173,11 +171,11 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri Δz = zspacing(i, j, k, grid, Center(), Center(), Center()) @inbounds begin - oxygen_deposition = oxygen_flux(i, j, k, grid, advection, bgc, tracers) * Δz + oxygen_deposition = 0#oxygen_flux(i, j, k, grid, advection, bgc, tracers) * Δz - POC_deposition = 0#carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz + POC_deposition = 0#5e-9 #carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz - iron_deposition = 0#carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz * (1/106) * 0.1 + iron_deposition = 0#5e-10 #carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz * (1/106) * 0.1 #(:O₂, :NH₄, :NO₃, :NO₂, :N₂, :TPO₄, :FeOHP, :Feᴵᴵ, :FeS₂, :SO₄, :TH₂S, :CH₄, :TCO₂, :Gi) O₂ = sediment.fields.O₂[i, j, 1] @@ -196,7 +194,6 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri #println(FeOHP + FeS₂ + Feᴵᴵ) # iron is conserved #println(2*FeS₂+SO₄+TH₂S) # sulfur is conserved println(TPO₄) - ##### ##### RATES ##### @@ -248,8 +245,12 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri R_Fe2ox = Feᴵᴵ * O₂ * fT * kFe2ox * per_day_to_per_seconds R_FeS2ox = FeS₂ * O₂ * fT * kFeS2ox * per_day_to_per_seconds R_FeS2p = TH₂S * Feᴵᴵ * fT * kFeS2p * per_day_to_per_seconds # H2 should be produced here but I assume it dissociates... - R_Fe3red = max(0, TH₂S) ^ 0.5 * FeOHP * fT * kFe3red * (2 / (O₂ + 2)) + R_Fe3red = max(0, TH₂S) ^ 0.5 * FeOHP * fT * kFe3red * (2 / (O₂ + 2)) * per_day_to_per_seconds + println(R_DNRA, " ", R_amx, " ", R_NH4ox, " ", R_NO2ox, " ", R_AOM, " ", R_H2Sox, " ", R_Fe2ox, " ", R_FeS2ox, " ", R_FeS2p, " ", R_Fe3red, " ") + if isnan(TPO₄) + sleep(10) + end @inline ratio_NC = 9.5/106 @inline ratio_PC = 1/106 @inline ratio_FeP = 0.1 @@ -272,6 +273,7 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri sediment_tendencies.SO₄[i, j, 1] = -0.5 * RSO₄ + R_DNRA - R_AOM + R_H2Sox + 2 * R_FeS2ox + (R_Fe3red / 8) sediment_tendencies.TH₂S[i, j, 1] = 0.5 * RSO₄ - R_DNRA + R_AOM - R_H2Sox - 2 * R_FeS2p - (R_Fe3red / 8) sediment_tendencies.CH₄[i, j, 1] = 0.5 * RCH₄ - R_AOM + #println(sediment_tendencies) end end diff --git a/test/test_IronPhos.jl b/test/test_IronPhos.jl index e3558ae9d..b745fcd5d 100644 --- a/test/test_IronPhos.jl +++ b/test/test_IronPhos.jl @@ -18,20 +18,20 @@ function intercept_tracer_tendencies!(model, intercepted_tendencies) end function set_defaults!(sediment::IronPhosphate) - set!(sediment.fields.O₂, 0.00005) - set!(sediment.fields.NH₄, 0.00005) - set!(sediment.fields.NO₃, 0.00005) - set!(sediment.fields.NO₂, 0.00005) - set!(sediment.fields.N₂, 0.00005) - set!(sediment.fields.TPO₄, 0.00005) - set!(sediment.fields.FeOHP, 0.00005) - set!(sediment.fields.Feᴵᴵ, 0.00005) - set!(sediment.fields.FeS₂, 0.00005) - set!(sediment.fields.SO₄, 0.00005) - set!(sediment.fields.TH₂S, 0.00005) - set!(sediment.fields.CH₄, 0.00005) - set!(sediment.fields.TCO₂, 0.00005) - set!(sediment.fields.Gi, 0.00005) + set!(sediment.fields.O₂, 100e-6) + set!(sediment.fields.NH₄, 100e-6) + set!(sediment.fields.NO₃, 6e-6) + set!(sediment.fields.NO₂, 0.5e-6) + set!(sediment.fields.N₂, 0) + set!(sediment.fields.TPO₄, 1.5e-6) + set!(sediment.fields.FeOHP, 410e-6) + set!(sediment.fields.Feᴵᴵ, 0.1e-6) + set!(sediment.fields.FeS₂, 0) + set!(sediment.fields.SO₄, 0.5e-6) + set!(sediment.fields.TH₂S, 0.1e-6) + set!(sediment.fields.CH₄, 10e-9) + set!(sediment.fields.TCO₂, 2e-3) + set!(sediment.fields.Gi, 1e-3) end set_defaults!(::VariableRedfieldLobster, model) = @@ -73,18 +73,11 @@ model = NonhydrostaticModel(; grid, set_defaults!(model.biogeochemistry.sediment) -<<<<<<< HEAD -simulation = Simulation(model, Δt = 50, stop_time = 1day) - - -simulation.output_writers[:tracers] = JLD2OutputWriter(model, model.biogeochemistry.sediment_model.fields, -======= set_defaults!(biogeochemistry.underlying_biogeochemistry, model) simulation = Simulation(model, Δt = 50, stop_time = 1day) simulation.output_writers[:tracers] = JLD2OutputWriter(model, model.biogeochemistry.sediment.tendencies.G⁻, ->>>>>>> 90aedaf0180696b25e7756616f1f0287b6715a8f filename = "temp_plotting_data.jld2", schedule = TimeInterval(24minute), overwrite_existing = true) From 830d7f2b5e991f46d0926c749f05de8c0eb61644 Mon Sep 17 00:00:00 2001 From: Louis Date: Wed, 24 Jul 2024 15:51:15 +0100 Subject: [PATCH 22/27] hmmmm --- src/Boundaries/Sediments/IronPhosphate.jl | 5 ++-- test/test_IronPhos.jl | 33 ++++++++++++++++++++--- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/Boundaries/Sediments/IronPhosphate.jl b/src/Boundaries/Sediments/IronPhosphate.jl index af216cd71..f32d860df 100644 --- a/src/Boundaries/Sediments/IronPhosphate.jl +++ b/src/Boundaries/Sediments/IronPhosphate.jl @@ -193,7 +193,7 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri #println(FeOHP + FeS₂ + Feᴵᴵ) # iron is conserved #println(2*FeS₂+SO₄+TH₂S) # sulfur is conserved - println(TPO₄) + #saprintln(TPO₄) ##### ##### RATES ##### @@ -247,10 +247,11 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri R_FeS2p = TH₂S * Feᴵᴵ * fT * kFeS2p * per_day_to_per_seconds # H2 should be produced here but I assume it dissociates... R_Fe3red = max(0, TH₂S) ^ 0.5 * FeOHP * fT * kFe3red * (2 / (O₂ + 2)) * per_day_to_per_seconds - println(R_DNRA, " ", R_amx, " ", R_NH4ox, " ", R_NO2ox, " ", R_AOM, " ", R_H2Sox, " ", R_Fe2ox, " ", R_FeS2ox, " ", R_FeS2p, " ", R_Fe3red, " ") + #println(R_DNRA, " ", R_amx, " ", R_NH4ox, " ", R_NO2ox, " ", R_AOM, " ", R_H2Sox, " ", R_Fe2ox, " ", R_FeS2ox, " ", R_FeS2p, " ", R_Fe3red, " ") if isnan(TPO₄) sleep(10) end + println(O₂) @inline ratio_NC = 9.5/106 @inline ratio_PC = 1/106 @inline ratio_FeP = 0.1 diff --git a/test/test_IronPhos.jl b/test/test_IronPhos.jl index b745fcd5d..769cc8620 100644 --- a/test/test_IronPhos.jl +++ b/test/test_IronPhos.jl @@ -2,7 +2,7 @@ include("dependencies_for_runtests.jl") using OceanBioME.Sediments: SimpleMultiG, InstantRemineralisation, IronPhosphate using Oceananigans.Units - +using Oceananigans using OceanBioME.Sediments: sediment_tracers, sediment_fields using Oceananigans: Field using Oceananigans.Fields: TracerFields @@ -75,9 +75,11 @@ set_defaults!(model.biogeochemistry.sediment) set_defaults!(biogeochemistry.underlying_biogeochemistry, model) -simulation = Simulation(model, Δt = 50, stop_time = 1day) +sim_length = 10days + +simulation = Simulation(model, Δt = 50, stop_time = sim_length) -simulation.output_writers[:tracers] = JLD2OutputWriter(model, model.biogeochemistry.sediment.tendencies.G⁻, +simulation.output_writers[:tracers] = JLD2OutputWriter(model, model.biogeochemistry.sediment.fields, filename = "temp_plotting_data.jld2", schedule = TimeInterval(24minute), overwrite_existing = true) @@ -88,4 +90,29 @@ simulation.callbacks[:intercept_tendencies] = Callback(intercept_tracer_tendenci run!(simulation) +var_name_example = keys(model.biogeochemistry.sediment.fields)[1] +times = FieldTimeSeries("temp_plotting_data.jld2", "$var_name_example").times + +timeseries = NamedTuple{keys(model.biogeochemistry.sediment.fields)}(FieldTimeSeries("temp_plotting_data.jld2", "$field")[1, 1, 1, :] for field in keys(model.biogeochemistry.sediment.fields)) + +# ## And plot +using CairoMakie + +fig = Figure(size = (1200, 3600), fontsize = 24) + +tick_location_seconds = range(0, times[end]; length=5) +tick_location_days = tick_location_seconds / (24 * 60 * 60) + + +axs = [] +for (name, tracer) in pairs(timeseries) + idx = (length(axs)) + push!(axs, Axis(fig[floor(Int, idx/2), Int(idx%2)], ylabel = "$name", xlabel = "Days", xticks=(collect(tick_location_seconds), string.(collect(tick_location_days))))) + lines!(axs[end], times, tracer, linewidth = 3) +end + +display(fig) + + + @info "Success!" \ No newline at end of file From 6445f0c1fb76ca9e0b3793c6536ff62565242b58 Mon Sep 17 00:00:00 2001 From: Louis Date: Wed, 24 Jul 2024 17:25:05 +0100 Subject: [PATCH 23/27] kinda working --- src/Boundaries/Sediments/IronPhosphate.jl | 50 ++++++++++++----------- test/test_IronPhos.jl | 8 ++-- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/Boundaries/Sediments/IronPhosphate.jl b/src/Boundaries/Sediments/IronPhosphate.jl index f32d860df..2951c3ebe 100644 --- a/src/Boundaries/Sediments/IronPhosphate.jl +++ b/src/Boundaries/Sediments/IronPhosphate.jl @@ -173,9 +173,9 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri @inbounds begin oxygen_deposition = 0#oxygen_flux(i, j, k, grid, advection, bgc, tracers) * Δz - POC_deposition = 0#5e-9 #carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz + POC_deposition = 5e-9 #carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz - iron_deposition = 0#5e-10 #carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz * (1/106) * 0.1 + iron_deposition = 5e-10 #carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz * (1/106) * 0.1 #(:O₂, :NH₄, :NO₃, :NO₂, :N₂, :TPO₄, :FeOHP, :Feᴵᴵ, :FeS₂, :SO₄, :TH₂S, :CH₄, :TCO₂, :Gi) O₂ = sediment.fields.O₂[i, j, 1] @@ -198,12 +198,12 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri ##### RATES ##### - @inline K_O₂ = 1 # μM, Half–saturation constant for O2 - @inline K_NO₃ = 10 # μM, Half–saturation constant for NO3 - @inline K_NO₂ = 10 # μM, Half–saturation constant for NO2 + @inline K_O₂ = 1e-6 # μM, Half–saturation constant for O2 + @inline K_NO₃ = 10e-6 # μM, Half–saturation constant for NO3 + @inline K_NO₂ = 10e-6 # μM, Half–saturation constant for NO2 @inline K_Fe = 0.028 # wt-%, Half–saturation constant for Fe - @inline K_SO₄ = 0.1 # μM, Half–saturation constant for SO4 - @inline K_TPO₄ = 10 # μM, Half–saturation constant for TPO4 + @inline K_SO₄ = 0.1e-6 # μM, Half–saturation constant for SO4 + @inline K_TPO₄ = 10e-6 # μM, Half–saturation constant for TPO4 #(:O₂, :NH₄, :NO₃, :NO₂, :N₂, :TPO₄, :FeOHP, :Feᴵᴵ, :FeS₂, :SO₄, :TH₂S, :CH₄, :TCO₂, :Gi) @inline kGi = 0.016 # day⁻¹, Rate constant for G0 degradation, Dale et al @@ -218,12 +218,14 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri fₖ₋ₛₒ₄ = SO₄ / (SO₄ + K_SO₄) # kinetic limiting term fₖ₋ₜₚₒ₄ = TPO₄ / (TPO₄ + K_TPO₄) # kinetic limiting term - RO₂ = Gi * (fT * kGi * fₒₓ * fₖ₋ₒ₂) * per_day_to_per_seconds - RNO₃ = Gi * (fT * kGi * fₖ₋ₙₒ₃ * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₒ₂)) * per_day_to_per_seconds - RNO₂ = Gi * (fT * kGi * fₖ₋ₙₒ₂ * (1 - fₖ₋ₒ₂)) * per_day_to_per_seconds - RFe = Gi * (fT * kGi * fK_Fe * (1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₙₒ₂)) * per_day_to_per_seconds - RSO₄ = Gi * (fT * kGi * fₖ₋ₛₒ₄ * (1 - fK_Fe) *(1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₙₒ₂)) * per_day_to_per_seconds - RCH₄ = Gi * (fT * kGi * (1 - fₖ₋ₛₒ₄) * (1 - fK_Fe) *(1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂)) * per_day_to_per_seconds + RO₂ = max(0, Gi * (fT * kGi * fₒₓ * fₖ₋ₒ₂) * per_day_to_per_seconds) + RNO₃ = max(0, Gi * (fT * kGi * fₖ₋ₙₒ₃ * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₒ₂)) * per_day_to_per_seconds) + RNO₂ = max(0, Gi * (fT * kGi * fₖ₋ₙₒ₂ * (1 - fₖ₋ₒ₂)) * per_day_to_per_seconds) + RFe = max(0, Gi * (fT * kGi * fK_Fe * (1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₙₒ₂)) * per_day_to_per_seconds) + RSO₄ = max(0, Gi * (fT * kGi * fₖ₋ₛₒ₄ * (1 - fK_Fe) *(1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₙₒ₂)) * per_day_to_per_seconds) + RCH₄ = max(0, Gi * (fT * kGi * (1 - fₖ₋ₛₒ₄) * (1 - fK_Fe) *(1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₙₒ₂)) * per_day_to_per_seconds) + + println(RO₂, "\n", RNO₂, "\n", fₖ₋ₒ₂, "\n", fₖ₋ₙₒ₂, "\n", fₖ₋ₙₒ₃, "\n\n") @inline kDNRA = 2.7e5 # M-1 day-1 @inline kamx = 2.7e4 # M-1 day-1 @@ -236,16 +238,16 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri @inline kFeS2p = 2.7e4 # M-1 day-1 @inline kFe3red = 0.82 # cm1.5 mmol−0.5 day−1 - R_DNRA = TH₂S * NO₃ * fT * kDNRA * per_day_to_per_seconds - R_amx = NH₄ * NO₂ * fT * kamx * per_day_to_per_seconds - R_NH4ox = NH₄ * O₂ * fT * kNH4ox * per_day_to_per_seconds - R_NO2ox = NO₂ * O₂ * fT * kNO2ox * per_day_to_per_seconds - R_AOM = CH₄ * SO₄ * fT * kAOM * per_day_to_per_seconds - R_H2Sox = TH₂S * O₂ * fT * kH2Sox * per_day_to_per_seconds - R_Fe2ox = Feᴵᴵ * O₂ * fT * kFe2ox * per_day_to_per_seconds - R_FeS2ox = FeS₂ * O₂ * fT * kFeS2ox * per_day_to_per_seconds - R_FeS2p = TH₂S * Feᴵᴵ * fT * kFeS2p * per_day_to_per_seconds # H2 should be produced here but I assume it dissociates... - R_Fe3red = max(0, TH₂S) ^ 0.5 * FeOHP * fT * kFe3red * (2 / (O₂ + 2)) * per_day_to_per_seconds + R_DNRA = max(0, TH₂S * NO₃ * fT * kDNRA * per_day_to_per_seconds) + R_amx = max(0, NH₄ * NO₂ * fT * kamx * per_day_to_per_seconds) + R_NH4ox = max(0, NH₄ * O₂ * fT * kNH4ox * per_day_to_per_seconds) + R_NO2ox = max(0, NO₂ * O₂ * fT * kNO2ox * per_day_to_per_seconds) + R_AOM = max(0, CH₄ * SO₄ * fT * kAOM * per_day_to_per_seconds) + R_H2Sox = max(0, TH₂S * O₂ * fT * kH2Sox * per_day_to_per_seconds) + R_Fe2ox = max(0, Feᴵᴵ * O₂ * fT * kFe2ox * per_day_to_per_seconds) + R_FeS2ox = max(0, FeS₂ * O₂ * fT * kFeS2ox * per_day_to_per_seconds) + R_FeS2p = max(0, TH₂S * Feᴵᴵ * fT * kFeS2p * per_day_to_per_seconds) # H2 should be produced here but I assume it dissociates... + R_Fe3red = max(0, max(0, TH₂S) ^ 0.5 * FeOHP * fT * kFe3red * (2 / (O₂ + 2)) * per_day_to_per_seconds) #println(R_DNRA, " ", R_amx, " ", R_NH4ox, " ", R_NO2ox, " ", R_AOM, " ", R_H2Sox, " ", R_Fe2ox, " ", R_FeS2ox, " ", R_FeS2p, " ", R_Fe3red, " ") if isnan(TPO₄) @@ -263,7 +265,7 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri sediment_tendencies.Gi[i, j, 1] = POC_deposition - RO₂ - RNO₃ - RNO₂ - RFe - RSO₄ - RCH₄ sediment_tendencies.O₂[i, j, 1] = oxygen_deposition - RO₂ - 1.5 * R_NH4ox - 0.5 * R_NO2ox - 2 * R_H2Sox - 0.25 * R_Fe2ox - 3.5 * R_FeS2ox sediment_tendencies.TCO₂[i, j, 1] = RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄ + R_AOM - sediment_tendencies.NH₄[i, j, 1] = ratio_NC * (RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄) + R_DNRA - R_amx - R_NH4ox + sediment_tendencies.NH₄[i, j, 1] = ratio_NC * (RO₂ +1e-3RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄) + R_DNRA - R_amx - R_NH4ox sediment_tendencies.NO₃[i, j, 1] = -2 * RNO₃ - R_DNRA + R_NO2ox sediment_tendencies.NO₂[i, j, 1] = 2 * RNO₃ - 1.33 * RNO₂ - R_amx + R_NH4ox - R_NO2ox sediment_tendencies.N₂[i, j, 1] = R_amx + 0.66 * RNO₂ diff --git a/test/test_IronPhos.jl b/test/test_IronPhos.jl index 769cc8620..dfdefca63 100644 --- a/test/test_IronPhos.jl +++ b/test/test_IronPhos.jl @@ -18,7 +18,7 @@ function intercept_tracer_tendencies!(model, intercepted_tendencies) end function set_defaults!(sediment::IronPhosphate) - set!(sediment.fields.O₂, 100e-6) + set!(sediment.fields.O₂, 1e-6) set!(sediment.fields.NH₄, 100e-6) set!(sediment.fields.NO₃, 6e-6) set!(sediment.fields.NO₂, 0.5e-6) @@ -30,8 +30,8 @@ function set_defaults!(sediment::IronPhosphate) set!(sediment.fields.SO₄, 0.5e-6) set!(sediment.fields.TH₂S, 0.1e-6) set!(sediment.fields.CH₄, 10e-9) - set!(sediment.fields.TCO₂, 2e-3) - set!(sediment.fields.Gi, 1e-3) + set!(sediment.fields.TCO₂, 0) + set!(sediment.fields.Gi, 0) end set_defaults!(::VariableRedfieldLobster, model) = @@ -75,7 +75,7 @@ set_defaults!(model.biogeochemistry.sediment) set_defaults!(biogeochemistry.underlying_biogeochemistry, model) -sim_length = 10days +sim_length = 5days simulation = Simulation(model, Δt = 50, stop_time = sim_length) From 11af3661ce48594a9652eb410c02278c1427f0f9 Mon Sep 17 00:00:00 2001 From: Louis Date: Thu, 25 Jul 2024 11:46:15 +0100 Subject: [PATCH 24/27] why is ch4 -ve?!?!? --- src/Boundaries/Sediments/IronPhosphate.jl | 6 +++--- test/test_IronPhos.jl | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Boundaries/Sediments/IronPhosphate.jl b/src/Boundaries/Sediments/IronPhosphate.jl index 2951c3ebe..12908fc36 100644 --- a/src/Boundaries/Sediments/IronPhosphate.jl +++ b/src/Boundaries/Sediments/IronPhosphate.jl @@ -175,7 +175,7 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri POC_deposition = 5e-9 #carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz - iron_deposition = 5e-10 #carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz * (1/106) * 0.1 + iron_deposition = 0#5e-10 #carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz * (1/106) * 0.1 #(:O₂, :NH₄, :NO₃, :NO₂, :N₂, :TPO₄, :FeOHP, :Feᴵᴵ, :FeS₂, :SO₄, :TH₂S, :CH₄, :TCO₂, :Gi) O₂ = sediment.fields.O₂[i, j, 1] @@ -225,7 +225,7 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri RSO₄ = max(0, Gi * (fT * kGi * fₖ₋ₛₒ₄ * (1 - fK_Fe) *(1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₙₒ₂)) * per_day_to_per_seconds) RCH₄ = max(0, Gi * (fT * kGi * (1 - fₖ₋ₛₒ₄) * (1 - fK_Fe) *(1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₙₒ₂)) * per_day_to_per_seconds) - println(RO₂, "\n", RNO₂, "\n", fₖ₋ₒ₂, "\n", fₖ₋ₙₒ₂, "\n", fₖ₋ₙₒ₃, "\n\n") + @inline kDNRA = 2.7e5 # M-1 day-1 @inline kamx = 2.7e4 # M-1 day-1 @@ -276,7 +276,7 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri sediment_tendencies.SO₄[i, j, 1] = -0.5 * RSO₄ + R_DNRA - R_AOM + R_H2Sox + 2 * R_FeS2ox + (R_Fe3red / 8) sediment_tendencies.TH₂S[i, j, 1] = 0.5 * RSO₄ - R_DNRA + R_AOM - R_H2Sox - 2 * R_FeS2p - (R_Fe3red / 8) sediment_tendencies.CH₄[i, j, 1] = 0.5 * RCH₄ - R_AOM - #println(sediment_tendencies) + println(sediment_tendencies.FeS₂[i, j, 1]) end end diff --git a/test/test_IronPhos.jl b/test/test_IronPhos.jl index dfdefca63..a398ed274 100644 --- a/test/test_IronPhos.jl +++ b/test/test_IronPhos.jl @@ -26,12 +26,12 @@ function set_defaults!(sediment::IronPhosphate) set!(sediment.fields.TPO₄, 1.5e-6) set!(sediment.fields.FeOHP, 410e-6) set!(sediment.fields.Feᴵᴵ, 0.1e-6) - set!(sediment.fields.FeS₂, 0) + set!(sediment.fields.FeS₂, 1e-7) set!(sediment.fields.SO₄, 0.5e-6) - set!(sediment.fields.TH₂S, 0.1e-6) + set!(sediment.fields.TH₂S, 1e-5) set!(sediment.fields.CH₄, 10e-9) set!(sediment.fields.TCO₂, 0) - set!(sediment.fields.Gi, 0) + set!(sediment.fields.Gi, 1e-6) end set_defaults!(::VariableRedfieldLobster, model) = From 37d3b3a5c613e27ebe2946669f7c02a8c9e00862 Mon Sep 17 00:00:00 2001 From: Louis Date: Thu, 25 Jul 2024 16:01:21 +0100 Subject: [PATCH 25/27] fe still -ve --- src/Boundaries/Sediments/IronPhosphate.jl | 17 ++++++++--------- test/test_IronPhos.jl | 8 ++++---- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/Boundaries/Sediments/IronPhosphate.jl b/src/Boundaries/Sediments/IronPhosphate.jl index 12908fc36..a0d4cb7a0 100644 --- a/src/Boundaries/Sediments/IronPhosphate.jl +++ b/src/Boundaries/Sediments/IronPhosphate.jl @@ -173,7 +173,7 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri @inbounds begin oxygen_deposition = 0#oxygen_flux(i, j, k, grid, advection, bgc, tracers) * Δz - POC_deposition = 5e-9 #carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz + POC_deposition = 0#5e-9 #carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz iron_deposition = 0#5e-10 #carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz * (1/106) * 0.1 @@ -198,12 +198,12 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri ##### RATES ##### - @inline K_O₂ = 1e-6 # μM, Half–saturation constant for O2 - @inline K_NO₃ = 10e-6 # μM, Half–saturation constant for NO3 - @inline K_NO₂ = 10e-6 # μM, Half–saturation constant for NO2 + @inline K_O₂ = 1e-6 # M, Half–saturation constant for O2 + @inline K_NO₃ = 10e-6 # M, Half–saturation constant for NO3 + @inline K_NO₂ = 10e-6 # M, Half–saturation constant for NO2 @inline K_Fe = 0.028 # wt-%, Half–saturation constant for Fe - @inline K_SO₄ = 0.1e-6 # μM, Half–saturation constant for SO4 - @inline K_TPO₄ = 10e-6 # μM, Half–saturation constant for TPO4 + @inline K_SO₄ = 0.1e-6 # M, Half–saturation constant for SO4 + @inline K_TPO₄ = 10e-6 # M, Half–saturation constant for TPO4 #(:O₂, :NH₄, :NO₃, :NO₂, :N₂, :TPO₄, :FeOHP, :Feᴵᴵ, :FeS₂, :SO₄, :TH₂S, :CH₄, :TCO₂, :Gi) @inline kGi = 0.016 # day⁻¹, Rate constant for G0 degradation, Dale et al @@ -236,7 +236,7 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri @inline kFe2ox = 2.7e5 # M-1 day-1 @inline kFeS2ox = 2.7e3 # M-1 day-1 @inline kFeS2p = 2.7e4 # M-1 day-1 - @inline kFe3red = 0.82 # cm1.5 mmol−0.5 day−1 + @inline kFe3red = 0.82e3 # cm1.5 mol−0.5 day−1 R_DNRA = max(0, TH₂S * NO₃ * fT * kDNRA * per_day_to_per_seconds) R_amx = max(0, NH₄ * NO₂ * fT * kamx * per_day_to_per_seconds) @@ -253,7 +253,6 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri if isnan(TPO₄) sleep(10) end - println(O₂) @inline ratio_NC = 9.5/106 @inline ratio_PC = 1/106 @inline ratio_FeP = 0.1 @@ -276,7 +275,7 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri sediment_tendencies.SO₄[i, j, 1] = -0.5 * RSO₄ + R_DNRA - R_AOM + R_H2Sox + 2 * R_FeS2ox + (R_Fe3red / 8) sediment_tendencies.TH₂S[i, j, 1] = 0.5 * RSO₄ - R_DNRA + R_AOM - R_H2Sox - 2 * R_FeS2p - (R_Fe3red / 8) sediment_tendencies.CH₄[i, j, 1] = 0.5 * RCH₄ - R_AOM - println(sediment_tendencies.FeS₂[i, j, 1]) + println(4 * RFe - R_Fe2ox + R_FeS2ox - R_FeS2p + R_Fe3red) end end diff --git a/test/test_IronPhos.jl b/test/test_IronPhos.jl index a398ed274..061adef57 100644 --- a/test/test_IronPhos.jl +++ b/test/test_IronPhos.jl @@ -25,7 +25,7 @@ function set_defaults!(sediment::IronPhosphate) set!(sediment.fields.N₂, 0) set!(sediment.fields.TPO₄, 1.5e-6) set!(sediment.fields.FeOHP, 410e-6) - set!(sediment.fields.Feᴵᴵ, 0.1e-6) + set!(sediment.fields.Feᴵᴵ, 1e-6) set!(sediment.fields.FeS₂, 1e-7) set!(sediment.fields.SO₄, 0.5e-6) set!(sediment.fields.TH₂S, 1e-5) @@ -75,7 +75,7 @@ set_defaults!(model.biogeochemistry.sediment) set_defaults!(biogeochemistry.underlying_biogeochemistry, model) -sim_length = 5days +sim_length = 3days simulation = Simulation(model, Δt = 50, stop_time = sim_length) @@ -98,7 +98,7 @@ timeseries = NamedTuple{keys(model.biogeochemistry.sediment.fields)}(FieldTimeSe # ## And plot using CairoMakie -fig = Figure(size = (1200, 3600), fontsize = 24) +fig = Figure(size = (2400, 2400), fontsize = 24) tick_location_seconds = range(0, times[end]; length=5) tick_location_days = tick_location_seconds / (24 * 60 * 60) @@ -107,7 +107,7 @@ tick_location_days = tick_location_seconds / (24 * 60 * 60) axs = [] for (name, tracer) in pairs(timeseries) idx = (length(axs)) - push!(axs, Axis(fig[floor(Int, idx/2), Int(idx%2)], ylabel = "$name", xlabel = "Days", xticks=(collect(tick_location_seconds), string.(collect(tick_location_days))))) + push!(axs, Axis(fig[floor(Int, idx/4), Int(idx%4)], ylabel = "$name", xlabel = "Days", xticks=(collect(tick_location_seconds), string.(collect(tick_location_days))))) lines!(axs[end], times, tracer, linewidth = 3) end From d9e1e8f7621878eb8a133b177f4c9814299f8a60 Mon Sep 17 00:00:00 2001 From: Louis Date: Fri, 26 Jul 2024 12:11:59 +0100 Subject: [PATCH 26/27] push --- src/Boundaries/Sediments/IronPhosphate.jl | 44 ++++++++++++----------- test/test_IronPhos.jl | 2 +- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/Boundaries/Sediments/IronPhosphate.jl b/src/Boundaries/Sediments/IronPhosphate.jl index a0d4cb7a0..89532a38d 100644 --- a/src/Boundaries/Sediments/IronPhosphate.jl +++ b/src/Boundaries/Sediments/IronPhosphate.jl @@ -204,6 +204,7 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri @inline K_Fe = 0.028 # wt-%, Half–saturation constant for Fe @inline K_SO₄ = 0.1e-6 # M, Half–saturation constant for SO4 @inline K_TPO₄ = 10e-6 # M, Half–saturation constant for TPO4 + @inline K_CH₄ = 10e-6 # M, Half–saturation constant for TPO4 #(:O₂, :NH₄, :NO₃, :NO₂, :N₂, :TPO₄, :FeOHP, :Feᴵᴵ, :FeS₂, :SO₄, :TH₂S, :CH₄, :TCO₂, :Gi) @inline kGi = 0.016 # day⁻¹, Rate constant for G0 degradation, Dale et al @@ -217,13 +218,14 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri fK_Fe = FeOHP / (FeOHP + K_Fe) # kinetic limiting term fₖ₋ₛₒ₄ = SO₄ / (SO₄ + K_SO₄) # kinetic limiting term fₖ₋ₜₚₒ₄ = TPO₄ / (TPO₄ + K_TPO₄) # kinetic limiting term + fₖ₋cₕ₄ = CH₄ / (CH₄ + K_CH₄) # kinetic limiting term - RO₂ = max(0, Gi * (fT * kGi * fₒₓ * fₖ₋ₒ₂) * per_day_to_per_seconds) - RNO₃ = max(0, Gi * (fT * kGi * fₖ₋ₙₒ₃ * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₒ₂)) * per_day_to_per_seconds) - RNO₂ = max(0, Gi * (fT * kGi * fₖ₋ₙₒ₂ * (1 - fₖ₋ₒ₂)) * per_day_to_per_seconds) - RFe = max(0, Gi * (fT * kGi * fK_Fe * (1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₙₒ₂)) * per_day_to_per_seconds) - RSO₄ = max(0, Gi * (fT * kGi * fₖ₋ₛₒ₄ * (1 - fK_Fe) *(1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₙₒ₂)) * per_day_to_per_seconds) - RCH₄ = max(0, Gi * (fT * kGi * (1 - fₖ₋ₛₒ₄) * (1 - fK_Fe) *(1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₙₒ₂)) * per_day_to_per_seconds) + RO₂ = max(0, Gi * (fT * kGi * fₒₓ * fₖ₋ₒ₂))/day + RNO₂ = max(0, Gi * (fT * kGi * fₖ₋ₙₒ₂ * (1 - fₖ₋ₒ₂)))/day + RNO₃ = max(0, Gi * (fT * kGi * fₖ₋ₙₒ₃ * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₒ₂)))/day + RFe = max(0, Gi * (fT * kGi * fK_Fe * (1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₒ₂)))/day + RSO₄ = max(0, Gi * (fT * kGi * fₖ₋ₛₒ₄ * (1 - fK_Fe) *(1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₒ₂)))/day + RCH₄ = max(0, Gi * (fT * kGi * fₖ₋cₕ₄ * (1 - fₖ₋ₛₒ₄) * (1 - fK_Fe) *(1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₒ₂)))/day @@ -231,28 +233,28 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri @inline kamx = 2.7e4 # M-1 day-1 @inline kNH4ox = 2.7e4# M-1 day-1 @inline kNO2ox = 2.7e4 # M-1 day-1 - @inline kAOM = 0.27 # day-1 + @inline kAOM = 0.27e6 # day-1 @inline kH2Sox = 2.7e4 # M-1 day-1 @inline kFe2ox = 2.7e5 # M-1 day-1 @inline kFeS2ox = 2.7e3 # M-1 day-1 @inline kFeS2p = 2.7e4 # M-1 day-1 @inline kFe3red = 0.82e3 # cm1.5 mol−0.5 day−1 - R_DNRA = max(0, TH₂S * NO₃ * fT * kDNRA * per_day_to_per_seconds) - R_amx = max(0, NH₄ * NO₂ * fT * kamx * per_day_to_per_seconds) - R_NH4ox = max(0, NH₄ * O₂ * fT * kNH4ox * per_day_to_per_seconds) - R_NO2ox = max(0, NO₂ * O₂ * fT * kNO2ox * per_day_to_per_seconds) - R_AOM = max(0, CH₄ * SO₄ * fT * kAOM * per_day_to_per_seconds) - R_H2Sox = max(0, TH₂S * O₂ * fT * kH2Sox * per_day_to_per_seconds) - R_Fe2ox = max(0, Feᴵᴵ * O₂ * fT * kFe2ox * per_day_to_per_seconds) - R_FeS2ox = max(0, FeS₂ * O₂ * fT * kFeS2ox * per_day_to_per_seconds) - R_FeS2p = max(0, TH₂S * Feᴵᴵ * fT * kFeS2p * per_day_to_per_seconds) # H2 should be produced here but I assume it dissociates... - R_Fe3red = max(0, max(0, TH₂S) ^ 0.5 * FeOHP * fT * kFe3red * (2 / (O₂ + 2)) * per_day_to_per_seconds) + R_DNRA = max(0, TH₂S * NO₃ * fT * kDNRA)/day + R_amx = max(0, NH₄ * NO₂ * fT * kamx)/day + R_NH4ox = max(0, NH₄ * O₂ * fT * kNH4ox)/day + R_NO2ox = max(0, NO₂ * O₂ * fT * kNO2ox)/day + R_AOM = max(0, CH₄ * SO₄ * fT * kAOM)/day + R_H2Sox = max(0, TH₂S * O₂ * fT * kH2Sox)/day + R_Fe2ox = max(0, Feᴵᴵ * O₂ * fT * kFe2ox)/day + R_FeS2ox = max(0, FeS₂ * O₂ * fT * kFeS2ox)/day + R_FeS2p = max(0, TH₂S * Feᴵᴵ * fT * kFeS2p)/day # H2 should be produced here but I assume it dissociates... + R_Fe3red = max(0, max(0, TH₂S) ^ 0.5 * FeOHP * fT * kFe3red * (2 / (O₂ + 2)))/day #println(R_DNRA, " ", R_amx, " ", R_NH4ox, " ", R_NO2ox, " ", R_AOM, " ", R_H2Sox, " ", R_Fe2ox, " ", R_FeS2ox, " ", R_FeS2p, " ", R_Fe3red, " ") - if isnan(TPO₄) - sleep(10) - end + #if isnan(TPO₄) + # sleep(10) + #end @inline ratio_NC = 9.5/106 @inline ratio_PC = 1/106 @inline ratio_FeP = 0.1 @@ -275,7 +277,7 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri sediment_tendencies.SO₄[i, j, 1] = -0.5 * RSO₄ + R_DNRA - R_AOM + R_H2Sox + 2 * R_FeS2ox + (R_Fe3red / 8) sediment_tendencies.TH₂S[i, j, 1] = 0.5 * RSO₄ - R_DNRA + R_AOM - R_H2Sox - 2 * R_FeS2p - (R_Fe3red / 8) sediment_tendencies.CH₄[i, j, 1] = 0.5 * RCH₄ - R_AOM - println(4 * RFe - R_Fe2ox + R_FeS2ox - R_FeS2p + R_Fe3red) + println(sediment_tendencies.Feᴵᴵ[i, j, 1]) end end diff --git a/test/test_IronPhos.jl b/test/test_IronPhos.jl index 061adef57..6d7423ad9 100644 --- a/test/test_IronPhos.jl +++ b/test/test_IronPhos.jl @@ -57,7 +57,7 @@ set_defaults!(::VariableRedfieldLobster, model) = bottom_height(x, y) = -1000 + 500 * exp(- (x^2 + y^2) / 250) # a perfect hill -grid = RectilinearGrid(architecture; size=(3, 3, 50), extent=(10, 10, 500)) +grid = RectilinearGrid(architecture; size=(1, 1, 50), extent=(1, 1, 500)) sediment_model = IronPhosphate(; grid) biogeochemistry = LOBSTER(; grid, carbonates = true, From ec159392e1bc2aff7ad02434119a0a9347478588 Mon Sep 17 00:00:00 2001 From: louis Date: Fri, 26 Jul 2024 16:52:37 +0100 Subject: [PATCH 27/27] added comments --- src/Boundaries/Sediments/IronPhosphate.jl | 67 ++++++++++------------- test/test_IronPhos.jl | 27 +++++---- 2 files changed, 46 insertions(+), 48 deletions(-) diff --git a/src/Boundaries/Sediments/IronPhosphate.jl b/src/Boundaries/Sediments/IronPhosphate.jl index 89532a38d..c7f23a0e8 100644 --- a/src/Boundaries/Sediments/IronPhosphate.jl +++ b/src/Boundaries/Sediments/IronPhosphate.jl @@ -66,10 +66,9 @@ can be optionally specified. The model is a single layer (i.e. does not include porous diffusion) model with three classes of sediment organic matter which decay at three different rates (fast, slow, refactory). -The nitrification/denitrification/anoxic mineralisation fractions default to the parameterisation -of Soetaert et al. 2000; doi:[10.1016/S0012-8252(00)00004-0](https://doi.org/10.1016/S0012-8252(00)00004-0). +It is based on the equations and rate constants described in Dale et al, 2012 describing beggiatoa as a phosphate sink. -Additionally, Iron and Phosphate reactions are computed to adjust O2, NO3 and POC fluxes +Fluxes are set to be constant This model has not yet been validated or compared to observational data. The variety of degridation processes is likely to be strongly dependent on oxygen availability (see @@ -105,7 +104,7 @@ function IronPhosphate(; grid, solid_dep_params = on_architecture(architecture(grid), [0.233, 0.336, 982.0, - 1.548])) @warn "Sediment models are an experimental feature and have not yet been validated." - @info "This sediment model is currently only compatible with models providing NH₄, NO₃, O₂, and DIC." + @info "This sediment model is currently only compatible with models providing POC and Iron deposition fluxes." tracer_names = (:O₂, :NH₄, :NO₃, :NO₂, :N₂, :TPO₄, :FeOHP, :Feᴵᴵ, :FeS₂, :SO₄, :TH₂S, :CH₄, :TCO₂, :Gi) #:C_slow, :C_fast, :N_slow, :N_fast, :C_ref, :N_ref, :Fe_III, :Fe_II, :PO4_dissolved, :P_org) @@ -171,13 +170,17 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri Δz = zspacing(i, j, k, grid, Center(), Center(), Center()) @inbounds begin - oxygen_deposition = 0#oxygen_flux(i, j, k, grid, advection, bgc, tracers) * Δz + ##### + ##### Define incoming fluxes + ##### - POC_deposition = 0#5e-9 #carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz + oxygen_deposition = 0 #oxygen_flux(i, j, k, grid, advection, bgc, tracers) * Δz - iron_deposition = 0#5e-10 #carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz * (1/106) * 0.1 + POC_deposition = carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz + + iron_deposition = carbon_flux(i, j, k, grid, advection, bgc, tracers) * Δz * (1/106) * 0.1 - #(:O₂, :NH₄, :NO₃, :NO₂, :N₂, :TPO₄, :FeOHP, :Feᴵᴵ, :FeS₂, :SO₄, :TH₂S, :CH₄, :TCO₂, :Gi) + # define current tracer concentrations O₂ = sediment.fields.O₂[i, j, 1] NH₄ = sediment.fields.NH₄[i, j, 1] NO₃ = sediment.fields.NO₃[i, j, 1] @@ -189,13 +192,10 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri SO₄ = sediment.fields.SO₄[i, j, 1] TH₂S = sediment.fields.TH₂S[i, j, 1] CH₄ = sediment.fields.CH₄[i, j, 1] - Gi = sediment.fields.Gi[i, j, 1] + Gi = sediment.fields.Gi[i, j, 1] # the particulate matter debris - #println(FeOHP + FeS₂ + Feᴵᴵ) # iron is conserved - #println(2*FeS₂+SO₄+TH₂S) # sulfur is conserved - #saprintln(TPO₄) ##### - ##### RATES + ##### Calculate Rates of reactions ##### @inline K_O₂ = 1e-6 # M, Half–saturation constant for O2 @@ -205,12 +205,21 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri @inline K_SO₄ = 0.1e-6 # M, Half–saturation constant for SO4 @inline K_TPO₄ = 10e-6 # M, Half–saturation constant for TPO4 @inline K_CH₄ = 10e-6 # M, Half–saturation constant for TPO4 - #(:O₂, :NH₄, :NO₃, :NO₂, :N₂, :TPO₄, :FeOHP, :Feᴵᴵ, :FeS₂, :SO₄, :TH₂S, :CH₄, :TCO₂, :Gi) - + @inline kGi = 0.016 # day⁻¹, Rate constant for G0 degradation, Dale et al @inline fT = 1 # TODO temperature correction for rates @inline fₒₓ = 10 # Enhancement factor for POM degradation by O2 - @inline per_day_to_per_seconds = 1 / (60 * 60 * 24) + + @inline kDNRA = 2.7e5 # M-1 day-1 + @inline kamx = 2.7e4 # M-1 day-1 + @inline kNH4ox = 2.7e4# M-1 day-1 + @inline kNO2ox = 2.7e4 # M-1 day-1 + @inline kAOM = 0.27e6 # day-1 + @inline kH2Sox = 2.7e4 # M-1 day-1 + @inline kFe2ox = 2.7e5 # M-1 day-1 + @inline kFeS2ox = 2.7e3 # M-1 day-1 + @inline kFeS2p = 2.7e4 # M-1 day-1 + @inline kFe3red = 0.82e3 # cm1.5 mol−0.5 day−1 fₖ₋ₒ₂ = O₂ / (O₂ + K_O₂) # kinetic limiting term fₖ₋ₙₒ₃ = NO₃ / (NO₃ + K_NO₃) # kinetic limiting term @@ -227,19 +236,6 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri RSO₄ = max(0, Gi * (fT * kGi * fₖ₋ₛₒ₄ * (1 - fK_Fe) *(1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₒ₂)))/day RCH₄ = max(0, Gi * (fT * kGi * fₖ₋cₕ₄ * (1 - fₖ₋ₛₒ₄) * (1 - fK_Fe) *(1 - fₖ₋ₙₒ₃) * (1 - fₖ₋ₙₒ₂) * (1 - fₖ₋ₒ₂)))/day - - - @inline kDNRA = 2.7e5 # M-1 day-1 - @inline kamx = 2.7e4 # M-1 day-1 - @inline kNH4ox = 2.7e4# M-1 day-1 - @inline kNO2ox = 2.7e4 # M-1 day-1 - @inline kAOM = 0.27e6 # day-1 - @inline kH2Sox = 2.7e4 # M-1 day-1 - @inline kFe2ox = 2.7e5 # M-1 day-1 - @inline kFeS2ox = 2.7e3 # M-1 day-1 - @inline kFeS2p = 2.7e4 # M-1 day-1 - @inline kFe3red = 0.82e3 # cm1.5 mol−0.5 day−1 - R_DNRA = max(0, TH₂S * NO₃ * fT * kDNRA)/day R_amx = max(0, NH₄ * NO₂ * fT * kamx)/day R_NH4ox = max(0, NH₄ * O₂ * fT * kNH4ox)/day @@ -251,16 +247,12 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri R_FeS2p = max(0, TH₂S * Feᴵᴵ * fT * kFeS2p)/day # H2 should be produced here but I assume it dissociates... R_Fe3red = max(0, max(0, TH₂S) ^ 0.5 * FeOHP * fT * kFe3red * (2 / (O₂ + 2)))/day - #println(R_DNRA, " ", R_amx, " ", R_NH4ox, " ", R_NO2ox, " ", R_AOM, " ", R_H2Sox, " ", R_Fe2ox, " ", R_FeS2ox, " ", R_FeS2p, " ", R_Fe3red, " ") - #if isnan(TPO₄) - # sleep(10) - #end - @inline ratio_NC = 9.5/106 + @inline ratio_NC = 9.5/106 # redfield rations (almost) for sediment ratios of Gi @inline ratio_PC = 1/106 @inline ratio_FeP = 0.1 ##### - ##### sediment evolution + ##### calculate sediment evolution tendencies ##### sediment_tendencies.Gi[i, j, 1] = POC_deposition - RO₂ - RNO₃ - RNO₂ - RFe - RSO₄ - RCH₄ @@ -272,12 +264,11 @@ function _calculate_sediment_tendencies!(i, j, sediment::IronPhosphate, bgc, gri sediment_tendencies.N₂[i, j, 1] = R_amx + 0.66 * RNO₂ sediment_tendencies.TPO₄[i, j, 1] = ratio_PC * (RO₂ + RNO₃ + RNO₂ + RFe + RSO₄ + RCH₄) + RFe * ratio_FeP - ratio_FeP * R_Fe2ox * fₖ₋ₜₚₒ₄ + ratio_FeP * R_Fe3red # TODO P not conserved??? sediment_tendencies.FeOHP[i, j, 1] = iron_deposition - 4 * RFe + R_Fe2ox - R_Fe3red - sediment_tendencies.Feᴵᴵ[i, j, 1] = 4 * RFe - R_Fe2ox + R_FeS2ox - R_FeS2p + R_Fe3red + sediment_tendencies.Feᴵᴵ[i, j, 1] = 4 * RFe - R_Fe2ox + R_FeS2ox - R_FeS2p + R_Fe3red # why is this tending -ve? sediment_tendencies.FeS₂[i, j, 1] = R_FeS2p - R_FeS2ox sediment_tendencies.SO₄[i, j, 1] = -0.5 * RSO₄ + R_DNRA - R_AOM + R_H2Sox + 2 * R_FeS2ox + (R_Fe3red / 8) sediment_tendencies.TH₂S[i, j, 1] = 0.5 * RSO₄ - R_DNRA + R_AOM - R_H2Sox - 2 * R_FeS2p - (R_Fe3red / 8) - sediment_tendencies.CH₄[i, j, 1] = 0.5 * RCH₄ - R_AOM - println(sediment_tendencies.Feᴵᴵ[i, j, 1]) + sediment_tendencies.CH₄[i, j, 1] = 0.5 * RCH₄ - R_AOM # why is this tending -ve? end end diff --git a/test/test_IronPhos.jl b/test/test_IronPhos.jl index 6d7423ad9..40f8aac50 100644 --- a/test/test_IronPhos.jl +++ b/test/test_IronPhos.jl @@ -1,3 +1,7 @@ +##### +##### This isn't really a test but you can run this to see if sediment works :) +##### + include("dependencies_for_runtests.jl") using OceanBioME.Sediments: SimpleMultiG, InstantRemineralisation, IronPhosphate @@ -18,7 +22,7 @@ function intercept_tracer_tendencies!(model, intercepted_tendencies) end function set_defaults!(sediment::IronPhosphate) - set!(sediment.fields.O₂, 1e-6) + set!(sediment.fields.O₂, 1e-6) # defaults based of Dale et al and what looks realistic set!(sediment.fields.NH₄, 100e-6) set!(sediment.fields.NO₃, 6e-6) set!(sediment.fields.NO₂, 0.5e-6) @@ -34,8 +38,8 @@ function set_defaults!(sediment::IronPhosphate) set!(sediment.fields.Gi, 1e-6) end -set_defaults!(::VariableRedfieldLobster, model) = - set!(model, P = 0.4686, Z = 0.5363, +set_defaults!(::VariableRedfieldLobster, model) = + set!(model, P = 0.4686, Z = 0.5363, # dont think these really matter NO₃ = 2.3103, NH₄ = 0.0010, DIC = 2106.9, Alk = 2408.9, O₂ = 258.92, @@ -45,7 +49,7 @@ set_defaults!(::VariableRedfieldLobster, model) = #total_nitrogen(sed::SimpleMultiG) = sum(sed.fields.N_fast) + # sum(sed.fields.N_slow) + -# sum(sed.fields.N_ref) +# sum(sed.fields.N_ref) TODO add these back when the model doesnt explode #total_nitrogen(::VariableRedfieldLobster, model) = sum(model.tracers.NO₃) + # sum(model.tracers.NH₄) + @@ -55,6 +59,10 @@ set_defaults!(::VariableRedfieldLobster, model) = # sum(model.tracers.sPON) + # sum(model.tracers.bPON) +##### +##### Creates a the model and runs the simulation in a 1x1x50 grid (only top square represents the sediment) +##### + bottom_height(x, y) = -1000 + 500 * exp(- (x^2 + y^2) / 250) # a perfect hill grid = RectilinearGrid(architecture; size=(1, 1, 50), extent=(1, 1, 500)) @@ -90,12 +98,15 @@ simulation.callbacks[:intercept_tendencies] = Callback(intercept_tracer_tendenci run!(simulation) -var_name_example = keys(model.biogeochemistry.sediment.fields)[1] +##### +##### Plots all the tracers +##### + +var_name_example = keys(model.biogeochemistry.sediment.fields)[1] # grabs a random sediment to get times times = FieldTimeSeries("temp_plotting_data.jld2", "$var_name_example").times timeseries = NamedTuple{keys(model.biogeochemistry.sediment.fields)}(FieldTimeSeries("temp_plotting_data.jld2", "$field")[1, 1, 1, :] for field in keys(model.biogeochemistry.sediment.fields)) -# ## And plot using CairoMakie fig = Figure(size = (2400, 2400), fontsize = 24) @@ -112,7 +123,3 @@ for (name, tracer) in pairs(timeseries) end display(fig) - - - -@info "Success!" \ No newline at end of file