Skip to content

Commit

Permalink
Change deposition species
Browse files Browse the repository at this point in the history
  • Loading branch information
jialinl6 committed Oct 1, 2024
1 parent 382c6b1 commit d058416
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 34 deletions.
10 changes: 5 additions & 5 deletions docs/src/dry_deposition.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ model = DrydepositionG()
Before running any simulations with the model we need to convert it into a system of differential equations.
```julia
sys = structural_simplify(model)
tspan = (0.0, 3600*24)
u0 = [2.0,10.0,5,5,2.34,0.15,10] # initial concentrations of SO₂, O₃, NO₂, NO, H₂O₂, CH₂O, HNO₃
sol = solve(ODEProblem(sys, u0, tspan, []),AutoTsit5(Rosenbrock23()), saveat=10.0) # default parameters
tspan = (0.0, 3600*24)
prob = ODEProblem(sys, [], tspan, []) # default initial concentration of SO₂, O₃, NO₂, H₂O₂, HNO₃, CH₂O
sol = solve(prob,AutoTsit5(Rosenbrock23()), saveat=10.0) # default parameters
```

```@setup 1
Expand All @@ -36,8 +36,8 @@ model = DrydepositionG()
sys = structural_simplify(model)
tspan = (0.0, 3600*24)
u0 = [2.0,10.0,5,5,2.34,0.15,10] # initial concentrations of SO₂, O₃, NO₂, NO, H₂O₂, CH₂O, HNO₃
sol = solve(ODEProblem(sys, u0, tspan, []),AutoTsit5(Rosenbrock23()), saveat=10.0) # default parameters
prob = ODEProblem(sys, [], tspan, []) # default initial concentration of SO₂, O₃, NO₂, H₂O₂, HNO₃, CH₂O
sol = solve(prob,AutoTsit5(Rosenbrock23()), saveat=10.0) # default parameters
```

