Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New MACCs realization #442

Merged
merged 24 commits into from
Sep 23, 2022
Merged

New MACCs realization #442

merged 24 commits into from
Sep 23, 2022

Conversation

bodirsky
Copy link
Member

@bodirsky bodirsky commented Aug 29, 2022

🐦 Purpose of this PR 🐦

  • New MACCs realization

The previous model version had two shortcomings:
a) The marginal abatement cost curves (MACCs) did reduce N2O emissions, but without changing the nitrogen cycle. In reality, most of the measures within the MACCs actually achieve a reduction of N2O emissions by improving nitrogen use efficiency (NUE), and therfore change the entire nitrogen cycle, including also other N-related pollutants.
b) The MACCs were subject to a potential double accounting in case the NUE was increased.
c) The emission factors of IPCC were based on the inputs, not on the losses. So, even in case of a 100% NUE when there can be by definition no emissions, soil emissions where still there, because also under a NUE of 100%, the nutrients removed by the harvest have to be replaced. The mitigation potential was therefore underestimated.
d) The scenarios of the NUE assumed a globaly uniform target value. That usually implied that NUEs fall slightly in HICs, while they rise rapidly in countries with low efficiencies (like China). This may be unrealistic.

The new PR solves a) and b) and uses the already existing "rescaled" implementation (non-default, but by now frequently tested) to achieve c). d) is achieved via new scenarios. A new set of scenarios now lead to less of decline in HICs and strong but slower improvements in countries with low efficiencies.
a) is solved by wiring the MACCs to the NUE. We transform the MACCs to an implementation that changes NUE in such a way that the change in NUE results in the same decline of emissions as the MACCs under the conditions of an NUE of 50% (global average). In case of a higher baseline NUE, they however result in a lower mitigation potential (as less of the losses can be reduced by these emissions. The formula is Losses = (1-NUE) = (1-NUE_base)(1-MACCs)
b) The formula Losses = (1-NUE) = (1-NUE_base)
(1-MACCs) also takes care of the double accounting. It still assumes that the measures in the MACCs have an effect, yet this effect is reduced the higher the baseline NUE is. This means however, that the baseline NUEs have to be chosen more conservatively; i therefore included a number of new scenarios, which result in a comparable NUE as previous implementations only if they are combined with the MACCs.

The interfaces between the models was changed. Previous implementations were using the vm_btm_reg, so the emissions before technical mitigation, which were then translated into final emissions in the GHG policy module. In the new implementation, vm_btm_reg is abolished, and the MACCs are applied directly in the emisssions modules. This simplifies code, and allows for different MACCs implementations in different emission module realizations.

Results for the 5 SSPs with the new implementation are called maccs_test_v10

Results differ in terms of N2O emissions. In general they are lower, because NUE has improved in many world regions and the new implementation accounts for this. They are in particular lower in Europe and the USA, and higher in China. This is intended outcome.

Results also differ in terms of nitrogen cycle. Air pollutants and nitrate are now reduced in mitigation scenarios. Fertilizer application as well. This is also intended.

Old module realizations were removed. Otherwise, the change of interface from vm_btm_reg to vm_emissions_reg would not have been possible without inconsistencies.

🔧 Checklist for PR creator 🔧

  • Low risk : Simple bugfixes (missing files, updated documentation, typos) or Start/output scripts
  • Medium risk : New realization / Changes to existing realization / Other changes which don't modify default.cfg
  • High risk : New input files (if cfg$input is changed in default.cfg) / Modification to core model (eg. changes in equations, calculations, introduction of new sets etc.) / Other changes in default.cfg
  • [X ] Providing additional information based on PR label
  • Low risk : No new model run needed.
  • Medium risk : Default run based on the current version of the fork from which PR is made
  • High risk
    • Default run from the current develop branch
    • Default run based on the current version of the fork from which PR is made
  • 📉 Performance loss/gain from current default behavior 📈
    no significant change in runtime

grafik

  • [X ] Added changes to CHANGELOG.md
  • [X ] Compilation check (model starts without compilation errors - use gams main.gms action=c in model folder for testing).
  • [ X] No hard coded numbers and cluster/country/region names.
  • [ X] The new code doesn't contain declared but unused parameters or variables.
  • [ X] Where relevant, In-code comments added including documentation comments.
  • Made sure that documentation created with goxygen is okay (use goxygen::goxygen() for testing).
  • Changes to magpie4 R library for post processing of model output (ideally backward compatible).
  • [ X] Self-review of my own code.
  • In case of updated cellular input tgz file in default.cfg: scenario_config.csv has been updated accordingly (rcp1p9, rcp2p6 etc)
  • For high risk runs: validation of major model indicators - Land-use, emissions, food prices, Tau. %Delete this line in case it is not a high risk run%

⚠️ Additional notes or warnings ⚠️

