Skip to content

Commit

Permalink
Update Emission unit test & delete system name GasChem+
Browse files Browse the repository at this point in the history
  • Loading branch information
jialinl6 committed Jul 10, 2024
1 parent 9379cdd commit e8fc4db
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/Fast-JX.jl
Original file line number Diff line number Diff line change
Expand Up @@ -173,5 +173,5 @@ function FastJX(t)
j_NO2 ~ j_mean_NO2(t*j_unit, lat, long, T) * j_unit
]

ODESystem(eqs, t, [j_h2o2, j_CH2Oa, j_o31D, j_CH3OOH, j_NO2], [lat, long, j_unit, T]; name=:GasChem₊fastjx)
ODESystem(eqs, t, [j_h2o2, j_CH2Oa, j_o31D, j_CH3OOH, j_NO2], [lat, long, j_unit, T]; name=:fastjx)
end
2 changes: 1 addition & 1 deletion src/SuperFast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,5 @@ function SuperFast(t)
#OH + CO = HO2
Reaction(k19 * c, [OH, CO], [HO2], [1, 1], [1])
]
rxn_sys = ReactionSystem(rxs, t; combinatoric_ratelaws=false, name=:GasChem₊superfast)
rxn_sys = ReactionSystem(rxs, t; combinatoric_ratelaws=false, name=:superfast)
end
2 changes: 1 addition & 1 deletion src/geoschem_fullchem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1710,5 +1710,5 @@ function GEOSChemGasPhase(t)
j_166, NPHEN --> HNO2 + CO + CO2 + AROMP4 + HO2 #==2021/09/29; Bates2021b; KHB,MSL==#
end
rxn_sys = compose(rxn_sys, rate_systems)
sys = convert(ODESystem, rxn_sys, combinatoric_ratelaws=false, name=:GasChem₊GEOSChemGasPhase)
sys = convert(ODESystem, rxn_sys, combinatoric_ratelaws=false, name=:GEOSChemGasPhase)
end
9 changes: 4 additions & 5 deletions test/Emission_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ using Test, Dates, ModelingToolkit, DifferentialEquations, EarthSciMLBase, Unitf

sys = structural_simplify(get_mtk(model_3way))
@test length(states(sys)) 18

start = Dates.datetime2unix(Dates.DateTime(2016, 5, 1))
tspan = (start, start+24*3600)
sol_3way = solve(ODEProblem(sys, [], tspan, []), AutoTsit5(Rosenbrock23()))
@test sol_3way[1,end] 2479.8538498918574

eqs = string(equations(sys))
wanteqs = ["Differential(t)(superfast₊CH2O(t)) ~ superfast₊NEI2016MonthlyEmis_mrggrid_withbeis_withrwc₊FORM(t)"]
@test contains(string(eqs), wanteqs[1])
end
10 changes: 5 additions & 5 deletions test/geoschem_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ end

eqs = string(equations(gf))

wanteqs = ["GasChem₊GEOSChemGasPhase₊j_9(t) ~ uconv*GasChem₊fastjx₊j_h2o2(t)",
"GasChem₊GEOSChemGasPhase₊j_7(t) ~ uconv*GasChem₊fastjx₊j_CH2Oa(t)",
"GasChem₊GEOSChemGasPhase₊j_10(t) ~ uconv*GasChem₊fastjx₊j_CH3OOH(t)",
"GasChem₊GEOSChemGasPhase₊j_11(t) ~ uconv*GasChem₊astjx₊j_NO2(t)",
"GasChem₊GEOSChemGasPhase₊j_3(t) ~ c_fixme1*GasChem₊fastjx₊j_o31D(t)"]
wanteqs = ["GEOSChemGasPhase₊j_9(t) ~ uconv*fastjx₊j_h2o2(t)",
"GEOSChemGasPhase₊j_7(t) ~ uconv*fastjx₊j_CH2Oa(t)",
"GEOSChemGasPhase₊j_10(t) ~ uconv*fastjx₊j_CH3OOH(t)",
"GEOSChemGasPhase₊j_11(t) ~ uconv*fastjx₊j_NO2(t)",
"GEOSChemGasPhase₊j_3(t) ~ c_fixme1*fastjx₊j_o31D(t)"]
for eq in wanteqs
@test contains(string(eqs), wanteqs[1])
end
Expand Down

0 comments on commit e8fc4db

Please sign in to comment.