From f435179a185c179791b52592436a8be9bc048d89 Mon Sep 17 00:00:00 2001 From: jialinl6 Date: Fri, 8 Mar 2024 00:10:36 -0600 Subject: [PATCH 1/4] Add extensions --- Project.toml | 9 ++++++++- ext/GasChemExt.jl | 9 +++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 ext/GasChemExt.jl diff --git a/Project.toml b/Project.toml index 491bb240..0eed6493 100644 --- a/Project.toml +++ b/Project.toml @@ -28,6 +28,13 @@ julia = "1" [extras] SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +GasChem = "58070593-4751-4c87-a5d1-63807d11d76c" [targets] -test = ["Test", "SafeTestsets"] +test = ["Test", "SafeTestsets", "GasChem"] + +[weakdeps] +GasChem = "58070593-4751-4c87-a5d1-63807d11d76c" + +[extensions] +GasChemExt = "GasChem" diff --git a/ext/GasChemExt.jl b/ext/GasChemExt.jl new file mode 100644 index 00000000..85029c32 --- /dev/null +++ b/ext/GasChemExt.jl @@ -0,0 +1,9 @@ +module GasChemExt + +Base.:(+)(w::Wetdeposition, b::SuperFast) = operator_compose(b, w) +Base.:(+)(b::SuperFast, w::Wetdeposition) = w + b + +Base.:(+)(d::DrydepositionG, b::SuperFast) = operator_compose(b, d) +Base.:(+)(b::SuperFast, d::DrydepositionG) = d + b + +end \ No newline at end of file From 03df01f1ac2f6e437e46c49e330417ac8ce1ff57 Mon Sep 17 00:00:00 2001 From: jialinl6 Date: Fri, 8 Mar 2024 01:01:51 -0600 Subject: [PATCH 2/4] Update extension module --- ext/GasChemExt.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/GasChemExt.jl b/ext/GasChemExt.jl index 85029c32..ec7177cc 100644 --- a/ext/GasChemExt.jl +++ b/ext/GasChemExt.jl @@ -1,5 +1,6 @@ module GasChemExt +using AtmosphericDeposition, GasChem Base.:(+)(w::Wetdeposition, b::SuperFast) = operator_compose(b, w) Base.:(+)(b::SuperFast, w::Wetdeposition) = w + b From 0ba32625e2788d8da0f99293c0d69b6b668c91d3 Mon Sep 17 00:00:00 2001 From: jialinl6 Date: Fri, 8 Mar 2024 01:10:04 -0600 Subject: [PATCH 3/4] Add documentation of connector and update GasChemExt.jl --- Project.toml | 3 ++- ext/GasChemExt.jl | 2 +- test/connector_test.jl | 12 ++++++++++++ test/runtests.jl | 4 ++++ 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 test/connector_test.jl diff --git a/Project.toml b/Project.toml index 0eed6493..7d8331be 100644 --- a/Project.toml +++ b/Project.toml @@ -29,9 +29,10 @@ julia = "1" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" GasChem = "58070593-4751-4c87-a5d1-63807d11d76c" +Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" [targets] -test = ["Test", "SafeTestsets", "GasChem"] +test = ["Test", "SafeTestsets", "GasChem", "Dates"] [weakdeps] GasChem = "58070593-4751-4c87-a5d1-63807d11d76c" diff --git a/ext/GasChemExt.jl b/ext/GasChemExt.jl index ec7177cc..c5d32041 100644 --- a/ext/GasChemExt.jl +++ b/ext/GasChemExt.jl @@ -1,6 +1,6 @@ module GasChemExt -using AtmosphericDeposition, GasChem +using AtmosphericDeposition, GasChem, EarthSciMLBase Base.:(+)(w::Wetdeposition, b::SuperFast) = operator_compose(b, w) Base.:(+)(b::SuperFast, w::Wetdeposition) = w + b diff --git a/test/connector_test.jl b/test/connector_test.jl new file mode 100644 index 00000000..b1c2a87d --- /dev/null +++ b/test/connector_test.jl @@ -0,0 +1,12 @@ +using AtmosphericDeposition +using Test, Unitful, ModelingToolkit, GasChem, Dates, EarthSciMLBase + +@testset "Connector" begin + ModelingToolkit.check_units(eqs...) = nothing + start = Dates.datetime2unix(Dates.DateTime(2016, 5, 1)) + @parameters t + composed_ode = SuperFast(t) + FastJX(t) + DrydepositionG(t) + Wetdeposition(t) + tspan = (start, start+3600*24*3) + sys = structural_simplify(get_mtk(composed_ode)) + @test length(states(sys)) ≈ 18 +end diff --git a/test/runtests.jl b/test/runtests.jl index c36e7f4f..17a51d03 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -13,4 +13,8 @@ using Test, SafeTestsets @safetestset "wetdep_test.jl" begin include("wetdep_test.jl") end + + @safetestset "connector_test.jl" begin + include("connector_test.jl") + end end \ No newline at end of file From b8645a748825c00ca35635dc4b45ef137e07ca1e Mon Sep 17 00:00:00 2001 From: jialinl6 Date: Fri, 8 Mar 2024 01:10:04 -0600 Subject: [PATCH 4/4] Add test for connector and update GasChemExt.jl --- Project.toml | 3 ++- ext/GasChemExt.jl | 2 +- test/connector_test.jl | 12 ++++++++++++ test/runtests.jl | 4 ++++ 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 test/connector_test.jl diff --git a/Project.toml b/Project.toml index 0eed6493..7d8331be 100644 --- a/Project.toml +++ b/Project.toml @@ -29,9 +29,10 @@ julia = "1" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" GasChem = "58070593-4751-4c87-a5d1-63807d11d76c" +Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" [targets] -test = ["Test", "SafeTestsets", "GasChem"] +test = ["Test", "SafeTestsets", "GasChem", "Dates"] [weakdeps] GasChem = "58070593-4751-4c87-a5d1-63807d11d76c" diff --git a/ext/GasChemExt.jl b/ext/GasChemExt.jl index ec7177cc..c5d32041 100644 --- a/ext/GasChemExt.jl +++ b/ext/GasChemExt.jl @@ -1,6 +1,6 @@ module GasChemExt -using AtmosphericDeposition, GasChem +using AtmosphericDeposition, GasChem, EarthSciMLBase Base.:(+)(w::Wetdeposition, b::SuperFast) = operator_compose(b, w) Base.:(+)(b::SuperFast, w::Wetdeposition) = w + b diff --git a/test/connector_test.jl b/test/connector_test.jl new file mode 100644 index 00000000..b1c2a87d --- /dev/null +++ b/test/connector_test.jl @@ -0,0 +1,12 @@ +using AtmosphericDeposition +using Test, Unitful, ModelingToolkit, GasChem, Dates, EarthSciMLBase + +@testset "Connector" begin + ModelingToolkit.check_units(eqs...) = nothing + start = Dates.datetime2unix(Dates.DateTime(2016, 5, 1)) + @parameters t + composed_ode = SuperFast(t) + FastJX(t) + DrydepositionG(t) + Wetdeposition(t) + tspan = (start, start+3600*24*3) + sys = structural_simplify(get_mtk(composed_ode)) + @test length(states(sys)) ≈ 18 +end diff --git a/test/runtests.jl b/test/runtests.jl index c36e7f4f..17a51d03 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -13,4 +13,8 @@ using Test, SafeTestsets @safetestset "wetdep_test.jl" begin include("wetdep_test.jl") end + + @safetestset "connector_test.jl" begin + include("connector_test.jl") + end end \ No newline at end of file