Skip to content

Commit fdad09b

Browse files
authored
Merge pull request #28 from FrankErrickson/oxidised_methane
Update CH4 to CO2 oxidation equation
2 parents a6a1796 + 7f2d6be commit fdad09b

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/MimiFAIR.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ function get_model(;rcp_scenario::String="RCP85", start_year::Int=1765, end_year
9292
set_param!(m, :ch4_cycle, :fossil_frac, gas_fractions.ch4_fossil)
9393
set_param!(m, :ch4_cycle, :oxidation_frac, 0.61)
9494
set_param!(m, :ch4_cycle, :mol_weight_CH₄, gas_data[gas_data.gas .== "CH4", :mol_weight][1])
95-
set_param!(m, :ch4_cycle, :mol_weight_CO₂, gas_data[gas_data.gas .== "CO2", :mol_weight][1])
95+
set_param!(m, :ch4_cycle, :mol_weight_C, gas_data[gas_data.gas .== "C", :mol_weight][1])
9696
set_param!(m, :ch4_cycle, :emiss2conc_ch4, conversions[conversions.gases .== "CH4", :emiss2conc][1])
9797

9898
# ---- Nitrous Oxide Cycle ---- #
@@ -110,7 +110,6 @@ function get_model(;rcp_scenario::String="RCP85", start_year::Int=1765, end_year
110110
set_param!(m, :co2_cycle, :a, [0.2173, 0.2240, 0.2824, 0.2763])
111111
set_param!(m, :co2_cycle, :τ_CO₂, [10.0^6, 394.4, 36.54, 4.304])
112112
set_param!(m, :co2_cycle, :E, rcp_emissions.FossilCO2 .+ rcp_emissions.OtherCO2)
113-
set_param!(m, :co2_cycle, :gtc2ppm, conversions[conversions.gases .== "CO2", :emiss2conc][1])
114113

115114
# ---- Other Well-Mixed Greenhouse Gas Cycles ---- #
116115
set_param!(m, :other_ghg_cycles, :τ_other_ghg, gas_data[findall((in)(other_ghg_names), gas_data.gas), :lifetimes])
@@ -223,6 +222,7 @@ function get_model(;rcp_scenario::String="RCP85", start_year::Int=1765, end_year
223222
set_param!(m, :NOx_emiss, rcp_emissions.NOx)
224223
set_param!(m, :fix_pre1850_RCP, true)
225224
set_param!(m, :mol_weight_N, gas_data[gas_data.gas .== "N", :mol_weight][1])
225+
set_param!(m, :gtc2ppm, conversions[conversions.gases .== "CO2", :emiss2conc][1])
226226

227227
# ---------------------------------------------
228228
# Create connections between Mimi components.

src/components/ch4_cycle.jl

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,37 @@
66

77
emiss2conc_ch4 = Parameter() # Conversion between ppb/ppt concentrations and Mt/kt emissions.
88
CH₄_0 = Parameter() # Initial (pre-industrial) atmospheric methane concentration (ppb).
9-
τ_CH₄ = Parameter() # Atmospheric (e-folding) lifetime of methane.
9+
τ_CH₄ = Parameter() # Atmospheric (e-folding) lifetime of methane.
10+
gtc2ppm = Parameter() # Conversion factor between GtC and ppm.
1011
oxidation_frac = Parameter() # Fraction of methane lost through reaction with hydroxyl radical that is converted to carbon dioxide.
1112
mol_weight_CH₄ = Parameter() # Molecular mass of methane.
12-
mol_weight_CO₂ = Parameter() # Molecular mass of carbon dioxide.
13+
mol_weight_C = Parameter() # Molecular mass of carbon.
1314
fossil_emiss_CH₄ = Parameter(index=[time]) # Fossil-fuel methane emissions (Mt CH₄ yr⁻¹).
1415
natural_emiss_CH₄ = Parameter(index=[time]) # Natural methane emissions (Mt CH₄ yr⁻¹).
1516
fossil_frac = Parameter(index=[time]) # Fraciton of anthropogenic methane attributable to fossil sources.
1617

17-
CH₄ = Variable(index=[time]) # Atmospheric methane concentration (ppb).
18-
oxidised_CH₄ = Variable(index=[time]) # Methane that has been oxidized to carbon dioxide.
19-
18+
CH₄ = Variable(index=[time]) # Atmospheric methane concentration (ppb).
19+
oxidised_CH₄ = Variable(index=[time]) # Methane that has been oxidized to carbon dioxide (ppb).
20+
oxidised_CH₄_GtC = Variable(index=[time]) # Methane that has been oxidized to carbon dioxide (GtC)
2021

2122
function run_timestep(p, v, d, t)
2223

2324
# Set initial methane concentration values.
2425
if is_first(t)
2526
v.CH₄[t] = p.CH₄_0
2627
v.oxidised_CH₄[t] = 0.0
28+
v.oxidised_CH₄_GtC[t] = 0.0
2729
else
2830
# Calculate atmospheric methane concentration.
2931
emiss_prev = p.fossil_emiss_CH₄[t-1] + p.natural_emiss_CH₄[t]
3032
emiss_curr = p.fossil_emiss_CH₄[t] + p.natural_emiss_CH₄[t]
3133
v.CH₄[t] = v.CH₄[t-1] - v.CH₄[t-1] * (1.0 - exp(-1/p.τ_CH₄)) + 0.5 * (emiss_prev + emiss_curr) * (1.0/p.emiss2conc_ch4)
3234

3335
# Calculate carbon dioxide from oxidized methane (bounded below at 0.0).
34-
v.oxidised_CH₄[t] = max(((v.CH₄[t-1]-p.CH₄_0) * (1.0 - exp(-1.0/p.τ_CH₄)) * (p.mol_weight_CO₂/p.mol_weight_CH₄ * 0.001 * p.oxidation_frac * p.fossil_frac[t])), 0.0)
36+
v.oxidised_CH₄[t] = max(((v.CH₄[t-1]-p.CH₄_0) * (1.0 - exp(-1.0/p.τ_CH₄)) * (p.mol_weight_C/p.mol_weight_CH₄ * 0.001 * p.oxidation_frac * p.fossil_frac[t])), 0.0)
37+
38+
# Also provide oxidised CH₄ in units of GtC.
39+
v.oxidised_CH₄_GtC[t] = v.oxidised_CH₄[t] * p.gtc2ppm
3540
end
3641
end
3742
end

0 commit comments

Comments
 (0)