Skip to content

aerocm.climate_models.ipcc_climate_model

This module contains the IPCC climate model implementation.

IPCCClimateModel

IPCCClimateModel(start_year, end_year, specie_name, specie_inventory, specie_settings, model_settings)

Bases: ClimateModel

Class for the IPCC climate model implementation.

Notes

References: - Myhre et al. (2013). https://doi.org/10.1017/CBO9781107415324.018 - Forster et al. (2021). https://doi.org/10.1017/9781009157896.009

Source code in aerocm/utils/classes.py
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
def __init__(
    self,
    start_year: int,
    end_year: int,
    specie_name: str,
    specie_inventory: list | np.ndarray,
    specie_settings: dict,
    model_settings: dict,
):
    """Initialize the climate model with the provided settings.

    Parameters
    ----------
    start_year : int
        Start year of the simulation.
    end_year : int
        End year of the simulation.
    specie_name : str
        Name of the species.
    specie_inventory : list or np.ndarray
        Emission profile for the species.
    specie_settings : dict
        Dictionary containing species settings.
    model_settings : dict
        Dictionary containing model settings.
    """

    # --- Validate parameters ---
    self.validate_model_settings(model_settings)
    self.validate_specie_settings(specie_name, specie_settings)
    self.validate_inventory(start_year, end_year, specie_inventory)

    # --- Store parameters ---
    self.start_year = start_year
    self.end_year = end_year
    self.specie_name = specie_name
    self.specie_inventory = specie_inventory
    self.specie_settings = specie_settings
    self.model_settings = model_settings

run

run(return_df=False)

Run the IPCC climate model with the assigned input data.

Parameters:

Name Type Description Default
return_df bool

If True, returns the results as a pandas DataFrame, by default False.

False

Returns:

Name Type Description
output_data dict

Dictionary containing the results of the LWE climate model.

