Skip to content

Commit

Permalink
Merge pull request #36 from jialinl6/Fix22
Browse files Browse the repository at this point in the history
Add superfast connectors as an extension
  • Loading branch information
ctessum authored Mar 11, 2024
2 parents e9fc542 + 6233dde commit 226004d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ julia = "1"
[extras]
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"]
test = ["Test", "SafeTestsets", "GasChem", "Dates"]

[weakdeps]
GasChem = "58070593-4751-4c87-a5d1-63807d11d76c"

[extensions]
GasChemExt = "GasChem"
10 changes: 10 additions & 0 deletions ext/GasChemExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module GasChemExt

using AtmosphericDeposition, GasChem, EarthSciMLBase
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
12 changes: 12 additions & 0 deletions test/connector_test.jl
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 226004d

Please sign in to comment.