which we can plot as
Expand Down
3 changes: 1 addition & 2 deletions docs/src/emep.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ model = Wetdeposition()
sys = structural_simplify(model)
tspan = (0.0, 3600*24)
u0 = [2.0,10.0,5,1400,275,50,0.15,2.34,10,0.15] # initial concentration of SO₂, O₃, NO₂, CH₄, CO, DMS, ISOP, H₂O₂, HNO₃, CH₂O
prob = ODEProblem(sys, u0, tspan, [])
prob = ODEProblem(sys, [], tspan, []) # default initial concentration of SO₂, O₃, NO₂, H₂O₂, HNO₃, CH₂O
sol = solve(prob,AutoTsit5(Rosenbrock23()), saveat=10.0) # default parameters
```

Expand Down
5 changes: 0 additions & 5 deletions ext/GasChemExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ function EarthSciMLBase.couple2(c::GasChem.SuperFastCoupler, d::AtmosphericDepos
c.SO2 => d.SO2,
c.NO2 => d.NO2,
c.O3 => d.O3,
c.NO => d.NO,
c.H2O2 => d.H2O2,
c.CH2O => d.CH2O,
))
Expand All @@ -22,10 +21,6 @@ function EarthSciMLBase.couple2(c::GasChem.SuperFastCoupler, d::AtmosphericDepos
c.SO2 => d.SO2,
c.NO2 => d.NO2,
c.O3 => d.O3,
c.CH4 => d.CH4,
c.CO => d.CO,
c.DMS => d.DMS,
c.ISOP => d.ISOP,
c.H2O2 => d.H2O2,
c.CH2O => d.CH2O,
))
Expand Down
14 changes: 6 additions & 8 deletions src/dry_deposition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -254,20 +254,18 @@ function DrydepositionG(; name=:DrydepositionG)
D = Differential(t)

vars = @variables(
SO2(t), [unit = u"ppb"],
O3(t),[unit = u"ppb"],
NO2(t), [unit = u"ppb"],
NO(t), [unit = u"ppb"],
H2O2(t), [unit = u"ppb"],
CH2O(t), [unit = u"ppb"],
HNO3(t), [unit = u"ppb"],
SO2(t) = 2, [unit = u"ppb"],
O3(t) = 10,[unit = u"ppb"],
NO2(t) = 10, [unit = u"ppb"],
H2O2(t) = 2.34, [unit = u"ppb"],
CH2O(t) = 0.15, [unit = u"ppb"],
HNO3(t) = 10, [unit = u"ppb"],
)

eqs = [
D(SO2) ~ -DryDepGas(z, z₀, u_star, L, ρA, So2Data, G, T, θ, iSeason, iLandUse, rain, dew, true, false) / z * SO2
D(O3) ~ -DryDepGas(z, z₀, u_star, L, ρA, O3Data, G, T, θ, iSeason, iLandUse, rain, dew, false, true) / z * O3
D(NO2) ~ -DryDepGas(z, z₀, u_star, L, ρA, No2Data, G, T, θ, iSeason, iLandUse, rain, dew, false, false) / z * NO2
D(NO) ~ -DryDepGas(z, z₀, u_star, L, ρA, NoData, G, T, θ, iSeason, iLandUse, rain, dew, false, false) / z * NO
D(H2O2) ~ -DryDepGas(z, z₀, u_star, L, ρA, H2o2Data, G, T, θ, iSeason, iLandUse, rain, dew, false, false) / z * H2O2
D(CH2O) ~ -DryDepGas(z, z₀, u_star, L, ρA, HchoData, G, T, θ, iSeason, iLandUse, rain, dew, false, false) / z * CH2O
D(HNO3) ~ -DryDepGas(z, z₀, u_star, L, ρA, Hno3Data, G, T, θ, iSeason, iLandUse, rain, dew, false, false) / z * HNO3
Expand Down
20 changes: 6 additions & 14 deletions src/wet_deposition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,18 @@ function Wetdeposition(; name=:Wetdeposition)
D = Differential(t)

vars = @variables(
SO2(t), [unit = u"ppb"],
O3(t), [unit = u"ppb"],
NO2(t), [unit = u"ppb"],
CH4(t), [unit = u"ppb"],
CO(t), [unit = u"ppb"],
DMS(t), [unit = u"ppb"],
ISOP(t), [unit = u"ppb"],
H2O2(t), [unit = u"ppb"],
HNO3(t), [unit = u"ppb"],
CH2O(t), [unit = u"ppb"],
SO2(t) = 2, [unit = u"ppb"],
O3(t) = 10, [unit = u"ppb"],
NO2(t) = 10, [unit = u"ppb"],
H2O2(t) = 2.34, [unit = u"ppb"],
HNO3(t) = 10, [unit = u"ppb"],
CH2O(t) = 0.15, [unit = u"ppb"],
)

eqs = [
D(SO2) ~ -WetDeposition(cloudFrac, qrain, ρ_air, Δz)[2] * SO2
D(O3) ~ -WetDeposition(cloudFrac, qrain, ρ_air, Δz)[3] * O3
D(NO2) ~ -WetDeposition(cloudFrac, qrain, ρ_air, Δz)[3] * NO2
D(CH4) ~ -WetDeposition(cloudFrac, qrain, ρ_air, Δz)[3] * CH4
D(CO) ~ -WetDeposition(cloudFrac, qrain, ρ_air, Δz)[3] * CO
D(DMS) ~ -WetDeposition(cloudFrac, qrain, ρ_air, Δz)[3] * DMS
D(ISOP) ~ -WetDeposition(cloudFrac, qrain, ρ_air, Δz)[3] * ISOP
D(H2O2) ~ -WetDeposition(cloudFrac, qrain, ρ_air, Δz)[3] * H2O2
D(HNO3) ~ -WetDeposition(cloudFrac, qrain, ρ_air, Δz)[3] * HNO3
D(CH2O) ~ -WetDeposition(cloudFrac, qrain, ρ_air, Δz)[3] * CH2O
Expand Down

0 comments on commit d058416

Please sign in to comment.