Source code in aerocm/climate_models/ipcc_climate_model.py
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
def run(self, return_df: bool = False) -> dict | pd.DataFrame:
    """Run the IPCC climate model with the assigned input data.

    Parameters
    ----------
    return_df : bool, optional
        If True, returns the results as a pandas DataFrame, by default False.

    Returns
    -------
    output_data : dict
        Dictionary containing the results of the LWE climate model.
    """

    # --- Extract species settings ---
    sensitivity_rf = self.specie_settings.get("sensitivity_rf", None)
    ratio_erf_rf = self.specie_settings["ratio_erf_rf"]
    efficacy_erf = self.specie_settings.get("efficacy_erf", 1.0)
    ch4_change_per_species = self.specie_settings.get(
        "ch4_change_per_species", 0.0
    )  # only for NOx/H2 leakage - CH4 and induced

    # --- Extract simulation settings ---
    start_year = self.start_year
    end_year = self.end_year
    specie_name = self.specie_name
    specie_inventory = self.specie_inventory
    years = list(range(start_year, end_year + 1))

    # --- Run the IPCC climate model ---
    if specie_name == "CO2":
        equivalent_emissions = (
            specie_inventory / 10**12
        )  # Conversion from kgCO2 to GtCO2

        co2_molar_mass = 44.01 * 1e-3  # [kg/mol]
        air_molar_mass = 28.97e-3  # [kg/mol]
        atmosphere_total_mass = 5.1352e18  # [kg]
        radiative_efficiency = (
            1.33e-5  # radiative efficiency [W/m^2/ppb] with AR6 value
        )
        A_co2_unit = (
            radiative_efficiency
            * 1e9
            * air_molar_mass
            / (co2_molar_mass * atmosphere_total_mass)
        )  # RF per unit mass increase in atmospheric abundance of CO2 [W/m^2/kg]

        A_co2 = A_co2_unit * specie_inventory
        a = [0.2173, 0.2240, 0.2824, 0.2763]
        tau = [0, 394.4, 36.54, 4.304]

        radiative_forcing_from_year = np.zeros(
            (len(specie_inventory), len(specie_inventory))
        )
        # Radiative forcing induced in year j by the species emitted in year i
        for i in range(0, len(specie_inventory)):
            for j in range(0, len(specie_inventory)):
                if i <= j:
                    radiative_forcing_from_year[i, j] = A_co2[i] * a[0]
                    for k in [1, 2, 3]:
                        radiative_forcing_from_year[i, j] += (
                            A_co2[i] * a[k] * np.exp(-(j - i) / tau[k])
                        )
        radiative_forcing = np.zeros(len(specie_inventory))
        for k in range(0, len(specie_inventory)):
            radiative_forcing[k] = np.sum(radiative_forcing_from_year[:, k])
        effective_radiative_forcing = radiative_forcing * ratio_erf_rf

    else:
        if (
            specie_name == "NOx - CH4 and induced"
            or specie_name == "H2 leakage - CH4 and induced"
        ):
            min_year = min(start_year, 1939)
            max_year = max(end_year, 2051)
            tau_reference_year = [min_year, 1940, 1980, 1994, 2004, 2050, max_year]
            tau_reference_values = [11, 11, 10.1, 10, 9.85, 10.25, 10.25]
            tau_function = interp1d(
                tau_reference_year, tau_reference_values, kind="linear"
            )
            years = list(range(start_year, end_year + 1))
            tau = tau_function(years)
            ch4_molar_mass = 16.04e-3  # [kg/mol]
            air_molar_mass = 28.97e-3  # [kg/mol]
            atmosphere_total_mass = 5.1352e18  # [kg]
            radiative_efficiency = 3.454545e-4  # radiative efficiency [W/m^2/ppb] with AR6 value (5.7e-4) without indirect effects
            A_CH4_unit = (
                radiative_efficiency
                * 1e9
                * air_molar_mass
                / (ch4_molar_mass * atmosphere_total_mass)
            )  # RF per unit mass increase in atmospheric abundance of CH4 [W/m^2/kg]
            A_CH4 = A_CH4_unit * ch4_change_per_species * specie_inventory
            f1 = 0.5  # Indirect effect on ozone
            f2 = 0.15  # Indirect effect on stratospheric water
            radiative_forcing_from_year = np.zeros(
                (len(specie_inventory), len(specie_inventory))
            )
            # Radiative forcing induced in year j by the species emitted in year i
            for i in range(0, len(specie_inventory)):
                for j in range(0, len(specie_inventory)):
                    if i <= j:
                        radiative_forcing_from_year[i, j] = (
                            (1 + f1 + f2) * A_CH4[i] * np.exp(-(j - i) / tau[j])
                        )
            radiative_forcing = np.zeros(len(specie_inventory))
            for k in range(0, len(specie_inventory)):
                radiative_forcing[k] = np.sum(radiative_forcing_from_year[:, k])
            effective_radiative_forcing = radiative_forcing * ratio_erf_rf

        else:
            radiative_forcing = sensitivity_rf * specie_inventory
            effective_radiative_forcing = radiative_forcing * ratio_erf_rf

    ## Temperature
    temperature = np.zeros(len(effective_radiative_forcing))
    c = [0.631, 0.429]
    d = [8.4, 409.5]

    if specie_name == "CO2":
        for k in range(0, len(temperature)):
            for ki in range(0, k + 1):
                term = 0
                for j in [0, 1]:
                    term += a[0] * c[j] * (1 - np.exp((ki - k) / d[j]))
                    for i in [1, 2, 3]:
                        term += (
                            a[i]
                            * tau[i]
                            * c[j]
                            / (tau[i] - d[j])
                            * (np.exp((ki - k) / tau[i]) - np.exp((ki - k) / d[j]))
                        )
                temperature[k] += A_co2[ki] * term
    elif (
        specie_name == "NOx - CH4 and induced"
        or specie_name == "H2 leakage - CH4 and induced"
    ):
        for k in range(0, len(temperature)):
            for ki in range(0, k + 1):
                term = 0
                for j in [0, 1]:
                    term += (
                        tau[k]
                        * c[j]
                        / (tau[k] - d[j])
                        * (np.exp((ki - k) / tau[k]) - np.exp((ki - k) / d[j]))
                    )
                temperature[k] += efficacy_erf * (1 + f1 + f2) * A_CH4[ki] * term
    else:
        tau = 1
        for k in range(0, len(temperature)):
            for ki in range(0, k + 1):
                term = 0
                for j in [0, 1]:
                    term += (
                        tau
                        * c[j]
                        / (tau - d[j])
                        * (np.exp((ki - k) / tau) - np.exp((ki - k) / d[j]))
                    )
                temperature[k] += (
                    efficacy_erf * effective_radiative_forcing[ki] * term
                )

    # --- Prepare output ---
    output_data = {
        "radiative_forcing": radiative_forcing,
        "effective_radiative_forcing": effective_radiative_forcing,
        "temperature": temperature,
    }

    if return_df:
        output_data = pd.DataFrame(output_data, index=years)
        output_data.index.name = "Year"

    return output_data