NA

🚨 Checklist for RSE reviewer 🚨

  • PR is labeled correctly.
  • CHANGELOG is updated correctly
  • No hard coded numbers and cluster/country/region names.
  • No unnecessary increase in module interfaces
  • All required updates in interfaces (if any) have been properly adressed in the module contracts
  • In-code comments and documentation comments are satisfactory.
  • model behavior/performance is satisfactory.
  • Requested changes (if any) were applied correctly

🚨 Checklist for MAgPIE reviewer 🚨

  • PR is labeled correctly.
  • CHANGELOG is updated correctly
  • No hard coded numbers and cluster/country/region names.
  • Changes to the model are scientifically sound
  • In-code comments and documentation comments are satisfactory.
  • model behavior/performance is satisfactory.
  • Requested changes (if any) were applied correctly

moving MACCs out of GHG policy module and into emission modules
@bodirsky bodirsky changed the title Develop New MACCs realization Aug 29, 2022
@bodirsky bodirsky changed the base branch from master to develop August 29, 2022 09:03
@flohump flohump added Major Substantial modifications High risk Higher risk labels Aug 29, 2022
@bodirsky bodirsky self-assigned this Aug 30, 2022
Copy link
Contributor

@flohump flohump left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for these improvements!
As far as I can judge, your suggestions make sense content-wise.
Please add a summary of changes to the changelog file.
There seem to be left-over files from deleted module realizations. Please clean up.

config/scenario_config.csv Outdated Show resolved Hide resolved
modules/50_nr_soil_budget/macceff_aug22/presolve.gms Outdated Show resolved Hide resolved
modules/50_nr_soil_budget/macceff_aug22/presolve.gms Outdated Show resolved Hide resolved
modules/53_methane/ipcc2006_aug22/equations.gms Outdated Show resolved Hide resolved
modules/57_maccs/on_aug22/equations.gms Show resolved Hide resolved
modules/57_maccs/on_aug22/preloop.gms Show resolved Hide resolved
modules/58_peatland/off/preloop.gms Outdated Show resolved Hide resolved
scripts/output/extra/highres.R Outdated Show resolved Hide resolved
scripts/output/projects/FSDP_collect.R Outdated Show resolved Hide resolved
scripts/projects/fsec.R Outdated Show resolved Hide resolved
Copy link
Member

@tscheypidi tscheypidi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. Just see the few requests for changes I made and in addition update CHANGELOG.md as also requested by Florian

config/default.cfg Outdated Show resolved Hide resolved
config/default.cfg Show resolved Hide resolved
modules/42_water_demand/agr_sector_aug13/input.gms Outdated Show resolved Hide resolved
modules/50_nr_soil_budget/macceff_aug22/presolve.gms Outdated Show resolved Hide resolved
@flohump
Copy link
Contributor

flohump commented Sep 1, 2022

We also need to adjust this function in the magpie4 R library. The output is used by REMIND.
https://github.com/pik-piam/magpie4/blob/master/R/EmissionsBeforeTechnicalMitigation.R
I will coordinate with @bodirsky .

@flohump
Copy link
Contributor

flohump commented Sep 2, 2022

We also need to adjust this function in the magpie4 R library. The output is used by REMIND.
https://github.com/pik-piam/magpie4/blob/master/R/EmissionsBeforeTechnicalMitigation.R
I will coordinate with @bodirsky .

I updated the function such that it works with the model version in this PR as well as with the current develop.
https://github.com/pik-piam/magpie4/blob/master/R/EmissionsBeforeTechnicalMitigation.R

Copy link
Contributor

@flohump flohump left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!
I added some minor suggestions, mostly spelling corrections.

config/default.cfg Outdated Show resolved Hide resolved
config/default.cfg Outdated Show resolved Hide resolved
modules/42_water_demand/agr_sector_aug13/input.gms Outdated Show resolved Hide resolved
modules/57_maccs/on_aug22/preloop.gms Outdated Show resolved Hide resolved
Copy link
Member

@tscheypidi tscheypidi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove the PIK specific descriptions and check whether the RCP change in inputs is intended. Otherwise, looks good to me

config/default.cfg Outdated Show resolved Hide resolved
config/default.cfg Outdated Show resolved Hide resolved
bodirsky and others added 9 commits September 23, 2022 10:19
Co-authored-by: Florian Humpenöder <humpenoeder@pik-potsdam.de>
Co-authored-by: Florian Humpenöder <humpenoeder@pik-potsdam.de>
…develop

# Conflicts:
#	CHANGELOG.md
#	config/default.cfg
#	main.gms
Co-authored-by: Florian Humpenöder <humpenoeder@pik-potsdam.de>
@bodirsky bodirsky merged commit dced456 into magpiemodel:develop Sep 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
High risk Higher risk Major Substantial modifications
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants