Skip to content

aerocm.climate_models.gwpstar_climate_model

This module contains the GWP* climate model implementation.

GWPStarClimateModel

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

Bases: ClimateModel

Class for the GWP* climate model implementation.

Notes

Reference: Lynch et al. (2020), https://doi.org/10.1088/1748-9326/ab6d7e

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 GWP* 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 climate model.

Source code in aerocm/climate_models/gwpstar_climate_model.py
 50
 51
 52
 53
 54
 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
 94
 95
 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
def run(self, return_df: bool = False) -> dict | pd.DataFrame:
    """Run the GWP* 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 climate model.
    """

    # --- Extract model settings ---
    tcre = self.model_settings["tcre"]

    # --- 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)

    # --- 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 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:
        radiative_forcing = sensitivity_rf * specie_inventory
        effective_radiative_forcing = radiative_forcing * ratio_erf_rf

        gwpstar_variation_duration = np.nan
        gwpstar_s_coefficient = np.nan

        if (
                specie_name == "Contrails"
                or specie_name == "NOx - ST O3 increase"
                or specie_name == "Soot"
                or specie_name == "Sulfur"
                or specie_name == "H2O"
        ):
            gwpstar_variation_duration = 6
            gwpstar_s_coefficient = 0.0

        elif specie_name == "NOx - CH4 decrease and induced":
            gwpstar_variation_duration = 20
            gwpstar_s_coefficient = 0.25

        equivalent_emissions = (
                gwpstar_equivalent_emissions_function(
                    start_year,
                    end_year,
                    emissions_erf=effective_radiative_forcing,
                    gwpstar_variation_duration=gwpstar_variation_duration,
                    gwpstar_s_coefficient=gwpstar_s_coefficient,
                )
                / 10 ** 12
        )  # Conversion from kgCO2-we to GtCO2-we

    cumulative_equivalent_emissions = np.zeros(len(specie_inventory))
    cumulative_equivalent_emissions[0] = equivalent_emissions[0]
    for k in range(1, len(cumulative_equivalent_emissions)):
        cumulative_equivalent_emissions[k] = (
                cumulative_equivalent_emissions[k - 1] + equivalent_emissions[k]
        )
    temperature = tcre * cumulative_equivalent_emissions * efficacy_erf

    # --- 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

gwpstar_equivalent_emissions_function

gwpstar_equivalent_emissions_function(start_year, end_year, emissions_erf, gwpstar_variation_duration, gwpstar_s_coefficient)

GWP* equivalent emissions function.

Parameters:

Name Type Description Default
start_year int

Start year of the simulation.

required
end_year int

End year of the simulation.

required
emissions_erf ndarray

Emissions effective radiative forcing profile.

required
gwpstar_variation_duration int

GWP* variation duration.

required
gwpstar_s_coefficient float

GWP* s coefficient.

required

Returns:

Name Type Description
emissions_equivalent_emissions ndarray

Emissions equivalent emissions profile.

Notes

Reference: Smith et al. (2021), https://doi.org/10.1038/s41612-021-00169-8

Source code in aerocm/climate_models/gwpstar_climate_model.py
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
def gwpstar_equivalent_emissions_function(
    start_year: int,
    end_year: int,
    emissions_erf: np.ndarray,
    gwpstar_variation_duration: int,
    gwpstar_s_coefficient: float,
):
    """GWP* equivalent emissions function.

    Parameters
    ----------
    start_year : int
        Start year of the simulation.
    end_year : int
        End year of the simulation.
    emissions_erf : np.ndarray
        Emissions effective radiative forcing profile.
    gwpstar_variation_duration : int
        GWP* variation duration.
    gwpstar_s_coefficient : float
        GWP* s coefficient.

    Returns
    -------
    emissions_equivalent_emissions : np.ndarray
        Emissions equivalent emissions profile.

    Notes
    -----
    Reference: Smith et al. (2021), https://doi.org/10.1038/s41612-021-00169-8
    """

    # Global
    climate_time_horizon = 100
    (
        agwp_rf_co2,
        agwp_erf_co2,
        aegwp_rf_co2,
        aegwp_erf_co2,
        agtp_co2,
        iagtp_co2,
        atr_co2,
    ) = co2_ipcc_pulse_absolute_metrics(climate_time_horizon)
    co2_agwp_h = agwp_rf_co2

    # g coefficient for GWP*
    if gwpstar_s_coefficient == 0:
        g_coefficient = 1
    else:
        g_coefficient = (
            1 - np.exp(-gwpstar_s_coefficient / (1 - gwpstar_s_coefficient))
        ) / gwpstar_s_coefficient

    # Main
    emissions_erf_variation = np.zeros(end_year - start_year + 1)
    for k in range(start_year, end_year + 1):
        if k - start_year >= gwpstar_variation_duration:
            emissions_erf_variation[k - start_year] = (
                emissions_erf[k - start_year]
                - emissions_erf[k - gwpstar_variation_duration - start_year]
            ) / gwpstar_variation_duration
        else:
            emissions_erf_variation[k - start_year] = (
                emissions_erf[k - start_year] / gwpstar_variation_duration
            )
    emissions_equivalent_emissions = np.zeros(end_year - start_year + 1)
    for k in range(start_year, end_year + 1):
        emissions_equivalent_emissions[k - start_year] = (
            g_coefficient
            * (1 - gwpstar_s_coefficient)
            * climate_time_horizon
            / co2_agwp_h
            * emissions_erf_variation[k - start_year]
        ) + g_coefficient * gwpstar_s_coefficient / co2_agwp_h * emissions_erf[
            k - start_year
        ]

    return emissions_equivalent_emissions