diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index ff0f32f6e5..ea10a34738 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,58 +1,49 @@ -## :bird: Purpose of this PR :bird: +## :bird: Description of this PR :bird: - Briefly explain the purpose of this pull request ## :wrench: Checklist for PR creator :wrench: -- [ ] Labeling pull request correctly [from the label list](https://github.com/magpiemodel/magpie/labels). - -* 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 - -- [ ] 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 - -- [ ] :chart_with_downwards_trend: Performance loss/gain from current default behavior :chart_with_upwards_trend: - * Current develop branch default : ** mins - * This PR's default : ** mins - -- [ ] Added changes to `CHANGELOG.md` -- [ ] Compilation check (model starts without compilation errors - use `gams main.gms action=c` in model folder for testing). -- [ ] No hard coded numbers and cluster/country/region names. -- [ ] The new code doesn't contain declared but unused parameters or variables. -- [ ] Where relevant, In-code comments added including documentation comments. -- [ ] Made sure that documentation created with [`goxygen`](https://github.com/pik-piam/goxygen) is okay (use `goxygen::goxygen()` for testing). -- [ ] Changes to [`magpie4`](https://github.com/pik-piam/magpie4) R library for post processing of model output (ideally backward compatible). -- [ ] 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% - -## :warning: Additional notes or warnings :warning: -NA - -## :rotating_light: Checklist for RSE reviewer :rotating_light: - -- [ ] 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 - -## :rotating_light: Checklist for MAgPIE reviewer :rotating_light: - -- [ ] 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 +- [ ] Label pull request [from the label list](https://github.com/magpiemodel/magpie/labels). + - **Low risk**: Simple bugfixes (missing files, updated documentation, typos) or changes in start or output scripts + - **Medium risk**: Uncritical changes in the model core (e.g. moderate modifications in non-default realizations) + - **High risk**: Critical changes in model core or default settings (e.g. changing a model default or adjusting a core mechanic in the model) + +- [ ] Self-review own code + - No hard coded numbers and cluster/country/region names. + - The new code doesn't contain declared but unused parameters or variables. + - [`magpie4`](https://github.com/pik-piam/magpie4) R library has been updated accordingly and backwards compatible where necessary. + - `scenario_config.csv` has been updated accordingly (important if `default.cfg` has been updated) + +- [ ] Document changes + - Add changes to `CHANGELOG.md` + - Where relevant, put In-code documentation comments + - Properly address updates in interfaces in the module documentations + - run [`goxygen::goxygen()`](https://github.com/pik-piam/goxygen) and verify the modified code is properly documented + +- [ ] Perform test runs + - **Low risk**: + - Run a compilation check via `gams main.gms action=c` + - **Medium risk**: + - Run test runs via `Rscript start.R --> "test runs"` + - **High risk**: + - Run test runs via `Rscript start.R --> "test runs"` + - Default run based on the current version of the fork from which PR is made + - Provide relevant comparison plots (land-use, emissions, food prices, land-use intensity,...) + +### :chart_with_downwards_trend: Performance changes :chart_with_upwards_trend: + + - Current develop branch default : ** mins + - This PR's default : ** mins + +## :rotating_light: Checklist for reviewer :rotating_light: + +- PR is labeled correctly +- Code changes look reasonable + - No hard coded numbers and cluster/country/region names. + - No unnecessary increase in module interfaces + - model behavior/performance is satisfactory. +- Changes are properly documented + - `CHANGELOG` is updated correctly + - Updates in interfaces have been properly addressed in the module documentations + - In-code documentation looks appropriate diff --git a/.gitignore b/.gitignore index 775edb43a8..5806f08ab6 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ magpie_calib.* #ignore run specific files and folders /225*/ /run_details/ +/logs/ *.out /scripts/npi_ndc/npi_ndc_overview.txt Rplots.pdf diff --git a/.zenodo.json b/.zenodo.json index 064e1f1e05..02359f1bb0 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,6 +1,6 @@ { "title": "MAgPIE - An Open Source land-use modeling framework", - "version": "4.5.0", + "version": "4.6.0", "creators": [ { "name": "Dietrich, Jan Philipp", @@ -65,6 +65,10 @@ "affiliation": "Potsdam Institute for Climate Impact Research", "orcid": "0000-0003-1282-400X" }, + { + "name": "Leip, Debbora", + "affiliation": "Potsdam Institute for Climate Impact Research" + }, { "name": "Klein, David", "affiliation": "Potsdam Institute for Climate Impact Research" @@ -85,6 +89,11 @@ "name": "Biewald, Anne", "affiliation": "Potsdam Institute for Climate Impact Research" }, + { + "name": "Führlich, Pascal", + "affiliation": "Potsdam Institute for Climate Impact Research", + "orcid": "0000-0002-6856-8239" + }, { "name": "Lotze-Campen, Hermann", "affiliation": "Potsdam Institute for Climate Impact Research", @@ -100,5 +109,5 @@ "license": { "id": "AGPL-3.0-or-later" }, - "publication_date": "2022-07-07" + "publication_date": "2022-11-09" } diff --git a/CHANGELOG.md b/CHANGELOG.md index c2b1d700b6..7c251d4a23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,80 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [4.6.0] - 2022-11-09 + +### changed +- **18_residues** bugfix in `q18_cost_prod_res` +- **36_employment** included calculations for minimum wage scenario +- **38_factor_costs** included labor cost scaling in case of wage scenario +- **42_water_demand** account for multiple cropping in water requirements +- **51_nitrogen** moved maccs into emission modules. change of interface from vm_btm_reg to vm_emissions_reg +- **52_carbon** change of interface from vm_btm_reg to vm_emissions_reg +- **52_carbon** Soil C of urban areas set to soil C of natural other land +- **57_maccs** default changed from PBL2007 to PBL2022 +- **58_peatland** moved maccs into emission modules. change of interface from vm_btm_reg to vm_emissions_reg +- **59_som** Now calculates soil C for fallow and urban areas +- **62_material** added biomass demand for bioplastic production +- **70_livestock** included labor cost scaling in case of wage scenario +- **config** added `s62_max_dem_bioplastic` and `s62_midpoint_dem_bioplastic` to define bioplastic scenario +- **config** adjusted PR template +- **config** best_calib set to FALSE in default +- **config** new switches `s36_minimum_wage`, `s36_scale_productivity_with_wage`, and `s38_fix_capital_need` +- **config** non-food system emission MAGICC switch +- **config** updated config to new module setup of MACCs +- **config** updated default realization of 15_food from anthropometrics_jan18 to anthro_iso_jun22 +- **config** updated SHAPE SDP scenarios in scenario_config.csv +- **documentation** added literature +- **inputs** update of NPi for China (additional data 4.30) +- **inputs** updated f56_emis_policy (additional data 4.29) +- **inputs** updated non-food initial prices, MACCs curves, and removed suitability threshold of 0.1 in all_marginal setting +- **scripts** added single time step run to test runs +- **scripts** fix in start_functions for the calibration setting `ifneeded` +- **scripts** FSDP_collect handles the health impacts data provided by Marco Springmann, distributed it into the scenario's various reports. It performs a similar operation for global nutrient surplus (which must be calculated on the grid-level and then aggregated).- **13_tc** relaxed vm_tau upper limit +- **scripts** log files are now written in a subfolder "logs" +- **scripts** output/extra/disaggregation_BII.R adjusted BII output for primary and secondary other land +- **scripts** quit with exit code = gams status at the end of submit.R +- **scripts** update of rds_report to allow gridded intermediate outputs +- **scripts** updated FSEC start and output scripts +- **scripts** updated FSEC start scripts and related config files to introduce new scenarios +- **scripts/start** cleanup of old start scripts + +### added +- **14_yields** added input file containing AQUASTAT yield calibration factors and switch `s14_calib_ir2rf` in default.cfg to activate this yield calibration +- **15_food** added new realization with country level exogenous diets, product-specific intake estimates, new scenarios for exogenous BMI and decomposition switches for EAT Lancet diets. Simplified code and improved iteration procedure. +- **50_nr_soil_budget** new module realization for more consistent MACCs implementation. change of interface from vm_btm_reg to vm_emissions_reg +- **53_methane** moved maccs into emission modules. change of interface from vm_btm_reg to vm_emissions_reg +- **56_ghg_policy** added new ecosystem protection scenarios +- **56_ghg_policy** new module realization for more consistent MACCs implementation +- **57_maccs** added new Marginal Abatement Cost Curve (MACCs) data set from PBL (PBL2022) +- **57_maccs** new more consistent maccs implementation. different mapping of emission sources to maccs. +- **f32_forest** added the option to run generic disturbance scenarios of secondary forest types determined in `f32_forest_shock.csv` +- **f35_natveg** added the option to run generic disturbance scenarios of primary forest determined in `f35_forest_shock.csv` +- **scripts** added output script creating a merged .csv for dietaryIndicators and caloricSupply outputs +- **scripts** added output script creating a merged .csv for dietaryIndicators and caloricSupply outputs +- **scripts** added output script creating a set of outputs for Alessandro Passaro in the FSEC context +- **scripts** added output script creating a set of outputs for Simon Dietz in the FSEC context +- **scripts** added output script for gridded crop diversity indices +- **scripts** added output script running MAGICC7 on a MAgPIE scenario +- **scripts** added output script, FSDP_process creating a merged .csv and .gdx for dietaryIndicators and caloricSupply outputs +- **scripts** added output scripts for FSEC FSDP runs +- **scripts** added water output script for FSEC model runs + +### removed +- **15_food** removed read-in of non-needed input file "f15_calib_factor_FAOfsupply_iso" +- **38_factor_costs** removed `mixed_reg_feb17` realization +- **50_nr_soil_budget** old inconsistent module realizations +- **53_methane** old inconsistent module realizations +- **56_ghg_policy** old inconsistent module realizations +- **57_maccs** old inconsistent module realizations + +### fixed +- **38_factor_costs** fixed calibration of share parameter in `sticky_labor` realization +- **43_water_availability** added missing years after 2100 in "f43_wat_avail" to avoid infeasibilities in coupled runs with less_ts timesteps +- **59_som** corrected the som pool due to the carbon transfer from other and primary forest to secondary forest before optimization (presolve) +- **scripts** fixed some bugs related to background execution of start/output scripts + + ## [4.5.0] - 2022-07-07 ### changed @@ -46,10 +120,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **scripts** clean up of the recalibrate_realizations.R script, project_LAMACLIMA_WP4.R, and sticky.R to remove sticky dynamic/free switch. - **scripts** bugfix in disaggregation.R, disaggregation_BII.R with respect to urban scenario - **scripts** added FSEC modeling start script (global runs) -- **scripts** The disaggregation_LUH2.R was extended to include the changes used to generate ISIMIP3b maps for LUH harmonization. The largest changes are: 1) The convertLUH function now breaks the grid level magpie objects by groups of years, then creates the raster for the groups and aggregates them to create the final map at a quarter of a degree resolution (this speeds up the process). 2) The mapping between LUH and MAgPIE is now defined by country and magpie-LUH types (not 1 to 1 anymore). 3) The split of MAgPIE's pasture land type between pasture and rangeland changed. Rangeland is assumed to stay constant after 2015, and changes in MAgPIE's pasture are due to pasture. 4) IFs were added so if a certain map already exists in the output folder, it will not generate it once again. 5) Flooded land now corresponds to a share of rice cropland, based on historical values. 6) To speed calculations, yields are read at the cell level, the crops are aggregated based on the new MAgPIE-LUH mapping, and then disaggregated to grid level. +- **scripts** The disaggregation_LUH2.R was extended to include the changes used to generate ISIMIP3b maps for LUH harmonization. The largest changes are: 1) The convertLUH function now breaks the grid level magpie objects by groups of years, then creates the raster for the groups and aggregates them to create the final map at a quarter of a degree resolution (this speeds up the process). 2) The mapping between LUH and MAgPIE is now defined by country and magpie-LUH types (not 1 to 1 anymore). 3) The split of MAgPIE's pasture land type between pasture and rangeland changed. Rangeland is assumed to stay constant after 2015, and changes in MAgPIE's pasture are due to managed pasture. 4) IFs were added so if a certain map already exists in the output folder, it will not generate it once again. 5) Flooded land now corresponds to a share of rice cropland, based on historical values. 6) To speed calculations, yields are read at the cell level, the crops are aggregated based on the new MAgPIE-LUH mapping, and then disaggregated to grid level. - **scripts** added new disaggregation script to provide grid cell level BII - **scripts** removed test script "irrig_dep_test" from "start" folder to "extra" folder -- **scripts** Added script to folder projects paper_grassland.R +- **scripts** Added script projects/paper_grassland.R - **scripts** scripts/output/extra/emulator.R Remove dependency on deprecated R package "magpie" ### added @@ -75,7 +149,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **scripts** output/projects/FSEC_costs.R to create costs ouput for the FSEC project - **scripts** output/projects/FSEC_dietaryIndicators.R to create output datasets for the FSEC project - **scripts** output/projects/FSEC_nitrogenPollution.R to create output datasets of nitrogen pollutants for the FSEC project -- **scripts** Added script to folder projects paper_grassland.R - **scripts** Extended dissagregation.R script to replace single "past" land class by LHU range and pastr classes when grassland_apr22 realization is used. - **scripts** `start/projects/test_rotations.R` testscript for different rotation scenario settings @@ -465,7 +538,8 @@ This release version is focussed on consistency between the MAgPIE setup and the First open source release of the framework. See [MAgPIE 4.0 paper](https://doi.org/10.5194/gmd-12-1299-2019) for more information. -[Unreleased]: https://github.com/magpiemodel/magpie/compare/v4.5.0...develop +[Unreleased]: https://github.com/magpiemodel/magpie/compare/v4.6.0...develop +[4.6.0]: https://github.com/magpiemodel/magpie/compare/v4.5.0...v4.6.0 [4.5.0]: https://github.com/magpiemodel/magpie/compare/v4.4.0...v4.5.0 [4.4.0]: https://github.com/magpiemodel/magpie/compare/v4.3.5...v4.4.0 [4.3.5]: https://github.com/magpiemodel/magpie/compare/v4.3.4...v4.3.5 diff --git a/CITATION.cff b/CITATION.cff index f274122286..cda7dfe488 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -77,6 +77,11 @@ authors: affiliation: "Potsdam Institute for Climate Impact Research" email: crawford@pik-potsdam.de + - family-names: Leip + given-names: Debbora + affiliation: "Potsdam Institute for Climate Impact Research" + email: leip@pik-potsdam.de + - family-names: Klein given-names: David affiliation: "Potsdam Institute for Climate Impact Research" @@ -101,6 +106,12 @@ authors: given-names: Anne affiliation: "Potsdam Institute for Climate Impact Research" + - family-names: Führlich + given-names: Pascal + orcid: https://orcid.org/0000-0002-6856-8239 + affiliation: "Potsdam Institute for Climate Impact Research" + email: pascal.fuehrlich@pik-potsdam.de + - family-names: Lotze-Campen given-names: Hermann orcid: https://orcid.org/0000-0002-0003-5508 @@ -114,8 +125,8 @@ authors: email: popp@pik-potsdam.de title: MAgPIE - An Open Source land-use modeling framework -version: 4.5.0 -date-released: 2022-07-07 +version: 4.6.0 +date-released: 2022-11-09 repository-code: https://github.com/magpiemodel/magpie keywords: - landuse diff --git a/Dockerfile b/Dockerfile index 4e00e99108..83c98495a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,10 @@ -FROM rocker/r-ver:3.6.2 +FROM rocker/r-ver:4.2.1 RUN mkdir /home/magpie COPY . /home/magpie/ RUN apt-get update \ + && apt-get upgrade -y \ && apt-get install -y libpng-dev \ && apt-get install -y libjpeg-dev \ && apt-get install -y zlib1g-dev \ @@ -16,17 +17,30 @@ RUN apt-get update \ && apt-get install -y fonts-inconsolata \ && apt-get install -y pandoc \ && apt-get install -y pandoc-citeproc \ + && apt-get install -y libfontconfig1-dev \ + && apt-get install -y libharfbuzz-dev \ + && apt-get install -y libfribidi-dev \ + && apt-get install -y libfreetype6-dev \ + && apt-get install -y libtiff5-dev \ + && apt-get install -y r-cran-ncdf4 \ + && apt-get install -y netcdf-bin \ + && apt-get install -y libnetcdf-dev \ + && apt-get install -y proj-bin \ + && apt-get install -y libproj-dev \ + && apt-get install -y gdal-bin \ + && apt-get install -y libgdal-dev \ + && apt-get install -y texlive-latex-extra \ + && apt-get install -y git \ && fc-cache -fv - - - RUN R -e "options(repos = \ list(CRAN = 'https://cran.rstudio.com/',pik='https://rse.pik-potsdam.de/r/packages')); \ install.packages(c('gdxrrw', \ 'ggplot2', \ + 'citation', \ 'curl', \ 'gdx', \ + 'gms', \ 'magclass', \ 'madrat', \ 'mip', \ @@ -36,10 +50,15 @@ RUN R -e "options(repos = \ 'lusweave', \ 'luscale', \ 'goxygen', \ - 'luplot'))" + 'luplot', \ + 'yaml'))" + +RUN R -e "install.packages(c('ncdf4', \ + 'raster'))" # Set GAMS version -ENV LATEST=30.3.0 +ENV LATEST=40.2.0 +ENV LATEST_SHORT=40.2 ENV GAMS_VERSION=${LATEST} # Set GAMS bit architecture, either 'x64_64' or 'x86_32' @@ -56,14 +75,15 @@ RUN cd /opt/gams &&\ ./gams.exe &&\ rm -rf gams.exe -COPY gamslice.txt /opt/gams/gams30.3_linux_x64_64_sfx/gamslice.txt +COPY gamslice.txt /opt/gams/gams${LATEST_SHORT}_linux_${GAMS_BIT_ARC}_sfx/gamslice.txt # Add GAMS path to user env path RUN GAMS_PATH=$(dirname $(find / -name gams -type f -executable -print)) &&\ ln -s $GAMS_PATH /usr/local/bin &&\ echo "export PATH=\$PATH:$GAMS_PATH" >> ~/.bashrc &&\ + echo "export GAMS_PATH=$GAMS_PATH" >> ~/.bashrc &&\ cd $GAMS_PATH &&\ ./gamsinst -a -COPY gamslice.txt /opt/gams/gams30.3_linux_x64_64_sfx/gamslice.txt +COPY gamslice.txt /opt/gams/gams${LATEST_SHORT}_linux_${GAMS_BIT_ARC}_sfx/gamslice.txt CMD cd /home/magpie && Rscript start.R diff --git a/README.md b/README.md index f29e53716f..75fd0e918f 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,8 @@ https://www.pik-potsdam.de/research/projects/activities/land-use-modelling/magpi A framework description paper has been published in Geoscientific Model Development (GMD): https://doi.org/10.5194/gmd-12-1299-2019 -The model documentation for version 4.5.0 can be found at -https://rse.pik-potsdam.de/doc/magpie/4.5.0/ +The model documentation for version 4.6.0 can be found at +https://rse.pik-potsdam.de/doc/magpie/4.6.0/ A most recent version of the documentation can also be extracted from the model source code via the R package goxygen @@ -215,7 +215,7 @@ magpie@pik-potsdam.de Please contact magpie@pik-potsdam.de ## CITATION -See file CITATION.cff or the [How-to-Cite section](https://rse.pik-potsdam.de/doc/magpie/4.5.0/#how-to-cite) in the model documentation for information how to cite the model. +See file CITATION.cff or the [How-to-Cite section](https://rse.pik-potsdam.de/doc/magpie/4.6.0/#how-to-cite) in the model documentation for information how to cite the model. ## AUTHORS See list of authors in CITATION.cff diff --git a/config/default.cfg b/config/default.cfg index 2e593f0c9a..b1e46eb675 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -22,24 +22,15 @@ cfg$model <- "main.gms" #def = "main.gms" #### input settings #### # which input data sets should be used? -cfg$input <- c(regional = "rev4.73_h12_magpie.tgz", - cellular = "rev4.73_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", - validation = "rev4.73_h12_validation.tgz", - additional = "additional_data_rev4.26.tgz", - calibration = "calibration_H12_per_ton_fao_may22_28May22.tgz") - -# Options for calibration tgz files for different factor costs realizations, with default settings and rev4.73: -# * (mixed_reg_feb17, global fac req) "calibration_H12_mixed_reg_feb17_28May22.tgz" -# * (mixed_reg_feb17, regional fac req) "calibration_H12_mixed_reg_feb17_reg_13Jun22.tgz" -# * (per_ton_fao_may22, global fac req) "calibration_H12_per_ton_fao_may22_28May22.tgz" -# * (per_ton_fao_may22, regional fac req) "calibration_H12_per_ton_fao_may22_reg_13Jun22.tgz" -# * (sticky_feb18, global fac req) "calibration_H12_sticky_feb18_28May22.tgz" -# * (sticky_feb18, regional fac req) "calibration_H12_sticky_feb18_reg_13Jun22.tgz" -# * (sticky_labor, global fac req) "calibration_H12_sticky_feb18_28May22.tgz" -# * (sticky_labor, regional fac req) "calibration_H12_sticky_feb18_reg_13Jun22.tgz" - -# Calibration factors for 31_past (pasture management module) -# * (grasslands_mar22) "calibration_H12_grassland_mar22.tgz" +cfg$input <- c(regional = "rev4.77_h12_magpie.tgz", + cellular = "rev4.77_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", + validation = "rev4.77_h12_validation.tgz", + additional = "additional_data_rev4.32.tgz", + calibration = "calibration_H12+ir2rf_05Oct22.tgz") + +# NOTE: It is recommended to recalibrate the model when changing cellular input data +# as well as for any other setting that would affect initial values in the model, +# e.g. changes in costs structure, NPI policies, etc. #a list of repositories (please pay attention to the list format!) in which the #files should be searched for. Files will be searched in all repositories until @@ -54,7 +45,7 @@ cfg$input <- c(regional = "rev4.73_h12_magpie.tgz", #below it will get merged into cfg$repositories cfg$repositories <- append(list("https://rse.pik-potsdam.de/data/magpie/public"=NULL), - getOption("magpie_repos")) + getOption("magpie_repos")) @@ -83,7 +74,7 @@ cfg$crop_calib_max <- 1.5 # def= 1.5 # Selection type of calibration factors. # If FALSE, calibration factors from the last iteration are used. # If TRUE, calibration factors from the iteration with the lowest standard deviation are used. -cfg$best_calib <- TRUE +cfg$best_calib <- FALSE # def = FALSE # Settings for land conversion cost calibration (cropland) # The calibration routine derives regional calibration factors for @@ -276,7 +267,7 @@ cfg$gms$c13_tccost <- "medium" # def = medium # * ignore historical tau (1) or use it as lower bound (0) cfg$gms$s13_ignore_tau_historical <- 1 # def = 1 -# * Maximum regional tech cost expressed as share of reginal GDP +# * Maximum regional tech cost expressed as share of regional GDP # * A meaningful value would be 0.002. However, this bound causes infeasibilities in some cases. # * Therefore, this bound is not used in the current model version. cfg$gms$s13_max_gdp_shr <- Inf # def = Inf @@ -309,10 +300,21 @@ cfg$gms$s14_yld_past_switch <- 0.25 # def = 0.25 # * 0 (pure relative calibration) cfg$gms$s14_limit_calib <- 1 # def = 1 +# * Switch on scaling of irrigated yields to AQUASTAT irrigated-to-rainfed yield +# * ratio on regional scale +# NOTE: It is recommended to recalibrate the model when changing this setting! +cfg$gms$s14_calib_ir2rf <- 1 # def = 1 + # ***--------------------- 15_food --------------------------------------- # * (anthropometrics_jan18): estimates food using scenario dependent regression # * and demography drivers -cfg$gms$food <- "anthropometrics_jan18" # def = anthropometrics_jan18 +# * (anthro_iso_jun22): estimates food using scenario dependent regression +# * and demography drivers on iso level +cfg$gms$food <- "anthro_iso_jun22" # def = anthro_iso_jun22 + +# * switch between exogenous and endogenous food demand +# * options: 0 (exogenous food demand) and 1 (endogenous food demand) +cfg$gms$s15_elastic_demand <- 0 # def =0 # * maximal number of iterations between food and magpie model before # * simulation proceeds to next time step @@ -322,10 +324,6 @@ cfg$gms$s15_maxiter <- 5 # def = 5 # * real income between iterations cfg$gms$s15_convergence <- 0.005 # def = 0.005 -# * switch between exogenous and endogenous food demand -# * options: 0 (exogenous food demand) and 1 (endogenous food demand) -cfg$gms$s15_elastic_demand <- 0 # def =0 - # * food scenario for selected (and respectively not selected) countries # * in scen_countries15 # * options: SSP: "SSP1", "SSP2", "SSP3", "SSP4", "SSP5" @@ -384,22 +382,6 @@ cfg$gms$s15_livescen_target_subst <- 1 # def = 1 # ***** Start configuration of exogenous food intake and waste scenarios ***** # -# * Transition to exogenous food intake and waste scenarios including functional forms, targets -# * and transition periods (applied after the food demand model is executed). The resulting scenario -# * parametrisation is a linear combination of the default MAgPIE parametrisation and the exogenous -# * scenario data input. -# * Options consist of 3 parts: functional form (lin, sigmoid), target (zero, 20pc, 50pc, 80pc, 90pc; -# * pc: percent) and transition period (10_50: from 2010 to 2050, 20_50: from 2020 to 2050). -# * The target defines the relative contribution of the default MAgPIE parametrisation, e.g. zero -# * defines a full transition to the exogenous scenario data input. -# * Examples with target year y2030: lin_zero_20_30 -# * Examples with target year y2050: lin_zero_20_50 -# * Examples with target year y2070: lin_zero_20_70 -# * For the full list of available options, see information on food substitution scenarios above. -# * Only active if at least one of the exogenous food intake and waste scenario -# * switches (s15_exo_diet and s15_exo_waste) is set to 1. -cfg$gms$c15_exo_foodscen <- "lin_zero_20_50" # def = lin_zero_20_50 -# # # * switch for transition to food waste scenarios # * (1): transition towards exogenous food waste target @@ -421,16 +403,42 @@ cfg$gms$s15_exo_diet <- 0 # def = 0 # # * exogenous calorie scenario (EAT Lancet diet scenarios) # * only activated if s15_exo_diet is set to 1 -# * options: healthy_BMI, 2100kcal, 2500kcal +# * options: healthy_BMI, 2100kcal, 2500kcal, +# * endo, no_underweight, no_overweight +# * healthy_BMI: all people have a BMI of 20-25 +# * no_underweight: all people with BMI<20 have a BMI 20-25 +# * no_overweight: all people with BMI>25 have a BMI 20-25 +# * endo: no changes with respect to endogenous BMI +# * 2100kcal, 2500kcal: an exogenous target of 2100 or 2500 kcal, all +# * people have a BMI 20-25. cfg$gms$c15_kcal_scen <- "healthy_BMI" # def = healthy_BMI # # * exogenous food-specific diet scenario (EAT Lancet diet scenarios) # * only activated if s15_exo_diet is set to 1 # * options: BMK, FLX, PSC, VEG, VGN, FLX_hmilk, FLX_hredmeat cfg$gms$c15_EAT_scen <- "FLX" # def = FLX -# + +# * Subspecifications: Which commodities shall be included in the diet shift +# * towards cfg$gms$c15_EAT_scen ? Only selected (1) commodities will be +# * included, while the others will remain to be endogenous. +# * Any shift will be compensated to reach the calorie target by adjusting +# * staple calories. +cfg$gms$s15_exo_monogastric <- 1 # def = 1, options: 0,1 +cfg$gms$s15_exo_ruminant <- 1 # def = 1, options: 0,1 +cfg$gms$s15_exo_fish <- 1 # def = 1, options: 0,1 +cfg$gms$s15_exo_fruitvegnut <- 1 # def = 1, options: 0,1 +cfg$gms$s15_exo_pulses <- 1 # def = 1, options: 0,1 +cfg$gms$s15_exo_sugar <- 1 # def = 1, options: 0,1 +cfg$gms$s15_exo_oils <- 1 # def = 1, options: 0,1 +cfg$gms$s15_exo_brans <- 1 # def = 1, options: 0,1 +cfg$gms$s15_exo_scp <- 1 # def = 1, options: 0,1 + # * Scenario target for the inclusion of alcohol in the EAT-Lancet diet +# * The EAT-Lancet diet only allows for added sugars, but does not include processed food or +# * alcohol. # * only activated if s15_exo_diet is set to 1 +cfg$gms$s15_exo_alcohol <- 1 # default: 1 +# * Via 's15_alc_scen' a maximum target for alcohol consumption can be defined. # * (0): no alcohol consumption, as in the original version of the EAT-Lancet diet # * (0.014): maximum target for alcohol consumption is 1.4% of total calorie consumption # * (see Lassen et al., 2020) @@ -445,6 +453,22 @@ cfg$gms$s15_alc_scen <- 0.014 # def = 0.014 # * Note: must be written in the format: "IND, BRA, DEU" # * Default: all iso countries cfg$gms$scen_countries15 <- all_iso_countries +# +# * Transition to exogenous food intake and waste scenarios including functional forms, targets +# * and transition periods (applied after the food demand model is executed). The resulting scenario +# * parametrisation is a linear combination of the default MAgPIE parametrisation and the exogenous +# * scenario data input. +# * Options consist of 3 parts: functional form (lin, sigmoid), target (zero, 20pc, 50pc, 80pc, 90pc; +# * pc: percent) and transition period (10_50: from 2010 to 2050, 20_50: from 2020 to 2050). +# * The target defines the relative contribution of the default MAgPIE parametrisation, e.g. zero +# * defines a full transition to the exogenous scenario data input. +# * Examples with target year y2030: lin_zero_20_30 +# * Examples with target year y2050: lin_zero_20_50 +# * Examples with target year y2070: lin_zero_20_70 +# * For the full list of available options, see information on food substitution scenarios above. +# * Only active if at least one of the exogenous food intake and waste scenario +# * switches (s15_exo_diet and s15_exo_waste) is set to 1. +cfg$gms$c15_exo_foodscen <- "lin_zero_20_50" # def = lin_zero_20_50 # ***** End configuration of exogenous food intake and waste scenarios ***** @@ -570,6 +594,7 @@ cfg$gms$ageclass <- "feb21" # def = feb21 # * (endo_apr21): Hard rotational constraints. Dynamic cropland and detailed cropland availability data at grid cell level. # * (rotation_apr22): hard rotational constraints and fallow constraints with the option of different future scenarios. Dynamic cropland and detailed cropland availability data at grid cell level. # * (penalty_apr222): rotational and fallow constraints are incentivized via penalty payments. Dynamic cropland and detailed cropland availability data at grid cell level. +# NOTE: It is recommended to recalibrate the model when changing this setting! cfg$gms$crop <- "endo_apr21" # def = endo_apr21 # * (c30_bioen_type): switch for type of bioenergy crops; options: begr, betr, all cfg$gms$c30_bioen_type <- "all" # def = "all" @@ -624,6 +649,7 @@ cfg$gms$policy_countries30 <- all_iso_countries # * (static): static pasture # * (endo_jun13): dynamic pasture # * (grasslands_apr22): Grassland management separating managed pastures from rangelands +# NOTE: It is recommended to recalibrate the model when changing this setting! cfg$gms$past <- "endo_jun13" # def = endo_jun13 # * Factor requirements (USD04 per ton DM) @@ -634,7 +660,8 @@ cfg$gms$s31_fac_req_past <- 1 # def = 1 # * reflecting that not all pasture area is grazed. cfg$gms$s31_unequal <- 1 # def = 1 -#SSP scenario switch for pasture suitability areas (only take effect for realization grasslands_apr22) +# * SSP scenario switch for pasture suitability areas (only take effect for realization grasslands_apr22) +# * options: ssp126, ssp245, ssp370, ssp460, ssp585 cfg$gms$c31_past_suit_scen <- "ssp370" # def = "ssp370" # * Switch that allows selecting how yield calibration factors will be calculated. @@ -778,6 +805,14 @@ cfg$gms$s32_hvarea = 0 # def = 0 cfg$gms$c32_rot_calc_type <- "current_annual_increment" +# Generic forest shock scenarios. Disturbance sets percentage of all age classes back to 0 +# * ("none") No disturbance applied +# * ("002lin2030") Disturbance applied to 0p2 percent per year linear phase-in over 20yrs from 0 in 2030 +# * ("004lin2030") Disturbance applied to 0p4 percent per year linear phase-in over 20yrs from 0 in 2030 +# * ("008lin2030") Disturbance applied to 0p8 percent per year linear phase-in over 20yrs from 0 in 2030 +# * ("016lin2030") Disturbance applied to 1p6 percent per year linear phase-in over 20yrs from 0 in 2030 +cfg$gms$c32_shock_scenario = "none" # def = "none" + # ***--------------------- 34_urban --------------------------------------- # * 34_urban includes urban land # * (static) static urban land fixed on 1995 patterns from LUH2v2 @@ -815,6 +850,7 @@ cfg$gms$s35_secdf_distribution <- 0 # def = 0 # * (0): No damage simulated # * (1): Damage from shifting agriculture (constant) # * (2): Damage from shifting agriculture is faded out by the year defined in 'cfg$gms$c35_forest_damage_end' +# * (4): Generic forest disturbance scenarios defined in `f35_forest_shock.csv` cfg$gms$s35_forest_damage <- 2 # def = 2 # * If option (2) above: Year by which damage from shifting agriculture has petered out cfg$gms$s35_forest_damage_end <- 2050 #def = 2050 @@ -825,20 +861,41 @@ cfg$gms$s35_forest_damage_end <- 2050 #def = 2050 # * 2 = Timber production from natveg including age-class shifting cfg$gms$s35_hvarea <- 0 # def = 0 +# Generic forest shock scenarios. Disturbance sets percentage of all age classes back to 0 +# * ("none") No disturbance applied +# * ("002lin2030") Disturbance applied to 0p2 percent per year linear phase-in over 20yrs from 0 in 2030 +# * ("004lin2030") Disturbance applied to 0p4 percent per year linear phase-in over 20yrs from 0 in 2030 +# * ("008lin2030") Disturbance applied to 0p8 percent per year linear phase-in over 20yrs from 0 in 2030 +# * ("016lin2030") Disturbance applied to 1p6 percent per year linear phase-in over 20yrs from 0 in 2030 +cfg$gms$c35_shock_scenario = "none" # def = "none" + # ***--------------------- 36_employment ------------------------------- # * This module calculates agricultural employment. # * (exo_may22): employment is calculated based on labor costs and not affecting the # * optimization cfg$gms$employment <- "exo_may22" # default = "exo_may22" +# * global minimum wage in USDMER05 per hour that needs to be reached in all countries by 2050 +cfg$gms$s36_minimum_wage <- 0 # default = 0 (no minimum wage) + +# * A scenario that increases wages can either be fully related to productivity increase +# * (leading to lower employment for the same total labor costs), or keep productivity +# * constant (leading to the same employment for higher total labor costs), or to a +# * mixture between productivity increase an total labor cost increase. +# * The scalar `s36_scale_productivity_with_wage` describes how high the labor productivity +# * gain should be relative to the increase in hourly labor costs. If set to 0, +# * productivity stays constant, if set to 1 productivity scales proportional to hourly +# * labor costs. Other positive values lead to a mixture of productivity gain and increase +# * in total costs. +cfg$gms$s36_scale_productivity_with_wage <- 0 # default = 0 # ***--------------------- 37_labor_prod --------------------------------- # * This module provides a labour productivity factor (0-1), # * which reflects the efficiency of labour under changing environmental conditions (1 = no change). -# * The labour productivity factor is currently only considered in the sticky_labour +# * The labour productivity factor is currently only considered in the sticky_labor # * realization of the [38_factor_costs] module. -# * (off): labour productivity factor fixed to 1 -# * (exo): labour productivity factor is affected by climate change impacts +# * (off): labor productivity factor fixed to 1 +# * (exo): labor productivity factor is affected by climate change impacts cfg$gms$labor_prod <- "off" # default = off # * Additional setting for exo realization only: @@ -851,29 +908,29 @@ cfg$gms$c37_labor_intensity <- "400W" # default = "400W" # * Uncertainty over ESMs. Options: "enslower", "ensmean", "ensupper" cfg$gms$c37_labor_uncertainty <- "ensmean" # default = "ensmean" - # ***--------------------- 38_factor_costs ------------------------------- # * Make sure you use the corresponding calibration file to the selected realization # * Please, check details in input settings. # * (per_ton_fao_may22) factor costs fixed per ton # * (sticky_feb18) factor costs including investments in capital # * (sticky_labor) based on sticky_feb18 + labor productivity factor included +# NOTE: It is recommended to recalibrate the model when changing this setting! +# NOTE: In case the maximum number of iterations is reached without convergence +# in the calibration, please consider to use the best_calib setting for the calibration run cfg$gms$factor_costs <- "per_ton_fao_may22" # default = per_ton_fao_may22 -# * Scalar to change factor costs by a certain factor for irrigation - -cfg$gms$s38_factor <- 1 #default = 1 - -# * Year when policy shock (additional costs for irrigated crops ) will be implemented -# * (only applicable for mixed_reg_feb17 realization) -cfg$gms$s38_shock_year <- 1995 #default = 1995 - # * Regional (reg) or global (glo) factor requirements (applicable for per_ton_fao_may22, # * sticky_feb18, sticky_labor). The regional version keeps factor requirements constant # * after 2010, the global version uses values from 2005 for all years. Typically, the # * same version (glo or reg) should be chosen for c70_fac_req_regr for consistency. +# NOTE: It is recommended to recalibrate the model when changing this setting! cfg$gms$c38_fac_req <- "glo" # default "glo" +# * Only relevant for sticky_labor implementation: scalar to determine until which year +# * the capital need (per unit of output) should be fixed to start value (i.e. not +# * allowing for subsititution between labor and capital). + +cfg$gms$s38_fix_capital_need <- 2020 # default 2020 # ***--------------------- 39_landconversion ----------------------------- # * (calib): Costs for cropland expansion are scaled with a regional calibration factor @@ -1073,35 +1130,62 @@ cfg$gms$climate <- "static" # def = static # ***------------------------- 50_nr_soil_budget -------------------------- # * (off): off -# * (exoeff_aug16): exogenous nr efficiency -cfg$gms$nr_soil_budget <- "exoeff_aug16" # def = exoeff_aug16 +# * (macceff_aug22): nr efficiency dependent on MACC curves +cfg$gms$nr_soil_budget <- "macceff_aug22" # def = macceff_aug22 -# * Scenario for nr efficiency on croplands or pastures for selected (and +# * Scenario for baseline nr efficiency (excluding additional improvements based +# * on marginal abatmeent cost curves) on croplands for selected (and # * respectively non-selected) countries in cropneff_countries and pastneff_countries -# * Scenario name are composed as follows: first number is the nitrogen uptake efficiency -# * (NUE) by 2050, second number is the NUE by 2100, startyear describes -# * the year when historical values end. Zhang et al 2015 describes regional maximum -# * values. -# * Options: constant, neff_ZhangBy2030_start2010, neff_ZhangBy2050_start2010, -# * neff55_55_starty1990,neff60_60_starty1990,neff65_70_starty1990, -# * neff65_70_starty2010,neff60_60_starty2010,neff55_60_starty2010, -# * neff70_75_starty2010,neff75_80_starty2010,neff80_85_starty2010 -# * neff85_85_starty2010 -# Please note that N2O MACCs (module 57) should not be applied with extreme NUE -# improvements, as this may lead to partial doubleaccounting. For extreme NUE -# improvements, deactivate MACCs and instead activate module realization -# rescaled_jan21 of module 51_nitrogen. Moreover, MACCs for N2O should never be -# applied in combination with the module realization rescaled_jan21 of module -# 51_nitrogen. - -cfg$gms$c50_scen_neff <- "neff60_60_starty2010" # def = neff60_60_starty2010 -cfg$gms$c50_scen_neff_noselect <- "neff60_60_starty2010" # def = neff60_60_starty2010 -# * Options: constant, neff_ZhangBy2030_start2010, neff_ZhangBy2050_start2010, -# * neff55_55_starty1990,neff60_60_starty1990,neff65_70_starty1990, -# * neff65_70_starty2010,neff60_60_starty2010,neff55_60_starty2010, -# * neff70_75_starty2010,neff75_80_starty2010,neff80_85_starty2010 -cfg$gms$c50_scen_neff_pasture <- "constant" # def = constant -cfg$gms$c50_scen_neff_pasture_noselect <- "constant" # def = constant +# * +# * Options: +# * "constant", +# * Scenarios keep baseline NUE constant. +# * "baseeff_add3_add10_add20_max75", (SSP1) +# * "baseeff_add3_add5_add10_max65", (SSP2) +# * "baseeff_add3_add0_add0_max55", (SSP3) +# * "baseeff_add3_add10_add15_max75", (SSP4) +# * "baseeff_add3_add5_add15_max75", (SSP5) +# * "baseeff_add3_add15_add25_max65", (lowTech) +# * "baseeff_add3_add15_add25_max75", (MaxMitigation) +# * In the baseeff_add scenarios, the baseline NUE starts from historical +# * values in 2010. The three numbers signify how many percentage points +# * the efficiency increases until 2020,2050 and 2100, always relative to +# * 2010. The max efficiency is the maximum base efficiency in 2050 +# * and 2100. "baseeff_add3_add15_add25_max65" means that China with a +# * current NUE of 41 increases to 44% by 2010, 56% by 2050 and 65% by 2100, +# * while the USA, with a current NUE of 71% has a falling base NUE to 65% +# * by 2050 and 2100. These base NUEs can however be improved by the MACCs, +# * leading to a max NUE of 85% for both China and USA in 2100. +# * The recommmended mapping to storylines is shown above in brackets. +# * "maxeff_add3_glo75_glo85", "maxeff_add3_glo75_glo80", +# * "maxeff_add3_glo60_glo65", "maxeff_add3_glo65_glo75", +# * Scenarios with a globaly uniform target NUE. This target NUE is achieved +# * by the combination of full MACCs and baseline NUE. First number is the +# * again additive efficiency increase until 2020, second number is +# * max NUE in 2050, third in 2100. Example: maxeff_add3_glo75_glo85 +# * means efficiency increases a regional specific 3 percentag point +# * improvement until 2020, and then it achieves a globally uniform 75% +# * efficiency in y2050; the baseline NUE value is therefore about 63%, +# * while the MACCs can increase this to 75%. In 2100, the baseline NUE +# * increases to 74%, which can achieve 85% if combined with +# * the MACCs. +# * "maxeff_ZhangBy2030", "maxeff_ZhangBy2050" +# * These two scenarios reach the max NUE of Zhang et al under application +# * of the full MACCs by 2030 or 2050, and then rise a bit further to +# * achieve a maximum NUE of 80% by 2100. + +cfg$gms$c50_scen_neff <- "baseeff_add3_add5_add10_max65" # def = baseeff_add3_add5_add10_max65 +cfg$gms$c50_scen_neff_noselect <- "baseeff_add3_add5_add10_max65" # def = baseeff_add3_add5_add10_max65 + +# * For pastures, only two scenarios exist: a constant scenario, and one where +# * the minimum NUE increases to 55,60 and 65% for 2020,2050 and 2100, to avoid +# * that pastures which dont have a nutrient deficit are fertilized +# * (historical NUE may be low despite no fertilization) +# * Options: +# * constant, constant_min55_min60_min65 + +cfg$gms$c50_scen_neff_pasture <- "constant_min55_min60_min65" # def = constant_min55_min60_min65 +cfg$gms$c50_scen_neff_pasture_noselect <- "constant_min55_min60_min65" # def = constant_min55_min60_min65 # * Switch and specification of countries for which above defined (c50_scen_neff, # * c50_scen_neff_pasture) apply, respectively. @@ -1116,10 +1200,9 @@ cfg$gms$pastneff_countries <- all_iso_countries # ***--------------------- 51_nitrogen ------------------------------------ -# * (ipcc2006_sep16): IPCC based nitrogen implementation # * (rescaled_jan21): IPCC emissions factors rescaled with efficiency # * (off): no nitrogen calculations -cfg$gms$nitrogen <- "ipcc2006_sep16" # def = ipcc2006_sep16 +cfg$gms$nitrogen <- "rescaled_jan21" # def = rescaled_jan21 # ***--------------------- 52_carbon -------------------------------------- @@ -1142,9 +1225,9 @@ cfg$gms$c52_carbon_scenario <- "cc" # def = "cc" cfg$gms$s52_plantation_threshold <- 8 # def = 8 # ***--------------------- 53_methane ------------------------------------- -# * (ipcc2006_flexreg_apr16): IPCC 1996 methodology +# * (ipcc2006_aug22): IPCC 2006 methodology # * (off): methane calculations deactivated -cfg$gms$methane <- "ipcc2006_flexreg_apr16" # def = ipcc2006_flexreg_apr16 +cfg$gms$methane <- "ipcc2006_aug22" # def = ipcc2006_aug22 # ***--------------------- 54_phosphorus ---------------------------------- # * (off): calculations deactivated @@ -1173,8 +1256,8 @@ cfg$gms$c55_scen_conf_noselect <- "ssp2" # def = ssp2 cfg$gms$scen_countries55 <- all_iso_countries # ***--------------------- 56_ghg_policy ---------------------------------- -# * (price_jan20): applies pollutant prices to different emission types and calculates the reward for CDR from afforestation -cfg$gms$ghg_policy <- "price_jan20" # def = price_jan20 +# * (price_aug22): applies pollutant prices to different emission types and calculates the reward for CDR from afforestation +cfg$gms$ghg_policy <- "price_aug22" # def = price_aug22 # * Switch for scaling GHG price with development state (1=on 0=off) cfg$gms$s56_ghgprice_devstate_scaling <- 0 # def = 0 @@ -1289,17 +1372,24 @@ cfg$gms$s56_limit_ch4_n2o_price <- 1000 # def = 1000 # * The main purpose of these options is to regulate the pricing of positive emissions. Note that re/afforestation is covered by a separate mechanism. # * GHG emission pricing policies -# * options: none, redd_nosoil, redd+_nosoil, redd+natveg_nosoil, all, all_nosoil, maccs_excl_cropland_n2o -# * none: Not including any GHG sources -# * redd_nosoil: Above ground CO2 emis from LUC in forest; all CH4 and N2O emissions -# * redd+_nosoil: Above ground CO2 emis from LUC in forest and forestry; all CH4 and N2O emissions -# * redd+natveg_nosoil: Above ground CO2 emis from LUC in forest, forestry and natveg; all CH4 and N2O emissions -# * all: CO2 emis from LUC in all LUs; all CH4 and N2O emissions +# * options: +# * none (not including any GHG sources), +# * redd_nosoil (Above ground CO2 emis from LUC in forest; all CH4 and N2O emissions), +# * redd+_nosoil (Above ground CO2 emis from LUC in forest and forestry; all CH4 and N2O emissions), +# * redd+natveg_nosoil (Above ground CO2 emis from LUC in forest, forestry and natveg; all CH4 and N2O emissions), +# * all (CO2 emis from LUC in all LUs; all CH4 and N2O emissions), all_nosoil (Above ground CO2 emis from LUC for all LUs; all CH4 and N2O emissions) # * all_nosoil: Above ground CO2 emis from LUC for all LUs; all CH4 and N2O emissions -# * maccs_excl_cropland_n2o: Above ground CO2 emis from all LUC; all CH4 emissions and animal-sourced N2O # * sdp_cropeff (only ch4 from rice), sdp_livestock (only ch4 and n2o from livestock), sdp_peatland (co2, ch4 and n2o from peatland), -# * sdp_redd (only co2 from vegc), sdp_soil (only co2 from litc and soilc), sdp_redd_soil (only co2 from vegc, litc, soilc) -# * sdp_all (all individual sdp scenarios combined), sdp_allnosoil (all sdp scenarios without soil pricing) +# * sdp_redd (only co2 from vegc), sdp_soil (only co2 from litc and soilc), sdp_redd_soil (only co2 from vegc, litc, soilc), +# * sdp_redd_soil_peat (only co2 from vegc, litc, soilc and co2, ch4 and n2o from peatland), sdp_all (all individual sdp scenarios combined) +# * gcs_lbs (land-based mitigation: above-ground CO2 emis from LUC in forest, forestry and natveg; co2, ch4 and n2o from peatland), +# * gcs_res (mitigation in production systems: all agricultural non-CO2 emissions) +# * ecoSysProtAll: (Above ground CO2 emis from LUC in forest, forestry, natveg; All types of emis from peatland; All CH4 and N2O emis), +# * ecoSysProtForest: (Above ground CO2 emis from LUC in forest, forestry; All CH4 and N2O emis except peatland), +# * ecoSysProtPrimForest: (Above ground CO2 emis from LUC in primary forest; All CH4 and N2O emis except peatland), +# * ecoSysProtOff: (All CH4 and N2O emis except peatland), +# * ecoSysProtAll_agMgmtExclN2O: (Above ground CO2 emis from LUC in forest, forestry, natveg; All types of emis from peatland; All CH4 emis, no further N2O emis) +# * ecoSysProtAll_agMgmtExclCH4: (Above ground CO2 emis from LUC in forest, forestry, natveg; All types of emis from peatland; All N2O emis, no further CH4 emis) cfg$gms$c56_emis_policy <- "redd+natveg_nosoil" # def = redd+natveg_nosoil # * CO2 emissions subject to carbon pricing @@ -1311,18 +1401,30 @@ c56_carbon_stock_pricing <- "actualNoAcEst" # def = actualNoAcEst # ***--------------------- 57_maccs --------------------------------------- -# * (on_sep16): maccs for non-CO2 emission mitigation activated -# * (off_jul16): maccs for non-CO2 emission mitigation deactivated -# Please note that MACCs should not be applied with extreme NUE improvements, -# as this may lead to partial double accounting. For extreme NUE improvements, -# deactivate MACCs and instead activate module realization rescaled_jan21 -# of module 51_nitrogen. Moreover, MACCs for N2O should never be applied in -# combination with the module realization rescaled_jan21 of module 51_nitrogen. -cfg$gms$maccs <- "on_sep16" # def = on_sep16 +# * (on_aug22): maccs for non-CO2 emission mitigation activated +cfg$gms$maccs <- "on_aug22" # def = on_aug22 # * Version of MACCs -# * options: PBL_2007, PBL_2019 -cfg$gms$c57_macc_version <- "PBL_2007" # def = PBL_2007 +# * options: PBL_2007, PBL_2019, PBL_2022 +cfg$gms$c57_macc_version <- "PBL_2022" # def = PBL_2022 + +# * MACC scenario (only for PBL_2022) +# * options: Default, Optimistic, Pessimistic +cfg$gms$c57_macc_scenario <- "Default" # def = Default + +# * Exogenous forced mitigation, independent of pollutant prices +# * Overwrites signal of mitigation price by choosing maximum mitigation levels +# * This avoids that emission tax is rolled over to food prices, only the +# * the mitigaton costs are rolled over to prices. +# * options: -1, 1 to 201 for each MACC mitigation step +# * -1: pollutant-price driven maccs +# * 0: inactive MACCs (price level zero) +# * 201: maximum level of mitigation +cfg$gms$s57_maxmac_n_soil <- -1 # def = -1 +cfg$gms$s57_maxmac_n_awms <- -1 # def = -1 +cfg$gms$s57_maxmac_ch4_rice <- -1 # def = -1 +cfg$gms$s57_maxmac_ch4_entferm <- -1 # def = -1 +cfg$gms$s57_maxmac_ch4_awms <- -1 # def = -1 # ***--------------------- 58_peatland ------------------------------------ # * (off): Peatland area and associated GHG emissions are assumed zero @@ -1364,7 +1466,7 @@ cfg$gms$s58_fix_peatland <- 2015 # def = 2015 # ***------------------------- 59_som ------------------------------------- # * (static_jan19): static soil carbon loss for cropland # * (cellpool_aug16): dynamic soil organic matter pool on cellular level -cfg$gms$som <- "static_jan19" # def = off +cfg$gms$som <- "static_jan19" # def = static_jan19 # * static realization switch # * options: cellular (use preprocessed cellular stock change factors) @@ -1489,6 +1591,19 @@ cfg$gms$c60_bioenergy_subsidy <- 300 # def = 300 # * (exo_flexreg_apr16): default cfg$gms$material <- "exo_flexreg_apr16" +# * Biomass demand for bioplastics is based on a logistic curve projecting +# * bioplastic demand, which matches the historic demand in 2020, and is +# * defined by the maximum demand for bioplastics s62_max_dem_bioplastics +# * (in mio. tonnes) and the midpoint s62_midpoint_dem_bioplastics (i.e. +# * where bioplastic demand is half of the maximum demand). +# * If maximum demand is 0, biomass demand for bioplastic production is not included. +# * Projected total plastic use in the "Global Ambiton" scneario of the OECD is +# * about 600 mio. tonnes in 2050 -> E.g. 200 mio. tonnes in 2050 could be a +# * reasonable (but ambitious) bioplastic scenario. With midpoint 2050 this +# * would mean s62_max_dem_bioplastic = 400. +cfg$gms$s62_max_dem_bioplastic <- 0 # def = 0 +cfg$gms$s62_midpoint_dem_bioplastic <- 2050 # def = 2050 + # ***--------------------- 70_livestock ----------------------------------- # * (fbask_jan16): default feed basket realization cfg$gms$livestock <- "fbask_jan16" # def = fbask_jan16 @@ -1628,6 +1743,15 @@ cfg$gms$s80_optfile <- 1 #### Other settings (e.g. clustering, gdx files, ...): #### +# Choosing scenario for coupling with MAGICC for emissions outside the food system +# (options) bjoernAR6_C_RemSDP-900-MagSSP1.mif, bjoernAR6_C_RemSSP1-1000-MagSDP.mif, +# bjoernAR6_C_SDP-NPi.mif, bjoernAR6_C_SDP-PkBudg1000.mif, +# bjoernAR6_C_SSP1-Base.mif, bjoernAR6_C_SSP1-NDC.mif, +# bjoernAR6_C_SSP1-NPi.mif, bjoernAR6_C_SSP1-PkBudg900.mif, +# bjoernAR6_C_SSP2-Base.mif, bjoernAR6_C_SSP2-NDC.mif, +# bjoernAR6_C_SSP2-NPi.mif, bjoernAR6_C_SSP2-PkBudg900.mif +cfg$magicc_emis_scen <- "bjoernAR6_C_SSP2-NDC.mif" + # Decide whether the runs should be run sequentially (TRUE), # or in parallel (FALSE) # NA means that this decision is taken automatically diff --git a/config/scenario_config.csv b/config/scenario_config.csv index b69088d6de..4b917d723b 100644 --- a/config/scenario_config.csv +++ b/config/scenario_config.csv @@ -1,65 +1,81 @@ -;cc;nocc;nocc_hist;SSP1;SSP2;SSP3;SSP4;SSP5;SDP;SDP-EI;SDP-RC;SDP-MC;BASE;NPI;NDC;coupling;emulator;input;Tland;eat_lancet_diet;SUSTAg1;SUSTAg2;SUSTAg3;SUSTAg4;SUSTAg5;LAMA_Inequal;LAMA_Inequal-SustDemand;LAMA_Inequal-EnvirProt;LAMA_Inequal-GHGPrice;LAMA_Sustainability;ForestryEndo;ForestryExo;ForestryOff;rcp1p9;rcp2p6;rcp4p5;rcp6p0;rcp7p0;rcp8p5 -gms$c09_pop_scenario;;;;SSP1;SSP2;SSP3;SSP4;SSP5;SSP1;SSP1;SSP1;SSP1;;;;;;;;;SSP1;SSP2;SSP3;SSP4;SSP5;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;; -gms$c09_gdp_scenario;;;;SSP1;SSP2;SSP3;SSP4;SSP5;SSP1;SDP_EI;SDP_RC;SDP_MC;;;;;;;;;SSP1;SSP2;SSP3;SSP4;SSP5;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;; -gms$c09_pal_scenario;;;;SSP1;SSP2;SSP3;SSP4;SSP5;SSP1;SSP1;SSP1;SSP1;;;;;;;;;SSP1;SSP2;SSP3;SSP4;SSP5;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;; -gms$c15_food_scenario;;;;SSP1;SSP2;SSP3;SSP4;SSP5;SSP1;SSP5;SSP1;SSP1;;;;;;;;SSP1;SSP1;SSP2;SSP3;SSP4;SSP5;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;; -gms$c15_food_scenario_noselect;;;;;;;;;;;;;;;;;;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;; -gms$s15_elastic_demand;;;;0;0;0;0;0;0;0;0;0;;;;;;;0;0;1;1;1;1;1;0;0;0;0;0;;;;;;;;; -gms$c15_rumdairy_scp_scen;;;;constant;constant;constant;constant;constant;constant;sigmoid_50pc_20_50;constant;constant;;;;;;;constant;;;;;;;;;;;;;;;;;;;; -gms$kfo_rd;;;;;;;;;;livst_rum;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -gms$c15_exo_foodscen;;;;;;;;;lin_zero_20_50;lin_zero_20_50;lin_zero_20_50;lin_zero_20_70;;;;;;;lin_zero_20_50;lin_zero_20_50;;;;;;;lin_zero_20_50;;;lin_zero_20_50;;;;;;;;; -gms$s15_exo_waste;;;;0;0;0;0;0;1;1;1;1;;;;;;;1;1;0;0;0;0;0;0;1;0;0;1;;;;;;;;; -gms$s15_waste_scen;;;;;;;;;1.2;1.36;1.2;1.3;;;;;;;1.2;1.2;;;;;;;1.2;;;1.2;;;;;;;;; -gms$s15_exo_diet;;;;0;0;0;0;0;1;0;1;1;;;;;;;1;1;0;0;0;0;0;0;1;0;0;1;;;;;;;;; -gms$c15_kcal_scen;;;;;;;;;healthy_BMI;healthy_BMI;healthy_BMI;healthy_BMI;;;;;;;healthy_BMI;healthy_BMI;;;;;;;healthy_BMI;;;healthy_BMI;;;;;;;;; -gms$c15_EAT_scen;;;;;;;;;FLX;;FLX;FLX;;;;;;;FLX;FLX;;;;;;;FLX;;;FLX;;;;;;;;; -gms$c21_trade_liberalization;;;;l908080r807070;l909090r808080;l909595r809090;l908080r807070;l908080r807070;l908080r807070;l908080r807070;l909595r809090;l908080r807070;;;;;;;;;l908080r807070;l909090r808080;l909595r809090;l908080r807070;l908080r807070;l908080r807070;l908080r807070;l908080r807070;l908080r807070;l908080r807070;;;;;;;;; -gms$c22_protect_scenario;;;;none;none;none;none;none;BH;none;BH_IFL;BH;;;;;;;BH;;none;none;none;none;none;BH_IFL;BH_IFL;BH_IFL;BH_IFL;BH_IFL;;;;;;;;; -gms$c22_protect_scenario_noselect;;;;;;;;;;;;;;;;;;;;;;;;;;none;none;BH_IFL;none;BH_IFL;;;;;;;;; -gms$c30_bioen_water;;;;rainfed;rainfed;rainfed;rainfed;rainfed;rainfed;all;rainfed;rainfed;;;;;;;rainfed;;;;;;;;;;;;;;;;;;;; -gms$s30_snv_shr;;;;0;0;0;0;0;0;0;0;0.2;;;;;;;0;;;;;;;0.2;0.2;0.2;0.2;0.2;;;;;;;;; -gms$s30_snv_shr_noselect;;;;;;;;;;;;;;;;;;;;;;;;;;0;0;0.2;0;0.2;;;;;;;;; -gms$c30_snv_target;;;;none;none;none;none;none;none;none;none;by2030;;;;;;;none;;;;;;;by2030;by2030;by2030;by2030;by2030;;;;;;;;; -gms$c31_past_suit_scen;;;;ssp126;ssp245;ssp370;ssp460;ssp585;;;;;;;;;;;;;;;;;;;;;;;;;;ssp126;ssp126;ssp245;ssp460;ssp370;ssp585 -gms$s32_aff_plantation;;;;0;0;0;0;0;0;1;0;0;;;;;;;0;;;;;;;;;;;;;;;;;;;; -gms$s32_aff_bii_coeff;;;;0;0;0;0;0;0;1;0;0;;;;;;;0;;;;;;;;;;;;;;;;;;;; -gms$s32_max_aff_area;;;;Inf;Inf;Inf;Inf;Inf;500;500;0;700;;;;;;;500;;Inf;Inf;Inf;Inf;Inf;Inf;Inf;Inf;500;500;;;;;;;;; -gms$c32_aff_mask;;;;noboreal;noboreal;noboreal;noboreal;noboreal;onlytropical;onlytropical;onlytropical;onlytropical;;;;;;;onlytropical;;noboreal;noboreal;noboreal;noboreal;noboreal;noboreal;noboreal;noboreal;noboreal;noboreal;;;;;;;;; -gms$c34_urban_scenario;;;;SSP1;SSP2;SSP3;SSP4;SSP5;SSP1;SSP1;SSP2;SSP1;;;;;;;;;SSP1;SSP2;SSP3;SSP4;SSP5;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;; -gms$c32_aff_policy;;;;;;;;;;;;;none;npi;ndc;;;;;;;;;;;ndc;ndc;ndc;ndc;ndc;;;;;;;;; -gms$c35_ad_policy;;;;;;;;;;;;;none;npi;ndc;;;;;;;;;;;ndc;ndc;ndc;ndc;ndc;;;;;;;;; -gms$c35_aolc_policy;;;;;;;;;;;;;none;npi;ndc;;;;;;;;;;;ndc;ndc;ndc;ndc;ndc;;;;;;;;; -gms$s35_forest_damage_end;;;;2030;2050;2050;2050;2030;2030;2030;2030;2030;;;;;;;2030;;2030;2050;2050;2050;2030;2030;2030;2030;2030;2030;;;;;;;;; -gms$s42_watdem_nonagr_scenario;;;;1;2;3;2;1;1;1;3;1;;;;;;;;;;;;;;2;1;2;2;1;;;;;;;;; -gms$s42_irrig_eff_scenario;;;;2;2;2;2;2;3;3;3;3;;;;;;;3;;1;1;1;1;1;3;3;3;3;3;;;;;;;;; -gms$c42_env_flow_policy;;;;on;off;off;mixed;on;on;on;mixed;on;;;;;;;on;;on;off;off;mixed;on;on;on;on;on;on;;;;;;;;; -gms$s44_target_price;;;;0;0;0;0;0;0;100;0;0;;;;;;;0;;;;;;;;;;;;;;;;;;;; -gms$c50_scen_neff;;;;neff65_70_starty2010;neff60_60_starty2010;neff55_60_starty2010;neff65_70_starty2010;neff55_60_starty2010;neff75_80_starty2010;neff75_80_starty2010;neff65_70_starty2010;neff75_80_starty2010;;;;;;;neff75_80_starty2010;;neff65_70_starty2010;neff60_60_starty2010;neff55_60_starty2010;neff65_70_starty2010;neff55_60_starty2010;neff75_80_starty2010;neff75_80_starty2010;neff75_80_starty2010;neff75_80_starty2010;neff75_80_starty2010;;;;;;;;; -gms$c50_scen_neff_noselect;;;;neff65_70_starty2010;neff60_60_starty2010;neff55_60_starty2010;neff65_70_starty2010;neff55_60_starty2010;neff75_80_starty2010;neff75_80_starty2010;neff65_70_starty2010;neff75_80_starty2010;;;;;;;neff75_80_starty2010;;neff65_70_starty2010;neff60_60_starty2010;neff55_60_starty2010;neff65_70_starty2010;neff55_60_starty2010;neff65_70_starty2010;neff65_70_starty2010;neff75_80_starty2010;neff65_70_starty2010;neff75_80_starty2010;;;;;;;;; -gms$c55_scen_conf;;;;ssp1;ssp2;ssp3;ssp4;ssp5;ssp1;ssp1;ssp1;ssp1;;;;;;;ssp1;;ssp1;ssp2;ssp3;ssp4;ssp5;ssp1;ssp1;ssp1;ssp1;ssp1;;;;;;;;; -gms$c55_scen_conf_noselect;;;;ssp1;ssp2;ssp3;ssp4;ssp5;ssp1;ssp1;ssp1;ssp1;;;;;;;ssp1;;ssp1;ssp2;ssp3;ssp4;ssp5;ssp4;ssp4;ssp1;ssp4;ssp1;;;;;;;;; -gms$c56_pollutant_prices;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;SSPDB-SSP1-20-IMAGE;SSPDB-SSP2-26-MESSAGE-GLOBIOM;SSPDB-SSP3-60-AIM-CGE;SSPDB-SSP4-45-GCAM4;SSPDB-SSP5-45-REMIND-MAGPIE;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;; -gms$c56_pollutant_prices_noselect;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;SSPDB-SSP1-20-IMAGE;SSPDB-SSP2-26-MESSAGE-GLOBIOM;SSPDB-SSP3-60-AIM-CGE;SSPDB-SSP4-45-GCAM4;SSPDB-SSP5-45-REMIND-MAGPIE;R21M42-SDP-NPi;R21M42-SDP-NPi;R21M42-SDP-NPi;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;; -gms$s56_buffer_aff;;;;0.2;0.2;0.2;0.2;0.2;0.2;0.5;0.2;0.3;;;;;;;0.2;;;;;;;;;;;;;;;;;;;; -gms$c56_emis_policy;;;;redd+natveg_nosoil;redd+natveg_nosoil;redd+natveg_nosoil;redd+natveg_nosoil;redd+natveg_nosoil;redd+natveg_nosoil;redd+natveg_nosoil;redd+_nosoil;all_nosoil;;;;;;;redd+natveg_nosoil;;;;;;;;;;;;;;;;;;;; -gms$maccs;;;;;;;;;;;;;;;;;;;;;on_sep16;on_sep16;on_sep16;on_sep16;on_sep16;;;;;;;;;;;;;; -gms$c60_2ndgen_biodem;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;SSPDB-SSP1-20-IMAGE;SSPDB-SSP2-26-MESSAGE-GLOBIOM;SSPDB-SSP3-60-AIM-CGE;SSPDB-SSP4-45-GCAM4;SSPDB-SSP5-45-REMIND-MAGPIE;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;; -gms$c60_2ndgen_biodem_noselect;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;SSPDB-SSP1-20-IMAGE;SSPDB-SSP2-26-MESSAGE-GLOBIOM;SSPDB-SSP3-60-AIM-CGE;SSPDB-SSP4-45-GCAM4;SSPDB-SSP5-45-REMIND-MAGPIE;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;; -gms$c60_1stgen_biodem;;;;phaseout2020;const2020;const2030;const2020;phaseout2020;phaseout2020;phaseout2020;phaseout2020;phaseout2020;;;;;;;phaseout2020;;phaseout2020;const2020;const2030;const2020;phaseout2020;phaseout2020;phaseout2020;phaseout2020;phaseout2020;phaseout2020;;;;;;;;; -gms$c60_biodem_level;;;;;;;;;;;;;;;;1;0;;;;;;;;;1;1;1;1;1;;;;;;;;; -gms$c60_bioenergy_subsidy;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -gms$c60_res_2ndgenBE_dem;;;;ssp1;ssp2;ssp3;ssp4;ssp5;sdp;sdp;sdp;sdp;;;;;;;sdp;;ssp1;ssp2;ssp3;ssp4;ssp5;ssp4;sdp;ssp4;ssp4;sdp;;;;;;;;; -gms$c70_feed_scen;;;;ssp1;ssp2;ssp3;ssp4;ssp5;ssp1;ssp5;ssp1;ssp1;;;;;;;ssp1;;ssp1;ssp2;ssp3;ssp4;ssp5;ssp4;ssp1;ssp4;ssp4;ssp1;;;;;;;;; -gms$c_timesteps;;;;;;;;;;;;;;;;less_TS;less_TS;;;;;;;;;5year;5year;5year;5year;5year;;;;;;;;; -gms$c14_yields_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;cc;cc;cc;cc;cc;;;;;;;;; -gms$c42_watdem_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;cc;cc;cc;cc;cc;;;;;;;;; -gms$c43_watavail_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;cc;cc;cc;cc;cc;;;;;;;;; -gms$c52_carbon_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;cc;cc;cc;cc;cc;;;;;;;;; -gms$c59_som_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;cc;;;cc;cc;cc;cc;cc;cc;cc;cc;cc;cc;;;;;;;;; -gms$s32_initial_distribution;;;;;;;;;;;;;;;;;;;;;;;;;;4;4;4;4;4;4;4;0;;;;;; -gms$s32_hvarea;;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;2;1;0;;;;;; -gms$s35_secdf_distribution;;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;2;2;0;;;;;; -gms$s35_hvarea;;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;2;2;0;;;;;; -gms$s73_timber_demand_switch;;;;;;;;;;;;;;;;;;;;;;;;;;1;1;1;1;1;1;1;0;;;;;; -input['cellular'];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.72_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.72_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.72_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.72_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.72_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.72_h12_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz -gms$c52_land_carbon_sink_rcp;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;RCP19;RCP26;RCP45;RCP60;RCPBU;RCPBU +;cc;nocc;nocc_hist;SSP1;SSP2;SSP3;SSP4;SSP5;SDP;SDP-EI;SDP-RC;SDP-MC;BASE;NPI;NDC;coupling;emulator;input;Tland;eat_lancet_diet;LAMA_Inequal;LAMA_Inequal-SustDemand;LAMA_Inequal-EnvirProt;LAMA_Inequal-GHGPrice;LAMA_Sustainability;NAVIGATE_AllOff;NAVIGATE_LandSup;NAVIGATE_LandDem;NAVIGATE_AllOn;ForestryEndo;ForestryExo;ForestryOff;frst_shock_none;frst_shock_002lin2030;frst_shock_004lin2030;frst_shock_008lin2030;frst_shock_016lin2030;rcp1p9;rcp2p6;rcp4p5;rcp6p0;rcp7p0;rcp8p5 +gms$c09_pop_scenario;;;;SSP1;SSP2;SSP3;SSP4;SSP5;SSP1;SSP1;SSP1;SSP1;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;; +gms$c09_gdp_scenario;;;;SSP1;SSP2;SSP3;SSP4;SSP5;SSP1;SDP_EI;SDP_RC;SDP_MC;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;; +gms$c09_pal_scenario;;;;SSP1;SSP2;SSP3;SSP4;SSP5;SSP1;SSP1;SSP1;SSP1;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;; +gms$c15_food_scenario;;;;SSP1;SSP2;SSP3;SSP4;SSP5;SSP1;SSP2;SSP1;SSP1;;;;;;;;SSP1;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;; +gms$c15_food_scenario_noselect;;;;;;;;;;;;;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;; +gms$s15_elastic_demand;;;;0;0;0;0;0;0;0;0;0;;;;;;;0;0;0;0;0;0;0;;;;;;;;;;;;;;;;;; +gms$c15_rumdairy_scp_scen;;;;constant;constant;constant;constant;constant;constant;sigmoid_50pc_20_50;constant;constant;;;;;;;constant;;;;;;;;;;;;;;;;;;;;;;;; +gms$kfo_rd;;;;;;;;;;livst_rum;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c15_exo_foodscen;;;;;;;;;lin_zero_20_50;lin_zero_20_50;lin_zero_20_50;lin_zero_20_70;;;;;;;lin_zero_20_50;lin_zero_20_50;;lin_zero_20_50;;;lin_zero_20_50;;;;;;;;;;;;;;;;;; +gms$s15_exo_waste;;;;0;0;0;0;0;1;1;1;1;;;;;;;1;1;0;1;0;0;1;0;0;1;1;;;;;;;;;;;;;; +gms$s15_waste_scen;;;;;;;;;1.2;1.36;1.2;1.3;;;;;;;1.2;1.2;;1.2;;;1.2;;;;;;;;;;;;;;;;;; +gms$s15_exo_diet;;;;0;0;0;0;0;1;1;1;1;;;;;;;1;1;0;1;0;0;1;0;0;1;1;;;;;;;;;;;;;; +gms$c15_kcal_scen;;;;;;;;;healthy_BMI;no_underweight;healthy_BMI;healthy_BMI;;;;;;;healthy_BMI;healthy_BMI;;healthy_BMI;;;healthy_BMI;;;;;;;;;;;;;;;;;; +gms$c15_EAT_scen;;;;;;;;;FLX;;FLX;FLX;;;;;;;FLX;FLX;;FLX;;;FLX;;;;;;;;;;;;;;;;;; +gms$s15_exo_monogastric;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;1;1;1;;;;;;;;;;;;;;;;;; +gms$s15_exo_ruminant;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;1;1;1;;;;;;;;;;;;;;;;;; +gms$s15_exo_fish;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;1;1;1;;;;;;;;;;;;;;;;;; +gms$s15_exo_fruitvegnut;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;1;1;1;;;;;;;;;;;;;;;;;; +gms$s15_exo_pulses;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;1;1;1;;;;;;;;;;;;;;;;;; +gms$s15_exo_sugar;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;1;1;1;;;;;;;;;;;;;;;;;; +gms$s15_exo_oils;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;1;1;1;;;;;;;;;;;;;;;;;; +gms$s15_exo_brans;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;1;1;1;;;;;;;;;;;;;;;;;; +gms$s15_exo_scp;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;1;1;1;;;;;;;;;;;;;;;;;; +gms$s15_exo_alcohol;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;1;1;1;;;;;;;;;;;;;;;;;; +gms$c21_trade_liberalization;;;;l908080r807070;l909090r808080;l909595r809090;l908080r807070;l908080r807070;l908080r807070;l908080r807070;l909595r809090;l908080r807070;;;;;;;;;l908080r807070;l908080r807070;l908080r807070;l908080r807070;l908080r807070;;;;;;;;;;;;;;;;;; +gms$c22_protect_scenario;;;;none;none;none;none;none;BH;none;BH_IFL;BH;;;;;;;BH;;BH_IFL;BH_IFL;BH_IFL;BH_IFL;BH_IFL;;;;;;;;;;;;;;;;;; +gms$c22_protect_scenario_noselect;;;;;;;;;;;;;;;;;;;;;none;none;BH_IFL;none;BH_IFL;;;;;;;;;;;;;;;;;; +gms$c30_bioen_water;;;;rainfed;rainfed;rainfed;rainfed;rainfed;rainfed;all;rainfed;rainfed;;;;;;;rainfed;;;;;;;;;;;;;;;;;;;;;;;; +gms$s30_snv_shr;;;;0;0;0;0;0;0;0;0;0.2;;;;;;;0;;0.2;0.2;0.2;0.2;0.2;;;;;;;;;;;;;;;;;; +gms$s30_snv_shr_noselect;;;;;;;;;;;;;;;;;;;;;0;0;0.2;0;0.2;;;;;;;;;;;;;;;;;; +gms$c30_snv_target;;;;none;none;none;none;none;none;none;none;by2030;;;;;;;none;;by2030;by2030;by2030;by2030;by2030;;;;;;;;;;;;;;;;;; +gms$c31_past_suit_scen;;;;ssp126;ssp245;ssp370;ssp460;ssp585;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ssp126;ssp126;ssp245;ssp460;ssp370;ssp585 +gms$s32_aff_plantation;;;;0;0;0;0;0;0;1;0;0;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;; +gms$s32_aff_bii_coeff;;;;0;0;0;0;0;0;1;0;0;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;; +gms$s32_max_aff_area;;;;Inf;Inf;Inf;Inf;Inf;500;400;0;700;;;;;;;500;;Inf;Inf;Inf;500;500;;;;;;;;;;;;;;;;;; +gms$c32_aff_mask;;;;noboreal;noboreal;noboreal;noboreal;noboreal;onlytropical;onlytropical;onlytropical;onlytropical;;;;;;;onlytropical;;noboreal;noboreal;noboreal;noboreal;noboreal;;;;;;;;;;;;;;;;;; +gms$c34_urban_scenario;;;;SSP1;SSP2;SSP3;SSP4;SSP5;SSP1;SSP1;SSP2;SSP1;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;; +gms$c32_aff_policy;;;;;;;;;;;;;none;npi;ndc;;;;;;ndc;ndc;ndc;ndc;ndc;;;;;;;;;;;;;;;;;; +gms$c35_ad_policy;;;;;;;;;;;;;none;npi;ndc;;;;;;ndc;ndc;ndc;ndc;ndc;;;;;;;;;;;;;;;;;; +gms$c35_aolc_policy;;;;;;;;;;;;;none;npi;ndc;;;;;;ndc;ndc;ndc;ndc;ndc;;;;;;;;;;;;;;;;;; +gms$s35_forest_damage_end;;;;2030;2050;2050;2050;2030;2030;2030;2030;2030;;;;;;;2030;;2030;2030;2030;2030;2030;;;;;;;;;;;;;;;;;; +gms$s42_watdem_nonagr_scenario;;;;1;2;3;2;1;1;1;3;1;;;;;;;;;2;1;2;2;1;;;;;;;;;;;;;;;;;; +gms$s42_irrig_eff_scenario;;;;2;2;2;2;2;3;3;3;3;;;;;;;3;;3;3;3;3;3;;;;;;;;;;;;;;;;;; +gms$c42_env_flow_policy;;;;on;off;off;mixed;on;on;on;mixed;on;;;;;;;on;;on;on;on;on;on;;;;;;;;;;;;;;;;;; +gms$s44_target_price;;;;0;0;0;0;0;0;100;0;0;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;; +gms$c50_scen_neff;;;;baseeff_add3_add10_add20_max75;baseeff_add3_add5_add10_max65;baseeff_add3_add0_add0_max55;baseeff_add3_add10_add15_max75;baseeff_add3_add5_add15_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max65;baseeff_add3_add15_add25_max75;;;;;;;baseeff_add3_add15_add25_max75;;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max75;;;;;;;;;;;;;;;;;; +gms$c50_scen_neff_noselect;;;;baseeff_add3_add10_add20_max75;baseeff_add3_add5_add10_max65;baseeff_add3_add0_add0_max55;baseeff_add3_add10_add15_max75;baseeff_add3_add5_add15_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max65;baseeff_add3_add15_add25_max75;;;;;;;baseeff_add3_add15_add25_max75;;baseeff_add3_add10_add15_max75;baseeff_add3_add10_add15_max75;baseeff_add3_add10_add15_max75;baseeff_add3_add10_add15_max75;baseeff_add3_add10_add15_max75;;;;;;;;;;;;;;;;;; +gms$c55_scen_conf;;;;ssp1;ssp2;ssp3;ssp4;ssp5;ssp1;ssp1;ssp1;ssp1;;;;;;;ssp1;;ssp1;ssp1;ssp1;ssp1;ssp1;;;;;;;;;;;;;;;;;; +gms$c55_scen_conf_noselect;;;;ssp1;ssp2;ssp3;ssp4;ssp5;ssp1;ssp1;ssp1;ssp1;;;;;;;ssp1;;ssp4;ssp4;ssp1;ssp4;ssp1;;;;;;;;;;;;;;;;;; +gms$c56_pollutant_prices;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;; +gms$c56_pollutant_prices_noselect;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;R21M42-SDP-NPi;R21M42-SDP-NPi;R21M42-SDP-NPi;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;; +gms$s56_buffer_aff;;;;0.2;0.2;0.2;0.2;0.2;0.2;0.5;0.2;0.3;;;;;;;0.2;;;;;;;;;;;;;;;;;;;;;;;; +gms$c56_emis_policy;;;;redd+natveg_nosoil;redd+natveg_nosoil;redd+natveg_nosoil;redd+natveg_nosoil;redd+natveg_nosoil;redd+natveg_nosoil;redd+natveg_nosoil;redd+_nosoil;all_nosoil;;;;;;;redd+natveg_nosoil;;;;;;;;;;;;;;;;;;;;;;;; +gms$maccs;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c60_2ndgen_biodem;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;; +gms$c60_2ndgen_biodem_noselect;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;; +gms$c60_1stgen_biodem;;;;phaseout2020;const2020;const2030;const2020;phaseout2020;phaseout2020;phaseout2020;phaseout2020;phaseout2020;;;;;;;phaseout2020;;phaseout2020;phaseout2020;phaseout2020;phaseout2020;phaseout2020;;;;;;;;;;;;;;;;;; +gms$c60_biodem_level;;;;;;;;;;;;;;;;1;0;;;;1;1;1;1;1;;;;;;;;;;;;;;;;;; +gms$c60_bioenergy_subsidy;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c60_res_2ndgenBE_dem;;;;ssp1;ssp2;ssp3;ssp4;ssp5;sdp;ssp2;sdp;sdp;;;;;;;sdp;;ssp4;sdp;ssp4;ssp4;sdp;;;;;;;;;;;;;;;;;; +gms$c70_feed_scen;;;;ssp1;ssp2;ssp3;ssp4;ssp5;ssp1;ssp5;ssp1;ssp1;;;;;;;ssp1;;ssp4;ssp1;ssp4;ssp4;ssp1;;;;;;;;;;;;;;;;;; +gms$c_timesteps;;;;;;;;;;;;;;;;less_TS;less_TS;;;;5year;5year;5year;5year;5year;;;;;;;;;;;;;;;;;; +gms$c14_yields_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;; +gms$c42_watdem_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;; +gms$c43_watavail_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;; +gms$c52_carbon_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;; +gms$c59_som_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;cc;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;; +gms$s32_initial_distribution;;;;;;;;;;;;;;;;;;;;;4;4;4;4;4;;;;;4;4;0;;;;;;;;;;; +gms$s32_hvarea;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;1;0;;;;;;;;;;; +gms$s35_secdf_distribution;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;2;0;;;;;;;;;;; +gms$s35_hvarea;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;2;0;;;;;;;;;;; +gms$s73_timber_demand_switch;;;;;;;;;;;;;;;;;;;;;1;1;1;1;1;;;;;1;1;0;;;;;;;;;;; +gms$s35_forest_damage;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4;4;4;4;4;;;;;; +gms$c32_shock_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;none;002lin2030;004lin2030;008lin2030;016lin2030;;;;;; +gms$c35_shock_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;none;002lin2030;004lin2030;008lin2030;016lin2030;;;;;; +input['cellular'];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.77_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.77_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.77_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.77_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.77_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.77_h12_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz +gms$c52_land_carbon_sink_rcp;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;RCP19;RCP26;RCP45;RCP60;RCPBU;RCPBU +gms$c57_macc_version;;;;;;;;;;;;;;;;;;;;;;;;;;PBL_2022;PBL_2022;PBL_2022;PBL_2022;;;;;;;;;;;;;; +gms$c57_macc_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;Default;Optimistic;Default;Optimistic;;;;;;;;;;;;;; +gms$s58_rewetting_switch;;;;;;;;;;;;;;;;;;;;;;;;;;0;1;0;1;;;;;;;;;;;;;; diff --git a/config/scenario_fsec.csv b/config/scenario_fsec.csv new file mode 100644 index 0000000000..fec9df7924 --- /dev/null +++ b/config/scenario_fsec.csv @@ -0,0 +1,64 @@ +;FSEC;population;institutions;energy;bioplastics;minWage;noUnderweight;noOverweight;fruitsNutsVegSeeds;monogastrics;ruminants;pulses;processed;fish;waste;awms;livestock;cropefficiency;nueMAC;riceMAC;biodiversity;fairTrade;timberCities;REDDaff;REDD;landSharing;landSparing;waterSparing;peatland;airPollution;soil;allDiet;allDietAndWaste;allEnvPrice;allEmisPrice;SSP1;SSP2;SSP3;SSP4;SSP5 +gms$c09_pop_scenario;;SSP1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c09_gdp_scenario;;;SSP1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c09_pal_scenario;;;;SSP1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$s12_interest_lic;;;0.06;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$s12_interest_hic;;;0.04;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$food;anthro_iso_jun22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_waste;;;;;;;0;0;0;0;0;0;0;0;1;;;;;;;;;;;;;;;;;0;1;;;;;;; +gms$s15_exo_diet;;;;;;;1;1;1;1;1;1;1;1;0;;;;;;;;;;;;;;;;;1;1;;;;;;; +gms$c15_kcal_scen;;;;;;;no_underweight;no_overweight;endo;endo;endo;endo;endo;endo;healthy_BMI;;;;;;;;;;;;;;;;;healthy_BMI;healthy_BMI;;;;;;; +gms$c15_EAT_scen;;;;;;;FLX;FLX;FLX;FLX;FLX;FLX;FLX;FLX;FLX;;;;;;;;;;;;;;;;;FLX;FLX;;;;;;; +gms$s15_exo_monogastric;;;;;;;0;0;0;1;0;0;0;0;0;;;;;;;;;;;;;;;;;1;1;;;;;;; +gms$s15_exo_ruminant;;;;;;;0;0;0;0;1;0;0;0;0;;;;;;;;;;;;;;;;;1;1;;;;;;; +gms$s15_exo_fish;;;;;;;0;0;0;0;0;0;0;1;0;;;;;;;;;;;;;;;;;1;1;;;;;;; +gms$s15_exo_fruitvegnut;;;;;;;0;0;1;0;0;0;0;0;0;;;;;;;;;;;;;;;;;1;1;;;;;;; +gms$s15_exo_pulses;;;;;;;0;0;0;0;0;1;0;0;0;;;;;;;;;;;;;;;;;1;1;;;;;;; +gms$s15_exo_sugar;;;;;;;0;0;0;0;0;0;1;0;0;;;;;;;;;;;;;;;;;1;1;;;;;;; +gms$s15_exo_oils;;;;;;;0;0;0;0;0;0;1;0;0;;;;;;;;;;;;;;;;;1;1;;;;;;; +gms$s15_exo_scp;;;;;;;0;0;0;0;0;0;1;0;0;;;;;;;;;;;;;;;;;1;1;;;;;;; +gms$s15_exo_alcohol;;;;;;;0;0;0;0;0;0;1;0;0;;;;;;;;;;;;;;;;;1;1;;;;;;; +gms$c18_burn_scen;constant;;;;;;;;;;;;;;;;;;;;;;;;;;;;;phaseout;;;;;;;;;; +gms$c21_trade_liberalization;;;;;;;;;;;;;;;;;;;;;;l908080r807070;;;;;;;;;;;;;;;;;; +gms$c22_protect_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;HalfEarth;;;;;;;;;;;;; +gms$crop;penalty_apr22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c30_rotation_scenario;default;;;;;;;;;;;;;;;;;;;;;;;;;agroecology;;;;;;;;;;;;;; +gms$c30_rotation_scenario_speed;by2050;;;;;;;;;;;;;;;;;;;;;;;;;by2050;;;;;;;;;;;;;; +gms$c30_marginal_land;q33_marginal;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c30_bioen_water;;;;;;;;;;;;;;;;;;;;;;;;;;;;rainfed;;;;;;;;;;;; +gms$past;endo_jun13;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c31_past_suit_scen;ssp245;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ssp126;ssp126;ssp245;ssp370;ssp460;ssp585 +gms$c34_urban_scenario;;;;SSP1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$s42_watdem_nonagr_scenario;;;;1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c42_env_flow_policy;off;;;;;;;;;;;;;;;;;;;;;;;;;;;on;;;;;;;;;;;; +gms$c32_aff_policy;;;;;;;;;;;;;;;;;;;;;;;;ndc;;;;;;;;;;;;;;;; +gms$c32_aff_mask;;;;;;;;;;;;;;;;;;;;;;;;onlytropical;;;;;;;;;;;;;;;; +gms$s32_max_aff_area;;;;;;;;;;;;;;;;;;;;;;;;500;;;;;;;;;;;;;;;; +gms$factor_costs;sticky_labor;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$s36_minimum_wage;0;;;;;5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c38_fac_req;reg;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$s44_bii_lower_bound;;;;;;;;;;;;;;;;;;;;;0.81;;;;;;;;;;;;;;;;;;; +gms$s44_target_year;;;;;;;;;;;;;;;;;;;;;2050;;;;;;;;;;;;;;;;;;; +gms$nitrogen;rescaled_jan21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c55_scen_conf;;;;;;;;;;;;;;;;GoodPractice;;;;;;;;;;;;;;;;;;;;;;;; +gms$c56_emis_policy;none;;;;;;;;;;;;;;;;;sdp_cropeff;;;;;;sdp_redd;sdp_redd;;;;sdp_peatland;;sdp_soil;;;sdp_redd_soil_peat;sdp_all;;;;; +gms$c56_pollutant_prices;R21M42-SSP2-PkBudg1300;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$s56_c_price_induced_aff;0;;;;;;;;;;;;;;;;;;;;;;;1;;;;;;;;;;;;;;;; +gms$s57_maxmac_n_soil;-1;;;;;;;;;;;;;;;;;;201;;;;;;;;;;;;;;;;;;;;; +gms$s57_maxmac_ch4_rice;-1;;;;;;;;;;;;;;;;;;;201;;;;;;;;;;;;;;;;;;;; +gms$s57_maxmac_ch4_entferm;-1;;;;;;;;;;;;;;;;201;;;;;;;;;;;;;;;;;;;;;;; +gms$s57_maxmac_ch4_awms;-1;;;;;;;;;;;;;;;201;;;;;;;;;;;;;;;;;;;;;;;; +gms$s58_rewetting_switch;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Inf;;;;;;;;;;; +gms$som;cellpool_aug16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c60_2ndgen_biodem;;;;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c60_res_2ndgenBE_dem;;;;sdp;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$s62_max_dem_bioplastic;0;;;;400;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c70_fac_req_regr;reg;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c70_feed_scen;;;;;;;;;;;;;;;;;ssp1;;;;;;;;;;;;;;;;;;;;;;; +gms$c73_build_demand;;;;;;;;;;;;;;;;;;;;;;;50pc;;;;;;;;;;;;;;;;; +input['cellular'];rev4.77FSEC_e2bdb6cd_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.77FSEC_e2bdb6cd_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.77FSEC_e2bdb6cd_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.77FSEC_e2bdb6cd_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.77FSEC_e2bdb6cd_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.77FSEC_e2bdb6cd_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.77FSEC_e2bdb6cd_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz +input['regional'];rev4.77FSEC_e2bdb6cd_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['validation'];rev4.77FSEC_e2bdb6cd_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['additional'];additional_data_rev4.32.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['calibration'];calibration_FSEC_13Oct22.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +magicc_emis_scen;bjoernAR6_C_SSP2-NDC.mif;;;bjoernAR6_C_SSP2-PkBudg900.mif;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;bjoernAR6_C_RemSDP-900-MagSSP1.mif;bjoernAR6_C_SSP1-NDC.mif;;;; diff --git a/literature.bib b/literature.bib index 3dacc451d6..cea62fbac2 100644 --- a/literature.bib +++ b/literature.bib @@ -11,10 +11,42 @@ @Article{dietrich_magpie4 } @article{bodirsky_starved_nodate, - title = {From starved to stuffed: {Long}-term dynamics of diets and anthropometrics.}, - author = {Bodirsky, Benjamin Leon and Dietrich, Jan Philipp and Martinelli, Eleonora and Stenstad, Anthonia and Pradhan, Prajal and Rolinski, Susanne and Gabrysch, Sabine and Mishra, Abhijeet and Le-Mouel, Chantal and Baumstark, Lavinia and Wang, Xiaoxi and Lotze-Campen, Hermann and Popp, Alexander} + title = {The ongoing nutrition transition thwarts long-term targets for food security, public health and environmental protection}, + volume = {10}, + copyright = {2020 The Author(s)}, + issn = {2045-2322}, + url = {https://www.nature.com/articles/s41598-020-75213-3}, + doi = {10.1038/s41598-020-75213-3}, + abstract = {The nutrition transition transforms food systems globally and shapes public health and environmental change. Here we provide a global forward-looking assessment of a continued nutrition transition and its interlinked symptoms in respect to food consumption. These symptoms range from underweight and unbalanced diets to obesity, food waste and environmental pressure. We find that by 2050, 45\% (39–52\%) of the world population will be overweight and 16\% (13–20\%) obese, compared to 29\% and 9\% in 2010 respectively. The prevalence of underweight approximately halves but absolute numbers stagnate at 0.4–0.7 billion. Aligned, dietary composition shifts towards animal-source foods and empty calories, while the consumption of vegetables, fruits and nuts increases insufficiently. Population growth, ageing, increasing body mass and more wasteful consumption patterns are jointly pushing global food demand from 30 to 45 (43–47) Exajoules. Our comprehensive open dataset and model provides the interfaces necessary for integrated studies of global health, food systems, and environmental change. Achieving zero hunger, healthy diets, and a food demand compatible with environmental boundaries necessitates a coordinated redirection of the nutrition transition. Reducing household waste, animal-source foods, and overweight could synergistically address multiple symptoms at once, while eliminating underweight would not substantially increase food demand.}, + language = {en}, + number = {1}, + urldate = {2020-11-18}, + journal = {Scientific Reports}, + author = {Bodirsky, Benjamin Leon and Dietrich, Jan Philipp and Martinelli, Eleonora and Stenstad, Antonia and Pradhan, Prajal and Gabrysch, Sabine and Mishra, Abhijeet and Weindl, Isabelle and Le Mouël, Chantal and Rolinski, Susanne and Baumstark, Lavinia and Wang, Xiaoxi and Waid, Jillian L. and Lotze-Campen, Hermann and Popp, Alexander}, + month = nov, + year = {2020}, + note = {Number: 1 +Publisher: Nature Publishing Group}, + pages = {19778}, + file = {Bodirsky et al. - 2020 - The ongoing nutrition transition thwarts long-term.pdf:C\:\\bbb\\PIK\\Bibliographie\\storage\\YTSW6G8R\\Bodirsky et al. - 2020 - The ongoing nutrition transition thwarts long-term.pdf:application/pdf;nutrition_transition.docx:C\:\\bbb\\PIK\\Bibliographie\\storage\\I8485S9W\\41598_2020_75213_MOESM2_ESM.docx:application/vnd.openxmlformats-officedocument.wordprocessingml.document;nutrition_transition.zip:C\:\\bbb\\PIK\\Bibliographie\\storage\\4APAXJTA\\41598_2020_75213_MOESM1_ESM.zip:application/x-zip-compressed;Snapshot:C\:\\bbb\\PIK\\Bibliographie\\storage\\FQ5MF7D2\\s41598-020-75213-3.html:text/html}, +} + +@article{willett_food_2019, + title = {Food in the {Anthropocene}: the {EAT}–{Lancet} {Commission} on healthy diets from sustainable food systems}, + issn = {01406736}, + shorttitle = {Food in the {Anthropocene}}, + url = {https://linkinghub.elsevier.com/retrieve/pii/S0140673618317884}, + doi = {10.1016/S0140-6736(18)31788-4}, + language = {en}, + urldate = {2019-01-18}, + journal = {The Lancet}, + author = {Willett, Walter and Rockström, Johan and Loken, Brent and Springmann, Marco and Lang, Tim and Vermeulen, Sonja and Garnett, Tara and Tilman, David and DeClerck, Fabrice and Wood, Amanda and Jonell, Malin and Clark, Michael and Gordon, Line J and Fanzo, Jessica and Hawkes, Corinna and Zurayk, Rami and Rivera, Juan A and De Vries, Wim and Majele Sibanda, Lindiwe and Afshin, Ashkan and Chaudhary, Abhishek and Herrero, Mario and Agustina, Rina and Branca, Francesco and Lartey, Anna and Fan, Shenggen and Crona, Beatrice and Fox, Elizabeth and Bignet, Victoria and Troell, Max and Lindahl, Therese and Singh, Sudhvir and Cornell, Sarah E and Srinath Reddy, K and Narain, Sunita and Nishtar, Sania and Murray, Christopher J L}, + month = jan, + year = {2019}, + file = {Willett et al. - 2019 - Food in the Anthropocene the EAT–Lancet Commissio.pdf:C\:\\bbb\\PIK\\Bibliographie\\storage\\2FLEBM8R\\Willett et al. - 2019 - Food in the Anthropocene the EAT–Lancet Commissio.pdf:application/pdf}, } + @misc{FAOSTAT, author = {FAOSTAT}, title = {{FAOSTAT Database}}, @@ -1005,6 +1037,15 @@ @article{siebert_FAO_2007 year = {2007}, } +@book{fao_aquastat_2016, + address = {Rome}, + title = {{AQUASTAT} core database}, + publisher = {Food and Agriculture Organization of the United Nations (FAO)}, + author = {{FAO}}, + year = {2016}, + note = {Database accessed on 2022/09/20} +} + @techreport{worldbank_irrigation_1995, title = {World Bank and Irrigation}, institution = {World Bank}, diff --git a/main.gms b/main.gms index 4a8d591103..fcd174e4cf 100644 --- a/main.gms +++ b/main.gms @@ -145,24 +145,26 @@ $title magpie *' * Always try to access model outputs through the corresponding magpie package instead of accessing them directly with readGDX. It cannot be guaranteed that your script will work in the future if you do otherwise (as only the corresponding magpie package will be continuously adapted to changes in the GAMS code). *##################### R SECTION START (VERSION INFO) ########################## +* +* Used data set: rev4.77_h12_magpie.tgz * md5sum: NA * Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output * -* Used data set: rev4.73_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz +* Used data set: rev4.77_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz * md5sum: NA * Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output * -* Used data set: rev4.73_h12_validation.tgz +* Used data set: rev4.77_h12_validation.tgz * md5sum: NA * Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output * -* Used data set: additional_data_rev4.26.tgz +* Used data set: additional_data_rev4.30.tgz * md5sum: NA -* Repository: https://rse.pik-potsdam.de/data/magpie/public +* Repository: scp://cluster.pik-potsdam.de/p/projects/landuse/data/input/archive * * Used data set: calibration_H12_per_ton_fao_may22_28May22.tgz -* md5sum: f6bf26be99c5dbd29e13a38af38c0d31 -* Repository: /p/projects/rd3mod/mirror/rse.pik-potsdam.de/data/magpie/public +* md5sum: NA +* Repository: https://rse.pik-potsdam.de/data/magpie/public * * Low resolution: c200 * High resolution: 0.5 @@ -175,22 +177,23 @@ $title magpie * * Regionscode: 62eff8f7 * -* Regions data revision: 4.73 +* Regions data revision: 4.77 * * lpj2magpie settings: * * LPJmL data: MRI-ESM2-0:ssp370 -* * Revision: 4.73 +* * Revision: 4.77 * * aggregation settings: * * Input resolution: 0.5 * * Output resolution: c200 * * Regionscode: 62eff8f7 +* * Number of clusters per region: +* CAZ CHA EUR IND JPN LAM MEA NEU OAS REF SSA USA +* 6 23 7 6 1 43 27 7 11 12 37 20 * * Call: withCallingHandlers(expr, message = messageHandler, warning = warningHandler, error = errorHandler) * -* Warning message: -* package 'lucode2' was built under R version 4.2.1 * -* Last modification (input data): Tue Jul 5 14:20:37 2022 +* Last modification (input data): Fri Sep 23 12:55:58 2022 * *###################### R SECTION END (VERSION INFO) ########################### @@ -264,14 +267,14 @@ $setglobal water_availability total_water_aug13 $setglobal biodiversity bii_target $setglobal climate static -$setglobal nr_soil_budget exoeff_aug16 -$setglobal nitrogen ipcc2006_sep16 +$setglobal nr_soil_budget macceff_aug22 +$setglobal nitrogen rescaled_jan21 $setglobal carbon normal_dec17 -$setglobal methane ipcc2006_flexreg_apr16 +$setglobal methane ipcc2006_aug22 $setglobal phosphorus off $setglobal awms ipcc2006_aug16 -$setglobal ghg_policy price_jan20 -$setglobal maccs on_sep16 +$setglobal ghg_policy price_aug22 +$setglobal maccs on_aug22 $setglobal peatland on $setglobal som static_jan19 diff --git a/modules/10_land/feb15/declarations.gms b/modules/10_land/feb15/declarations.gms index 4ed6744fe1..4623e6fd89 100644 --- a/modules/10_land/feb15/declarations.gms +++ b/modules/10_land/feb15/declarations.gms @@ -8,7 +8,7 @@ parameters pm_land_start(j,land) Land initialization area (mio. ha) - pcm_land(j,land) Land area in previous time step (mio. ha) + pcm_land(j,land) Land area in previous time step including possible changes after optimization (mio. ha) ; variables diff --git a/modules/10_land/landmatrix_dec18/declarations.gms b/modules/10_land/landmatrix_dec18/declarations.gms index 2e60fd619d..5d1a439509 100644 --- a/modules/10_land/landmatrix_dec18/declarations.gms +++ b/modules/10_land/landmatrix_dec18/declarations.gms @@ -7,7 +7,7 @@ parameters pm_land_start(j,land) Land initialization area (mio. ha) - pcm_land(j,land) Land area in previous time step (mio. ha) + pcm_land(j,land) Land area in previous time step including possible changes after optimization (mio. ha) ; variables diff --git a/modules/13_tc/endo_jan22/presolve.gms b/modules/13_tc/endo_jan22/presolve.gms index 10ca4cb971..5067c2ce8c 100644 --- a/modules/13_tc/endo_jan22/presolve.gms +++ b/modules/13_tc/endo_jan22/presolve.gms @@ -16,7 +16,7 @@ else vm_tau.lo(h, tautype) = pcm_tau(h, tautype); ); - vm_tau.up(h,tautype) = 2*pcm_tau(h,tautype); + vm_tau.up(h,tautype) = 2 * pcm_tau(h,tautype); * educated guess for vm_tau.l: if(ord(t) = 1, @@ -25,7 +25,7 @@ else vm_tau.l(h,tautype) = pcm_tau(h,tautype)*(1+pc13_tcguess(h,tautype))**m_yeardiff(t); ); -vm_tau.up(h,tautype) = 2*pcm_tau(h,tautype); +vm_tau.up(h,tautype) = 2 * pcm_tau(h,tautype); if(m_year(t) > sm_fix_SSP2 AND s13_max_gdp_shr <> Inf, @@ -39,4 +39,4 @@ if(m_year(t) > sm_fix_SSP2 AND s13_max_gdp_shr <> Inf, * as an efficient part of the optimal solution. vm_tech_cost.l(i) = vm_tech_cost.up(i); -); \ No newline at end of file +); diff --git a/modules/14_yields/managementcalib_aug19/declarations.gms b/modules/14_yields/managementcalib_aug19/declarations.gms index 87219d3bf9..bb304d900c 100644 --- a/modules/14_yields/managementcalib_aug19/declarations.gms +++ b/modules/14_yields/managementcalib_aug19/declarations.gms @@ -19,6 +19,10 @@ parameters p14_growing_stock_initial(j,ac,forest_land,forest_type) Initial Forest growing stock (tDM per ha per yr) pm_timber_yield_initial(j,ac,forest_land) Initial Forest yield (tDM per ha per yr) pm_yields_semi_calib(j,kve,w) Potential yields calibrated to FAO regional levels (tDM per ha per yr) + i14_calib_yields_hist(i,w) Calibrated yields average over region and crop type at the historical reference year (tDM per ha per yr) + i14_calib_yields_ratio(i) Irrigated to rainfed yield ratio for calibrated yields (1) + i14_target_ratio(i) Target irrigated to rainfed ratio as upper bound (1) + i14_modeled_yields_hist2(i,knbe14) Calibrated yields average over region and water supply type at the historical reference year (tDM per ha per yr) ; positive variables diff --git a/modules/14_yields/managementcalib_aug19/input.gms b/modules/14_yields/managementcalib_aug19/input.gms index 4e3aa42414..0731fcbd7d 100644 --- a/modules/14_yields/managementcalib_aug19/input.gms +++ b/modules/14_yields/managementcalib_aug19/input.gms @@ -12,6 +12,8 @@ $setglobal c14_yields_scenario cc scalar s14_limit_calib Relative managament calibration switch (1=limited 0=pure relative) / 1 /; +scalar s14_calib_ir2rf Switch to calibrate rainfed to irrigated yield ratios (1=calib 0=not calib) / 1 /; + scalars s14_yld_past_switch Spillover parameter for translating technological change in the crop sector into pasture yield increases (1) / 0.25 / ; @@ -54,6 +56,14 @@ $offdelim ; m_fillmissingyears(f14_fao_yields_hist,"i,kcr"); +parameter f14_ir2rf_ratio(i) AQUASTAT ratio of irrigated to rainfed yields per region (1) +/ +$ondelim +$include "./modules/14_yields/managementcalib_aug19/input/f14_ir2rf_ratio.cs4" +$offdelim +/ +; + table f14_ipcc_bce(clcl,forest_type) IPCC Biomass Conversion and Expansion factors (1) $ondelim $include "./modules/14_yields/input/f14_ipcc_bce.cs3" diff --git a/modules/14_yields/managementcalib_aug19/input/files b/modules/14_yields/managementcalib_aug19/input/files index 06788a7019..cf2be7a6dc 100644 --- a/modules/14_yields/managementcalib_aug19/input/files +++ b/modules/14_yields/managementcalib_aug19/input/files @@ -1,4 +1,5 @@ * list of files that are required here f14_region_yields.cs3 +f14_ir2rf_ratio.cs4 f14_ipcc_bce.cs3 f14_aboveground_fraction.csv diff --git a/modules/14_yields/managementcalib_aug19/preloop.gms b/modules/14_yields/managementcalib_aug19/preloop.gms index 61fa644abe..22b21cea25 100644 --- a/modules/14_yields/managementcalib_aug19/preloop.gms +++ b/modules/14_yields/managementcalib_aug19/preloop.gms @@ -25,35 +25,35 @@ i14_yields_calib(t,j,"pasture",w) = i14_yields_calib(t,j,"pasture",w) * sum(cell *' @code -*' The following equations calibrate the cellular yield patterns ('f14_yields') to match -*' FAO historical yields ('f14_fao_yields_hist') by calculating a calibration term called +*' The following equations calibrate the cellular yield patterns (`f14_yields`) to match +*' FAO historical yields (`f14_fao_yields_hist`) by calculating a calibration term called *' 'i14_managementcalib'. For most cases, 'i14_managementcalib' is the ratio of the historical -*' yields reported by FAO ('f14_fao_yields_hist') and regional mean yields ('i14_modeled_yields_hist') +*' yields reported by FAO (`f14_fao_yields_hist`) and regional mean yields (`i14_modeled_yields_hist`) *' given historic crop area patterns ('fm_croparea') and cellular yields coming from crop models -*' like LPJmL ('f14_yields'). In these cases, 'i14_managementcalib' represents a purely relative +*' like LPJmL (`f14_yields`). In these cases, 'i14_managementcalib' represents a purely relative *' calibration factor that depends only on the initial conditions of the starting year. *' *' However, when FAO yields are significantly higher than given by the cellular yield inputs *' (underestimated baseline), the relative calibration terms can lead to unrealistically large *' yields in the case of future yield increases within the cellular yield patterns. *' -*' To address this issue, the factor 'i14_lambda_yields' determines the degree +*' To address this issue, the factor `i14_lambda_yields` determines the degree *' to which the baseline (FAO) is under- or overestimated and therefore controls *' whether the calibration factor is applied as an absolute or relative change. -*' For overestimated FAO yields, 'i14_lambda_yields' is 1, which is equivalent -*' to an entirely relative calibration. For underestimated yields, 'i14_lambda_yields' +*' For overestimated FAO yields, `i14_lambda_yields` is 1, which is equivalent +*' to an entirely relative calibration. For underestimated yields, `i14_lambda_yields` *' is calculated as the squared root of the ratio between LPJmL yields and FAO historical -*' yields, and as 'i14_lambda_yields' approaches 0, it reduces the applied relative change +*' yields, and as `i14_lambda_yields` approaches 0, it reduces the applied relative change *' resulting in a mean change increasingly similar to an additive term (@Heinke.2013). *' This concept is referred to as limited calibration, as it limits the calibration *' to an additive term in case of a strongly underestimated baseline. The scalar -* 's14_limit_calib' can be used to switch limited calibration on (1) and off (0). +*' `s14_limit_calib` can be used to switch limited calibration on (1) and off (0). i14_croparea_total(t_all,w,j) = sum(kcr, fm_croparea(t_all,j,w,kcr)); -*' Historic crop area patterns ('fm_croprea') are used to calculate regional yields -*' ('i14_modeled_yields_hist') from the given cellular input pattern. In rare cases where +*' Historic crop area patterns (`fm_croprea`) are used to calculate regional yields +*' (`i14_modeled_yields_hist`) from the given cellular input pattern. In rare cases where *' a region has no crop area reported for a given crop type, the total crop area is *' used to calculate a proxy yield for the calibration, given by the following equation: @@ -64,11 +64,11 @@ i14_modeled_yields_hist(t_past,i,knbe14) sum((cell(i,j),w), i14_croparea_total(t_past,w,j)))$(sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14))=0); -*' The factor 'i14_lambda_yields' is calculated for the initial time step depending -*' on the setting 's14_limit_calib' and is then held constant for all other time steps. +*' The factor `i14_lambda_yields` is calculated for the initial time step depending +*' on the setting `s14_limit_calib` and is then held constant for all other time steps. *' The regional FAO yield and regional yield of the crop model input of the initial -*' time step is kept constant in the two parameters 'i14_fao_yields_hist' and -*' 'i14_modeled_yields_hist': +*' time step is kept constant in the two parameters `i14_fao_yields_hist` and +*' `i14_modeled_yields_hist`: loop(t, if(sum(sameas(t,"y1995"),1)=1, @@ -92,10 +92,9 @@ loop(t, ); ); - -*' The calibrated cellular yield 'i14_yields_calib' is calculated for each time step depending -*' on the constant values 'i14_modeled_yields_hist', 'i14_fao_yields_hist', 'i14_lambda_yields' -*' and the uncalibrated, cellular yield 'f14_yields' following the idea of eq. (9) in @Heinke.2013: +*' The calibrated cellular yield `i14_yields_calib` is calculated for each time step depending +*' on the constant values `i14_modeled_yields_hist`, `i14_fao_yields_hist`, `i14_lambda_yields` +*' and the uncalibrated, cellular yield `f14_yields` following the idea of eq. (9) in [@Heinke.2013]: i14_managementcalib(t,j,knbe14,w) = 1 + (sum(cell(i,j), i14_fao_yields_hist(t,i,knbe14) - i14_modeled_yields_hist(t,i,knbe14)) / @@ -108,6 +107,37 @@ i14_yields_calib(t,j,knbe14,w) = i14_managementcalib(t,j,knbe14,w) * f14_yiel pm_yields_semi_calib(j,knbe14,w) = i14_yields_calib("y1995",j,knbe14,w); *' Note that the calculation is split into two parts for better readability. + +*' Irrigated yields are calibrated to meet the country-level +*' ratio between irrigated and rainfed yields reported by Aquastat. +*' This can be de-activated with the switch `s14_calib_ir2rf`. +if ((s14_calib_ir2rf = 1), + +* Weighted yields + i14_calib_yields_hist(i,w) + = sum((cell(i,j), knbe14), fm_croparea("y1995",j,"irrigated",knbe14) * i14_yields_calib("y1995",j,knbe14,w)) / + sum((cell(i,j), knbe14), fm_croparea("y1995",j,"irrigated",knbe14)); + +* Use irrigated-rainfed ratio of Aquastat if larger than our calculated ratio + i14_calib_yields_ratio(i) = i14_calib_yields_hist(i,"irrigated") / i14_calib_yields_hist(i,"rainfed"); + i14_target_ratio(i) = max(i14_calib_yields_ratio(i), f14_ir2rf_ratio(i)); + i14_yields_calib(t,j,knbe14,"irrigated") = sum((cell(i,j)), i14_target_ratio(i) / i14_calib_yields_ratio(i)) * + i14_yields_calib(t,j,knbe14,"irrigated"); + +* Calibrate newly calibrated yields to FAO yields + i14_modeled_yields_hist2(i,knbe14) + = (sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14) * i14_yields_calib("y1995",j,knbe14,w)) / + sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14)))$(sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14))>0) + + (sum((cell(i,j),w), i14_croparea_total("y1995",w,j) * f14_yields("y1995",j,knbe14,w)) / + sum((cell(i,j),w), i14_croparea_total("y1995",w,j)))$(sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14))=0); + + i14_yields_calib(t,j,knbe14,w) = sum((cell(i,j)), i14_fao_yields_hist("y1995",i,knbe14) / + i14_modeled_yields_hist2(i,knbe14)) * + i14_yields_calib(t,j,knbe14,w); + + pm_yields_semi_calib(j,knbe14,w) = i14_yields_calib("y1995",j,knbe14,w); +); + *' @stop diff --git a/modules/14_yields/managementcalib_aug19/realization.gms b/modules/14_yields/managementcalib_aug19/realization.gms index 6ba3c415dd..bc01adebc5 100644 --- a/modules/14_yields/managementcalib_aug19/realization.gms +++ b/modules/14_yields/managementcalib_aug19/realization.gms @@ -12,6 +12,8 @@ *' yields achieved under the highest currently observed value of the $\tau$ factor *' representing agricultural land-use intensity. Secondly, pasture yields are calculated *' based on pasture demand to account for in- and extensification of managed grasslands. +*' Thirdly, irrigated yields are scaled to meet the irrigated-to-rainfed yield +*' ratio as provided by AQUASTAT [@fao_aquastat_2016]. *' Finally, crop yields are calibrated to FAO [@FAOSTAT] regional yield levels of the *' initial time step. An additional feature of this realization is to allow crop yields *' technological change from the precedent times step to spillover to pasture areas. This @@ -20,7 +22,7 @@ *' @limitations The exogenous implementation of pasture intensification cannot *' capture feedbacks between land scarcity and efforts to improve pasture -*' management. And, the magnitude of spillover effects from technological change +*' management. Moreover, the magnitude of spillover effects from technological change *' in the crop sector towards improvements in pasture management is very uncertain. diff --git a/modules/14_yields/module.gms b/modules/14_yields/module.gms index 6dc1157be1..74c7bdcc25 100644 --- a/modules/14_yields/module.gms +++ b/modules/14_yields/module.gms @@ -17,6 +17,8 @@ *' [@FAOSTAT]. For the simulation of the temporal development of agricultural *' yields, the module receives information about the agricultural land use *' intensity represented by the $\tau$ factor coming from the module [13_tc]. +*' Irrigated yields can optionally be calibrated to meet irrigated-rainfed +*' country-level yield ratios as reported by Aquastat [@fao_aquastat_2016]. *' *' The module returns yields for all crops and for pasture, which is then used *' by the modules [30_crop] and [31_past]. diff --git a/modules/15_food/anthro_iso_jun22/declarations.gms b/modules/15_food/anthro_iso_jun22/declarations.gms new file mode 100644 index 0000000000..d352f6159f --- /dev/null +++ b/modules/15_food/anthro_iso_jun22/declarations.gms @@ -0,0 +1,252 @@ +*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + + +equations + q15_food_demand(i,kfo) Food demand (mio. kcal) +; + +positive variables + vm_dem_food(i,kall) Food demand (mio. tDM per yr) +; + + +*** #### Food Demand Model + + + +equations + q15_aim Objective function of food demand model (mio. USD05PPP) + q15_budget(iso) Household budget constraint (USD05PPP per cap per day) + + q15_regr_bmi_shr(iso,sex,agegroup15,bmi_tree15) Estimates regression parameters for BMI regression shares (1) + q15_bmi_shr_verylow(iso,sex,agegroup15) Estimates BMI share for population groups with low BMI (1) + q15_bmi_shr_low(iso,sex,agegroup15) Estimates BMI share for population groups with very low BMI (1) + q15_bmi_shr_medium(iso,sex,agegroup15) Estimates BMI share for population groups with medium BMI(1) + q15_bmi_shr_medium_high(iso,sex,agegroup15) Estimates BMI share for population groups with medium to high BMI (1) + q15_bmi_shr_high(iso,sex,agegroup15) Estimates BMI share for population groups with high BMI (1) + q15_bmi_shr_veryhigh(iso,sex,agegroup15) Estimates BMI share for population groups with very high BMI (1) + q15_bmi_shr_agg(iso,sex,age,bmi_group15) Disaggregates age groups from overarching groups (1) + + q15_intake(iso) Estimates average intake for the entire country (kcal per cap per day) + q15_regr_kcal(iso) Per capita total demand (kcal per cap per day) + q15_regr(iso, regr15) Estimates parameters for food demand and dietary composition (1) + q15_foodtree_kcal_animals(iso,kfo_ap) Demand for animal products (kcal per cap per day) + q15_foodtree_kcal_processed(iso,kfo_pf) Demand for processed products (kcal per cap per day) + q15_foodtree_kcal_staples(iso,kfo_st) Demand for staple products (kcal per cap per day) + q15_foodtree_kcal_vegetables(iso) Demand for vegetable and fruit products (kcal per cap per day) + +; + + +positive variables + v15_kcal_regr(iso,kfo) Uncalibrated regression estimates of calorie demand (kcal per cap per day) + v15_kcal_regr_total(iso) Uncalibrated regression estimates of total per cap calories (kcal per cap per day) + v15_demand_regr(iso, regr15) Uncalibrated regression estimates of kcal shares (1) + v15_income_pc_real_ppp_iso(iso) Real income per cap (USD05PPP per cap) + v15_income_balance(iso) Balance variable to balance cases in which reduction in income is larger than the per capita GDP (USD05PPP per cap per yr) + v15_kcal_intake_total_regr(iso) Food intake (kcal per cap per day) + v15_regr_overgroups(iso,sex,agegroup15,bmi_tree15) Hierarchical tree parameter regressions (1) + v15_bmi_shr_regr(iso,sex,age,bmi_group15) Uncalibrated share of population groups belonging to a certain BMI group (1) + v15_bmi_shr_overgroups(iso,sex,agegroup15,bmi_group15) Uncalibrated share of population groups belonging to a certain BMI group (1) +; + +variables + v15_objective Objective term (USD05PPP) +; + +scalars + s15_yeardiff Number of 5-year time intervalls between time steps (1) + s15_count Loop counter for interpolating body height estimates between longer timesteps (1) + s15_run_diet_postprocessing run diet postprocessing (1) +; + +parameters +* technical + p15_modelstat(t) Model solver status (1) + p15_iteration_counter(t) Number of iterations required for reaching an equilibrium between food demand model and magpie (1) + p15_convergence_measure(t,iter15) Convergence measure to decide for continuation or stop of food_demand - magpie iteration (1) + i15_dem_intercept(iso,regr15) Food regression parameters intercept in kcal or as share (X) + i15_dem_saturation(iso,regr15) Food regression parameters saturation in kcal or as share (X) + i15_dem_halfsat(iso,regr15) Food regression parameters halfsaturation (USD05PPP per cap) + i15_dem_nonsat(iso,regr15) Food regression parameters nonsaturation (1) + +*prices + p15_prices_kcal(t,iso,kfo,iter15) Prices from MAgPIE after optimization (USD05PPP per kcal) + i15_prices_initial_kcal(iso,kfo) Initial prices that capture the approximate level of prices in 1961-2010 (USD05PPP per kcal) + +* anthropometrics + p15_bodyheight(t,iso,sex,age,estimates15) Body height (cm per cap) + p15_bodyweight(t,iso,sex,age,bmi_group15) Body weight (kg per cap) + p15_bodyheight_calib(t,iso,sex,age_new_estimated15) Calibration factor for regional height differences (cm) + p15_kcal_growth_food(t_all,iso,underaged15) Average per capita demand for body size growth relevant food items in the last three 5-year steps (kcal per capita per day) + p15_physical_activity_level(t,iso,sex,age) Physical activity levels in PAL relative to basic metabolic rate BMR (kcal per kcal) + + i15_bmi_intercept(sex,agegroup15,bmi_tree15) BMI share regression intercept (1) + i15_bmi_saturation(sex,agegroup15,bmi_tree15) BMI share regression saturation (1) + i15_bmi_halfsat(sex,agegroup15,bmi_tree15) BMI share regression halfsaturation (1) + + p15_bmi_shr_regr(t,iso,sex,age,bmi_group15) Uncalibrated regression estimates of BMI shares (1) + i15_bmi_shr_calib(t,iso,sex,age,bmi_group15) Calibration parameters to meet historical BMI shares (1) + i15_bmi_shr_calib_lastcalibyear(iso,sex,age,bmi_group15) Calibration parameters of the last year with historical observations (1) + +* diet structure + p15_intake(t,iso,sex,age,bmi_group15) Mean food intake by population group (kcal per capita per day) + i15_kcal_pregnancy(t,iso) Additional calorie requirements for pregnancy and lactation (kcal) + p15_kcal_regr(t, iso, kfo) Uncalibrated regression estimates of calorie demand (kcal per cap per day) + + i15_milk_share_fadeout_india(t_all) Temporal fader of milk share in india (applied before food demand model) (1) + i15_rum_share_fadeout(t_all,iso) Temporal fader of ruminant meat share (applied before food demand model) (1) + i15_ruminant_fadeout(t,iso) Ruminant fadeout share (1) + i15_fish_fadeout(t,iso) Fish fadeout share (1) + i15_alcohol_fadeout(t,iso) Alcohol fadeout share (1) + i15_livestock_fadeout(t,iso) Livestock fadeout share (1) + i15_rumdairy_fadeout(t,iso) Ruminant meat and dairy fadeout share (1) + i15_rumdairy_scp_fadeout(t,iso) Ruminant meat and dairy fadeout share to be replaced by SCP (1) + i15_livestock_fadeout_threshold(t,iso) Livestock fadeout share for threshold (1) + + i15_protein_to_kcal_ratio(t,kfo) protein-to-kcal ratio (g protein per kcal) + + i15_staples_kcal_structure_iso(t,iso,kfo_st) Share of single staple products within total staples (1) + i15_livestock_kcal_structure_iso_raw(t,iso,kfo_ap) Share of single livestock products within total livestock products (uncorrected for future changes in shares) (1) + i15_livestock_kcal_structure_iso(t,iso,kfo_ap) Share of single livestock products within total livestock products (corrected for future changes in shares) (1) + i15_processed_kcal_structure_iso Share of single processed products within total processed food (1) + +* diet calibration + p15_kcal_calib(t,iso,kfo) Balance flow to diverge from mean calories of regressions (kcal per cap per day) + p15_kcal_calib_lastcalibyear(iso,kfo) Calibration factor for the last year with observations (kcal per cap per day) + p15_balanceflow_kcal(t,i,kfo) Balance flow for mismatch between FAOSTAT and demand estimates (kcal per capita per day) + p15_balanceflow_kcal_iso(t,iso,kfo) Balance flow for mismatch between FAOSTAT and demand estimates (kcal per capita per day) + p15_balanceflow_kcal_lastcalibyear(iso,kfo) Balance flow of last historic time step for mismatch between FAOSTAT and demand estimates (kcal per capita per day) + +* before shock + o15_kcal_regr_initial(t,iso,kfo) Uncalibrated per capita demand before price shock (kcal per capita per day) + p15_kcal_pc_initial(t,i,kfo) Per capita consumption in food demand model before price shock on regional level (kcal per capita per day) + pm_kcal_pc_initial(t,i,kfo) Per capita consumption in food demand model before price shock (kcal per capita per day) + p15_kcal_pc_initial_iso(t,iso,kfo) Per capita consumption in food demand model before price shock on country level (kcal per capita per day) + +* after price shock + p15_kcal_pc_iso(t,iso,kfo) Per capita consumption in food demand model after price shock on country level (kcal per capita per day) + p15_kcal_pc(t,i,kfo) Per capita consumption in food demand model after price shock on regional level (kcal per capita per day) + p15_kcal_pc_calibrated(t,i,kfo) Calibrated per capita consumption in food demand model after price shock (kcal per capita per day) + p15_kcal_pc_iso_orig(t,iso,kfo) Auxiliary parameter for per capita food consumption - basis for convergence into waste and diet scenarios (kcal per capita per day) + p15_kcal_pc_iso_livestock_orig(t,iso) Auxiliary parameter for per capita livestock consumption - basis for scenarios of livestock food substitution (kcal per capita per day) + p15_kcal_pc_iso_rumdairy_orig(t,iso) Auxiliary parameter for per capita ruminant and dairy consumption - basis for scenarios of ruminant-based food substitution (kcal per capita per day) + p15_kcal_pc_iso_plant_orig(t,iso) Auxiliary parameter for per capita plant-based food consumption - basis for scenarios of livestock food substitution (kcal per capita per day) + p15_livestock_kcal_structure_orig(t,iso,kfo_lp) Auxiliary parameter for livestock kcal structure - basis for scenarios of livestock food substitution (1) + p15_rumdairy_kcal_structure_orig(t,iso,kfo_rd) Auxiliary parameter for ruminant and dairy kcal structure - basis for scenarios of ruminant-based food substitution (1) + p15_plant_kcal_structure_orig(t,iso,kfo_pp) Auxiliary parameter for plant-based food kcal structure - basis for scenarios of livestock food substitution (1) + p15_kcal_pc_livestock_supply_target(iso) Target of per capita livestock consumption (kcal per capita per day) + + p15_bmi_shr_calibrated(t,iso,sex,age,bmi_group15) Calibrated estimates of BMI share for population groups (1) + p15_bmi_shr_target(t,iso,sex,age,bmi_group15) Target for BMI shares under exogenous scenarios (1) + p15_intake_total(t,iso) Total food intake in a country (kcal per capita per day) + +*food waste + p15_demand2intake_ratio(t,iso) Ratio between food calorie demand and intake (kcal per kcal) + p15_waste_pc(t,iso,kfo) Household waste by food group (kcal per capita per day) + p15_intake_detail(t,iso,kfo) Intake by food group (kcal per capita per day) + p15_demand2intake_ratio_detail(t,iso,kfo) Food waste ratio by food group (kcal per kcal) + p15_demand2intake_ratio_detail_preexo(t,iso,kfo) Food waste as outcome of regression (kcal per kcal) + +* transition to exogenous scenario diets + i15_intake_scen_target(t,iso) Target for total per capita calorie intake according to an exogenous diet scenario (kcal per capita per day) + i15_intake_EATLancet_all(iso,kcal_scen15,EAT_scen15,kfo) Food-specific per capita calorie intake according to various EAT Lancet diet scenarios (kcal per capita per day) + i15_intake_EATLancet(iso,kfo) Food-specific per capita calorie intake according to EAT Lancet diet scenario (kcal per capita per day) + i15_intake_detailed_scen_target(t,iso,kfo) Target for food-specific per capita calorie intake according to an exogenous diet scenario (kcal per capita per day) + + p15_foodwaste_growth(t,iso) Increase in food waste over time relative to the historical time step of EAT Lancet diets (1) + i15_kcal_pc_scen_target(t,iso,kfo) Target for per capita food consumption according to an exogenous diet scenario (kcal per capita per day) + i15_exo_foodscen_fader(t,iso) Fader that converges per capita food consumption to an exogenous diet scenario (1) + +* country-specific scenario switch + p15_country_dummy(iso) Dummy parameter indicating whether country is affected by diet scenarios (1) + +* calculate diet iteration breakpoint + p15_income_pc_real_ppp(t,i) Regional per capita income after price shock on regional level (USD05PPP per capita) + p15_delta_income(t,i,iter15) Regional change in per capita income due to price shock on regional level (1) +; + +scalars + s15_year Current year as integer value (yr) /2000/ +; + +*' @code +*' The food demand model consists of the following equations, which are not +*' part of MAgPIE. + +model m15_food_demand / + q15_aim, + q15_budget, + + q15_regr_bmi_shr, + + q15_bmi_shr_verylow, + q15_bmi_shr_low, + q15_bmi_shr_medium, + q15_bmi_shr_medium_high, + q15_bmi_shr_high, + q15_bmi_shr_veryhigh, + + q15_bmi_shr_agg, + + q15_intake, + q15_regr_kcal, + q15_regr, + + q15_foodtree_kcal_animals, + q15_foodtree_kcal_processed, + q15_foodtree_kcal_staples, + q15_foodtree_kcal_vegetables + /; + + + +*' In contrast, the equation `q15_food_demand` is part of MAgPIE, but +*' not of the food demand model. +*' @stop + +m15_food_demand.optfile = 0 ; +m15_food_demand.scaleopt = 1 ; +m15_food_demand.solprint = 0 ; +m15_food_demand.holdfixed = 1 ; + + + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov_dem_food(t,i,kall,type) Food demand (mio. tDM per yr) + ov15_kcal_regr(t,iso,kfo,type) Uncalibrated regression estimates of calorie demand (kcal per cap per day) + ov15_kcal_regr_total(t,iso,type) Uncalibrated regression estimates of total per cap calories (kcal per cap per day) + ov15_demand_regr(t,iso,regr15,type) Uncalibrated regression estimates of kcal shares (1) + ov15_income_pc_real_ppp_iso(t,iso,type) Real income per cap (USD05PPP per cap) + ov15_income_balance(t,iso,type) Balance variable to balance cases in which reduction in income is larger than the per capita GDP (USD05PPP per cap per yr) + ov15_kcal_intake_total_regr(t,iso,type) Food intake (kcal per cap per day) + ov15_regr_overgroups(t,iso,sex,agegroup15,bmi_tree15,type) Hierarchical tree parameter regressions (1) + ov15_bmi_shr_regr(t,iso,sex,age,bmi_group15,type) Uncalibrated share of population groups belonging to a certain BMI group (1) + ov15_bmi_shr_overgroups(t,iso,sex,agegroup15,bmi_group15,type) Uncalibrated share of population groups belonging to a certain BMI group (1) + ov15_objective(t,type) Objective term (USD05PPP) + oq15_food_demand(t,i,kfo,type) Food demand (mio. kcal) + oq15_aim(t,type) Objective function of food demand model (mio. USD05PPP) + oq15_budget(t,iso,type) Household budget constraint (USD05PPP per cap per day) + oq15_regr_bmi_shr(t,iso,sex,agegroup15,bmi_tree15,type) Estimates regression parameters for BMI regression shares (1) + oq15_bmi_shr_verylow(t,iso,sex,agegroup15,type) Estimates BMI share for population groups with low BMI (1) + oq15_bmi_shr_low(t,iso,sex,agegroup15,type) Estimates BMI share for population groups with very low BMI (1) + oq15_bmi_shr_medium(t,iso,sex,agegroup15,type) Estimates BMI share for population groups with medium BMI(1) + oq15_bmi_shr_medium_high(t,iso,sex,agegroup15,type) Estimates BMI share for population groups with medium to high BMI (1) + oq15_bmi_shr_high(t,iso,sex,agegroup15,type) Estimates BMI share for population groups with high BMI (1) + oq15_bmi_shr_veryhigh(t,iso,sex,agegroup15,type) Estimates BMI share for population groups with very high BMI (1) + oq15_bmi_shr_agg(t,iso,sex,age,bmi_group15,type) Disaggregates age groups from overarching groups (1) + oq15_intake(t,iso,type) Estimates average intake for the entire country (kcal per cap per day) + oq15_regr_kcal(t,iso,type) Per capita total demand (kcal per cap per day) + oq15_regr(t,iso,regr15,type) Estimates parameters for food demand and dietary composition (1) + oq15_foodtree_kcal_animals(t,iso,kfo_ap,type) Demand for animal products (kcal per cap per day) + oq15_foodtree_kcal_processed(t,iso,kfo_pf,type) Demand for processed products (kcal per cap per day) + oq15_foodtree_kcal_staples(t,iso,kfo_st,type) Demand for staple products (kcal per cap per day) + oq15_foodtree_kcal_vegetables(t,iso,type) Demand for vegetable and fruit products (kcal per cap per day) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/15_food/anthro_iso_jun22/equations.gms b/modules/15_food/anthro_iso_jun22/equations.gms new file mode 100644 index 0000000000..50a63f4bef --- /dev/null +++ b/modules/15_food/anthro_iso_jun22/equations.gms @@ -0,0 +1,207 @@ +*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @equations + +q15_food_demand(i2,kfo) .. + (vm_dem_food(i2,kfo) + sum(ct, f15_household_balanceflow(ct,i2,kfo,"dm"))) + * sum(ct,(f15_nutrition_attributes(ct,kfo,"kcal") * 10**6)) =g= + sum(ct,im_pop(ct,i2) * p15_kcal_pc_calibrated(ct,i2,kfo)) * 365 + ; + +*' Above constraint transforms the fooduse of agricultural products into per capita +*' food demand. +*' `vm_dem_food` is the fooduse of agricultural products. It is measured in tons +*' of dry matter prior to processing. The multiplication with the nutrition attributes +*' provides the equivalent in calories. While nutrition attributes are assumed +*' to be globally the same +*' (assumption of homogeneous products), a regional balance flow is used to account +*' for current differences in food processing, where some regions get different calories +*' from the same fooduse quantitiy. Depending on the input data, the balance flow +*' may fade out in the future, which implies actual homogeneous products. + +*' The subsequent equations belong to the standalone food demand model, which is +*' executed before MAgPIE or iterated with MAgPIE. They are excluded from the run +*' of MAgPIE itself. + +q15_aim .. + v15_objective =e= + sum(iso, + - 10**6*v15_income_balance(iso)) + ; + +*' In principle, the food demand model has only one solution that satifies all +*' equations. Technically, the objective could therefore be chosen arbirtrarily, +*' for the solver to find the single solution. +*' However, if the model is executed outside its domain +*' (e.g. with extreme price shocks), it can happen that real income takes a +*' negative value (because the increase in food value exceeds the available income). +*' To avoid this case, a punishment term `v15_income_balance` is introduced. It +*' increases the real income, but affects the maximized objective variable +*' negatively, disincentivizing its use in cases where it is not needed. + + +q15_budget(iso) .. + v15_income_pc_real_ppp_iso(iso) =e= + sum(kfo, v15_kcal_regr(iso,kfo)*365 + *(i15_prices_initial_kcal(iso,kfo)-sum((ct,curr_iter15), p15_prices_kcal(ct,iso,kfo,curr_iter15)))) + + sum(ct,im_gdp_pc_ppp_iso(ct,iso)) + v15_income_balance(iso); + +*' The budget constraint calculates the real income after a possible price +*' shock. The basic assumption is that increasing prices reduce real income, +*' while decreasing prices increase real income. +*' Through this income effect, higher prices reduce the food demand. +*' The income before the food price shock is `im_gdp_pc_ppp_iso`. +*' It is reduced by the change in value of the demanded calories under changed +*' prices. +*' In the following, the real income is used to determine food intake, +*' food demand as well as dietary composition. + +*' The BMI distribution within the population is calculated using +*' regressions in a hierachical tree to estimate the share of the population +*' falling into a certain BMI class. +*' ![Hierarchical tree used to estimate BMI population shares](hierarchical_tree.png){ width=100% } + +*' First, the regression shares are calculated: + +q15_regr_bmi_shr(iso,sex,agegroup15,bmi_tree15) .. + v15_regr_overgroups(iso,sex,agegroup15,bmi_tree15) + =e= + i15_bmi_intercept(sex,agegroup15,bmi_tree15) + + (i15_bmi_saturation(sex,agegroup15,bmi_tree15) * v15_income_pc_real_ppp_iso(iso)) + / (i15_bmi_halfsat(sex,agegroup15,bmi_tree15) + v15_income_pc_real_ppp_iso(iso)); + +*' Then, these regression shares are applied to parameterize the +*' hierarchical tree structure: + +q15_bmi_shr_verylow(iso,sex,agegroup15) .. + v15_bmi_shr_overgroups(iso,sex,agegroup15,"verylow") + =e= + v15_regr_overgroups(iso,sex,agegroup15,"low") + * v15_regr_overgroups(iso,sex,agegroup15,"lowsplit") + ; + +q15_bmi_shr_low(iso,sex,agegroup15) .. + v15_bmi_shr_overgroups(iso,sex,agegroup15,"low") + =e= + v15_regr_overgroups(iso,sex,agegroup15,"low") + * (1- v15_regr_overgroups(iso,sex,agegroup15,"lowsplit")) + ; + +q15_bmi_shr_medium(iso,sex,agegroup15) .. + v15_bmi_shr_overgroups(iso,sex,agegroup15,"medium") + =e= + (1-v15_regr_overgroups(iso,sex,agegroup15,"low") + -v15_regr_overgroups(iso,sex,agegroup15,"high")) + * (1-v15_regr_overgroups(iso,sex,agegroup15,"mediumsplit")) + ; + +q15_bmi_shr_medium_high(iso,sex,agegroup15) .. + v15_bmi_shr_overgroups(iso,sex,agegroup15,"mediumhigh") + =e= + (1-v15_regr_overgroups(iso,sex,agegroup15,"low") + -v15_regr_overgroups(iso,sex,agegroup15,"high")) + * v15_regr_overgroups(iso,sex,agegroup15,"mediumsplit") + ; + +q15_bmi_shr_high(iso,sex,agegroup15) .. + v15_bmi_shr_overgroups(iso,sex,agegroup15,"high") + =e= + v15_regr_overgroups(iso,sex,agegroup15,"high") + * (1-v15_regr_overgroups(iso,sex,agegroup15,"highsplit")) + ; + +q15_bmi_shr_veryhigh(iso,sex,agegroup15) .. + v15_bmi_shr_overgroups(iso,sex,agegroup15,"veryhigh") + =e= + v15_regr_overgroups(iso,sex,agegroup15,"high") + * v15_regr_overgroups(iso,sex,agegroup15,"highsplit") + ; + + +*' From BMI shares of the larger groups (overgroups), we disaggregate to +*' age-specific subgroups. + +q15_bmi_shr_agg(iso,sex,age,bmi_group15) .. + v15_bmi_shr_regr(iso,sex,age,bmi_group15) + =e= + sum(agegroup2age(agegroup15,age), + v15_bmi_shr_overgroups(iso,sex,agegroup15,bmi_group15) + ); + + +*' Food intake is estimated based on BMI distribution, typical intakes for +*' BMI groups, demographic structure and extra energy requirements for +*' pregnancy and lactation (estimated based on the new-born population size). + +q15_intake(iso).. + v15_kcal_intake_total_regr(iso) + * sum((sex,age,ct), im_demography(ct,iso,sex,age)) + =e= + sum((ct, sex, age, bmi_group15), + v15_bmi_shr_regr(iso,sex,age,bmi_group15)* + im_demography(ct,iso,sex,age) * + p15_intake(ct,iso,sex,age,bmi_group15) + ) + + sum(ct,i15_kcal_pregnancy(ct,iso)) + ; + + +*' Food demand is based on food intake and a regression +*' based on income, which estimates how much the actual demand is relative to +*' the required intake. +*' The difference between demand and intake is food waste (not explicitly +*' mentioned in this equation) + +q15_regr_kcal(iso) .. + v15_kcal_regr_total(iso) =e= + v15_demand_regr(iso, "overconsumption") + *v15_kcal_intake_total_regr(iso); + +*' This equation estimates key dietary composition regressision factors, +*' such as the share of animal products, empty calories, or +*' fruits, vegetables and nuts. + +q15_regr(iso, regr15) .. + v15_demand_regr(iso, regr15) =e= + i15_dem_intercept(iso,regr15) + + (i15_dem_saturation(iso,regr15) * v15_income_pc_real_ppp_iso(iso)) + / (i15_dem_halfsat(iso,regr15) + v15_income_pc_real_ppp_iso(iso)**i15_dem_nonsat(iso,regr15)); + +*' In the subsequent equations, those parameters +*' are used to determine the dietary composition using a hierachical tree: +*' Total calories are first divided into animal- and plant-based. The plant-based +*' calories are further divided into processed empty calories and nutritious +*' calories, and so on. + +q15_foodtree_kcal_animals(iso,kfo_ap) .. + v15_kcal_regr(iso,kfo_ap) =e= + v15_kcal_regr_total(iso) + * v15_demand_regr(iso, "livestockshare") + * sum(ct,i15_livestock_kcal_structure_iso(ct,iso,kfo_ap)); + +q15_foodtree_kcal_processed(iso,kfo_pf) .. + v15_kcal_regr(iso,kfo_pf) =e= + v15_kcal_regr_total(iso) + * (1 - v15_demand_regr(iso, "livestockshare")) + * v15_demand_regr(iso, "processedshare") + * sum(ct,i15_processed_kcal_structure_iso(ct,iso,kfo_pf)) ; + +q15_foodtree_kcal_vegetables(iso) .. + v15_kcal_regr(iso,"others") =e= + v15_kcal_regr_total(iso) + * (1 - v15_demand_regr(iso, "livestockshare")) + * (1 - v15_demand_regr(iso, "processedshare")) + * v15_demand_regr(iso, "vegfruitshare"); + +q15_foodtree_kcal_staples(iso,kfo_st) .. + v15_kcal_regr(iso,kfo_st) =e= + v15_kcal_regr_total(iso) + * (1 - v15_demand_regr(iso, "livestockshare")) + * (1 - v15_demand_regr(iso, "processedshare")) + * (1 - v15_demand_regr(iso, "vegfruitshare")) + * sum(ct,i15_staples_kcal_structure_iso(ct,iso,kfo_st)) ; diff --git a/modules/15_food/anthro_iso_jun22/exodietmacro.gms b/modules/15_food/anthro_iso_jun22/exodietmacro.gms new file mode 100644 index 0000000000..8455093909 --- /dev/null +++ b/modules/15_food/anthro_iso_jun22/exodietmacro.gms @@ -0,0 +1,428 @@ +*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' as include statements are not allowed within the if statements, we execute +*' the if statement before, put the result in s15_run_diet_postprocessing, +*' and then execute the if statement again within the included file: +if (s15_run_diet_postprocessing = 1, + +*' This macro is executed twice, once after the presolve and once in the +*' intersolve. It calibrates the values, includes exogenous diet modifications +*' in the postprocessing and aggregates to regional level. + +* saving regression outcome for per capita food demand for different foods + p15_kcal_regr(t, iso, kfo) = v15_kcal_regr.l(iso, kfo); + +*' The calibration factor is added to the regression value. + p15_kcal_pc_iso(t,iso,kfo) = + v15_kcal_regr.l(iso,kfo) + p15_kcal_calib(t,iso,kfo) * s15_calibrate; + +*' Negative values that can possibly occur due to calibration are set to zero. + p15_kcal_pc_iso(t,iso,kfo)$(p15_kcal_pc_iso(t,iso,kfo)<0) = 0; + +* saving regression outcome for BMI shares + p15_bmi_shr_regr(t,iso,sex,age,bmi_group15) = v15_bmi_shr_regr.l(iso,sex,age,bmi_group15); + + p15_bmi_shr_calibrated(t,iso,sex,age,bmi_group15) = + p15_bmi_shr_regr(t,iso,sex,age,bmi_group15)+ + i15_bmi_shr_calib(t,iso,sex,age,bmi_group15); + +* The BMI shares are not allowed to exceed the bounds 0 and 1. Values are corrected to the bounds. + p15_bmi_shr_calibrated(t,iso,sex,age,bmi_group15)$(p15_bmi_shr_calibrated(t,iso,sex,age,bmi_group15)<0) = 0; + p15_bmi_shr_calibrated(t,iso,sex,age,bmi_group15)$(p15_bmi_shr_calibrated(t,iso,sex,age,bmi_group15)>1) = 1; +* The mismatch is balanced by moving the exceeding quantities into the middle BMI group. + p15_bmi_shr_calibrated(t,iso,sex,age,"medium")= + 1 - (sum(bmi_group15, p15_bmi_shr_calibrated(t,iso,sex,age,bmi_group15)) + - p15_bmi_shr_calibrated(t,iso,sex,age,"medium")); + + + +*############################################################################### +* ###### Food substitution scenarios + + +* Substitution of ruminant beef with poultry: + p15_kcal_pc_iso_orig(t,iso,kfo) = p15_kcal_pc_iso(t,iso,kfo); + p15_kcal_pc_iso(t,iso,"livst_rum") = + p15_kcal_pc_iso_orig(t,iso,"livst_rum") * i15_ruminant_fadeout(t,iso); + p15_kcal_pc_iso(t,iso,"livst_chick") = p15_kcal_pc_iso_orig(t,iso,"livst_chick") + + p15_kcal_pc_iso_orig(t,iso,"livst_rum") * (1- i15_ruminant_fadeout(t,iso)); + + +* Substitution of fish with poultry: + p15_kcal_pc_iso_orig(t,iso,kfo) = p15_kcal_pc_iso(t,iso,kfo); + p15_kcal_pc_iso(t,iso,"fish") = + p15_kcal_pc_iso_orig(t,iso,"fish") * i15_fish_fadeout(t,iso); + p15_kcal_pc_iso(t,iso,"livst_chick") = p15_kcal_pc_iso_orig(t,iso,"livst_chick") + + p15_kcal_pc_iso_orig(t,iso,"fish") * (1-i15_fish_fadeout(t,iso)); + + +* Fade-out of alcohol consumption without substitution: +* (leads to inconsistencies with BMI estimates) + p15_kcal_pc_iso_orig(t,iso,kfo) = p15_kcal_pc_iso(t,iso,kfo); + p15_kcal_pc_iso(t,iso,"alcohol") = + p15_kcal_pc_iso_orig(t,iso,"alcohol") * i15_alcohol_fadeout(t,iso); + + +* Substitution of livestock products (without fish) with plant-based food commodities: + p15_kcal_pc_iso_orig(t,iso,kfo) = p15_kcal_pc_iso(t,iso,kfo); + p15_kcal_pc_iso_livestock_orig(t,iso) = sum(kfo_lp,p15_kcal_pc_iso(t,iso,kfo_lp)); + p15_kcal_pc_iso_plant_orig(t,iso) = sum(kfo_pp,p15_kcal_pc_iso(t,iso,kfo_pp)); + + p15_livestock_kcal_structure_orig(t,iso,kfo_lp)$(p15_kcal_pc_iso_livestock_orig(t,iso)>0) = + p15_kcal_pc_iso(t,iso,kfo_lp) + /p15_kcal_pc_iso_livestock_orig(t,iso); + + p15_plant_kcal_structure_orig(t,iso,kfo_pp)$(p15_kcal_pc_iso_plant_orig(t,iso)>0) = + p15_kcal_pc_iso(t,iso,kfo_pp) + /p15_kcal_pc_iso_plant_orig(t,iso); + + p15_kcal_pc_iso(t,iso,kfo_lp) = p15_livestock_kcal_structure_orig(t,iso,kfo_lp) + *p15_kcal_pc_iso_livestock_orig(t,iso)*i15_livestock_fadeout(t,iso); + p15_kcal_pc_iso(t,iso,kfo_pp) = p15_plant_kcal_structure_orig(t,iso,kfo_pp) + *(p15_kcal_pc_iso_plant_orig(t,iso) + + p15_kcal_pc_iso_livestock_orig(t,iso) * (1-i15_livestock_fadeout(t,iso))); + + +* Substitution of ruminant meat and dairy products with plant-based food commodities: + p15_kcal_pc_iso_orig(t,iso,kfo) = p15_kcal_pc_iso(t,iso,kfo); + p15_kcal_pc_iso_rumdairy_orig(t,iso) = sum(kfo_rd,p15_kcal_pc_iso(t,iso,kfo_rd)); + p15_kcal_pc_iso_plant_orig(t,iso) = sum(kfo_pp,p15_kcal_pc_iso(t,iso,kfo_pp)); + + p15_rumdairy_kcal_structure_orig(t,iso,kfo_rd)$(p15_kcal_pc_iso_rumdairy_orig(t,iso)>0) = + p15_kcal_pc_iso(t,iso,kfo_rd) + /p15_kcal_pc_iso_rumdairy_orig(t,iso); + + p15_plant_kcal_structure_orig(t,iso,kfo_pp)$(p15_kcal_pc_iso_plant_orig(t,iso)>0) = + p15_kcal_pc_iso(t,iso,kfo_pp) + /p15_kcal_pc_iso_plant_orig(t,iso); + + p15_kcal_pc_iso(t,iso,kfo_rd) = p15_rumdairy_kcal_structure_orig(t,iso,kfo_rd) + *p15_kcal_pc_iso_rumdairy_orig(t,iso)*i15_rumdairy_fadeout(t,iso); + p15_kcal_pc_iso(t,iso,kfo_pp) = p15_plant_kcal_structure_orig(t,iso,kfo_pp) + *(p15_kcal_pc_iso_plant_orig(t,iso) + + p15_kcal_pc_iso_rumdairy_orig(t,iso) * (1- i15_rumdairy_fadeout(t,iso))); + +*** Substitution of ruminant meat and dairy products (kfo_rd) with single-cell protein (SCP) based on protein/cap/day + i15_protein_to_kcal_ratio(t,kfo) = f15_nutrition_attributes(t,kfo,"protein")/f15_nutrition_attributes(t,kfo,"kcal"); +* Before the substitution, kfo_rd is converted from kcal/cap/day to g protein/cap/day +* using i15_protein_to_kcal_ratio(t,kfo_rd). +* After the substitution of kfo_rd with SCP (1-i15_rumdairy_scp_fadeout), SCP is converted +* back to kcal/cap/day using i15_protein_to_kcal_ratio(t,"scp"). + p15_kcal_pc_iso(t,iso,"scp") = p15_kcal_pc_iso(t,iso,"scp") + + sum(kfo_rd, p15_kcal_pc_iso(t,iso,kfo_rd) * (1-i15_rumdairy_scp_fadeout(t,iso)) * + i15_protein_to_kcal_ratio(t,kfo_rd)) / i15_protein_to_kcal_ratio(t,"scp"); + p15_kcal_pc_iso(t,iso,kfo_rd) = p15_kcal_pc_iso(t,iso,kfo_rd) * i15_rumdairy_scp_fadeout(t,iso); + + +* Conditional reduction of livestock products (without fish) depending on s15_kcal_pc_livestock_intake_target. +* Optional substitution with plant-based products depending on s15_livescen_target_subst. + p15_kcal_pc_iso_orig(t,iso,kfo) = p15_kcal_pc_iso(t,iso,kfo); + p15_kcal_pc_iso_livestock_orig(t,iso) = sum(kfo_lp,p15_kcal_pc_iso(t,iso,kfo_lp)); + p15_kcal_pc_iso_plant_orig(t,iso) = sum(kfo_pp,p15_kcal_pc_iso(t,iso,kfo_pp)); + + p15_livestock_kcal_structure_orig(t,iso,kfo_lp)$(p15_kcal_pc_iso_livestock_orig(t,iso)>0) = + p15_kcal_pc_iso(t,iso,kfo_lp) + /p15_kcal_pc_iso_livestock_orig(t,iso); + + p15_plant_kcal_structure_orig(t,iso,kfo_pp)$(p15_kcal_pc_iso_plant_orig(t,iso)>0) = + p15_kcal_pc_iso(t,iso,kfo_pp) + /p15_kcal_pc_iso_plant_orig(t,iso); + + p15_kcal_pc_livestock_supply_target(iso) = s15_kcal_pc_livestock_intake_target * f15_overcons_FAOwaste(iso,"livst_rum"); + + loop(iso$(p15_kcal_pc_iso_livestock_orig(t,iso) > p15_kcal_pc_livestock_supply_target(iso)), + p15_kcal_pc_iso(t,iso,kfo_lp) = p15_livestock_kcal_structure_orig(t,iso,kfo_lp) + * (p15_kcal_pc_livestock_supply_target(iso)*(1-i15_livestock_fadeout_threshold(t,iso)) + + p15_kcal_pc_iso_livestock_orig(t,iso)*i15_livestock_fadeout_threshold(t,iso)); + p15_kcal_pc_iso(t,iso,kfo_pp) = p15_plant_kcal_structure_orig(t,iso,kfo_pp) + * (p15_kcal_pc_iso_plant_orig(t,iso) + + (p15_kcal_pc_iso_livestock_orig(t,iso) - + sum(kfo_lp, p15_kcal_pc_iso(t,iso,kfo_lp))) * s15_livescen_target_subst); + ); + + +*############################################################################### +* ###### WASTE CALCULATIONS (required for exogenous food waste or diet scenarios) + +* The ratio of food demand at household level to food intake is determined +* by the amount of food that is wasted. This ratio is one of the drivers of +* future food demand trajetories. +* For the calculation of the ratio between food demand and intake, total food +* calorie intake based on CALIBRATED parameters needs to be calculated: + + p15_intake_total(t,iso)$(sum((sex,age), im_demography(t,iso,sex,age)) >0 ) = + (sum((sex, age, bmi_group15), p15_bmi_shr_calibrated(t,iso,sex,age,bmi_group15)* + im_demography(t,iso,sex,age)*p15_intake(t,iso,sex,age,bmi_group15) ) + + i15_kcal_pregnancy(t,iso)) + / sum((sex,age), im_demography(t,iso,sex,age)); + + p15_demand2intake_ratio(t,iso) = 1$(p15_intake_total(t,iso) = 0) + + (sum(kfo,p15_kcal_pc_iso(t,iso,kfo)) / p15_intake_total(t,iso))$( + p15_intake_total(t,iso) <> 0); + + +* Next, we derive a product-specific waste share, which uses product specific +* waste shares from FAO and calibrates them to meet total +* food waste ratio. +* To achieve maximum consistency, this calibration involves three steps. + +* first apply FAO waste factors, than rescale intake proportionally to meet total intake +* This distributes the differences in waste estimates rather equally over different products + + p15_intake_detail(t,iso,kfo) = p15_kcal_pc_iso(t,iso,kfo)/f15_overcons_FAOwaste(iso,kfo); + + p15_intake_detail(t,iso,kfo)$(sum(kfo2, p15_intake_detail(t,iso,kfo2))<>0) = + p15_intake_detail(t,iso,kfo) / sum(kfo2, p15_intake_detail(t,iso,kfo2))* + p15_intake_total(t,iso); +* to avoid negative waste, we reduce intake where it exceed food availabiltiy + + p15_intake_detail(t,iso,kfo)$(p15_intake_detail(t,iso,kfo)>p15_kcal_pc_iso(t,iso,kfo)) = + p15_kcal_pc_iso(t,iso,kfo); + +* in a second round of calibration, we rescale food waste to meet total food waste. +* Now, waste is increasing only where there is already waste. + + p15_waste_pc(t,iso,kfo) = p15_kcal_pc_iso(t,iso,kfo) - p15_intake_detail(t,iso,kfo); + + p15_waste_pc(t,iso,kfo) = 0$(sum(kfo2, p15_waste_pc(t,iso,kfo2))=0) + ( + p15_waste_pc(t,iso,kfo) / sum(kfo2, p15_waste_pc(t,iso,kfo2))* + (p15_intake_total(t,iso)*p15_demand2intake_ratio(t,iso)-p15_intake_total(t,iso)) + )$(sum(kfo2, p15_waste_pc(t,iso,kfo2))<>0); + + p15_intake_detail(t,iso,kfo) = p15_kcal_pc_iso(t,iso,kfo) - p15_waste_pc(t,iso,kfo); + + +* the third calibration is only needed for those countries where total intake exceeds calory availabtility +* here we want to have the inconsistency in the waste, not in the intake. + + p15_intake_detail(t,iso,kfo)$(sum(kfo2, p15_intake_detail(t,iso,kfo2))<>0) = + p15_intake_detail(t,iso,kfo) / sum(kfo2, p15_intake_detail(t,iso,kfo2))* + p15_intake_total(t,iso); + p15_waste_pc(t,iso,kfo) = p15_kcal_pc_iso(t,iso,kfo) - p15_intake_detail(t,iso,kfo); + +* we calculate a product specific demand2intake ratio + p15_demand2intake_ratio_detail(t,iso,kfo)=1$(p15_intake_detail(t,iso,kfo) = 0) + + (p15_kcal_pc_iso(t,iso,kfo) / p15_intake_detail(t,iso,kfo))$(p15_intake_detail(t,iso,kfo) > 0); + +* Bodyheight is estimated based on a calorie availabiltiy regression, including +* waste. As food waste scenarios should not affect bodyheight, we apply the +* normal food waste ratios for the growth estimates + p15_demand2intake_ratio_detail_preexo(t,iso,kfo)=p15_demand2intake_ratio_detail(t,iso,kfo); + +* ###### Exogenous EAT Lancet diet scenario + +*' @code +*' Transition to exogenous Planetary Health diet scenarios [@willett_food_2019]: +*' It is possible to define exogenous diet scenarios that replace the regression-based +*' calculation of food intake and demand according to a predefined speed of +*' convergence from `p15_kcal_pc_calibrated(t,iso,kfo)` to the scenario-dependent target +*' `i15_kcal_pc_scen_target(t,iso,kfo)` by setting the switch `s15_exo_diet` +*' to 1. + + + if(s15_exo_diet = 1, + +*' 1.) In a first step, the exogenous scenario diets are defined by selecting a +*' scenario target for total daily per capita food intake + +$ifthen "%c15_kcal_scen%" == "healthy_BMI" + + p15_bmi_shr_target(t,iso,sex,age,bmi_group15)=0; + p15_bmi_shr_target(t,iso,sex,age,"medium")=1; + + i15_intake_scen_target(t,iso)$(sum((sex,age), im_demography(t,iso,sex,age)) >0 ) = + (sum((sex, age, bmi_group15), p15_bmi_shr_target(t,iso,sex,age,bmi_group15)* + im_demography(t,iso,sex,age)*p15_intake(t,iso,sex,age,bmi_group15) ) + + i15_kcal_pregnancy(t,iso)) + / sum((sex,age), im_demography(t,iso,sex,age)); + +$elseif "%c15_kcal_scen%" == "no_underweight" + + p15_bmi_shr_target(t,iso,sex,age,bmi_group15)=p15_bmi_shr_calibrated(t,iso,sex,age,bmi_group15); + p15_bmi_shr_target(t,iso,sex,age,"medium")= + p15_bmi_shr_calibrated(t,iso,sex,age,"verylow") + + p15_bmi_shr_calibrated(t,iso,sex,age,"low") + + p15_bmi_shr_calibrated(t,iso,sex,age,"medium"); + p15_bmi_shr_target(t,iso,sex,age,"verylow")=0; + p15_bmi_shr_target(t,iso,sex,age,"low")=0; + + i15_intake_scen_target(t,iso)$(sum((sex,age), im_demography(t,iso,sex,age)) >0 ) = + (sum((sex, age, bmi_group15), p15_bmi_shr_target(t,iso,sex,age,bmi_group15)* + im_demography(t,iso,sex,age)*p15_intake(t,iso,sex,age,bmi_group15) ) + + i15_kcal_pregnancy(t,iso)) + / sum((sex,age), im_demography(t,iso,sex,age)); + +$elseif "%c15_kcal_scen%" == "no_overweight" + + p15_bmi_shr_target(t,iso,sex,age,bmi_group15)=p15_bmi_shr_calibrated(t,iso,sex,age,bmi_group15); + p15_bmi_shr_target(t,iso,sex,age,"medium")= + p15_bmi_shr_calibrated(t,iso,sex,age,"mediumhigh") + + p15_bmi_shr_calibrated(t,iso,sex,age,"high") + + p15_bmi_shr_calibrated(t,iso,sex,age,"veryhigh") + + p15_bmi_shr_calibrated(t,iso,sex,age,"medium"); + p15_bmi_shr_target(t,iso,sex,age,"mediumhigh")=0; + p15_bmi_shr_target(t,iso,sex,age,"high")=0; + p15_bmi_shr_target(t,iso,sex,age,"veryhigh")=0; + i15_intake_scen_target(t,iso)$(sum((sex,age), im_demography(t,iso,sex,age)) >0 ) = + (sum((sex, age, bmi_group15), p15_bmi_shr_target(t,iso,sex,age,bmi_group15)* + im_demography(t,iso,sex,age)*p15_intake(t,iso,sex,age,bmi_group15) ) + + i15_kcal_pregnancy(t,iso)) + / sum((sex,age), im_demography(t,iso,sex,age)); +$elseif "%c15_kcal_scen%" == "endo" + i15_intake_scen_target(t,iso) = p15_intake_total(t,iso); + p15_bmi_shr_target(t,iso,sex,age,bmi_group15) = p15_bmi_shr_calibrated(t,iso,sex,age,bmi_group15); +$else + i15_intake_scen_target(t,iso) = sum(kfo,i15_intake_EATLancet_all(iso,"%c15_kcal_scen%","%c15_EAT_scen%",kfo)); + p15_bmi_shr_target(t,iso,sex,age,bmi_group15)=0; + p15_bmi_shr_target(t,iso,sex,age,"medium")=1; +$endif + + +*' Intake target is adjusted to meet the calorie target + i15_intake_detailed_scen_target(t,iso,kfo)$(p15_intake_total(t,iso)>0) = + p15_intake_detail(t,iso,kfo) / p15_intake_total(t,iso) * i15_intake_scen_target(t,iso); + +*' 2.) The second step defines the daily per capita intake of different food +*' commodities by filling up the scenario target for total daily per capita food +*' intake according to different scenario assumptions on dietary patterns. Calories +*' for staple crops can be modified in order to meet the total calorie target. + +*' The EAT lancet target values are the same for non-staples irrespective of the calorie target +*' Only non-staples differ + + i15_intake_EATLancet(iso,kfo) = + i15_intake_EATLancet_all(iso,"2100kcal","%c15_EAT_scen%",kfo); + + if (s15_exo_monogastric=1, + i15_intake_detailed_scen_target(t,iso,EAT_monogastrics15) = i15_intake_EATLancet(iso,EAT_monogastrics15)); + if (s15_exo_ruminant=1, + i15_intake_detailed_scen_target(t,iso,EAT_ruminants15) = i15_intake_EATLancet(iso,EAT_ruminants15)); + if (s15_exo_fish=1, + i15_intake_detailed_scen_target(t,iso,"fish") = i15_intake_EATLancet(iso,"fish")); + if (s15_exo_fruitvegnut=1, + i15_intake_detailed_scen_target(t,iso,EAT_fruitvegnutseed15) = i15_intake_EATLancet(iso,EAT_fruitvegnutseed15)); + if (s15_exo_pulses=1, + i15_intake_detailed_scen_target(t,iso,EAT_pulses15) = i15_intake_EATLancet(iso,EAT_pulses15)); + if (s15_exo_sugar=1, + i15_intake_detailed_scen_target(t,iso,EAT_sugar15) = i15_intake_EATLancet(iso,EAT_sugar15)); + if (s15_exo_oils=1, + i15_intake_detailed_scen_target(t,iso,"oils") = i15_intake_EATLancet(iso,"oils")); + if (s15_exo_brans=1, + i15_intake_detailed_scen_target(t,iso,"brans") = i15_intake_EATLancet(iso,"brans")); + if (s15_exo_scp=1, + i15_intake_detailed_scen_target(t,iso,"scp") = i15_intake_EATLancet(iso,"scp")); + if (s15_exo_alcohol=1, +* alcohol target is not part of EAT Lancet recommendation. Upper boundary is therefore included as specific swtich s15_alc_scen + i15_intake_detailed_scen_target(t,iso,"alcohol")$(i15_intake_detailed_scen_target(t,iso,"alcohol") > s15_alc_scen*i15_intake_scen_target(t,iso)) + = s15_alc_scen*i15_intake_scen_target(t,iso); + ); + + i15_intake_detailed_scen_target(t,iso,EAT_staples)$(sum(EAT_staples2,i15_intake_EATLancet(iso,EAT_staples2))>0) = ( + i15_intake_scen_target(t,iso) - sum(EAT_nonstaples,i15_intake_detailed_scen_target(t,iso,EAT_nonstaples)) )*( + i15_intake_EATLancet(iso,EAT_staples)/sum(EAT_staples2,i15_intake_EATLancet(iso,EAT_staples2)) ); + +*' 3.) In the third step, the regression-based calculation of intake +*' is faded into the exogenous intake scenario according to a predefined speed of +*' convergence (note that fading should start after the historical time slice of +*' the EAT Lancet diet scenarios (y2010) as defined in `i15_exo_foodscen_fader(t,iso)`): + p15_intake_detail(t,iso,kfo) = p15_intake_detail(t,iso,kfo) * (1-i15_exo_foodscen_fader(t,iso)) + + i15_intake_detailed_scen_target(t,iso,kfo) * i15_exo_foodscen_fader(t,iso); + + p15_bmi_shr_calibrated(t,iso,sex,age,bmi_group15) = p15_bmi_shr_calibrated(t,iso,sex,age,bmi_group15) * (1-i15_exo_foodscen_fader(t,iso)) + + p15_bmi_shr_target(t,iso,sex,age,bmi_group15) * i15_exo_foodscen_fader(t,iso); + +*' 4.) The fourth step estimates the calorie supply at household level by multiplying +*' daily per capita calorie intake with the demand2intake ratio that was estimated +*' previously. It assures that if commodities with higher food waste ratio are +*' increasingly consumed, food waste increases. + p15_kcal_pc_iso(t,iso,kfo) = p15_intake_detail(t,iso,kfo) + *p15_demand2intake_ratio_detail(t,iso,kfo); + +*' Total waste share and total intake are adapted to new calculations. + + p15_intake_total(t,iso) = sum(kfo, p15_intake_detail(t,iso,kfo)); + p15_waste_pc(t,iso,kfo) = p15_kcal_pc_iso(t,iso,kfo) - p15_intake_detail(t,iso,kfo); + + p15_demand2intake_ratio(t,iso) = 1$(p15_intake_total(t,iso) = 0) + + (sum(kfo,p15_kcal_pc_iso(t,iso,kfo)) / p15_intake_total(t,iso))$( + p15_intake_total(t,iso) > 0); + + p15_demand2intake_ratio_detail(t,iso,kfo)=1$(p15_intake_detail(t,iso,kfo) = 0) + + (p15_kcal_pc_iso(t,iso,kfo) / p15_intake_detail(t,iso,kfo))$(p15_intake_detail(t,iso,kfo) > 0); + +); +*' End of special postprocessing food demand scenarios. + + + + +* ###### Exogenous food waste scenario + + if(s15_exo_waste = 1, + +*' "Downwards convergence" of regional calorie oversupply due to food waste to the +*' waste reduction target, i.e. only for values that are higher than the target: + + p15_demand2intake_ratio(t,iso)$(p15_demand2intake_ratio(t,iso) > s15_waste_scen ) + = p15_demand2intake_ratio(t,iso)*(1-i15_exo_foodscen_fader(t,iso)) + + s15_waste_scen*i15_exo_foodscen_fader(t,iso); + +*' waste calculation by crop type + + p15_waste_pc(t,iso,kfo)$(sum(kfo2, p15_waste_pc(t,iso,kfo2))<>0) = p15_waste_pc(t,iso,kfo) / sum(kfo2, p15_waste_pc(t,iso,kfo2))* + (p15_intake_total(t,iso)*p15_demand2intake_ratio(t,iso)-p15_intake_total(t,iso)); + +*' Waste ratio is applied + p15_kcal_pc_iso(t,iso,kfo) = p15_intake_detail(t,iso,kfo) + p15_waste_pc(t,iso,kfo); + + p15_demand2intake_ratio_detail(t,iso,kfo)=1$(p15_intake_detail(t,iso,kfo) = 0) + + (p15_kcal_pc_iso(t,iso,kfo) / p15_intake_detail(t,iso,kfo))$(p15_intake_detail(t,iso,kfo) > 0); + +); + + + + +*' The country-level parameter p15_kcal_pc_iso is aggregated to the +*' regional level. After removing estimates from countries that are not included +*' in FAOSTAT, the resulting parameter p15_kcal_pc_calibrated is provided to +*' constraint q15_food_demand in the MAgPIE model, which defines the demand for food. + +*' Results are aggregated to regions + p15_kcal_pc(t,i,kfo)$( + sum(i_to_iso(i,iso), + im_pop_iso(t,iso) + ) >0 ) = + sum(i_to_iso(i,iso), + p15_kcal_pc_iso(t,iso,kfo) + * im_pop_iso(t,iso) + ) / sum(i_to_iso(i,iso), + im_pop_iso(t,iso) + ); + + p15_balanceflow_kcal(t,i,kfo)$( + sum(i_to_iso(i,iso), + im_pop_iso(t,iso) + ) >0 ) = + sum(i_to_iso(i,iso), + p15_balanceflow_kcal_iso(t,iso,kfo) + * im_pop_iso(t,iso) + ) / sum(i_to_iso(i,iso), + im_pop_iso(t,iso) + ); + + +*' Finally, we calibrate countries with zero food demand according to FAOSTAT +*' down to zero to match FAO world totals. +*' Values are rounded to avoid path dependencies of MAgPIE solver. + p15_kcal_pc_calibrated(t,i,kfo)=p15_kcal_pc(t,i,kfo)+p15_balanceflow_kcal(t,i,kfo); + p15_kcal_pc_calibrated(t,i,kfo)=round(p15_kcal_pc_calibrated(t,i,kfo),2); + p15_kcal_pc_calibrated(t,i,kfo)$(p15_kcal_pc_calibrated(t,i,kfo)<0)=0; + +*' @stop + ); diff --git a/modules/15_food/anthro_iso_jun22/food_demand_coupling.png b/modules/15_food/anthro_iso_jun22/food_demand_coupling.png new file mode 100644 index 0000000000..57d25b92f7 Binary files /dev/null and b/modules/15_food/anthro_iso_jun22/food_demand_coupling.png differ diff --git a/modules/15_food/anthro_iso_jun22/food_demand_coupling.svg b/modules/15_food/anthro_iso_jun22/food_demand_coupling.svg new file mode 100644 index 0000000000..225cf78a02 --- /dev/null +++ b/modules/15_food/anthro_iso_jun22/food_demand_coupling.svg @@ -0,0 +1,640 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + D + + elastic + inelastic + + t+1 + + + standalone + coupling + presolve + D + intersolve + M + + + standalone + coupling + M + + t+1 + + t+1 + converged + + + not converged + + D + intersolve + t+1 + M + ... + + iteration>x + fail + + t+1 + + diff --git a/modules/15_food/anthro_iso_jun22/hierarchical_tree.png b/modules/15_food/anthro_iso_jun22/hierarchical_tree.png new file mode 100644 index 0000000000..465f5ab430 Binary files /dev/null and b/modules/15_food/anthro_iso_jun22/hierarchical_tree.png differ diff --git a/modules/15_food/anthro_iso_jun22/input.gms b/modules/15_food/anthro_iso_jun22/input.gms new file mode 100644 index 0000000000..c4bb30b93f --- /dev/null +++ b/modules/15_food/anthro_iso_jun22/input.gms @@ -0,0 +1,251 @@ +*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + + +$setglobal c15_food_scenario SSP2 +$setglobal c15_food_scenario_noselect SSP2 +* options: SSP: "SSP1", "SSP2", "SSP3", "SSP4", "SSP5" +* SRES: "A1", "A2", "B1", "B2" +* OTHER: "SSP1_boundary", "SSP2_boundary", "SSP3_boundary", "SSP4_boundary", "SSP5_boundary" + +$setglobal c15_calibscen constant +* options: constant, fadeout2050 + +$setglobal c15_rum_share mixed +* options: constant, halving2050, mixed + +* Fader for food substitution scenarios and exogenous food intake and waste +* scenarios including functional forms, targets and transition periods +* options: constant, +* lin_zero_10_50, lin_zero_20_50, lin_zero_20_30, lin_50pc_20_50, lin_50pc_20_50_extend65, lin_50pc_20_50_extend80, +* lin_50pc_10_50_extend90, lin_75pc_10_50_extend90, lin_80pc_20_50, lin_80pc_20_50_extend95, lin_90pc_20_50_extend95, +* lin_99-98-90pc_20_50-60-100, sigmoid_20pc_20_50, sigmoid_50pc_20_50, sigmoid_80pc_20_50 +$setglobal c15_rumscen constant +$setglobal c15_fishscen constant +$setglobal c15_alcscen constant +$setglobal c15_livescen constant +$setglobal c15_rumdairyscen constant +$setglobal c15_rumdairy_scp_scen constant +$setglobal c15_livescen_target constant +$setglobal c15_exo_foodscen lin_zero_20_50 + +$setglobal c15_kcal_scen healthy_BMI +* options: healthy_BMI, 2100kcal, 2500kcal + +$setglobal c15_EAT_scen FLX +* options: BMK, FLX, PSC, VEG, VGN, FLX_hmilk, FLX_hredmeat + + +* Set-switch for countries affected by country-specific exogenous diet scenario +* Default: all iso countries selected +sets + scen_countries15(iso) countries to be affected by selected food sceanrio / ABW,AFG,AGO,AIA,ALA,ALB,AND,ARE,ARG,ARM, + ASM,ATA,ATF,ATG,AUS,AUT,AZE,BDI,BEL,BEN, + BES,BFA,BGD,BGR,BHR,BHS,BIH,BLM,BLR,BLZ, + BMU,BOL,BRA,BRB,BRN,BTN,BVT,BWA,CAF,CAN, + CCK,CHN,CHE,CHL,CIV,CMR,COD,COG,COK,COL, + COM,CPV,CRI,CUB,CUW,CXR,CYM,CYP,CZE,DEU, + DJI,DMA,DNK,DOM,DZA,ECU,EGY,ERI,ESH,ESP, + EST,ETH,FIN,FJI,FLK,FRA,FRO,FSM,GAB,GBR, + GEO,GGY,GHA,GIB,GIN,GLP,GMB,GNB,GNQ,GRC, + GRD,GRL,GTM,GUF,GUM,GUY,HKG,HMD,HND,HRV, + HTI,HUN,IDN,IMN,IND,IOT,IRL,IRN,IRQ,ISL, + ISR,ITA,JAM,JEY,JOR,JPN,KAZ,KEN,KGZ,KHM, + KIR,KNA,KOR,KWT,LAO,LBN,LBR,LBY,LCA,LIE, + LKA,LSO,LTU,LUX,LVA,MAC,MAF,MAR,MCO,MDA, + MDG,MDV,MEX,MHL,MKD,MLI,MLT,MMR,MNE,MNG, + MNP,MOZ,MRT,MSR,MTQ,MUS,MWI,MYS,MYT,NAM, + NCL,NER,NFK,NGA,NIC,NIU,NLD,NOR,NPL,NRU, + NZL,OMN,PAK,PAN,PCN,PER,PHL,PLW,PNG,POL, + PRI,PRK,PRT,PRY,PSE,PYF,QAT,REU,ROU,RUS, + RWA,SAU,SDN,SEN,SGP,SGS,SHN,SJM,SLB,SLE, + SLV,SMR,SOM,SPM,SRB,SSD,STP,SUR,SVK,SVN, + SWE,SWZ,SXM,SYC,SYR,TCA,TCD,TGO,THA,TJK, + TKL,TKM,TLS,TON,TTO,TUN,TUR,TUV,TWN,TZA, + UGA,UKR,UMI,URY,USA,UZB,VAT,VCT,VEN,VGB, + VIR,VNM,VUT,WLF,WSM,YEM,ZAF,ZMB,ZWE / +; + +$onMultiR +set kfo_rd(kfo) Ruminant meat and dairy food products / livst_rum /; +$offMulti + +scalar s15_elastic_demand Elastic demand switch (1=elastic 0=exogenous) (1) / 0 /; + +scalar s15_calibrate Calibration switch (1=calibrated 0=pure regression outcomes) (1) / 1 /; +* only for per-capita calories, not for e.g. calibration of transformation parameters between per-capita calories in dm + +scalar s15_maxiter Scalar defining maximum number of iterations (1) / 5 /; + +scalar s15_convergence Convergence criterion (1) / 0.005 /; +* maximum relative per-capita gdp difference within a region between two iteratios + +scalar s15_exo_waste Switch for transition towards exogenous food waste scenario (1) / 0 /; + +scalar s15_waste_scen Scenario target for the ratio between food demand and intake (1) / 1.2 /; + +scalar s15_exo_diet Switch for transition towards exogenous diet scenario (1) / 0 /; +* The following switches only become active when s15_exo_diet is active +* They define which components of the diet should become active +* If the switch is set to 1,the exogenous diets are activated. +* For all other settings (!=1), the endogenous estimate is used. +* When activating a target, total calories are always preserved via scaling of staples +scalar s15_exo_monogastric Exogenous EAT Lancet animal product target on (1) / 1 /; +scalar s15_exo_ruminant Exogenous EAT Lancet animal product target on (1) / 1 /; +scalar s15_exo_fish Exogenous EAT Lancet animal product target on (1) / 1 /; +scalar s15_exo_fruitvegnut Exogenous EAT Lancet fruit vegetable nut seeds target on (1) / 1 /; +scalar s15_exo_pulses Exogenous pulses target on (1) / 1 /; +scalar s15_exo_sugar Exogenous sugar target on (1) / 1 /; +scalar s15_exo_oils Exogenous oils (1) / 1 /; +scalar s15_exo_brans Exogenous brans (1) / 1 /; +scalar s15_exo_scp Exogenous microbial protein target on (1) / 1 /; +* The EAT-Lancet diet only allows for added sugars, but does not include processed food or +* alcohol. Via 's15_alc_scen' a maximum target for alcohol consumption can be defined. +scalar s15_exo_alcohol Exogenous alcohol target on (1) / 1 /; +scalar s15_alc_scen Scenario target for the inclusion of alcohol in the EAT-Lancet diet (1) / 0.014 /; + +scalar s15_rum_share_fadeout_india_strong switch for stronger ruminant fadeout in India (binary) / 1 /; + +scalar s15_milk_share_fadeout_india switch for milk fadeout in India (binary) / 1 /; + +scalar s15_kcal_pc_livestock_intake_target target for livestock intake (kcal per cap per day) / 430 /; + +scalar s15_livescen_target_subst fade-out of livestock products (0) or substitution of livestock products with plant-based products (1) / 1 /; + +table f15_household_balanceflow(t_all,i,kall,dm_ge_nr) Balance flow to take account of heterogeneous products and processes (mio. tDM) +$ondelim +$include "./modules/15_food/input/f15_household_balanceflow.cs3" +$offdelim; + +table f15_nutrition_attributes(t_all,kall,nutrition) Nutrition attributes of food items dedicated for fooduse (mio. kcal per tDM | t Protein per tDM) +$ondelim +$include "./modules/15_food/input/f15_nutrition_attributes.cs3" +$offdelim; + + +*** Food Demand Model + + +* Unit for `f15_demand_paras` is +* kcal/capita/day for saturation and intercept, and +* USD05/capita for halfsaturation + +table f15_demand_paras(regr15,food_scen15,par15) Food regression parameters in USD05PPP or dimensionless (X) +$ondelim +$include "./modules/15_food/input/f15_demand_regression_parameters.cs3" +$offdelim; + +table f15_bmi_shr_paras(sex, agegroup15, bmi_tree15, paras_b15) BMI share regression parameters in USD05PPP or dimensionless (X) +$ondelim +$include "./modules/15_food/input/f15_bmi_shr_regr_paras.cs3" +$offdelim; + +table f15_bmi(sex,age,bmi_group15) Mean body mass index for each BMI group (kg per m2) +$ondelim +$include "./modules/15_food/input/f15_bmi.cs3" +$offdelim; + +table f15_bmi_shr_past(t_all,iso,age,sex,bmi_group15) Observed share of population belonging to a BMI group in the past (1) +$ondelim +$include "./modules/15_food/input/f15_bmi_shr_past.cs3" +$offdelim; + + +table f15_kcal_pc_iso(t_all,iso,kfo) Observed per capita food supply in the past (kcal per cap per day) +$ondelim +$include "./modules/15_food/input/f15_kcal_pc_iso.csv" +$offdelim; + + +table f15_intake_pc_observed_iso(t_all,iso,sex,age) Observed per capita food intake in the past (kcal per captia per day) +$ondelim +$include "./modules/15_food/input/f15_intake_pc_observed_iso.cs3" +$offdelim; + + +parameter f15_prices_initial(kall) Food prices in initialization period (USD05MER per t DM) +/ +$ondelim +$include "./modules/15_food/input/f15_prices_initial.csv" +$offdelim +/; + + +parameter f15_price_index(t_all) Food price index in initialization period (1) +/ +$ondelim +$include "./modules/15_food/input/f15_prices_index.csv" +$offdelim +/; + + +table f15_kcal_calib_fadeout(t_all,calibscen15) Calibration fadeout factor (1) +$ondelim +$include "./modules/15_food/input/f15_kcal_balanceflow_fadeout.csv" +$offdelim +; + + +table f15_rum_share_fadeout(t_all,livst_fadeoutscen15) Ruminant share fadeout scenario (1) +$ondelim +$include "./modules/15_food/input/f15_ruminant_fadeout.csv" +$offdelim +; + +parameter f15_rum_share_fadeout_india(t_all) Ruminant share fadeout scenario for India (1) +/ +$ondelim +$include "./modules/15_food/input/f15_ruminant_fadeout_india.csv" +$offdelim +/; + +parameter f15_milk_share_fadeout_india(t_all) Milk share India fadeout scenario (1) +/ +$ondelim +$include "./modules/15_food/input/f15_milk_fadeout_india.csv" +$offdelim +/; + + +table f15_bodyheight(t_all,iso,sex,age) Body height (cm per cap) +$ondelim +$include "./modules/15_food/input/f15_bodyheight_historical.cs3" +$offdelim; + +table f15_bodyheight_regr_paras(sex,paras_h15) Body height regression parameters (X) +$ondelim +$include "./modules/15_food/input/f15_bodyheight_regr_paras.cs3" +$offdelim; + +table f15_schofield(sex,age, paras_s15) Schofield equation parameters in kcal per capita per day or kcal per capita per day per weight (X) +$ondelim +$include "./modules/15_food/input/f15_schofield_parameters.cs3" +$offdelim +; + +*** Food substitution scenarios + +table f15_food_substitution_fader(t_all,fadeoutscen15) Fader for food substitution scenarios (1) +$ondelim +$include "./modules/15_food/input/f15_food_substitution_fader.csv" +$offdelim; + + +*** Exogenous food demand scenarios + +table f15_intake_EATLancet(t_scen15,iso,kcal_scen15,EAT_scen15,kfo) EAT Lancet scenarios for food specific intake (kcal per capita per day) +$ondelim +$include "./modules/15_food/input/f15_intake_EATLancet_iso.cs3" +$offdelim; + +table f15_overcons_FAOwaste(iso,kfo) Ratio between food calorie supply and food intake based on FAO food waste shares (1) +$ondelim +$include "./modules/15_food/input/f15_supply2intake_ratio_FAO_iso.cs3" +$offdelim; + + +*** EOF input.gms *** diff --git a/modules/15_food/anthro_iso_jun22/intersolve.gms b/modules/15_food/anthro_iso_jun22/intersolve.gms new file mode 100644 index 0000000000..4b9654f44c --- /dev/null +++ b/modules/15_food/anthro_iso_jun22/intersolve.gms @@ -0,0 +1,156 @@ +*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +* retrieving interfaces from MAgPIE +* calculate prices for providing 1 kcal per day of one commodity + + if (magpie.modelstat = NA, + display "Coupling: Reading exogenous prices as MAgPIE has not (yet) been run"; + q15_food_demand.m(i,kfo)=0; + p15_prices_kcal(t,iso,kfo,curr_iter15)=i15_prices_initial_kcal(iso,kfo)*f15_price_index(t); + else +*' @code +*' After one time step of MAgPIE is executed, the shadow prices of the food demand +*' constraint are fed back into the food demand module, and the food demand +*' module is executed once again. + display "Coupling: Reading out marginal costs from MAgPIE"; + p15_prices_kcal(t,iso,kfo,curr_iter15)=sum(i_to_iso(i,iso), q15_food_demand.m(i,kfo)); +*' @stop + ); + +*' If `s15_elastic_demand` is 0, MAgPIE is not executed again for this time step. +if (s15_elastic_demand = 1 AND m_year(t) > sm_fix_SSP2, + display "elastic demand model is activated"; + + option nlp = conopt4; + +* A new iteration is started + p15_iteration_counter(t) = p15_iteration_counter(t) + 1; +* The set current iter includes only one element with the set element +* of the current iteration, e.g. "iter2" + curr_iter15(iter15) = no; + curr_iter15(iter15)$(ord(iter15)=p15_iteration_counter(t)) = yes; +* Now we also define a set for the previous iteration + prev_iter15(iter15) = no; + prev_iter15(iter15)$(ord(iter15)=p15_iteration_counter(t)-1) = yes; + +*' @code + display "starting m15_food_demand in iteration number ", p15_iteration_counter; + + solve m15_food_demand USING nlp MAXIMIZING v15_objective; +*' @stop in + +* in case of problems try CONOPT3 + if(m15_food_demand.modelstat > 2, + display "Modelstat > 2 | Retry solve with CONOPT3"; + option nlp = conopt; + solve m15_food_demand USING nlp MAXIMIZING v15_objective; + option nlp = conopt4; + ); + + p15_modelstat(t) = m15_food_demand.modelstat; + + display "Food Demand Model finished with modelstat "; + display p15_modelstat; + + if(p15_modelstat(t) > 2 AND p15_modelstat(t) ne 7, + m15_food_demand.solprint = 1 + Execute_Unload "fulldata.gdx"; + abort "Food Demand Model became infeasible. Should not be possible."; + ); + + +* estimate regional indicators from demand model + + + p15_income_pc_real_ppp(t,i)$( + sum(i_to_iso(i,iso), + im_pop_iso(t,iso) + ) >0 ) = + sum(i_to_iso(i,iso), + v15_income_pc_real_ppp_iso.l(iso) + * im_pop_iso(t,iso) + ) / sum(i_to_iso(i,iso), + im_pop_iso(t,iso) + ); + + + + p15_delta_income(t,i,curr_iter15) = p15_income_pc_real_ppp(t,i) / + ( sum(i_to_iso(i,iso), + im_gdp_pc_ppp_iso(t,iso) + * im_pop_iso(t,iso) + ) / sum(i_to_iso(i,iso), + im_pop_iso(t,iso)) + ); + + +* estimate convergence measure for deciding to stop iteration + + + p15_convergence_measure(t,curr_iter15) =smax(i, + abs(p15_delta_income(t,i,curr_iter15) / sum(prev_iter15,p15_delta_income(t,i,prev_iter15))- 1) + ); + + display "convergence measure:",p15_convergence_measure; + +*' @code + +*' It is checked whether MAgPIE and the +*' food demand model have reached sufficient convergence. The criterion for this +*' is whether the real income in the food demand model has changed in any region +*' by more than `s15_convergences_measure` relative to the last iteration due to +*' changes in food prices from MAgPIE. Moreover, the model aborts when the +*' number of iterations reaches `s15_maxiter`. +*' As long as the iteration continues, the food prices are transferred from +*' MAgPIE to the food demand model, and the food demand is transferred from +*' the food demand model to MAgPIE. +*' @stop + + + if ((sum(curr_iter15,p15_convergence_measure(t,curr_iter15)) > s15_convergence and p15_iteration_counter(t) <= s15_maxiter), + + display "convergence between MAgPIE and Food Demand Model not yet reached"; + display "starting magpie in iteration number ", p15_iteration_counter; + sm_intersolve=0; + s15_run_diet_postprocessing=1; + + elseif(p15_iteration_counter(t) > s15_maxiter), + sm_intersolve=1; + s15_run_diet_postprocessing=0; + display "Warning: convergence between MAgPIE and Food Demand Model not reached after ",p15_iteration_counter," iterations. Continue to next time step!"; + else + sm_intersolve=1; + s15_run_diet_postprocessing=0; + display "Success: convergence between MAgPIE and Food Demand Model reached."; + display "requiring ",p15_iteration_counter," runs of food demand model, "; + display "and one run less with MAgPIE."; +* set back convergence indicators for next timestep + ); + +* if the food demand model is not run again, also postprocessing is not +* executed again. +else + display "exogenous demand information is used" ; + s15_run_diet_postprocessing=0; +); + +* Postprocessing of diets: calibration, exogenous scenario modifications and +* aggregation to regional level. +* As this occurs twice (in presolve and intersolve), it is here included as +* macro. As include comments are not allowed within if statements, we pass the +* information whether postprocessing shall be executed to the macro within +* the parameter s15_run_diet_postprocessing. It is checked within the macro +* whether it shall be executed again. +$include "./modules/15_food/anthro_iso_jun22/exodietmacro.gms"; + +if (s15_run_diet_postprocessing = 1 , + if (p15_modelstat(t) <= 2, + put_utility 'shell' / 'mv -f m15_food_demand_p.gdx m15_food_demand_' t.tl:0'.gdx'; + ); +); +s15_run_diet_postprocessing=1; diff --git a/modules/15_food/anthro_iso_jun22/postsolve.gms b/modules/15_food/anthro_iso_jun22/postsolve.gms new file mode 100644 index 0000000000..76919edd3e --- /dev/null +++ b/modules/15_food/anthro_iso_jun22/postsolve.gms @@ -0,0 +1,208 @@ +*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + + +if(ord(t)>1, +* start from bodyheight structure of last period + p15_bodyheight(t,iso,sex,age,"final") = p15_bodyheight(t-1,iso,sex,age,"final"); + p15_kcal_growth_food(t,iso,underaged15) = p15_kcal_growth_food(t-1,iso,underaged15); +); + +s15_yeardiff = m_yeardiff(t)/5; +if(s15_yeardiff<1,s15_yeardiff=1); + +For (s15_count = 1 to s15_yeardiff, + +* circular move of age by 5 years +* to find out about ++1 search for help on Circular Lag and Lead Operators in Assignments + p15_bodyheight(t,iso,sex,age++1,"final") = p15_bodyheight(t,iso,sex,age,"final"); + +* move on consumption agegroups by 5 years + p15_kcal_growth_food(t,iso,underaged15++1)= + p15_kcal_growth_food(t,iso,underaged15); + +* consumption is calculated as linear interpolation between timesteps + p15_kcal_growth_food(t,iso,"0--4") = + sum(growth_food15, + p15_intake_detail(t,iso,growth_food15) + * p15_demand2intake_ratio_detail_preexo(t,iso,growth_food15) + * (s15_count / (m_yeardiff(t)/5)) + + p15_intake_detail(t-1,iso,growth_food15) + * p15_demand2intake_ratio_detail_preexo(t-1,iso,growth_food15) + * (1 - s15_count / (m_yeardiff(t)/5)) + ); + +*' @code +*' After each execution of the food demand model, the body height distribution +*' of the population is estimated. The starting point is the body height +*' distribution of the last timestep. The body height estimates of the old +*' period are moved into the subsequent age class (e.g. the 20-24 year old are +*' now 25-29 years old). The age class of 15-19 year old is estimated newly +*' using the body height regressions and the food consumption of the last 15 +*' years. + + p15_bodyheight(t,iso,sex,"15--19","final") = + f15_bodyheight_regr_paras(sex,"slope")* + (sum(underaged15, + p15_kcal_growth_food(t,iso,underaged15) + )/3)**f15_bodyheight_regr_paras(sex,"exponent") + ; + +*' @stop +); + +*' @code +*' The bodyheight of the underaged age class (0-14) is assumed to diverge from 'normal' +*' body height by the same proportion as the age class of the 15-19 year old. + +p15_bodyheight(t,iso,"M","0--4","final")=p15_bodyheight(t,iso,"M","15--19","final")/176*92; +p15_bodyheight(t,iso,"M","5--9","final")=p15_bodyheight(t,iso,"M","15--19","final")/176*125; +p15_bodyheight(t,iso,"M","10--14","final")=p15_bodyheight(t,iso,"M","15--19","final")/176*152; + +p15_bodyheight(t,iso,"F","0--4","final")=p15_bodyheight(t,iso,"M","15--19","final")/163*91; +p15_bodyheight(t,iso,"F","5--9","final")=p15_bodyheight(t,iso,"M","15--19","final")/163*124; +p15_bodyheight(t,iso,"F","10--14","final")=p15_bodyheight(t,iso,"M","15--19","final")/163*154; + +*' @stop + +*' @code +*' Finally, the regression outcome is calibrated by a country-specific additive +*' term, which is the residual of the regression fit and observation of the last +*' historical time step. + +if (sum(sameas(t_past,t),1) = 1, +* For historical period, the regression results are only used to estimate the calibration parameter. + p15_bodyheight_calib(t,iso,sex,age_new_estimated15) = f15_bodyheight(t,iso,sex,age_new_estimated15) - p15_bodyheight(t,iso,sex,age_new_estimated15,"final"); + p15_bodyheight(t,iso,sex,age_new_estimated15,"final") = f15_bodyheight(t,iso,sex,age_new_estimated15); +else + p15_bodyheight_calib(t,iso,sex,age_new_estimated15)=p15_bodyheight_calib(t-1,iso,sex,age_new_estimated15); + p15_bodyheight(t,iso,sex,age_new_estimated15,"final")=p15_bodyheight(t,iso,sex,age_new_estimated15,"final")+p15_bodyheight_calib(t,iso,sex,age_new_estimated15)*s15_calibrate; +); + +*' @stop + + + + +*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### + ov_dem_food(t,i,kall,"marginal") = vm_dem_food.m(i,kall); + ov15_kcal_regr(t,iso,kfo,"marginal") = v15_kcal_regr.m(iso,kfo); + ov15_kcal_regr_total(t,iso,"marginal") = v15_kcal_regr_total.m(iso); + ov15_demand_regr(t,iso,regr15,"marginal") = v15_demand_regr.m(iso,regr15); + ov15_income_pc_real_ppp_iso(t,iso,"marginal") = v15_income_pc_real_ppp_iso.m(iso); + ov15_income_balance(t,iso,"marginal") = v15_income_balance.m(iso); + ov15_kcal_intake_total_regr(t,iso,"marginal") = v15_kcal_intake_total_regr.m(iso); + ov15_regr_overgroups(t,iso,sex,agegroup15,bmi_tree15,"marginal") = v15_regr_overgroups.m(iso,sex,agegroup15,bmi_tree15); + ov15_bmi_shr_regr(t,iso,sex,age,bmi_group15,"marginal") = v15_bmi_shr_regr.m(iso,sex,age,bmi_group15); + ov15_bmi_shr_overgroups(t,iso,sex,agegroup15,bmi_group15,"marginal") = v15_bmi_shr_overgroups.m(iso,sex,agegroup15,bmi_group15); + ov15_objective(t,"marginal") = v15_objective.m; + oq15_food_demand(t,i,kfo,"marginal") = q15_food_demand.m(i,kfo); + oq15_aim(t,"marginal") = q15_aim.m; + oq15_budget(t,iso,"marginal") = q15_budget.m(iso); + oq15_regr_bmi_shr(t,iso,sex,agegroup15,bmi_tree15,"marginal") = q15_regr_bmi_shr.m(iso,sex,agegroup15,bmi_tree15); + oq15_bmi_shr_verylow(t,iso,sex,agegroup15,"marginal") = q15_bmi_shr_verylow.m(iso,sex,agegroup15); + oq15_bmi_shr_low(t,iso,sex,agegroup15,"marginal") = q15_bmi_shr_low.m(iso,sex,agegroup15); + oq15_bmi_shr_medium(t,iso,sex,agegroup15,"marginal") = q15_bmi_shr_medium.m(iso,sex,agegroup15); + oq15_bmi_shr_medium_high(t,iso,sex,agegroup15,"marginal") = q15_bmi_shr_medium_high.m(iso,sex,agegroup15); + oq15_bmi_shr_high(t,iso,sex,agegroup15,"marginal") = q15_bmi_shr_high.m(iso,sex,agegroup15); + oq15_bmi_shr_veryhigh(t,iso,sex,agegroup15,"marginal") = q15_bmi_shr_veryhigh.m(iso,sex,agegroup15); + oq15_bmi_shr_agg(t,iso,sex,age,bmi_group15,"marginal") = q15_bmi_shr_agg.m(iso,sex,age,bmi_group15); + oq15_intake(t,iso,"marginal") = q15_intake.m(iso); + oq15_regr_kcal(t,iso,"marginal") = q15_regr_kcal.m(iso); + oq15_regr(t,iso,regr15,"marginal") = q15_regr.m(iso,regr15); + oq15_foodtree_kcal_animals(t,iso,kfo_ap,"marginal") = q15_foodtree_kcal_animals.m(iso,kfo_ap); + oq15_foodtree_kcal_processed(t,iso,kfo_pf,"marginal") = q15_foodtree_kcal_processed.m(iso,kfo_pf); + oq15_foodtree_kcal_staples(t,iso,kfo_st,"marginal") = q15_foodtree_kcal_staples.m(iso,kfo_st); + oq15_foodtree_kcal_vegetables(t,iso,"marginal") = q15_foodtree_kcal_vegetables.m(iso); + ov_dem_food(t,i,kall,"level") = vm_dem_food.l(i,kall); + ov15_kcal_regr(t,iso,kfo,"level") = v15_kcal_regr.l(iso,kfo); + ov15_kcal_regr_total(t,iso,"level") = v15_kcal_regr_total.l(iso); + ov15_demand_regr(t,iso,regr15,"level") = v15_demand_regr.l(iso,regr15); + ov15_income_pc_real_ppp_iso(t,iso,"level") = v15_income_pc_real_ppp_iso.l(iso); + ov15_income_balance(t,iso,"level") = v15_income_balance.l(iso); + ov15_kcal_intake_total_regr(t,iso,"level") = v15_kcal_intake_total_regr.l(iso); + ov15_regr_overgroups(t,iso,sex,agegroup15,bmi_tree15,"level") = v15_regr_overgroups.l(iso,sex,agegroup15,bmi_tree15); + ov15_bmi_shr_regr(t,iso,sex,age,bmi_group15,"level") = v15_bmi_shr_regr.l(iso,sex,age,bmi_group15); + ov15_bmi_shr_overgroups(t,iso,sex,agegroup15,bmi_group15,"level") = v15_bmi_shr_overgroups.l(iso,sex,agegroup15,bmi_group15); + ov15_objective(t,"level") = v15_objective.l; + oq15_food_demand(t,i,kfo,"level") = q15_food_demand.l(i,kfo); + oq15_aim(t,"level") = q15_aim.l; + oq15_budget(t,iso,"level") = q15_budget.l(iso); + oq15_regr_bmi_shr(t,iso,sex,agegroup15,bmi_tree15,"level") = q15_regr_bmi_shr.l(iso,sex,agegroup15,bmi_tree15); + oq15_bmi_shr_verylow(t,iso,sex,agegroup15,"level") = q15_bmi_shr_verylow.l(iso,sex,agegroup15); + oq15_bmi_shr_low(t,iso,sex,agegroup15,"level") = q15_bmi_shr_low.l(iso,sex,agegroup15); + oq15_bmi_shr_medium(t,iso,sex,agegroup15,"level") = q15_bmi_shr_medium.l(iso,sex,agegroup15); + oq15_bmi_shr_medium_high(t,iso,sex,agegroup15,"level") = q15_bmi_shr_medium_high.l(iso,sex,agegroup15); + oq15_bmi_shr_high(t,iso,sex,agegroup15,"level") = q15_bmi_shr_high.l(iso,sex,agegroup15); + oq15_bmi_shr_veryhigh(t,iso,sex,agegroup15,"level") = q15_bmi_shr_veryhigh.l(iso,sex,agegroup15); + oq15_bmi_shr_agg(t,iso,sex,age,bmi_group15,"level") = q15_bmi_shr_agg.l(iso,sex,age,bmi_group15); + oq15_intake(t,iso,"level") = q15_intake.l(iso); + oq15_regr_kcal(t,iso,"level") = q15_regr_kcal.l(iso); + oq15_regr(t,iso,regr15,"level") = q15_regr.l(iso,regr15); + oq15_foodtree_kcal_animals(t,iso,kfo_ap,"level") = q15_foodtree_kcal_animals.l(iso,kfo_ap); + oq15_foodtree_kcal_processed(t,iso,kfo_pf,"level") = q15_foodtree_kcal_processed.l(iso,kfo_pf); + oq15_foodtree_kcal_staples(t,iso,kfo_st,"level") = q15_foodtree_kcal_staples.l(iso,kfo_st); + oq15_foodtree_kcal_vegetables(t,iso,"level") = q15_foodtree_kcal_vegetables.l(iso); + ov_dem_food(t,i,kall,"upper") = vm_dem_food.up(i,kall); + ov15_kcal_regr(t,iso,kfo,"upper") = v15_kcal_regr.up(iso,kfo); + ov15_kcal_regr_total(t,iso,"upper") = v15_kcal_regr_total.up(iso); + ov15_demand_regr(t,iso,regr15,"upper") = v15_demand_regr.up(iso,regr15); + ov15_income_pc_real_ppp_iso(t,iso,"upper") = v15_income_pc_real_ppp_iso.up(iso); + ov15_income_balance(t,iso,"upper") = v15_income_balance.up(iso); + ov15_kcal_intake_total_regr(t,iso,"upper") = v15_kcal_intake_total_regr.up(iso); + ov15_regr_overgroups(t,iso,sex,agegroup15,bmi_tree15,"upper") = v15_regr_overgroups.up(iso,sex,agegroup15,bmi_tree15); + ov15_bmi_shr_regr(t,iso,sex,age,bmi_group15,"upper") = v15_bmi_shr_regr.up(iso,sex,age,bmi_group15); + ov15_bmi_shr_overgroups(t,iso,sex,agegroup15,bmi_group15,"upper") = v15_bmi_shr_overgroups.up(iso,sex,agegroup15,bmi_group15); + ov15_objective(t,"upper") = v15_objective.up; + oq15_food_demand(t,i,kfo,"upper") = q15_food_demand.up(i,kfo); + oq15_aim(t,"upper") = q15_aim.up; + oq15_budget(t,iso,"upper") = q15_budget.up(iso); + oq15_regr_bmi_shr(t,iso,sex,agegroup15,bmi_tree15,"upper") = q15_regr_bmi_shr.up(iso,sex,agegroup15,bmi_tree15); + oq15_bmi_shr_verylow(t,iso,sex,agegroup15,"upper") = q15_bmi_shr_verylow.up(iso,sex,agegroup15); + oq15_bmi_shr_low(t,iso,sex,agegroup15,"upper") = q15_bmi_shr_low.up(iso,sex,agegroup15); + oq15_bmi_shr_medium(t,iso,sex,agegroup15,"upper") = q15_bmi_shr_medium.up(iso,sex,agegroup15); + oq15_bmi_shr_medium_high(t,iso,sex,agegroup15,"upper") = q15_bmi_shr_medium_high.up(iso,sex,agegroup15); + oq15_bmi_shr_high(t,iso,sex,agegroup15,"upper") = q15_bmi_shr_high.up(iso,sex,agegroup15); + oq15_bmi_shr_veryhigh(t,iso,sex,agegroup15,"upper") = q15_bmi_shr_veryhigh.up(iso,sex,agegroup15); + oq15_bmi_shr_agg(t,iso,sex,age,bmi_group15,"upper") = q15_bmi_shr_agg.up(iso,sex,age,bmi_group15); + oq15_intake(t,iso,"upper") = q15_intake.up(iso); + oq15_regr_kcal(t,iso,"upper") = q15_regr_kcal.up(iso); + oq15_regr(t,iso,regr15,"upper") = q15_regr.up(iso,regr15); + oq15_foodtree_kcal_animals(t,iso,kfo_ap,"upper") = q15_foodtree_kcal_animals.up(iso,kfo_ap); + oq15_foodtree_kcal_processed(t,iso,kfo_pf,"upper") = q15_foodtree_kcal_processed.up(iso,kfo_pf); + oq15_foodtree_kcal_staples(t,iso,kfo_st,"upper") = q15_foodtree_kcal_staples.up(iso,kfo_st); + oq15_foodtree_kcal_vegetables(t,iso,"upper") = q15_foodtree_kcal_vegetables.up(iso); + ov_dem_food(t,i,kall,"lower") = vm_dem_food.lo(i,kall); + ov15_kcal_regr(t,iso,kfo,"lower") = v15_kcal_regr.lo(iso,kfo); + ov15_kcal_regr_total(t,iso,"lower") = v15_kcal_regr_total.lo(iso); + ov15_demand_regr(t,iso,regr15,"lower") = v15_demand_regr.lo(iso,regr15); + ov15_income_pc_real_ppp_iso(t,iso,"lower") = v15_income_pc_real_ppp_iso.lo(iso); + ov15_income_balance(t,iso,"lower") = v15_income_balance.lo(iso); + ov15_kcal_intake_total_regr(t,iso,"lower") = v15_kcal_intake_total_regr.lo(iso); + ov15_regr_overgroups(t,iso,sex,agegroup15,bmi_tree15,"lower") = v15_regr_overgroups.lo(iso,sex,agegroup15,bmi_tree15); + ov15_bmi_shr_regr(t,iso,sex,age,bmi_group15,"lower") = v15_bmi_shr_regr.lo(iso,sex,age,bmi_group15); + ov15_bmi_shr_overgroups(t,iso,sex,agegroup15,bmi_group15,"lower") = v15_bmi_shr_overgroups.lo(iso,sex,agegroup15,bmi_group15); + ov15_objective(t,"lower") = v15_objective.lo; + oq15_food_demand(t,i,kfo,"lower") = q15_food_demand.lo(i,kfo); + oq15_aim(t,"lower") = q15_aim.lo; + oq15_budget(t,iso,"lower") = q15_budget.lo(iso); + oq15_regr_bmi_shr(t,iso,sex,agegroup15,bmi_tree15,"lower") = q15_regr_bmi_shr.lo(iso,sex,agegroup15,bmi_tree15); + oq15_bmi_shr_verylow(t,iso,sex,agegroup15,"lower") = q15_bmi_shr_verylow.lo(iso,sex,agegroup15); + oq15_bmi_shr_low(t,iso,sex,agegroup15,"lower") = q15_bmi_shr_low.lo(iso,sex,agegroup15); + oq15_bmi_shr_medium(t,iso,sex,agegroup15,"lower") = q15_bmi_shr_medium.lo(iso,sex,agegroup15); + oq15_bmi_shr_medium_high(t,iso,sex,agegroup15,"lower") = q15_bmi_shr_medium_high.lo(iso,sex,agegroup15); + oq15_bmi_shr_high(t,iso,sex,agegroup15,"lower") = q15_bmi_shr_high.lo(iso,sex,agegroup15); + oq15_bmi_shr_veryhigh(t,iso,sex,agegroup15,"lower") = q15_bmi_shr_veryhigh.lo(iso,sex,agegroup15); + oq15_bmi_shr_agg(t,iso,sex,age,bmi_group15,"lower") = q15_bmi_shr_agg.lo(iso,sex,age,bmi_group15); + oq15_intake(t,iso,"lower") = q15_intake.lo(iso); + oq15_regr_kcal(t,iso,"lower") = q15_regr_kcal.lo(iso); + oq15_regr(t,iso,regr15,"lower") = q15_regr.lo(iso,regr15); + oq15_foodtree_kcal_animals(t,iso,kfo_ap,"lower") = q15_foodtree_kcal_animals.lo(iso,kfo_ap); + oq15_foodtree_kcal_processed(t,iso,kfo_pf,"lower") = q15_foodtree_kcal_processed.lo(iso,kfo_pf); + oq15_foodtree_kcal_staples(t,iso,kfo_st,"lower") = q15_foodtree_kcal_staples.lo(iso,kfo_st); + oq15_foodtree_kcal_vegetables(t,iso,"lower") = q15_foodtree_kcal_vegetables.lo(iso); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/15_food/anthro_iso_jun22/preloop.gms b/modules/15_food/anthro_iso_jun22/preloop.gms new file mode 100644 index 0000000000..37c36ad5d3 --- /dev/null +++ b/modules/15_food/anthro_iso_jun22/preloop.gms @@ -0,0 +1,91 @@ +*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: c15_livescenmagpie@pik-potsdam.de + + i15_bmi_intercept(sex,agegroup15,bmi_tree15) = f15_bmi_shr_paras(sex,agegroup15,bmi_tree15,"intercept"); + i15_bmi_saturation(sex,agegroup15,bmi_tree15) = f15_bmi_shr_paras(sex,agegroup15,bmi_tree15,"saturation"); + i15_bmi_halfsat(sex,agegroup15,bmi_tree15) = f15_bmi_shr_paras(sex,agegroup15,bmi_tree15,"halfsaturation"); + +p15_bodyheight(t,iso,sex,age,estimates15) = f15_bodyheight(t,iso,sex,age); + +* calculating growth food for historical period + +loop(t_past, + if (ord(t_past)>3, + p15_kcal_growth_food(t_past,iso,"10--14") = sum(growth_food15, f15_kcal_pc_iso(t_past-3,iso,growth_food15)); + p15_kcal_growth_food(t_past,iso,"5--9") = sum(growth_food15, f15_kcal_pc_iso(t_past-2,iso,growth_food15)); + p15_kcal_growth_food(t_past,iso,"0--4") = sum(growth_food15, f15_kcal_pc_iso(t_past-1,iso,growth_food15)); + Elseif ord(t_past)=3, + p15_kcal_growth_food(t_past,iso,"10--14") = sum(growth_food15, f15_kcal_pc_iso(t_past-2,iso,growth_food15)); + p15_kcal_growth_food(t_past,iso,"5--9") = sum(growth_food15, f15_kcal_pc_iso(t_past-2,iso,growth_food15)); + p15_kcal_growth_food(t_past,iso,"0--4") = sum(growth_food15, f15_kcal_pc_iso(t_past-1,iso,growth_food15)); + Elseif ord(t_past)=2, + p15_kcal_growth_food(t_past,iso,"10--14") = sum(growth_food15, f15_kcal_pc_iso(t_past-1,iso,growth_food15)); + p15_kcal_growth_food(t_past,iso,"5--9") = sum(growth_food15, f15_kcal_pc_iso(t_past-1,iso,growth_food15)); + p15_kcal_growth_food(t_past,iso,"0--4") = sum(growth_food15, f15_kcal_pc_iso(t_past-1,iso,growth_food15)); + Elseif ord(t_past)=1, + p15_kcal_growth_food(t_past,iso,"10--14") = sum(growth_food15, f15_kcal_pc_iso(t_past-0,iso,growth_food15)); + p15_kcal_growth_food(t_past,iso,"5--9") = sum(growth_food15, f15_kcal_pc_iso(t_past-0,iso,growth_food15)); + p15_kcal_growth_food(t_past,iso,"0--4") = sum(growth_food15, f15_kcal_pc_iso(t_past-0,iso,growth_food15)); + ); +); + + +* Temporal development of ruminant meat share within the livestock food product +* group (applied before food demand model is executed) +$ifthen "%c15_rum_share%" == "mixed" i15_rum_share_fadeout(t,iso) = (f15_rum_share_fadeout(t,"constant") + f15_rum_share_fadeout(t,"halving2050"))/2; +$else i15_rum_share_fadeout(t,iso) = f15_rum_share_fadeout(t,"%c15_rum_share%"); +$endif + +* Stronger ruminant fadeout for India +if (s15_rum_share_fadeout_india_strong = 1, + i15_rum_share_fadeout(t,"IND") = f15_rum_share_fadeout_india(t); +); + +* Milk fadeout for India +if (s15_milk_share_fadeout_india = 0, + i15_milk_share_fadeout_india(t) = 1; +Elseif s15_milk_share_fadeout_india = 1, + i15_milk_share_fadeout_india(t) = f15_milk_share_fadeout_india(t); +); + + +* ###### Exogenous food waste and diet scenarios as well as food substitution scenarios + + +* Switch to determine countries for which exogenous food scenarios (EAT Lancet diet and +* food waste scenarios), and food substitution scenarios shall be applied. +* In the default case, the exogenous food scenarios affect all countries. +p15_country_dummy(iso) = 0; +p15_country_dummy(scen_countries15) = 1; + +* Food substitution scenarios including functional forms, targets and transition periods +i15_ruminant_fadeout(t,iso) = 1 - p15_country_dummy(iso)*(1-f15_food_substitution_fader(t,"%c15_rumscen%")); +i15_fish_fadeout(t,iso) = 1 - p15_country_dummy(iso)*(1-f15_food_substitution_fader(t,"%c15_fishscen%")); +i15_alcohol_fadeout(t,iso) = 1 - p15_country_dummy(iso)*(1-f15_food_substitution_fader(t,"%c15_alcscen%")); +i15_livestock_fadeout(t,iso) = 1 - p15_country_dummy(iso)*(1-f15_food_substitution_fader(t,"%c15_livescen%")); +i15_rumdairy_fadeout(t,iso) = 1 - p15_country_dummy(iso)*(1-f15_food_substitution_fader(t,"%c15_rumdairyscen%")); +i15_rumdairy_scp_fadeout(t,iso) = 1 - p15_country_dummy(iso)*(1-f15_food_substitution_fader(t,"%c15_rumdairy_scp_scen%")); +i15_livestock_fadeout_threshold(t,iso) = 1 - p15_country_dummy(iso)*(1-f15_food_substitution_fader(t,"%c15_livescen_target%")); + + +* Exogenous food intake and waste scenarios including functional forms, targets and transition periods +i15_exo_foodscen_fader(t,iso) = (1-f15_food_substitution_fader(t,"%c15_exo_foodscen%")) * p15_country_dummy(iso); + +* Select from the data set of EAT Lancet scenarios the target years that are +* consistent with the target year of the fader: + +$ifthen "%c15_exo_foodscen%" == "lin_zero_20_30" + i15_intake_EATLancet_all(iso,kcal_scen15,EAT_scen15,kfo) = f15_intake_EATLancet("y2030",iso,kcal_scen15,EAT_scen15,kfo); +$else + i15_intake_EATLancet_all(iso,kcal_scen15,EAT_scen15,kfo) = f15_intake_EATLancet("y2050",iso,kcal_scen15,EAT_scen15,kfo); +$endif + +* initial prices in $US per Kcal +i15_prices_initial_kcal(iso,kfo)$(f15_nutrition_attributes("y1995",kfo,"kcal")>0) = f15_prices_initial(kfo) + / (f15_nutrition_attributes("y1995",kfo,"kcal")*10**6); +p15_prices_kcal(t,iso,kfo,"iter1")=i15_prices_initial_kcal(iso,kfo); +p15_convergence_measure(t,iter15)=NA; diff --git a/modules/15_food/anthro_iso_jun22/presolve.gms b/modules/15_food/anthro_iso_jun22/presolve.gms new file mode 100644 index 0000000000..2e06af7860 --- /dev/null +++ b/modules/15_food/anthro_iso_jun22/presolve.gms @@ -0,0 +1,332 @@ +*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + + + +if(m_year(t) <= sm_fix_SSP2, + i15_dem_intercept(iso,regr15) = f15_demand_paras(regr15,"SSP2","intercept"); + i15_dem_saturation(iso,regr15) = f15_demand_paras(regr15,"SSP2","saturation"); + i15_dem_halfsat(iso,regr15) = f15_demand_paras(regr15,"SSP2","halfsaturation"); + i15_dem_nonsat(iso,regr15) = f15_demand_paras(regr15,"SSP2","non_saturation"); +else + i15_dem_intercept(iso,regr15) = f15_demand_paras(regr15,"%c15_food_scenario%","intercept")*p15_country_dummy(iso) + + f15_demand_paras(regr15,"%c15_food_scenario_noselect%","intercept")*(1-p15_country_dummy(iso)); + i15_dem_saturation(iso,regr15) = f15_demand_paras(regr15,"%c15_food_scenario%","saturation")*p15_country_dummy(iso) + + f15_demand_paras(regr15,"%c15_food_scenario_noselect%","saturation")*(1-p15_country_dummy(iso)); + i15_dem_halfsat(iso,regr15) = f15_demand_paras(regr15,"%c15_food_scenario%","halfsaturation")*p15_country_dummy(iso) + + f15_demand_paras(regr15,"%c15_food_scenario_noselect%","halfsaturation")*(1-p15_country_dummy(iso)); + i15_dem_nonsat(iso,regr15) = f15_demand_paras(regr15,"%c15_food_scenario%","non_saturation")*p15_country_dummy(iso) + + f15_demand_paras(regr15,"%c15_food_scenario_noselect%","non_saturation")*(1-p15_country_dummy(iso)); +); + +option nlp = conopt4 + + +*' @code +*' Within the major food groups determined by the regressions +*' (animal calories, empty calories, fruits, vegetable and nut calories as well as staple calories), +*' the relative share of individual products (e.g. eggs within animal calories) +*' is assumed to be constant. An exception is the demand for ruminant meat, +*' which declines in the course of the century at the cost of chicken meat. +*' @stop + +if (sum(sameas(t_past,t),1) = 1, + +*** Calculate the share of individual food products within major food groups, and replace zero shares with regional averages +* First set it to equal shares, just in case there is no population + + + i15_livestock_kcal_structure_iso_raw(t,iso,kfo_ap) = + sum(iso2, f15_kcal_pc_iso(t,iso2,kfo_ap)*im_pop_iso(t,iso2))/ + ( + sum((kfo_ap2,iso2),(f15_kcal_pc_iso(t,iso2,kfo_ap2)*im_pop_iso(t,iso2))) + +10**(-5) + ); + + i15_livestock_kcal_structure_iso_raw(t,iso,kfo_ap)$sum(kfo_ap2,f15_kcal_pc_iso(t,iso,kfo_ap2)>0)= + f15_kcal_pc_iso(t,iso,kfo_ap) / + sum(kfo_ap2,f15_kcal_pc_iso(t,iso,kfo_ap2) +* 10**(-5) required to avoid unlogical division by zero error. + ); + + i15_livestock_kcal_structure_iso(t,iso,kfo_ap) = i15_livestock_kcal_structure_iso_raw(t,iso,kfo_ap); + + i15_processed_kcal_structure_iso(t,iso,kfo_pf) = + sum(iso2, f15_kcal_pc_iso(t,iso2,kfo_pf)*im_pop_iso(t,iso2)) / + ( + sum((kfo_pf2,iso2),f15_kcal_pc_iso(t,iso2,kfo_pf2)*im_pop_iso(t,iso2)) + +10**(-5) +* 10**(-5) required to avoid unlogical division by zero error. Ask Jan P + ); + + i15_processed_kcal_structure_iso(t,iso,kfo_pf)$(sum(kfo_pf2,f15_kcal_pc_iso(t,iso,kfo_pf2))>0) = + f15_kcal_pc_iso(t,iso,kfo_pf) + /sum(kfo_pf2,f15_kcal_pc_iso(t,iso,kfo_pf2) + ); + + i15_staples_kcal_structure_iso(t,iso,kfo_st) = + sum(iso2, f15_kcal_pc_iso(t,iso2,kfo_st)*im_pop_iso(t,iso2)) / + ( + sum((kfo_st2,iso2),f15_kcal_pc_iso(t,iso2,kfo_st2)*im_pop_iso(t,iso2)) + +10**(-5) +* 10**(-5) required to avoid unlogical division by zero error. Ask Jan P + ); + + i15_staples_kcal_structure_iso(t,iso,kfo_st)$(sum(kfo_st2,f15_kcal_pc_iso(t,iso,kfo_st2))>0) = + f15_kcal_pc_iso(t,iso,kfo_st) + /sum(kfo_st2,f15_kcal_pc_iso(t,iso,kfo_st2) + ); + + + else +* Assumptions on future calorie structure within food groups for future projections: + i15_staples_kcal_structure_iso(t,iso,kfo_st) =i15_staples_kcal_structure_iso(t-1,iso,kfo_st); + i15_processed_kcal_structure_iso(t,iso,kfo_pf) =i15_processed_kcal_structure_iso(t-1,iso,kfo_pf); + i15_livestock_kcal_structure_iso_raw(t,iso,kfo_ap) = i15_livestock_kcal_structure_iso_raw(t-1,iso,kfo_ap); + i15_livestock_kcal_structure_iso(t,iso,kfo_ap) = i15_livestock_kcal_structure_iso_raw(t,iso,kfo_ap); + i15_livestock_kcal_structure_iso(t,iso,"livst_chick") = + i15_livestock_kcal_structure_iso_raw(t,iso,"livst_chick") + + i15_livestock_kcal_structure_iso_raw(t,iso,"livst_rum") * (1-i15_rum_share_fadeout(t,iso)); + i15_livestock_kcal_structure_iso(t,iso,"livst_rum") = + i15_livestock_kcal_structure_iso_raw(t,iso,"livst_rum") * i15_rum_share_fadeout(t,iso); + +* Substitute milk demand in India with chicken, egg and fish (equally distributed) because milk demand in India shows an implausible increase + i15_livestock_kcal_structure_iso(t,"IND","livst_milk") = + i15_livestock_kcal_structure_iso_raw(t,"IND","livst_milk") * i15_milk_share_fadeout_india(t); + i15_livestock_kcal_structure_iso(t,"IND","livst_chick") = + i15_livestock_kcal_structure_iso(t,"IND","livst_chick") + + i15_livestock_kcal_structure_iso_raw(t,"IND","livst_milk") * (1-i15_milk_share_fadeout_india(t)) * 1/3; + i15_livestock_kcal_structure_iso(t,"IND","livst_egg") = + i15_livestock_kcal_structure_iso(t,"IND","livst_egg") + + i15_livestock_kcal_structure_iso_raw(t,"IND","livst_milk") * (1-i15_milk_share_fadeout_india(t)) * 1/3; + i15_livestock_kcal_structure_iso(t,"IND","fish") = + i15_livestock_kcal_structure_iso(t,"IND","fish") + + i15_livestock_kcal_structure_iso_raw(t,"IND","livst_milk") * (1-i15_milk_share_fadeout_india(t)) * 1/3; + ); + + +*' @code +*' The calculations are executed in the following order: +*' +*' In the beginning of each time step, the body height is estimated based on the diets +*' of the previous 15 years. In case that the time step length exceeds 5 years, +*' the consumption is extrapolated using the last two time steps. +*' Body height is estimated using the consumption of proteins and fats, in our case +*' the foodgroups animal products, pulses and oils. +*' To estimate the body size of underaged (0-14 years), we scale the WHO body height +*' recommendations for underaged with the divergence of the 15-19 year old. +*' The body height estimates are repeated again at the end of the time step to improve +*' the results of the extrapolation for cases where the time step length exceeds 5 years. +*' @stop + +* ###### ANTHROPOMETRIC ESTIMATES +* ### Preliminary calculation of body height and weight based on food availability of last 3 timesteps. +* ### This may diverge from final calculation in the case where timestep length exceeds 5 years +* ### as then the demand depends on the result of MAgPIE. +* ### Calculations are therefore repeated after optimization. + +* Calculations are only made after historical period. Before, we use historical values. + +if (sum(sameas(t_past,t),1) = 1, + + p15_bodyheight(t,iso,sex,age,estimates15) = f15_bodyheight(t,iso,sex,age); + + +else + + p15_bodyheight(t,iso,sex,age,"preliminary") = p15_bodyheight(t-1,iso,sex,age,"final"); + p15_kcal_growth_food(t,iso,underaged15) = p15_kcal_growth_food(t-1,iso,underaged15); + + + + + s15_yeardiff = m_yeardiff(t)/5; +* avoid fake 1yr timestep in 1995 + if(s15_yeardiff<1,s15_yeardiff=1); + + For (s15_count = 1 to s15_yeardiff, + + +* circular move of age by 5 years +* to find out about ++1 search for help on Circular Lag and Lead Operators in Assignments + p15_bodyheight(t,iso,sex,age++1,"preliminary") = p15_bodyheight(t,iso,sex,age,"preliminary"); + +* replace age groups of 18 year old + p15_bodyheight(t,iso,sex,"15--19","preliminary") = + f15_bodyheight_regr_paras(sex,"slope")* + (sum(underaged15, + p15_kcal_growth_food(t,iso,underaged15) + )/3)**f15_bodyheight_regr_paras(sex,"exponent") + ; + + ); +*adjust body height of kids proportional to over18 population + p15_bodyheight(t,iso,"M","0--4","preliminary")=p15_bodyheight(t,iso,"M","15--19","preliminary")/176*92; + p15_bodyheight(t,iso,"M","5--9","preliminary")=p15_bodyheight(t,iso,"M","15--19","preliminary")/176*125; + p15_bodyheight(t,iso,"M","10--14","preliminary")=p15_bodyheight(t,iso,"M","15--19","preliminary")/176*152; + + p15_bodyheight(t,iso,"F","0--4","preliminary")=p15_bodyheight(t,iso,"M","15--19","preliminary")/163*91; + p15_bodyheight(t,iso,"F","5--9","preliminary")=p15_bodyheight(t,iso,"M","15--19","preliminary")/163*124; + p15_bodyheight(t,iso,"F","10--14","preliminary")=p15_bodyheight(t,iso,"M","15--19","preliminary")/163*154; + +); + + +*' @code + + + +*### Estimate standardized food requirements +p15_bodyweight(t,iso,sex,age,bmi_group15)= f15_bmi(sex,age,bmi_group15) * (p15_bodyheight(t,iso,sex,age,"preliminary")/100)**2; + +*' Physical activity levels (PAL) relative to the basic metabolic rate (BMR) are +*' estimated based on physical inactivity levels, assuming PALs for sedentary +*' and medium-active populations of 1.53 and 1.76 respectively: +p15_physical_activity_level(t,iso,sex,age)= + im_physical_inactivity(t,iso,sex,age) * 1.53 + +(1-im_physical_inactivity(t,iso,sex,age)) * 1.76 + ; + +p15_intake(t,iso,sex,age,bmi_group15)= + (f15_schofield(sex,age, "intercept") + + f15_schofield(sex,age, "slope")*p15_bodyweight(t,iso,sex,age,bmi_group15)) + * p15_physical_activity_level(t,iso,sex,age); + + +*' Pregnancy and lactation require additional food intake. To account for this, +*' newborns are distributed among reproductive women in a population. This number +*' is then multiplied with the extra energy requirements: +i15_kcal_pregnancy(t,iso)=sum(sex,im_demography(t,iso,sex,"0--4")/5) * ((40/66)*845 + (26/66)*675); + +*' @stop + + + +*###### Estimation of food demand using a first run of the food demand model with unshocked prices. + +*' @code +*' Before MAgPIE is executed, the food demand model is executed, at first +*' without price shocks. +*' @stop + +* demand for non-food products "knf" is set to 0; +vm_dem_food.fx(i,knf)=0; + +*** Food demand model is calculated the first time for the current time step, using standard prices + +* activating the first iteration +p15_iteration_counter(t) = 1; + +* The set curr_iter15 includes only one element with the set element +* of the current iteration, e.g. "iter2" +curr_iter15(iter15) = no; +curr_iter15(iter15)$(ord(iter15)=p15_iteration_counter(t)) = yes; + +p15_delta_income(t,i,curr_iter15) = 1; + +display "starting demand model for initialisation run...."; + + +* helping the solver by starting from reasonable values +* by setting real income per capita on exogenous gdp per capita +v15_income_pc_real_ppp_iso.lo(iso)=10; +v15_income_pc_real_ppp_iso.fx(iso)=im_gdp_pc_ppp_iso(t,iso); + +solve m15_food_demand USING nlp MAXIMIZING v15_objective; + +* in case of problems try CONOPT3 +if(m15_food_demand.modelstat > 2, + display "Modelstat > 2 | Retry solve with CONOPT3"; + option nlp = conopt; + solve m15_food_demand USING nlp MAXIMIZING v15_objective; + option nlp = conopt4; +); + +p15_modelstat(t) = m15_food_demand.modelstat; + +display "Food Demand Model Initialisation run finished with modelstat "; +display p15_modelstat; + +if(p15_modelstat(t) > 2 AND p15_modelstat(t) ne 7, + m15_food_demand.solprint = 1 + Execute_Unload "fulldata.gdx"; + abort "Food Demand Model became infeasible already during initialisation run. Stop run."; +); + +* releasing real income per capita binding for later runs that include shocks +v15_income_pc_real_ppp_iso.lo(iso)=10; +v15_income_pc_real_ppp_iso.up(iso)=Inf; + +* deriving calibration values + +*' @code +*' Per capita food demand and BMI shares are calibrated so that historical data +*' are met. For this purpose, the residual between the regression fit and the +*' observation is calculated for the historical period. When the historical period +*' ends, the calibration factor is fixed at the value of the last historical time +*' step. Additionally, a second calibration is required to meet the world totals +*' of FAOSTAT food demand for different foods. While the food demand model estimates +*' the demand for all countries of the world, FAOSTAT only covers a subset of +*' countries. To match FAOSTAT totals, the food demand of countries not included +*' in FAOSTAT is calibrated to zero. As this calibration is done ex-post, food +*' demand estimates can still be used for all countries, but MAgPIE only considers +*' demand from FAOSTAT countries. + +if (sum(sameas(t_past,t),1) = 1, + p15_kcal_calib(t,iso,kfo)$(sum(kfo2,f15_kcal_pc_iso(t,iso,kfo2))=0) = 0; + p15_balanceflow_kcal_iso(t,iso,kfo)$(sum(kfo2,f15_kcal_pc_iso(t,iso,kfo2))>0) = 0; + p15_kcal_calib(t,iso,kfo)$(sum(kfo2,f15_kcal_pc_iso(t,iso,kfo2))>0) = f15_kcal_pc_iso(t,iso,kfo) - v15_kcal_regr.l(iso, kfo); + p15_balanceflow_kcal_iso(t,iso,kfo)$(sum(kfo2,f15_kcal_pc_iso(t,iso,kfo2))=0) = f15_kcal_pc_iso(t,iso,kfo) - v15_kcal_regr.l(iso, kfo); + + p15_kcal_calib_lastcalibyear(iso,kfo) = p15_kcal_calib(t,iso,kfo); + p15_balanceflow_kcal_lastcalibyear(iso,kfo) = p15_balanceflow_kcal_iso(t,iso,kfo); + + i15_bmi_shr_calib(t,iso,sex,age,bmi_group15) = + f15_bmi_shr_past(t,iso,age,sex,bmi_group15) - + v15_bmi_shr_regr.l(iso,sex,age,bmi_group15); + i15_bmi_shr_calib_lastcalibyear(iso,sex,age,bmi_group15)= + i15_bmi_shr_calib(t,iso,sex,age,bmi_group15); + +else +*' Depending on the scenario switch c15_calibscen, the divergence of the demand from the +*' historical data is kept constant or faded out. + p15_kcal_calib(t,iso,kfo) = p15_kcal_calib_lastcalibyear(iso,kfo) * f15_kcal_calib_fadeout(t,"%c15_calibscen%"); +*' The divergence of the kcal of countries with no FAOSTAT data is kept constant +*' over time. + p15_balanceflow_kcal_iso(t,iso,kfo) = p15_balanceflow_kcal_lastcalibyear(iso,kfo); + +*' Depending on the scenario switch c15_calibscen, the divergence of the BMI shares from the +*' historical data is kept constant over time or faded out. + i15_bmi_shr_calib(t,iso,sex,age,bmi_group15) = + i15_bmi_shr_calib_lastcalibyear(iso,sex,age,bmi_group15) + * f15_kcal_calib_fadeout(t,"%c15_calibscen%"); +); + + + +*############################################################################### +* ###### Food substitution scenarios, same as in intersolve +s15_run_diet_postprocessing = 1; +$include "./modules/15_food/anthro_iso_jun22/exodietmacro.gms"; + + +* some calculations for postprocessing and other modules +p15_kcal_pc_initial_iso(t,iso,kfo) = p15_kcal_pc_iso(t,iso,kfo); +pm_kcal_pc_initial(t,i,kfo) = p15_kcal_pc(t,i,kfo); +o15_kcal_regr_initial(t,iso,kfo)=v15_kcal_regr.l(iso,kfo); + + +*' @stop + +*############################################################################### + + + + +*' @code +*' Now, MAgPIE is executed. +*' @stop diff --git a/modules/15_food/anthro_iso_jun22/realization.gms b/modules/15_food/anthro_iso_jun22/realization.gms new file mode 100644 index 0000000000..5e38b1e274 --- /dev/null +++ b/modules/15_food/anthro_iso_jun22/realization.gms @@ -0,0 +1,48 @@ +*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/15_food/anthro_iso_jun22/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/15_food/anthro_iso_jun22/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/15_food/anthro_iso_jun22/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/15_food/anthro_iso_jun22/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/15_food/anthro_iso_jun22/scaling.gms" +$Ifi "%phase%" == "preloop" $include "./modules/15_food/anthro_iso_jun22/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/15_food/anthro_iso_jun22/presolve.gms" +$Ifi "%phase%" == "intersolve" $include "./modules/15_food/anthro_iso_jun22/intersolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/15_food/anthro_iso_jun22/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### + +*' @description +*' This realization uses per capita income and the demography of the +*' world population (including sex and age classes at the country level, +*' which are provided from module [09_drivers]) as drivers. +*' The module estimates food demand on iso-country level taking +*' anthropometric food requirements as well as economic dynamics into account. +*' If flexible demand is activated, the module also uses the shadow prices +*' for agircultural products from the optimization, which are the Lagrange +*' multipliers of the constraint `q15_food_demand`. +*' The module consists of a standalone food demand model, which is executed +*' before MAgPIE starts. In the case of endogenous demand, the module is +*' iterated with MAgPIE. +*' Besides providing the fooduse of agricultural products, the model also +*' provides a number of output indicators, including the BMI distribution, +*' body weight and height of the population by age and sex, food intake by +*' age group and sex, food waste, dietary composition between livestock products, +*' empty calories (sugar, oil and alcohol), fruits vegetables and nuts, as well +*' as staple calories. +*' The food demand model can be run in standalone mode by running the +*' the file `standalone/demand_model.gms`. +*' The model is described in [@bodirsky_starved_nodate]. +*' +*' ![Execution order](food_demand_coupling.png){ width=60% } +*' +*' The model also includes a number of switches that allow for exogenous +*' diet scenarios, most importantly the shift to the Planetary Health diet +*' [@willett_food_2019]. +*' +*' @authors Benjamin Leon Bodirsky, Isabelle Weindl, Jan Philipp Dietrich diff --git a/modules/51_nitrogen/ipcc2006_sep16/scaling.gms b/modules/15_food/anthro_iso_jun22/scaling.gms similarity index 75% rename from modules/51_nitrogen/ipcc2006_sep16/scaling.gms rename to modules/15_food/anthro_iso_jun22/scaling.gms index e06a29124a..d5413452b0 100644 --- a/modules/51_nitrogen/ipcc2006_sep16/scaling.gms +++ b/modules/15_food/anthro_iso_jun22/scaling.gms @@ -5,4 +5,6 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de - +v15_income_pc_real_ppp_iso.scale(iso) = 10e5; +v15_kcal_intake_total_regr.scale(iso) = 10e3; +v15_kcal_regr_total.scale(iso) = 10e4; diff --git a/modules/15_food/anthro_iso_jun22/sets.gms b/modules/15_food/anthro_iso_jun22/sets.gms new file mode 100644 index 0000000000..d5bd0e0010 --- /dev/null +++ b/modules/15_food/anthro_iso_jun22/sets.gms @@ -0,0 +1,196 @@ +*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +sets + + iter15 iterations between food demand model and magpie + /iter1*iter10/ + curr_iter15(iter15) currently active iteration + prev_iter15(iter15) last active iteration + + underaged15(age) Group of underaged age classes + /0--4,5--9,10--14/ + + adult15(age) Age groups for adult population + / 15--19, + 20--24, 25--29, 30--34, 35--39, + 40--44, 45--49, 50--54, 55--59, + 60--64, 65--69, 70--74, 75--79 + 80--84,85--89,90--94,95--99,100+ / + + working15(adult15) Group of working age population + / 15--19, + 20--24, 25--29, 30--34, 35--39, + 40--44, 45--49, 50--54, 55--59/ + + retired15(adult15) Age group of retired population + /60--64, 65--69, 70--74, 75--79 + 80--84,85--89,90--94,95--99,100+ / + + agegroup15 All age groups + /underaged,working,retired / + + age2_adults15(agegroup15) Adult age group + /working,retired / + + agegroup2age(agegroup15,age) Mapping between age cohort and age + / + underaged . (0--4,5--9,10--14) + working . (15--19, + 20--24, 25--29, 30--34, 35--39, + 40--44, 45--49, 50--54, 55--59) + retired . (60--64, 65--69, 70--74, 75--79 + 80--84,85--89,90--94,95--99,100+ ) + / + + bmi_tree15 Body mass index + /low,lowsplit,mediumsplit,high,highsplit/ + + bmi_group15 Body mass index gradient + /verylow,low,medium,mediumhigh,high,veryhigh/ + + bmi_group_est15(bmi_group15) Body mass index extremes + /verylow,low,mediumhigh,high,veryhigh/ + + age_new_estimated15(age) Estimated ages + /0--4,5--9,10--14,15--19/ + + reproductive(age) Age group of people in the reproductive age + /20--24, 25--29, 30--34, 35--39/ + + estimates15 Preliminary or final result for body height distribution + /preliminary,final/ + + paras_s15 Schofield equation parameters + /slope, intercept/ + + paras_b15 Intake equation parameters + /saturation,halfsaturation,intercept/ + + paras_h15 Bodyheight equation parameters + /slope, exponent/ + + kfo(kall) All products in the sectoral version + / tece,maiz,trce,rice_pro,soybean,rapeseed,groundnut,sunflower,puls_pro, + potato,cassav_sp,sugr_cane,sugr_beet, + oils,sugar,molasses,alcohol,brans,scp, + livst_rum,livst_pig,livst_chick, livst_egg, livst_milk, fish, + others / + + growth_food15(kfo) Food items that are important for body growth regression + / soybean,groundnut,puls_pro,oils, + livst_rum,livst_pig,livst_chick, livst_egg, livst_milk, fish / + + kst(kfo) Plant-based staple products in the sectoral version + / tece,maiz,trce,rice_pro,soybean,rapeseed,groundnut,sunflower,puls_pro, + potato,cassav_sp,sugr_cane,sugr_beet, + oils,sugar,molasses,alcohol,brans,scp / + + kfo_pp(kfo) Plant-based food products + / tece,maiz,trce,rice_pro,soybean,rapeseed,groundnut,sunflower,puls_pro, + potato,cassav_sp,sugr_cane,sugr_beet, + oils,sugar,molasses,alcohol,brans,scp, + others / + + kfo_ap(kfo) Animal food products + / livst_rum,livst_pig,livst_chick, livst_egg, livst_milk, fish / + + kfo_lp(kfo) Livestock food products + / livst_rum,livst_pig,livst_chick, livst_egg, livst_milk / + + kfo_rd(kfo) Ruminant meat and dairy food products + / livst_rum,livst_milk / + + kfo_st(kfo) Staple products + / tece,maiz,trce,rice_pro,soybean,rapeseed,groundnut,sunflower,puls_pro, + potato,cassav_sp,sugr_cane,sugr_beet,molasses,brans,scp / + + kfo_pf(kfo) Processed foods including oils sugar alcohol + / oils,alcohol,sugar / + + knf(kall) Non-food products in the sectoral version + / oilpalm,cottn_pro,foddr, pasture, begr, betr, + oilcakes,ethanol,distillers_grain,fibres, + res_cereals, res_fibrous, res_nonfibrous, + wood, woodfuel / + + nutrition Nutrition attributes + /kcal, protein/ + + par15 Parameters for food module + / intercept,saturation,halfsaturation,non_saturation / +* intercept + saturation give the max value if non-saturation is 1 +* halfsaturation is the gdp until which half of saturation is reached + + regr15 Demand regression types + / overconsumption,livestockshare,processedshare,vegfruitshare / + +*** Scenarios + food_scen15 Food scenarios + / SSP1, SSP2, SSP3, SSP4, SSP5, + SSP1_boundary, SSP2_boundary, SSP3_boundary, + SSP4_boundary, SSP5_boundary, + SSP2_lowcal, SSP2_lowls, SSP2_waste, + ssp2_high_yvonne,ssp2_low_yvonne,ssp2_lowest_yvonne, + history / + + pop_scen15 Population scenarios + / SSP1, SSP2, SSP3, SSP4, SSP5 / + + + calibscen15 Calibration scenarios for balance flow + / constant, fadeout2050 / + + livst_fadeoutscen15 Scenarios for changed composition of livestock products + / halving2050, constant / + + fadeoutscen15 Food substitution scenarios including functional forms with targets and transition periods + / constant, + lin_zero_10_50, lin_zero_20_50, lin_zero_20_30, lin_zero_20_70, lin_50pc_20_50, lin_50pc_20_50_extend65, lin_50pc_20_50_extend80, + lin_50pc_10_50_extend90, lin_75pc_10_50_extend90, lin_80pc_20_50, lin_80pc_20_50_extend95, lin_90pc_20_50_extend95, + lin_99-98-90pc_20_50-60-100, sigmoid_20pc_20_50, sigmoid_50pc_20_50, sigmoid_80pc_20_50 / + + t_scen15(t_all) Target years for transition to exogenous scenario diets + / y2010, y2030, y2050 / + + kcal_scen15 Scenario of daily per capita calorie intake + / 2100kcal, 2500kcal / + + EAT_scen15 Scenario of daily per capita calorie intake + / BMK, FLX, PSC, VEG, VGN, FLX_hmilk, FLX_hredmeat / + + EAT_monogastrics15(kfo) monogastic products + / livst_pig, livst_egg, livst_chick / + EAT_ruminants15(kfo) ruminant products + / livst_milk, livst_rum / + EAT_fruitvegnutseed15(kfo) vegetables fruits nuts seeds + /rapeseed,sunflower,others/ + EAT_pulses15(kfo) pulses + /soybean,puls_pro,groundnut/ + EAT_sugar15(kfo) sugar + /sugr_cane,sugr_beet,sugar,molasses/ + + EAT_staples(kfo) All staple food products according to EAT Lancet definition + / tece,maiz,trce,rice_pro,potato,cassav_sp / + EAT_nonstaples(kfo) All non-staple food products according to EAT Lancet definition + / soybean,rapeseed,groundnut,sunflower,puls_pro, + sugr_cane,sugr_beet, + oils,sugar,molasses,alcohol,brans,scp, + livst_rum,livst_pig,livst_chick, livst_egg, livst_milk, fish, + others / + +; + +alias(kst,kst2); +alias(bmi_group15,bmi_group15_2); +alias(kfo,kfo2); +alias(kfo_ap,kfo_ap2); +alias(kfo_st,kfo_st2); +alias(kfo_pf,kfo_pf2); +alias(iso,iso2); +alias(reproductive,reproductive2); +alias(EAT_staples,EAT_staples2); diff --git a/modules/15_food/input/files b/modules/15_food/input/files index c0c09524a0..e8ff6c7bf2 100644 --- a/modules/15_food/input/files +++ b/modules/15_food/input/files @@ -17,7 +17,9 @@ f15_household_balanceflow.cs3 f15_nutrition_attributes.cs3 f15_calib_factor_FAOfsupply.cs4 f15_supply2intake_ratio_bottomup.cs3 +f15_supply2intake_ratio_FAO_iso.cs3 f15_intake_EATLancet.cs3 +f15_intake_EATLancet_iso.cs3 f15_food_substitution_fader.csv f15_ruminant_fadeout_india.csv f15_milk_fadeout_india.csv diff --git a/modules/15_food/module.gms b/modules/15_food/module.gms index b87d812084..19edc65f0a 100644 --- a/modules/15_food/module.gms +++ b/modules/15_food/module.gms @@ -7,10 +7,18 @@ *' @title Food demand *' -*' @description The main function of the food demand module is to forecast -*' the food demand from agricultural products, which is used in the module [16_demand]. -*' @authors Benjamin Leon Bodirsky, Jan Philipp Dietrich +*' @description The food demand module forecasts the food demand vm_dem_food for +*' various agricultural products, which is used in the module [16_demand]. +*' Drivers of food demand are population, income, and demographic structure from +*' module [09_drivers], as well as module-specific scenario assumptions. +*' In the case of elastic demand, the model uses the shadow price of +*' agricultural commodities q15_food_demand.m to change food demand and iterates +*' with MAgPIE until a common solution is found. Outputs include next to food +*' demand also projections of anthropometric parameters such as body height and +*' weight distribution, as well as phyiscal activity levels. +*' @authors Benjamin Leon Bodirsky, Isabelle Weindl, Jan Philipp Dietrich *###################### R SECTION START (MODULETYPES) ########################## +$Ifi "%food%" == "anthro_iso_jun22" $include "./modules/15_food/anthro_iso_jun22/realization.gms" $Ifi "%food%" == "anthropometrics_jan18" $include "./modules/15_food/anthropometrics_jan18/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/18_residues/flexreg_apr16/equations.gms b/modules/18_residues/flexreg_apr16/equations.gms index 8257affe46..557848a686 100644 --- a/modules/18_residues/flexreg_apr16/equations.gms +++ b/modules/18_residues/flexreg_apr16/equations.gms @@ -14,9 +14,9 @@ q18_prod_res_ag_reg(i2,kcr,attributes) .. vm_res_biomass_ag(i2,kcr,attributes) =e= - (sum((cell(i2,j2),w), vm_area(j2,kcr,w)) * sum(ct,f18_multicropping(ct,i2)) * f18_cgf("intercept",kcr) - + vm_prod_reg(i2,kcr)*f18_cgf("slope",kcr)) - * f18_attributes_residue_ag(attributes,kcr); + (sum((cell(i2,j2),w), vm_area(j2,kcr,w)) * sum(ct,fm_multicropping(ct,i2)) * f18_cgf("intercept",kcr) + + vm_prod_reg(i2,kcr) * f18_cgf("slope",kcr)) + * f18_attributes_residue_ag(attributes,kcr); *' The BG crop residue biomass `vm_res_biomass_bg` is calculated as a function of *' total aboveground biomass. @@ -24,7 +24,7 @@ q18_prod_res_bg_reg(i2,kcr,dm_nr) .. vm_res_biomass_bg(i2,kcr,dm_nr) =e= - (vm_prod_reg(i2,kcr) + vm_res_biomass_ag(i2,kcr,"dm"))*f18_cgf("bg_to_ag",kcr) + (vm_prod_reg(i2,kcr) + vm_res_biomass_ag(i2,kcr,"dm")) * f18_cgf("bg_to_ag",kcr) * f18_attributes_residue_bg(dm_nr,kcr); *' In contrast to AG biomass, AG production `vm_res_biomass_ag(i,kcr,attributes)` @@ -112,7 +112,7 @@ q18_cost_prod_res(i2,kres) .. vm_cost_prod_kres(i2,kres) =e= - vm_prod_reg(i2,kres)*f18_fac_req_kres(kres); + vm_prod_reg(i2,kres) * fm_attributes("wm",kres) * f18_fac_req_kres(kres); *' Trade of AG residues is not considered, so that all produced AG residues have *' to be assigned to uses within the respective world region. diff --git a/modules/18_residues/flexreg_apr16/input.gms b/modules/18_residues/flexreg_apr16/input.gms index 1c0adb8df5..df62c4279b 100644 --- a/modules/18_residues/flexreg_apr16/input.gms +++ b/modules/18_residues/flexreg_apr16/input.gms @@ -8,7 +8,7 @@ $setglobal c18_burn_scen phaseout * options: phaseout,constant -table f18_multicropping(t_all,i) Multicropping indicator as ratio of area harvested by physical area (1) +table fm_multicropping(t_all,i) Multicropping indicator as ratio of area harvested by physical area (1) $ondelim $include "./modules/18_residues/input/f18_multicropping.csv" $offdelim; diff --git a/modules/20_processing/off/presolve.gms b/modules/18_residues/off/input.gms similarity index 65% rename from modules/20_processing/off/presolve.gms rename to modules/18_residues/off/input.gms index af4ca610c0..5ae878a278 100644 --- a/modules/20_processing/off/presolve.gms +++ b/modules/18_residues/off/input.gms @@ -5,8 +5,9 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de +table fm_multicropping(t_all,i) Multicropping indicator as ratio of area harvested by physical area (1) +$ondelim +$include "./modules/18_residues/input/f18_multicropping.csv" +$offdelim; -vm_dem_processing.fx(i,kall)=0; -vm_secondary_overproduction.fx(i,ksd,kpr)=0; - -vm_processing_substitution_cost.fx(i)=0; +*** EOF input.gms *** diff --git a/modules/18_residues/off/realization.gms b/modules/18_residues/off/realization.gms index c8dfe3e893..ec7f9fde9d 100644 --- a/modules/18_residues/off/realization.gms +++ b/modules/18_residues/off/realization.gms @@ -17,6 +17,7 @@ *####################### R SECTION START (PHASES) ############################## $Ifi "%phase%" == "sets" $include "./modules/18_residues/off/sets.gms" $Ifi "%phase%" == "declarations" $include "./modules/18_residues/off/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/18_residues/off/input.gms" $Ifi "%phase%" == "preloop" $include "./modules/18_residues/off/preloop.gms" $Ifi "%phase%" == "postsolve" $include "./modules/18_residues/off/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/20_processing/module.gms b/modules/20_processing/module.gms index 01cb03b647..a84ce6231e 100644 --- a/modules/20_processing/module.gms +++ b/modules/20_processing/module.gms @@ -15,6 +15,5 @@ *###################### R SECTION START (MODULETYPES) ########################## -$Ifi "%processing%" == "off" $include "./modules/20_processing/off/realization.gms" $Ifi "%processing%" == "substitution_may21" $include "./modules/20_processing/substitution_may21/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/20_processing/off/declarations.gms b/modules/20_processing/off/declarations.gms deleted file mode 100644 index e8e79c9390..0000000000 --- a/modules/20_processing/off/declarations.gms +++ /dev/null @@ -1,31 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - - -equations - q20_processing_costs(i) processing costs (mio.USD05MER) -; - -positive variables - vm_dem_processing(i,kall) demand for processing use (mio.tDM) - vm_secondary_overproduction(i,kall,kpr) overproduction of secondary couple products (mio.tDM) - vm_cost_processing(i) processing costs (mio. USD05MER per yr) -; - -variables - vm_processing_substitution_cost(i) Costs or benefits of substituting one product by another (mio. USD05MER per yr) -; - -*#################### R SECTION START (OUTPUT DECLARATIONS) #################### -parameters - ov_dem_processing(t,i,kall,type) demand for processing use (mio.tDM) - ov_secondary_overproduction(t,i,kall,kpr,type) overproduction of secondary couple products (mio.tDM) - ov_cost_processing(t,i,type) processing costs (mio. USD05MER per yr) - ov_processing_substitution_cost(t,i,type) Costs or benefits of substituting one product by another (mio. USD05MER per yr) - oq20_processing_costs(t,i,type) processing costs (mio.USD05MER) -; -*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/20_processing/off/equations.gms b/modules/20_processing/off/equations.gms deleted file mode 100644 index 2693320e8b..0000000000 --- a/modules/20_processing/off/equations.gms +++ /dev/null @@ -1,14 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @equations -*' The equation of this realization is straight forward. -*' Costs of processing are calculated by the product of the quantity of secondary products and the unit processing costs -*' and unit processing costs (which arbitrarily is set to be 5000 USD for all processing types and secondary products). - -q20_processing_costs(i2) .. - vm_cost_processing(i2) =e= sum(ksd, vm_prod_reg(i2,ksd) * 5000); diff --git a/modules/20_processing/off/not_used.txt b/modules/20_processing/off/not_used.txt deleted file mode 100644 index fd7a3ee6c4..0000000000 --- a/modules/20_processing/off/not_used.txt +++ /dev/null @@ -1,10 +0,0 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -# | authors, and contributors see CITATION.cff file. This file is part -# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -# | AGPL-3.0, you are granted additional permissions described in the -# | MAgPIE License Exception, version 1.0 (see LICENSE file). -# | Contact: magpie@pik-potsdam.de - -name,type,reason -vm_dem_food,input,questionnaire -fm_attributes,input,questionnaire diff --git a/modules/20_processing/off/postsolve.gms b/modules/20_processing/off/postsolve.gms deleted file mode 100644 index 8dea76c9b6..0000000000 --- a/modules/20_processing/off/postsolve.gms +++ /dev/null @@ -1,31 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - - - -*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_dem_processing(t,i,kall,"marginal") = vm_dem_processing.m(i,kall); - ov_secondary_overproduction(t,i,kall,kpr,"marginal") = vm_secondary_overproduction.m(i,kall,kpr); - ov_cost_processing(t,i,"marginal") = vm_cost_processing.m(i); - ov_processing_substitution_cost(t,i,"marginal") = vm_processing_substitution_cost.m(i); - oq20_processing_costs(t,i,"marginal") = q20_processing_costs.m(i); - ov_dem_processing(t,i,kall,"level") = vm_dem_processing.l(i,kall); - ov_secondary_overproduction(t,i,kall,kpr,"level") = vm_secondary_overproduction.l(i,kall,kpr); - ov_cost_processing(t,i,"level") = vm_cost_processing.l(i); - ov_processing_substitution_cost(t,i,"level") = vm_processing_substitution_cost.l(i); - oq20_processing_costs(t,i,"level") = q20_processing_costs.l(i); - ov_dem_processing(t,i,kall,"upper") = vm_dem_processing.up(i,kall); - ov_secondary_overproduction(t,i,kall,kpr,"upper") = vm_secondary_overproduction.up(i,kall,kpr); - ov_cost_processing(t,i,"upper") = vm_cost_processing.up(i); - ov_processing_substitution_cost(t,i,"upper") = vm_processing_substitution_cost.up(i); - oq20_processing_costs(t,i,"upper") = q20_processing_costs.up(i); - ov_dem_processing(t,i,kall,"lower") = vm_dem_processing.lo(i,kall); - ov_secondary_overproduction(t,i,kall,kpr,"lower") = vm_secondary_overproduction.lo(i,kall,kpr); - ov_cost_processing(t,i,"lower") = vm_cost_processing.lo(i); - ov_processing_substitution_cost(t,i,"lower") = vm_processing_substitution_cost.lo(i); - oq20_processing_costs(t,i,"lower") = q20_processing_costs.lo(i); -*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/20_processing/off/realization.gms b/modules/20_processing/off/realization.gms deleted file mode 100644 index b556760a45..0000000000 --- a/modules/20_processing/off/realization.gms +++ /dev/null @@ -1,27 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @description This realization uses an arbitrary unit cost of processing -*' which is too high for many of the processing types and secondary products. -*' So doing is meant to discourage overproduction of secondary products. -*' Despite these limitations, however, the implementation is very simple -*' as it uses the same unit costs of processing for all second -*' products (e.g. alcohol, ethanol, molasses, brans) and -*' processing types (e.g. fermentation, ginning, milling, breeding). - -*' @limitations There is no empirical ground to use the same unit costs of processing -*' for all processing types and secondary products, -*' and to impose constraint on over production of secondary products. - -*####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/20_processing/off/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/20_processing/off/declarations.gms" -$Ifi "%phase%" == "equations" $include "./modules/20_processing/off/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/20_processing/off/scaling.gms" -$Ifi "%phase%" == "presolve" $include "./modules/20_processing/off/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/20_processing/off/postsolve.gms" -*######################## R SECTION END (PHASES) ############################### diff --git a/modules/20_processing/off/scaling.gms b/modules/20_processing/off/scaling.gms deleted file mode 100644 index c3d0169a2c..0000000000 --- a/modules/20_processing/off/scaling.gms +++ /dev/null @@ -1,9 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*vm_cost_processing.scale(i) = 10e6; -*vm_secondary_overproduction.scale(i,kall,kpr) = 10e-4; diff --git a/modules/20_processing/off/sets.gms b/modules/20_processing/off/sets.gms deleted file mode 100644 index cd296bbfd5..0000000000 --- a/modules/20_processing/off/sets.gms +++ /dev/null @@ -1,20 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - - -sets - -kpr(kall) Products that can be processed - /tece,maiz,trce,rice_pro,soybean,rapeseed,groundnut,sunflower,oilpalm, - potato,cassav_sp,sugr_cane,sugr_beet,others,cottn_pro,brans,begr,betr,foddr, - sugar,molasses/ - -knpr(kall) Plant-based products that cannot be processed - /alcohol,distillers_grain,ethanol,fibres,fish,livst_chick,livst_egg,livst_milk, - livst_pig,livst_rum,oils,oilcakes,pasture,puls_pro,res_cereals,res_fibrous, - res_nonfibrous,scp,wood,woodfuel/ -; diff --git a/modules/21_trade/input/files b/modules/21_trade/input/files index be5b3e7f00..a47bdcc1a7 100644 --- a/modules/21_trade/input/files +++ b/modules/21_trade/input/files @@ -5,6 +5,6 @@ f21_trade_balanceflow.cs3 f21_trade_margin.cs3 f21_trade_tariff.cs3 f21_trade_tariff_export.cs3 -f21_trade_tariff_import.cs3 +f21_trade_tariff_import.cs3 f21_trade_bal_reduction.cs3 f21_trade_balance.cs3 diff --git a/modules/30_crop/penalty_apr22/input.gms b/modules/30_crop/penalty_apr22/input.gms index 39eebb63a5..4eba3af132 100644 --- a/modules/30_crop/penalty_apr22/input.gms +++ b/modules/30_crop/penalty_apr22/input.gms @@ -20,7 +20,7 @@ $setglobal c30_snv_target none $setglobal c30_rotation_constraints on *options: on, off -$setglobal c30_rotation_scenario current +$setglobal c30_rotation_scenario default *options: none, default, fallow, legumes, agroforestry, agroecology $setglobal c30_rotation_scenario_speed by2050 diff --git a/modules/30_crop/rotation_apr22/input.gms b/modules/30_crop/rotation_apr22/input.gms index 65e29d4972..1e424f05e0 100644 --- a/modules/30_crop/rotation_apr22/input.gms +++ b/modules/30_crop/rotation_apr22/input.gms @@ -20,7 +20,7 @@ $setglobal c30_snv_target none $setglobal c30_rotation_constraints on *options: on, off -$setglobal c30_rotation_scenario current +$setglobal c30_rotation_scenario default *options: min,default,good,good_20div,setaside,legumes,agroforestry,sixfoldrotation,agroecology $setglobal c30_rotation_scenario_speed by2050 diff --git a/modules/32_forestry/dynamic_feb21/declarations.gms b/modules/32_forestry/dynamic_feb21/declarations.gms index d8b435365b..e4b9bd4fac 100644 --- a/modules/32_forestry/dynamic_feb21/declarations.gms +++ b/modules/32_forestry/dynamic_feb21/declarations.gms @@ -58,6 +58,7 @@ parameters p32_avg_increment(t_all,j,ac) Mean annual increment (tC per ha per year) p32_bii_coeff(type32,bii_class_secd,potnatveg) bii coeff (1) p32_c_density_ac_fast_forestry(t_all,j,ac) Carbon densities in plantations based on Braakhekke et al (tC per ha) + p32_disturbance_loss_ftype32(t,j,type32,ac) Loss due to disturbances in all plantation type forests (mio. ha) ; positive variables diff --git a/modules/32_forestry/dynamic_feb21/input.gms b/modules/32_forestry/dynamic_feb21/input.gms index 8ab31380ad..eae0ec0281 100644 --- a/modules/32_forestry/dynamic_feb21/input.gms +++ b/modules/32_forestry/dynamic_feb21/input.gms @@ -24,6 +24,9 @@ $setglobal c32_rot_calc_type current_annual_increment * option max_increment, max_npv $setglobal c32_rot_calc_type current_annual_increment * options mean_annual_increment, current_annual_increment, instantaneous_growth_rate +$setglobal c32_shock_scenario none +* options none 002lin2030 004lin2030 008lin2030 016lin2030 + scalars s32_hvarea Flag for harvested area and establishemt (0=zero 1=exognous 2=endogneous) / 0 / @@ -122,3 +125,9 @@ $ondelim $include "./modules/32_forestry/input/f32_estb_calib.cs4" $offdelim /; + +table f32_forest_shock(t_all, shock_scen32) Forest carbon shock scenarios (area share affected per year) +$ondelim +$include "./modules/32_forestry/input/f32_forest_shock.csv" +$offdelim +; diff --git a/modules/32_forestry/dynamic_feb21/preloop.gms b/modules/32_forestry/dynamic_feb21/preloop.gms index 76e98f7f3c..ca85f37693 100644 --- a/modules/32_forestry/dynamic_feb21/preloop.gms +++ b/modules/32_forestry/dynamic_feb21/preloop.gms @@ -298,3 +298,9 @@ elseif s32_aff_bii_coeff = 1, ); p32_bii_coeff("ndc",bii_class_secd,potnatveg) = fm_bii_coeff(bii_class_secd,potnatveg); p32_bii_coeff("plant",bii_class_secd,potnatveg) = fm_bii_coeff("timber",potnatveg); + +* initialize parameter +p32_land(t,j,type32,ac) = 0; + +* initialize forest disturbance losses +p32_disturbance_loss_ftype32(t,j,"aff",ac) = 0; diff --git a/modules/32_forestry/dynamic_feb21/presolve.gms b/modules/32_forestry/dynamic_feb21/presolve.gms index 1ecd98b404..98b4c1fa14 100644 --- a/modules/32_forestry/dynamic_feb21/presolve.gms +++ b/modules/32_forestry/dynamic_feb21/presolve.gms @@ -49,6 +49,18 @@ p32_carbon_density_ac(t,j,"ndc",ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_po p32_cdr_ac(t,j,ac)$(ord(ac) > 1 AND (ord(ac)-1) <= s32_planing_horizon/5) = p32_carbon_density_ac(t,j,"aff",ac,"vegc") - p32_carbon_density_ac(t,j,"aff",ac-1,"vegc"); +* Disturbance from generic sources to managed and natural forests +if((ord(t) = 1), + pc32_land(j,type32,ac) = p32_land_start_ac(j,type32,ac); +else + pc32_land(j,type32,ac) = p32_land(t-1,j,type32,ac); +); + +p32_disturbance_loss_ftype32(t,j,"aff",ac_sub) = pc32_land(j,"aff",ac_sub) * f32_forest_shock(t,"%c32_shock_scenario%") * m_timestep_length; +pc32_land(j,"aff",ac_est) = pc32_land(j,"aff",ac_est) + sum(ac_sub,p32_disturbance_loss_ftype32(t,j,"aff",ac_sub))/card(ac_est); + +pc32_land(j,"aff",ac_sub) = pc32_land(j,"aff",ac_sub) - p32_disturbance_loss_ftype32(t,j,"aff",ac_sub); + *' Regrowth of natural vegetation (natural succession) is modelled by shifting *' age-classes according to time step length. For first year of simulation, the *' shift is just 1. Division by 5 happends because the age-classes exist in 5 year steps @@ -62,14 +74,18 @@ p32_land(t,j,type32,ac)$(ord(ac) > s32_shift) = p32_land_start_ac(j,type32,ac-s3 p32_land(t,j,type32,"acx") = p32_land(t,j,type32,"acx") + sum(ac$(ord(ac) > card(ac)-s32_shift), p32_land_start_ac(j,type32,ac)); else * Example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s32_shift = 1) -p32_land(t,j,type32,ac)$(ord(ac) > s32_shift) = p32_land(t-1,j,type32,ac-s32_shift); +p32_land(t,j,type32,ac)$(ord(ac) > s32_shift) = pc32_land(j,type32,ac-s32_shift); * Account for cases at the end of the age class set (s32_shift > 1) which are not shifted by the above calculation -p32_land(t,j,type32,"acx") = p32_land(t,j,type32,"acx") + sum(ac$(ord(ac) > card(ac)-s32_shift), p32_land(t-1,j,type32,ac)); +p32_land(t,j,type32,"acx") = p32_land(t,j,type32,"acx") + sum(ac$(ord(ac) > card(ac)-s32_shift), pc32_land(j,type32,ac)); ); * set ac_est to zero p32_land(t,j,type32,ac_est) = 0; *' @stop + + + + ** Calculate v32_land.l v32_land.l(j,type32,ac) = p32_land(t,j,type32,ac); pc32_land(j,type32,ac) = v32_land.l(j,type32,ac); diff --git a/modules/32_forestry/dynamic_feb21/sets.gms b/modules/32_forestry/dynamic_feb21/sets.gms index 8d9fd97a70..61e883921a 100644 --- a/modules/32_forestry/dynamic_feb21/sets.gms +++ b/modules/32_forestry/dynamic_feb21/sets.gms @@ -41,6 +41,10 @@ inter32 Interpolation of scenario from FAO study on proportion of roundwood prod scen32 Scenario for development of roundwood production share from plantations / constant,h5s5l5,h5s2l2,h5s2l1,h5s1l1,h5s1l05,h2s1l05 / + shock_scen32 Scenario name of forest carbon shock + / none, 002lin2030,004lin2030,008lin2030,016lin2030 + / + ; *** EOF sets.gms *** diff --git a/modules/32_forestry/input/files b/modules/32_forestry/input/files index 14a4597507..97cfd1ed3d 100644 --- a/modules/32_forestry/input/files +++ b/modules/32_forestry/input/files @@ -11,3 +11,4 @@ f32_gs_relativetarget.cs4 f32_plantation_contribution.cs3 f32_plantedforest.cs4 f32_estb_calib.cs4 +f32_forest_shock.csv diff --git a/modules/34_urban/exo_nov21/presolve.gms b/modules/34_urban/exo_nov21/presolve.gms index 72cfa9c062..83b18a4dcb 100644 --- a/modules/34_urban/exo_nov21/presolve.gms +++ b/modules/34_urban/exo_nov21/presolve.gms @@ -5,7 +5,7 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -vm_carbon_stock.fx(j,"urban",c_pools,stockType) = 0; +vm_carbon_stock.fx(j,"urban",ag_pools,stockType) = 0; if(ord(t) = 1, vm_land.fx(j,"urban") = i34_urban_area(t,j); diff --git a/modules/34_urban/static/presolve.gms b/modules/34_urban/static/presolve.gms index 4c274004ea..d65067fbed 100644 --- a/modules/34_urban/static/presolve.gms +++ b/modules/34_urban/static/presolve.gms @@ -7,7 +7,7 @@ vm_land.fx(j,"urban") = pcm_land(j,"urban"); -vm_carbon_stock.fx(j,"urban",c_pools) = 0; +vm_carbon_stock.fx(j,"urban",ag_pools) = 0; *' Biodiveristy value (BV) vm_bv.fx(j,"urban", potnatveg) = pcm_land(j,"urban") * fm_bii_coeff("urban",potnatveg) * fm_luh2_side_layers(j,potnatveg); diff --git a/modules/35_natveg/dynamic_feb21/input.gms b/modules/35_natveg/dynamic_feb21/input.gms index c02789a4fe..49f6b5311c 100644 --- a/modules/35_natveg/dynamic_feb21/input.gms +++ b/modules/35_natveg/dynamic_feb21/input.gms @@ -7,6 +7,7 @@ $setglobal c35_ad_policy npi $setglobal c35_aolc_policy npi +$setglobal c35_shock_scenario none scalars s35_hvarea Flag for harvested area (0=zero 1=exognous 2=endogneous) / 0 / @@ -18,7 +19,7 @@ s35_timber_harvest_cost_other Cost for harvesting from other land (USD pe s35_timber_harvest_cost_primforest Cost for harvesting from primary forest (USD per ha) / 3000/ s35_natveg_harvest_shr Constrains the allowed wood harvest from natural vegetation (1=unconstrained) (1) /1/ s35_secdf_distribution Flag for secdf initialization (0=all secondary forest in highest age class 1=Equal distribution among all age classes 2=Poulter distribution from MODIS satellite data) (1) / 0 / -s35_forest_damage Damage simulation in forests (0=none 1=shifting agriculture 2= Damage from shifting agriculture is faded out by c35_forest_damage_end) / 2 / +s35_forest_damage Damage simulation in forests (0=none 1=shifting agriculture 2= Damage from shifting agriculture is faded out by c35_forest_damage_end 4= f35_forest_shock scenario) / 2 / s35_forest_damage_end Year of forest damage end (1) / 2050 / ; @@ -34,6 +35,12 @@ $include "./modules/35_natveg/input/npi_ndc_ad_aolc_pol.cs3" $offdelim ; +table f35_forest_shock(t_all, shock_scen) Forest carbon shock scenarios (area share affected per year) +$ondelim +$include "./modules/35_natveg/input/f35_forest_shock.csv" +$offdelim +; + parameter f35_forest_disturbance_share(i) Share of area damanged by forest disturbances (1) / $ondelim diff --git a/modules/35_natveg/dynamic_feb21/presolve.gms b/modules/35_natveg/dynamic_feb21/presolve.gms index 55e1490bda..bb7a405c05 100644 --- a/modules/35_natveg/dynamic_feb21/presolve.gms +++ b/modules/35_natveg/dynamic_feb21/presolve.gms @@ -34,6 +34,12 @@ if(s35_forest_damage=3, p35_disturbance_loss_primf(t,j) = pcm_land(j,"primforest") * sum((cell(i,j),combined_loss),f35_forest_lost_share(i,combined_loss))*m_timestep_length_forestry; ); +* generic disturbance scenarios +if(s35_forest_damage=4, + p35_disturbance_loss_secdf(t,j,ac_sub) = pc35_secdforest(j,ac_sub) * f35_forest_shock(t,"%c35_shock_scenario%") * m_timestep_length; + p35_disturbance_loss_primf(t,j) = pcm_land(j,"primforest") * f35_forest_shock(t,"%c35_shock_scenario%") * m_timestep_length; + ); + * Distribution of damages correctly pc35_secdforest(j,ac_est) = pc35_secdforest(j,ac_est) + sum(ac_sub,p35_disturbance_loss_secdf(t,j,ac_sub))/card(ac_est) + p35_disturbance_loss_primf(t,j)/card(ac_est); diff --git a/modules/35_natveg/dynamic_feb21/sets.gms b/modules/35_natveg/dynamic_feb21/sets.gms index 0ecb1e5410..d8276dcc04 100644 --- a/modules/35_natveg/dynamic_feb21/sets.gms +++ b/modules/35_natveg/dynamic_feb21/sets.gms @@ -21,4 +21,8 @@ sets / forest, other / + shock_scen Scenario name of forest carbon shock + / none, 002lin2030,004lin2030,008lin2030,016lin2030 + / + ; diff --git a/modules/35_natveg/input/files b/modules/35_natveg/input/files index 0b976e27e7..f1603f4a64 100644 --- a/modules/35_natveg/input/files +++ b/modules/35_natveg/input/files @@ -3,4 +3,4 @@ npi_ndc_ad_aolc_pol.cs3 f35_forest_disturbance_share.cs4 f35_forest_lost_share.cs3 f35_gs_relativetarget.cs4 - +f35_forest_shock.csv diff --git a/modules/36_employment/exo_may22/declarations.gms b/modules/36_employment/exo_may22/declarations.gms index c3e55e18a7..74dbc9c194 100644 --- a/modules/36_employment/exo_may22/declarations.gms +++ b/modules/36_employment/exo_may22/declarations.gms @@ -15,13 +15,15 @@ positive variables ; parameters - p36_hourly_costs_iso(t,iso) Hourly labor costs in agriculture on iso level (USDMER05 per hour) - p36_hourly_costs(t,i) Hourly labor costs in agriculture on regional level (USDMER05 per hour) - p36_total_hours_worked(iso) Total hours worked by all employed people (mio. hours per year) - p36_calibration_hourly_costs(iso) Additive calibration term for hourly labor costs (USDMER05 per hour) - p36_cost_share(t,i) Capital share of factor costs (1) - p36_share_calibration(i) Additive calibration term for capital shares (1) - p36_nonmagpie_labor_costs(t,i) Labor costs from subsidies and VoP not covered by MAgPIE (mio. USDMER05) + p36_hourly_costs_iso(t_all,iso, wage_scen) Hourly labor costs in agriculture on iso level before and after including wage scenario (USDMER05 per hour) + p36_hourly_costs_increase(iso) Difference between minimum hourly labor costs and actual hourly labor costs in 2050 (USDMER05 per hour) + pm_hourly_costs(t,i, wage_scen) Hourly labor costs in agriculture on regional level before and after including wage scenario (USDMER05 per hour) + pm_productivity_gain_from_wages(t,i) Multiplicative factor describing productivity gain related to higher wages (1) + p36_total_hours_worked(iso) Total hours worked by all employed people (mio. hours per year) + p36_calibration_hourly_costs(iso) Additive calibration term for hourly labor costs (USDMER05 per hour) + p36_cost_share(t,i) Capital share of factor costs (1) + p36_share_calibration(i) Additive calibration term for capital shares (1) + p36_nonmagpie_labor_costs(t,i) Labor costs from subsidies and Value of Production not covered by MAgPIE (mio. USDMER05) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### diff --git a/modules/36_employment/exo_may22/equations.gms b/modules/36_employment/exo_may22/equations.gms index 56085549c1..0c36cdc01f 100644 --- a/modules/36_employment/exo_may22/equations.gms +++ b/modules/36_employment/exo_may22/equations.gms @@ -8,16 +8,16 @@ *' @equations +*' Employment is calculated as total labor costs divided by hourly labor costs and +*' average hours worked per employed person per year. Total labor costs include +*' labor costs from crop production (see [38_factor_costs]) and livestock production +*' (see [70_livestock]), and some labor costs for crop and livestock production +*' which are not covered by MAgPIE. + * excluding labor costs for crop residues (as this is not include in the * data on agricultural employment by the International Labour Organization) * and fish (as we cannot calibrate labor costs for fish to employment data) - q36_employment(i2) .. v36_employment(i2) =e= (vm_cost_prod_crop(i2,"labor") + vm_cost_prod_livst(i2,"labor") + sum(ct,p36_nonmagpie_labor_costs(ct,i2))) * - (1 / sum(ct,f36_weekly_hours(ct,i2)*s36_weeks_in_year*p36_hourly_costs(ct,i2))); + (1 / sum(ct,f36_weekly_hours(ct,i2)*s36_weeks_in_year*pm_hourly_costs(ct,i2,"scenario"))); -*' Employment is calculated as total labor costs devided by hourly labor costs and -*' average hours worked per employed person per year. Total labor costs include -*' labor costs from crop production (see [38_factor_costs]) and livestock production -*' (see [70_livestock]), and some labor costs for crop and livestock production -*' which are not covered by MAgPIE. \ No newline at end of file diff --git a/modules/36_employment/exo_may22/input.gms b/modules/36_employment/exo_may22/input.gms index ba46b0e4a0..58d998db51 100644 --- a/modules/36_employment/exo_may22/input.gms +++ b/modules/36_employment/exo_may22/input.gms @@ -6,7 +6,9 @@ *** | Contact: magpie@pik-potsdam.de scalars -s36_weeks_in_year number of weeks in a year / 52.1429 / +s36_weeks_in_year number of weeks in a year (weeks per yr) / 52.1429 / +s36_minimum_wage global minimum wage (USDMER05 per hour) / 0 / +s36_scale_productivity_with_wage how strong the wage increase should affect labor productivity (1) / 0 / ; table f36_weekly_hours(t_all,i) Historical values of average weekly hours worked per person in agriculture (h per week) @@ -66,3 +68,5 @@ $ondelim $include "./modules/36_employment/exo_may22/input/f36_historical_share.csv" $offdelim ; + + diff --git a/modules/36_employment/exo_may22/preloop.gms b/modules/36_employment/exo_may22/preloop.gms index 0c512054c2..72ee4ec7e2 100644 --- a/modules/36_employment/exo_may22/preloop.gms +++ b/modules/36_employment/exo_may22/preloop.gms @@ -7,5 +7,61 @@ * get calibration factors and aggregation weight p36_calibration_hourly_costs(iso) = sum(t_past$(ord(t_past) eq card(t_past)), f36_hist_hourly_costs(t_past,iso)-(im_gdp_pc_mer_iso(t_past,iso) - *f36_regr_hourly_costs("slope")+f36_regr_hourly_costs("intercept"))); -p36_total_hours_worked(iso) = sum(t_past$(ord(t_past) eq card(t_past)), f36_historic_ag_empl(t_past,iso)*f36_weekly_hours_iso(t_past,iso)*s36_weeks_in_year); \ No newline at end of file + *f36_regr_hourly_costs("slope")+f36_regr_hourly_costs("intercept"))); +p36_total_hours_worked(iso) = sum(t_past$(ord(t_past) eq card(t_past)), f36_historic_ag_empl(t_past,iso)*f36_weekly_hours_iso(t_past,iso)*s36_weeks_in_year); + +*' @code + +*' Hourly labor costs are projected into the future by using a linear regression with +*' GDPpcMER, which is calibrated such that historic values of agricultural employment +*' are met. A threshold is used in the regression to avoid too low or negative hourly +*' labor costs. +p36_hourly_costs_iso(t_all,iso,"baseline") = max((im_gdp_pc_mer_iso(t_all,iso) * f36_regr_hourly_costs("slope") + + f36_regr_hourly_costs("intercept") + p36_calibration_hourly_costs(iso)), + f36_regr_hourly_costs("threshold")); + +*' @stop + +p36_hourly_costs_iso(t_all,iso,"baseline")$(sum(sameas(t_past,t_all),1) = 1) = f36_hist_hourly_costs(t_all,iso); + + +* necessary increase in hourly labor costs in target year (2050) to match minimum wage +p36_hourly_costs_increase(iso) = s36_minimum_wage - p36_hourly_costs_iso("y2050",iso,"baseline"); + +p36_hourly_costs_iso(t_all,iso,"scenario") = p36_hourly_costs_iso(t_all,iso,"baseline"); + +*' @code +*' In case of a scenario with an external global minimum wage we add a linear term to the baseline +*' hourly labor costs, starting from 0 zero in 2020 and increasing such that resulting hourly labor costs will match +*' the minimum wage in 2050. After 2050 the additional term is decreased again, reaching 0 in 2100 (where baseline +*' hourly labor costs and new hourly labor costs will match again). +*' In case this means that hourly labor costs would decrease again below the minimum wage after 2050, we keep them +*' at minimum wage. +*' If baseline hourly labor costs are already high enough to meet the minimum wage in 2050, they are not changed. +*' @stop + +p36_hourly_costs_iso(t_all,iso,"scenario")$((m_year(t_all) gt 2020) and (m_year(t_all) le 2050)) = p36_hourly_costs_iso(t_all,iso,"baseline") + max(0, ((m_year(t_all)-2020)/(2050-2020))*p36_hourly_costs_increase(iso)); + +p36_hourly_costs_iso(t_all,iso,"scenario")$((m_year(t_all) gt 2050) and (m_year(t_all) le 2100)) = max(s36_minimum_wage, p36_hourly_costs_iso(t_all,iso,"baseline") + max(0, p36_hourly_costs_increase(iso)-((m_year(t_all)-2050)/(2100-2050))*p36_hourly_costs_increase(iso))); + +p36_hourly_costs_iso(t_all,iso,"scenario")$(m_year(t_all) gt 2100) = max(s36_minimum_wage, p36_hourly_costs_iso(t_all,iso,"baseline")); + +* Hourly labor costs are then aggregated to regional level using the total hours worked in the last +* year of `t_past` as weight. +pm_hourly_costs(t,i,wage_scen) = sum(i_to_iso(i,iso), p36_hourly_costs_iso(t,iso,wage_scen)*p36_total_hours_worked(iso)) * (1/sum(i_to_iso(i,iso),p36_total_hours_worked(iso))); + +*' @code +*' A scenario that increases wages can either be fully related to productivity increase (leading to lower employment +*' for the same total labor costs), or keep productivity constant (leading to the same employment for higher total labor +*' costs), or show a mixture between productivity increase and total labor cost increase. +*' The scalar `s36_scale_productivity_with_wage` describes how high the labor productivity gain should be relative to +*' the increase in hourly labor costs and is used to calculate `pm_productivity_gain_from_wages`, which is applied to +*' labor costs for crop production ([38_factor_costs]), livestock production ([70_livestock]), and the non-MAgPIE +*' labor costs. If `s36_scale_productivity_with_wage = 1` the productivity gain and wage increase cancel out, +*' leading to the same total labor costs as without wage scenario. For `s36_scale_productivity_with_wage = 0` the total +*' labor costs scale proportional to the hourly labor costs. For other values, the total labor costs show a non-linear +*' realtionship with `s36_scale_productivity_with_wage`. + +pm_productivity_gain_from_wages(t,i) = s36_scale_productivity_with_wage * (pm_hourly_costs(t,i,"scenario") / pm_hourly_costs(t,i,"baseline")) + (1 - s36_scale_productivity_with_wage); + +*' @stop diff --git a/modules/36_employment/exo_may22/presolve.gms b/modules/36_employment/exo_may22/presolve.gms index de8d8f6650..5853a955fa 100644 --- a/modules/36_employment/exo_may22/presolve.gms +++ b/modules/36_employment/exo_may22/presolve.gms @@ -20,24 +20,6 @@ elseif (m_year(t)>=2010), *' categories not covered by MAgPIE (i.e. wool, beeswax, honey, silk-worms), which *' are both kept constant for future years. -p36_nonmagpie_labor_costs(t,i) = (f36_unspecified_subsidies(t,i) + f36_nonmagpie_factor_costs(t,i)) * (1-p36_cost_share(t,i)); - - -*' Hourly labor costs are projected into the future by using a linear regression with -*' GDPpcMER, which is calibrated such that historic values of agricultural employment -*' are met. +p36_nonmagpie_labor_costs(t,i) = (f36_unspecified_subsidies(t,i) + f36_nonmagpie_factor_costs(t,i)) * (1-p36_cost_share(t,i)) * (1/pm_productivity_gain_from_wages(t,i)) * (pm_hourly_costs(t,i,"scenario") / pm_hourly_costs(t,i,"baseline")); *' @stop - -* historic hourly labor costs for t_past, calibrated regression values based on GDPpcMER for future years -* A threshold of 0.1$/h is used in the regression to avoid too low or negative hourly labor costs. -if (sum(sameas(t_past,t),1) = 1, - p36_hourly_costs_iso(t,iso) = f36_hist_hourly_costs(t,iso) -else - p36_hourly_costs_iso(t,iso) = max((im_gdp_pc_mer_iso(t,iso)*f36_regr_hourly_costs("slope")+ - f36_regr_hourly_costs("intercept")+p36_calibration_hourly_costs(iso)), - f36_regr_hourly_costs("threshold")); -); - - -p36_hourly_costs(t,i) = sum(i_to_iso(i,iso),p36_hourly_costs_iso(t,iso)*p36_total_hours_worked(iso))*(1/sum(i_to_iso(i,iso),p36_total_hours_worked(iso))); diff --git a/modules/36_employment/exo_may22/realization.gms b/modules/36_employment/exo_may22/realization.gms index a7adf2ff91..fc1029a742 100644 --- a/modules/36_employment/exo_may22/realization.gms +++ b/modules/36_employment/exo_may22/realization.gms @@ -8,16 +8,20 @@ *' @description This realization calculates agricultural employment based *' on it's relation to total labor costs. It therefore depends *' on the labor costs calculated in the modules [38_factor_costs] and -*' [70_livestock], but does not affect resulting total costs or production -*' patterns. +*' [70_livestock]. Resulting total costs and production patterns can be affected +*' if an external wage scenario is used, which increases labor costs for +*' crop and livestock production in [38_factor_costs] and [70_livestock]. *' @limitations Labor availability is not seen as a limiting factor for *' agricultural production, as the number of people employed is directly linked *' to labor costs which scale with the amount of production. Furthermore, *' hourly labor costs are projected into the future based on a regression with *' GDP pc, while factor requirements for crops (i.e. labor + capital costs per -*' production unit) are kept constant. This means, that any increase in wages -*' is assumed to be matched by a corresponding increase in labor productivity. +*' production unit) are kept constant. This means, that the increase in the +*' baseline wages over time is assumed to be matched by a corresponding increase +*' in labor productivity. For external wage scenarios that lead to higher wages +*' the additional wage increase can be either related to productivity increase +*' or higher total labor costs. *####################### R SECTION START (PHASES) ############################## diff --git a/modules/36_employment/exo_may22/sets.gms b/modules/36_employment/exo_may22/sets.gms index 793ec52e39..71a1244476 100644 --- a/modules/36_employment/exo_may22/sets.gms +++ b/modules/36_employment/exo_may22/sets.gms @@ -8,4 +8,6 @@ sets reg36 regression coefficients / slope, intercept, threshold / + wage_scen version of wages + / baseline, scenario / ; diff --git a/modules/36_employment/module.gms b/modules/36_employment/module.gms index 85c38ebe31..b5b1208a36 100644 --- a/modules/36_employment/module.gms +++ b/modules/36_employment/module.gms @@ -10,9 +10,12 @@ *' @description This module is used to calculate hourly labor costs in agriculutre *' and the number of people employed in crop and livestock production. -*' The calculation is based on labor costs in crop and livestock production -*' coming from [38_factor_costs] and [70_livestock], as well as GDP pc from -*' [09_drivers]. +*' Hourly labor costs are calculated based on a regression with GDP pc from [09_drivers]. +*' They can be increased by an externally set global minimum wage. Wages as well as +*' productivity gain from higher wages are provided to [38_factor_costs] and [70_livestock], +*' to scale total labor costs accordingly. +*' The calculation of employment then uses labor costs for crop and livestock production +*' coming from [38_factor_costs] and [70_livestock]. *' @authors Debbora Leip diff --git a/modules/38_factor_costs/mixed_reg_feb17/declarations.gms b/modules/38_factor_costs/mixed_reg_feb17/declarations.gms deleted file mode 100644 index 73aa1eced0..0000000000 --- a/modules/38_factor_costs/mixed_reg_feb17/declarations.gms +++ /dev/null @@ -1,29 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -equations -q38_cost_prod_crop(i,req) Regional factor costs of capital and labor for plant production (mio. USD05MER per yr) -; - - -positive variables -vm_cost_prod_crop(i,req) Regional factor costs of capital and labor for plant production (mio. USD05MER per yr) -; - -parameters -p38_fac_req(i,kcr,w) Regional factor requirement costs differentiated by irrigation type (USD05MER per tDM) -p38_cost_share(t,i,req) Capital and labor shares of the regional factor costs for plant production (1) -p38_share_calibration(i) Summation factor used to calibrate calculated capital shares with historical values (1) - -; - -*#################### R SECTION START (OUTPUT DECLARATIONS) #################### -parameters - ov_cost_prod_crop(t,i,req,type) Regional factor costs of capital and labor for plant production (mio. USD05MER per yr) - oq38_cost_prod_crop(t,i,req,type) Regional factor costs of capital and labor for plant production (mio. USD05MER per yr) -; -*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/38_factor_costs/mixed_reg_feb17/equations.gms b/modules/38_factor_costs/mixed_reg_feb17/equations.gms deleted file mode 100644 index a0785fdb23..0000000000 --- a/modules/38_factor_costs/mixed_reg_feb17/equations.gms +++ /dev/null @@ -1,35 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - - -*' @equations - - -q38_cost_prod_crop(i2,req) .. - vm_cost_prod_crop(i2,req) =e= (sum((cell(i2,j2), supreg(h2,i2), w, kcr), vm_area(j2,kcr,w)*f38_region_yield(i2,kcr) - * vm_tau(h2,"crop")/fm_tau1995(h2)*p38_fac_req(i2,kcr,w))) * sum(ct,p38_cost_share(ct,i2,req)); - - -*' The equation above shows that factor requirement costs `vm_cost_prod_costs` mainly -*' depend on area harvested `vm_area` and average regional land-use intensity -*' levels `vm_tau`. Multiplying the land-use intensity increase increases -*' since 1995 with average regional yields `f38_region_yield` gives the -*' average regional yield. Multiplied with the area under production it gives -*' the production of this location assuming an average yield. Multiplied with -*' estimated factor requirement costs per volume `p38_fac_req` returns the -*' total factor costs, which multiplied by p38_cost_share gives us a results costs differentiated -*' by factor (capital or labor)'. -*' -*' The crop-and-water specific factor costs per volume of crop production -*' `f38_fac_req` are obtained from @narayanan_gtap7_2008. Splitting factors -*' costs into costs under irrigation and under rainfed production was performed -*' based on the methodology described in @Calzadilla2011GTAP. -*' -*' In this realization, regardless of the cellular productivity, the factor -*' costs per area are identical for all cells within a region. This implicitly -*' gives an incentive to allocate and concentrate production to highly -*' productive cells. diff --git a/modules/38_factor_costs/mixed_reg_feb17/input.gms b/modules/38_factor_costs/mixed_reg_feb17/input.gms deleted file mode 100644 index 7f6d5fd0a5..0000000000 --- a/modules/38_factor_costs/mixed_reg_feb17/input.gms +++ /dev/null @@ -1,37 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -scalar -s38_factor_irrigation Factor to increase irrigation costs / 1 / -s38_shock_year Year from which policy shock will be implemented / 1995 / -; - - -table f38_fac_req(i,kcr,w) Factor requirement costs (USD05MER per tDM) -$ondelim -$include "./modules/38_factor_costs/mixed_reg_feb17/input/f38_fac_req_reg.csv" -$offdelim; - - -table f38_region_yield(i,kcr) Regional crop yields (tDM per ha) -$ondelim -$include "./modules/38_factor_costs/mixed_reg_feb17/input/f38_region_yield.csv" -$offdelim; - -parameter f38_reg_parameters(reg) Parameters for capital share regression -/ -$ondelim -$include "./modules/38_factor_costs/input/f38_regression_cap_share.csv" -$offdelim -/ -; - -table f38_historical_share(t_all,i) Historical capital share -$ondelim -$include "./modules/38_factor_costs/input/f38_historical_share.csv" -$offdelim -; diff --git a/modules/38_factor_costs/mixed_reg_feb17/input/files b/modules/38_factor_costs/mixed_reg_feb17/input/files deleted file mode 100644 index 82b9b0f1b3..0000000000 --- a/modules/38_factor_costs/mixed_reg_feb17/input/files +++ /dev/null @@ -1,3 +0,0 @@ -* list of files that are required here -f38_region_yield.csv -f38_fac_req_reg.csv diff --git a/modules/38_factor_costs/mixed_reg_feb17/not_used.txt b/modules/38_factor_costs/mixed_reg_feb17/not_used.txt deleted file mode 100644 index 8f8857ecb4..0000000000 --- a/modules/38_factor_costs/mixed_reg_feb17/not_used.txt +++ /dev/null @@ -1,13 +0,0 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -# | authors, and contributors see CITATION.cff file. This file is part -# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -# | AGPL-3.0, you are granted additional permissions described in the -# | MAgPIE License Exception, version 1.0 (see LICENSE file). -# | Contact: magpie@pik-potsdam.de - -name,type,reason -vm_prod_reg,input,questionnaire -pm_interest,input,questionnaire -pm_prod_init,input,questionnaire -vm_prod,input,questionnaire -pm_labor_prod,input,questionnaire diff --git a/modules/38_factor_costs/mixed_reg_feb17/postsolve.gms b/modules/38_factor_costs/mixed_reg_feb17/postsolve.gms deleted file mode 100644 index 1618fd8afe..0000000000 --- a/modules/38_factor_costs/mixed_reg_feb17/postsolve.gms +++ /dev/null @@ -1,17 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_cost_prod_crop(t,i,req,"marginal") = vm_cost_prod_crop.m(i,req); - oq38_cost_prod_crop(t,i,req,"marginal") = q38_cost_prod_crop.m(i,req); - ov_cost_prod_crop(t,i,req,"level") = vm_cost_prod_crop.l(i,req); - oq38_cost_prod_crop(t,i,req,"level") = q38_cost_prod_crop.l(i,req); - ov_cost_prod_crop(t,i,req,"upper") = vm_cost_prod_crop.up(i,req); - oq38_cost_prod_crop(t,i,req,"upper") = q38_cost_prod_crop.up(i,req); - ov_cost_prod_crop(t,i,req,"lower") = vm_cost_prod_crop.lo(i,req); - oq38_cost_prod_crop(t,i,req,"lower") = q38_cost_prod_crop.lo(i,req); -*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/38_factor_costs/mixed_reg_feb17/preloop.gms b/modules/38_factor_costs/mixed_reg_feb17/preloop.gms deleted file mode 100644 index 9b3fd41443..0000000000 --- a/modules/38_factor_costs/mixed_reg_feb17/preloop.gms +++ /dev/null @@ -1,8 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -p38_fac_req(i,kcr,w) = f38_fac_req(i,kcr,w); diff --git a/modules/38_factor_costs/mixed_reg_feb17/presolve.gms b/modules/38_factor_costs/mixed_reg_feb17/presolve.gms deleted file mode 100644 index 7c2962d10d..0000000000 --- a/modules/38_factor_costs/mixed_reg_feb17/presolve.gms +++ /dev/null @@ -1,22 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - - -p38_share_calibration(i) = f38_historical_share("y2010",i)-(f38_reg_parameters("slope")*log10(sum(i_to_iso(i,iso),im_gdp_pc_ppp_iso("y2010",iso)))+f38_reg_parameters("intercept")); - -if (m_year(t)<2010, - p38_cost_share(t,i,"capital") = f38_historical_share(t,i); - p38_cost_share(t,i,"labor") = 1 - f38_historical_share(t,i); - -elseif (m_year(t)>=2010), -p38_cost_share(t,i,"capital") = f38_reg_parameters("slope")*log10(sum(i_to_iso(i,iso),im_gdp_pc_ppp_iso(t,iso)))+f38_reg_parameters("intercept")+p38_share_calibration(i); -p38_cost_share(t,i,"labor") = 1 - p38_cost_share(t,i,"capital"); -); - -if (m_year(t)>s38_shock_year, - p38_fac_req(i,kcr,"irrigated") = f38_fac_req(i,kcr,"irrigated") * s38_factor_irrigation ; -); diff --git a/modules/38_factor_costs/mixed_reg_feb17/realization.gms b/modules/38_factor_costs/mixed_reg_feb17/realization.gms deleted file mode 100644 index c5d0bff23c..0000000000 --- a/modules/38_factor_costs/mixed_reg_feb17/realization.gms +++ /dev/null @@ -1,32 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @description This 'mixed' realization specifies factors costs to depend on -*' area harvested and agricultural land use intensity and corresponding average -*' production volumes. -*' Consequently, factor costs in this realization react on both: area under -*' production and average productivity of a region as captured by the $\tau$ -*' factor. A detailed description of the approach can be found -*' in @dietrich_forecasting_2014 with background information about the used -*' intensity measure in @dietrich_measuring_2012. -*' -*' @limitations This realization assumes that factor costs only depend on area -*' and average productivity of a region. Productivity differences within a -*' region are ignored. Therefore, cases in which the cellular productivity -*' levels affect factors costs are only partially accounted for. - - -*####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/38_factor_costs/mixed_reg_feb17/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/38_factor_costs/mixed_reg_feb17/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/38_factor_costs/mixed_reg_feb17/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/38_factor_costs/mixed_reg_feb17/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/38_factor_costs/mixed_reg_feb17/scaling.gms" -$Ifi "%phase%" == "preloop" $include "./modules/38_factor_costs/mixed_reg_feb17/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/38_factor_costs/mixed_reg_feb17/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/38_factor_costs/mixed_reg_feb17/postsolve.gms" -*######################## R SECTION END (PHASES) ############################### diff --git a/modules/38_factor_costs/mixed_reg_feb17/scaling.gms b/modules/38_factor_costs/mixed_reg_feb17/scaling.gms deleted file mode 100644 index f57a11cfac..0000000000 --- a/modules/38_factor_costs/mixed_reg_feb17/scaling.gms +++ /dev/null @@ -1,6 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de diff --git a/modules/38_factor_costs/mixed_reg_feb17/sets.gms b/modules/38_factor_costs/mixed_reg_feb17/sets.gms deleted file mode 100644 index 2f4b8cb165..0000000000 --- a/modules/38_factor_costs/mixed_reg_feb17/sets.gms +++ /dev/null @@ -1,16 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -sets -req input requirements -/ labor, capital / - - reg regression parameters for capital calculation - /slope, intercept/ - ; - -*** EOF sets.gms *** diff --git a/modules/38_factor_costs/module.gms b/modules/38_factor_costs/module.gms index 7b7dd0a47c..b9fe948557 100644 --- a/modules/38_factor_costs/module.gms +++ b/modules/38_factor_costs/module.gms @@ -15,11 +15,10 @@ *' Thus, factor costs will contribute to and influence the choice of production *' pattern in the model. -*' @authors Jan Philipp Dietrich, Benjamin Bodirsky, Kristine Karstens, Edna J. Molina Bacca +*' @authors Jan Philipp Dietrich, Benjamin Bodirsky, Kristine Karstens, Edna J. Molina Bacca, Debbora Leip *###################### R SECTION START (MODULETYPES) ########################## -$Ifi "%factor_costs%" == "mixed_reg_feb17" $include "./modules/38_factor_costs/mixed_reg_feb17/realization.gms" $Ifi "%factor_costs%" == "per_ton_fao_may22" $include "./modules/38_factor_costs/per_ton_fao_may22/realization.gms" $Ifi "%factor_costs%" == "sticky_feb18" $include "./modules/38_factor_costs/sticky_feb18/realization.gms" $Ifi "%factor_costs%" == "sticky_labor" $include "./modules/38_factor_costs/sticky_labor/realization.gms" diff --git a/modules/38_factor_costs/per_ton_fao_may22/declarations.gms b/modules/38_factor_costs/per_ton_fao_may22/declarations.gms index 8e78b44488..da4fdf159b 100644 --- a/modules/38_factor_costs/per_ton_fao_may22/declarations.gms +++ b/modules/38_factor_costs/per_ton_fao_may22/declarations.gms @@ -6,22 +6,24 @@ *** | Contact: magpie@pik-potsdam.de equations -q38_cost_prod_crop(i,req) Regional factor costs of capital and labor for plant production (mio. USD05MER per yr) +q38_cost_prod_crop_labor(i) Regional labor costs for crop production (mio. USD05MER per yr) +q38_cost_prod_crop_capital(i) Regional capital costs for crop production (mio. USD05MER per yr) ; positive variables -vm_cost_prod_crop(i,req) Regional factor costs of capital and labor for plant production (mio. USD05MER per yr) +vm_cost_prod_crop(i,req) Regional factor costs of capital and labor for crop production (mio. USD05MER per yr) ; parameter -p38_cost_share(t,i,req) Capital and labor shares of the regional factor costs for plant production (1) +p38_cost_share(t,i,req) Capital and labor shares of the regional factor costs for crop production (1) p38_share_calibration(i) Summation factor used to calibrate calculated capital shares with historical values (1) i38_fac_req(t_all,i,kcr) Factor requirements (USD05MER per tDM) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_cost_prod_crop(t,i,req,type) Regional factor costs of capital and labor for plant production (mio. USD05MER per yr) - oq38_cost_prod_crop(t,i,req,type) Regional factor costs of capital and labor for plant production (mio. USD05MER per yr) + ov_cost_prod_crop(t,i,req,type) Regional factor costs of capital and labor for crop production (mio. USD05MER per yr) + oq38_cost_prod_crop_labor(t,i,type) Regional labor costs for crop production (mio. USD05MER per yr) + oq38_cost_prod_crop_capital(t,i,type) Regional capital costs for crop production (mio. USD05MER per yr) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/38_factor_costs/per_ton_fao_may22/equations.gms b/modules/38_factor_costs/per_ton_fao_may22/equations.gms index da70c8436f..f599ccc447 100644 --- a/modules/38_factor_costs/per_ton_fao_may22/equations.gms +++ b/modules/38_factor_costs/per_ton_fao_may22/equations.gms @@ -7,10 +7,11 @@ *' @equations + q38_cost_prod_crop_labor(i2) .. + vm_cost_prod_crop(i2,"labor") =e= sum(kcr, vm_prod_reg(i2,kcr) * sum(ct,i38_fac_req(ct,i2,kcr))) * sum(ct,p38_cost_share(ct,i2,"labor") * (1/pm_productivity_gain_from_wages(ct,i2)) * (pm_hourly_costs(ct,i2,"scenario") / pm_hourly_costs(ct,i2,"baseline"))); - q38_cost_prod_crop(i2,req) .. - vm_cost_prod_crop(i2,req) =e= sum(kcr, vm_prod_reg(i2,kcr) * sum(ct,i38_fac_req(ct,i2,kcr)))* sum(ct,p38_cost_share(ct,i2,req)); - + q38_cost_prod_crop_capital(i2) .. + vm_cost_prod_crop(i2,"capital") =e= sum(kcr, vm_prod_reg(i2,kcr) * sum(ct,i38_fac_req(ct,i2,kcr)))* sum(ct,p38_cost_share(ct,i2,"capital")); *' The factor costs for crops `vm_cost_prod_crop` are calculated as product of *' production quantity `vm_prod_reg` and crop-specific factor requirements @@ -19,6 +20,10 @@ *' from FAO Value of Production, to which the USDA factor cost share out of total *' costs was applied. Labor and capital costs are split by applying the corresponding *' share out of total factor costs. +*' To account for increased hourly labor costs and producitivity in case of an external +*' wage scenario, the total labor costs are scaled by the corresponding increase in hourly +*' labor costs and the related productivity gain from [36_employment]. +*' *' It is worth to mention again that the factor costs in this module *' do not include land rents (as MAgPIE calculates land rents endogenously), *' chemical fertilizer costs (as they are calculated in [50_nr_soil_budget] diff --git a/modules/38_factor_costs/per_ton_fao_may22/not_used.txt b/modules/38_factor_costs/per_ton_fao_may22/not_used.txt index cf446d07df..a76ea293ff 100644 --- a/modules/38_factor_costs/per_ton_fao_may22/not_used.txt +++ b/modules/38_factor_costs/per_ton_fao_may22/not_used.txt @@ -9,6 +9,3 @@ name,type,reason pm_interest,input,questionnaire vm_prod,input,questionnaire pm_prod_init,par,questionnaire -vm_tau,par,questionnaire -fm_tau1995,par,questionnaire -vm_area,par,questionnaire diff --git a/modules/38_factor_costs/per_ton_fao_may22/postsolve.gms b/modules/38_factor_costs/per_ton_fao_may22/postsolve.gms index a6d7ffd27d..fee35f5175 100644 --- a/modules/38_factor_costs/per_ton_fao_may22/postsolve.gms +++ b/modules/38_factor_costs/per_ton_fao_may22/postsolve.gms @@ -8,12 +8,16 @@ *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_cost_prod_crop(t,i,req,"marginal") = vm_cost_prod_crop.m(i,req); - oq38_cost_prod_crop(t,i,req,"marginal") = q38_cost_prod_crop.m(i,req); - ov_cost_prod_crop(t,i,req,"level") = vm_cost_prod_crop.l(i,req); - oq38_cost_prod_crop(t,i,req,"level") = q38_cost_prod_crop.l(i,req); - ov_cost_prod_crop(t,i,req,"upper") = vm_cost_prod_crop.up(i,req); - oq38_cost_prod_crop(t,i,req,"upper") = q38_cost_prod_crop.up(i,req); - ov_cost_prod_crop(t,i,req,"lower") = vm_cost_prod_crop.lo(i,req); - oq38_cost_prod_crop(t,i,req,"lower") = q38_cost_prod_crop.lo(i,req); + ov_cost_prod_crop(t,i,req,"marginal") = vm_cost_prod_crop.m(i,req); + oq38_cost_prod_crop_labor(t,i,"marginal") = q38_cost_prod_crop_labor.m(i); + oq38_cost_prod_crop_capital(t,i,"marginal") = q38_cost_prod_crop_capital.m(i); + ov_cost_prod_crop(t,i,req,"level") = vm_cost_prod_crop.l(i,req); + oq38_cost_prod_crop_labor(t,i,"level") = q38_cost_prod_crop_labor.l(i); + oq38_cost_prod_crop_capital(t,i,"level") = q38_cost_prod_crop_capital.l(i); + ov_cost_prod_crop(t,i,req,"upper") = vm_cost_prod_crop.up(i,req); + oq38_cost_prod_crop_labor(t,i,"upper") = q38_cost_prod_crop_labor.up(i); + oq38_cost_prod_crop_capital(t,i,"upper") = q38_cost_prod_crop_capital.up(i); + ov_cost_prod_crop(t,i,req,"lower") = vm_cost_prod_crop.lo(i,req); + oq38_cost_prod_crop_labor(t,i,"lower") = q38_cost_prod_crop_labor.lo(i); + oq38_cost_prod_crop_capital(t,i,"lower") = q38_cost_prod_crop_capital.lo(i); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/38_factor_costs/sticky_feb18/declarations.gms b/modules/38_factor_costs/sticky_feb18/declarations.gms index a17eb32b03..a23b55c41c 100644 --- a/modules/38_factor_costs/sticky_feb18/declarations.gms +++ b/modules/38_factor_costs/sticky_feb18/declarations.gms @@ -6,25 +6,25 @@ *** | Contact: magpie@pik-potsdam.de equations - q38_cost_prod_labor(i) Regional labor input costs for plant production (mio USD05MER) - q38_cost_prod_capital(i) Regional capital input costs for plant production (mio USD05MER) + q38_cost_prod_labor(i) Regional labor input costs for crop production (mio USD05MER) + q38_cost_prod_capital(i) Regional capital input costs for crop production (mio USD05MER) q38_investment_immobile(j,kcr) Cellular immobile investments into farm capital (mio USD05MER) q38_investment_mobile(j) Cellular mobile investments into farm capital (mio USD05MER) ; positive variables - vm_cost_prod_crop(i,req) Regional factor costs of capital and labor for plant production (mio USD05MER per yr) + vm_cost_prod_crop(i,req) Regional factor costs of capital and labor for crop production (mio USD05MER per yr) v38_investment_immobile(j,kcr) Investment costs in immobile farm capital (mio USD05MER per yr) v38_investment_mobile(j) Investment costs in mobile farm capital (mio USD05MER per yr) ; parameters - p38_variable_costs(t,i,kcr) Variable input costs per unit of output (USD05MER per ton DM) + p38_labor_need(t,i,kcr) Labor input costs per unit of output (USD05MER per ton DM) p38_capital_need(t,i,kcr,mobil38) Capital requirements per unit of output (USD05MER per ton DM) p38_capital_immobile(t,j,kcr) Preexisting immobile capital stocks before investment (mio USD05MER) p38_capital_mobile(t,j) Preexisting mobile capital stocks before investment (mio USD05MER) - p38_cost_share(t,i,req) Capital and labor shares of the regional factor costs for plant production (1) + p38_cost_share(t,i,req) Capital and labor shares of the regional factor costs for crop production (1) p38_share_calibration(i) Summation factor used to calibrate calculated capital shares with historical values (1) p38_croparea_start(j,w,kcr) Agricultural land initialization area (mio. ha) @@ -35,11 +35,11 @@ parameters *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_cost_prod_crop(t,i,req,type) Regional factor costs of capital and labor for plant production (mio USD05MER per yr) + ov_cost_prod_crop(t,i,req,type) Regional factor costs of capital and labor for crop production (mio USD05MER per yr) ov38_investment_immobile(t,j,kcr,type) Investment costs in immobile farm capital (mio USD05MER per yr) ov38_investment_mobile(t,j,type) Investment costs in mobile farm capital (mio USD05MER per yr) - oq38_cost_prod_labor(t,i,type) Regional labor input costs for plant production (mio USD05MER) - oq38_cost_prod_capital(t,i,type) Regional capital input costs for plant production (mio USD05MER) + oq38_cost_prod_labor(t,i,type) Regional labor input costs for crop production (mio USD05MER) + oq38_cost_prod_capital(t,i,type) Regional capital input costs for crop production (mio USD05MER) oq38_investment_immobile(t,j,kcr,type) Cellular immobile investments into farm capital (mio USD05MER) oq38_investment_mobile(t,j,type) Cellular mobile investments into farm capital (mio USD05MER) ; diff --git a/modules/38_factor_costs/sticky_feb18/equations.gms b/modules/38_factor_costs/sticky_feb18/equations.gms index 2449536bd7..19b38686d0 100644 --- a/modules/38_factor_costs/sticky_feb18/equations.gms +++ b/modules/38_factor_costs/sticky_feb18/equations.gms @@ -8,9 +8,12 @@ *' @equations *' Labor costs: The labor costs are calculated by multiplying regional aggregated production with labor requirments per output. +*' To account for increased hourly labor costs and producitivity in case of an external +*' wage scenario, the total labor costs are scaled by the corresponding increase in hourly +*' labor costs and the related productivity gain from [36_employment]. q38_cost_prod_labor(i2).. vm_cost_prod_crop(i2,"labor") - =e= sum(kcr,vm_prod_reg(i2,kcr) * sum(ct,p38_variable_costs(ct,i2,kcr))) + =e= sum(kcr,vm_prod_reg(i2,kcr) * sum(ct,p38_labor_need(ct,i2,kcr) * (1/pm_productivity_gain_from_wages(ct,i2)) * (pm_hourly_costs(ct,i2,"scenario") / pm_hourly_costs(ct,i2,"baseline")))) ; *' Investment costs: Investment are the summation of investment in mobile and immobile capital. The costs are annuitized, diff --git a/modules/38_factor_costs/sticky_feb18/input.gms b/modules/38_factor_costs/sticky_feb18/input.gms index 94e1654ae8..78107e5300 100644 --- a/modules/38_factor_costs/sticky_feb18/input.gms +++ b/modules/38_factor_costs/sticky_feb18/input.gms @@ -9,9 +9,9 @@ $setglobal c38_fac_req glo * options: glo, reg scalars -*' Depreciation rate assuming roughly 20 years linear depreciation for invesment goods +* Depreciation rate assuming roughly 20 years linear depreciation for invesment goods s38_depreciation_rate depreciation rate (share of costs) / 0.05 / -*' Share of immobile capital. +* Share of immobile capital. s38_immobile immobile capital (share) / 1 / ; diff --git a/modules/38_factor_costs/sticky_feb18/not_used.txt b/modules/38_factor_costs/sticky_feb18/not_used.txt index 7fd9a351b8..a40b473c2f 100644 --- a/modules/38_factor_costs/sticky_feb18/not_used.txt +++ b/modules/38_factor_costs/sticky_feb18/not_used.txt @@ -5,6 +5,3 @@ # | MAgPIE License Exception, version 1.0 (see LICENSE file). # | Contact: magpie@pik-potsdam.de name,type,reason -vm_tau,par,questionnaire -fm_tau1995,par,questionnaire -vm_area,par,questionnaire diff --git a/modules/38_factor_costs/sticky_feb18/presolve.gms b/modules/38_factor_costs/sticky_feb18/presolve.gms index 90d7b44452..8723fc593d 100644 --- a/modules/38_factor_costs/sticky_feb18/presolve.gms +++ b/modules/38_factor_costs/sticky_feb18/presolve.gms @@ -6,7 +6,7 @@ *** | Contact: magpie@pik-potsdam.de if (smax(j, pm_labor_prod(t,j)) <> 1 OR smin(j, pm_labor_prod(t,j)) <> 1, - abort "This factor cost realization cannot handle labor productivities != 1" + abort "This factor cost realization cannot handle labor productivities != 1" ); p38_share_calibration(i) = f38_historical_share("y2010",i)-(f38_reg_parameters("slope")*log10(sum(i_to_iso(i,iso),im_gdp_pc_ppp_iso("y2010",iso)))+f38_reg_parameters("intercept")); @@ -32,7 +32,7 @@ else i38_fac_req(t,i,kcr) = i38_fac_req(t,i,kcr); ); -p38_variable_costs(t,i,kcr) = i38_fac_req(t,i,kcr) * p38_cost_share(t,i,"labor"); +p38_labor_need(t,i,kcr) = i38_fac_req(t,i,kcr) * p38_cost_share(t,i,"labor"); p38_capital_need(t,i,kcr,"mobile") = i38_fac_req(t,i,kcr) * p38_cost_share(t,i,"capital") / (pm_interest(t,i)+s38_depreciation_rate) * (1-s38_immobile); p38_capital_need(t,i,kcr,"immobile") = i38_fac_req(t,i,kcr) * p38_cost_share(t,i,"capital") / (pm_interest(t,i)+s38_depreciation_rate) * s38_immobile; diff --git a/modules/38_factor_costs/sticky_labor/declarations.gms b/modules/38_factor_costs/sticky_labor/declarations.gms index dbf9d7a556..16197e39cf 100644 --- a/modules/38_factor_costs/sticky_labor/declarations.gms +++ b/modules/38_factor_costs/sticky_labor/declarations.gms @@ -6,51 +6,53 @@ *** | Contact: magpie@pik-potsdam.de equations - q38_cost_prod_labor(i) Regional labor input costs for plant production (mio USD05MER) - q38_cost_prod_capital(i) Regional capital input costs for plant production (mio USD05MER) + q38_cost_prod_labor(i) Regional labor input costs for crop production (mio USD05MER) + q38_cost_prod_capital(i) Regional capital input costs for crop production (mio USD05MER) q38_investment_immobile(j,kcr) Cellular immobile investments into farm capital (mio USD05MER) q38_investment_mobile(j) Cellular mobile investments into farm capital (mio USD05MER) - q38_ces_prodfun(j,kcr) CES production function for one unit of output (1) + q38_ces_prodfun(j,kcr) CES production function for one unit of output (1) ; positive variables - vm_cost_prod_crop(i,req) Regional factor costs of capital and labor for plant production (mio USD05MER per yr) + vm_cost_prod_crop(i,req) Regional factor costs of capital and labor for crop production (mio USD05MER per yr) v38_investment_immobile(j,kcr) Investment costs in immobile farm capital (mio USD05MER per yr) v38_investment_mobile(j) Investment costs in mobile farm capital (mio USD05MER per yr) - v38_labor_need(j,kcr) Labor required per unit of output (hours per ton DM) - v38_capital_need(j,kcr,mobil38) Captial required per unit of output (USD05MER per ton DM) + v38_laborhours_need(j,kcr) Labor required per unit of output (hours per ton DM) + v38_capital_need(j,kcr,mobil38) Captial required per unit of output (USD05MER per ton DM) ; parameters - p38_variable_costs(t,i,kcr) Variable input costs per unit of output (USD05MER per ton DM) + p38_labor_need(t,i,kcr) Labor input costs per unit of output (USD05MER per ton DM) p38_capital_need(t,i,kcr,mobil38) Capital requirements per unit of output (USD05MER per ton DM) p38_capital_immobile(t,j,kcr) Preexisting immobile capital stocks before investment (mio USD05MER) p38_capital_mobile(t,j) Preexisting mobile capital stocks before investment (mio USD05MER) - p38_cost_share(t,i,req) Capital and labor shares of the regional factor costs for plant production (1) + p38_cost_share(t,i,req) Capital and labor shares of the regional factor costs for crop production (1) p38_share_calibration(i) Summation factor used to calibrate calculated capital shares with historical values (1) p38_croparea_start(j,w,kcr) Agricultural land initialization area (mio. ha) - i38_ces_shr(j,kcr) Share parameter for CES function (1) - i38_ces_scale(j,kcr) Scaling factor for total factor productivity (1) + i38_ces_shr(j,kcr) Share parameter for CES function (1) + i38_ces_scale(j,kcr) Scaling factor for total factor productivity (1) + p38_intr_depr(t,i) Factor from interest and depreciation rate (1) + i38_fac_req(t_all,i,kcr) Factor requirements (USD05MER per tDM) ; scalars - s38_ces_elast_par Elasticity parameter for CES function (1) + s38_ces_elast_par Elasticity parameter for CES function (1) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_cost_prod_crop(t,i,req,type) Regional factor costs of capital and labor for plant production (mio USD05MER per yr) + ov_cost_prod_crop(t,i,req,type) Regional factor costs of capital and labor for crop production (mio USD05MER per yr) ov38_investment_immobile(t,j,kcr,type) Investment costs in immobile farm capital (mio USD05MER per yr) ov38_investment_mobile(t,j,type) Investment costs in mobile farm capital (mio USD05MER per yr) - ov38_labor_need(t,j,kcr,type) Labor required per unit of output (hours per ton DM) + ov38_laborhours_need(t,j,kcr,type) Labor required per unit of output (hours per ton DM) ov38_capital_need(t,j,kcr,mobil38,type) Captial required per unit of output (USD05MER per ton DM) - oq38_cost_prod_labor(t,i,type) Regional labor input costs for plant production (mio USD05MER) - oq38_cost_prod_capital(t,i,type) Regional capital input costs for plant production (mio USD05MER) + oq38_cost_prod_labor(t,i,type) Regional labor input costs for crop production (mio USD05MER) + oq38_cost_prod_capital(t,i,type) Regional capital input costs for crop production (mio USD05MER) oq38_investment_immobile(t,j,kcr,type) Cellular immobile investments into farm capital (mio USD05MER) oq38_investment_mobile(t,j,type) Cellular mobile investments into farm capital (mio USD05MER) oq38_ces_prodfun(t,j,kcr,type) CES production function for one unit of output (1) diff --git a/modules/38_factor_costs/sticky_labor/equations.gms b/modules/38_factor_costs/sticky_labor/equations.gms index 32f826c063..26e1864172 100644 --- a/modules/38_factor_costs/sticky_labor/equations.gms +++ b/modules/38_factor_costs/sticky_labor/equations.gms @@ -9,22 +9,24 @@ *' @equations *' Constant elasticity of substitution (CES) production function for one unit of output. -*' The CES function accounts for capital `v38_capital_need` and labor `v38_labor_need` requirements. -*' The efficiency of labor is affected by the labor productivity factor `vm_labor_prod`, which is -*' provided by the labor productivity module [37_labor_prod]. +*' The CES function accounts for capital `v38_capital_need` and labor `v38_laborhours_need` requirements. +*' The efficiency of labor is affected by the labor productivity factor `pm_labor_prod` based on climate +*' change impacts, which is provided by the labor productivity module [37_labor_prod], and by the factor +*' `pm_productivity_gain_from_wages` based on increased wages from [36_employment]. *' The calculation of total capital and labor costs is covered by the equations `q38_cost_prod_crop` and `q38_cost_prod_inv`. *' The conceptual and analytical details of the CES function including the labor productivity factor are documented in @orlov_ces_2021. q38_ces_prodfun(j2,kcr) .. i38_ces_scale(j2,kcr) * (i38_ces_shr(j2,kcr)*sum(mobil38, v38_capital_need(j2,kcr,mobil38))**(-s38_ces_elast_par) + - (1 - i38_ces_shr(j2,kcr))*(sum(ct, pm_labor_prod(ct,j2)) * v38_labor_need(j2,kcr))**(-s38_ces_elast_par))**(-1/s38_ces_elast_par) + (1 - i38_ces_shr(j2,kcr))*(sum(ct, pm_labor_prod(ct,j2) * sum(cell(i2,j2), pm_productivity_gain_from_wages(ct,i2))) * v38_laborhours_need(j2,kcr))**(-s38_ces_elast_par))**(-1/s38_ces_elast_par) =e= 1 ; -*' Labor costs: The labor costs are calculated by multiplying regional aggregated production with labor requirments per output. +*' Labor costs: The labor costs are calculated by multiplying regional aggregated production with labor requirements +*' (in hours) per output unit and wages from [36_employment]. q38_cost_prod_labor(i2).. vm_cost_prod_crop(i2,"labor") - =e= sum(kcr,sum(cell(i2,j2), vm_prod(j2,kcr) * v38_labor_need(j2,kcr) * s38_wage)) + =e= sum(kcr,sum(cell(i2,j2), vm_prod(j2,kcr) * v38_laborhours_need(j2,kcr) * sum(ct, pm_hourly_costs(ct,i2,"scenario")))) ; *' Investment costs: Investment are the summation of investment in mobile and immobile capital. The costs are annuitized, diff --git a/modules/38_factor_costs/sticky_labor/input.gms b/modules/38_factor_costs/sticky_labor/input.gms index b3653b8985..249283f0d0 100644 --- a/modules/38_factor_costs/sticky_labor/input.gms +++ b/modules/38_factor_costs/sticky_labor/input.gms @@ -9,14 +9,12 @@ $setglobal c38_fac_req glo * options: glo, reg scalars -*' Depreciation rate assuming roughly 20 years linear depreciation for invesment goods +* Depreciation rate assuming roughly 20 years linear depreciation for invesment goods s38_depreciation_rate depreciation rate (share of costs) / 0.05 / -*' Share of immobile capital. +* Share of immobile capital. s38_immobile immobile capital (share) / 1 / -* Note: Wage for labor is needed for the CES function. -* The actual value does not matter because it cancels out. -s38_wage Wage for labor in CES function (USD05MER per hour) / 1 / s38_ces_elast_subst Elasticity of substitution in CES function (1) / 0.3 / +s38_fix_capital_need Year until which capital requirements are fixed / 2020 / ; parameter f38_fac_req(kcr) Factor requirement costs in 2005 (USD05MER per tDM) diff --git a/modules/38_factor_costs/sticky_labor/not_used.txt b/modules/38_factor_costs/sticky_labor/not_used.txt index 790364668a..e10fdd9ad7 100644 --- a/modules/38_factor_costs/sticky_labor/not_used.txt +++ b/modules/38_factor_costs/sticky_labor/not_used.txt @@ -6,6 +6,3 @@ # | Contact: magpie@pik-potsdam.de name,type,reason vm_prod_reg,input,not used -vm_tau,par,questionnaire -fm_tau1995,par,questionnaire -vm_area,par,questionnaire diff --git a/modules/38_factor_costs/sticky_labor/postsolve.gms b/modules/38_factor_costs/sticky_labor/postsolve.gms index f337c2d2af..b421b25da7 100644 --- a/modules/38_factor_costs/sticky_labor/postsolve.gms +++ b/modules/38_factor_costs/sticky_labor/postsolve.gms @@ -14,7 +14,7 @@ p38_capital_mobile(t+1,j) = p38_capital_mobile(t,j) + v38_investment_mobile.l(j) ov_cost_prod_crop(t,i,req,"marginal") = vm_cost_prod_crop.m(i,req); ov38_investment_immobile(t,j,kcr,"marginal") = v38_investment_immobile.m(j,kcr); ov38_investment_mobile(t,j,"marginal") = v38_investment_mobile.m(j); - ov38_labor_need(t,j,kcr,"marginal") = v38_labor_need.m(j,kcr); + ov38_laborhours_need(t,j,kcr,"marginal") = v38_laborhours_need.m(j,kcr); ov38_capital_need(t,j,kcr,mobil38,"marginal") = v38_capital_need.m(j,kcr,mobil38); oq38_cost_prod_labor(t,i,"marginal") = q38_cost_prod_labor.m(i); oq38_cost_prod_capital(t,i,"marginal") = q38_cost_prod_capital.m(i); @@ -24,7 +24,7 @@ p38_capital_mobile(t+1,j) = p38_capital_mobile(t,j) + v38_investment_mobile.l(j) ov_cost_prod_crop(t,i,req,"level") = vm_cost_prod_crop.l(i,req); ov38_investment_immobile(t,j,kcr,"level") = v38_investment_immobile.l(j,kcr); ov38_investment_mobile(t,j,"level") = v38_investment_mobile.l(j); - ov38_labor_need(t,j,kcr,"level") = v38_labor_need.l(j,kcr); + ov38_laborhours_need(t,j,kcr,"level") = v38_laborhours_need.l(j,kcr); ov38_capital_need(t,j,kcr,mobil38,"level") = v38_capital_need.l(j,kcr,mobil38); oq38_cost_prod_labor(t,i,"level") = q38_cost_prod_labor.l(i); oq38_cost_prod_capital(t,i,"level") = q38_cost_prod_capital.l(i); @@ -34,7 +34,7 @@ p38_capital_mobile(t+1,j) = p38_capital_mobile(t,j) + v38_investment_mobile.l(j) ov_cost_prod_crop(t,i,req,"upper") = vm_cost_prod_crop.up(i,req); ov38_investment_immobile(t,j,kcr,"upper") = v38_investment_immobile.up(j,kcr); ov38_investment_mobile(t,j,"upper") = v38_investment_mobile.up(j); - ov38_labor_need(t,j,kcr,"upper") = v38_labor_need.up(j,kcr); + ov38_laborhours_need(t,j,kcr,"upper") = v38_laborhours_need.up(j,kcr); ov38_capital_need(t,j,kcr,mobil38,"upper") = v38_capital_need.up(j,kcr,mobil38); oq38_cost_prod_labor(t,i,"upper") = q38_cost_prod_labor.up(i); oq38_cost_prod_capital(t,i,"upper") = q38_cost_prod_capital.up(i); @@ -44,7 +44,7 @@ p38_capital_mobile(t+1,j) = p38_capital_mobile(t,j) + v38_investment_mobile.l(j) ov_cost_prod_crop(t,i,req,"lower") = vm_cost_prod_crop.lo(i,req); ov38_investment_immobile(t,j,kcr,"lower") = v38_investment_immobile.lo(j,kcr); ov38_investment_mobile(t,j,"lower") = v38_investment_mobile.lo(j); - ov38_labor_need(t,j,kcr,"lower") = v38_labor_need.lo(j,kcr); + ov38_laborhours_need(t,j,kcr,"lower") = v38_laborhours_need.lo(j,kcr); ov38_capital_need(t,j,kcr,mobil38,"lower") = v38_capital_need.lo(j,kcr,mobil38); oq38_cost_prod_labor(t,i,"lower") = q38_cost_prod_labor.lo(i); oq38_cost_prod_capital(t,i,"lower") = q38_cost_prod_capital.lo(i); diff --git a/modules/38_factor_costs/sticky_labor/preloop.gms b/modules/38_factor_costs/sticky_labor/preloop.gms index c50a897e8e..8068b9b489 100644 --- a/modules/38_factor_costs/sticky_labor/preloop.gms +++ b/modules/38_factor_costs/sticky_labor/preloop.gms @@ -7,3 +7,5 @@ * Calibrate the CES function: s38_ces_elast_par = (1/s38_ces_elast_subst) - 1 ; + +p38_intr_depr(t,i) = (1-s38_depreciation_rate) * pm_interest(t,i)/(1+pm_interest(t,i)) + s38_depreciation_rate; diff --git a/modules/38_factor_costs/sticky_labor/presolve.gms b/modules/38_factor_costs/sticky_labor/presolve.gms index ab0f3965af..b131c04812 100644 --- a/modules/38_factor_costs/sticky_labor/presolve.gms +++ b/modules/38_factor_costs/sticky_labor/presolve.gms @@ -28,25 +28,29 @@ else i38_fac_req(t,i,kcr) = i38_fac_req(t,i,kcr); ); -p38_variable_costs(t,i,kcr) = i38_fac_req(t,i,kcr) * p38_cost_share(t,i,"labor"); +p38_labor_need(t,i,kcr) = i38_fac_req(t,i,kcr) * p38_cost_share(t,i,"labor"); p38_capital_need(t,i,kcr,"mobile") = i38_fac_req(t,i,kcr) * p38_cost_share(t,i,"capital") / (pm_interest(t,i)+s38_depreciation_rate) * (1-s38_immobile); p38_capital_need(t,i,kcr,"immobile") = i38_fac_req(t,i,kcr) * p38_cost_share(t,i,"capital") / (pm_interest(t,i)+s38_depreciation_rate) * s38_immobile; *** Variable labor costs BEGIN -* set bounds for labor requirements -v38_labor_need.lo(j,kcr) = 0.1*sum(cell(i,j),p38_variable_costs(t,i,kcr)); -v38_labor_need.l(j,kcr) = sum(cell(i,j),p38_variable_costs(t,i,kcr)); -v38_labor_need.up(j,kcr) = 10 * sum(cell(i,j),p38_variable_costs(t,i,kcr)); +* set bounds for labor requirements (in terms of hours worked per output unit) +v38_laborhours_need.lo(j,kcr) = 0.1 * (sum(cell(i,j),p38_labor_need(t,i,kcr)) / sum(cell(i,j), pm_hourly_costs(t,i,"baseline"))); +v38_laborhours_need.l(j,kcr) = sum(cell(i,j),p38_labor_need(t,i,kcr)) / sum(cell(i,j), pm_hourly_costs(t,i,"baseline")); +v38_laborhours_need.up(j,kcr) = 10 * (sum(cell(i,j),p38_labor_need(t,i,kcr)) / sum(cell(i,j), pm_hourly_costs(t,i,"baseline"))); * set bounds for captial requirements -v38_capital_need.lo(j,kcr,mobil38) = 0.1*sum(cell(i,j),p38_capital_need(t,i,kcr,mobil38)); -v38_capital_need.l(j,kcr,mobil38) = sum(cell(i,j),p38_capital_need(t,i,kcr,mobil38)); -v38_capital_need.up(j,kcr,mobil38) = 10 * sum(cell(i,j),p38_capital_need(t,i,kcr,mobil38)); +if (m_year(t) <= s38_fix_capital_need, + v38_capital_need.fx(j,kcr,mobil38) = sum(cell(i,j),p38_capital_need(t,i,kcr,mobil38)); +else + v38_capital_need.lo(j,kcr,mobil38) = 0.1*sum(cell(i,j),p38_capital_need(t,i,kcr,mobil38)); + v38_capital_need.l(j,kcr,mobil38) = sum(cell(i,j),p38_capital_need(t,i,kcr,mobil38)); + v38_capital_need.up(j,kcr,mobil38) = 10 * sum(cell(i,j),p38_capital_need(t,i,kcr,mobil38)); +); * update CES parameters -i38_ces_shr(j,kcr) = sum(cell(i,j), (pm_interest(t,i) * sum(mobil38, v38_capital_need.l(j,kcr,mobil38))**(1 + s38_ces_elast_par)) / (pm_interest(t,i) * sum(mobil38, v38_capital_need.l(j,kcr,mobil38))**(1 + s38_ces_elast_par) + s38_wage * v38_labor_need.l(j,kcr)**(1 + s38_ces_elast_par))); -i38_ces_scale(j,kcr) = sum(cell(i,j), 1/([i38_ces_shr(j,kcr) * sum(mobil38, v38_capital_need.l(j,kcr,mobil38))**(-s38_ces_elast_par) + (1 - i38_ces_shr(j,kcr)) * v38_labor_need.l(j,kcr)**(-s38_ces_elast_par)]**(-1/s38_ces_elast_par))); +i38_ces_shr(j,kcr) = sum(cell(i,j), (p38_intr_depr(t,i) * sum(mobil38, v38_capital_need.l(j,kcr,mobil38))**(1 + s38_ces_elast_par)) / (p38_intr_depr(t,i) * sum(mobil38, v38_capital_need.l(j,kcr,mobil38))**(1 + s38_ces_elast_par) + pm_hourly_costs(t,i,"baseline") * v38_laborhours_need.l(j,kcr)**(1 + s38_ces_elast_par))); +i38_ces_scale(j,kcr) = sum(cell(i,j), 1/([i38_ces_shr(j,kcr) * sum(mobil38, v38_capital_need.l(j,kcr,mobil38))**(-s38_ces_elast_par) + (1 - i38_ces_shr(j,kcr)) * v38_laborhours_need.l(j,kcr)**(-s38_ces_elast_par)]**(-1/s38_ces_elast_par))); *** Variable labor costs END diff --git a/modules/38_factor_costs/sticky_labor/realization.gms b/modules/38_factor_costs/sticky_labor/realization.gms index 391e93bd58..a87d8c5a73 100644 --- a/modules/38_factor_costs/sticky_labor/realization.gms +++ b/modules/38_factor_costs/sticky_labor/realization.gms @@ -6,8 +6,9 @@ *** | Contact: magpie@pik-potsdam.de *' @description This realization is based on sticky_feb18, but in addition includes a -*' CES production function, which -*' accounts for climate change impacts on labor productivity provided by [37_labor_prod]. +*' CES production function, which accounts for climate change impacts on labor productivity +*' provided by [37_labor_prod], and wage increase impact on labor productivity based on +*' wages in [36_employment]. *' The main goal of this realization is to improve crop patterns at different spatial *' scales. Specifically, the goal is reached by reducing capital relocation flexibility between *' crop types. In the "sticky" realization, the factor costs are separated into variable labor cost and diff --git a/modules/42_water_demand/agr_sector_aug13/declarations.gms b/modules/42_water_demand/agr_sector_aug13/declarations.gms index 66aba449cb..9aad78e1e6 100644 --- a/modules/42_water_demand/agr_sector_aug13/declarations.gms +++ b/modules/42_water_demand/agr_sector_aug13/declarations.gms @@ -33,6 +33,8 @@ positive variables parameters ov_watdem(t,wat_dem,j,type) Water demand from different sectors (mio. m^3 per yr) ov42_irrig_eff(t,j,type) Irrigation efficiency (1) + ov_water_cost(t,i,type) Cost of irrigation water (USD05MER per m^3) oq42_water_demand(t,wat_dem,j,type) Water withdrawals of different sectors (mio. m^3 per yr) + oq42_water_cost(t,i,type) Total cost of pumping irrigation water (USD05MER per yr) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/42_water_demand/agr_sector_aug13/equations.gms b/modules/42_water_demand/agr_sector_aug13/equations.gms index 1af433155e..16c96762d1 100644 --- a/modules/42_water_demand/agr_sector_aug13/equations.gms +++ b/modules/42_water_demand/agr_sector_aug13/equations.gms @@ -7,14 +7,15 @@ *' @equations -q42_water_demand("agriculture",j2).. +q42_water_demand("agriculture",j2) .. + vm_watdem("agriculture",j2) * v42_irrig_eff(j2) =e= + sum(kcr, vm_area(j2,kcr,"irrigated") * + sum((cell(i2,j2),ct), fm_multicropping(ct,i2)) * + ic42_wat_req_k(j2,kcr)) + + sum(kli, vm_prod(j2,kli) * ic42_wat_req_k(j2,kli) * v42_irrig_eff(j2)); - vm_watdem("agriculture",j2)*v42_irrig_eff(j2) =e= - sum(kcr, vm_area(j2,kcr,"irrigated") * ic42_wat_req_k(j2,kcr)) - + sum(kli,vm_prod(j2,kli) * ic42_wat_req_k(j2,kli) * v42_irrig_eff(j2)); - - q42_water_cost(i2) .. - vm_water_cost(i2) =e= sum(cell(i2,j2),vm_watdem("agriculture",j2))*ic42_pumping_cost(i2); + q42_water_cost(i2) .. + vm_water_cost(i2) =e= sum(cell(i2,j2), vm_watdem("agriculture",j2)) * ic42_pumping_cost(i2); *' `vm_watdem` is composed by irrigation and livestock demand uses. *' The factor `v42_irrig_eff` corresponds to the amount of water that is used diff --git a/modules/42_water_demand/agr_sector_aug13/input.gms b/modules/42_water_demand/agr_sector_aug13/input.gms index f5e53ad252..035c9d8f5c 100644 --- a/modules/42_water_demand/agr_sector_aug13/input.gms +++ b/modules/42_water_demand/agr_sector_aug13/input.gms @@ -33,7 +33,7 @@ s42_env_flow_base_fraction Fraction of available water that is reserved * (determined in the file EFR_protection_policy.csv) s42_env_flow_fraction Fraction of available water that is reserved for under protection policies (1) / 0.2 / s42_pumping Switch to activate pumping cost settings (1) / 0 / -s42_multiplier_startyear Year from which pumping costs multiplier will be implemented (1) / 1995 / +s42_multiplier_startyear Year from which pumping costs multiplier will be implemented (1) / 0 / s42_multiplier multiplier to change pumping costs for sensitivity analysis takes numeric values (1) / 0 / ; diff --git a/modules/42_water_demand/agr_sector_aug13/postsolve.gms b/modules/42_water_demand/agr_sector_aug13/postsolve.gms index f1cedc5fc0..4a4dc96caf 100644 --- a/modules/42_water_demand/agr_sector_aug13/postsolve.gms +++ b/modules/42_water_demand/agr_sector_aug13/postsolve.gms @@ -8,14 +8,22 @@ *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov_watdem(t,wat_dem,j,"marginal") = vm_watdem.m(wat_dem,j); ov42_irrig_eff(t,j,"marginal") = v42_irrig_eff.m(j); + ov_water_cost(t,i,"marginal") = vm_water_cost.m(i); oq42_water_demand(t,wat_dem,j,"marginal") = q42_water_demand.m(wat_dem,j); + oq42_water_cost(t,i,"marginal") = q42_water_cost.m(i); ov_watdem(t,wat_dem,j,"level") = vm_watdem.l(wat_dem,j); ov42_irrig_eff(t,j,"level") = v42_irrig_eff.l(j); + ov_water_cost(t,i,"level") = vm_water_cost.l(i); oq42_water_demand(t,wat_dem,j,"level") = q42_water_demand.l(wat_dem,j); + oq42_water_cost(t,i,"level") = q42_water_cost.l(i); ov_watdem(t,wat_dem,j,"upper") = vm_watdem.up(wat_dem,j); ov42_irrig_eff(t,j,"upper") = v42_irrig_eff.up(j); + ov_water_cost(t,i,"upper") = vm_water_cost.up(i); oq42_water_demand(t,wat_dem,j,"upper") = q42_water_demand.up(wat_dem,j); + oq42_water_cost(t,i,"upper") = q42_water_cost.up(i); ov_watdem(t,wat_dem,j,"lower") = vm_watdem.lo(wat_dem,j); ov42_irrig_eff(t,j,"lower") = v42_irrig_eff.lo(j); + ov_water_cost(t,i,"lower") = vm_water_cost.lo(i); oq42_water_demand(t,wat_dem,j,"lower") = q42_water_demand.lo(wat_dem,j); + oq42_water_cost(t,i,"lower") = q42_water_cost.lo(i); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/42_water_demand/all_sectors_aug13/declarations.gms b/modules/42_water_demand/all_sectors_aug13/declarations.gms index 003ca8f23c..92eabb190f 100644 --- a/modules/42_water_demand/all_sectors_aug13/declarations.gms +++ b/modules/42_water_demand/all_sectors_aug13/declarations.gms @@ -33,8 +33,8 @@ positive variables parameters ov_watdem(t,wat_dem,j,type) Amount of water needed in different sectors (mio. m^3 per yr) ov42_irrig_eff(t,j,type) Irrigation efficiency (1) - ov_water_cost(t,i,type) Cost of irrigation water (USD per m^3 per yr) + ov_water_cost(t,i,type) Cost of irrigation water (USD05MER per m^3) oq42_water_demand(t,wat_dem,j,type) Water withdrawals of different sectors (mio. m^3 per yr) - oq42_water_cost(t,i,type) Total cost of pumping irrigation water (USD) + oq42_water_cost(t,i,type) Total cost of pumping irrigation water (USD05MER per yr) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/42_water_demand/all_sectors_aug13/equations.gms b/modules/42_water_demand/all_sectors_aug13/equations.gms index f58d297be9..7c8e803977 100644 --- a/modules/42_water_demand/all_sectors_aug13/equations.gms +++ b/modules/42_water_demand/all_sectors_aug13/equations.gms @@ -7,14 +7,15 @@ *' @equations -q42_water_demand("agriculture",j2).. +q42_water_demand("agriculture",j2) .. + vm_watdem("agriculture",j2) * v42_irrig_eff(j2) =e= + sum(kcr, vm_area(j2,kcr,"irrigated") * + sum((cell(i2,j2),ct), fm_multicropping(ct,i2)) * + ic42_wat_req_k(j2,kcr)) + + sum(kli, vm_prod(j2,kli) * ic42_wat_req_k(j2,kli) * v42_irrig_eff(j2)); - vm_watdem("agriculture",j2)*v42_irrig_eff(j2) =e= - sum(kcr, vm_area(j2,kcr,"irrigated")*ic42_wat_req_k(j2,kcr)) - + sum(kli,vm_prod(j2,kli)*ic42_wat_req_k(j2,kli)*v42_irrig_eff(j2)); - -q42_water_cost(i2) .. - vm_water_cost(i2) =e= sum(cell(i2,j2),vm_watdem("agriculture",j2))*ic42_pumping_cost(i2); +q42_water_cost(i2) .. + vm_water_cost(i2) =e= sum(cell(i2,j2), vm_watdem("agriculture",j2)) * ic42_pumping_cost(i2); *' Agricultural water demand is composed by livestock water demand and *' demand for irrigation water withdrawals. diff --git a/modules/42_water_demand/all_sectors_aug13/input.gms b/modules/42_water_demand/all_sectors_aug13/input.gms index 58c9e0d8dc..cf16743802 100644 --- a/modules/42_water_demand/all_sectors_aug13/input.gms +++ b/modules/42_water_demand/all_sectors_aug13/input.gms @@ -37,7 +37,7 @@ s42_env_flow_base_fraction Fraction of available water that is reserved * EFR_protection_policy.csv) s42_env_flow_fraction Fraction of available water that is reserved for under protection policies (1) / 0.2 / s42_pumping Switch to activate pumping cost settings (1) / 0 / -s42_multiplier_startyear Year from which pumping costs multiplier will be implemented (1) / 1995 / +s42_multiplier_startyear Year from which pumping costs multiplier will be implemented (1) / 0 / s42_multiplier multiplier to change pumping costs for sensitivity analysis takes numeric values (1) / 0 / ; diff --git a/modules/43_water_availability/total_water_aug13/input.gms b/modules/43_water_availability/total_water_aug13/input.gms index e02e2f5888..6cb208b469 100644 --- a/modules/43_water_availability/total_water_aug13/input.gms +++ b/modules/43_water_availability/total_water_aug13/input.gms @@ -20,3 +20,8 @@ $include "./modules/43_water_availability/input/lpj_watavail_grper.cs2" $offdelim / ; +* set values to 1995 if nocc scenario is used, or to sm_fix_cc after sm_fix_cc if nocc_hist is used +$ifthen "%c43_watavail_scenario%" == "nocc" f43_wat_avail(t_all,j) = f43_wat_avail("y1995",j); +$elseif "%c43_watavail_scenario%" == "nocc_hist" f43_wat_avail(t_all,j)$(m_year(t_all) > sm_fix_cc) = f43_wat_avail(t_all,j)$(m_year(t_all) = sm_fix_cc); +$endif +m_fillmissingyears(f43_wat_avail,"j"); diff --git a/modules/43_water_availability/total_water_aug13/preloop.gms b/modules/43_water_availability/total_water_aug13/preloop.gms index 4de92c8a9d..a5e18c8abe 100644 --- a/modules/43_water_availability/total_water_aug13/preloop.gms +++ b/modules/43_water_availability/total_water_aug13/preloop.gms @@ -10,9 +10,3 @@ im_wat_avail(t,"surface",j) = f43_wat_avail(t,j); im_wat_avail(t,"ground",j) = 0; im_wat_avail(t,"ren_ground",j) = 0; im_wat_avail(t,"technical",j) = 0; - - -$ifthen "%c43_watavail_scenario%" == "nocc" f43_wat_avail(t_all,j) = f43_wat_avail("y1995",j); -$elseif "%c43_watavail_scenario%" == "nocc_hist" f43_wat_avail(t_all,j)$(m_year(t_all) > sm_fix_cc) = f43_wat_avail(t_all,j)$(m_year(t_all) = sm_fix_cc); -$endif -m_fillmissingyears(f43_wat_avail,"j"); diff --git a/modules/44_biodiversity/bv_btc_mar21/input.gms b/modules/44_biodiversity/bv_btc_mar21/input.gms index 4665ede06b..407e6112da 100644 --- a/modules/44_biodiversity/bv_btc_mar21/input.gms +++ b/modules/44_biodiversity/bv_btc_mar21/input.gms @@ -6,8 +6,8 @@ *** | Contact: magpie@pik-potsdam.de scalars - s44_start_year Start year of biodiversity price (1) / 2020 / - s44_target_year Target year of biodiversity price (1) / 2050 / + s44_start_year Start year of biodiversity price (1) / 2025 / + s44_target_year Target year of biodiversity price (1) / 2100 / s44_start_price Price for biodiversity stock loss in start year (USD per ha) / 0 / s44_target_price Price for biodiversity stock loss in target year (USD per ha) / 0 / ; diff --git a/modules/50_nr_soil_budget/input/files b/modules/50_nr_soil_budget/input/files index b7ddfa071d..00b47652e6 100644 --- a/modules/50_nr_soil_budget/input/files +++ b/modules/50_nr_soil_budget/input/files @@ -1,9 +1,9 @@ * list of files that are required here -f50_snupe.cs4 +f50_snupe_base.cs4 f50_nitrogen_balanceflow.cs4 f50_ndfa.cs4 f50_fixation_freeliving.cs4 -f50_nue_pasture.cs4 +f50_nue_base_pasture.cs4 f50_nitrogen_fixation_rates_pasture.cs4 f50_nitrogen_balanceflow_pasture.cs4 f50_NitrogenFixationRateNatural_0.5.mz diff --git a/modules/50_nr_soil_budget/exoeff_aug16/declarations.gms b/modules/50_nr_soil_budget/macceff_aug22/declarations.gms similarity index 80% rename from modules/50_nr_soil_budget/exoeff_aug16/declarations.gms rename to modules/50_nr_soil_budget/macceff_aug22/declarations.gms index b7bcca2ed0..d9ba47239c 100644 --- a/modules/50_nr_soil_budget/exoeff_aug16/declarations.gms +++ b/modules/50_nr_soil_budget/macceff_aug22/declarations.gms @@ -36,11 +36,14 @@ equations parameters i50_atmospheric_deposition_rates(t,j,land) Atmospheric deposition rate (t N per ha) * country-specific scenario switch - p50_country_dummy_cropneff(iso) Dummy parameter indicating whether country is affected by crop neff scenario (1) - p50_country_dummy_pastneff(iso) Dummy parameter indicating whether country is affected by pasture neff scenario (1) - p50_cropneff_region_shr(t,i) Weighted share of region with regards to crop neff scenario of countries (1) - p50_pastneff_region_shr(t,i) Weighted share of region with regards to pasture neff scenario of countries (1) - ; + p50_country_dummy_cropneff(iso) Dummy parameter indicating whether country is affected by crop neff scenario (1) + p50_country_dummy_pastneff(iso) Dummy parameter indicating whether country is affected by pasture neff scenario (1) + p50_cropneff_region_shr(t,i) Weighted share of region with regards to crop neff scenario of countries (1) + p50_pastneff_region_shr(t,i) Weighted share of region with regards to pasture neff scenario of countries (1) + i50_nr_eff_bau(t_all,i) Business as usual soil nitrogen uptake efficiency before MACCs mitigation (1) + i50_nr_eff_pasture_bau(t_all,i) Business as usual pasture nitrogen use efficiency before MACCs mitigation (1) + i50_maccs_mitigation_transf(t,i) Transformed marginal abatement cost curves to be consistent with cropland SNuPE implementaton (1) + i50_maccs_mitigation_pasture_transf(t,i) Transformed marginal abatement cost curves to be consistent with pasture NUE implementaton (1) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### diff --git a/modules/50_nr_soil_budget/exoeff_aug16/equations.gms b/modules/50_nr_soil_budget/macceff_aug22/equations.gms similarity index 100% rename from modules/50_nr_soil_budget/exoeff_aug16/equations.gms rename to modules/50_nr_soil_budget/macceff_aug22/equations.gms diff --git a/modules/50_nr_soil_budget/exoeff_aug16/input.gms b/modules/50_nr_soil_budget/macceff_aug22/input.gms similarity index 81% rename from modules/50_nr_soil_budget/exoeff_aug16/input.gms rename to modules/50_nr_soil_budget/macceff_aug22/input.gms index ef7c992e36..e80f38c33e 100644 --- a/modules/50_nr_soil_budget/exoeff_aug16/input.gms +++ b/modules/50_nr_soil_budget/macceff_aug22/input.gms @@ -8,27 +8,27 @@ * Scenario for nr efficiency on croplands or pastures for selected (and * respectively non-selected) countries in cropneff_countries and pastneff_countries -$setglobal c50_scen_neff neff60_60_starty2010 -$setglobal c50_scen_neff_noselect neff60_60_starty2010 -* options: constant, -* neff55_55_starty1990,neff60_60_starty1990,neff65_70_starty1990, -* neff65_70_starty2010,neff60_60_starty2010,neff55_60_starty2010, -* neff70_75_starty2010,neff75_80_starty2010,neff80_85_starty2010 -* neff75_85_starty2010,neff85_85_starty2010 - -$setglobal c50_scen_neff_pasture constant -$setglobal c50_scen_neff_pasture_noselect constant -* options: constant, -* neff55_55_starty1990,neff60_60_starty1990,neff65_70_starty1990, -* neff65_70_starty2010,neff60_60_starty2010,neff55_60_starty2010, -* neff70_75_starty2010,neff75_80_starty2010,neff80_85_starty2010 -* neff75_85_starty2010 +$setglobal c50_scen_neff baseeff_add3_add5_add10_max65 +$setglobal c50_scen_neff_noselect baseeff_add3_add5_add10_max65 +* constant, baseeff_add3_add15_add25_max75, +* baseeff_add3_add15_add25_max65, baseeff_add3_add10_add20_max75, +* baseeff_add3_add5_add10_max65, baseeff_add3_add0_add0_max55, +* baseeff_add3_add10_add15_max75, baseeff_add3_add5_add15_max75, +* maxeff_add3_glo75_glo85, maxeff_add3_glo75_glo80, +* maxeff_add3_glo60_glo65, maxeff_add3_glo65_glo75, +* maxeff_ZhangBy2030, maxeff_ZhangBy2050 / + +$setglobal c50_scen_neff_pasture constant_min55_min60_min65 +$setglobal c50_scen_neff_pasture_noselect constant_min55_min60_min65 +* constant, constant_min55_min60_min65 $setglobal c50_dep_scen history * options: history scalar s50_fertilizer_costs Costs of fertilizer (USD05MER per tN) / 600 / + s50_maccs_global_ef Do maccs assume global emission factor (binary) /1/ + s50_maccs_implicit_nue_glo Global nitrogen use efficiency implicit to MACCs /0.5/ ; * Set-switch for countries affected by country-specific neff scenarios @@ -86,17 +86,17 @@ sets VIR,VNM,VUT,WLF,WSM,YEM,ZAF,ZMB,ZWE / ; -parameter f50_snupe(t_all,i,scen_neff50) selected scenario values for soil nitrogen uptake efficiency (1) +parameter f50_snupe_base(t_all,i,scen_neff_cropland50) selected scenario values for soil nitrogen uptake efficiency (1) / $ondelim -$include "./modules/50_nr_soil_budget/input/f50_snupe.cs4" +$include "./modules/50_nr_soil_budget/input/f50_snupe_base.cs4" $offdelim /; -parameter f50_nue_pasture(t_all,i,scen_neff50) selected scenario values for soil nitrogen uptake efficiency (1) +parameter f50_nue_base_pasture(t_all,i,scen_neff_pasture50) selected scenario values for soil nitrogen uptake efficiency (1) / $ondelim -$include "./modules/50_nr_soil_budget/input/f50_nue_pasture.cs4" +$include "./modules/50_nr_soil_budget/input/f50_nue_base_pasture.cs4" $offdelim /; diff --git a/modules/50_nr_soil_budget/exoeff_aug16/postsolve.gms b/modules/50_nr_soil_budget/macceff_aug22/postsolve.gms similarity index 100% rename from modules/50_nr_soil_budget/exoeff_aug16/postsolve.gms rename to modules/50_nr_soil_budget/macceff_aug22/postsolve.gms diff --git a/modules/50_nr_soil_budget/exoeff_aug16/presolve.gms b/modules/50_nr_soil_budget/macceff_aug22/preloop.gms similarity index 53% rename from modules/50_nr_soil_budget/exoeff_aug16/presolve.gms rename to modules/50_nr_soil_budget/macceff_aug22/preloop.gms index 69fba9c016..9ae0186e01 100644 --- a/modules/50_nr_soil_budget/exoeff_aug16/presolve.gms +++ b/modules/50_nr_soil_budget/macceff_aug22/preloop.gms @@ -1,3 +1,4 @@ + *** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) *** | authors, and contributors see CITATION.cff file. This file is part *** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of @@ -5,6 +6,7 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de + * Country switches to determine countries for which chosen Neff scenario * shall be applied. * In the default case, the scenarios affects all countries when activated. @@ -19,16 +21,24 @@ p50_cropneff_region_shr(t,i) = sum(i_to_iso(i,iso), p50_country_dummy_cropneff(i p50_pastneff_region_shr(t,i) = sum(i_to_iso(i,iso), p50_country_dummy_pastneff(iso) * im_pop_iso(t,iso)) / sum(i_to_iso(i,iso), im_pop_iso(t,iso)); * Nitrogen use efficiency -if(m_year(t) <= sm_fix_SSP2, - vm_nr_eff.fx(i) = f50_snupe(t,i,"neff60_60_starty2010") * p50_cropneff_region_shr(t,i) - + f50_snupe(t,i,"neff60_60_starty2010") * (1-p50_cropneff_region_shr(t,i)); - vm_nr_eff_pasture.fx(i) = f50_nue_pasture(t,i,"constant") * p50_pastneff_region_shr(t,i) - + f50_nue_pasture(t,i,"constant") * (1-p50_pastneff_region_shr(t,i)); -else - vm_nr_eff.fx(i) = f50_snupe(t,i,"%c50_scen_neff%") * p50_cropneff_region_shr(t,i) - + f50_snupe(t,i,"%c50_scen_neff_noselect%") * (1-p50_cropneff_region_shr(t,i)); - vm_nr_eff_pasture.fx(i) = f50_nue_pasture(t,i,"%c50_scen_neff_pasture%") * p50_pastneff_region_shr(t,i) - + f50_nue_pasture(t,i,"%c50_scen_neff_pasture_noselect%") * (1-p50_pastneff_region_shr(t,i)); +loop(t, + + if(m_year(t) <= sm_fix_SSP2, + + i50_nr_eff_bau(t,i) = f50_snupe_base(t,i,"baseeff_add3_add5_add10_max65") * p50_cropneff_region_shr(t,i) + + f50_snupe_base(t,i,"baseeff_add3_add5_add10_max65") * (1-p50_cropneff_region_shr(t,i)); + i50_nr_eff_pasture_bau(t,i) = f50_nue_base_pasture(t,i,"constant_min55_min60_min65") * p50_pastneff_region_shr(t,i) + + f50_nue_base_pasture(t,i,"constant_min55_min60_min65") * (1-p50_pastneff_region_shr(t,i)); + + else + + i50_nr_eff_bau(t,i) = f50_snupe_base(t,i,"%c50_scen_neff%") * p50_cropneff_region_shr(t,i) + + f50_snupe_base(t,i,"%c50_scen_neff_noselect%") * (1-p50_cropneff_region_shr(t,i)); + i50_nr_eff_pasture_bau(t,i) = f50_nue_base_pasture(t,i,"%c50_scen_neff_pasture%") * p50_pastneff_region_shr(t,i) + + f50_nue_base_pasture(t,i,"%c50_scen_neff_pasture_noselect%") * (1-p50_pastneff_region_shr(t,i)); + + ); ); -i50_atmospheric_deposition_rates(t,j,land)=f50_atmospheric_deposition_rates(t,j,land,"%c50_dep_scen%"); +* selecting the scenario for atmospheric deposition + i50_atmospheric_deposition_rates(t,j,land)=f50_atmospheric_deposition_rates(t,j,land,"%c50_dep_scen%"); diff --git a/modules/50_nr_soil_budget/macceff_aug22/presolve.gms b/modules/50_nr_soil_budget/macceff_aug22/presolve.gms new file mode 100644 index 0000000000..dee0324624 --- /dev/null +++ b/modules/50_nr_soil_budget/macceff_aug22/presolve.gms @@ -0,0 +1,79 @@ +*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @code +*' We first need to transform the MACC curves from a format where they are a function +*' of inputs (approach 1, IPCC) to a function of losses (approach 2, MAgPIE). +*' Approach 2 is more consistent, as emissions can only come from losses, and +*' in the case of nitrogen use efficiency (NUE=I/H), losses (L=I-H) are zero, +*' but approach 1 would still come up with positive emissions. +*' The two approaches (see module 51_nitrogen) are +*' +*' (1) E_1 = I_1 * EF * (1 - MACCs_O) +*' +*' (2) E_2 = I_2 * (1 - NUE_2) / (1 - NUE_ef) * EF +*' +*' with the further condition: +*' +*' (3) H = I_i * NUE_i +*' +*' (4) (1 - NUE_2) = (1 - NUE_b) * (1 - MACCs_T) +*' +*' E: emissions, I: nutrient inputs, EF: emission factor, +*' NUE: nitrogen use efficiency, H: harvested N +*' NUE_ef: the nitrogen use efficiency for which the EF is made +*' NUE_2: nitrogen use efficiency in our model +*' NUE_b: baseline nitrogen use efficiency before application of MACCs +*' MACCs_O: original MACCs to be applied on fertilizer application +*' MACCs_T: transformed MACCs to be applied on nitrogen surplus +*' +*' We want to derive Maccs_T under the condition that the measured reduction of +*' emissions (R = E / Eb) in both approaches remains equal. +*' combining 1 + 3 and 2 + 3 + +*' (4) R_1 = H / NUE_b * EF * (1 - MACCs_O) / (H / NUE_b * EF) +*' (5) R_2 = (H / NUE2 * (1 - NUE2) / (1 - NUE_ef) * EF) / (H / NUE_b * (1 - NUE_b) / (1 - NUE_ef) * EF) +*' (4+5) MACCs_T = MACCs_O * NUE_b / (1 + MACCs_O * (NUE_b - 1)) + +*' If the MACCs are expressed relative to a changing emission factor, this could +*' be accomodated in equation 4. Currently we assume a constant emission factor +*' implicit to the MACCs. +*' The year of NUE_ef should be fixed to the baseyear efficiency, as +*' alternative "baseline" improvements would otherwise not reduce the +*' mitigation potential of the MACCs. +*' If the MACCs relate to a global emission factor NUE_ef should be the global +*' NUE, otherwise the regional NUE. +*' The name of the MACC category "inorg_fert_n2o" actually includes all types +*' of soil N2O emissions. Most of these measures also reduce general Nr surpluses. +*' We therefor apply it here to Nr soil efficiency more generally. + +if(s50_maccs_global_ef = 1, + i50_maccs_mitigation_transf(t,i) = + im_maccs_mitigation(t,i,"inorg_fert","n2o_n_direct")*s50_maccs_implicit_nue_glo / (1 + im_maccs_mitigation(t,i,"inorg_fert","n2o_n_direct") * (s50_maccs_implicit_nue_glo - 1)); + i50_maccs_mitigation_pasture_transf(t,i) = + im_maccs_mitigation(t,i,"inorg_fert","n2o_n_direct")*s50_maccs_implicit_nue_glo / (1 + im_maccs_mitigation(t,i,"inorg_fert","n2o_n_direct") * (s50_maccs_implicit_nue_glo - 1)); +else + i50_maccs_mitigation_transf(t,i) = + im_maccs_mitigation(t,i,"inorg_fert","n2o_n_direct")*i50_nr_eff_bau("y2010",i) / (1 + im_maccs_mitigation(t,i,"inorg_fert","n2o_n_direct") * (i50_nr_eff_bau("y2010",i) - 1)); + i50_maccs_mitigation_pasture_transf(t,i) = + im_maccs_mitigation(t,i,"inorg_fert","n2o_n_direct")*i50_nr_eff_pasture_bau("y2010",i) / (1 + im_maccs_mitigation(t,i,"inorg_fert","n2o_n_direct") * (i50_nr_eff_pasture_bau("y2010",i) - 1)); +); + +*' After transformation of the MACCs, we can calculate NUE_2 (vm_nr_eff) as the +*' result of a baseline NUE improvement and an MACC-driven further increase of NUE. +*' The nitrogen use efficiency is the inverse of the nitrogen loss share. +*' The loss share is estimated as a baseline loss share that describes the +*' baseline technological improvement of NUE, and a reduction of this loss +*' share by technical mitigation. +*' We assume that the MACCs reduce the remaining losses proportional, so that +*' emissions cannot become negative, and the baseline improvement reduces the +*' mitigation potential of the MACCs. + + vm_nr_eff.fx(i) = 1 - (1-i50_nr_eff_bau(t,i)) * (1 - i50_maccs_mitigation_transf(t,i)); + vm_nr_eff_pasture.fx(i)= 1 - (1-i50_nr_eff_pasture_bau(t,i)) * (1 - i50_maccs_mitigation_pasture_transf(t,i)); + +*' @stop diff --git a/modules/50_nr_soil_budget/exoeff_aug16/realization.gms b/modules/50_nr_soil_budget/macceff_aug22/realization.gms similarity index 73% rename from modules/50_nr_soil_budget/exoeff_aug16/realization.gms rename to modules/50_nr_soil_budget/macceff_aug22/realization.gms index 7fce4175b5..fb48f411c4 100644 --- a/modules/50_nr_soil_budget/exoeff_aug16/realization.gms +++ b/modules/50_nr_soil_budget/macceff_aug22/realization.gms @@ -5,15 +5,16 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -*' @description This realization calculates the nitrogen balance for crop land and pasture land +*' @description This realization calculates the nitrogen balance for crop land and pasture land *' using exogenous uptake efficiencies. Several scenarios are available for the efficiency. *####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/50_nr_soil_budget/exoeff_aug16/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/50_nr_soil_budget/exoeff_aug16/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/50_nr_soil_budget/exoeff_aug16/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/50_nr_soil_budget/exoeff_aug16/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/50_nr_soil_budget/exoeff_aug16/scaling.gms" -$Ifi "%phase%" == "presolve" $include "./modules/50_nr_soil_budget/exoeff_aug16/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/50_nr_soil_budget/exoeff_aug16/postsolve.gms" +$Ifi "%phase%" == "sets" $include "./modules/50_nr_soil_budget/macceff_aug22/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/50_nr_soil_budget/macceff_aug22/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/50_nr_soil_budget/macceff_aug22/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/50_nr_soil_budget/macceff_aug22/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/50_nr_soil_budget/macceff_aug22/scaling.gms" +$Ifi "%phase%" == "preloop" $include "./modules/50_nr_soil_budget/macceff_aug22/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/50_nr_soil_budget/macceff_aug22/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/50_nr_soil_budget/macceff_aug22/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/50_nr_soil_budget/exoeff_aug16/scaling.gms b/modules/50_nr_soil_budget/macceff_aug22/scaling.gms similarity index 100% rename from modules/50_nr_soil_budget/exoeff_aug16/scaling.gms rename to modules/50_nr_soil_budget/macceff_aug22/scaling.gms diff --git a/modules/50_nr_soil_budget/exoeff_aug16/sets.gms b/modules/50_nr_soil_budget/macceff_aug22/sets.gms similarity index 52% rename from modules/50_nr_soil_budget/exoeff_aug16/sets.gms rename to modules/50_nr_soil_budget/macceff_aug22/sets.gms index f905769f13..23f2b7a7bb 100644 --- a/modules/50_nr_soil_budget/exoeff_aug16/sets.gms +++ b/modules/50_nr_soil_budget/macceff_aug22/sets.gms @@ -10,12 +10,17 @@ sets deposition_source51 Source of atmospheric deposition / agricultural_magpie, other_exogenous / -scen_neff50 Scenario for uptake efficiency -/ constant,neff_ZhangBy2030_start2010,neff_ZhangBy2050_start2010, -neff55_55_starty1990,neff60_60_starty1990,neff65_70_starty1990, -neff65_70_starty2010,neff60_60_starty2010,neff55_60_starty2010, -neff70_75_starty2010,neff75_80_starty2010,neff80_85_starty2010, -neff75_85_starty2010,neff85_85_starty2010 / +scen_neff_cropland50 Scenario for SNUpE on croplands +/ constant, baseeff_add3_add15_add25_max75, +baseeff_add3_add15_add25_max65, baseeff_add3_add10_add20_max75, +baseeff_add3_add5_add10_max65, baseeff_add3_add0_add0_max55, +baseeff_add3_add10_add15_max75, baseeff_add3_add5_add15_max75, +maxeff_add3_glo75_glo85, maxeff_add3_glo75_glo80, +maxeff_add3_glo60_glo65, maxeff_add3_glo65_glo75, +maxeff_ZhangBy2030, maxeff_ZhangBy2050 / + +scen_neff_pasture50 Scenario for NUE on pastures +/constant, constant_min55_min60_min65/ dep_scen50 Scenario for atmospheric deposition /history/ diff --git a/modules/50_nr_soil_budget/module.gms b/modules/50_nr_soil_budget/module.gms index 5cf58c2481..4abf256c38 100644 --- a/modules/50_nr_soil_budget/module.gms +++ b/modules/50_nr_soil_budget/module.gms @@ -13,6 +13,5 @@ *' @authors Benjamin Bodirsky *###################### R SECTION START (MODULETYPES) ########################## -$Ifi "%nr_soil_budget%" == "exoeff_aug16" $include "./modules/50_nr_soil_budget/exoeff_aug16/realization.gms" -$Ifi "%nr_soil_budget%" == "off" $include "./modules/50_nr_soil_budget/off/realization.gms" +$Ifi "%nr_soil_budget%" == "macceff_aug22" $include "./modules/50_nr_soil_budget/macceff_aug22/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/50_nr_soil_budget/off/declarations.gms b/modules/50_nr_soil_budget/off/declarations.gms deleted file mode 100644 index 1b8de3c075..0000000000 --- a/modules/50_nr_soil_budget/off/declarations.gms +++ /dev/null @@ -1,22 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -positive variables - vm_nr_inorg_fert_reg(i,land_ag) Inorganic fertilizer application (Tg N per yr) - vm_nr_inorg_fert_costs(i) Cost of inorganic fertiliuers (mio. USD05MER per yr) - vm_nr_eff(i) Cropland nutrient uptake efficiency (Tg N per yr) - vm_nr_eff_pasture(i) Pasture nutrient uptake efficiency (Tg N per yr) -; - -*#################### R SECTION START (OUTPUT DECLARATIONS) #################### -parameters - ov_nr_inorg_fert_reg(t,i,land_ag,type) Inorganic fertilizer application (Tg N per yr) - ov_nr_inorg_fert_costs(t,i,type) Cost of inorganic fertiliuers (mio. USD05MER per yr) - ov_nr_eff(t,i,type) Cropland nutrient uptake efficiency (Tg N per yr) - ov_nr_eff_pasture(t,i,type) Pasture nutrient uptake efficiency (Tg N per yr) -; -*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/50_nr_soil_budget/off/not_used.txt b/modules/50_nr_soil_budget/off/not_used.txt deleted file mode 100644 index 10c5454f93..0000000000 --- a/modules/50_nr_soil_budget/off/not_used.txt +++ /dev/null @@ -1,22 +0,0 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -# | authors, and contributors see CITATION.cff file. This file is part -# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -# | AGPL-3.0, you are granted additional permissions described in the -# | MAgPIE License Exception, version 1.0 (see LICENSE file). -# | Contact: magpie@pik-potsdam.de - -name,type,reason -vm_nr_som_fertilizer, input, not needed -vm_area,input,not needed -vm_manure,input, not needed -vm_manure_recycling,input, not needed -vm_res_recycling,input, not needed -vm_res_biomass_ag,input, not needed -vm_res_biomass_bg,input, not needed -fm_attributes,input, not needed -vm_prod_reg,input, not needed -vm_dem_seed,input, not needed -vm_land,input,questionnaire -sm_fix_SSP2, input, not used -im_pop_iso, input, not used -vm_fallow,input,questionnaire diff --git a/modules/50_nr_soil_budget/off/postsolve.gms b/modules/50_nr_soil_budget/off/postsolve.gms deleted file mode 100644 index 73231fc214..0000000000 --- a/modules/50_nr_soil_budget/off/postsolve.gms +++ /dev/null @@ -1,28 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - - - -*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_nr_inorg_fert_reg(t,i,land_ag,"marginal") = vm_nr_inorg_fert_reg.m(i,land_ag); - ov_nr_inorg_fert_costs(t,i,"marginal") = vm_nr_inorg_fert_costs.m(i); - ov_nr_eff(t,i,"marginal") = vm_nr_eff.m(i); - ov_nr_eff_pasture(t,i,"marginal") = vm_nr_eff_pasture.m(i); - ov_nr_inorg_fert_reg(t,i,land_ag,"level") = vm_nr_inorg_fert_reg.l(i,land_ag); - ov_nr_inorg_fert_costs(t,i,"level") = vm_nr_inorg_fert_costs.l(i); - ov_nr_eff(t,i,"level") = vm_nr_eff.l(i); - ov_nr_eff_pasture(t,i,"level") = vm_nr_eff_pasture.l(i); - ov_nr_inorg_fert_reg(t,i,land_ag,"upper") = vm_nr_inorg_fert_reg.up(i,land_ag); - ov_nr_inorg_fert_costs(t,i,"upper") = vm_nr_inorg_fert_costs.up(i); - ov_nr_eff(t,i,"upper") = vm_nr_eff.up(i); - ov_nr_eff_pasture(t,i,"upper") = vm_nr_eff_pasture.up(i); - ov_nr_inorg_fert_reg(t,i,land_ag,"lower") = vm_nr_inorg_fert_reg.lo(i,land_ag); - ov_nr_inorg_fert_costs(t,i,"lower") = vm_nr_inorg_fert_costs.lo(i); - ov_nr_eff(t,i,"lower") = vm_nr_eff.lo(i); - ov_nr_eff_pasture(t,i,"lower") = vm_nr_eff_pasture.lo(i); -*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### - diff --git a/modules/50_nr_soil_budget/off/realization.gms b/modules/50_nr_soil_budget/off/realization.gms deleted file mode 100644 index ff1842ecb0..0000000000 --- a/modules/50_nr_soil_budget/off/realization.gms +++ /dev/null @@ -1,14 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @description This realization sets the demand for inorganic fertilizer and associated costs to zero. - -*####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "declarations" $include "./modules/50_nr_soil_budget/off/declarations.gms" -$Ifi "%phase%" == "preloop" $include "./modules/50_nr_soil_budget/off/preloop.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/50_nr_soil_budget/off/postsolve.gms" -*######################## R SECTION END (PHASES) ############################### diff --git a/modules/51_nitrogen/input/files b/modules/51_nitrogen/input/files deleted file mode 100644 index b0e4c6f64c..0000000000 --- a/modules/51_nitrogen/input/files +++ /dev/null @@ -1,4 +0,0 @@ -* list of files that are required here -f51_ipcc_ef.csv -f51_ef_n_soil.cs3 -f51_ef_n_soil_reg.cs3 diff --git a/modules/51_nitrogen/ipcc2006_sep16/declarations.gms b/modules/51_nitrogen/ipcc2006_sep16/declarations.gms deleted file mode 100644 index 15d38f0f2d..0000000000 --- a/modules/51_nitrogen/ipcc2006_sep16/declarations.gms +++ /dev/null @@ -1,34 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -equations - q51_emissions_inorg_fert(i,n_pollutants_direct) estimates various emission types X from inorganic fertilizer before technical mitigation (Mt X-N) - q51_emissions_man_crop(i,n_pollutants_direct) estimates various emission types X from manure on cropland before technical mitigation (Mt X-N) - q51_emissions_resid(i,n_pollutants_direct) estimates various emission types X from residues before technical mitigation (Mt X-N) - q51_emissions_resid_burn(i,n_pollutants_direct) estimates various emission types X from residues burning (Mt X-N) - q51_emissions_som(i,n_pollutants_direct) estimates various emission types X from soil organic matter loss before technical mitigation (Mt X-N) - q51_emissionbal_man_past(i,n_pollutants_direct) estimates various emission types X from manure on pasture land before technical mitigation (Mt X-N) - q51_emissionbal_awms(i,n_pollutants_direct) estimates various emission types X from animal waste management systems before technical mitigation (Mt X-N) - q51_emissions_indirect_n2o(i,emis_source_n51) estimates various emission types X from volatilisation and leaching (Mt X-N) -; - -parameters - i51_ef_n_soil(t,i,n_pollutants_direct,emis_source_n_cropsoils51) emission factors for nitrogen emissions from cropland soils -; - -*#################### R SECTION START (OUTPUT DECLARATIONS) #################### -parameters - oq51_emissions_inorg_fert(t,i,n_pollutants_direct,type) estimates various emission types X from inorganic fertilizer before technical mitigation (Mt X-N) - oq51_emissions_man_crop(t,i,n_pollutants_direct,type) estimates various emission types X from manure on cropland before technical mitigation (Mt X-N) - oq51_emissions_resid(t,i,n_pollutants_direct,type) estimates various emission types X from residues before technical mitigation (Mt X-N) - oq51_emissions_resid_burn(t,i,n_pollutants_direct,type) estimates various emission types X from residues burning (Mt X-N) - oq51_emissions_som(t,i,n_pollutants_direct,type) estimates various emission types X from soil organic matter loss before technical mitigation (Mt X-N) - oq51_emissionbal_man_past(t,i,n_pollutants_direct,type) estimates various emission types X from manure on pasture land before technical mitigation (Mt X-N) - oq51_emissionbal_awms(t,i,n_pollutants_direct,type) estimates various emission types X from animal waste management systems before technical mitigation (Mt X-N) - oq51_emissions_indirect_n2o(t,i,emis_source_n51,type) estimates various emission types X from volatilisation and leaching (Mt X-N) -; -*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/51_nitrogen/ipcc2006_sep16/equations.gms b/modules/51_nitrogen/ipcc2006_sep16/equations.gms deleted file mode 100644 index da99762f12..0000000000 --- a/modules/51_nitrogen/ipcc2006_sep16/equations.gms +++ /dev/null @@ -1,73 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @equations - -*' Nitrogeneous emissions stem from manure applied to croplands, inorganic fertilizers, -*' crop residues decaying on fields, soil organic matter loss, animal waste management, and -*' manure excreted on pasture land. Additionally, part of the NH3 and NOx emissions -*' as well as leached NO3 later result in indirect emissions of N2O when they are redeposited, -*' nitrified and dinitrified. -*' -*' Manure applied to croplands: - q51_emissions_man_crop(i2,n_pollutants_direct).. - vm_btm_reg(i2,"man_crop",n_pollutants_direct) - =e= - vm_manure_recycling(i2,"nr") - * sum(ct, i51_ef_n_soil(ct,i2,n_pollutants_direct,"man_crop")); - -*' inorganic fertilizers: - q51_emissions_inorg_fert(i2,n_pollutants_direct).. - vm_btm_reg(i2,"inorg_fert",n_pollutants_direct) - =e= - sum(land_ag,vm_nr_inorg_fert_reg(i2,land_ag)) - * sum(ct, i51_ef_n_soil(ct,i2,n_pollutants_direct,"inorg_fert")); - -*' crop residues decaying on fields: - q51_emissions_resid(i2,n_pollutants_direct).. - vm_btm_reg(i2,"resid",n_pollutants_direct) - =e= - vm_res_recycling(i2,"nr") * sum(ct, i51_ef_n_soil(ct,i2,n_pollutants_direct,"resid")); - -*' emissions from burning crop residues, N2O and NOx - q51_emissions_resid_burn(i2,n_pollutants_direct).. - vm_btm_reg(i2,"resid_burn",n_pollutants_direct) - =e= - sum(kcr, vm_res_ag_burn(i2,kcr,"dm")) * f51_ef_resid_burn(n_pollutants_direct); - -*' soil organic matter loss: - q51_emissions_som(i2,n_pollutants_direct).. - vm_btm_reg(i2,"som",n_pollutants_direct) - =e= - sum(cell(i2,j2),vm_nr_som(j2)) * sum(ct, i51_ef_n_soil(ct,i2,n_pollutants_direct,"som")); - -*' animal waste management: - q51_emissionbal_awms(i2,n_pollutants_direct) .. - vm_btm_reg(i2,"awms",n_pollutants_direct) - =e= - sum((kli,awms_conf), - vm_manure_confinement(i2,kli,awms_conf,"nr") - * f51_ef3_confinement(i2,kli,awms_conf,n_pollutants_direct)); - -*' and manure excreted on pasture land: - q51_emissionbal_man_past(i2,n_pollutants_direct) .. - vm_btm_reg(i2,"man_past",n_pollutants_direct) - =e= - sum((awms_prp,kli), - vm_manure(i2, kli, awms_prp, "nr") - * f51_ef3_prp(i2,n_pollutants_direct,kli)); - -*' Indirect emissions from NH3, NOx and NO3: - q51_emissions_indirect_n2o(i2,emis_source_n51) .. - vm_btm_reg(i2,emis_source_n51,"n2o_n_indirect") - =e= - sum(pollutant_nh3no2_51,vm_emissions_reg(i2,emis_source_n51,pollutant_nh3no2_51)) - * f51_ipcc_ef("ef_4","best") - + vm_emissions_reg(i2,emis_source_n51,"no3_n") - * f51_ipcc_ef("ef_5","best"); - -*** EOF constraints.gms *** diff --git a/modules/51_nitrogen/ipcc2006_sep16/input.gms b/modules/51_nitrogen/ipcc2006_sep16/input.gms deleted file mode 100644 index de02c48fab..0000000000 --- a/modules/51_nitrogen/ipcc2006_sep16/input.gms +++ /dev/null @@ -1,42 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - - - -table f51_ipcc_ef(ipcc_ef51,emis_uncertainty51) ipcc emission factors for various emission types X (tX-N per tN) -$ondelim -$include "./modules/51_nitrogen/input/f51_ipcc_ef.csv" -$offdelim -; - -table f51_ef_n_soil(t_all,i,n_pollutants_direct,emis_source_n_cropsoils51) ipcc emission factors for various emission types X (tX-N per tN) -$ondelim -$include "./modules/51_nitrogen/input/f51_ef_n_soil_reg.cs3" -$offdelim -; - -parameter f51_ef3_confinement(i,kli,awms_conf,n_pollutants_direct) emissions from manure managed in confinement for various emission types X (tX-N per tN) -/ -$ondelim -$include "./modules/51_nitrogen/ipcc2006_sep16/input/f51_ef3_confinement.cs4" -$offdelim -/ -; - -parameter f51_ef3_prp(i,n_pollutants_direct,kli) emissions from manure on pasture range and paddocks for various emission types X (tX-N per tN) -/ -$ondelim -$include "./modules/51_nitrogen/ipcc2006_sep16/input/f51_ef3_prp.cs4" -$offdelim -/; - -parameter f51_ef_resid_burn(n_pollutants_direct) emission factor for residual burning (tX-N per t DM) -/ -$ondelim -$include "./modules/51_nitrogen/ipcc2006_sep16/input/f51_ef_resid_burn.cs4" -$offdelim -/; diff --git a/modules/51_nitrogen/ipcc2006_sep16/input/files b/modules/51_nitrogen/ipcc2006_sep16/input/files deleted file mode 100644 index 87b30d104d..0000000000 --- a/modules/51_nitrogen/ipcc2006_sep16/input/files +++ /dev/null @@ -1,4 +0,0 @@ -* list of files that are required here -f51_ef3_confinement.cs4 -f51_ef3_prp.cs4 -f51_ef_resid_burn.cs4 \ No newline at end of file diff --git a/modules/51_nitrogen/ipcc2006_sep16/not_used.txt b/modules/51_nitrogen/ipcc2006_sep16/not_used.txt deleted file mode 100644 index 7bb19c7dd2..0000000000 --- a/modules/51_nitrogen/ipcc2006_sep16/not_used.txt +++ /dev/null @@ -1,9 +0,0 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -# | authors, and contributors see CITATION.cff file. This file is part -# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -# | AGPL-3.0, you are granted additional permissions described in the -# | MAgPIE License Exception, version 1.0 (see LICENSE file). -# | Contact: magpie@pik-potsdam.de -name,type,reason -vm_nr_eff,input,not needed -vm_nr_eff_pasture,input,not needed diff --git a/modules/51_nitrogen/ipcc2006_sep16/postsolve.gms b/modules/51_nitrogen/ipcc2006_sep16/postsolve.gms deleted file mode 100644 index ac28136098..0000000000 --- a/modules/51_nitrogen/ipcc2006_sep16/postsolve.gms +++ /dev/null @@ -1,43 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - - - -*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - oq51_emissions_inorg_fert(t,i,n_pollutants_direct,"marginal") = q51_emissions_inorg_fert.m(i,n_pollutants_direct); - oq51_emissions_man_crop(t,i,n_pollutants_direct,"marginal") = q51_emissions_man_crop.m(i,n_pollutants_direct); - oq51_emissions_resid(t,i,n_pollutants_direct,"marginal") = q51_emissions_resid.m(i,n_pollutants_direct); - oq51_emissions_resid_burn(t,i,n_pollutants_direct,"marginal") = q51_emissions_resid_burn.m(i,n_pollutants_direct); - oq51_emissions_som(t,i,n_pollutants_direct,"marginal") = q51_emissions_som.m(i,n_pollutants_direct); - oq51_emissionbal_man_past(t,i,n_pollutants_direct,"marginal") = q51_emissionbal_man_past.m(i,n_pollutants_direct); - oq51_emissionbal_awms(t,i,n_pollutants_direct,"marginal") = q51_emissionbal_awms.m(i,n_pollutants_direct); - oq51_emissions_indirect_n2o(t,i,emis_source_n51,"marginal") = q51_emissions_indirect_n2o.m(i,emis_source_n51); - oq51_emissions_inorg_fert(t,i,n_pollutants_direct,"level") = q51_emissions_inorg_fert.l(i,n_pollutants_direct); - oq51_emissions_man_crop(t,i,n_pollutants_direct,"level") = q51_emissions_man_crop.l(i,n_pollutants_direct); - oq51_emissions_resid(t,i,n_pollutants_direct,"level") = q51_emissions_resid.l(i,n_pollutants_direct); - oq51_emissions_resid_burn(t,i,n_pollutants_direct,"level") = q51_emissions_resid_burn.l(i,n_pollutants_direct); - oq51_emissions_som(t,i,n_pollutants_direct,"level") = q51_emissions_som.l(i,n_pollutants_direct); - oq51_emissionbal_man_past(t,i,n_pollutants_direct,"level") = q51_emissionbal_man_past.l(i,n_pollutants_direct); - oq51_emissionbal_awms(t,i,n_pollutants_direct,"level") = q51_emissionbal_awms.l(i,n_pollutants_direct); - oq51_emissions_indirect_n2o(t,i,emis_source_n51,"level") = q51_emissions_indirect_n2o.l(i,emis_source_n51); - oq51_emissions_inorg_fert(t,i,n_pollutants_direct,"upper") = q51_emissions_inorg_fert.up(i,n_pollutants_direct); - oq51_emissions_man_crop(t,i,n_pollutants_direct,"upper") = q51_emissions_man_crop.up(i,n_pollutants_direct); - oq51_emissions_resid(t,i,n_pollutants_direct,"upper") = q51_emissions_resid.up(i,n_pollutants_direct); - oq51_emissions_resid_burn(t,i,n_pollutants_direct,"upper") = q51_emissions_resid_burn.up(i,n_pollutants_direct); - oq51_emissions_som(t,i,n_pollutants_direct,"upper") = q51_emissions_som.up(i,n_pollutants_direct); - oq51_emissionbal_man_past(t,i,n_pollutants_direct,"upper") = q51_emissionbal_man_past.up(i,n_pollutants_direct); - oq51_emissionbal_awms(t,i,n_pollutants_direct,"upper") = q51_emissionbal_awms.up(i,n_pollutants_direct); - oq51_emissions_indirect_n2o(t,i,emis_source_n51,"upper") = q51_emissions_indirect_n2o.up(i,emis_source_n51); - oq51_emissions_inorg_fert(t,i,n_pollutants_direct,"lower") = q51_emissions_inorg_fert.lo(i,n_pollutants_direct); - oq51_emissions_man_crop(t,i,n_pollutants_direct,"lower") = q51_emissions_man_crop.lo(i,n_pollutants_direct); - oq51_emissions_resid(t,i,n_pollutants_direct,"lower") = q51_emissions_resid.lo(i,n_pollutants_direct); - oq51_emissions_resid_burn(t,i,n_pollutants_direct,"lower") = q51_emissions_resid_burn.lo(i,n_pollutants_direct); - oq51_emissions_som(t,i,n_pollutants_direct,"lower") = q51_emissions_som.lo(i,n_pollutants_direct); - oq51_emissionbal_man_past(t,i,n_pollutants_direct,"lower") = q51_emissionbal_man_past.lo(i,n_pollutants_direct); - oq51_emissionbal_awms(t,i,n_pollutants_direct,"lower") = q51_emissionbal_awms.lo(i,n_pollutants_direct); - oq51_emissions_indirect_n2o(t,i,emis_source_n51,"lower") = q51_emissions_indirect_n2o.lo(i,emis_source_n51); -*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/51_nitrogen/ipcc2006_sep16/preloop.gms b/modules/51_nitrogen/ipcc2006_sep16/preloop.gms deleted file mode 100644 index b2082a865f..0000000000 --- a/modules/51_nitrogen/ipcc2006_sep16/preloop.gms +++ /dev/null @@ -1,10 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -vm_btm_reg.fx(i,emis_source,n_pollutants) = 0; -vm_btm_reg.lo(i,emis_source_n51,n_pollutants) = -Inf; -vm_btm_reg.up(i,emis_source_n51,n_pollutants) = Inf; diff --git a/modules/51_nitrogen/ipcc2006_sep16/presolve.gms b/modules/51_nitrogen/ipcc2006_sep16/presolve.gms deleted file mode 100644 index ed691cf4d4..0000000000 --- a/modules/51_nitrogen/ipcc2006_sep16/presolve.gms +++ /dev/null @@ -1,16 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -* leaching emissions are dynamic with climate for the history; -* for the future, for now we keep them constant at 2010 levels. - if (sum(sameas(t_past,t),1) = 1, - i51_ef_n_soil(t,i,n_pollutants_direct,emis_source_n_cropsoils51) = - f51_ef_n_soil(t,i,n_pollutants_direct,emis_source_n_cropsoils51); - else - i51_ef_n_soil(t,i,n_pollutants_direct,emis_source_n_cropsoils51)= - i51_ef_n_soil(t-1,i,n_pollutants_direct,emis_source_n_cropsoils51); - ); diff --git a/modules/51_nitrogen/ipcc2006_sep16/realization.gms b/modules/51_nitrogen/ipcc2006_sep16/realization.gms deleted file mode 100644 index fab05d05d9..0000000000 --- a/modules/51_nitrogen/ipcc2006_sep16/realization.gms +++ /dev/null @@ -1,29 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @description -*' The nitrogen module calculates nitrogeneous emissions before technical -*' mitigation, including N2O, NOx, NH3, NO3- and N2. -*' The model receives information on nitrogen flows from [50_nr_soil_budget], -*' [55_awms], [18_residues], [59_som], and it provides the emissions to the -*' module [56_ghg_policy]. -*' Emissions factors estimates are largely based on the IPCC 2006 Guidelines for -*' National Greenhouse Gas Inventories (@ipcc_2006_2006.), -*' as described in (@bodirsky_current_2012.). -*' -*' @authors Benjamin Leon Bodirsky - -*####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/51_nitrogen/ipcc2006_sep16/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/51_nitrogen/ipcc2006_sep16/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/51_nitrogen/ipcc2006_sep16/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/51_nitrogen/ipcc2006_sep16/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/51_nitrogen/ipcc2006_sep16/scaling.gms" -$Ifi "%phase%" == "preloop" $include "./modules/51_nitrogen/ipcc2006_sep16/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/51_nitrogen/ipcc2006_sep16/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/51_nitrogen/ipcc2006_sep16/postsolve.gms" -*######################## R SECTION END (PHASES) ############################### diff --git a/modules/51_nitrogen/ipcc2006_sep16/sets.gms b/modules/51_nitrogen/ipcc2006_sep16/sets.gms deleted file mode 100644 index a44e81cc1d..0000000000 --- a/modules/51_nitrogen/ipcc2006_sep16/sets.gms +++ /dev/null @@ -1,21 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -sets - emis_uncertainty51 Different estimates for emission parameters - /best,low, high/ - - ipcc_ef51 ipcc Emission factors - /frac_gasf,frac_gasm,frac_leach,frac_leach_h,ef_1,ef_1fr,ef_2,ef_4,ef_5/ - - emis_source_n51(emis_source) Emission sources from agriculture - / inorg_fert, man_crop, awms, resid, resid_burn, man_past, som / - - emis_source_n_cropsoils51(emis_source) activities that lead to emissions - / inorg_fert, man_crop, resid, som, rice / - -; diff --git a/modules/51_nitrogen/module.gms b/modules/51_nitrogen/module.gms index 8ab09d1211..8780659389 100644 --- a/modules/51_nitrogen/module.gms +++ b/modules/51_nitrogen/module.gms @@ -14,7 +14,6 @@ *' @authors Benjamin Leon Bodirsky *###################### R SECTION START (MODULETYPES) ########################## -$Ifi "%nitrogen%" == "ipcc2006_sep16" $include "./modules/51_nitrogen/ipcc2006_sep16/realization.gms" $Ifi "%nitrogen%" == "off" $include "./modules/51_nitrogen/off/realization.gms" $Ifi "%nitrogen%" == "rescaled_jan21" $include "./modules/51_nitrogen/rescaled_jan21/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/51_nitrogen/off/not_used.txt b/modules/51_nitrogen/off/not_used.txt index c80d9923d6..a3d196859a 100644 --- a/modules/51_nitrogen/off/not_used.txt +++ b/modules/51_nitrogen/off/not_used.txt @@ -5,7 +5,6 @@ # | MAgPIE License Exception, version 1.0 (see LICENSE file). # | Contact: magpie@pik-potsdam.de name,type,reason -vm_emissions_reg, input, no emission feedback on deposition vm_manure, input, new flexreg structure vm_manure_confinement, input, new flexreg structure vm_manure_recycling, input, new flexreg structure @@ -15,3 +14,4 @@ vm_nr_inorg_fert_reg, input, not needed vm_nr_som, input, questionnaire vm_nr_eff, input, not needed vm_nr_eff_pasture, input, not needed +im_maccs_mitigation,input,questionnaire diff --git a/modules/51_nitrogen/off/preloop.gms b/modules/51_nitrogen/off/preloop.gms index c7ad15dfd9..ade9c749f0 100644 --- a/modules/51_nitrogen/off/preloop.gms +++ b/modules/51_nitrogen/off/preloop.gms @@ -5,4 +5,4 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -vm_btm_reg.fx(i,emis_source,n_pollutants) = 0; +vm_emissions_reg.fx(i,emis_source,n_pollutants) = 0; diff --git a/modules/51_nitrogen/rescaled_jan21/equations.gms b/modules/51_nitrogen/rescaled_jan21/equations.gms index 8d88aa5c10..d8bcc4b532 100644 --- a/modules/51_nitrogen/rescaled_jan21/equations.gms +++ b/modules/51_nitrogen/rescaled_jan21/equations.gms @@ -15,10 +15,12 @@ *' *' Emissions are rescaled using the nitrogen uptake efficiency. This is done to keep consistency *' of emissions with nitrogen surplus and take account for improved emission factors when NUE increases. +*' The marginal abatement cost curves (MACCs) are already applied at the estimation +*' of the NUE in module 50_nr_soil_budget. *' *' Manure applied to croplands: q51_emissions_man_crop(i2,n_pollutants_direct).. - vm_btm_reg(i2,"man_crop",n_pollutants_direct) + vm_emissions_reg(i2,"man_crop",n_pollutants_direct) =e= vm_manure_recycling(i2,"nr") / (1-s51_snupe_base) * (1-vm_nr_eff(i2)) @@ -26,7 +28,7 @@ *' inorganic fertilizers: q51_emissions_inorg_fert(i2,n_pollutants_direct).. - vm_btm_reg(i2,"inorg_fert",n_pollutants_direct) + vm_emissions_reg(i2,"inorg_fert",n_pollutants_direct) =e= vm_nr_inorg_fert_reg(i2,"crop") / (1-s51_snupe_base) * (1-vm_nr_eff(i2)) @@ -38,35 +40,39 @@ *' crop residues decaying on fields: q51_emissions_resid(i2,n_pollutants_direct).. - vm_btm_reg(i2,"resid",n_pollutants_direct) + vm_emissions_reg(i2,"resid",n_pollutants_direct) =e= vm_res_recycling(i2,"nr") * sum(ct, i51_ef_n_soil(ct,i2,n_pollutants_direct,"resid")) / (1-s51_snupe_base) * (1-vm_nr_eff(i2)); *' emissions from burning crop residues, N2O and NOx q51_emissions_resid_burn(i2,n_pollutants_direct).. - vm_btm_reg(i2,"resid_burn",n_pollutants_direct) + vm_emissions_reg(i2,"resid_burn",n_pollutants_direct) =e= sum(kcr, vm_res_ag_burn(i2,kcr,"dm")) * f51_ef_resid_burn(n_pollutants_direct); *' soil organic matter loss: q51_emissions_som(i2,n_pollutants_direct).. - vm_btm_reg(i2,"som",n_pollutants_direct) + vm_emissions_reg(i2,"som",n_pollutants_direct) =e= sum(cell(i2,j2),vm_nr_som(j2)) * sum(ct, i51_ef_n_soil(ct,i2,n_pollutants_direct,"som")) / (1-s51_snupe_base) * (1-vm_nr_eff(i2)); -*' animal waste management: +*' animal waste management +*' Here we apply the marginal abatement cost curves to the emissions of all +*' N pollutants. The measures (e.g. decreased storage time, coverage) are not +*' specific to N2O and assumed to apply also to NH3 and other losses. q51_emissionbal_awms(i2,n_pollutants_direct) .. - vm_btm_reg(i2,"awms",n_pollutants_direct) + vm_emissions_reg(i2,"awms",n_pollutants_direct) =e= sum((kli,awms_conf), vm_manure_confinement(i2,kli,awms_conf,"nr") - * f51_ef3_confinement(i2,kli,awms_conf,n_pollutants_direct)); + * f51_ef3_confinement(i2,kli,awms_conf,n_pollutants_direct)) + * (1-sum(ct, im_maccs_mitigation(ct,i2,"awms","n2o_n_direct"))); *' and manure excreted on pasture land: q51_emissionbal_man_past(i2,n_pollutants_direct) .. - vm_btm_reg(i2,"man_past",n_pollutants_direct) + vm_emissions_reg(i2,"man_past",n_pollutants_direct) =e= sum((awms_prp,kli), vm_manure(i2, kli, awms_prp, "nr") @@ -75,7 +81,7 @@ *' Indirect emissions from NH3, NOx and NO3: q51_emissions_indirect_n2o(i2,emis_source_n51) .. - vm_btm_reg(i2,emis_source_n51,"n2o_n_indirect") + vm_emissions_reg(i2,emis_source_n51,"n2o_n_indirect") =e= sum(pollutant_nh3no2_51,vm_emissions_reg(i2,emis_source_n51,pollutant_nh3no2_51)) * f51_ipcc_ef("ef_4","best") diff --git a/modules/51_nitrogen/rescaled_jan21/input.gms b/modules/51_nitrogen/rescaled_jan21/input.gms index 04c70155ea..af50fa496c 100644 --- a/modules/51_nitrogen/rescaled_jan21/input.gms +++ b/modules/51_nitrogen/rescaled_jan21/input.gms @@ -10,13 +10,13 @@ Scalar s51_nue_pasture_base assumption on implicit SNuPE in ipcc guidelines (1) table f51_ipcc_ef(ipcc_ef51,emis_uncertainty51) ipcc emission factors for various emission types X (tX-N per tN) $ondelim -$include "./modules/51_nitrogen/input/f51_ipcc_ef.csv" +$include "./modules/51_nitrogen/rescaled_jan21/input/f51_ipcc_ef.csv" $offdelim ; table f51_ef_n_soil(t_all,i,n_pollutants_direct,emis_source_n_cropsoils51) ipcc emission factors for various emission types X (tX-N per tN) $ondelim -$include "./modules/51_nitrogen/input/f51_ef_n_soil_reg.cs3" +$include "./modules/51_nitrogen/rescaled_jan21/input/f51_ef_n_soil_reg.cs3" $offdelim ; diff --git a/modules/51_nitrogen/rescaled_jan21/input/files b/modules/51_nitrogen/rescaled_jan21/input/files index 87b30d104d..e4798643b3 100644 --- a/modules/51_nitrogen/rescaled_jan21/input/files +++ b/modules/51_nitrogen/rescaled_jan21/input/files @@ -1,4 +1,6 @@ * list of files that are required here f51_ef3_confinement.cs4 f51_ef3_prp.cs4 -f51_ef_resid_burn.cs4 \ No newline at end of file +f51_ef_resid_burn.cs4 +f51_ipcc_ef.csv +f51_ef_n_soil_reg.cs3 \ No newline at end of file diff --git a/modules/51_nitrogen/rescaled_jan21/preloop.gms b/modules/51_nitrogen/rescaled_jan21/preloop.gms index b2082a865f..5f1c9c3322 100644 --- a/modules/51_nitrogen/rescaled_jan21/preloop.gms +++ b/modules/51_nitrogen/rescaled_jan21/preloop.gms @@ -5,6 +5,6 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -vm_btm_reg.fx(i,emis_source,n_pollutants) = 0; -vm_btm_reg.lo(i,emis_source_n51,n_pollutants) = -Inf; -vm_btm_reg.up(i,emis_source_n51,n_pollutants) = Inf; +vm_emissions_reg.fx(i,emis_source,n_pollutants) = 0; +vm_emissions_reg.lo(i,emis_source_n51,n_pollutants) = -Inf; +vm_emissions_reg.up(i,emis_source_n51,n_pollutants) = Inf; diff --git a/modules/52_carbon/normal_dec17/declarations.gms b/modules/52_carbon/normal_dec17/declarations.gms index 0d56d7e835..db3d2b916a 100644 --- a/modules/52_carbon/normal_dec17/declarations.gms +++ b/modules/52_carbon/normal_dec17/declarations.gms @@ -12,5 +12,12 @@ parameters i52_land_carbon_sink(t_all,i) Land carbon sink adjustment factors from Grassi et al 2021 (GtCO2 per year) ; +equations + q52_emis_co2_actual(i,emis_oneoff) Calculation of annual CO2 emissions (Tg per yr) +; + *#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + oq52_emis_co2_actual(t,i,emis_oneoff,type) Calculation of annual CO2 emissions (Tg per yr) +; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/52_carbon/normal_dec17/equations.gms b/modules/52_carbon/normal_dec17/equations.gms new file mode 100644 index 0000000000..34a09b68e8 --- /dev/null +++ b/modules/52_carbon/normal_dec17/equations.gms @@ -0,0 +1,19 @@ + +*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + + +*' @equations + +*** Emissions + +*' Actual CO2 emissions are calculated based on changes in carbon stocks between timesteps in the interface `vm_carbon_stock`. + + q52_emis_co2_actual(i2,emis_oneoff) .. + vm_emissions_reg(i2,emis_oneoff,"co2_c") =e= + sum((cell(i2,j2),emis_land(emis_oneoff,land,c_pools)), + (vm_carbon_stock.l(j2,land,c_pools,"actual") - vm_carbon_stock(j2,land,c_pools,"actual"))/m_timestep_length); diff --git a/modules/52_carbon/normal_dec17/input.gms b/modules/52_carbon/normal_dec17/input.gms index 3ab5b279ec..5ba6af7007 100644 --- a/modules/52_carbon/normal_dec17/input.gms +++ b/modules/52_carbon/normal_dec17/input.gms @@ -23,6 +23,10 @@ $if "%c52_carbon_scenario%" == "nocc" fm_carbon_density(t_all,j,land,c_pools) = $if "%c52_carbon_scenario%" == "nocc_hist" fm_carbon_density(t_all,j,land,c_pools)$(m_year(t_all) > sm_fix_cc) = fm_carbon_density(t_all,j,land,c_pools)$(m_year(t_all) = sm_fix_cc); m_fillmissingyears(fm_carbon_density,"j,land,c_pools"); +* Fix urban area soilc to natural land soilc as long as preprocessed +* fm_carbon_density does not provide meaningful numbers for urban. +fm_carbon_density(t_all,j,"urban","soilc") = fm_carbon_density(t_all,j,"other","soilc") + parameter f52_growth_par(clcl,chap_par,forest_type) Parameters for chapman-richards equation (1) / $ondelim diff --git a/modules/52_carbon/normal_dec17/postsolve.gms b/modules/52_carbon/normal_dec17/postsolve.gms new file mode 100644 index 0000000000..f5d1c2d687 --- /dev/null +++ b/modules/52_carbon/normal_dec17/postsolve.gms @@ -0,0 +1,8 @@ + +*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### + oq52_emis_co2_actual(t,i,emis_oneoff,"marginal") = q52_emis_co2_actual.m(i,emis_oneoff); + oq52_emis_co2_actual(t,i,emis_oneoff,"level") = q52_emis_co2_actual.l(i,emis_oneoff); + oq52_emis_co2_actual(t,i,emis_oneoff,"upper") = q52_emis_co2_actual.up(i,emis_oneoff); + oq52_emis_co2_actual(t,i,emis_oneoff,"lower") = q52_emis_co2_actual.lo(i,emis_oneoff); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### + diff --git a/modules/52_carbon/normal_dec17/realization.gms b/modules/52_carbon/normal_dec17/realization.gms index 03806a5d82..4b68eb0317 100644 --- a/modules/52_carbon/normal_dec17/realization.gms +++ b/modules/52_carbon/normal_dec17/realization.gms @@ -19,5 +19,7 @@ $Ifi "%phase%" == "sets" $include "./modules/52_carbon/normal_dec17/sets.gms" $Ifi "%phase%" == "declarations" $include "./modules/52_carbon/normal_dec17/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/52_carbon/normal_dec17/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/52_carbon/normal_dec17/equations.gms" $Ifi "%phase%" == "start" $include "./modules/52_carbon/normal_dec17/start.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/52_carbon/normal_dec17/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/53_methane/ipcc2006_flexreg_apr16/declarations.gms b/modules/53_methane/ipcc2006_aug22/declarations.gms similarity index 100% rename from modules/53_methane/ipcc2006_flexreg_apr16/declarations.gms rename to modules/53_methane/ipcc2006_aug22/declarations.gms diff --git a/modules/53_methane/ipcc2006_flexreg_apr16/equations.gms b/modules/53_methane/ipcc2006_aug22/equations.gms similarity index 79% rename from modules/53_methane/ipcc2006_flexreg_apr16/equations.gms rename to modules/53_methane/ipcc2006_aug22/equations.gms index 3fe67fe0fb..504b5933a7 100644 --- a/modules/53_methane/ipcc2006_flexreg_apr16/equations.gms +++ b/modules/53_methane/ipcc2006_aug22/equations.gms @@ -7,7 +7,7 @@ *' @equations *' -*' We calculate methane emissions before technical mitigation(btm) in each regions (reg) (`vm_btm_reg`) +*' We calculate methane emissions in each regions (reg) (`vm_emissions_reg`) *' from the aforementioned four sources of emissions step-by-step in the following four equations. *' *' The first equation describes how CH4 emission from enteric fermentation is calculated. @@ -19,13 +19,14 @@ *' released as methane for dairy cattle and ruminants respectively. q53_emissionbal_ch4_ent_ferm(i2) .. - vm_btm_reg(i2,"ent_ferm","ch4") =e= 1/55.65 * + vm_emissions_reg(i2,"ent_ferm","ch4") =e= 1/55.65 * (sum(k_conc53, vm_dem_feed(i2,"livst_rum",k_conc53) *fm_attributes("ge",k_conc53)*0.03) - + sum(k_conc53, vm_dem_feed(i2,"livst_milk",k_conc53) + + sum(k_conc53, vm_dem_feed(i2,"livst_milk",k_conc53) *fm_attributes("ge",k_conc53)*0.065) - + sum((k_noconc53,k_ruminants53),vm_dem_feed(i2,k_ruminants53,k_noconc53) - *fm_attributes("ge",k_noconc53)*0.065)); + + sum((k_noconc53,k_ruminants53),vm_dem_feed(i2,k_ruminants53,k_noconc53) + *fm_attributes("ge",k_noconc53)*0.065) + ) * (1-sum(ct, im_maccs_mitigation(ct,i2,"ent_ferm","ch4"))); *' As such, methane from enteric fermentation depends on the feed quality and the purpose of livestock farming. *' The feed quality (measured by energy content of the feed type) can be `k_conc53` @@ -45,9 +46,10 @@ *' See the module for more on calculation of methane from animal waste(or manure). q53_emissionbal_ch4_awms(i2) .. - vm_btm_reg(i2,"awms","ch4") =e= + vm_emissions_reg(i2,"awms","ch4") =e= sum(kli, vm_manure(i2, kli, "confinement", "nr") - * sum(ct, f53_ef_ch4_awms(ct,i2,kli))); + * sum(ct, f53_ef_ch4_awms(ct,i2,kli))) + * (1-sum(ct, im_maccs_mitigation(ct,i2,"awms","ch4"))); *' The third equation of this realization calculates methane emissions from rice cultivation. *' As presented below CH4 from rice is a function of harvested area of rice @@ -55,15 +57,16 @@ *' The calculation is based on @ipcc_2006_2006 and Rice Cultivation Emissions from @FAOSTAT. q53_emissionbal_ch4_rice(i2) .. - vm_btm_reg(i2,"rice","ch4") =e= + vm_emissions_reg(i2,"rice","ch4") =e= sum((cell(i2,j2),w), vm_area(j2,"rice_pro",w) - * sum(ct,f53_ef_ch4_rice(ct,i2))); + * sum(ct,f53_ef_ch4_rice(ct,i2))) + * (1-sum(ct, im_maccs_mitigation(ct,i2,"rice","ch4"))); -*' The fourth equation calculates emissions from burning crop residues for CH4. -*' This calculation follows the 2019 Refinement to the 2006 IPPC Guidelines for +*' The fourth equation calculates emissions from burning crop residues for CH4. +*' This calculation follows the 2019 Refinement to the 2006 IPPC Guidelines for *' National Greenhouse Gas Inventories, Eq. 2.27. q53_emissions_resid_burn(i2) .. - vm_btm_reg(i2,"resid_burn","ch4") =e= - sum(kcr, vm_res_ag_burn(i2,kcr,"dm")) * s53_ef_ch4_res_ag_burn; \ No newline at end of file + vm_emissions_reg(i2,"resid_burn","ch4") =e= + sum(kcr, vm_res_ag_burn(i2,kcr,"dm")) * s53_ef_ch4_res_ag_burn; diff --git a/modules/53_methane/ipcc2006_flexreg_apr16/input.gms b/modules/53_methane/ipcc2006_aug22/input.gms similarity index 100% rename from modules/53_methane/ipcc2006_flexreg_apr16/input.gms rename to modules/53_methane/ipcc2006_aug22/input.gms diff --git a/modules/53_methane/ipcc2006_flexreg_apr16/postsolve.gms b/modules/53_methane/ipcc2006_aug22/postsolve.gms similarity index 100% rename from modules/53_methane/ipcc2006_flexreg_apr16/postsolve.gms rename to modules/53_methane/ipcc2006_aug22/postsolve.gms diff --git a/modules/50_nr_soil_budget/off/preloop.gms b/modules/53_methane/ipcc2006_aug22/preloop.gms similarity index 70% rename from modules/50_nr_soil_budget/off/preloop.gms rename to modules/53_methane/ipcc2006_aug22/preloop.gms index cc03ead348..6f5f86420c 100644 --- a/modules/50_nr_soil_budget/off/preloop.gms +++ b/modules/53_methane/ipcc2006_aug22/preloop.gms @@ -5,7 +5,6 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -vm_nr_inorg_fert_reg.fx(i,land_ag) = 0; -vm_nr_inorg_fert_costs.fx(i) = 0; -vm_nr_eff.fx(i) = 0.6; -vm_nr_eff_pasture.fx(i) = 0.66; +vm_emissions_reg.fx(i,emis_source,"ch4") = 0; +vm_emissions_reg.lo(i,emis_source_methane53,"ch4") = -Inf; +vm_emissions_reg.up(i,emis_source_methane53,"ch4") = Inf; diff --git a/modules/53_methane/ipcc2006_flexreg_apr16/realization.gms b/modules/53_methane/ipcc2006_aug22/realization.gms similarity index 88% rename from modules/53_methane/ipcc2006_flexreg_apr16/realization.gms rename to modules/53_methane/ipcc2006_aug22/realization.gms index 35e6db9e22..7d54609e01 100644 --- a/modules/53_methane/ipcc2006_flexreg_apr16/realization.gms +++ b/modules/53_methane/ipcc2006_aug22/realization.gms @@ -16,10 +16,10 @@ *' inconsistent with CH4 emissions from enteric fermentation. *####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/53_methane/ipcc2006_flexreg_apr16/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/53_methane/ipcc2006_flexreg_apr16/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/53_methane/ipcc2006_flexreg_apr16/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/53_methane/ipcc2006_flexreg_apr16/equations.gms" -$Ifi "%phase%" == "preloop" $include "./modules/53_methane/ipcc2006_flexreg_apr16/preloop.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/53_methane/ipcc2006_flexreg_apr16/postsolve.gms" +$Ifi "%phase%" == "sets" $include "./modules/53_methane/ipcc2006_aug22/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/53_methane/ipcc2006_aug22/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/53_methane/ipcc2006_aug22/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/53_methane/ipcc2006_aug22/equations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/53_methane/ipcc2006_aug22/preloop.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/53_methane/ipcc2006_aug22/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/53_methane/ipcc2006_flexreg_apr16/sets.gms b/modules/53_methane/ipcc2006_aug22/sets.gms similarity index 100% rename from modules/53_methane/ipcc2006_flexreg_apr16/sets.gms rename to modules/53_methane/ipcc2006_aug22/sets.gms diff --git a/modules/53_methane/ipcc2006_flexreg_apr16/preloop.gms b/modules/53_methane/ipcc2006_flexreg_apr16/preloop.gms deleted file mode 100644 index a0b00beafd..0000000000 --- a/modules/53_methane/ipcc2006_flexreg_apr16/preloop.gms +++ /dev/null @@ -1,10 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -vm_btm_reg.fx(i,emis_source,"ch4") = 0; -vm_btm_reg.lo(i,emis_source_methane53,"ch4") = -Inf; -vm_btm_reg.up(i,emis_source_methane53,"ch4") = Inf; diff --git a/modules/53_methane/module.gms b/modules/53_methane/module.gms index 9f36b72fe0..cfe96161d2 100644 --- a/modules/53_methane/module.gms +++ b/modules/53_methane/module.gms @@ -15,6 +15,6 @@ *' @authors Benjamin Leon Bodirsky *###################### R SECTION START (MODULETYPES) ########################## -$Ifi "%methane%" == "ipcc2006_flexreg_apr16" $include "./modules/53_methane/ipcc2006_flexreg_apr16/realization.gms" +$Ifi "%methane%" == "ipcc2006_aug22" $include "./modules/53_methane/ipcc2006_aug22/realization.gms" $Ifi "%methane%" == "off" $include "./modules/53_methane/off/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/53_methane/off/not_used.txt b/modules/53_methane/off/not_used.txt index 0d3dc2c545..170578b49f 100644 --- a/modules/53_methane/off/not_used.txt +++ b/modules/53_methane/off/not_used.txt @@ -10,4 +10,5 @@ vm_area,input,not needed vm_dem_feed,input,not needed fm_attributes,input,not needed vm_manure,input,questionnaire -vm_res_ag_burn,input,not needed \ No newline at end of file +vm_res_ag_burn,input,not needed +im_maccs_mitigation,input,questionnaire diff --git a/modules/53_methane/off/preloop.gms b/modules/53_methane/off/preloop.gms index 9b1c3d849f..b95435ad09 100644 --- a/modules/53_methane/off/preloop.gms +++ b/modules/53_methane/off/preloop.gms @@ -8,4 +8,4 @@ *' @code *' Methane emission from agricultural sources equals to zero. -vm_btm_reg.fx(i,emis_source,"ch4") = 0; +vm_emissions_reg.fx(i,emis_source,"ch4") = 0; diff --git a/modules/56_ghg_policy/module.gms b/modules/56_ghg_policy/module.gms index 62346c0fcf..5db2eed119 100644 --- a/modules/56_ghg_policy/module.gms +++ b/modules/56_ghg_policy/module.gms @@ -24,5 +24,5 @@ *' @authors Benjamin Bodirsky, Florian Humpenoeder *###################### R SECTION START (MODULETYPES) ########################## -$Ifi "%ghg_policy%" == "price_jan20" $include "./modules/56_ghg_policy/price_jan20/realization.gms" +$Ifi "%ghg_policy%" == "price_aug22" $include "./modules/56_ghg_policy/price_aug22/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/56_ghg_policy/price_jan20/declarations.gms b/modules/56_ghg_policy/price_aug22/declarations.gms similarity index 55% rename from modules/56_ghg_policy/price_jan20/declarations.gms rename to modules/56_ghg_policy/price_aug22/declarations.gms index b7ee9f02c7..07ccf047fe 100644 --- a/modules/56_ghg_policy/price_jan20/declarations.gms +++ b/modules/56_ghg_policy/price_aug22/declarations.gms @@ -15,8 +15,6 @@ parameters ; equations - q56_emis_co2_actual(i,emis_oneoff) Calculation of annual CO2 emissions (Tg per yr) - q56_technical_mitigation(i,pollutants,emis_source) Application of maccs on emissions (Tg per yr) q56_emission_costs(i) Calculation of total emission costs (mio. USD05MER per yr) q56_emission_cost_annual(i,emis_annual) Calculation of regional costs for annual emissions (mio. USD05MER per yr) q56_emission_cost_oneoff(i,emis_oneoff) Calculation of regional costs for emissions occuring only once in time (mio. USD05MER per yr) @@ -32,7 +30,6 @@ positive variables variables - vm_btm_reg(i,emis_source,pollutants) Regional emissions before technical mitigation (Tg per yr) vm_emission_costs(i) Costs for emission rights for pollutants and greenhouse gases (mio. USD05MER per yr) vm_emissions_reg(i,emis_source,pollutants) Regional emissions by source and gas after technical mitigation N CH4 C (Tg per yr) v56_emis_pricing(i,emis_source,pollutants) Regional emissions by source and gas after technical mitigation N CH4 C (Tg per yr) @@ -43,22 +40,19 @@ variables *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_carbon_stock(t,j,land,c_pools,stockType,type) Carbon stock in vegetation soil and litter for different land types (mio. tC) - ov_btm_reg(t,i,emis_source,pollutants,type) Regional emissions before technical mitigation (Tg per yr) - ov_emission_costs(t,i,type) Costs for emission rights for pollutants and greenhouse gases (mio. USD05MER per yr) - ov_emissions_reg(t,i,emis_source,pollutants,type) Regional emissions by source and gas after technical mitigation N CH4 C (Tg per yr) - ov56_emis_pricing(t,i,emis_source,pollutants,type) Regional emissions by source and gas after technical mitigation N CH4 C (Tg per yr) - ov56_emission_cost(t,i,emis_source,type) GHG emissions cost (mio. USD05MER per yr) - ov_reward_cdr_aff(t,i,type) Regional average annual expected revenue from afforestation (mio. USD05MER per yr) - ov56_reward_cdr_aff(t,j,type) Cellular average annual expected revenue from afforestation (mio. USD05MER per yr) - oq56_emis_co2_actual(t,i,emis_oneoff,type) Calculation of annual CO2 emissions (Tg per yr) - oq56_technical_mitigation(t,i,pollutants,emis_source,type) Application of maccs on emissions (Tg per yr) - oq56_emission_costs(t,i,type) Calculation of total emission costs (mio. USD05MER per yr) - oq56_emission_cost_annual(t,i,emis_annual,type) Calculation of regional costs for annual emissions (mio. USD05MER per yr) - oq56_emission_cost_oneoff(t,i,emis_oneoff,type) Calculation of regional costs for emissions occuring only once in time (mio. USD05MER per yr) - oq56_reward_cdr_aff_reg(t,i,type) Regional revenues for carbon captured by afforestation (mio. USD05MER per yr) - oq56_reward_cdr_aff(t,j,type) Cellular revenues for carbon captured by afforestation (mio. USD05MER per yr) - oq56_emis_pricing(t,i,pollutants,emis_source,type) Calculation of annual CO2 emissions for pricing (Tg per yr) - oq56_emis_pricing_co2(t,i,emis_oneoff,type) Calculation of annual CO2 emissions for pricing (Tg per yr) + ov_carbon_stock(t,j,land,c_pools,stockType,type) Carbon stock in vegetation soil and litter for different land types (mio. tC) + ov_emission_costs(t,i,type) Costs for emission rights for pollutants and greenhouse gases (mio. USD05MER per yr) + ov_emissions_reg(t,i,emis_source,pollutants,type) Regional emissions by source and gas after technical mitigation N CH4 C (Tg per yr) + ov56_emis_pricing(t,i,emis_source,pollutants,type) Regional emissions by source and gas after technical mitigation N CH4 C (Tg per yr) + ov56_emission_cost(t,i,emis_source,type) GHG emissions cost (mio. USD05MER per yr) + ov_reward_cdr_aff(t,i,type) Regional average annual expected revenue from afforestation (mio. USD05MER per yr) + ov56_reward_cdr_aff(t,j,type) Cellular average annual expected revenue from afforestation (mio. USD05MER per yr) + oq56_emission_costs(t,i,type) Calculation of total emission costs (mio. USD05MER per yr) + oq56_emission_cost_annual(t,i,emis_annual,type) Calculation of regional costs for annual emissions (mio. USD05MER per yr) + oq56_emission_cost_oneoff(t,i,emis_oneoff,type) Calculation of regional costs for emissions occuring only once in time (mio. USD05MER per yr) + oq56_reward_cdr_aff_reg(t,i,type) Regional revenues for carbon captured by afforestation (mio. USD05MER per yr) + oq56_reward_cdr_aff(t,j,type) Cellular revenues for carbon captured by afforestation (mio. USD05MER per yr) + oq56_emis_pricing(t,i,pollutants,emis_source,type) Calculation of annual CO2 emissions for pricing (Tg per yr) + oq56_emis_pricing_co2(t,i,emis_oneoff,type) Calculation of annual CO2 emissions for pricing (Tg per yr) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/56_ghg_policy/price_jan20/equations.gms b/modules/56_ghg_policy/price_aug22/equations.gms similarity index 80% rename from modules/56_ghg_policy/price_jan20/equations.gms rename to modules/56_ghg_policy/price_aug22/equations.gms index 6502bbdf06..c030cf0e8e 100644 --- a/modules/56_ghg_policy/price_jan20/equations.gms +++ b/modules/56_ghg_policy/price_aug22/equations.gms @@ -8,26 +8,6 @@ *' @equations -*** Calculate emissions for the core - -*** Emissions - -*' Actual CO2 emissions are calculated based on changes in carbon stocks between timesteps in the interface `vm_carbon_stock`. - - q56_emis_co2_actual(i2,emis_oneoff) .. - vm_btm_reg(i2,emis_oneoff,"co2_c") =e= - sum((cell(i2,j2),emis_land(emis_oneoff,land,c_pools)), - (vm_carbon_stock.l(j2,land,c_pools,"actual") - vm_carbon_stock(j2,land,c_pools,"actual"))/m_timestep_length); - -*' Total **regional GHG emissions** `vm_emissions_reg` are the sum of emissions from different sources less -*' the fraction `im_maccs_mitigation` that can be abated by technicial mitigation measures (see module [57_maccs]). -*' The regional emisssions before technical mitigation are calculated in the respective modules -*' ([51_nitrogen], [53_methane]) and delivered to this module through the interface variable `vm_btm_reg`. - - q56_technical_mitigation(i2,pollutants,emis_source) .. - vm_emissions_reg(i2,emis_source,pollutants) =e= - vm_btm_reg(i2,emis_source,pollutants) - * (1 - sum(ct, im_maccs_mitigation(ct,i2,emis_source,pollutants))); *' GHG emissions for pricing can differ for CO2 emissions from land-use change depending on `c56_carbon_stock_pricing`. *' CO2 emission subject to emission pricing are calculated based on changes in carbon stocks between timesteps in the interface `vm_carbon_stock`, depending on `c56_carbon_stock_pricing`. diff --git a/modules/56_ghg_policy/price_jan20/input.gms b/modules/56_ghg_policy/price_aug22/input.gms similarity index 100% rename from modules/56_ghg_policy/price_jan20/input.gms rename to modules/56_ghg_policy/price_aug22/input.gms diff --git a/modules/56_ghg_policy/price_aug22/postsolve.gms b/modules/56_ghg_policy/price_aug22/postsolve.gms new file mode 100644 index 0000000000..3171b07f62 --- /dev/null +++ b/modules/56_ghg_policy/price_aug22/postsolve.gms @@ -0,0 +1,65 @@ +*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### + ov_carbon_stock(t,j,land,c_pools,stockType,"marginal") = vm_carbon_stock.m(j,land,c_pools,stockType); + ov_emission_costs(t,i,"marginal") = vm_emission_costs.m(i); + ov_emissions_reg(t,i,emis_source,pollutants,"marginal") = vm_emissions_reg.m(i,emis_source,pollutants); + ov56_emis_pricing(t,i,emis_source,pollutants,"marginal") = v56_emis_pricing.m(i,emis_source,pollutants); + ov56_emission_cost(t,i,emis_source,"marginal") = v56_emission_cost.m(i,emis_source); + ov_reward_cdr_aff(t,i,"marginal") = vm_reward_cdr_aff.m(i); + ov56_reward_cdr_aff(t,j,"marginal") = v56_reward_cdr_aff.m(j); + oq56_emission_costs(t,i,"marginal") = q56_emission_costs.m(i); + oq56_emission_cost_annual(t,i,emis_annual,"marginal") = q56_emission_cost_annual.m(i,emis_annual); + oq56_emission_cost_oneoff(t,i,emis_oneoff,"marginal") = q56_emission_cost_oneoff.m(i,emis_oneoff); + oq56_reward_cdr_aff_reg(t,i,"marginal") = q56_reward_cdr_aff_reg.m(i); + oq56_reward_cdr_aff(t,j,"marginal") = q56_reward_cdr_aff.m(j); + oq56_emis_pricing(t,i,pollutants,emis_source,"marginal") = q56_emis_pricing.m(i,pollutants,emis_source); + oq56_emis_pricing_co2(t,i,emis_oneoff,"marginal") = q56_emis_pricing_co2.m(i,emis_oneoff); + ov_carbon_stock(t,j,land,c_pools,stockType,"level") = vm_carbon_stock.l(j,land,c_pools,stockType); + ov_emission_costs(t,i,"level") = vm_emission_costs.l(i); + ov_emissions_reg(t,i,emis_source,pollutants,"level") = vm_emissions_reg.l(i,emis_source,pollutants); + ov56_emis_pricing(t,i,emis_source,pollutants,"level") = v56_emis_pricing.l(i,emis_source,pollutants); + ov56_emission_cost(t,i,emis_source,"level") = v56_emission_cost.l(i,emis_source); + ov_reward_cdr_aff(t,i,"level") = vm_reward_cdr_aff.l(i); + ov56_reward_cdr_aff(t,j,"level") = v56_reward_cdr_aff.l(j); + oq56_emission_costs(t,i,"level") = q56_emission_costs.l(i); + oq56_emission_cost_annual(t,i,emis_annual,"level") = q56_emission_cost_annual.l(i,emis_annual); + oq56_emission_cost_oneoff(t,i,emis_oneoff,"level") = q56_emission_cost_oneoff.l(i,emis_oneoff); + oq56_reward_cdr_aff_reg(t,i,"level") = q56_reward_cdr_aff_reg.l(i); + oq56_reward_cdr_aff(t,j,"level") = q56_reward_cdr_aff.l(j); + oq56_emis_pricing(t,i,pollutants,emis_source,"level") = q56_emis_pricing.l(i,pollutants,emis_source); + oq56_emis_pricing_co2(t,i,emis_oneoff,"level") = q56_emis_pricing_co2.l(i,emis_oneoff); + ov_carbon_stock(t,j,land,c_pools,stockType,"upper") = vm_carbon_stock.up(j,land,c_pools,stockType); + ov_emission_costs(t,i,"upper") = vm_emission_costs.up(i); + ov_emissions_reg(t,i,emis_source,pollutants,"upper") = vm_emissions_reg.up(i,emis_source,pollutants); + ov56_emis_pricing(t,i,emis_source,pollutants,"upper") = v56_emis_pricing.up(i,emis_source,pollutants); + ov56_emission_cost(t,i,emis_source,"upper") = v56_emission_cost.up(i,emis_source); + ov_reward_cdr_aff(t,i,"upper") = vm_reward_cdr_aff.up(i); + ov56_reward_cdr_aff(t,j,"upper") = v56_reward_cdr_aff.up(j); + oq56_emission_costs(t,i,"upper") = q56_emission_costs.up(i); + oq56_emission_cost_annual(t,i,emis_annual,"upper") = q56_emission_cost_annual.up(i,emis_annual); + oq56_emission_cost_oneoff(t,i,emis_oneoff,"upper") = q56_emission_cost_oneoff.up(i,emis_oneoff); + oq56_reward_cdr_aff_reg(t,i,"upper") = q56_reward_cdr_aff_reg.up(i); + oq56_reward_cdr_aff(t,j,"upper") = q56_reward_cdr_aff.up(j); + oq56_emis_pricing(t,i,pollutants,emis_source,"upper") = q56_emis_pricing.up(i,pollutants,emis_source); + oq56_emis_pricing_co2(t,i,emis_oneoff,"upper") = q56_emis_pricing_co2.up(i,emis_oneoff); + ov_carbon_stock(t,j,land,c_pools,stockType,"lower") = vm_carbon_stock.lo(j,land,c_pools,stockType); + ov_emission_costs(t,i,"lower") = vm_emission_costs.lo(i); + ov_emissions_reg(t,i,emis_source,pollutants,"lower") = vm_emissions_reg.lo(i,emis_source,pollutants); + ov56_emis_pricing(t,i,emis_source,pollutants,"lower") = v56_emis_pricing.lo(i,emis_source,pollutants); + ov56_emission_cost(t,i,emis_source,"lower") = v56_emission_cost.lo(i,emis_source); + ov_reward_cdr_aff(t,i,"lower") = vm_reward_cdr_aff.lo(i); + ov56_reward_cdr_aff(t,j,"lower") = v56_reward_cdr_aff.lo(j); + oq56_emission_costs(t,i,"lower") = q56_emission_costs.lo(i); + oq56_emission_cost_annual(t,i,emis_annual,"lower") = q56_emission_cost_annual.lo(i,emis_annual); + oq56_emission_cost_oneoff(t,i,emis_oneoff,"lower") = q56_emission_cost_oneoff.lo(i,emis_oneoff); + oq56_reward_cdr_aff_reg(t,i,"lower") = q56_reward_cdr_aff_reg.lo(i); + oq56_reward_cdr_aff(t,j,"lower") = q56_reward_cdr_aff.lo(j); + oq56_emis_pricing(t,i,pollutants,emis_source,"lower") = q56_emis_pricing.lo(i,pollutants,emis_source); + oq56_emis_pricing_co2(t,i,emis_oneoff,"lower") = q56_emis_pricing_co2.lo(i,emis_oneoff); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/56_ghg_policy/price_jan20/preloop.gms b/modules/56_ghg_policy/price_aug22/preloop.gms similarity index 98% rename from modules/56_ghg_policy/price_jan20/preloop.gms rename to modules/56_ghg_policy/price_aug22/preloop.gms index 9e3df4594c..323d21fe88 100644 --- a/modules/56_ghg_policy/price_jan20/preloop.gms +++ b/modules/56_ghg_policy/price_aug22/preloop.gms @@ -87,8 +87,7 @@ loop(t, until s56_counter = s56_timesteps-1); ); ); -display p56_pollutant_prices_input; -display im_pollutant_prices; + *initialize age-class dependent C price with same C price for all age-classes p56_c_price_aff(t_all,i,ac) = im_pollutant_prices(t_all,i,"co2_c","forestry_vegc"); *Shift C prices in age-classes for reflecting foresight. @@ -99,5 +98,3 @@ ac_exp(ac)$(ac.off = s56_c_price_exp_aff/5) = yes; p56_c_price_aff(t_all,i,ac)$(ac.off >= s56_c_price_exp_aff/5) = sum(ac_exp, p56_c_price_aff(t_all,i,ac_exp)); *zero C price before starting year p56_c_price_aff(t_all,i,ac)$(m_year(t_all) sm_fix_SSP2, + + if (s57_maxmac_n_soil >= 0, i57_mac_step_n2o(t,i,emis_source_inorg_fert_n2o) = s57_maxmac_n_soil); + if (s57_maxmac_n_awms >= 0, i57_mac_step_n2o(t,i,emis_source_awms_n2o) = s57_maxmac_n_awms); + if (s57_maxmac_ch4_rice >= 0, i57_mac_step_ch4(t,i,emis_source_rice_ch4) = s57_maxmac_ch4_rice); + if (s57_maxmac_ch4_entferm >= 0, i57_mac_step_ch4(t,i,emis_source_ent_ferm_ch4) = s57_maxmac_ch4_entferm); + if (s57_maxmac_ch4_awms >= 0, i57_mac_step_ch4(t,i,emis_source_awms_ch4) = s57_maxmac_ch4_awms); + + ); +); + *Calculate technical mitigation depending on i57_mac_step_n2o and i57_mac_step_ch4. *At zero GHG prices i57_mac_step_n2o and i57_mac_step_ch4 are set to 1. *Technical mitigation should be zero at zero GHG prices. @@ -31,8 +46,8 @@ im_maccs_mitigation(t,i,emis_source_inorg_fert_n2o,"n2o_n_direct") = sum(maccs_steps$(ord(maccs_steps) eq i57_mac_step_n2o(t,i,emis_source_inorg_fert_n2o) AND ord(maccs_steps) > 1), f57_maccs_n2o(t,i,"inorg_fert_n2o",maccs_steps)); -im_maccs_mitigation(t,i,emis_source_awms_manure_n2o,"n2o_n_direct") = - sum(maccs_steps$(ord(maccs_steps) eq i57_mac_step_n2o(t,i,emis_source_awms_manure_n2o) AND ord(maccs_steps) > 1), +im_maccs_mitigation(t,i,emis_source_awms_n2o,"n2o_n_direct") = + sum(maccs_steps$(ord(maccs_steps) eq i57_mac_step_n2o(t,i,emis_source_awms_n2o) AND ord(maccs_steps) > 1), f57_maccs_n2o(t,i,"awms_manure_n2o",maccs_steps)); im_maccs_mitigation(t,i,emis_source_rice_ch4,"ch4") = @@ -50,10 +65,10 @@ im_maccs_mitigation(t,i,emis_source_awms_ch4,"ch4") = $ontext The costs associated with technical abatement of GHG emissions are reflected by the area under the mac curve, i.e. the integral. Abatement options at zero cost are in the first step. Therefore an offset of -1 is used. -Note that vm_btm_reg, which needs to be part of the integral calculation but is not available in preloop, -is multiplied with p57_maccs_costs_integral during optimization (see equations). +Note that the emissions before mitigation, which need to be part of the integral calculation but are not available in preloop, +are multiplied with p57_maccs_costs_integral during optimization (see equations). -Illustrative example for CH4: Abatement is 0.14 percent at 0$/tC, 0.15 percent at 5 and 10 $/tC, and 0.16 percent at 15 $/tC. +Illustrative example for CH4: Abatement is 0.14 percent at 0$/tC, 0.15 percent at 5 and 10 $/tC, and 0.16 percent at 15 $/tC. Emissions before technical mitigation are assumed 1 t CH4. step 1 0 mio $ 0 mio $ @@ -70,8 +85,8 @@ loop(maccs_steps$(ord(maccs_steps) > 1), p57_maccs_costs_integral(t,i,emis_source_inorg_fert_n2o,"n2o_n_direct") + (f57_maccs_n2o(t,i,"inorg_fert_n2o",maccs_steps) - f57_maccs_n2o(t,i,"inorg_fert_n2o",maccs_steps-1))*(ord(maccs_steps)-1)*s57_step_length; - p57_maccs_costs_integral(t,i,emis_source_awms_manure_n2o,"n2o_n_direct")$(ord(maccs_steps) <= i57_mac_step_n2o(t,i,emis_source_awms_manure_n2o)) = - p57_maccs_costs_integral(t,i,emis_source_awms_manure_n2o,"n2o_n_direct") + + p57_maccs_costs_integral(t,i,emis_source_awms_n2o,"n2o_n_direct")$(ord(maccs_steps) <= i57_mac_step_n2o(t,i,emis_source_awms_n2o)) = + p57_maccs_costs_integral(t,i,emis_source_awms_n2o,"n2o_n_direct") + (f57_maccs_n2o(t,i,"awms_manure_n2o",maccs_steps) - f57_maccs_n2o(t,i,"awms_manure_n2o",maccs_steps-1))*(ord(maccs_steps)-1)*s57_step_length; p57_maccs_costs_integral(t,i,emis_source_rice_ch4,"ch4")$(ord(maccs_steps) <= i57_mac_step_ch4(t,i,emis_source_rice_ch4)) = @@ -90,11 +105,3 @@ loop(maccs_steps$(ord(maccs_steps) > 1), *Conversion from USD per ton C to USD per ton N and USD per ton CH4, using the old IPCC AR4 GWP factors. p57_maccs_costs_integral(t,i,emis_source,"n2o_n_direct") = p57_maccs_costs_integral(t,i,emis_source,"n2o_n_direct")*12/44*298*44/28; p57_maccs_costs_integral(t,i,emis_source,"ch4") = p57_maccs_costs_integral(t,i,emis_source,"ch4")*12/44*25; - - -display -i57_mac_step_n2o -i57_mac_step_ch4 -im_maccs_mitigation -p57_maccs_costs_integral -; diff --git a/modules/57_maccs/on_sep16/realization.gms b/modules/57_maccs/on_aug22/realization.gms similarity index 68% rename from modules/57_maccs/on_sep16/realization.gms rename to modules/57_maccs/on_aug22/realization.gms index 34cc5f40fd..2aa0de5401 100644 --- a/modules/57_maccs/on_sep16/realization.gms +++ b/modules/57_maccs/on_aug22/realization.gms @@ -13,11 +13,11 @@ *' @limitations The data set PBL_2007 is outdated and only kept for backward compatibility *####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/57_maccs/on_sep16/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/57_maccs/on_sep16/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/57_maccs/on_sep16/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/57_maccs/on_sep16/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/57_maccs/on_sep16/scaling.gms" -$Ifi "%phase%" == "preloop" $include "./modules/57_maccs/on_sep16/preloop.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/57_maccs/on_sep16/postsolve.gms" +$Ifi "%phase%" == "sets" $include "./modules/57_maccs/on_aug22/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/57_maccs/on_aug22/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/57_maccs/on_aug22/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/57_maccs/on_aug22/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/57_maccs/on_aug22/scaling.gms" +$Ifi "%phase%" == "preloop" $include "./modules/57_maccs/on_aug22/preloop.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/57_maccs/on_aug22/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/57_maccs/on_sep16/scaling.gms b/modules/57_maccs/on_aug22/scaling.gms similarity index 100% rename from modules/57_maccs/on_sep16/scaling.gms rename to modules/57_maccs/on_aug22/scaling.gms diff --git a/modules/57_maccs/on_sep16/sets.gms b/modules/57_maccs/on_aug22/sets.gms similarity index 75% rename from modules/57_maccs/on_sep16/sets.gms rename to modules/57_maccs/on_aug22/sets.gms index cbaa2b97ce..a7aac8d11b 100644 --- a/modules/57_maccs/on_sep16/sets.gms +++ b/modules/57_maccs/on_aug22/sets.gms @@ -7,28 +7,34 @@ sets - emis_source_inorg_fert_n2o(emis_source) subset inorg_fert_n2o emissions - /inorg_fert,resid,som,rice/ + emis_source_inorg_fert_n2o(emis_source) subset inorg_fert_n2o emissions + /inorg_fert, resid, som, rice, man_crop, man_past/ - emis_source_awms_manure_n2o(emis_source) subset awms_manure_n2o - /man_crop,man_past,awms/ + emis_source_awms_n2o(emis_source) subset awms_manure_n2o + /awms/ emis_source_rice_ch4(emis_source) subset rice emissions /rice/ - + emis_source_ent_ferm_ch4(emis_source) subset ent_ferm emissions /ent_ferm/ - + emis_source_awms_ch4(emis_source) subset awms emissions /awms/ + pollutants_maccs57(pollutants) pollutants via which MAC costs are calculated + / ch4, n2o_n_direct / + maccs_ch4 ch4 mitigation categories with MACCS / rice_ch4, ent_ferm_ch4, awms_ch4 / - + maccs_n2o n2o mitigation categories with MACCS / inorg_fert_n2o, awms_manure_n2o / maccs_steps maccs tax level steps / 1*201 / + scen57 scenarios + / Default, Optimistic, Pessimistic / + ; diff --git a/modules/57_maccs/on_sep16/equations.gms b/modules/57_maccs/on_sep16/equations.gms deleted file mode 100644 index 242c0544b8..0000000000 --- a/modules/57_maccs/on_sep16/equations.gms +++ /dev/null @@ -1,20 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @equations -*' Therefore, the equation below is used to estimate the mitigation costs. -*' It is simply calculated as a product of GHG emissions before technical mitigation (`vm_btm_reg`), -*' and the costs per unit of technical mitigation (`p57_maccs_costs_integral`). -*' The mitigation costs will go into the objective function of the model. - -q57_total_costs(i2) .. - vm_maccs_costs(i2) =e= - sum((ct,emis_source), p57_maccs_costs_integral(ct,i2,emis_source,"n2o_n_direct") - * vm_btm_reg(i2,emis_source,"n2o_n_direct") - + p57_maccs_costs_integral(ct,i2,emis_source,"ch4") - * vm_btm_reg(i2,emis_source,"ch4") - ); diff --git a/modules/57_maccs/on_sep16/input.gms b/modules/57_maccs/on_sep16/input.gms deleted file mode 100644 index fd3c7873e6..0000000000 --- a/modules/57_maccs/on_sep16/input.gms +++ /dev/null @@ -1,23 +0,0 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -* option: PBL_2007,PBL_2019 -$setglobal c57_macc_version PBL_2007 - -table f57_maccs_n2o(t_all,i,maccs_n2o,maccs_steps) N2O MACC from Image model (percent) -$ondelim -$if "%c57_macc_version%" == "PBL_2007" $include "./modules/57_maccs/input/f57_maccs_n2o.cs3" -$if "%c57_macc_version%" == "PBL_2019" $include "./modules/57_maccs/input/f57_maccs_n2o_2019.cs3" -$offdelim -; - -table f57_maccs_ch4(t_all,i,maccs_ch4,maccs_steps) CH4 MACC from Image model (percent) -$ondelim -$if "%c57_macc_version%" == "PBL_2007" $include "./modules/57_maccs/input/f57_maccs_ch4.cs3" -$if "%c57_macc_version%" == "PBL_2019" $include "./modules/57_maccs/input/f57_maccs_ch4_2019.cs3" -$offdelim -; diff --git a/modules/57_maccs/on_sep16/not_used.txt b/modules/57_maccs/on_sep16/not_used.txt deleted file mode 100644 index da77c77f60..0000000000 --- a/modules/57_maccs/on_sep16/not_used.txt +++ /dev/null @@ -1,8 +0,0 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -# | authors, and contributors see CITATION.cff file. This file is part -# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -# | AGPL-3.0, you are granted additional permissions described in the -# | MAgPIE License Exception, version 1.0 (see LICENSE file). -# | Contact: magpie@pik-potsdam.de - -name,type,reason diff --git a/modules/58_peatland/off/preloop.gms b/modules/58_peatland/off/preloop.gms index a4bed35f73..dbac78cb8a 100644 --- a/modules/58_peatland/off/preloop.gms +++ b/modules/58_peatland/off/preloop.gms @@ -5,5 +5,5 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -vm_btm_reg.fx(i,"peatland",pollutants) = 0; +vm_emissions_reg.fx(i,"peatland",pollutants) = 0; vm_peatland_cost.fx(j) = 0; diff --git a/modules/58_peatland/on/equations.gms b/modules/58_peatland/on/equations.gms index 82ae09f5d8..ba13f31a1f 100644 --- a/modules/58_peatland/on/equations.gms +++ b/modules/58_peatland/on/equations.gms @@ -7,18 +7,18 @@ *' @equations -*' Land transition matrix for peatland area. -*' The sum of current peatland area defined in `v58_lu_transitions` has to equal the sum of +*' Land transition matrix for peatland area. +*' The sum of current peatland area defined in `v58_lu_transitions` has to equal the sum of *' peatland area in the previous time step (`pc58_peatland_man` + `pc58_peatland_intact`). -*' The two balancing variables `v58_balance_positive` and `v58_balance_negative` are needed -*' to avoid technical infeasibilities due to small differences in accuracy between -*' variables and parameters in GAMS. The use of `v58_balance_positive` and -*' `v58_balance_negative` is minimized by putting a high cost factor on these variables -*' (`q58_peatland_cost_full`). In practice, `v58_balance_positive` and -*' `v58_balance_negative`should deviate from zero only in exceptional cases. - +*' The two balancing variables `v58_balance_positive` and `v58_balance_negative` are needed +*' to avoid technical infeasibilities due to small differences in accuracy between +*' variables and parameters in GAMS. The use of `v58_balance_positive` and +*' `v58_balance_negative` is minimized by putting a high cost factor on these variables +*' (`q58_peatland_cost_full`). In practice, `v58_balance_positive` and +*' `v58_balance_negative`should deviate from zero only in exceptional cases. + q58_transition_matrix(j2) .. - sum((from58,to58), v58_lu_transitions(j2,from58,to58)) + sum((from58,to58), v58_lu_transitions(j2,from58,to58)) + v58_balance_positive(j2) - v58_balance_negative(j2) =e= sum((man58,land58), pc58_peatland_man(j2,man58,land58)) + pc58_peatland_intact(j2); @@ -62,7 +62,7 @@ v58_lu_transitions(j2,from58,to58)); *' Future peatland degradation (`v58_peatland_man`) depends on managed land (`vm_land`), -*' scaled with the ratio of total peatland area and total land area (`p58_scaling_factor`) +*' scaled with the ratio of total peatland area and total land area (`p58_scaling_factor`) *' and a calibration factor (`p58_calib_factor`) for alignment with historic levels of degraded peatland. *' By multiplying changes in managed land (`vm_land`) with the scaling factor we implicitly assume *' that intact peatlands are distributed equally within a grid cell. @@ -79,7 +79,7 @@ *' This constraint avoids the conversion of intact peatland into rewetted peatland. q58_peatland_rewet(j2) .. - sum(stat_rewet58, v58_expansion(j2,stat_rewet58)) =l= + sum(stat_rewet58, v58_expansion(j2,stat_rewet58)) =l= sum(stat_degrad58, v58_reduction(j2,stat_degrad58) + v58_expansion(j2,stat_degrad58)) - v58_reduction(j2,"intact"); *' Costs for peatland degradation and rewetting @@ -88,10 +88,10 @@ vm_peatland_cost(j2) =e= v58_peatland_cost(j2) + (v58_balance_positive(j2) + v58_balance_negative(j2)) * s58_cost_balance; q58_peatland_cost(j2) .. - v58_peatland_cost(j2) =e= v58_peatland_cost_annuity(j2) + v58_peatland_cost(j2) =e= v58_peatland_cost_annuity(j2) + sum(land58, v58_peatland_man(j2,"rewet",land58)) * sum(ct, i58_cost_rewet_recur(ct)) + sum((degrad58,land58), v58_peatland_man(j2,degrad58,land58)) * sum(ct, i58_cost_degrad_recur(ct)); - + q58_peatland_cost_annuity(j2) .. v58_peatland_cost_annuity(j2) =e= (sum(stat_rewet58, v58_expansion(j2,stat_rewet58)) * sum(ct, i58_cost_rewet_onetime(ct)) @@ -105,10 +105,10 @@ sum((man58,land58,clcl58), v58_peatland_man(j2,man58,land58) * p58_mapping_cell_climate(j2,clcl58) * p58_ipcc_wetland_ef(clcl58,land58,emis58,man58)); -*' Conversion from CO2 equivalent to element unit for interface `vm_btm_cell` using GWP100 conversion factors from AR5 (same as in @wilson_2016). +*' Conversion from CO2 equivalent to element unit for interface `vm_emissions_reg` +*' using GWP100 conversion factors from AR5 (same as in @wilson_2016). q58_peatland_emis(i2,poll58) .. - vm_btm_reg(i2,"peatland",poll58) =e= + vm_emissions_reg(i2,"peatland",poll58) =e= sum((cell(i2,j2),emisSub58_to_poll58(emisSub58,poll58)), v58_peatland_emis(j2,emisSub58) * p58_conversion_factor(emisSub58)); - \ No newline at end of file diff --git a/modules/58_peatland/on/preloop.gms b/modules/58_peatland/on/preloop.gms index 380c960bca..5383d6728c 100644 --- a/modules/58_peatland/on/preloop.gms +++ b/modules/58_peatland/on/preloop.gms @@ -5,9 +5,9 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -vm_btm_reg.fx(i,"peatland",pollutants) = 0; -vm_btm_reg.lo(i,"peatland",poll58) = -Inf; -vm_btm_reg.up(i,"peatland",poll58) = Inf; +vm_emissions_reg.fx(i,"peatland",pollutants) = 0; +vm_emissions_reg.lo(i,"peatland",poll58) = -Inf; +vm_emissions_reg.up(i,"peatland",poll58) = Inf; * GHG emission conversion factors from GWP100 to element unit. p58_conversion_factor("co2") = 12/44; @@ -19,7 +19,7 @@ p58_mapping_cell_climate(j,clcl58) = sum(clcl_mapping(clcl,clcl58),pm_climate_cl p58_ipcc_wetland_ef(clcl58,land58,emis58,ef58) = f58_ipcc_wetland_ef(clcl58,land58,emis58,ef58); p58_ipcc_wetland_ef(clcl58,land58,emis58,"unused") = f58_ipcc_wetland_ef(clcl58,land58,emis58,"degrad"); -* Peatland scaling factor: ratio of total peatland area and total land area +* Peatland scaling factor: ratio of total peatland area and total land area p58_scaling_factor(j) = (f58_peatland_degrad(j) + f58_peatland_intact(j)) / sum(land, pcm_land(j,land)); * Intact peatland area pc58_peatland_intact(j) = f58_peatland_intact(j); @@ -35,7 +35,7 @@ p58_calib_factor(j,land58)$(p58_calib_factor(j,land58) > 1) = 1; * Initialization of peatland pc58_peatland_man(j,man58,land58) = 0; * Degraded peatland is estimated by multiplication of managed land (pcm_land) with the peatland scaling factor (p58_scaling_factor). -* The calibration factor (p58_calib_factor) reduces this estimate to historic levels of degraded peatland. p58_calib_factor is 1 for most cases. +* The calibration factor (p58_calib_factor) reduces this estimate to historic levels of degraded peatland. p58_calib_factor is 1 for most cases. pc58_peatland_man(j,"degrad",land58) = pcm_land(j,land58) * p58_scaling_factor(j) * p58_calib_factor(j,land58); * The residual is added to an "unused" category, which represents degraded but unused peatland. pc58_peatland_man(j,"unused",land58) = f58_peatland_degrad(j) * p58_peatland_degrad_weight(j,land58) - pc58_peatland_man(j,"degrad",land58); diff --git a/modules/59_som/cellpool_aug16/declarations.gms b/modules/59_som/cellpool_aug16/declarations.gms index 08c6226776..27cbff88b4 100644 --- a/modules/59_som/cellpool_aug16/declarations.gms +++ b/modules/59_som/cellpool_aug16/declarations.gms @@ -11,8 +11,10 @@ parameters i59_tillage_share(i,tillage59) Share of land under tillage class (1) i59_input_share(i,inputs59) Share of land under input class (1) i59_cratio(j,kcr,w) Ratio of carbon density of land relative to natural vegetaion (1) + i59_cratio_fallow(j) Ratio of carbon density of fallow land relative to natural vegetation (1) p59_som_pool(j,pools59) Actual C pool (mio. tC) i59_subsoilc_density(t_all,j) Subsoil carbon density of a hectare of land (tC per ha) + p59_land_before(j,land) Land area in previous time step (mio. ha) ; equations diff --git a/modules/59_som/cellpool_aug16/equations.gms b/modules/59_som/cellpool_aug16/equations.gms index 51d49311cc..4570110885 100644 --- a/modules/59_som/cellpool_aug16/equations.gms +++ b/modules/59_som/cellpool_aug16/equations.gms @@ -13,6 +13,7 @@ q59_som_target_cropland(j2) .. v59_som_target(j2,"crop") =e= sum((kcr,w), vm_area(j2,kcr,w) * i59_cratio(j2,kcr,w)) * sum(ct,f59_topsoilc_density(ct,j2)) + + vm_fallow(j2) * i59_cratio_fallow(j2) * sum(ct,f59_topsoilc_density(ct,j2)) ; *' as well as for all non cropland given by diff --git a/modules/59_som/cellpool_aug16/postsolve.gms b/modules/59_som/cellpool_aug16/postsolve.gms index faf7221e39..7b6080e443 100644 --- a/modules/59_som/cellpool_aug16/postsolve.gms +++ b/modules/59_som/cellpool_aug16/postsolve.gms @@ -6,7 +6,9 @@ *** | Contact: magpie@pik-potsdam.de p59_som_pool(j,pools59) = v59_som_pool.l(j,pools59); - +p59_land_before(j,land) = vm_land.l(j,land); +p59_carbon_density(t,j,noncropland59)$(pcm_land(j,noncropland59)>0) = p59_som_pool(j,noncropland59) / pcm_land(j,noncropland59); +p59_carbon_density(t,j,"crop")$(pcm_land(j,"crop")>0) = p59_som_pool(j,"crop") / pcm_land(j,"crop"); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov59_som_target(t,j,pools59,"marginal") = v59_som_target.m(j,pools59); @@ -66,4 +68,3 @@ p59_som_pool(j,pools59) = v59_som_pool.l(j,pools59); oq59_nr_som_fertilizer2(t,j,"lower") = q59_nr_som_fertilizer2.lo(j); oq59_carbon_soil(t,j,pools59,stockType,"lower") = q59_carbon_soil.lo(j,pools59,stockType); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### - diff --git a/modules/59_som/cellpool_aug16/preloop.gms b/modules/59_som/cellpool_aug16/preloop.gms index 66aebf9501..2a085a3da9 100644 --- a/modules/59_som/cellpool_aug16/preloop.gms +++ b/modules/59_som/cellpool_aug16/preloop.gms @@ -68,6 +68,18 @@ i59_cratio(j,kcr,w) = sum((cell(i,j),tillage59,inputs59,climate59), * i59_input_share(i,inputs59) * f59_cratio_inputs(climate59,inputs59) * f59_cratio_irrigation(climate59,w,kcr)); + +*' For fallow we assume annual crops with bare fallow - therefor low input - +*' and reduced tillage. Assumed to have no irrigation, so irrigation multiplier +*' is 1. + +i59_cratio_fallow(j) = sum(climate59, + sum(clcl_climate59(clcl,climate59),pm_climate_class(j,clcl)) + * f59_cratio_landuse(climate59,"maiz") + * f59_cratio_tillage(climate59,"reduced_tillage") + * f59_cratio_inputs(climate59,"low_input")); *' @stop -p59_carbon_density(t,j,pools59)=0; +p59_carbon_density(t,j,pools59) = 0; + +p59_land_before(j,land) = pm_land_start(j,land); diff --git a/modules/59_som/cellpool_aug16/presolve.gms b/modules/59_som/cellpool_aug16/presolve.gms index 087f0b688e..28ba8bd185 100644 --- a/modules/59_som/cellpool_aug16/presolve.gms +++ b/modules/59_som/cellpool_aug16/presolve.gms @@ -5,5 +5,26 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -p59_carbon_density(t,j,noncropland59)$(pcm_land(j,noncropland59)>0) = p59_som_pool(j,noncropland59)/pcm_land(j,noncropland59); -p59_carbon_density(t,j,"crop")$(pcm_land(j,"crop")>0)= p59_som_pool(j,"crop") / pcm_land(j,"crop"); + +* SOM pools and densities will be updated after natural regrowth and disturbance loss accounting. +* The secondary forest pool will receive carbon from primary forest (due to natural disturbance) +* and from other land (due to regrowth). +* Note: This will only account for transitions of primary forest to secondary forest and +* other land to secondary forest. See current version of 35_natveg to check consistency. + +p59_som_pool(j,"secdforest") = p59_som_pool(j,"secdforest") + + (p59_land_before(j,"primforest") - pcm_land(j,"primforest")) * + p59_carbon_density(t-1,j,"primforest") + + (p59_land_before(j,"other") - pcm_land(j,"other")) * + p59_carbon_density(t-1,j,"other"); + +p59_som_pool(j,"other") = p59_som_pool(j,"other") - + (p59_land_before(j,"other") - pcm_land(j,"other")) * + p59_carbon_density(t-1,j,"other"); + +p59_som_pool(j,"primforest") = p59_som_pool(j,"primforest") - + (p59_land_before(j,"primforest") - pcm_land(j,"primforest")) * + p59_carbon_density(t-1,j,"primforest"); + +p59_carbon_density(t,j,noncropland59)$(pcm_land(j,noncropland59)>0) = p59_som_pool(j,noncropland59) / pcm_land(j,noncropland59); +p59_carbon_density(t,j,"crop")$(pcm_land(j,"crop")>0) = p59_som_pool(j,"crop") / pcm_land(j,"crop"); diff --git a/modules/59_som/cellpool_aug16/realization.gms b/modules/59_som/cellpool_aug16/realization.gms index e1e12ccf7e..7f313bd06b 100644 --- a/modules/59_som/cellpool_aug16/realization.gms +++ b/modules/59_som/cellpool_aug16/realization.gms @@ -13,13 +13,15 @@ *' This approach also accounts for the temporal dimension of soil organic carbon change, *' since it assumes a gradual step of 15% in the direction of the new equilibrium soil *' organic carbon pool each year. Stock change factors tracks crop types as well as -*' management (e.g. irrigation) and input differences on cropland. +*' management (e.g. irrigation) and input differences on cropland. *' @limitations It is assumed that pastures and rangelandes as well as managed forests -*' do not change in soil carbon compared to the natural reference state. +*' do not change in soil carbon compared to the natural reference state. Moreover only +*' transitions from other land and primary forest to secondary forest between optimization +*' steps (due to natural regrowth and disturbance loss) are accounted for. -*' @authors Benjamin Leon Bodirsky, Kristine Karstens +*' @authors Kristine Karstens, Benjamin Leon Bodirsky diff --git a/modules/59_som/cellpool_aug16/sets.gms b/modules/59_som/cellpool_aug16/sets.gms index d9ac1cdbc3..4148216ca9 100644 --- a/modules/59_som/cellpool_aug16/sets.gms +++ b/modules/59_som/cellpool_aug16/sets.gms @@ -8,10 +8,10 @@ sets pools59(land) Carbon differentiating landuse types -/crop, past, forestry, primforest, secdforest, other/ +/crop, past, forestry, primforest, secdforest, other, urban/ noncropland59(pools59) Soil carbon conserving landuse types -/past, forestry, primforest, secdforest, other/ +/past, forestry, primforest, secdforest, other, urban/ tillage59 Tillage categories of IPCC /full_tillage,reduced_tillage,no_tillage/ diff --git a/modules/59_som/static_jan19/not_used.txt b/modules/59_som/static_jan19/not_used.txt index 0fd9c9c50f..aa662df4c5 100644 --- a/modules/59_som/static_jan19/not_used.txt +++ b/modules/59_som/static_jan19/not_used.txt @@ -12,3 +12,4 @@ vm_landexpansion,input,questionnaire vm_croplandexpansion,input,questionnaire vm_croplandreduction,input,questionnaire pm_climate_class,input,questionnaire +vm_fallow,input,questionnaire diff --git a/modules/59_som/static_jan19/sets.gms b/modules/59_som/static_jan19/sets.gms index 97ef2deb7d..b7463f3a51 100644 --- a/modules/59_som/static_jan19/sets.gms +++ b/modules/59_som/static_jan19/sets.gms @@ -7,7 +7,7 @@ sets noncropland59(land) Soil carbon conserving landuse types -/past, forestry, primforest, secdforest, other/ +/past, forestry, primforest, secdforest, other, urban/ exo_scen59 exogenous scenarios for soil organic matter loss /constant, fadeout_2050/ diff --git a/modules/62_material/exo_flexreg_apr16/declarations.gms b/modules/62_material/exo_flexreg_apr16/declarations.gms index 5b3475a4c7..d0f50eea5c 100644 --- a/modules/62_material/exo_flexreg_apr16/declarations.gms +++ b/modules/62_material/exo_flexreg_apr16/declarations.gms @@ -8,12 +8,17 @@ scalar s62_historical Switch for turning off historical material demand (1) / 1 / + s62_growth_rate_bioplastic Logistic growth rate of bioplastic demand (1); ; parameters - p62_dem_material_lh(i,kall) Material demand in last historical timestep (mio. tDM per yr) - p62_dem_food_lh(i) Food demand in last historical timestep (mio. tDM per yr) - p62_scaling_factor(i) Scaling factor for material demand (1) + p62_dem_material_lastcalibyear(i,kall) Material demand in last historical timestep (mio. tDM per yr) + p62_dem_food_lastcalibyear(i) Food demand in last historical timestep (mio. tDM per yr) + p62_scaling_factor(i) Scaling factor for material demand (1) + p62_dem_bioplastic(t,i) Demand for bioplastic (mio. t per yr) + p62_bioplastic_substrate(t,i,kall) Regional biomass needed as substrate for bioplastic production (mio. tDM per yr) + p62_bioplastic_substrate_lastcalibyear(i,kall) Bioplastic substrate in last historical timestep (mio. tDM per yr) + p62_bioplastic_substrate_double_counted(t,i,kall) Bioplastic substrate counted both in general material demand and demand for bioplastic (mio. tDM per yr) ; positive variables diff --git a/modules/62_material/exo_flexreg_apr16/equations.gms b/modules/62_material/exo_flexreg_apr16/equations.gms index 7db6e00930..53c18a1139 100644 --- a/modules/62_material/exo_flexreg_apr16/equations.gms +++ b/modules/62_material/exo_flexreg_apr16/equations.gms @@ -14,17 +14,19 @@ *' as the scaled version of material demand in last historical timestep *' depending on a scaling factor. This scaling factor is calculated as the *' ratio beween the food demand from last timestep and the food demand from -*' the last historical time step. +*' the last historical time step. If an exogenous target for bioplastic production +*' is set, material demand (substrate) for bioplastic production is included. +*' For historic years it is assumed that this demand is already part of the +*' general material demand, therefore the double-counted demand is subtracted. q62_dem_material(i2,kall) .. vm_dem_material(i2,kall) =e= sum(ct,f62_dem_material(ct,i2,kall))*s62_historical + - (p62_dem_material_lh(i2,kall) * p62_scaling_factor(i2)) - *(1-s62_historical) + (p62_dem_material_lastcalibyear(i2,kall) * p62_scaling_factor(i2)) + *(1-s62_historical) + sum(ct, p62_bioplastic_substrate(ct, i2, kall)) - + sum(ct, p62_bioplastic_substrate_double_counted(ct,i2,kall)) ; -*' Results are stored in the interface `vm_dem_material` and this interface -*' is then used in demand([16_demand]) module as a part of global supply-demand -*' balance for crop, livestock, secondary products and residues. + diff --git a/modules/62_material/exo_flexreg_apr16/input.gms b/modules/62_material/exo_flexreg_apr16/input.gms index 4783aca37b..6c4e9abb62 100644 --- a/modules/62_material/exo_flexreg_apr16/input.gms +++ b/modules/62_material/exo_flexreg_apr16/input.gms @@ -10,3 +10,22 @@ table f62_dem_material(t_all,i,kall) Historical material demand (mio. tDM) $ondelim $include "./modules/62_material/input/f62_dem_material.cs3" $offdelim; + +parameter f62_biomass2bioplastic_conversion_ratio(kall) Biomass demand for one unit of bioplastics (tDM biomass per tDM bioplastic) +/ +$ondelim +$include "./modules/62_material/input/f62_bioplastic2biomass.csv" +$offdelim +/ +; + +parameter f62_hist_dem_bioplastic(t_all) Historic demand for bioplastics (mio. tDM) +/ +$ondelim +$include "./modules/62_material/input/f62_hist_dem_bioplastic.csv" +$offdelim +/ +; + +scalar s62_max_dem_bioplastic maximum demand for bioplastics (mio. tDM per yr) / 400 /; +scalar s62_midpoint_dem_bioplastic midpoint of logistic function for bioplastic demand (yr) / 2050 /; diff --git a/modules/62_material/exo_flexreg_apr16/postsolve.gms b/modules/62_material/exo_flexreg_apr16/postsolve.gms index 4ce1b563b2..68be8d8259 100644 --- a/modules/62_material/exo_flexreg_apr16/postsolve.gms +++ b/modules/62_material/exo_flexreg_apr16/postsolve.gms @@ -5,14 +5,14 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de *' @code -*' The parameters `p62_dem_material_lh` and `p62_dem_food_lh` are overwritten -*' based on each time step optimization, in order to be used in next step. +*' The parameters `p62_dem_material_lastcalibyear` and `p62_dem_food_lastcalibyear` +*' are overwritten based on each time step optimization, in order to be used in next step. *' This is only carried out when the model is still running in the time period *' before (and including) y2010 with this model version. if (sum(sameas(t_past,t),1) = 1, - p62_dem_material_lh(i,kall) = f62_dem_material(t,i,kall); - p62_dem_food_lh(i)= sum(kfo, vm_dem_food.l(i,kfo)); + p62_dem_material_lastcalibyear(i,kall) = f62_dem_material(t,i,kall); + p62_dem_food_lastcalibyear(i) = sum(kfo, vm_dem_food.l(i,kfo)); ); *' @stop diff --git a/modules/62_material/exo_flexreg_apr16/preloop.gms b/modules/62_material/exo_flexreg_apr16/preloop.gms index 487203c5e0..8e0f53e746 100644 --- a/modules/62_material/exo_flexreg_apr16/preloop.gms +++ b/modules/62_material/exo_flexreg_apr16/preloop.gms @@ -5,5 +5,19 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de - p62_dem_material_lh(i,kall) =0; - p62_dem_food_lh(i)=1; + p62_dem_material_lastcalibyear(i,kall) = 0; + p62_dem_food_lastcalibyear(i) = 1; + p62_dem_bioplastic(t,i) = 0; + +* Bioplastic demand is based on historic values up to 2020, and a logistic function with given +* midpoint and maximum for future years. Global bioplastic demand is distributed to regions +* proportional to population due to lack of better data. + +if (s62_max_dem_bioplastic <> 0, + p62_dem_bioplastic(t,i) = f62_hist_dem_bioplastic(t) * (im_pop(t,i) / sum(i2, im_pop(t,i2))); + s62_growth_rate_bioplastic = log((s62_max_dem_bioplastic/f62_hist_dem_bioplastic("y2020")) - 1)/(s62_midpoint_dem_bioplastic-2020); + p62_dem_bioplastic(t,i)$(m_year(t)>2020) = s62_max_dem_bioplastic / (1 + exp(-s62_growth_rate_bioplastic*(m_year(t)-s62_midpoint_dem_bioplastic))) * (im_pop(t,i) / sum(i2, im_pop(t,i2))); +); + +* translate bioplastic demand to biomass demand using conversion factors between bioplastic and the different biomass sources +p62_bioplastic_substrate(t,i,kall) = p62_dem_bioplastic(t,i) * f62_biomass2bioplastic_conversion_ratio(kall); \ No newline at end of file diff --git a/modules/62_material/exo_flexreg_apr16/presolve.gms b/modules/62_material/exo_flexreg_apr16/presolve.gms index 20d0aac3dd..f7553f0844 100644 --- a/modules/62_material/exo_flexreg_apr16/presolve.gms +++ b/modules/62_material/exo_flexreg_apr16/presolve.gms @@ -19,6 +19,16 @@ else ); p62_scaling_factor(i) = 1; -p62_scaling_factor(i)$(p62_dem_food_lh(i) > 0) = sum(kfo, vm_dem_food.l(i,kfo)) / p62_dem_food_lh(i); +p62_scaling_factor(i)$(p62_dem_food_lastcalibyear(i) > 0) = sum(kfo, vm_dem_food.l(i,kfo)) / p62_dem_food_lastcalibyear(i); *' @stop + +* In t_past, biomass demand for bioplastic is already included in the general material demand, which is +* scaled for future years. Therefore we calculate the amount of biomass that is counted twice, and subtract +* it in the final biomass demand equation. +if (sum(sameas(t_past,t),1) = 1, + p62_bioplastic_substrate_double_counted(t,i,kall) = p62_bioplastic_substrate(t,i,kall); + p62_bioplastic_substrate_lastcalibyear(i,kall) = p62_bioplastic_substrate(t,i,kall); +else + p62_bioplastic_substrate_double_counted(t,i,kall) = p62_bioplastic_substrate_lastcalibyear(i,kall) * p62_scaling_factor(i); +); diff --git a/modules/62_material/exo_flexreg_apr16/realization.gms b/modules/62_material/exo_flexreg_apr16/realization.gms index fdb5ed523f..58c8840e03 100644 --- a/modules/62_material/exo_flexreg_apr16/realization.gms +++ b/modules/62_material/exo_flexreg_apr16/realization.gms @@ -12,6 +12,9 @@ *' material module based on historical data. The assumption that material demand *' grows proportional to food demand is a simplification that can be justified *' by the minor importance of non-bioenergy material usage of agricultural products. +*' In addition, biomass demand for bioplastic production can be included, with +*' future bioplastic production following a logistic curve with exogenously defined +*' target production. *####################### R SECTION START (PHASES) ############################## $Ifi "%phase%" == "sets" $include "./modules/62_material/exo_flexreg_apr16/sets.gms" diff --git a/modules/62_material/input/files b/modules/62_material/input/files index 7da2fb95c9..066a7ebcfd 100644 --- a/modules/62_material/input/files +++ b/modules/62_material/input/files @@ -1,2 +1,4 @@ * list of files that are required here f62_dem_material.cs3 +f62_bioplastic2biomass.csv +f62_hist_dem_bioplastic.csv \ No newline at end of file diff --git a/modules/62_material/module.gms b/modules/62_material/module.gms index a488e29d2e..c155dd722e 100644 --- a/modules/62_material/module.gms +++ b/modules/62_material/module.gms @@ -15,8 +15,10 @@ *' category, the use for bioenergy (oils and ethanol) has been excluded *' and is accounted for in the demand for bioenergy. Material demand in this *' context can be considered as a subset of "other utils" category of FAO. +*' In addition, future material demand for bioplastic production can be included +*' by setting a target bioplastic demand. -*' @authors Benjamin Bodirsky +*' @authors Benjamin Bodirsky, Debbora Leip *###################### R SECTION START (MODULETYPES) ########################## $Ifi "%material%" == "exo_flexreg_apr16" $include "./modules/62_material/exo_flexreg_apr16/realization.gms" diff --git a/modules/70_livestock/fbask_jan16/declarations.gms b/modules/70_livestock/fbask_jan16/declarations.gms index 02c0b7ca5a..e025f70550 100644 --- a/modules/70_livestock/fbask_jan16/declarations.gms +++ b/modules/70_livestock/fbask_jan16/declarations.gms @@ -14,7 +14,8 @@ positive variables equations q70_feed(i,kap,kall) Regional feed demand - q70_cost_prod_liv(i,req) Regional factor input costs for livestock production + q70_cost_prod_liv_labor(i) Regional labor costs for livestock production + q70_cost_prod_liv_capital(i) Regional capital costs for livestock production q70_cost_prod_fish(i) Regional factor input costs for fish production ; @@ -26,7 +27,7 @@ parameters p70_incr_cattle(t,i) Change in estimated cattle stocks attributed to food demand projections (1) pm_past_mngmnt_factor(t,i) Regional pasture management intensification factor (1) i70_cereal_scp_fadeout(t_all,i) Cereal feed fadeout (share 0-1) to be replaced by SCP (1) - i70_foddr_scp_fadeout(t_all,i) Fooder fadeout (share 0-1) to be replaced by SCP (1) + i70_foddr_scp_fadeout(t_all,i) Fodder fadeout (share 0-1) to be replaced by SCP (1) p70_country_dummy(iso) Dummy parameter indicating whether country is affected by feed scenarios (1) p70_feedscen_region_shr(t_all,i) Weighted share of region with regards to feed scenario of countries (1) p70_cost_share_livst(t,i,req) Capital and labor shares of the regional factor costs for plant production for livestock (1) @@ -37,11 +38,12 @@ parameters *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_dem_feed(t,i,kap,kall,type) Regional feed demand including byproducts (mio. tDM per yr) - ov_cost_prod_livst(t,i,req,type) Livestock factor costs (mio. USD05MER per yr) - ov_cost_prod_fish(t,i,type) Fish factor costs (mio. USD05MER per yr) - oq70_feed(t,i,kap,kall,type) Regional feed demand - oq70_cost_prod_liv(t,i,req,type) Regional factor input costs for livestock production - oq70_cost_prod_fish(t,i,type) Regional factor input costs for fish production + ov_dem_feed(t,i,kap,kall,type) Regional feed demand including byproducts (mio. tDM per yr) + ov_cost_prod_livst(t,i,req,type) Livestock factor costs (mio. USD05MER per yr) + ov_cost_prod_fish(t,i,type) Fish factor costs (mio. USD05MER per yr) + oq70_feed(t,i,kap,kall,type) Regional feed demand + oq70_cost_prod_liv_labor(t,i,type) Regional labor costs for livestock production + oq70_cost_prod_liv_capital(t,i,type) Regional capital costs for livestock production + oq70_cost_prod_fish(t,i,type) Regional factor input costs for fish production ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/70_livestock/fbask_jan16/equations.gms b/modules/70_livestock/fbask_jan16/equations.gms index 97c4a4fdba..c1ed962ead 100644 --- a/modules/70_livestock/fbask_jan16/equations.gms +++ b/modules/70_livestock/fbask_jan16/equations.gms @@ -29,11 +29,22 @@ q70_feed(i2,kap,kall) .. *' `i70_cost_regr(i,kli,"cost_regr_b")` is set to zero in the case of livestock *' products generated in monogastric systems. -q70_cost_prod_liv(i2,req) .. - vm_cost_prod_livst(i2,req) =e= sum(kli, vm_prod_reg(i2,kli) +*' To account for increased hourly labor costs and producitivity in case of an external +*' wage scenario, the total labor costs are scaled by the corresponding increase in hourly +*' labor costs and the related productivity gain from [36_employment]. + +q70_cost_prod_liv_labor(i2) .. + vm_cost_prod_livst(i2,"labor") =e= sum(kli, vm_prod_reg(i2,kli) + *(i70_cost_regr(i2,kli,"cost_regr_a") + i70_cost_regr(i2,kli,"cost_regr_b") + *sum((ct, sys_to_kli(sys,kli)),i70_livestock_productivity(ct,i2,sys)))) + *sum(ct, p70_cost_share_livst(ct,i2,"labor")) + *sum(ct, (1/pm_productivity_gain_from_wages(ct,i2)) * (pm_hourly_costs(ct,i2,"scenario") / pm_hourly_costs(ct,i2,"baseline"))); + +q70_cost_prod_liv_capital(i2) .. + vm_cost_prod_livst(i2,"capital") =e= sum(kli, vm_prod_reg(i2,kli) *(i70_cost_regr(i2,kli,"cost_regr_a") + i70_cost_regr(i2,kli,"cost_regr_b") *sum((ct, sys_to_kli(sys,kli)),i70_livestock_productivity(ct,i2,sys)))) - *sum(ct, p70_cost_share_livst(ct,i2,req)); + *sum(ct, p70_cost_share_livst(ct,i2,"capital")); q70_cost_prod_fish(i2) .. vm_cost_prod_fish(i2) =e= diff --git a/modules/70_livestock/fbask_jan16/preloop.gms b/modules/70_livestock/fbask_jan16/preloop.gms index 8949121356..e2b6227076 100644 --- a/modules/70_livestock/fbask_jan16/preloop.gms +++ b/modules/70_livestock/fbask_jan16/preloop.gms @@ -53,7 +53,7 @@ im_feed_baskets(t_all,i,kap,kcer70) = * After the substitution of foddr with SCP (1-i70_foddr_scp_fadeout), SCP is converted * back DM fm_attributes("nr","scp"). im_feed_baskets(t_all,i,kap,"scp") = im_feed_baskets(t_all,i,kap,"scp") - + (im_feed_baskets(t_all,i,kap,"foddr") * (1-i70_foddr_scp_fadeout(t_all,i)) * + + (im_feed_baskets(t_all,i,kap,"foddr") * (1-i70_foddr_scp_fadeout(t_all,i)) * fm_attributes("nr","foddr")) / fm_attributes("nr","scp"); im_feed_baskets(t_all,i,kap,"foddr") = im_feed_baskets(t_all,i,kap,"foddr") * i70_foddr_scp_fadeout(t_all,i); diff --git a/modules/70_livestock/fbask_jan16/sets.gms b/modules/70_livestock/fbask_jan16/sets.gms index c4fa905110..f2a548a1d3 100644 --- a/modules/70_livestock/fbask_jan16/sets.gms +++ b/modules/70_livestock/fbask_jan16/sets.gms @@ -6,6 +6,7 @@ *** | Contact: magpie@pik-potsdam.de sets + cost_regr Cost regression parameters /cost_regr_a,cost_regr_b/ @@ -42,5 +43,4 @@ sets lin_zero_10_50, lin_zero_20_50, lin_zero_20_30, lin_zero_20_70, lin_50pc_20_50, lin_50pc_20_50_extend65, lin_50pc_20_50_extend80, lin_50pc_10_50_extend90, lin_75pc_10_50_extend90, lin_80pc_20_50, lin_80pc_20_50_extend95, lin_90pc_20_50_extend95, lin_99-98-90pc_20_50-60-100, sigmoid_20pc_20_50, sigmoid_50pc_20_50, sigmoid_80pc_20_50 / - ; diff --git a/modules/73_timber/default/preloop.gms b/modules/73_timber/default/preloop.gms index 786a58c82e..63b06b81dd 100644 --- a/modules/73_timber/default/preloop.gms +++ b/modules/73_timber/default/preloop.gms @@ -40,7 +40,7 @@ if(s73_timber_demand_switch=1, p73_timber_demand_gdp_pop(t_all,i,"wood")$(p73_timber_demand_gdp_pop(t_all,i,"wood")/sum(i_to_iso(i,iso),p73_forestry_demand_prod_specific(t_all-1,iso,"industrial_roundwood")) > s73_increase_ceiling) = p73_timber_demand_gdp_pop(t_all-1,i,"wood") * s73_increase_ceiling; ); ); -display p73_timber_demand_gdp_pop; + ** Alternative wood use scenarios $ifthen "%c73_wood_scen%" == "construction" p73_timber_demand_gdp_pop(t_all,i,"wood") = p73_timber_demand_gdp_pop(t_all,i,"wood") * f73_demand_modifier(t_all,"%c73_wood_scen%"); diff --git a/output.R b/output.R index 47e730729a..25617c7cb3 100644 --- a/output.R +++ b/output.R @@ -84,7 +84,7 @@ runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { system("sclass") cat("\n") } else { - modes <- modes[-1:-2] + modes <- grep("^SLURM", modes, invert = TRUE, value = TRUE) } cat("\n",title,":\n",sep="") cat(paste(1:length(modes), modes, sep=": " ),sep="\n") @@ -113,6 +113,7 @@ runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { } runsubmit <- function(output, alloutputdirs, submit, script_path) { + if(!dir.exists("logs")) dir.create("logs") #Set value source_include so that loaded scripts know, that they are #included as source (instead of a load from command line) source_include <- TRUE @@ -130,18 +131,27 @@ runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { loop <- list(alloutputdirs) } else { loop <- alloutputdirs - } + } + rout_name <- sub("\\.R$","",sub("/","_",rout)) for(outputdir in loop) { message("\n# ",name, " -> ", outputdir) - r_command <- paste0("Rscript output.R outputdir=",paste(outputdir,collapse=",")," output=",rout," submit=direct") - sbatch_command <- paste0("sbatch --job-name=scripts-output --output=log_out-%j.out --error=log_out-%j.err --mail-type=END --time=200 --mem-per-cpu=8000 --wrap=\"",r_command,"\"") + r_command <- paste0("output.R outputdir=",paste(outputdir,collapse=",")," output=",rout," submit=direct") + sbatch_command <- paste0("sbatch ", + "--job-name=scripts-output ", + "--output=logs/out-", rout_name, "-%j.out ", + "--error=logs/out-", rout_name, "-%j.err ", + "--mail-type=END ", + "--time=200 ", + "--mem-per-cpu=8000 ", + "--wrap=\"Rscript ", r_command, "\"") if(submit=="direct") { tmp.env <- new.env() tmp.error <- try(sys.source(script,envir=tmp.env)) if(!is.null(tmp.error)) warning("Script ",name," was stopped by an error and not executed properly!") rm(tmp.env) } else if(submit=="background") { - system(paste0(r_command," &> ",format(Sys.time(), "blog_out-%Y-%H-%M-%S-%OS3.log")," &")) + log <- format(Sys.time(), paste0("logs/out-",rout_name,"-%Y-%H-%M-%S-%OS3.log")) + system2("Rscript", r_command, stderr = log, stdout = log, wait=FALSE) } else if(submit=="slurm standby") { system(paste(sbatch_command, "--qos=standby")) } else if(submit=="slurm standby maxMem") { diff --git a/scripts/output/extra/disaggregation_BII.R b/scripts/output/extra/disaggregation_BII.R index f54692a4ba..dca800a2c9 100644 --- a/scripts/output/extra/disaggregation_BII.R +++ b/scripts/output/extra/disaggregation_BII.R @@ -49,6 +49,14 @@ mapping <- readRDS(map_file) bii_lr <- BII(gdx, file = NULL, level = "cell", mode = "auto", landClass = "all", bii_coeff = NULL, side_layers = NULL) +# add BII values for primary other land (BII = 1) +bii_lr <- mbind( + bii_lr[,,"other", invert=TRUE], + setNames(bii_lr[,,"other"], c("primother.forested", "primother.nonforested")), + setNames(bii_lr[,,"other"], c("secdother.forested", "secdother.nonforested")) +) +bii_lr[,,c("primother.forested", "primother.nonforested")] <- 1 + # Load input data land_ini_lr <- readGDX(gdx, "f10_land", "f_land", format = "first_found")[, "y1995", ] land_lr <- land(gdx, sum = FALSE, level = "cell") @@ -122,21 +130,18 @@ land_hr <- interpolateAvlCroplandWeighted(x = land_lr, urban_land_hr = urban_land_hr, unit = "share") -land_hr <- land_hr[, "y1985", invert = TRUE] +# Add primary and secondaray other land +land_hr <- PrimSecdOtherLand(land_hr, land_hr_file) + +# specify potential natural vegetation land_hr <- land_hr * side_layers_hr[, , c("forested", "nonforested")] # Sum over land classes bii_hr <- dimSums(land_hr * bii_hr, dim = 3, na.rm = TRUE) -# Create new output folder for BII -baseDir <- getwd() -biiOutputDir <- file.path(baseDir, "output", "BII") -if (!dir.exists(biiOutputDir)) { - dir.create(biiOutputDir) -} - -write.magpie(bii_hr, file.path(biiOutputDir, paste0(title, "_cell.bii_0.5.nc")), comment = "unitless") -write.magpie(bii_hr, file.path(biiOutputDir, paste0(title, "_cell.bii_0.5.mz")), comment = "unitless") +# Save BII data as .nc and .mz file, the first for better transferabiltiy, the second one for faster processing +write.magpie(bii_hr, file.path(outputdir, paste0(title, "_cell.bii_0.5.nc")), comment = "unitless") +write.magpie(bii_hr, file.path(outputdir, paste0(title, "_cell.bii_0.5.mz")), comment = "unitless") # Clean up rm(bii_hr) diff --git a/scripts/output/extra/highres.R b/scripts/output/extra/highres.R index de712ae5e2..2fb6d12d64 100644 --- a/scripts/output/extra/highres.R +++ b/scripts/output/extra/highres.R @@ -109,6 +109,11 @@ highres <- function(cfg) { #max resources for parallel runs cfg$qos <- "priority_maxMem" + # set force download to FALSE + # otherwise data is download again when calling start_run(), which overwrites + # f21_trade_balance.cs3, f13_tau_scenario.csv, f32_max_aff_area.cs4 etc + cfg$force_download <- FALSE + #download input files with high resolution download_and_update(cfg) diff --git a/scripts/output/merge_report.R b/scripts/output/merge_report.R index 53844fc643..acb27179fb 100644 --- a/scripts/output/merge_report.R +++ b/scripts/output/merge_report.R @@ -45,7 +45,7 @@ for (i in 1:length(outputdir)) { a <- read.report(rep,as.list = FALSE) getNames(a,dim=1) <- scen #add to reporting mif file - write.report2(a,file="output/report_all.mif",append=TRUE,ndigit = 4,skipempty = FALSE) + write.report(a,file="output/report_all.mif",append=TRUE,ndigit = 4,skipempty = FALSE) } else missing <- c(missing,outputdir[i]) } if (!is.null(missing)) { diff --git a/scripts/output/projects/FSDP_collect.R b/scripts/output/projects/FSDP_collect.R new file mode 100644 index 0000000000..10ff4eaacc --- /dev/null +++ b/scripts/output/projects/FSDP_collect.R @@ -0,0 +1,244 @@ +# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | authors, and contributors see CITATION.cff file. This file is part +# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +# | AGPL-3.0, you are granted additional permissions described in the +# | MAgPIE License Exception, version 1.0 (see LICENSE file). +# | Contact: magpie@pik-potsdam.de + +# -------------------------------------------------------------- +# description: Collect reg, iso and grid level data from multiple FSDP runs +# comparison script: TRUE +# --------------------------------------------------------------- + +# Version 1.0, Florian Humpenoeder + +library(lucode2) +library(magclass) +library(gms) +library(magpiesets) +library(data.table) +library(gdx) +library(quitte) +library(m4fsdp) +library(stringr) + +############################# BASIC CONFIGURATION ############################# +if(!exists("source_include")) { + outputdir <- file.path("output/", list.dirs("output/", full.names = FALSE, recursive = FALSE)) + #Define arguments that can be read from command line + lucode2::readArgs("outputdir") +} +############################################################################### + +########## +#filter out calibration run +x <- unlist(lapply(strsplit(basename(outputdir), "_"), function(x) x[2])) +outputdir <- outputdir[which(x %in% c("FSECa", "FSECb", "FSECc", "FSECd", "FSECe"))] + +#get revision +x <- unlist(lapply(strsplit(basename(outputdir),"_"), function(x) x[1])) +if (length(unique(x)) == 1) rev <- unique(x) else stop("version prefix is not identical. Check your selection of runs") + +########## +# Append health impacts reports +hi_datasets_path <- "/p/projects/magpie/data/FSEC_healthImpactsDatasets_raw" +if (dir.exists(hi_datasets_path)) { + + hi_datasets <- list.files(hi_datasets_path) + hi_versionToUse <- grep(rev, hi_datasets, value = TRUE) + + if (length(hi_versionToUse) == 0) { + + message("In FSDP_collect.R: No corresponding version ID was found within the FSEC health impacts datasets. + Using the highest current version.") + + highestVersionNr <- max(as.numeric(str_extract(hi_datasets, "(?<=v)(.*?)(?=_)"))) + hi_versionToUse <- grep(paste0("v", highestVersionNr), hi_datasets, value = TRUE) + + } else if (length(hi_versionToUse) >= 2) { + stop("In FSDP_collect.R: More than one health impacts datasets with this scenario's version ID were found. + Only one is expected.") + } + + hi_versionToUse_path <- file.path(hi_datasets_path, hi_versionToUse) + hi_gdx <- suppressWarnings(readGDX(hi_versionToUse_path)) + + .appendHealthImpacts <- function(.x) { + cfg <- gms::loadConfig(file.path(.x, "config.yml")) + title <- cfg$title + + message("Appending health impact report: ", title) + tryCatch( + expr = { + appendReportHealthImpacts(healthImpacts_gdx = hi_gdx, + scenario = title, + dir = .x) + }, error = function(e) { + message("In FSDP_collect.R: Unable to append health impacts!\n", e) + } + ) + } + lapply(X = outputdir, FUN = .appendHealthImpacts) + +} else { + message("In FSDP_collect.R: Directory storing health impacts datasets wasn't found. Skipping health impacts.") +} + +########## +# Append nutrient surplus reports +.appendNutrientSurplus <- function(.x) { + cfg <- gms::loadConfig(file.path(.x, "config.yml")) + title <- cfg$title + + tryCatch( + expr = { + appendReportNutrientSurplus(scenario = title, dir = .x) + }, error = function(e) { + message("In FSDP_collect.R: Unable to append the nutrient surplus dataset!\n", e) + } + ) +} +lapply(X = outputdir, FUN = .appendNutrientSurplus) + +########## +# Generate output files +cat("\nStarting output generation\n") + +reg <- NULL +iso <- NULL +grid <- NULL +missing <- NULL + +saveRDS(outputdir,"outputdir.rds") + +for (i in 1:length(outputdir)) { + print(paste("Processing",outputdir[i])) + cfg <- gms::loadConfig(file.path(outputdir[i], "config.yml")) + + ### regional level outputs + rep<-file.path(outputdir[i],"report.rds") + if(file.exists(rep)) { + reg <- rbind(reg,as.data.table(readRDS(rep))) + } else missing <- c(missing,outputdir[i]) + + ### ISO level outputs + rep <- file.path(outputdir[i],"report_iso.rds") + if(file.exists(rep)) { + iso <- rbind(iso,as.data.table(readRDS(rep))) + } else missing <- c(missing,outputdir[i]) + + ### Grid level outputs + ## only for BAU and SDP to save time and storage + scen <- c("BAU", "FSDP") + if (unlist(strsplit(cfg$title, "_"))[3] %in% scen) { + y <- NULL + years <- c(2020, 2050) + + ## BII + nc_file <- file.path(outputdir[i], paste(cfg$title, "cell.bii_0.5.mz", sep = "_"))#Note the "_" instead of "-" + if(file.exists(nc_file)) { + a <- read.magpie(nc_file)[,years,] + getNames(a) <- "BII (index)" + getSets(a,fulldim = F)[3] <- "variable" + a <- addLocation(a) + y <- mbind(y,a) + } else missing <- c(missing,outputdir[i]) + + ## Crop diversity + nc_file <- file.path(outputdir[i], paste0(scen, "-CropDiversityGridded.nc")) + if(file.exists(nc_file)) { + a <- read.magpie(nc_file)[,years, "ShannonCropDiversity"] + getNames(a) <- "Shannon crop diversity (index)" + getSets(a,fulldim = F)[3] <- "variable" + a <- addLocation(a) + y <- mbind(y,a) + } else missing <- c(missing,outputdir[i]) + + ## land patterns Mha + nc_file <- file.path(outputdir[i], "cell.land_0.5.mz") + if(file.exists(nc_file)) { + a <- read.magpie(nc_file)[,years,] + getNames(a) <- paste0(getNames(a)," (Mha)") + getSets(a,fulldim = F)[3] <- "variable" + a <- addLocation(a) + y <- mbind(y,a) + } else missing <- c(missing,outputdir[i]) + + ## land patterns share + nc_file <- file.path(outputdir[i], "cell.land_0.5_share.mz") + if(file.exists(nc_file)) { + a <- read.magpie(nc_file)[,years,] + getNames(a) <- paste0(getNames(a)," (area share)") + getSets(a,fulldim = F)[3] <- "variable" + a <- addLocation(a) + y <- mbind(y,a) + } else missing <- c(missing,outputdir[i]) + + ## Nitrogen + nc_file <- file.path(outputdir[i], paste(cfg$title,"nutrientSurplus_intensity.mz", sep="-")) + if(file.exists(nc_file)) { + a <- read.magpie(nc_file)[,years,] + getNames(a) <- "nutrientSurplus (kg N per ha)" + getSets(a,fulldim = F)[3] <- "variable" + a <- addLocation(a) + y <- mbind(y,a) + } else missing <- c(missing,outputdir[i]) + + ## Water + nc_file <- file.path(outputdir[i], paste("watStressViolations.mz", sep = "-")) + if (file.exists(nc_file)) { + a <- read.magpie(nc_file)[, years, ] + getNames(a) <- "water stress and violations" + getSets(a, fulldim = FALSE)[3] <- "variable" + a <- addLocation(a) + y <- mbind(y, a) + } else missing <- c(missing, outputdir[i]) + + #add dimensions + + if (is.null(y)) { + message("Scenario: ", cfg$title, " contained none of the cellular output data.") + } else { + y <- add_dimension(y, dim = 3.1, add = "scenario", nm = gsub(".", "_", cfg$title, fixed = TRUE)) + y <- add_dimension(y, dim = 3.1, add = "model", nm = "MAgPIE") + getSets(y, fulldim = FALSE)[2] <- "period" + + #save as data.frame with xy coordinates + y <- as.data.table(as.data.frame(y, rev = 3)) + + #bind together + grid <- rbind(grid, y) + } + } +} + +if (!is.null(missing)) { + cat("\nList of folders with missing report files\n") + print(missing) +} + +message("Saving rds files ...") + +saveRDS(reg, file = file.path("output", paste(rev, "FSDP_reg.rds", sep = "_")), version = 2, compress = "xz") +saveRDS(iso, file = file.path("output", paste(rev, "FSDP_iso.rds", sep = "_")), version = 2, compress = "xz") +saveRDS(grid, file = file.path("output", paste(rev, "FSDP_grid.rds", sep = "_")), version = 2, compress = "xz") + +#save i_to_iso mapping +gdx <- file.path(outputdir[1], "fulldata.gdx") +reg2iso <- readGDX(gdx, "i_to_iso") +names(reg2iso) <- c("region", "iso_a3") +write.csv(reg2iso, "output/reg2iso.csv") +saveRDS(reg2iso, file = file.path("output", "reg2iso.rds"), version = 2, compress = "xz") + +#save validation file +val <- file.path(outputdir[1], "validation.mif") +val <- as.data.table(read.quitte(val)) +saveRDS(val, file = file.path("output", paste(rev, "FSDP_validation.rds", sep = "_")), version = 2, compress = "xz") + +message("Plotting figures ...") +heatmapFSDP(reg, tableType = 1, file = file.path("output", paste(rev, "FSDP_heatmap1.jpg", sep = ""))) +heatmapFSDP(reg, tableType = "2a", file = file.path("output", paste(rev, "FSDP_heatmap2a.jpg", sep = ""))) +heatmapFSDP(reg, tableType = 3, file = file.path("output", paste(rev, "FSDP_heatmap3.jpg", sep = "_"))) +spatialMapsFSDP(reg, iso, grid, reg2iso, file = file.path("output", paste(rev, "FSDP_spatialMaps.jpg", sep = "_"))) +supplPlotsFSDP(reg, scenarioType = "all", file = file.path("output", paste(rev, "FSDP_supplPlots.jpg", sep = "_"))) +SupplPlotsCropShr(gdx = gdx, file = file.path("output", paste(rev, "FSDP_supplPlotCropShr.jpg", sep = "_")) ) \ No newline at end of file diff --git a/scripts/output/projects/FSDP_process.R b/scripts/output/projects/FSDP_process.R new file mode 100644 index 0000000000..ef7dab0b18 --- /dev/null +++ b/scripts/output/projects/FSDP_process.R @@ -0,0 +1,112 @@ +# | (C) 2008-2022 Potsdam Institute for Climate Impact Research (PIK) +# | authors, and contributors see CITATION.cff file. This file is part +# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +# | AGPL-3.0, you are granted additional permissions described in the +# | MAgPIE License Exception, version 1.0 (see LICENSE file). +# | Contact: magpie@pik-potsdam.de + +# ------------------------------------------------------------------------------------------------- +# description: Post-processing of FSEC scenarios, specifically generating dietary data +# comparison script: TRUE +# ------------------------------------------------------------------------------------------------- + +# Version 1.00 - Michael Crawford + +library(gms) +library(gdxrrw) +library(withr) + +message("Starting FSDP_process output runscript") + +############################# BASIC CONFIGURATION ####################################### + +if (!exists("source_include")) { + + outputdir <- file.path("output/", list.dirs("output/", full.names = FALSE, recursive = FALSE)) + lucode2::readArgs("outputdir") + +} + +######################################################################################### + +# ----------------------------------------------------------------------------------------------------------------- +# Merge dietary outputs from multiple FSEC scenarios into two .csv files + +message("Merging dietary outputs into \"caloricSupply.csv\" and \"dietaryIndicators.csv\"") + +caloricSupply_mergePath <- file.path("output", "caloricSupply.csv") +dietaryIndicators_mergePath <- file.path("output", "dietaryIndicators.csv") + +if (file.exists(caloricSupply_mergePath) || file.exists(dietaryIndicators_mergePath)) { + message("Merge files are already present for these runs. Removing these old files.") + file.remove(caloricSupply_mergePath, dietaryIndicators_mergePath) +} + +file.create(caloricSupply_mergePath, dietaryIndicators_mergePath) + +.writeDietaryIndicators <- function(.dir) { + + cfg <- gms::loadConfig(file.path(.dir, "config.yml")) + title <- cfg$title + + caloricSupply <- read.csv(file.path(.dir, paste0(title, "_caloricSupply.csv")), check.names = FALSE) + dietaryIndicators <- read.csv(file.path(.dir, paste0(title, "_dietaryIndicators.csv")), check.names = FALSE) + + if (file.info(caloricSupply_mergePath)$size == 0) { + # Include the header + write.table(caloricSupply, file = caloricSupply_mergePath, + quote = TRUE, sep = ",", row.names = FALSE, col.names = FALSE) + } else { + # Otherwise simply append + write.table(caloricSupply, file = caloricSupply_mergePath, + quote = TRUE, sep = ",", row.names = FALSE, col.names = FALSE, + append = TRUE) + } + + if (file.info(dietaryIndicators_mergePath)$size == 0) { + # Include the header + write.table(dietaryIndicators, file = dietaryIndicators_mergePath, + quote = TRUE, sep = ",", row.names = FALSE, col.names = FALSE) + } else { + # Otherwise simply append + write.table(dietaryIndicators, file = dietaryIndicators_mergePath, + quote = TRUE, sep = ",", row.names = FALSE, col.names = FALSE, + append = TRUE) + } +} + +# Only merge dietary indicators from selected, dietary-related, scenarios +dietRelatedScenarios <- c("c_BAU", + "d_SSP1bau", "d_SSP1PLUSbau", "d_SSP2bau", "d_SSP3bau", "d_SSP4bau", "d_SSP5bau", + "d_SSP1fsdp", "d_SSP1PLUSfsdp", "d_SSP2fsdp", "d_SSP3fsdp", "d_SSP4fsdp", "d_SSP5fsdp", + "a_NoUnderweight", "a_NoOverweight", + "a_DietVegFruitsNutsSeeds", "a_DietMonogastrics", "a_DietRuminants", + "a_DietLegumes", "a_DietEmptyCals", "a_DietFish", + "a_LessFoodWaste", + "e_FSDP", + "b_REDDaffRuminants", "b_DietRotations", "b_MonogastricsRotations", + "b_TradeMonogastrics", "b_TradeRuminants", "b_TradeVeggies", + "b_MonogastricsVeggies", "b_SoilMonogastric", "b_SoilMonogastricRuminants", + "b_AllNitrogen", "b_AllHealth", "b_Efficiency", "b_Sufficiency") + +outputdir_diets <- lapply(X = dietRelatedScenarios, FUN = function(.x) grep(x = outputdir, pattern = .x, value = TRUE)) +outputdir_diets <- unlist(outputdir_diets) + +lapply(X = outputdir_diets, FUN = .writeDietaryIndicators) + + +# ----------------------------------------------------------------------------------------------------------------- +# Produce .gdx files from two .csv files for Marco Springmann + +with_dir(file.path("output"), { + gamsScript <- "csv2gdx_dietaryIndicators.gms" + gamsScriptLst <- "csv2gdx_dietaryIndicators.lst" + file.create(gamsScript) + cat("$call csv2gdx dietaryIndicators.csv output=dietaryIndicators.gdx id=dietaryIndicators index=1..6 values=7..11 useHeader=y\n", + file = gamsScript, append = TRUE) + cat("$call csv2gdx caloricSupply.csv output=caloricSupply.gdx id=caloricSupply index=1,2,3,4 values=5 useHeader=y", + file = gamsScript, append = TRUE) + gams(gamsScript) + file.remove(gamsScript) + file.remove(gamsScriptLst) +}) diff --git a/scripts/output/projects/FSEC_AlessandroPassaro.R b/scripts/output/projects/FSEC_AlessandroPassaro.R new file mode 100644 index 0000000000..3167a36adf --- /dev/null +++ b/scripts/output/projects/FSEC_AlessandroPassaro.R @@ -0,0 +1,53 @@ +# | (C) 2008-2022 Potsdam Institute for Climate Impact Research (PIK) +# | authors, and contributors see CITATION.cff file. This file is part +# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +# | AGPL-3.0, you are granted additional permissions described in the +# | MAgPIE License Exception, version 1.0 (see LICENSE file). +# | Contact: magpie@pik-potsdam.de + +# -------------------------------------------------------------- +# description: Create FSEC outputs for use by Alessandro Passaro +# comparison script: FALSE +# --------------------------------------------------------------- + +# Version 1.00 - Michael Crawford +# 1.00: first working version + +library(gms) +library(magpie4) + +message("Starting FSEC_AlessandroPassaro output runscript") + +############################# BASIC CONFIGURATION ####################################### +if (!exists("source_include")) { + + title <- NULL + outputdir <- NULL + + # Define arguments that can be read from command line + readArgs("outputdir", "title") + +} +######################################################################################### + +message("Script started for output directory: ", outputdir) +cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) +title <- cfg$title + +message("Creating an output directory for Alessandro Passaro's datasets") +alessandroPassaroDir <- file.path(".", "output", "AlessandroPassaro") +if (!dir.exists(alessandroPassaroDir)) { + dir.create(alessandroPassaroDir) +} + +reportOutputDir <- file.path(alessandroPassaroDir, title) +if (dir.exists(reportOutputDir)) { + message("Warning in FSEC_AlessandroPassaro: Output directory for " , title, " already exists. Results will be overwritten.") +} +suppressWarnings(dir.create(reportOutputDir)) + +message("Generating Alessandro Passaro's output for the run: ", title) + +out <- getReportFSECAlessandroPassaro(magpieOutputDir = outputdir, + reportOutputDir = reportOutputDir, + scenario = title) \ No newline at end of file diff --git a/scripts/output/projects/FSEC_SimonDietz.R b/scripts/output/projects/FSEC_SimonDietz.R new file mode 100644 index 0000000000..a22f83c9aa --- /dev/null +++ b/scripts/output/projects/FSEC_SimonDietz.R @@ -0,0 +1,54 @@ +# | (C) 2008-2022 Potsdam Institute for Climate Impact Research (PIK) +# | authors, and contributors see CITATION.cff file. This file is part +# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +# | AGPL-3.0, you are granted additional permissions described in the +# | MAgPIE License Exception, version 1.0 (see LICENSE file). +# | Contact: magpie@pik-potsdam.de + +# -------------------------------------------------------------- +# description: Create FSEC outputs for use by Simon Dietz +# comparison script: FALSE +# --------------------------------------------------------------- + +# Version 1.00 - Michael Crawford +# 1.00: first working version + +library(gms) +library(magpie4) + +message("Starting FSEC_SimonDietz output runscript") + +############################# BASIC CONFIGURATION ####################################### +if (!exists("source_include")) { + + title <- NULL + outputdir <- NULL + + # Define arguments that can be read from command line + readArgs("outputdir", "title") + +} +######################################################################################### + +message("Script started for output directory: ", outputdir) +cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) +title <- cfg$title + +message("Creating an output directory for Simon Dietz's datasets") +simonDietzDir <- file.path(".", "output", "SimonDietz") +if (!dir.exists(simonDietzDir)) { + dir.create(simonDietzDir) +} + +reportOutputDir <- file.path(simonDietzDir, title) +if (dir.exists(reportOutputDir)) { + message("Warning in FSEC_SimonDietz: Output directory for " , title, " already exists. Results will be overwritten.") +} +suppressWarnings(dir.create(reportOutputDir)) + +message("Generating Simon Dietz's output for the run: ", title) + +out <- getReportFSECSimonDietz(magpieOutputDir = outputdir, + reportOutputDir = reportOutputDir, + scenario = title) + diff --git a/scripts/output/projects/FSEC_StevenLord.R b/scripts/output/projects/FSEC_StevenLord.R index 094892bc72..4cba83b2ff 100644 --- a/scripts/output/projects/FSEC_StevenLord.R +++ b/scripts/output/projects/FSEC_StevenLord.R @@ -34,17 +34,20 @@ message("Script started for output directory: ", outputdir) cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) title <- cfg$title -message("Generating StevenLord output for the run: ", title) -gdx <- file.path(outputdir, "fulldata.gdx") +message("Creating an output directory for Steven Lord's datasets") +stevenLordDir <- file.path(".", "output", "StevenLord") +if (!dir.exists(stevenLordDir)) { + dir.create(stevenLordDir) +} -baseDir <- getwd() -stevenLordOutputDir <- file.path(baseDir, "output", "StevenLord") -if (!dir.exists(stevenLordOutputDir)) { - dir.create(stevenLordOutputDir) +reportOutputDir <- file.path(stevenLordDir, title) +if (dir.exists(reportOutputDir)) { + message("Warning in FSEC_StevenLord: Output directory for " , title, " already exists. Results will be overwritten.") } +suppressWarnings(dir.create(reportOutputDir)) + +message("Generating Steven Lord's output for the run: ", title) -# Grid-level nitrogen pollution -out <- getReportFSECStevenLord(gdx = gdx, - reportOutputDir = stevenLordOutputDir, - magpieOutputDir = outputdir, +out <- getReportFSECStevenLord(magpieOutputDir = outputdir, + reportOutputDir = reportOutputDir, scenario = title) diff --git a/scripts/output/projects/FSEC_costs.R b/scripts/output/projects/FSEC_costs.R index 67df2b3521..31882db059 100644 --- a/scripts/output/projects/FSEC_costs.R +++ b/scripts/output/projects/FSEC_costs.R @@ -37,12 +37,6 @@ title <- cfg$title message("Generating costs output for the run: ", title) gdx <- file.path(outputdir, "fulldata.gdx") -baseDir <- getwd() -costsOutputDir <- file.path(baseDir, "output", "costs") -if (!dir.exists(costsOutputDir)) { - dir.create(costsOutputDir) -} - out <- getReportFSECCosts(gdx = gdx, - reportOutputDir = costsOutputDir, + reportOutputDir = outputdir, scenario = title) diff --git a/scripts/output/projects/FSEC_cropDiversityGrid.R b/scripts/output/projects/FSEC_cropDiversityGrid.R new file mode 100644 index 0000000000..c590626ff6 --- /dev/null +++ b/scripts/output/projects/FSEC_cropDiversityGrid.R @@ -0,0 +1,44 @@ +# | (C) 2008-2022 Potsdam Institute for Climate Impact Research (PIK) +# | authors, and contributors see CITATION.cff file. This file is part +# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +# | AGPL-3.0, you are granted additional permissions described in the +# | MAgPIE License Exception, version 1.0 (see LICENSE file). +# | Contact: magpie@pik-potsdam.de + +# -------------------------------------------------------------- +# description: Create FSEC Crop Diversity Map +# comparison script: FALSE +# --------------------------------------------------------------- + +# Version 1.00 - Patrick v. Jeetze +# 1.00: first working version + +library(gms) +library(magpie4) + +message("Starting FSEC gridded crop diversity output runscript") + +############################# BASIC CONFIGURATION ####################################### +if (!exists("source_include")) { + + title <- NULL + outputdir <- NULL + + # Define arguments that can be read from command line + readArgs("outputdir", "title") + +} +######################################################################################### + +message("Script started for output directory: ", outputdir) +cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) +title <- cfg$title + +message("Generating crop diversity map for the run: ", title) +gdx <- file.path(outputdir, "fulldata.gdx") + +# Grid-level nitrogen pollution +out <- getReportFSECCropDiversityGrid(gdx = gdx, + reportOutputDir = outputdir, + magpieOutputDir = outputdir, + scenario = title) diff --git a/scripts/output/projects/FSEC_dietaryIndicators.R b/scripts/output/projects/FSEC_dietaryIndicators.R index 52ca7f1393..fa8ae72953 100644 --- a/scripts/output/projects/FSEC_dietaryIndicators.R +++ b/scripts/output/projects/FSEC_dietaryIndicators.R @@ -39,12 +39,7 @@ message("Generating DietaryIndicators output for the run: ", title) gdx <- file.path(outputdir, "fulldata.gdx") report <- getReportDietaryIndicators(gdx, scenario = title) -dietaryIndicatorsOutputDir <- file.path(baseDir, "output", "DietaryIndicators") -if (!dir.exists(dietaryIndicatorsOutputDir)) { - dir.create(dietaryIndicatorsOutputDir) -} - -Map(f = function(x, i) write.csv(x, file = file.path(dietaryIndicatorsOutputDir, paste0(title, "_", i, ".csv")), +Map(f = function(x, i) write.csv(x, file = file.path(outputdir, paste0(title, "_", i, ".csv")), row.names = FALSE, quote = TRUE), x = report, i = names(report)) diff --git a/scripts/output/projects/FSEC_nitrogenPollution.R b/scripts/output/projects/FSEC_nitrogenPollution.R index 79b6639094..c107a257f5 100644 --- a/scripts/output/projects/FSEC_nitrogenPollution.R +++ b/scripts/output/projects/FSEC_nitrogenPollution.R @@ -35,16 +35,8 @@ cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) title <- cfg$title message("Generating nitrogen pollution output for the run: ", title) -gdx <- file.path(outputdir, "fulldata.gdx") - -baseDir <- getwd() -pollutantsOutputDir <- file.path(baseDir, "output", "nitrogen") -if (!dir.exists(pollutantsOutputDir)) { - dir.create(pollutantsOutputDir) -} # Grid-level nitrogen pollution -out <- getReportFSECPollution(gdx = gdx, - reportOutputDir = pollutantsOutputDir, +out <- getReportFSECPollution(reportOutputDir = outputdir, magpieOutputDir = outputdir, scenario = title) diff --git a/scripts/output/projects/FSEC_water.R b/scripts/output/projects/FSEC_water.R new file mode 100644 index 0000000000..29fb97b4e0 --- /dev/null +++ b/scripts/output/projects/FSEC_water.R @@ -0,0 +1,48 @@ +# | (C) 2008-2022 Potsdam Institute for Climate Impact Research (PIK) +# | authors, and contributors see CITATION.cff file. This file is part +# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +# | AGPL-3.0, you are granted additional permissions described in the +# | MAgPIE License Exception, version 1.0 (see LICENSE file). +# | Contact: magpie@pik-potsdam.de + +# -------------------------------------------------------------- +# description: Create FSEC water indicator gridded outputs for map +# comparison script: FALSE +# --------------------------------------------------------------- + +# Version 1.00 - Felicitas Beier +# 1.00: first working version + +library(gms) +library(magpie4) + +message("Starting FSEC nitrogen pollution output runscript") + +############################# BASIC CONFIGURATION ####################################### +if (!exists("source_include")) { + + title <- NULL + outputdir <- NULL + + # Define arguments that can be read from command line + readArgs("outputdir", "title") + +} +######################################################################################### + +message("Script started for output directory: ", outputdir) +cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) +title <- cfg$title + +message("Generating water indicators output for the run: ", title) +gdx <- file.path(outputdir, "fulldata.gdx") +mapping <- readRDS(paste0(outputdir, "clustermap_rev4.75FSEC_c200_e2bdb6cd.rds")) + +# Grid-level water intdicators +efvViolation <- waterEFViolation(gdx, level = "grid", dir = outputdir) +efvViolation[efvViolation > 0] <- 1 +watStress <- waterStressRatio(gdx, level = "grid", dir = outputdir) +watStressViolations <- watStress +watStressViolations[efvViolation == 1] <- 100 + +write.magpie(watStressViolations, paste0(outputdir, "watStressViolations.mz")) diff --git a/scripts/output/projects/agmip_merge_report.R b/scripts/output/projects/agmip_merge_report.R index 5cc0a23543..ee7c46ab55 100644 --- a/scripts/output/projects/agmip_merge_report.R +++ b/scripts/output/projects/agmip_merge_report.R @@ -48,7 +48,7 @@ for (i in 1:length(outputdir)) { a <- read.report(rep,as.list = FALSE) getNames(a,dim=1) <- scen #add to reporting csv file - write.report2(a,file="output/agmip_report_full.csv",append=TRUE,ndigit = 4,skipempty = FALSE) + write.report(a,file="output/agmip_report_full.csv",append=TRUE,ndigit = 4,skipempty = FALSE) } else missing <- c(missing,outputdir[i]) } if (!is.null(missing)) { diff --git a/scripts/output/projects/agmip_report.R b/scripts/output/projects/agmip_report.R index 298bb32cd7..0d7816f94f 100644 --- a/scripts/output/projects/agmip_report.R +++ b/scripts/output/projects/agmip_report.R @@ -24,15 +24,15 @@ if(!exists("source_include")) { } cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) -gdx <- file.path(outputdir,"fulldata.gdx") +gdx <- file.path(outputdir, "fulldata.gdx") mif <- paste0(outputdir, "/agmip_report.mif") rds <- paste0(outputdir, "/agmip_report.rds") ############################################################################### -report <- getReportAgMIP(gdx,scenario = cfg$title) +report <- getReportAgMIP(gdx, scenario = cfg$title) ###regional aggregation -write.report2(report, file=mif) -saveRDS(as.quitte(report),file=rds) +write.report(report, file = mif) +saveRDS(as.quitte(report), file = rds) diff --git a/scripts/output/projects/fsdp_merge_report.R b/scripts/output/projects/fsdp_merge_report.R deleted file mode 100644 index f3a4c34c31..0000000000 --- a/scripts/output/projects/fsdp_merge_report.R +++ /dev/null @@ -1,58 +0,0 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -# | authors, and contributors see CITATION.cff file. This file is part -# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -# | AGPL-3.0, you are granted additional permissions described in the -# | MAgPIE License Exception, version 1.0 (see LICENSE file). -# | Contact: magpie@pik-potsdam.de - -# -------------------------------------------------------------- -# description: merges several inms report files into one mif -# comparison script: TRUE -# --------------------------------------------------------------- - -# Version 1.0, merge_report script by Florian Humpeblder -# Version 1.01, adaptted to merge inms script by Benjamin Leon Bodirsky -# -library(lucode2) -library(magclass) -library(quitte) -library(gms) - -options(error=function()traceback(2)) - -############################# BASIC CONFIGURATION ############################# -if(!exists("source_include")) { - outputdir <- file.path("output/",list.dirs("output/", full.names = FALSE, recursive = FALSE)) - #Define arguments that can be read from command line - lucode2::readArgs("outputdir") -} -############################################################################### -cat("\nStarting output generation\n") - -missing <- NULL - -combined <- "output/inms.csv" - -if(file.exists(combined)) file.rename(combined,"output/inms.bak") - -for (i in 1:length(outputdir)) { - print(paste("Processing",outputdir[i])) - #gdx file - rep<-file.path(outputdir[i],"report_fsdp.mif") - if(file.exists(rep)) { - #get scenario name - cfg <- gms::loadConfig(file.path(outputdir[i], "config.yml")) - scen <- cfg$title - #read-in reporting file - a <- read.report(rep,as.list = FALSE) - getNames(a,dim=1) <- scen - #add to reporting csv file - write.report2(a,file=combined,append=TRUE,ndigit = 4,skipempty = FALSE) - } else missing <- c(missing,outputdir[i]) -} -if (!is.null(missing)) { - cat("\nList of folders with missing report.mif\n") - print(missing) -} - -if(file.exists(combined)) saveRDS(read.quitte(combined),file = "output/inms.rds") diff --git a/scripts/output/projects/fsdp_reporting_reg.R b/scripts/output/projects/fsdp_reporting_reg.R deleted file mode 100644 index 6f15d16156..0000000000 --- a/scripts/output/projects/fsdp_reporting_reg.R +++ /dev/null @@ -1,66 +0,0 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -# | authors, and contributors see CITATION.cff file. This file is part -# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -# | AGPL-3.0, you are granted additional permissions described in the -# | MAgPIE License Exception, version 1.0 (see LICENSE file). -# | Contact: magpie@pik-potsdam.de - -# -------------------------------------------------------------- -# description: extract inms-report in mif format from run -# comparison script: FALSE -# --------------------------------------------------------------- - -#Version 1.00 - Benjamin Leon Bodirsky -# 1.00: first working version - -library(lucode2) -library(magpie4) -library(magpiesets) -library(iamc) -library(gms) -print("Start inms reporting reg runscript") - -############################# BASIC CONFIGURATION ####################################### - -if(!exists("source_include")) { - - title <- "inms_SSP2_RCP4p5_PolicyLow_v4" - outputdir <- "output/inms_SSP2_RCP4p5_PolicyLow_v4_2020-07-13_15.37.07" - - ###Define arguments that can be read from command line - readArgs("outputdir","title") -} -######################################################################################### - -print(paste0("script started for output directory",outputdir)) - -wdbefore <- getwd() -on.exit(setwd(wdbefore)) -setwd(outputdir) - -cfg <- gms::loadConfig("config.yml") -title <- cfg$title -print("generating FSDP output for the run: ") -print(title) - -filename <- paste0("report_",title,".mif") -gdx <- paste0("fulldata.gdx") -a <- getReportINMS(gdx,file=filename,scenario = title,dir=".") - -print(filename) -mif <- read.report(filename) - - -missingyears <- function(x){ - history=paste0("y",1965+((0:5)*5)) - x[[1]][[1]] <- time_interpolate(x[[1]][[1]],interpolated_year = c(history,paste0("y",2005+((0:9)*10))),integrate_interpolated_years = TRUE) - x[[1]][[1]][,history,] = 0 - return(x) -} - -#a <- c(missingyears(ssp1),missingyears(ssp2)) -a <- missingyears(mif) - -#write.reportProject(a,mapping=paste0(wdbefore,"/mapping_fsdp.csv"),file="report_fsdp.mif") -write.report(a,file="report_fsdp.mif") -warnings() diff --git a/scripts/output/projects/inms_merge_report.R b/scripts/output/projects/inms_merge_report.R index 5ca05fa721..e24fd785b1 100644 --- a/scripts/output/projects/inms_merge_report.R +++ b/scripts/output/projects/inms_merge_report.R @@ -31,14 +31,14 @@ cat("\nStarting output generation\n") missing <- NULL -combined="output/inms.csv" +combined <- "output/inms.csv" if(file.exists(combined)) file.rename(combined,"output/inms.bak") for (i in 1:length(outputdir)) { print(paste("Processing",outputdir[i])) #gdx file - rep<-file.path(outputdir[i],"report_inms.mif") + rep <- file.path(outputdir[i], "report_inms.mif") if(file.exists(rep)) { #get scenario name cfg <- gms::loadConfig(file.path(outputdir[i], "config.yml")) @@ -47,8 +47,10 @@ for (i in 1:length(outputdir)) { a <- read.report(rep,as.list = FALSE) getNames(a,dim=1) <- scen #add to reporting csv file - write.report2(a,file=combined,append=TRUE,ndigit = 4,skipempty = FALSE) - } else missing <- c(missing,outputdir[i]) + write.report(a, file = combined, append = TRUE, ndigit = 4, skipempty = FALSE) + } else { + missing <- c(missing,outputdir[i]) + } } if (!is.null(missing)) { cat("\nList of folders with missing report.mif\n") diff --git a/scripts/output/projects/inms_reporting_reg.R b/scripts/output/projects/inms_reporting_reg.R index 2ec5adc68e..a8caf6d979 100644 --- a/scripts/output/projects/inms_reporting_reg.R +++ b/scripts/output/projects/inms_reporting_reg.R @@ -62,5 +62,5 @@ missingyears=function(x){ a=missingyears(mif) write.reportProject(a,mapping=paste0(wdbefore,"/mapping_inms.csv"),file="report_inms.mif") -#write.report2(a,file="magpie_results_nov2019.mif") +#write.report(a,file="magpie_results_nov2019.mif") warnings() diff --git a/scripts/output/rds_report.R b/scripts/output/rds_report.R index 2d74e91c3f..ff1ed58336 100644 --- a/scripts/output/rds_report.R +++ b/scripts/output/rds_report.R @@ -6,7 +6,7 @@ # | Contact: magpie@pik-potsdam.de # -------------------------------------------------------------- -# description: extract report in rds format from run +# description: extract report in rds and mif format from run # comparison script: FALSE # position: 2 # --------------------------------------------------------------- @@ -26,20 +26,20 @@ if(!exists("source_include")) { } cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) -gdx <- file.path(outputdir,"fulldata.gdx") +gdx <- file.path(outputdir, "fulldata.gdx") rds <- paste0(outputdir, "/report.rds") mif <- paste0(outputdir, "/report.mif") -runstatistics <- paste0(outputdir,"/runstatistics.rda") +runstatistics <- paste0(outputdir, "/runstatistics.rda") resultsarchive <- "/p/projects/rd3mod/models/results/magpie" ############################################################################### -report <- getReport(gdx,scenario = cfg$title) -write.report2(report, file=mif) +report <- getReport(gdx, scenario = cfg$title) +write.report(report, file = mif) q <- as.quitte(report) if(all(is.na(q$value))) stop("No values in reporting!") -saveRDS(q,file=rds, version = 2) +saveRDS(q, file = rds, version = 2) if(file.exists(runstatistics) & dir.exists(resultsarchive)) { stats <- list() @@ -49,14 +49,14 @@ if(file.exists(runstatistics) & dir.exists(resultsarchive)) { # been saved to the archive before) and save statistics to the archive message("No id found in runstatistics.rda. Calling lucode2::runstatistics() to create one.") stats <- lucode2::runstatistics(file = runstatistics, submit = cfg$runstatistics) - message("Created the id ",stats$id) + message("Created the id ", stats$id) # save stats locally (including id) otherwise it would generate a new id (and # resubmit the results and the statistics) next time rds_report is executed - save(stats, file=runstatistics, compress="xz") + save(stats, file = runstatistics, compress = "xz") } # Save report to results archive - saveRDS(q,file=paste0(resultsarchive,"/",stats$id,".rds"), version = 2) + saveRDS(q, file = paste0(resultsarchive, "/", stats$id, ".rds"), version = 2) cwd <- getwd() setwd(resultsarchive) system("ls 1*.rds > files") diff --git a/scripts/output/rds_report_iso.R b/scripts/output/rds_report_iso.R new file mode 100644 index 0000000000..abd22944db --- /dev/null +++ b/scripts/output/rds_report_iso.R @@ -0,0 +1,39 @@ +# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | authors, and contributors see CITATION.cff file. This file is part +# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +# | AGPL-3.0, you are granted additional permissions described in the +# | MAgPIE License Exception, version 1.0 (see LICENSE file). +# | Contact: magpie@pik-potsdam.de + +# -------------------------------------------------------------- +# description: extract report in rds format from run +# comparison script: FALSE +# position: 3 +# --------------------------------------------------------------- + + +library(magclass) +library(magpie4) +library(lucode2) +library(quitte) +library(gms) +options("magclass.verbosity" = 1) + +############################# BASIC CONFIGURATION ############################# +if (!exists("source_include")) { + outputdir <- NULL + readArgs("outputdir") +} + +cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) +gdx <- file.path(outputdir,"fulldata.gdx") +rds_iso <- paste0(outputdir, "/report_iso.rds") +############################################################################### + +report <- getReportIso(gdx, scenario = cfg$title, dir = outputdir) +q <- as.quitte(report) +if (all(is.na(q$value))) { + stop("No values in reporting!") +} + +saveRDS(q, file = rds_iso, version = 2, compress = "xz") diff --git a/scripts/output/runBlackmagicc.R b/scripts/output/runBlackmagicc.R new file mode 100644 index 0000000000..725d497710 --- /dev/null +++ b/scripts/output/runBlackmagicc.R @@ -0,0 +1,35 @@ +# | (C) 2008-2022 Potsdam Institute for Climate Impact Research (PIK) +# | authors, and contributors see CITATION.cff file. This file is part +# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +# | AGPL-3.0, you are granted additional permissions described in the +# | MAgPIE License Exception, version 1.0 (see LICENSE file). +# | Contact: magpie@pik-potsdam.de + +# -------------------------------------------------------------- +# description: Append MAGICC7 warming pathways to a MAgPIE run's report.mif +# comparison script: FALSE +# --------------------------------------------------------------- + +# Version 1.00 - Michael Crawford +# 1.00: first working version + +library(gms) +library(blackmagicc) + +message("Starting Blackmagicc output script") + +############################# BASIC CONFIGURATION ####################################### +if (!exists("source_include")) { + + title <- NULL + outputdir <- NULL + + # Define arguments that can be read from command line + readArgs("outputdir", "title") + +} +######################################################################################### + +message("Script started for output directory: ", outputdir) + +blackmagicc(dir = outputdir, append = TRUE) diff --git a/scripts/projects/fsec.R b/scripts/projects/fsec.R new file mode 100644 index 0000000000..4f9fe02a32 --- /dev/null +++ b/scripts/projects/fsec.R @@ -0,0 +1,217 @@ +# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | authors, and contributors see CITATION.cff file. This file is part +# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +# | AGPL-3.0, you are granted additional permissions described in the +# | MAgPIE License Exception, version 1.0 (see LICENSE file). +# | Contact: magpie@pik-potsdam.de + +################################################################################ +# Define internal functions +################################################################################ + +fsecScenario <- function(scenario) { + + source("config/default.cfg") + + # Version number + v <- "v26_FSEC" + + x <- list(c_BAU = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = "FSEC"), + d_SSP1bau = list(standard = c("cc", "rcp4p5", "SSP1", "NDC", "ForestryEndo"), + fsec = c("FSEC", "SSP1")), + d_SSP1PLUSbau = list(standard = c("cc", "rcp2p6", "SSP1", "NDC", "ForestryEndo"), + fsec = c("FSEC", "SSP1", + "energy", "bioplastics", "population", "institutions", "timberCities")), + d_SSP2bau = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "SSP2")), + d_SSP3bau = list(standard = c("cc", "rcp7p0", "SSP3", "NDC", "ForestryEndo"), + fsec = c("FSEC", "SSP3")), + d_SSP4bau = list(standard = c("cc", "rcp6p0", "SSP4", "NDC", "ForestryEndo"), + fsec = c("FSEC", "SSP4")), + d_SSP5bau = list(standard = c("cc", "rcp8p5", "SSP5", "NDC", "ForestryEndo"), + fsec = c("FSEC", "SSP5")), + d_SSP1PLUSfsdp = list(standard = c("cc", "rcp2p6", "SSP1", "NDC", "ForestryEndo"), + fsec = c("FSEC", "SSP1", + "energy", "bioplastics", "population", "institutions", "timberCities", + "awms", "livestock", "nueMAC", "riceMAC", "biodiversity", "fairTrade", "minWage", + "REDDaff", "REDD", "landSharing", "landSparing", "waterSparing", "peatland", + "airPollution", "soil", "allDietAndWaste", "allEnvPrice")), + d_SSP1fsdp = list(standard = c("cc", "rcp4p5", "SSP1", "NDC", "ForestryEndo"), + fsec = c("FSEC", "SSP1", + "awms", "livestock", "nueMAC", "riceMAC", "biodiversity", "fairTrade", "minWage", + "REDDaff", "REDD", "landSharing", "landSparing", "waterSparing", "peatland", + "airPollution", "soil", "allDietAndWaste", "allEnvPrice")), + d_SSP2fsdp = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "SSP2", + "awms", "livestock", "nueMAC", "riceMAC", "biodiversity", "fairTrade", "minWage", + "REDDaff", "REDD", "landSharing", "landSparing", "waterSparing", "peatland", + "airPollution", "soil", "allDietAndWaste", "allEnvPrice")), + d_SSP3fsdp = list(standard = c("cc", "rcp7p0", "SSP3", "NDC", "ForestryEndo"), + fsec = c("FSEC", "SSP3", + "awms", "livestock", "nueMAC", "riceMAC", "biodiversity", "fairTrade", "minWage", + "REDDaff", "REDD", "landSharing", "landSparing", "waterSparing", "peatland", + "airPollution", "soil", "allDietAndWaste", "allEnvPrice")), + d_SSP4fsdp = list(standard = c("cc", "rcp6p0", "SSP4", "NDC", "ForestryEndo"), + fsec = c("FSEC", "SSP4", + "awms", "livestock", "nueMAC", "riceMAC", "biodiversity", "fairTrade", "minWage", + "REDDaff", "REDD", "landSharing", "landSparing", "waterSparing", "peatland", + "airPollution", "soil", "allDietAndWaste", "allEnvPrice")), + d_SSP5fsdp = list(standard = c("cc", "rcp8p5", "SSP5", "NDC", "ForestryEndo"), + fsec = c("FSEC", "SSP5", + "awms", "livestock", "nueMAC", "riceMAC", "biodiversity", "fairTrade", "minWage", + "REDDaff", "REDD", "landSharing", "landSparing", "waterSparing", "peatland", + "airPollution", "soil", "allDietAndWaste", "allEnvPrice")), + # Individual transformation clusters: + a_Population = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "population")), + a_EconDevelop = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "institutions")), + a_EnergyTrans = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "energy")), + a_Bioplastics = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "bioplastics")), + a_MinWage = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "minWage")), + a_NoUnderweight = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "noUnderweight")), + a_NoOverweight = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "noOverweight")), + a_DietVegFruitsNutsSeeds = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "fruitsNutsVegSeeds")), + a_DietMonogastrics = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "monogastrics")), + a_DietRuminants = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "ruminants")), + a_DietLegumes = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "pulses")), + a_DietEmptyCals = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "processed")), + a_DietFish = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "fish")), + a_LessFoodWaste = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "waste")), + a_ManureMngmt = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "awms")), + a_LivestockMngmt = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "livestock")), + a_CropeffTax = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "cropefficiency")), + a_NitrogenEff = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "nueMAC")), + a_RiceMit = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "riceMAC")), + a_LandUseDiversity = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "biodiversity")), + a_FairTrade = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "fairTrade")), + a_TimberCities = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "timberCities")), + a_REDDaff = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "REDDaff")), + a_REDD = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "REDD")), + a_CropRotations = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "landSharing")), + a_LandSparing = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "landSparing")), + a_WaterSparing = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "waterSparing")), + a_PeatlandSparing = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "peatland")), + a_AirPollution = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "airPollution")), + a_SoilCarbon = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "soil")), + # FSDP (all transformations active) + e_FSDP = list(standard = c("cc", "rcp2p6", "SSP1", "NDC", "ForestryEndo"), + fsec = c("FSEC", + "energy", "bioplastics", "population", "institutions", "timberCities", + "awms", "livestock", "nueMAC", "riceMAC", "biodiversity", "fairTrade", "minWage", + "REDDaff", "REDD", "landSharing", "landSparing", "waterSparing", "peatland", + "airPollution", "soil", "allDietAndWaste", "allEnvPrice")), + # Scenarios (combinations of transformation clusters) + b_ExternalPressures = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "population", "institutions", "energy", "bioplastics")), + b_WaterSoil = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "waterSparing", "soil")), + b_REDDaffRuminants = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "ruminants", "REDDaff")), + b_DietRotations = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "landSharing", "allDiet")), + b_MonogastricsRotations = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "landSharing", "monogastrics")), + b_TradeRotations = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "landSharing", "fairTrade")), + b_TradeREDDaff = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "fairTrade", "REDDaff")), + b_TradeSoil = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "fairTrade", "soil")), + b_TradeMonogastrics = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "fairTrade", "monogastrics")), + b_TradeRuminants = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "fairTrade", "ruminants")), + b_TradeVeggies = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "fairTrade", "fruitsNutsVegSeeds")), + b_MonogastricsVeggies = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "monogastrics", "fruitsNutsVegSeeds")), + b_SoilMonogastric = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "monogastrics", "soil")), + b_SoilMonogastricRuminants = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "monogastrics", "ruminants","soil")), + b_SoilRotations = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "landSharing", "soil")), + b_LivestockManureMngmt = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "livestock", "awms")), + b_LivestockNUEMngmt = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "livestock", "nueMAC")), + b_AllNitrogen = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "awms", "nueMAC", "monogastrics", "ruminants", "waste")), + b_AllClimate = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "nueMAC", "riceMAC", "awms", "allEnvPrice")), + b_FullBiodiv = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "biodiversity", "landSharing")), + b_AllEnvironment = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "airPollution", "biodiversity", "REDDaff", + "landSparing", "waterSparing", "peatland", "soil", "allEnvPrice")), + b_AllHealth = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "allDiet")), + b_AllInclusion = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "population", "institutions", "timberCities", "fairTrade", "minWage")), + #Bioeconomy + energy + timber # we do not have bioeconomy yet + b_Efficiency = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "awms", "waste", "fairTrade", "nueMAC")), + b_Sufficiency = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "allDietAndWaste")), + b_Protection = list(standard = c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "waterSparing", "landSparing", "peatland")) + ) + # Assign selected scenario to cfg + cfg <- setScenario(cfg, x[[scenario]]$standard) + cfg <- setScenario(cfg, x[[scenario]]$fsec, scenario_config = "config/scenario_fsec.csv") + + # Download gridded population data + gms::download_unpack(input = "FSEC_populationScenarios_v2_22-08-22.tgz", + targetdir = "./input", + repositories = cfg$repositories) + + # general + cfg$title <- paste(v, scenario, sep = "") + cfg$recalibrate <- FALSE + cfg$qos <- "standby_maxMem" + cfg$output <- c(cfg$output, + "rds_report_iso", + "extra/disaggregation_BII", + "projects/FSEC_dietaryIndicators", + "projects/FSEC_costs", + "projects/FSEC_nitrogenPollution", + "runBlackmagicc", + "projects/FSDP_process", + "projects/FSEC_StevenLord", + "projects/FSEC_SimonDietz", + "projects/FSEC_AlessandroPassaro" + ) + cfg$force_download <- TRUE + + return(cfg) +} diff --git a/scripts/run_submit/submit.R b/scripts/run_submit/submit.R index e1581fcb40..f830cdfffc 100644 --- a/scripts/run_submit/submit.R +++ b/scripts/run_submit/submit.R @@ -124,3 +124,14 @@ lucode2::runstatistics(file = paste0(cfg$results_folder, "/runstatisti timeOutputEnd = timeOutputEnd) print(warnings()) + +# quit with gams status as exit code unless model completed locally optimal everywhere +gamsCode <- Find(function(code) !code %in% c(2, 7), ms_all) +if (is.null(gamsCode) && 7 %in% ms_all) { + gamsCode <- 7 +} +if (!is.null(gamsCode)) { + exitCode <- gamsCode + 200 # low numbered exit codes are used by R, add 200 to avoid confusion + message("gams status was ", gamsCode, ", exiting with code ", exitCode) + quit(status = exitCode) +} diff --git a/scripts/start/extra/recalibrate_FSEC.R b/scripts/start/extra/recalibrate_FSEC.R index 6cac897727..bc9735d35e 100644 --- a/scripts/start/extra/recalibrate_FSEC.R +++ b/scripts/start/extra/recalibrate_FSEC.R @@ -13,63 +13,17 @@ library(magpie4) library(magclass) library(gms) -# Load start_run(cfg) function which is needed to start MAgPIE runs source("scripts/start_functions.R") -source("config/default.cfg") - -input <- c(regional = "rev4.73FSECmodeling_e2bdb6cd_magpie.tgz", - cellular = "rev4.73FSECmodeling_e2bdb6cd_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", - validation = "WARNINGS42_rev4.73FSECmodeling_e2bdb6cd_validation.tgz", - additional = "additional_data_rev4.26_FSEC.tgz", - calibration = "calibration_FSEC_18Jun22.tgz") - -# General settings: -general_settings <- function(title) { - - source("config/default.cfg") - - cfg$input <- input - cfg$title <- paste0("v7_", title) - cfg$recalibrate <- FALSE - cfg$qos <- "priority_maxMem" - cfg$output <- c(cfg$output #, - #"extra/disaggregation_BII", "projects/FSEC_dietaryIndicators", - #"projects/FSEC_environmentalPollution_grid" - ) - - # Climate change impacts activated, SSP2 default settings, NDC activated, endogenous forestry activated - cfg <- gms::setScenario(cfg, c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo")) - cfg$input['cellular'] <- "rev4.73FSECmodeling_e2bdb6cd_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz" - cfg$force_download <- TRUE - - # Nitrogen module with IPCC emissions factors rescaled with efficiency - cfg$gms$nitrogen <- "rescaled_jan21" - # emission policy not including any GHG sources - cfg$gms$c56_emis_policy <- "none" - # ghg price setting (only relevant when activated by c56_emis_policy) - cfg$gms$c56_pollutant_prices <- "R21M42-SDP-PkBudg1000" - # residue on field burning is set to "constant" - cfg$gms$c18_burn_scen <- "constant" - # C price driven afforestation is off by default - cfg$gms$s56_c_price_induced_aff <- "0" - # Soil organic carbon dynamics activated - cfg$gms$som <- "cellpool_aug16" - # Cost module: sticky - dynamic mode - cfg$gms$factor_costs <- "sticky_feb18" - - # Regional factor requirement costs (crop and livestock) - cfg$gms$c38_fac_req <- "reg" - cfg$gms$c70_fac_req_regr <- "reg" - - return(cfg) -} +source("scripts/projects/fsec.R") # ----------------------------------------------------------------------------------------------------------------- # Calibration run -cfg <- general_settings("calibration_FSEC_17Jun22") +cfg <- fsecScenario(scenario = "c_BAU") +cfg$title <- "FSEC14Oct22" cfg$results_folder <- "output/:title:" cfg$recalibrate <- TRUE cfg$recalibrate_landconversion_cost <- TRUE +cfg$best_calib <- TRUE cfg$output <- c("rds_report", "validation_short") cfg$force_replace <- TRUE start_run(cfg, codeCheck = FALSE) diff --git a/scripts/start/extra/recalibrate_FSEC_agroecologyTest.R b/scripts/start/extra/recalibrate_FSEC_agroecologyTest.R deleted file mode 100644 index 972a127f91..0000000000 --- a/scripts/start/extra/recalibrate_FSEC_agroecologyTest.R +++ /dev/null @@ -1,81 +0,0 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -# | authors, and contributors see CITATION.cff file. This file is part -# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -# | AGPL-3.0, you are granted additional permissions described in the -# | MAgPIE License Exception, version 1.0 (see LICENSE file). -# | Contact: magpie@pik-potsdam.de - -# -------------------------------------------------------- -# description: calculate and store new calibration factors for yields AND land conversion costs for FSEC regional setup (time consuming; up to 40 model runs with 1 or 5 time steps) -# -------------------------------------------------------- - -library(magpie4) -library(magclass) -library(gms) - -# Load start_run(cfg) function which is needed to start MAgPIE runs -source("scripts/start_functions.R") -source("config/default.cfg") - -input <- c(regional = "rev4.73FSECmodeling_e2bdb6cd_magpie.tgz", - cellular = "rev4.73FSECmodeling_e2bdb6cd_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", - validation = "WARNINGS42_rev4.73FSECmodeling_e2bdb6cd_validation.tgz", - additional = "additional_data_rev4.26_FSEC.tgz", - calibration = "calibration_FSEC_29Jun22.tgz") - -# General settings: -general_settings <- function(title) { - - source("config/default.cfg") - - cfg$input <- input - cfg$title <- paste0("v9a_", title) - cfg$recalibrate <- FALSE - cfg$qos <- "priority_maxMem" - cfg$output <- c(cfg$output #, - #"extra/disaggregation_BII", "projects/FSEC_dietaryIndicators", - #"projects/FSEC_environmentalPollution_grid" - ) - - # Climate change impacts activated, SSP2 default settings, NDC activated, endogenous forestry activated - cfg <- gms::setScenario(cfg, c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo")) - cfg$input['cellular'] <- "rev4.73FSECmodeling_e2bdb6cd_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz" - cfg$force_download <- TRUE - - # Nitrogen module with IPCC emissions factors rescaled with efficiency - cfg$gms$nitrogen <- "rescaled_jan21" - # emission policy not including any GHG sources - cfg$gms$c56_emis_policy <- "none" - # ghg price setting (only relevant when activated by c56_emis_policy) - cfg$gms$c56_pollutant_prices <- "R21M42-SDP-PkBudg1000" - # residue on field burning is set to "constant" - cfg$gms$c18_burn_scen <- "constant" - # C price driven afforestation is off by default - cfg$gms$s56_c_price_induced_aff <- "0" - # Soil organic carbon dynamics activated - cfg$gms$som <- "cellpool_aug16" - # Cost module: sticky - dynamic mode - cfg$gms$factor_costs <- "sticky_feb18" - - # Regional factor requirement costs (crop and livestock) - cfg$gms$c38_fac_req <- "reg" - cfg$gms$c70_fac_req_regr <- "reg" - - # Agroecology general settings - cfg$gms$crop <- "penalty_apr22" - cfg$gms$c30_rotation_scenario <- "default" - cfg$gms$c30_rotation_scenario_speed <- "by2050" - - return(cfg) -} - -# ----------------------------------------------------------------------------------------------------------------- -# Calibration run -cfg <- general_settings("calibration_FSEC_29Jun22") -cfg$results_folder <- "output/:title:" -cfg$recalibrate <- TRUE -cfg$recalibrate_landconversion_cost <- TRUE -cfg$output <- c("rds_report", "validation_short") -cfg$force_replace <- TRUE -start_run(cfg, codeCheck = FALSE) -magpie4::submitCalibration("FSEC") diff --git a/scripts/start/extra/test_maccs.R b/scripts/start/extra/test_maccs.R new file mode 100644 index 0000000000..41cec306ae --- /dev/null +++ b/scripts/start/extra/test_maccs.R @@ -0,0 +1,51 @@ +# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | authors, and contributors see CITATION.cff file. This file is part +# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +# | AGPL-3.0, you are granted additional permissions described in the +# | MAgPIE License Exception, version 1.0 (see LICENSE file). +# | Contact: magpie@pik-potsdam.de + +# ---------------------------------------------------------- +# description: Test marginal abatement costs +# ---------------------------------------------------------- + + +###################################### +#### Script to start a MAgPIE run #### +###################################### + +library(gms) +library(lucode2) +library(magclass) + +# Load start_run(cfg) function which is needed to start MAgPIE runs +source("scripts/start_functions.R") + +#start MAgPIE run +source("config/default.cfg") + +prefix <- "maccs_test_v10" + +for(ssp in c("SSP1","SSP2","SSP3","SSP4","SSP5")){ + source("config/default.cfg") + cfg=setScenario(cfg=cfg,scenario=ssp) + cfg$title <- paste(prefix,"newdefault",ssp,sep="_") + start_run(cfg,codeCheck=FALSE) + + source("config/default.cfg") + cfg=setScenario(cfg=cfg,scenario=ssp) + cfg$title <- paste(prefix,"newdefault_mitigation",ssp,sep="_") + cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-PkBudg900" # def = R21M42-SSP2-NPi + cfg$gms$c56_pollutant_prices_noselect <- "R21M42-SSP2-PkBudg900" # def = R21M42-SSP2-NPi + start_run(cfg,codeCheck=FALSE) + + source("config/default.cfg") + cfg=setScenario(cfg=cfg,scenario=ssp) + cfg$title <- paste(prefix,"newsetup_maxmaccs",ssp,sep="_") + cfg$gms$s57_maxmac_n_soil <- 201 # def = -1 + cfg$gms$s57_maxmac_n_awms <- 201 # def = -1 + cfg$gms$s57_maxmac_ch4_rice <- 201 # def = -1 + cfg$gms$s57_maxmac_ch4_entferm <- 201 # def = -1 + cfg$gms$s57_maxmac_ch4_awms <- 201 # def = -1 + start_run(cfg,codeCheck=FALSE) +} diff --git a/scripts/start/projects/paper_ClimNat.R b/scripts/start/projects/paper_ClimNat.R index 5dc9d157b9..9672e5c947 100644 --- a/scripts/start/projects/paper_ClimNat.R +++ b/scripts/start/projects/paper_ClimNat.R @@ -18,92 +18,93 @@ library(gms) library(lucode2) library(magclass) -# Load start_run(cfg) function which is needed to start MAgPIE runs source("scripts/start_functions.R") -#start MAgPIE run source("config/default.cfg") #cfg$force_download <- TRUE +cfg$force_replace <- TRUE cfg$results_folder <- "output/:title:" cfg$output <- c("rds_report","extra/disaggregation")#"extra/highres" -prefix <- "CN45" +prefix <- "CN72" + cfg$qos <- "priority" -for (pol in c("Ref","Climate","Nature","Climate+Nature","Climate+Nature+Food")) { +cfg$gms$c_timesteps <- "5year" +cfg$gms$biodiversity <- "bii_target" + +for (pol in c("CurPol","Carbon","Biodiversity","Integrated")) { for (ssp in c("SSP2")) { - if (pol == "Ref") { - cfg <- setScenario(cfg,c(ssp,"NPI","rcp7p0")) + if (pol == "CurPol") { + cfg <- setScenario(cfg,c(ssp,"NPI","rcp4p5")) cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-NPi"#"PIK_NPI" cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-NPi"#"PIK_NPI" + cfg$gms$s15_exo_diet <- 0 + cfg$gms$s15_exo_waste <- 0 cfg$gms$c60_biodem_level <- 1 cfg$gms$s32_aff_plantation <- 0 cfg$gms$s32_aff_bii_coeff <- 0 + cfg$gms$s32_max_aff_area <- Inf cfg$gms$s44_target_price <- 0 + cfg$gms$s44_bii_target <- 0 cfg$gms$c35_protect_scenario <- "WDPA" cfg$gms$c30_snv_target <- "none" cfg$gms$s30_snv_shr <- 0 - cfg$gms$c56_emis_policy <- "redd+_nosoil" - } else if (pol == "Climate") { - cfg <- setScenario(cfg,c(ssp,"NDC","rcp1p9")) + cfg$gms$s56_c_price_induced_aff <- 0 + } else if (pol == "Carbon") { + cfg <- setScenario(cfg,c(ssp,"NPI","rcp1p9")) cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-PkBudg900"#"PIK_LIN" - cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-PkBudg900"#"PIK_LIN" + cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-NPi"#"PIK_NPI" + cfg$gms$s15_exo_diet <- 0 + cfg$gms$s15_exo_waste <- 0 cfg$gms$c60_biodem_level <- 1 cfg$gms$s32_aff_plantation <- 0 cfg$gms$s32_aff_bii_coeff <- 0 + cfg$gms$s32_max_aff_area <- Inf cfg$gms$c35_forest_damage_end <- "by2030" cfg$gms$s44_target_price <- 0 + cfg$gms$s44_bii_target <- 0 cfg$gms$c35_protect_scenario <- "WDPA" cfg$gms$c30_snv_target <- "none" cfg$gms$s30_snv_shr <- 0 - cfg$gms$c56_emis_policy <- "redd+_nosoil" - } else if (pol == "Nature") { - cfg <- setScenario(cfg,c(ssp,"NDC","rcp7p0")) + cfg$gms$s56_c_price_induced_aff <- 1 + } else if (pol == "Biodiversity") { + cfg <- setScenario(cfg,c(ssp,"NPI","rcp4p5")) cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-NPi"#"PIK_NPI" cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-NPi"#"PIK_NPI" + cfg$gms$s15_exo_diet <- 0 + cfg$gms$s15_exo_waste <- 0 cfg$gms$c60_biodem_level <- 1 cfg$gms$s32_aff_plantation <- 0 cfg$gms$s32_aff_bii_coeff <- 0 + cfg$gms$s32_max_aff_area <- Inf cfg$gms$c35_forest_damage_end <- "by2030" - cfg$gms$s44_target_price <- 2000 - cfg$gms$c35_protect_scenario <- "BH_IFL" - cfg$gms$c30_snv_target <- "by2030" - cfg$gms$s30_snv_shr <- 0.2 - cfg$gms$c56_emis_policy <- "redd+_nosoil" - } else if (pol == "Climate+Nature") { - cfg <- setScenario(cfg,c(ssp,"NDC","rcp1p9")) - cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-PkBudg900"#"PIK_LIN" - cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-PkBudg900"#"PIK_NPI" - cfg$gms$c60_biodem_level <- 1 - cfg$gms$s32_aff_plantation <- 0 - cfg$gms$s32_aff_bii_coeff <- 0 - cfg$gms$c35_forest_damage_end <- "by2030" - cfg$gms$s44_target_price <- 2000 + cfg$gms$s44_bii_target <- 0.81 cfg$gms$c35_protect_scenario <- "BH_IFL" cfg$gms$c30_snv_target <- "by2030" cfg$gms$s30_snv_shr <- 0.2 - cfg$gms$c56_emis_policy <- "redd+_nosoil" - } else if (pol == "Climate+Nature+Food") { - cfg <- setScenario(cfg,c(ssp,"NDC","rcp1p9")) + cfg$gms$s56_c_price_induced_aff <- 0 + } else if (pol == "Integrated") { + cfg <- setScenario(cfg,c(ssp,"NPI","rcp1p9")) cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-PkBudg900"#"PIK_LIN" - cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-PkBudg900"#"PIK_NPI" - cfg$gms$s15_exo_diet <- 1 - cfg$gms$s15_exo_waste <- 1 + cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-NPi"#"PIK_NPI" + cfg$gms$s15_exo_diet <- 0 + cfg$gms$s15_exo_waste <- 0 cfg$gms$c60_biodem_level <- 1 cfg$gms$s32_aff_plantation <- 0 cfg$gms$s32_aff_bii_coeff <- 0 + cfg$gms$s32_max_aff_area <- Inf cfg$gms$c35_forest_damage_end <- "by2030" - cfg$gms$s44_target_price <- 2000 + cfg$gms$s44_bii_target <- 0.81 cfg$gms$c35_protect_scenario <- "BH_IFL" cfg$gms$c30_snv_target <- "by2030" cfg$gms$s30_snv_shr <- 0.2 - cfg$gms$c56_emis_policy <- "redd+_nosoil" + cfg$gms$s56_c_price_induced_aff <- 1 } cfg$title <- paste(prefix,paste0(ssp,"-",pol),sep="_") start_run(cfg,codeCheck=FALSE) - # cfg$recalibrate <- FALSE } } diff --git a/scripts/start/projects/paper_ClimNat2.R b/scripts/start/projects/paper_ClimNat2.R deleted file mode 100644 index 7beeee1e01..0000000000 --- a/scripts/start/projects/paper_ClimNat2.R +++ /dev/null @@ -1,118 +0,0 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -# | authors, and contributors see CITATION.cff file. This file is part -# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -# | AGPL-3.0, you are granted additional permissions described in the -# | MAgPIE License Exception, version 1.0 (see LICENSE file). -# | Contact: magpie@pik-potsdam.de - -# ---------------------------------------------------------- -# description: Paper Protect vs. Restore -# ---------------------------------------------------------- - - -###################################### -#### Script to start a MAgPIE run #### -###################################### - -library(gms) -library(lucode2) -library(magclass) -library(magpie4) - -# Load start_run(cfg) function which is needed to start MAgPIE runs -source("scripts/start_functions.R") - -#start MAgPIE run -source("config/default.cfg") - -#cfg$force_download <- TRUE -cfg$force_replace <- TRUE - -cfg$results_folder <- "output/:title:" -cfg$output <- c("rds_report","extra/disaggregation")#"extra/highres" - -prefix <- "CN72" - - -cfg$qos <- "priority" - -cfg$gms$c_timesteps <- "5year" -cfg$gms$biodiversity <- "bii_target" - -for (pol in c("CurPol","Carbon","Biodiversity","Integrated")) { - for (ssp in c("SSP2")) { - if (pol == "CurPol") { - cfg <- setScenario(cfg,c(ssp,"NPI","rcp4p5")) - cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-NPi"#"PIK_NPI" - cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-NPi"#"PIK_NPI" - cfg$gms$s15_exo_diet <- 0 - cfg$gms$s15_exo_waste <- 0 - cfg$gms$c60_biodem_level <- 1 - cfg$gms$s32_aff_plantation <- 0 - cfg$gms$s32_aff_bii_coeff <- 0 - cfg$gms$s32_max_aff_area <- Inf - cfg$gms$s44_target_price <- 0 - cfg$gms$s44_bii_target <- 0 - cfg$gms$c35_protect_scenario <- "WDPA" - cfg$gms$c30_snv_target <- "none" - cfg$gms$s30_snv_shr <- 0 - #cfg$gms$c56_emis_policy <- "redd+_nosoil" - cfg$gms$s56_c_price_induced_aff <- 0 - } else if (pol == "Carbon") { - cfg <- setScenario(cfg,c(ssp,"NPI","rcp1p9")) - cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-PkBudg900"#"PIK_LIN" - cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-NPi"#"PIK_NPI" - cfg$gms$s15_exo_diet <- 0 - cfg$gms$s15_exo_waste <- 0 - cfg$gms$c60_biodem_level <- 1 - cfg$gms$s32_aff_plantation <- 0 - cfg$gms$s32_aff_bii_coeff <- 0 - cfg$gms$s32_max_aff_area <- Inf - cfg$gms$c35_forest_damage_end <- "by2030" - cfg$gms$s44_target_price <- 0 - cfg$gms$s44_bii_target <- 0 - cfg$gms$c35_protect_scenario <- "WDPA" - cfg$gms$c30_snv_target <- "none" - cfg$gms$s30_snv_shr <- 0 - #cfg$gms$c56_emis_policy <- "redd+_nosoil" - cfg$gms$s56_c_price_induced_aff <- 1 - } else if (pol == "Biodiversity") { - cfg <- setScenario(cfg,c(ssp,"NPI","rcp4p5")) - cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-NPi"#"PIK_NPI" - cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-NPi"#"PIK_NPI" - cfg$gms$s15_exo_diet <- 0 - cfg$gms$s15_exo_waste <- 0 - cfg$gms$c60_biodem_level <- 1 - cfg$gms$s32_aff_plantation <- 0 - cfg$gms$s32_aff_bii_coeff <- 0 - cfg$gms$s32_max_aff_area <- Inf - cfg$gms$c35_forest_damage_end <- "by2030" - cfg$gms$s44_bii_target <- 0.81 - cfg$gms$c35_protect_scenario <- "BH_IFL" - cfg$gms$c30_snv_target <- "by2030" - cfg$gms$s30_snv_shr <- 0.2 - #cfg$gms$c56_emis_policy <- "redd+_nosoil" - cfg$gms$s56_c_price_induced_aff <- 0 - } else if (pol == "Integrated") { - cfg <- setScenario(cfg,c(ssp,"NPI","rcp1p9")) - cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-PkBudg900"#"PIK_LIN" - cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-NPi"#"PIK_NPI" - cfg$gms$s15_exo_diet <- 0 - cfg$gms$s15_exo_waste <- 0 - cfg$gms$c60_biodem_level <- 1 - cfg$gms$s32_aff_plantation <- 0 - cfg$gms$s32_aff_bii_coeff <- 0 - cfg$gms$s32_max_aff_area <- Inf - cfg$gms$c35_forest_damage_end <- "by2030" - cfg$gms$s44_bii_target <- 0.81 - cfg$gms$c35_protect_scenario <- "BH_IFL" - cfg$gms$c30_snv_target <- "by2030" - cfg$gms$s30_snv_shr <- 0.2 - #cfg$gms$c56_emis_policy <- "redd+_nosoil" - cfg$gms$s56_c_price_induced_aff <- 1 - } - cfg$title <- paste(prefix,paste0(ssp,"-",pol),sep="_") - start_run(cfg,codeCheck=FALSE) - # cfg$recalibrate <- FALSE - } -} diff --git a/scripts/start/projects/paper_scp.R b/scripts/start/projects/paper_scp.R index 35572129ca..12e1f3faab 100644 --- a/scripts/start/projects/paper_scp.R +++ b/scripts/start/projects/paper_scp.R @@ -6,7 +6,7 @@ # | Contact: magpie@pik-potsdam.de # ---------------------------------------------------------- -# description: SCP paper runs +# description: SCP/MP paper runs # ---------------------------------------------------------- @@ -18,55 +18,43 @@ library(gms) library(lucode2) library(magclass) -# Load start_run(cfg) function which is needed to start MAgPIE runs source("scripts/start_functions.R") -#start MAgPIE run source("config/default.cfg") -#cfg$force_download <- TRUE +# prefix, added in front of title +prefix <- "SCP44" +# naming of result folders cfg$results_folder <- "output/:title:" -cfg$output <- c("rds_report","extra/disaggregation") - -cfg <- setScenario(cfg,c("SSP2","NPI")) -prefix <- "SCP36" -cfg$qos <- "priority" +# output scripts +cfg$output <- c("rds_report","extra/disaggregation") +#GAMS OptFile cfg$gms$s80_optfile <- 1 cfg$gms$s80_maxiter <- 30 -cfg$gms$s15_elastic_demand <- 0 - +### Scenario setup +# SSP2 as basis +cfg <- setScenario(cfg,c("SSP2","NPI")) +# single-cell microbial protein production route cfg$gms$c20_scp_type <- "sugar" - - -#ref -for (pol in c("Ref")) { - if (pol == "Ref") { - cfg$gms$c56_pollutant_prices <- "R2M41-SSP2-NPi" - cfg$gms$c60_2ndgen_biodem <- "R2M41-SSP2-NPi" - } else if (pol == "1p5deg") { - cfg$gms$c56_pollutant_prices <- "R2M41-SSP2-Budg600" - cfg$gms$c60_2ndgen_biodem <- "R2M41-SSP2-Budg600" - } - for (livst_type in c("RuminantMeat+Dairy","RuminantMeat","Dairy")) { - if (livst_type == "RuminantMeat+Dairy") { - cfg$gms$kfo_rd <- "livst_rum,livst_milk" - } else if (livst_type == "RuminantMeat") { - cfg$gms$kfo_rd <- "livst_rum" - } else if (livst_type == "Dairy") { - cfg$gms$kfo_rd <- "livst_milk" - } - for (scp_level in c(0,20,50,80)) { - cfg$title <- paste(prefix,paste0("SSP2-",pol,"-BioTech",scp_level),livst_type,sep="_") - if (scp_level == 0) scp_scen <- "constant" else if (scp_level == 20) scp_scen <- "sigmoid_80pc_20_50" else if (scp_level == 50) scp_scen <- "sigmoid_50pc_20_50" else if (scp_level == 80) scp_scen <- "sigmoid_20pc_20_50" - cfg$gms$c15_rumdairy_scp_scen <- scp_scen - start_run(cfg,codeCheck=FALSE) - } +# replacement of ruminant meat with MP +cfg$gms$kfo_rd <- "livst_rum" + +# Start MAgPIE runs with varying substitution targets of ruminant meat with MP by 2050, based on protein/cap/day basis +for (MP in c(0,20,50,80)) { + cfg$title <- paste(prefix,paste0("SSP2-Ref-MP",MP),sep="_") + if (MP == 0) { + scp_scen <- "constant" + } else if (MP == 20) { + scp_scen <- "sigmoid_80pc_20_50" + } else if (MP == 50) { + scp_scen <- "sigmoid_50pc_20_50" + }else if (MP == 80) { + scp_scen <- "sigmoid_20pc_20_50" } + cfg$gms$c15_rumdairy_scp_scen <- scp_scen + start_run(cfg,codeCheck=FALSE) } - -#rd is default. revert back -file.copy(from = "modules/15_food/anthropometrics_jan18/sets_rd.gms", to = "modules/15_food/anthropometrics_jan18/sets.gms",overwrite = TRUE) diff --git a/scripts/start/projects/project_FSEC_Scenarios.R b/scripts/start/projects/project_FSEC_Scenarios.R index f78685bb77..67424bb435 100644 --- a/scripts/start/projects/project_FSEC_Scenarios.R +++ b/scripts/start/projects/project_FSEC_Scenarios.R @@ -11,528 +11,37 @@ library(gms) source("scripts/start_functions.R") -source("config/default.cfg") +source("scripts/projects/fsec.R") -# Set defaults codeCheck <- FALSE -input <- c(regional = "rev4.73FSECmodeling_e2bdb6cd_magpie.tgz", - cellular = "rev4.73FSECmodeling_e2bdb6cd_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", - validation = "rev4.73FSECmodeling_e2bdb6cd_validation.tgz", - additional = "additional_data_rev4.26.tgz", - calibration = "calibration_FSEC_18Jun22.tgz") - -# General settings: -general_settings <- function(title) { - - source("config/default.cfg") - - cfg$input <- input - cfg$title <- paste0("v9_", title) - cfg$recalibrate <- FALSE - cfg$qos <- "priority_maxMem" - cfg$output <- c(cfg$output #, - #"extra/disaggregation_BII", "projects/FSEC_dietaryIndicators", - #"projects/FSEC_environmentalPollution_grid" - ) - - # Climate change impacts activated, SSP2 default settings, NDC activated, endogenous forestry activated - cfg <- gms::setScenario(cfg, c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo")) - cfg$input['cellular'] <- "rev4.73FSECmodeling_e2bdb6cd_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz" - cfg$force_download <- TRUE - - # Nitrogen module with IPCC emissions factors rescaled with efficiency - cfg$gms$nitrogen <- "rescaled_jan21" - # emission policy not including any GHG sources - cfg$gms$c56_emis_policy <- "none" - # ghg price setting (only relevant when activated by c56_emis_policy) - cfg$gms$c56_pollutant_prices <- "R21M42-SDP-PkBudg1000" - # residue on field burning is set to "constant" - cfg$gms$c18_burn_scen <- "constant" - # C price driven afforestation is off by default - cfg$gms$s56_c_price_induced_aff <- "0" - # Soil organic carbon dynamics activated - cfg$gms$som <- "cellpool_aug16" - # Cost module: sticky - dynamic mode - cfg$gms$factor_costs <- "sticky_feb18" - - # Regional factor requirement costs (crop and livestock) - cfg$gms$c38_fac_req <- "reg" - cfg$gms$c70_fac_req_regr <- "reg" - - return(cfg) -} - -# ----------------------------------------------------------------------------------------------------------------- -# Settings of transformation clusters: -### (1) Population and General Health ### -population_transformation <- function(cfg) { - # Population birth rate and demographic structure of SSP1 scenario: - cfg$gms$c09_pop_scenario <- "SSP1" # same as SDP scenario - - return(cfg) -} - -### (2) Reduced inequality transformation ### -inequalityANDeducation_transformation <- function(cfg) { - # GDP following SSP1 path - cfg$gms$c09_gdp_scenario <- "SSP1" - # Only cap top incomes - # (not available yet) - - return(cfg) -} - -### (3) Improved institutions ### -institution_transformation <- function(cfg) { - # Improved institutions: lower interest rates - # Interest rates are still regionally specific (dependent on GDP), but - # set to lower levels for low income countries - cfg$gms$s12_interest_lic <- "0.06" # def: "0.1" - cfg$gms$s12_interest_hic <- "0.04" # def: "0.04" - - return(cfg) -} - -### (4) Energy and transport transformation ### -energy_transformation <- function(cfg) { - # Air pollution reduction and other health risks - # (cannot be covered) - # Higher PAL due to active transportation - cfg$gms$c09_pal_scenario <- "SSP1" ### Note: new scenario needed! (not available yet) - # Lower non-agricultural water demand - cfg$gms$s42_watdem_nonagr_scenario <- "1" - - # Reduction of traditional fuels and manure burning - # (not available yet) - - # More sustainable urbanization path - cfg$gms$c34_urban_scenario <- "SSP1" - - # 2nd gen. bioenergy demand following "well-below 1.5" pathway - cfg$gms$c60_2ndgen_biodem <- "R21M42-SDP-PkBudg1000" - # 2nd gen. bioenergy residues following sustainable development pathway - cfg$gms$c60_res_2ndgenBE_dem <- "sdp" - - return(cfg) -} - -### (5) Diet health transformation ### -diet_transformation <- function(cfg) { - # Food transition towards healthy & sustainable diets - cfg$gms$c15_food_scenario <- "SSP1" - cfg$gms$s15_elastic_demand <- "0" - cfg$gms$c15_rumdairy_scp_scen <- "constant" - # cfg$gms$c15_exo_scen_targetyear <- "y2050" # need to be updated, switch changed - cfg$gms$s15_exo_diet <- "1" - cfg$gms$c15_kcal_scen <- "healthy_BMI" - cfg$gms$c15_EAT_scen <- "FLX" - # Change in life expectancy - # (cannot be implemented) - - return(cfg) -} - -### (6) Diet meat transformation ### -meat_transformation <- function(cfg) { - # Food transition towards reduced meat consumption - cfg$gms$c15_livescen_target <- "lin_zero_20_50" - - return(cfg) -} - -### (7) Diet waste transformation ### -waste_transformation <- function(cfg) { - # Lower food waste - cfg$gms$s15_exo_waste <- "1" - cfg$gms$s15_waste_scen <- "1.2" - - return(cfg) -} - -### (NA) Diet inclustion transformation ### -dietInclusion_transformation <- function(cfg) { - # Breastfeeding - # (cannot be implemented) - # Care work - # (cannot be implemented) - # Shifting to female consumption - # (cannot be implemented) - # Reducing intake inequality - # (cannot be implemented) - - return(cfg) -} - -### (8) Livestock management transformation ### -livestock_transformation <- function(cfg) { - # Higher manure recycling rates - cfg$gms$c55_scen_conf <- "SSP1" - # Higher feed efficiency (capped scenario) - cfg$gms$c70_feed_scen <- "ssp1" - # Animal welfare - # (cannot be implemented) - # CH4 price for livestock - cfg$gms$c56_emis_policy <- "sdp_livestock" - - return(cfg) -} - -### (9) Crop efficiency transformation ### -cropefficiency_transformation <- function(cfg) { - # high NUE - cfg$gms$c50_scen_neff <- "neff75_80_starty2010" - # water use efficiency - # (not available yet) - # tau - # (not available yet) - # rice emission pricing - cfg$gms$c56_emis_policy <- "sdp_cropeff" - - return(cfg) -} - -### (NA) Nitrogen transformation ### -nitrogen_transformation <- function(cfg) { - # improved N Fixing - # (not available yet) - # yield penalty - # (not available yet) - # replace rapeseed and sunflower by soybean in processing - # (not available yet) - - return(cfg) -} - -### (10) Biodiversity transformation ### -biodiversity_transformation <- function(cfg) { - # BII target - cfg$gms$s44_bii_lower_bound <- 0.81 - - return(cfg) - -} - -### (NA) Supply chain transformation ### -supplyChain_transformation <- function(cfg) { - # reduce value-added in processing - # (cannot be implemented) - # switch to wholegrain - # (not available yet) - # reduce sugar-sweetened beverages - # (cannot be implemented) - # reduce alcohol - # (not available yet) - # reduce salt - # (not available yet) - # ban of trans-fatty acids - # (not available yet) - # reduce food losses - # (not available yet) - # fortification - # (cannot be implemented) - - return(cfg) -} - -### (11) Fair trade transformation ### -fairTrade_transformation <- function(cfg) { - #reduce subsidies - # (cannot be implemented) - #reduce historical trade patterns - # (not available yet) - #increase transportation costs - # (not available yet) - # Increased trade openness - cfg$gms$c21_trade_liberalization <- "l908080r807070" - - return(cfg) -} - -### (12) Bioeconomy transformation ### -bioeconomy_transformation <- function(cfg) { - # Timber demand: higher demand for buildings from wood - cfg$gms$c73_build_demand <- "50pc" - # Biomaterial demand increases (therefore no phaseout of 1stgen bioenergy, but rather constant) - cfg$gms$c60_1stgen_biodem <- "const2030" - - return(cfg) +for (scenarioName in c( + # Single transformation runs + "a_Population", "a_EconDevelop", "a_EnergyTrans", + "a_NoUnderweight", "a_NoOverweight", "a_DietVegFruitsNutsSeeds", "a_DietLegumes", + "a_DietMonogastrics", "a_DietRuminants", "a_DietEmptyCals", "a_DietFish", "a_LessFoodWaste", + "a_ManureMngmt", "a_LivestockMngmt", "a_LandUseDiversity", + "a_NitrogenEff", "a_RiceMit", "a_CropeffTax", + "a_MinWage", "a_Bioplastics", + "a_FairTrade", "a_TimberCities", "a_REDDaff", "a_REDD", "a_CropRotations", + "a_LandSparing", "a_WaterSparing", "a_PeatlandSparing", "a_AirPollution", "a_SoilCarbon", + # Scenario combination runs + "c_BAU", "d_SSP1bau", "d_SSP1PLUSbau", "d_SSP2bau", "d_SSP3bau", "d_SSP4bau", "d_SSP5bau", + "d_SSP1fsdp", "d_SSP1PLUSfsdp", "d_SSP2fsdp", "d_SSP3fsdp", "d_SSP4fsdp", "d_SSP5fsdp", + "e_FSDP", + "b_ExternalPressures", "b_WaterSoil", "b_REDDaffRuminants", "b_DietRotations", + "b_MonogastricsRotations", + "b_TradeRotations", "b_TradeREDDaff", "b_TradeSoil", + "b_TradeMonogastrics", "b_TradeRuminants", "b_TradeVeggies", + "b_SoilMonogastric", "b_SoilMonogastricRuminants", "b_SoilRotations", + "b_MonogastricsVeggies", + "b_LivestockManureMngmt", "b_LivestockNUEMngmt", + "b_AllNitrogen", "b_AllClimate", "b_FullBiodiv", + "b_AllEnvironment", "b_AllHealth", "b_AllInclusion", + # still missing: Bioeconomy + energy + timber + "b_Efficiency", "b_Sufficiency", "b_Protection")) { + + # Start runs + cfg <- fsecScenario(scenario = scenarioName) + start_run(cfg = cfg, codeCheck = codeCheck) } - -### (13) Afforestation (REDDaff) transformation ### -REDDaff_transformation <- function(cfg) { - # Afforestation policy following Nationally determined contributions - # and limited to tropical regions and 500 Mha because of the albedo effect - # (see also Fuss et al. 2018) - cfg$gms$c32_aff_policy <- "ndc" - cfg$gms$c32_aff_mask <- "onlytropical" - cfg$gms$s32_max_aff_area <- "500" - - # C price driven afforestation activated - cfg$gms$s56_c_price_induced_aff <- "1" - # all carbon pools - cfg$gms$c56_emis_policy <- "sdp_redd" - - return(cfg) -} - -### (13) Reducing emissions from deforestation (REDD) transformation ### -REDD_transformation <- function(cfg) { - - # all carbon pools - cfg$gms$c56_emis_policy <- "sdp_redd" - - return(cfg) -} - - -### (14) Land and water sparing transformation ### -landsparing_transformation <- function(cfg) { - # land protection following strict protection scenario (half or land's surface) - cfg$gms$c22_protect_scenario <- "HalfEarth" - - # water protection through environmental flow protection - cfg$gms$c42_env_flow_policy <- "on" - cfg$gms$c30_bioen_water <- "rainfed" # (already default anyways) - - return(cfg) -} - -### (15) Peatland transformation ### -peatland_transformation <- function(cfg) { - # peatland protection via pricing - cfg$gms$c56_emis_policy <- "sdp_peatland" - # peatland restoration - cfg$gms$s58_rewetting_switch <- "Inf" - - return(cfg) -} - -### (16) Air pollution intervention transformation ### -airPollution_transformation <- function(cfg) { - # crop residue burning is phasing out rather than at constant levels as in default - cfg$gms$c18_burn_scen <- "phaseout" - # savanna burning - # (not available yet) - # deforestation with timber harvest rather than burning - cfg$gms$c35_forest_damage_end <- 2030 - - return(cfg) -} - -### (NA) Agricultural employment transformation ### -employment_transformation <- function(cfg) { - # increase minimum wage (at costs of costs) - # (not available yet) - # increase labor productivity + wage (at costs of employment) - # (not available yet) - - return(cfg) -} - -### (18) Soil pricing transformation ### -soil_transformation <- function(cfg) { - # soil pricing - cfg$gms$c56_emis_policy <- "sdp_soil" - - return(cfg) -} - - -# ----------------------------------------------------------------------------------------------------------------- -# Scenario runs - -################################################# -## Business-as-usual Scenario ## -################################################# -### Business-as-usual -cfg <- general_settings(title = "FSEC_BAU") -start_run(cfg = cfg, codeCheck = codeCheck) - -### SSP3 + mitigation (RCP 7.0) -cfg <- general_settings(title = "FSEC_SSP370") -cfg <- gms::setScenario(cfg, c("cc", "rcp7p0", "SSP3", "NDC", "ForestryEndo")) -cfg$input['cellular'] <- "rev4.73FSECmodeling_e2bdb6cd_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz" -start_run(cfg = cfg, codeCheck = codeCheck) - -### SSP4 + mitigation (RCP 6.0) -cfg <- general_settings(title = "FSEC_SSP460") -cfg <- gms::setScenario(cfg, c("cc", "rcp6p0", "SSP4", "NDC", "ForestryEndo")) -cfg$input['cellular'] <- "rev4.73FSECmodeling_e2bdb6cd_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz" -start_run(cfg = cfg, codeCheck = codeCheck) - -### SSP5 without mitigation (RCP 8.5) -cfg <- general_settings(title = "FSEC_SSP585") -cfg <- gms::setScenario(cfg, c("cc", "rcp8p5", "SSP5", "NDC", "ForestryEndo")) -cfg$input['cellular'] <- "rev4.73FSECmodeling_e2bdb6cd_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz" -start_run(cfg = cfg, codeCheck = codeCheck) - - -################################################# -## Total SDP Scenario ## -################################################# -cfg <- general_settings(title = "FSEC_SDP") -# Climate scenario: RCP 2.6 -cfg <- gms::setScenario(cfg, c("cc", "rcp2p6", "SSP1", "NDC", "ForestryEndo")) -cfg$input['cellular'] <- "rev4.73FSECmodeling_e2bdb6cd_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz" -### (1) Population and Health ### -cfg <- population_transformation(cfg = cfg) -### (2) Reduced inequality and Education Transformation ### -cfg <- inequalityANDeducation_transformation(cfg = cfg) -### (3) Improved institutions ### -cfg <- institution_transformation(cfg = cfg) -### (4) Energy and transfport transformation ### -cfg <- energy_transformation(cfg = cfg) -### (5) Diet health transformation ### -cfg <- diet_transformation(cfg = cfg) -### (6) Diet meat transformation ### -cfg <- meat_transformation(cfg = cfg) -### (7) Diet waste transformation ### -cfg <- waste_transformation(cfg = cfg) -### (NA) Diet inclustion transformation ### -#cfg <- dietInclusion_transformation(cfg = cfg) -### (8) Livestock management transformation ### -cfg <- livestock_transformation(cfg = cfg) -### (9) Crop efficiency transformation ### -cfg <- cropefficiency_transformation(cfg = cfg) -### (NA) Nitrogen transformation ### -#cfg <- nitrogen_transformation(cfg = cfg) -### (10) Biodiverstiy transformation ### -cfg <- biodiversity_transformation(cfg = cfg) -### (NA) Supply chain transformation ### -#cfg <- supplyChain_transformation(cfg = cfg) -### (11) Fair trade transformation ### -cfg <- fairTrade_transformation(cfg = cfg) -### (12) Bioeconomy transformation ### -cfg <- bioeconomy_transformation(cfg = cfg) -### (13) REDDaff transformation ### -cfg <- REDDaff_transformation(cfg = cfg) -### (14) REDD Transformation -cfg <- REDD_transformation(cfg = cfg) -### (15) Land and water sparing transformation ### -cfg <- landsparing_transformation(cfg = cfg) -### (16) Land and water sparing transformation ### -cfg <- peatland_transformation(cfg = cfg) -### (17) Air pollution intervention transformation ### -cfg <- airPollution_transformation(cfg = cfg) -### (NA) Agricultural employment transformation ### -#cfg <- employment_transformation(cfg = cfg) -### (19) Soil pricing transformation ## -cfg <- soil_transformation(cfg = cfg) -### Emission policy must be set separately in full-SDP scenario -# (because it would be overwritten in the different transformations) -cfg$gms$c56_emis_policy <- "sdp_all" # To Do: change to sdp_all once soil runs feasible -start_run(cfg = cfg, codeCheck = codeCheck) - -################################################# -## Disaggregated runs ## -################################################# -### (1) Population and Health ### -cfg <- general_settings(title = "FSEC_population") -cfg <- population_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (2) Reduced inequality and Education Transformation ### -cfg <- general_settings(title = "FSEC_gdp_educ_inequ") -cfg <- inequalityANDeducation_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (3) Improved institutions ### -cfg <- general_settings(title = "FSEC_inst") -cfg <- institution_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (4) Energy and transfport transformation ### -cfg <- general_settings(title = "FSEC_energy") -cfg <- energy_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (5) Diet health transformation ### -cfg <- general_settings(title = "FSEC_dietHealth") -cfg <- diet_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (6) Diet meat transformation ### -cfg <- general_settings(title = "FSEC_dietLvst") -cfg <- meat_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (7) Diet waste transformation ### -cfg <- general_settings(title = "FSEC_dietWaste") -cfg <- waste_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (NA) Diet inclustion transformation ### -#cfg <- general_settings(title = "FSEC_dietInclusion") -#cfg <- dietInclusion_transformation(cfg = cfg) -#start_run(cfg = cfg, codeCheck = codeCheck) - -### (8) Livestock management transformation ### -cfg <- general_settings(title = "FSEC_livestock") -cfg <- livestock_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (9) Crop efficiency transformation ### -cfg <- general_settings(title = "FSEC_cropeff") -cfg <- cropefficiency_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (NA) Nitrogen transformation ### -#cfg <- general_settings(title = "FSEC_nitrogen") -#cfg <- nitrogen_transformation(cfg = cfg) -#start_run(cfg = cfg, codeCheck = codeCheck) - -### (10) Biodiversity transformation ### -cfg <- general_settings(title = "FSEC_biodiv") -cfg <- biodiversity_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (NA) Supply chain transformation ### -#cfg <- general_settings(title = "FSEC_supplyChain") -#cfg <- supplyChain_transformation(cfg = cfg) -#start_run(cfg = cfg, codeCheck = codeCheck) - -### (11) Fair trade transformation ### -cfg <- general_settings(title = "FSEC_fairTrade") -cfg <- fairTrade_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (12) Bioeconomy transformation ### -cfg <- general_settings(title = "FSEC_bioeconomy") -cfg <- bioeconomy_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (13) Afforestation transformation ### -cfg <- general_settings(title = "FSEC_REDDaff") -cfg <- REDDaff_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (14) REDD Transformation -cfg <- general_settings(title = "FSEC_REDD") -cfg <- REDD_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (14) Land and water sparing transformation ### -cfg <- general_settings(title = "FSEC_landSparing") -cfg <- landsparing_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (15) Peatland transformation ### -cfg <- general_settings(title = "FSEC_peatland") -cfg <- peatland_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (17) Air pollution intervention transformation ### -cfg <- general_settings(title = "FSEC_airpollution") -cfg <- airPollution_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (NA) Agricultural employment transformation ### -#cfg <- general_settings(title = "FSEC_employment") -#cfg <- employment_transformation(cfg = cfg) -#start_run(cfg = cfg, codeCheck = codeCheck) - -### (18) Soil pricing transformation ## -cfg <- general_settings(title = "FSEC_soil") -cfg <- soil_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) diff --git a/scripts/start/projects/project_FSEC_Scenarios_agroecologyTest.R b/scripts/start/projects/project_FSEC_Scenarios_agroecologyTest.R deleted file mode 100644 index 9cf0ec128e..0000000000 --- a/scripts/start/projects/project_FSEC_Scenarios_agroecologyTest.R +++ /dev/null @@ -1,560 +0,0 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -# | authors, and contributors see CITATION.cff file. This file is part -# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -# | AGPL-3.0, you are granted additional permissions described in the -# | MAgPIE License Exception, version 1.0 (see LICENSE file). -# | Contact: magpie@pik-potsdam.de - -# ---------------------------------------------------------- -# description: Scenarios for FSEC -# ---------------------------------------------------------- - -library(gms) -source("scripts/start_functions.R") -source("config/default.cfg") - -# Set defaults -codeCheck <- FALSE - -input <- c(regional = "rev4.73FSECmodeling_e2bdb6cd_magpie.tgz", - cellular = "rev4.73FSECmodeling_e2bdb6cd_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", - validation = "rev4.73FSECmodeling_e2bdb6cd_validation.tgz", - additional = "additional_data_rev4.26.tgz", - calibration = "calibration_FSEC_29Jun22.tgz") - -# General settings: -general_settings <- function(title) { - - source("config/default.cfg") - - cfg$input <- input - cfg$title <- paste0("v9a_", title) - cfg$recalibrate <- FALSE - cfg$qos <- "priority_maxMem" - cfg$output <- c(cfg$output #, - #"extra/disaggregation_BII", "projects/FSEC_dietaryIndicators", - #"projects/FSEC_environmentalPollution_grid" - ) - - # Climate change impacts activated, SSP2 default settings, NDC activated, endogenous forestry activated - cfg <- gms::setScenario(cfg, c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo")) - cfg$input['cellular'] <- "rev4.73FSECmodeling_e2bdb6cd_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz" - cfg$force_download <- TRUE - - # Nitrogen module with IPCC emissions factors rescaled with efficiency - cfg$gms$nitrogen <- "rescaled_jan21" - # emission policy not including any GHG sources - cfg$gms$c56_emis_policy <- "none" - # ghg price setting (only relevant when activated by c56_emis_policy) - cfg$gms$c56_pollutant_prices <- "R21M42-SDP-PkBudg1000" - # residue on field burning is set to "constant" - cfg$gms$c18_burn_scen <- "constant" - # C price driven afforestation is off by default - cfg$gms$s56_c_price_induced_aff <- "0" - # Soil organic carbon dynamics activated - cfg$gms$som <- "cellpool_aug16" - # Cost module: sticky - dynamic mode - cfg$gms$factor_costs <- "sticky_feb18" - - # Regional factor requirement costs (crop and livestock) - cfg$gms$c38_fac_req <- "reg" - cfg$gms$c70_fac_req_regr <- "reg" - - # Agroecology general settings - cfg$gms$crop <- "penalty_apr22" - cfg$gms$c30_rotation_scenario <- "default" - cfg$gms$c30_rotation_scenario_speed <- "by2050" - - return(cfg) -} - -# ----------------------------------------------------------------------------------------------------------------- -# Settings of transformation clusters: -### (1) Population and General Health ### -population_transformation <- function(cfg) { - # Population birth rate and demographic structure of SSP1 scenario: - cfg$gms$c09_pop_scenario <- "SSP1" # same as SDP scenario - - return(cfg) -} - -### (2) Reduced inequality transformation ### -inequalityANDeducation_transformation <- function(cfg) { - # GDP following SSP1 path - cfg$gms$c09_gdp_scenario <- "SSP1" - # Only cap top incomes - # (not available yet) - - return(cfg) -} - -### (3) Improved institutions ### -institution_transformation <- function(cfg) { - # Improved institutions: lower interest rates - # Interest rates are still regionally specific (dependent on GDP), but - # set to lower levels for low income countries - cfg$gms$s12_interest_lic <- "0.06" # def: "0.1" - cfg$gms$s12_interest_hic <- "0.04" # def: "0.04" - - return(cfg) -} - -### (4) Energy and transport transformation ### -energy_transformation <- function(cfg) { - # Air pollution reduction and other health risks - # (cannot be covered) - # Higher PAL due to active transportation - cfg$gms$c09_pal_scenario <- "SSP1" ### Note: new scenario needed! (not available yet) - # Lower non-agricultural water demand - cfg$gms$s42_watdem_nonagr_scenario <- "1" - - # Reduction of traditional fuels and manure burning - # (not available yet) - - # More sustainable urbanization path - cfg$gms$c34_urban_scenario <- "SSP1" - - # 2nd gen. bioenergy demand following "well-below 1.5" pathway - cfg$gms$c60_2ndgen_biodem <- "R21M42-SDP-PkBudg1000" - # 2nd gen. bioenergy residues following sustainable development pathway - cfg$gms$c60_res_2ndgenBE_dem <- "sdp" - - return(cfg) -} - -### (5) Diet health transformation ### -diet_transformation <- function(cfg) { - # Food transition towards healthy & sustainable diets - cfg$gms$c15_food_scenario <- "SSP1" - cfg$gms$s15_elastic_demand <- "0" - cfg$gms$c15_rumdairy_scp_scen <- "constant" - #cfg$gms$c15_exo_scen_targetyear <- "y2050" # need to be updated, switch changed - cfg$gms$s15_exo_diet <- "1" - cfg$gms$c15_kcal_scen <- "healthy_BMI" - cfg$gms$c15_EAT_scen <- "FLX" - # Change in life expectancy - # (cannot be implemented) - - return(cfg) -} - -### (6) Diet meat transformation ### -meat_transformation <- function(cfg) { - # Food transition towards reduced meat consumption - cfg$gms$c15_livescen_target <- "lin_zero_20_50" - - return(cfg) -} - -### (7) Diet waste transformation ### -waste_transformation <- function(cfg) { - # Lower food waste - cfg$gms$s15_exo_waste <- "1" - cfg$gms$s15_waste_scen <- "1.2" - - return(cfg) -} - -### (NA) Diet inclustion transformation ### -dietInclusion_transformation <- function(cfg) { - # Breastfeeding - # (cannot be implemented) - # Care work - # (cannot be implemented) - # Shifting to female consumption - # (cannot be implemented) - # Reducing intake inequality - # (cannot be implemented) - - return(cfg) -} - -### (8) Livestock management transformation ### -livestock_transformation <- function(cfg) { - # Higher manure recycling rates - cfg$gms$c55_scen_conf <- "SSP1" - # Higher feed efficiency (capped scenario) - cfg$gms$c70_feed_scen <- "ssp1" - # Animal welfare - # (cannot be implemented) - # CH4 price for livestock - cfg$gms$c56_emis_policy <- "sdp_livestock" - - return(cfg) -} - -### (9) Crop efficiency transformation ### -cropefficiency_transformation <- function(cfg) { - # high NUE - cfg$gms$c50_scen_neff <- "neff75_80_starty2010" - # water use efficiency - # (not available yet) - # tau - # (not available yet) - # rice emission pricing - cfg$gms$c56_emis_policy <- "sdp_cropeff" - - return(cfg) -} - -### (NA) Nitrogen transformation ### -nitrogen_transformation <- function(cfg) { - # improved N Fixing - # (not available yet) - # yield penalty - # (not available yet) - # replace rapeseed and sunflower by soybean in processing - # (not available yet) - - return(cfg) -} - -### (10) Biodiversity transformation ### -biodiversity_transformation <- function(cfg) { - # BII target - cfg$gms$s44_bii_lower_bound <- 0.81 - - return(cfg) - -} - -### (11) Diversity on land transformation ### -landsharing_transformation <- function(cfg) { - # stricter crop rotations and agroforestry (2nd gen be with crop rotation) - cfg$gms$c30_rotation_scenario <- "agroecology" - - # increase labor costs based on value-difference between organic and conventional - # (not available yet) - - return(cfg) -} - -### (NA) Supply chain transformation ### -supplyChain_transformation <- function(cfg) { - # reduce value-added in processing - # (cannot be implemented) - # switch to wholegrain - # (not available yet) - # reduce sugar-sweetened beverages - # (cannot be implemented) - # reduce alcohol - # (not available yet) - # reduce salt - # (not available yet) - # ban of trans-fatty acids - # (not available yet) - # reduce food losses - # (not available yet) - # fortification - # (cannot be implemented) - - return(cfg) -} - -### (12) Fair trade transformation ### -fairTrade_transformation <- function(cfg) { - #reduce subsidies - # (cannot be implemented) - #reduce historical trade patterns - # (not available yet) - #increase transportation costs - # (not available yet) - # Increased trade openness - cfg$gms$c21_trade_liberalization <- "l908080r807070" - - return(cfg) -} - -### (13) Bioeconomy transformation ### -bioeconomy_transformation <- function(cfg) { - # Timber demand: higher demand for buildings from wood - cfg$gms$c73_build_demand <- "50pc" - # Biomaterial demand increases (therefore no phaseout of 1stgen bioenergy, but rather constant) - cfg$gms$c60_1stgen_biodem <- "const2030" - - return(cfg) -} - -### (14) Afforestation (REDDaff) transformation ### -REDDaff_transformation <- function(cfg) { - # Afforestation policy following Nationally determined contributions - # and limited to tropical regions and 500 Mha because of the albedo effect - # (see also Fuss et al. 2018) - cfg$gms$c32_aff_policy <- "ndc" - cfg$gms$c32_aff_mask <- "onlytropical" - cfg$gms$s32_max_aff_area <- "500" - - # C price driven afforestation activated - cfg$gms$s56_c_price_induced_aff <- "1" - # all carbon pools - cfg$gms$c56_emis_policy <- "sdp_redd" - - return(cfg) -} - -### (15) Reducing emissions from deforestation (REDD) transformation ### -REDD_transformation <- function(cfg) { - - # all carbon pools - cfg$gms$c56_emis_policy <- "sdp_redd" - - return(cfg) -} - - -### (16) Land and water sparing transformation ### -landsparing_transformation <- function(cfg) { - # land protection following strict protection scenario (half or land's surface) - cfg$gms$c22_protect_scenario <- "HalfEarth" - # Water protection through environmental flow protection - cfg$gms$c42_env_flow_policy <- "on" - cfg$gms$c30_bioen_water <- "rainfed" # (already default anyways) - - return(cfg) -} - -### (17) Peatland transformation ### -peatland_transformation <- function(cfg) { - # peatland protection via pricing - cfg$gms$c56_emis_policy <- "sdp_peatland" - # peatland restoration - cfg$gms$s58_rewetting_switch <- "Inf" - - return(cfg) -} - -### (18) Air pollution intervention transformation ### -airPollution_transformation <- function(cfg) { - # crop residue burning is phasing out rather than at constant levels as in default - cfg$gms$c18_burn_scen <- "phaseout" - # savanna burning - # (not available yet) - # deforestation with timber harvest rather than burning - cfg$gms$c35_forest_damage_end <- 2030 - - return(cfg) -} - -### (NA) Agricultural employment transformation ### -employment_transformation <- function(cfg) { - # increase minimum wage (at costs of costs) - # (not available yet) - # increase labor productivity + wage (at costs of employment) - # (not available yet) - - return(cfg) -} - -### (19) Soil pricing transformation ### -soil_transformation <- function(cfg) { - # soil pricing - cfg$gms$c56_emis_policy <- "sdp_soil" - - return(cfg) -} - - -# ----------------------------------------------------------------------------------------------------------------- -# Scenario runs - -################################################# -## Business-as-usual Scenario ## -################################################# -### Business-as-usual -cfg <- general_settings(title = "FSEC_BAU") -start_run(cfg = cfg, codeCheck = codeCheck) - -### SSP3 + mitigation (RCP 7.0) -cfg <- general_settings(title = "FSEC_SSP370") -cfg <- gms::setScenario(cfg, c("cc", "rcp7p0", "SSP3", "NDC", "ForestryEndo")) -cfg$input['cellular'] <- "rev4.73FSECmodeling_e2bdb6cd_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz" -start_run(cfg = cfg, codeCheck = codeCheck) - -### SSP4 + mitigation (RCP 6.0) -cfg <- general_settings(title = "FSEC_SSP460") -cfg <- gms::setScenario(cfg, c("cc", "rcp6p0", "SSP4", "NDC", "ForestryEndo")) -cfg$input['cellular'] <- "rev4.73FSECmodeling_e2bdb6cd_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz" -start_run(cfg = cfg, codeCheck = codeCheck) - -### SSP5 without mitigation (RCP 8.5) -cfg <- general_settings(title = "FSEC_SSP585") -cfg <- gms::setScenario(cfg, c("cc", "rcp8p5", "SSP5", "NDC", "ForestryEndo")) -cfg$input['cellular'] <- "rev4.73FSECmodeling_e2bdb6cd_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz" -start_run(cfg = cfg, codeCheck = codeCheck) - - -################################################# -## Total SDP Scenario ## -################################################# -cfg <- general_settings(title = "FSEC_SDP") -# Climate scenario: RCP 2.6 -cfg <- gms::setScenario(cfg, c("cc", "rcp2p6", "SSP1", "NDC", "ForestryEndo")) -cfg$input['cellular'] <- "rev4.73FSECmodeling_e2bdb6cd_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz" -### (1) Population and Health ### -cfg <- population_transformation(cfg = cfg) -### (2) Reduced inequality and Education Transformation ### -cfg <- inequalityANDeducation_transformation(cfg = cfg) -### (3) Improved institutions ### -cfg <- institution_transformation(cfg = cfg) -### (4) Energy and transfport transformation ### -cfg <- energy_transformation(cfg = cfg) -### (5) Diet health transformation ### -cfg <- diet_transformation(cfg = cfg) -### (6) Diet meat transformation ### -cfg <- meat_transformation(cfg = cfg) -### (7) Diet waste transformation ### -cfg <- waste_transformation(cfg = cfg) -### (NA) Diet inclustion transformation ### -#cfg <- dietInclusion_transformation(cfg = cfg) -### (8) Livestock management transformation ### -cfg <- livestock_transformation(cfg = cfg) -### (9) Crop efficiency transformation ### -cfg <- cropefficiency_transformation(cfg = cfg) -### (NA) Nitrogen transformation ### -#cfg <- nitrogen_transformation(cfg = cfg) -### (10) Biodiversity transformation ### -cfg <- biodiversity_transformation(cfg = cfg) -### (11) Diversity on land transformation ### -cfg <- landsharing_transformation(cfg = cfg) -### (NA) Supply chain transformation ### -#cfg <- supplyChain_transformation(cfg = cfg) -### (12) Fair trade transformation ### -cfg <- fairTrade_transformation(cfg = cfg) -### (13) Bioeconomy transformation ### -cfg <- bioeconomy_transformation(cfg = cfg) -### (14) REDDaff transformation ### -cfg <- REDDaff_transformation(cfg = cfg) -### (15) REDD Transformation -cfg <- REDD_transformation(cfg = cfg) -### (16) Land and water sparing transformation ### -cfg <- landsparing_transformation(cfg = cfg) -### (17) Land and water sparing transformation ### -cfg <- peatland_transformation(cfg = cfg) -### (18) Air pollution intervention transformation ### -cfg <- airPollution_transformation(cfg = cfg) -### (NA) Agricultural employment transformation ### -#cfg <- employment_transformation(cfg = cfg) -### (19) Soil pricing transformation ## -cfg <- soil_transformation(cfg = cfg) -### Emission policy must be set separately in full-SDP scenario -# (because it would be overwritten in the different transformations) -cfg$gms$c56_emis_policy <- "sdp_all" -start_run(cfg = cfg, codeCheck = codeCheck) - -################################################# -## Disaggregated runs ## -################################################# -### (1) Population and Health ### -cfg <- general_settings(title = "FSEC_population") -cfg <- population_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (2) Reduced inequality and Education Transformation ### -cfg <- general_settings(title = "FSEC_gdp_educ_inequ") -cfg <- inequalityANDeducation_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (3) Improved institutions ### -cfg <- general_settings(title = "FSEC_inst") -cfg <- institution_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (4) Energy and transfport transformation ### -cfg <- general_settings(title = "FSEC_energy") -cfg <- energy_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (5) Diet health transformation ### -cfg <- general_settings(title = "FSEC_dietHealth") -cfg <- diet_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (6) Diet meat transformation ### -cfg <- general_settings(title = "FSEC_dietLvst") -cfg <- meat_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (7) Diet waste transformation ### -cfg <- general_settings(title = "FSEC_dietWaste") -cfg <- waste_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (NA) Diet inclustion transformation ### -#cfg <- general_settings(title = "FSEC_dietInclusion") -#cfg <- dietInclusion_transformation(cfg = cfg) -#start_run(cfg = cfg, codeCheck = codeCheck) - -### (8) Livestock management transformation ### -cfg <- general_settings(title = "FSEC_livestock") -cfg <- livestock_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (9) Crop efficiency transformation ### -cfg <- general_settings(title = "FSEC_cropeff") -cfg <- cropefficiency_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (NA) Nitrogen transformation ### -#cfg <- general_settings(title = "FSEC_nitrogen") -#cfg <- nitrogen_transformation(cfg = cfg) -#start_run(cfg = cfg, codeCheck = codeCheck) - -### (10) Biodiversity transformation ### -cfg <- general_settings(title = "FSEC_biodiv") -cfg <- biodiversity_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (11) Diversity on land transformation ### -cfg <- general_settings(title = "FSEC_landSharing") -cfg <- landsharing_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (NA) Supply chain transformation ### -#cfg <- general_settings(title = "FSEC_supplyChain") -#cfg <- supplyChain_transformation(cfg = cfg) -#start_run(cfg = cfg, codeCheck = codeCheck) - -### (12) Fair trade transformation ### -cfg <- general_settings(title = "FSEC_fairTrade") -cfg <- fairTrade_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (13) Bioeconomy transformation ### -cfg <- general_settings(title = "FSEC_bioeconomy") -cfg <- bioeconomy_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (14) Afforestation transformation ### -cfg <- general_settings(title = "FSEC_REDDaff") -cfg <- REDDaff_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (15) REDD Transformation -cfg <- general_settings(title = "FSEC_REDD") -cfg <- REDD_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (16) Land and water sparing transformation ### -cfg <- general_settings(title = "FSEC_landSparing") -cfg <- landsparing_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (17) Peatland transformation ### -cfg <- general_settings(title = "FSEC_peatland") -cfg <- peatland_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (18) Air pollution intervention transformation ### -cfg <- general_settings(title = "FSEC_airpollution") -cfg <- airPollution_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) - -### (NA) Agricultural employment transformation ### -#cfg <- general_settings(title = "FSEC_employment") -#cfg <- employment_transformation(cfg = cfg) -#start_run(cfg = cfg, codeCheck = codeCheck) - -### (19) Soil pricing transformation ## -cfg <- general_settings(title = "FSEC_soil") -cfg <- soil_transformation(cfg = cfg) -start_run(cfg = cfg, codeCheck = codeCheck) diff --git a/scripts/start/projects/project_SHAPE.R b/scripts/start/projects/project_SHAPE.R index 271732d042..d6231d2ff9 100644 --- a/scripts/start/projects/project_SHAPE.R +++ b/scripts/start/projects/project_SHAPE.R @@ -28,7 +28,7 @@ source("config/default.cfg") ### General configurations -prefix <- "R0_v3_SHAPE" +prefix <- "R5_SHAPE" cfg$results_folder <- "output/:title:" cfg$output <- c("rds_report") # Only run rds_report after model run diff --git a/scripts/start/projects/project_gwpstar.R b/scripts/start/projects/project_gwpstar.R deleted file mode 100644 index f3476b0da2..0000000000 --- a/scripts/start/projects/project_gwpstar.R +++ /dev/null @@ -1,143 +0,0 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -# | authors, and contributors see CITATION.cff file. This file is part -# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -# | AGPL-3.0, you are granted additional permissions described in the -# | MAgPIE License Exception, version 1.0 (see LICENSE file). -# | Contact: magpie@pik-potsdam.de - -# ---------------------------------------------------------- -# description: AgMIP GWPstar runs -# ---------------------------------------------------------- - - -###################################### -#### Script to start a MAgPIE run #### -###################################### - -library(lucode2) -library(magclass) -library(gms) - -# Load start_run(cfg) function which is needed to start MAgPIE runs -source("scripts/start_functions.R") - -#start MAgPIE runs -source("config/default.cfg") - -pollutant_prices <- function(price_ref=0, CH4_factor=1) { - - GWP100_CH4 <- 25 - GWP100_N2O <- 265 - CO2_C <- 44/12 - N2O_N <- 44/28 - growth_rate <- 0.05 - year_start <- 2015 - year_end <- 2100 - year_ref <- 2070 - # price_ref <- 150 - - a<-read.magpie("modules/56_ghg_policy/input/f56_pollutant_prices_coupling.cs3") - a[,,] <- 0 - - for (y in seq(year_start,2150,by=5)) { - if (y <= year_end) { - a[,y,"ch4"] <- price_ref*(1+growth_rate)^-(year_ref-y)*GWP100_CH4*CH4_factor - a[,y,c("n2o_n_direct","n2o_n_indirect")] <- price_ref*(1+growth_rate)^-(year_ref-y)*N2O_N*GWP100_N2O - } else { - a[,y,"ch4"] <- setYears(a[,year_end,"ch4"],y) - a[,y,c("n2o_n_direct","n2o_n_indirect")] <- setYears(a[,year_end,c("n2o_n_direct","n2o_n_indirect")],y) - } - } - write.magpie(a,"modules/56_ghg_policy/input/f56_pollutant_prices_coupling.cs3") -} - -cfg$force_download <- FALSE - -cfg$results_folder <- "output/:title:" -cfg$force_replace <- TRUE -#cfg$results_folder <- "output/:title::date:" - -cfg$output <- c("rds_report","projects/agmip_report","validation","extra/disaggregation") - -prefix <- "V15" - -cfg$gms$c_timesteps <- "5year2070" - -cfg <- setScenario(cfg,c("SSP2","NPI")) -cfg$gms$c57_macc_version <- "PBL_2019" # def = PBL_2007 -cfg$gms$s56_limit_ch4_n2o_price <- 4000 # def = 1000 -cfg$gms$c56_pollutant_prices <- "coupling" - -cfg$gms$s15_livescen_target_subst <- 0 - -cfg$title <- paste(prefix,"SSP2_RCPREF_CP0000_REFDIET",sep = "_") -cfg$gms$c15_livescen_target <- "constant" -pollutant_prices(price_ref = 0,CH4_factor = 1) -start_run(cfg,codeCheck=FALSE) - -cfg$title <- paste(prefix,"SSP2_RCPREF_CP0150_REFDIET",sep = "_") -cfg$gms$c15_livescen_target <- "constant" -pollutant_prices(price_ref = 150,CH4_factor = 1) -start_run(cfg,codeCheck=FALSE) - -cfg$title <- paste(prefix,"SSP2_RCPREF_CP0150STARF_REFDIET",sep = "_") -cfg$gms$c15_livescen_target <- "constant" -pollutant_prices(price_ref = 150,CH4_factor = 0.25) -start_run(cfg,codeCheck=FALSE) - -cfg$title <- paste(prefix,"SSP2_RCPREF_CP0150STARM_REFDIET",sep = "_") -cfg$gms$c15_livescen_target <- "constant" -pollutant_prices(price_ref = 150,CH4_factor = 4) -start_run(cfg,codeCheck=FALSE) - - -cfg$title <- paste(prefix,"SSP2_RCPREF_CP0500_REFDIET",sep = "_") -cfg$gms$c15_livescen_target <- "constant" -pollutant_prices(price_ref = 500,CH4_factor = 1) -start_run(cfg,codeCheck=FALSE) - -cfg$title <- paste(prefix,"SSP2_RCPREF_CP0500STARF_REFDIET",sep = "_") -cfg$gms$c15_livescen_target <- "constant" -pollutant_prices(price_ref = 500,CH4_factor = 0.25) -start_run(cfg,codeCheck=FALSE) - -cfg$title <- paste(prefix,"SSP2_RCPREF_CP0500STARM_REFDIET",sep = "_") -cfg$gms$c15_livescen_target <- "constant" -pollutant_prices(price_ref = 500,CH4_factor = 4) -start_run(cfg,codeCheck=FALSE) - - -cfg$title <- paste(prefix,"SSP2_RCPREF_CP0000_LSPCUT",sep = "_") -cfg$gms$c15_livescen_target <- "lin_zero_20_70" -pollutant_prices(price_ref = 0,CH4_factor = 1) -start_run(cfg,codeCheck=FALSE) - -cfg$title <- paste(prefix,"SSP2_RCPREF_CP0150_LSPCUT",sep = "_") -cfg$gms$c15_livescen_target <- "lin_zero_20_70" -pollutant_prices(price_ref = 150,CH4_factor = 1) -start_run(cfg,codeCheck=FALSE) - -cfg$title <- paste(prefix,"SSP2_RCPREF_CP0150STARF_LSPCUT",sep = "_") -cfg$gms$c15_livescen_target <- "lin_zero_20_70" -pollutant_prices(price_ref = 150,CH4_factor = 0.25) -start_run(cfg,codeCheck=FALSE) - -cfg$title <- paste(prefix,"SSP2_RCPREF_CP0150STARM_LSPCUT",sep = "_") -cfg$gms$c15_livescen_target <- "lin_zero_20_70" -pollutant_prices(price_ref = 150,CH4_factor = 4) -start_run(cfg,codeCheck=FALSE) - -cfg$title <- paste(prefix,"SSP2_RCPREF_CP0500_LSPCUT",sep = "_") -cfg$gms$c15_livescen_target <- "lin_zero_20_70" -pollutant_prices(price_ref = 500,CH4_factor = 1) -start_run(cfg,codeCheck=FALSE) - -cfg$title <- paste(prefix,"SSP2_RCPREF_CP0500STARF_LSPCUT",sep = "_") -cfg$gms$c15_livescen_target <- "lin_zero_20_70" -pollutant_prices(price_ref = 500,CH4_factor = 0.25) -start_run(cfg,codeCheck=FALSE) - -cfg$title <- paste(prefix,"SSP2_RCPREF_CP0500STARM_LSPCUT",sep = "_") -cfg$gms$c15_livescen_target <- "lin_zero_20_70" -pollutant_prices(price_ref = 500,CH4_factor = 4) -start_run(cfg,codeCheck=FALSE) diff --git a/scripts/start/projects/project_vivid.R b/scripts/start/projects/project_vivid.R deleted file mode 100644 index a69d9b9e63..0000000000 --- a/scripts/start/projects/project_vivid.R +++ /dev/null @@ -1,77 +0,0 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) -# | authors, and contributors see CITATION.cff file. This file is part -# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -# | AGPL-3.0, you are granted additional permissions described in the -# | MAgPIE License Exception, version 1.0 (see LICENSE file). -# | Contact: magpie@pik-potsdam.de - -# ---------------------------------------------------------- -# description: VIVID -# ---------------------------------------------------------- - - -###################################### -#### Script to start a MAgPIE run #### -###################################### - -library(gms) -library(lucode2) -library(magclass) - -# Load start_run(cfg) function which is needed to start MAgPIE runs -source("scripts/start_functions.R") - -#start MAgPIE run -source("config/default.cfg") - -#cfg$force_download <- TRUE - -cfg$results_folder <- "output/:title:" -cfg$output <- c("rds_report","extra/disaggregation") - -prefix <- "VE10" -cfg$qos <- "priority" - -cfg$gms$s80_optfile <- 1 -cfg$gms$s80_maxiter <- 30 - -cfg$gms$s32_planing_horizon <- 100 -cfg$gms$c35_protect_scenario <- "WDPA" -cfg$gms$c56_emis_policy <- "redd+_nosoil" - -#ref -for (pol in c("Ref","Climate","Climate+Nature","ClimatePlant+NatureP10","ClimateNatveg+NatureP0")) { - if (pol == "Ref") { - cfg <- setScenario(cfg,c("SSP2","NPI")) - cfg$gms$c56_pollutant_prices <- "R2M41-SSP2-NPi" - cfg$gms$c60_2ndgen_biodem <- "R2M41-SSP2-NPi" - cfg$gms$s32_aff_plantation <- 0 - cfg$gms$c44_price_bv_loss <- "p0" - } else if (pol == "Climate") { - cfg <- setScenario(cfg,c("SSP2","NDC")) - cfg$gms$c56_pollutant_prices <- "R2M41-SSP2-Budg600" - cfg$gms$c60_2ndgen_biodem <- "R2M41-SSP2-Budg600" - cfg$gms$s32_aff_plantation <- 1 - cfg$gms$c44_price_bv_loss <- "p0" - } else if (pol == "Climate+Nature") { - cfg <- setScenario(cfg,c("SSP2","NDC")) - cfg$gms$c56_pollutant_prices <- "R2M41-SSP2-Budg600" - cfg$gms$c60_2ndgen_biodem <- "R2M41-SSP2-Budg600" - cfg$gms$s32_aff_plantation <- 0 - cfg$gms$c44_price_bv_loss <- "p10_p10000" - } else if (pol == "ClimatePlant+NatureP10") { - cfg <- setScenario(cfg,c("SSP2","NDC")) - cfg$gms$c56_pollutant_prices <- "R2M41-SSP2-Budg600" - cfg$gms$c60_2ndgen_biodem <- "R2M41-SSP2-Budg600" - cfg$gms$s32_aff_plantation <- 1 - cfg$gms$c44_price_bv_loss <- "p10_p10000" - } else if (pol == "ClimateNatveg+NatureP0") { - cfg <- setScenario(cfg,c("SSP2","NDC")) - cfg$gms$c56_pollutant_prices <- "R2M41-SSP2-Budg600" - cfg$gms$c60_2ndgen_biodem <- "R2M41-SSP2-Budg600" - cfg$gms$s32_aff_plantation <- 0 - cfg$gms$c44_price_bv_loss <- "p0" - } - cfg$title <- paste(prefix,paste0("SSP2-",pol),sep="_") - start_run(cfg,codeCheck=FALSE) -} diff --git a/scripts/start/projects/test_diets.R b/scripts/start/projects/test_diets.R new file mode 100644 index 0000000000..3228753bbe --- /dev/null +++ b/scripts/start/projects/test_diets.R @@ -0,0 +1,345 @@ +# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | authors, and contributors see CITATION.cff file. This file is part +# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +# | AGPL-3.0, you are granted additional permissions described in the +# | MAgPIE License Exception, version 1.0 (see LICENSE file). +# | Contact: magpie@pik-potsdam.de + +# ---------------------------------------------------------- +# description: Test diet scenarios +# ---------------------------------------------------------- + + +###################################### +#### Script to start a MAgPIE run #### +###################################### + +library(gms) +library(lucode2) +library(magclass) + +# Load start_run(cfg) function which is needed to start MAgPIE runs +source("scripts/start_functions.R") + +#start MAgPIE run +source("config/default.cfg") + +cfg$results_folder <- "output/:title:" +prefix <- "diet_change_v11" + +cfg$title <- paste(prefix,"olddefault",sep="_") +start_run(cfg,codeCheck=FALSE) + +cfg$title <- paste(prefix,"olddefaultEATlancet",sep="_") +cfg$gms$s15_exo_waste <- 1 +cfg$gms$s15_exo_diet <- 1 +cfg$gms$c15_kcal_scen <- "healthy_BMI" +cfg$gms$c15_EAT_scen <- "FLX" +cfg$gms$s15_exo_monogastric <- 1 +cfg$gms$s15_exo_ruminant <- 1 +cfg$gms$s15_exo_fish <- 1 +cfg$gms$s15_exo_fruitvegnut <- 1 +cfg$gms$s15_exo_pulses <- 1 +cfg$gms$s15_exo_sugar <- 1 +cfg$gms$s15_exo_oils <- 1 +cfg$gms$s15_exo_brans <- 1 +cfg$gms$s15_exo_scp <- 1 +cfg$gms$s15_exo_alcohol <- 1 +start_run(cfg,codeCheck=FALSE) + +source("config/default.cfg") +cfg$title <- paste(prefix,"newdefault",sep="_") +cfg$gms$food <- "anthro_iso_jun22" +start_run(cfg,codeCheck=FALSE) + +source("config/default.cfg") +cfg$title <- paste(prefix,"EATlancet",sep="_") +cfg$gms$food <- "anthro_iso_jun22" +cfg$gms$s15_exo_waste <- 1 +cfg$gms$s15_exo_diet <- 1 +cfg$gms$c15_kcal_scen <- "healthy_BMI" +cfg$gms$c15_EAT_scen <- "FLX" +cfg$gms$s15_exo_monogastric <- 1 +cfg$gms$s15_exo_ruminant <- 1 +cfg$gms$s15_exo_fish <- 1 +cfg$gms$s15_exo_fruitvegnut <- 1 +cfg$gms$s15_exo_pulses <- 1 +cfg$gms$s15_exo_sugar <- 1 +cfg$gms$s15_exo_oils <- 1 +cfg$gms$s15_exo_brans <- 1 +cfg$gms$s15_exo_scp <- 1 +cfg$gms$s15_exo_alcohol <- 1 +start_run(cfg,codeCheck=FALSE) + + +source("config/default.cfg") +cfg$title <- paste(prefix,"healthyBMI",sep="_") +cfg$gms$food <- "anthro_iso_jun22" +cfg$gms$s15_exo_waste <- 0 +cfg$gms$s15_exo_diet <- 1 +cfg$gms$c15_kcal_scen <- "healthy_BMI" +cfg$gms$c15_EAT_scen <- "FLX" +cfg$gms$s15_exo_monogastric <- 0 +cfg$gms$s15_exo_ruminant <- 0 +cfg$gms$s15_exo_fish <- 0 +cfg$gms$s15_exo_fruitvegnut <- 0 +cfg$gms$s15_exo_pulses <- 0 +cfg$gms$s15_exo_sugar <- 0 +cfg$gms$s15_exo_oils <- 0 +cfg$gms$s15_exo_brans <- 0 +cfg$gms$s15_exo_scp <- 0 +cfg$gms$s15_exo_alcohol <- 0 +start_run(cfg,codeCheck=FALSE) + +source("config/default.cfg") +cfg$title <- paste(prefix,"noUnderweight",sep="_") +cfg$gms$food <- "anthro_iso_jun22" +cfg$gms$s15_exo_waste <- 0 +cfg$gms$s15_exo_diet <- 1 +cfg$gms$c15_kcal_scen <- "no_underweight" +cfg$gms$c15_EAT_scen <- "FLX" +cfg$gms$s15_exo_monogastric <- 0 +cfg$gms$s15_exo_ruminant <- 0 +cfg$gms$s15_exo_fish <- 0 +cfg$gms$s15_exo_fruitvegnut <- 0 +cfg$gms$s15_exo_pulses <- 0 +cfg$gms$s15_exo_sugar <- 0 +cfg$gms$s15_exo_oils <- 0 +cfg$gms$s15_exo_brans <- 0 +cfg$gms$s15_exo_scp <- 0 +cfg$gms$s15_exo_alcohol <- 0 +start_run(cfg,codeCheck=FALSE) + +source("config/default.cfg") +cfg$title <- paste(prefix,"noOverweight",sep="_") +cfg$gms$food <- "anthro_iso_jun22" +cfg$gms$s15_exo_waste <- 0 +cfg$gms$s15_exo_diet <- 1 +cfg$gms$c15_kcal_scen <- "no_overweight" +cfg$gms$c15_EAT_scen <- "FLX" +cfg$gms$s15_exo_monogastric <- 0 +cfg$gms$s15_exo_ruminant <- 0 +cfg$gms$s15_exo_fish <- 0 +cfg$gms$s15_exo_fruitvegnut <- 0 +cfg$gms$s15_exo_pulses <- 0 +cfg$gms$s15_exo_sugar <- 0 +cfg$gms$s15_exo_oils <- 0 +cfg$gms$s15_exo_brans <- 0 +cfg$gms$s15_exo_scp <- 0 +cfg$gms$s15_exo_alcohol <- 0 +start_run(cfg,codeCheck=FALSE) + + +source("config/default.cfg") +cfg$title <- paste(prefix,"waste",sep="_") +cfg$gms$food <- "anthro_iso_jun22" +cfg$gms$s15_exo_waste <- 1 +cfg$gms$s15_exo_diet <- 0 +cfg$gms$c15_kcal_scen <- "healthy_BMI" +cfg$gms$c15_EAT_scen <- "FLX" +cfg$gms$s15_exo_monogastric <- 0 +cfg$gms$s15_exo_ruminant <- 0 +cfg$gms$s15_exo_fish <- 0 +cfg$gms$s15_exo_fruitvegnut <- 0 +cfg$gms$s15_exo_pulses <- 0 +cfg$gms$s15_exo_sugar <- 0 +cfg$gms$s15_exo_oils <- 0 +cfg$gms$s15_exo_brans <- 0 +cfg$gms$s15_exo_scp <- 0 +cfg$gms$s15_exo_alcohol <- 0 +start_run(cfg,codeCheck=FALSE) + +source("config/default.cfg") +cfg$title <- paste(prefix,"monogastric",sep="_") +cfg$gms$food <- "anthro_iso_jun22" +cfg$gms$s15_exo_waste <- 0 +cfg$gms$s15_exo_diet <- 1 +cfg$gms$c15_kcal_scen <- "endo" +cfg$gms$c15_EAT_scen <- "FLX" +cfg$gms$s15_exo_monogastric <- 1 +cfg$gms$s15_exo_ruminant <- 0 +cfg$gms$s15_exo_fish <- 0 +cfg$gms$s15_exo_fruitvegnut <- 0 +cfg$gms$s15_exo_pulses <- 0 +cfg$gms$s15_exo_sugar <- 0 +cfg$gms$s15_exo_oils <- 0 +cfg$gms$s15_exo_brans <- 0 +cfg$gms$s15_exo_scp <- 0 +cfg$gms$s15_exo_alcohol <- 0 +start_run(cfg,codeCheck=FALSE) + + +source("config/default.cfg") +cfg$title <- paste(prefix,"ruminant",sep="_") +cfg$gms$food <- "anthro_iso_jun22" +cfg$gms$s15_exo_waste <- 0 +cfg$gms$s15_exo_diet <- 1 +cfg$gms$c15_kcal_scen <- "endo" +cfg$gms$c15_EAT_scen <- "FLX" +cfg$gms$s15_exo_monogastric <- 0 +cfg$gms$s15_exo_ruminant <- 1 +cfg$gms$s15_exo_fish <- 0 +cfg$gms$s15_exo_fruitvegnut <- 0 +cfg$gms$s15_exo_pulses <- 0 +cfg$gms$s15_exo_sugar <- 0 +cfg$gms$s15_exo_oils <- 0 +cfg$gms$s15_exo_brans <- 0 +cfg$gms$s15_exo_scp <- 0 +cfg$gms$s15_exo_alcohol <- 0 +start_run(cfg,codeCheck=FALSE) + + +source("config/default.cfg") +cfg$title <- paste(prefix,"fish",sep="_") +cfg$gms$food <- "anthro_iso_jun22" +cfg$gms$s15_exo_waste <- 0 +cfg$gms$s15_exo_diet <- 1 +cfg$gms$c15_kcal_scen <- "endo" +cfg$gms$c15_EAT_scen <- "FLX" +cfg$gms$s15_exo_monogastric <- 0 +cfg$gms$s15_exo_ruminant <- 0 +cfg$gms$s15_exo_fish <- 1 +cfg$gms$s15_exo_fruitvegnut <- 0 +cfg$gms$s15_exo_pulses <- 0 +cfg$gms$s15_exo_sugar <- 0 +cfg$gms$s15_exo_oils <- 0 +cfg$gms$s15_exo_brans <- 0 +cfg$gms$s15_exo_scp <- 0 +cfg$gms$s15_exo_alcohol <- 0 +start_run(cfg,codeCheck=FALSE) + + +source("config/default.cfg") +cfg$title <- paste(prefix,"fruitvegnutseed",sep="_") +cfg$gms$food <- "anthro_iso_jun22" +cfg$gms$s15_exo_waste <- 0 +cfg$gms$s15_exo_diet <- 1 +cfg$gms$c15_kcal_scen <- "endo" +cfg$gms$c15_EAT_scen <- "FLX" +cfg$gms$s15_exo_monogastric <- 0 +cfg$gms$s15_exo_ruminant <- 0 +cfg$gms$s15_exo_fish <- 0 +cfg$gms$s15_exo_fruitvegnut <- 1 +cfg$gms$s15_exo_pulses <- 0 +cfg$gms$s15_exo_sugar <- 0 +cfg$gms$s15_exo_oils <- 0 +cfg$gms$s15_exo_brans <- 0 +cfg$gms$s15_exo_scp <- 0 +cfg$gms$s15_exo_alcohol <- 0 +start_run(cfg,codeCheck=FALSE) + + +source("config/default.cfg") +cfg$title <- paste(prefix,"pulses",sep="_") +cfg$gms$food <- "anthro_iso_jun22" +cfg$gms$s15_exo_waste <- 0 +cfg$gms$s15_exo_diet <- 1 +cfg$gms$c15_kcal_scen <- "endo" +cfg$gms$c15_EAT_scen <- "FLX" +cfg$gms$s15_exo_monogastric <- 0 +cfg$gms$s15_exo_ruminant <- 0 +cfg$gms$s15_exo_fish <- 0 +cfg$gms$s15_exo_fruitvegnut <- 0 +cfg$gms$s15_exo_pulses <- 1 +cfg$gms$s15_exo_sugar <- 0 +cfg$gms$s15_exo_oils <- 0 +cfg$gms$s15_exo_brans <- 0 +cfg$gms$s15_exo_scp <- 0 +cfg$gms$s15_exo_alcohol <- 0 +start_run(cfg,codeCheck=FALSE) + + +source("config/default.cfg") +cfg$title <- paste(prefix,"sugar",sep="_") +cfg$gms$food <- "anthro_iso_jun22" +cfg$gms$s15_exo_waste <- 0 +cfg$gms$s15_exo_diet <- 1 +cfg$gms$c15_kcal_scen <- "endo" +cfg$gms$c15_EAT_scen <- "FLX" +cfg$gms$s15_exo_monogastric <- 0 +cfg$gms$s15_exo_ruminant <- 0 +cfg$gms$s15_exo_fish <- 0 +cfg$gms$s15_exo_fruitvegnut <- 0 +cfg$gms$s15_exo_pulses <- 0 +cfg$gms$s15_exo_sugar <- 1 +cfg$gms$s15_exo_oils <- 0 +cfg$gms$s15_exo_brans <- 0 +cfg$gms$s15_exo_scp <- 0 +cfg$gms$s15_exo_alcohol <- 0 +start_run(cfg,codeCheck=FALSE) + + +source("config/default.cfg") +cfg$title <- paste(prefix,"oils",sep="_") +cfg$gms$food <- "anthro_iso_jun22" +cfg$gms$s15_exo_waste <- 0 +cfg$gms$s15_exo_diet <- 1 +cfg$gms$c15_kcal_scen <- "endo" +cfg$gms$c15_EAT_scen <- "FLX" +cfg$gms$s15_exo_monogastric <- 0 +cfg$gms$s15_exo_ruminant <- 0 +cfg$gms$s15_exo_fish <- 0 +cfg$gms$s15_exo_fruitvegnut <- 0 +cfg$gms$s15_exo_pulses <- 0 +cfg$gms$s15_exo_sugar <- 0 +cfg$gms$s15_exo_oils <- 1 +cfg$gms$s15_exo_brans <- 0 +cfg$gms$s15_exo_scp <- 0 +cfg$gms$s15_exo_alcohol <- 0 +start_run(cfg,codeCheck=FALSE) + +source("config/default.cfg") +cfg$title <- paste(prefix,"alcohol",sep="_") +cfg$gms$food <- "anthro_iso_jun22" +cfg$gms$s15_exo_waste <- 0 +cfg$gms$s15_exo_diet <- 1 +cfg$gms$c15_kcal_scen <- "endo" +cfg$gms$c15_EAT_scen <- "FLX" +cfg$gms$s15_exo_monogastric <- 0 +cfg$gms$s15_exo_ruminant <- 0 +cfg$gms$s15_exo_fish <- 0 +cfg$gms$s15_exo_fruitvegnut <- 0 +cfg$gms$s15_exo_pulses <- 0 +cfg$gms$s15_exo_sugar <- 0 +cfg$gms$s15_exo_oils <- 0 +cfg$gms$s15_exo_brans <- 0 +cfg$gms$s15_exo_scp <- 0 +cfg$gms$s15_exo_alcohol <- 1 +start_run(cfg,codeCheck=FALSE) + +source("config/default.cfg") +cfg$title <- paste(prefix,"processed",sep="_") +cfg$gms$food <- "anthro_iso_jun22" +cfg$gms$s15_exo_waste <- 0 +cfg$gms$s15_exo_diet <- 1 +cfg$gms$c15_kcal_scen <- "endo" +cfg$gms$c15_EAT_scen <- "FLX" +cfg$gms$s15_exo_monogastric <- 0 +cfg$gms$s15_exo_ruminant <- 0 +cfg$gms$s15_exo_fish <- 0 +cfg$gms$s15_exo_fruitvegnut <- 0 +cfg$gms$s15_exo_pulses <- 0 +cfg$gms$s15_exo_sugar <- 1 +cfg$gms$s15_exo_oils <- 1 +cfg$gms$s15_exo_brans <- 1 +cfg$gms$s15_exo_scp <- 1 +cfg$gms$s15_exo_alcohol <- 1 +start_run(cfg,codeCheck=FALSE) + +source("config/default.cfg") +cfg$title <- paste(prefix,"elastic",sep="_") +cfg$gms$food <- "anthro_iso_jun22" +cfg$gms$s15_exo_waste <- 0 +cfg$gms$s15_exo_diet <- 0 +cfg$gms$s15_elastic_demand <- 1 +start_run(cfg,codeCheck=FALSE) + + +# should show no change +source("config/default.cfg") +cfg$title <- paste(prefix,"elasticEAT",sep="_") +cfg$gms$food <- "anthro_iso_jun22" +cfg$gms$s15_exo_waste <- 1 +cfg$gms$s15_exo_diet <- 1 +cfg$gms$s15_elastic_demand <- 1 +start_run(cfg,codeCheck=FALSE) diff --git a/scripts/start/projects/test_rotations.R b/scripts/start/projects/test_rotations.R index 868acd0944..fc4a5a9fd3 100644 --- a/scripts/start/projects/test_rotations.R +++ b/scripts/start/projects/test_rotations.R @@ -27,7 +27,7 @@ cfg$gms$s13_max_gdp_shr <- 0.01 cfg$results_folder <- "output/:title:" #cfg$output <- c("rds_report","extra/disaggregation")#"extra/highres" -prefix <- "rota_penalty17" +prefix <- "rota_penalty18" cfg$title <- paste(prefix,"olddefault",sep="_") start_run(cfg,codeCheck=FALSE) @@ -44,16 +44,15 @@ start_run(cfg,codeCheck=FALSE) cfg$title <- paste(prefix,"newdefault",sep="_") cfg$gms$crop <- "penalty_apr22" +cfg$gms$som <- "cellpool_aug16" cfg$gms$c30_rotation_scenario = "default" #cfg$qos <- "priority" cfg$recalibrate <- TRUE cfg$recalibrate_landconversion_cost <- TRUE -cfg$recalibrate <- FALSE -cfg$recalibrate_landconversion_cost <- FALSE start_run(cfg,codeCheck=FALSE) -magpie4::submitCalibration("H12_sticky_feb18_dynamic_rotation") +magpie4::submitCalibration("H12_sticky_feb18_dynamic_rotation2") cfg$recalibrate <- FALSE cfg$recalibrate_landconversion_cost <- FALSE diff --git a/scripts/start/test_runs.R b/scripts/start/test_runs.R index 64cc7a7e8b..ced1476f9e 100644 --- a/scripts/start/test_runs.R +++ b/scripts/start/test_runs.R @@ -31,404 +31,45 @@ cfg$results_folder <- "output/:title:" cfg$force_replace <- TRUE # support function to create standardized title -.title <- function(...) return(paste(cfg$info$flag, sep="_",...)) +.title <- function(cfg, ...) return(paste(cfg$info$flag, sep="_",...)) + +# Single time step run +timeSteps <- cfg$gms$c_timesteps +cfg$gms$c_timesteps <- 1 +cfg$title <- .title(cfg, "singleTimeStep") +start_run(cfg, codeCheck = TRUE) +cfg$gms$c_timesteps <- timeSteps + # Reference and Policy run for SSP1, SSP2 and SSP5 for(ssp in c("SSP1","SSP2","SSP5")) { - cfg$title <- .title(paste(ssp,"Ref",sep="-")) + cfg$title <- .title(cfg, paste(ssp,"Ref",sep="-")) cfg <- setScenario(cfg,c(ssp,"NPI","rcp7p0")) cfg$gms$c56_pollutant_prices <- paste0("R21M42-",ssp,"-NPi") cfg$gms$c60_2ndgen_biodem <- paste0("R21M42-",ssp,"-NPi") - start_run(cfg, codeCheck = TRUE) + start_run(cfg, codeCheck = FALSE) - cfg$title <- .title(paste(ssp,"PkBudg900",sep="-")) + cfg$title <- .title(cfg, paste(ssp,"PkBudg900",sep="-")) cfg <- setScenario(cfg,c(ssp,"NDC","rcp1p9")) cfg$gms$c56_pollutant_prices <- paste0("R21M42-",ssp,"-PkBudg900") cfg$gms$c60_2ndgen_biodem <- paste0("R21M42-",ssp,"-PkBudg900") - start_run(cfg, codeCheck = TRUE) - -} - -############################################## -### FSEC Test run (FSDP) with FSEC regions ### -############################################## -codeCheck <- FALSE - -input <- c(regional = "rev4.73FSECmodeling_e2bdb6cd_magpie.tgz", - cellular = "rev4.73FSECmodeling_e2bdb6cd_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", - validation = "rev4.73FSECmodeling_e2bdb6cd_validation.tgz", - additional = "additional_data_rev4.26.tgz", - calibration = "calibration_FSEC_18Jun22.tgz") - -# General settings: -general_settings <- function(title) { - - source("config/default.cfg") - - cfg$input <- input - cfg$title <- paste0("v9_", title) - cfg$recalibrate <- FALSE - cfg$qos <- "priority_maxMem" - cfg$output <- c(cfg$output #, - #"extra/disaggregation_BII", "projects/FSEC_dietaryIndicators", - #"projects/FSEC_environmentalPollution_grid" - ) - - # Climate change impacts activated, SSP2 default settings, NDC activated, endogenous forestry activated - cfg <- gms::setScenario(cfg, c("cc", "rcp7p0", "SSP2", "NDC", "ForestryEndo")) - cfg$input['cellular'] <- "rev4.73FSECmodeling_e2bdb6cd_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz" - cfg$force_download <- TRUE - - # Nitrogen module with IPCC emissions factors rescaled with efficiency - cfg$gms$nitrogen <- "rescaled_jan21" - # emission policy not including any GHG sources - cfg$gms$c56_emis_policy <- "none" - # ghg price setting (only relevant when activated by c56_emis_policy) - cfg$gms$c56_pollutant_prices <- "R21M42-SDP-PkBudg1000" - # residue on field burning is set to "constant" - cfg$gms$c18_burn_scen <- "constant" - # C price driven afforestation is off by default - cfg$gms$s56_c_price_induced_aff <- "0" - # Soil organic carbon dynamics activated - cfg$gms$som <- "cellpool_aug16" - # Cost module: sticky - dynamic mode - cfg$gms$factor_costs <- "sticky_feb18" - - # Regional factor requirement costs (crop and livestock) - cfg$gms$c38_fac_req <- "reg" - cfg$gms$c70_fac_req_regr <- "reg" - - return(cfg) -} - -# ----------------------------------------------------------------------------------------------------------------- -# Settings of transformation clusters: -### (1) Population and General Health ### -population_transformation <- function(cfg) { - # Population birth rate and demographic structure of SSP1 scenario: - cfg$gms$c09_pop_scenario <- "SSP1" # same as SDP scenario - - return(cfg) -} - -### (2) Reduced inequality transformation ### -inequalityANDeducation_transformation <- function(cfg) { - # GDP following SSP1 path - cfg$gms$c09_gdp_scenario <- "SSP1" - # Only cap top incomes - # (not available yet) - - return(cfg) -} - -### (3) Improved institutions ### -institution_transformation <- function(cfg) { - # Improved institutions: lower interest rates - # Interest rates are still regionally specific (dependent on GDP), but - # set to lower levels for low income countries - cfg$gms$s12_interest_lic <- "0.06" # def: "0.1" - cfg$gms$s12_interest_hic <- "0.04" # def: "0.04" + start_run(cfg, codeCheck = FALSE) - return(cfg) } -### (4) Energy and transport transformation ### -energy_transformation <- function(cfg) { - # Air pollution reduction and other health risks - # (cannot be covered) - # Higher PAL due to active transportation - cfg$gms$c09_pal_scenario <- "SSP1" ### Note: new scenario needed! (not available yet) - # Lower non-agricultural water demand - cfg$gms$s42_watdem_nonagr_scenario <- "1" +##################################################### +### FSEC Test runs (BAU + FSDP) with FSEC regions ### +##################################################### +source("scripts/projects/fsec.R") - # Reduction of traditional fuels and manure burning - # (not available yet) - - # More sustainable urbanization path - cfg$gms$c34_urban_scenario <- "SSP1" - - # 2nd gen. bioenergy demand following "well-below 1.5" pathway - cfg$gms$c60_2ndgen_biodem <- "R21M42-SDP-PkBudg1000" - # 2nd gen. bioenergy residues following sustainable development pathway - cfg$gms$c60_res_2ndgenBE_dem <- "sdp" - - return(cfg) -} - -### (5) Diet health transformation ### -diet_transformation <- function(cfg) { - # Food transition towards healthy & sustainable diets - cfg$gms$c15_food_scenario <- "SSP1" - cfg$gms$s15_elastic_demand <- "0" - cfg$gms$c15_rumdairy_scp_scen <- "constant" - # cfg$gms$c15_exo_scen_targetyear <- "y2050" # need to be updated, switch changed - cfg$gms$s15_exo_diet <- "1" - cfg$gms$c15_kcal_scen <- "healthy_BMI" - cfg$gms$c15_EAT_scen <- "FLX" - # Change in life expectancy - # (cannot be implemented) - - return(cfg) -} - -### (6) Diet meat transformation ### -meat_transformation <- function(cfg) { - # Food transition towards reduced meat consumption - cfg$gms$c15_livescen_target <- "lin_zero_20_50" - - return(cfg) -} - -### (7) Diet waste transformation ### -waste_transformation <- function(cfg) { - # Lower food waste - cfg$gms$s15_exo_waste <- "1" - cfg$gms$s15_waste_scen <- "1.2" - - return(cfg) -} - -### (NA) Diet inclustion transformation ### -dietInclusion_transformation <- function(cfg) { - # Breastfeeding - # (cannot be implemented) - # Care work - # (cannot be implemented) - # Shifting to female consumption - # (cannot be implemented) - # Reducing intake inequality - # (cannot be implemented) - - return(cfg) -} - -### (8) Livestock management transformation ### -livestock_transformation <- function(cfg) { - # Higher manure recycling rates - cfg$gms$c55_scen_conf <- "SSP1" - # Higher feed efficiency (capped scenario) - cfg$gms$c70_feed_scen <- "ssp1" - # Animal welfare - # (cannot be implemented) - # CH4 price for livestock - cfg$gms$c56_emis_policy <- "sdp_livestock" - - return(cfg) -} - -### (9) Crop efficiency transformation ### -cropefficiency_transformation <- function(cfg) { - # high NUE - cfg$gms$c50_scen_neff <- "neff75_80_starty2010" - # water use efficiency - # (not available yet) - # tau - # (not available yet) - # rice emission pricing - cfg$gms$c56_emis_policy <- "sdp_cropeff" - - return(cfg) -} - -### (NA) Nitrogen transformation ### -nitrogen_transformation <- function(cfg) { - # improved N Fixing - # (not available yet) - # yield penalty - # (not available yet) - # replace rapeseed and sunflower by soybean in processing - # (not available yet) - - return(cfg) -} - -### (10) Biodiversity transformation ### -biodiversity_transformation <- function(cfg) { - # BII target - cfg$gms$s44_bii_lower_bound <- 0.81 - - return(cfg) - -} - -### (NA) Supply chain transformation ### -supplyChain_transformation <- function(cfg) { - # reduce value-added in processing - # (cannot be implemented) - # switch to wholegrain - # (not available yet) - # reduce sugar-sweetened beverages - # (cannot be implemented) - # reduce alcohol - # (not available yet) - # reduce salt - # (not available yet) - # ban of trans-fatty acids - # (not available yet) - # reduce food losses - # (not available yet) - # fortification - # (cannot be implemented) - - return(cfg) -} - -### (11) Fair trade transformation ### -fairTrade_transformation <- function(cfg) { - #reduce subsidies - # (cannot be implemented) - #reduce historical trade patterns - # (not available yet) - #increase transportation costs - # (not available yet) - # Increased trade openness - cfg$gms$c21_trade_liberalization <- "l908080r807070" - - return(cfg) -} - -### (12) Bioeconomy transformation ### -bioeconomy_transformation <- function(cfg) { - # Timber demand: higher demand for buildings from wood - cfg$gms$c73_build_demand <- "50pc" - # Biomaterial demand increases (therefore no phaseout of 1stgen bioenergy, but rather constant) - cfg$gms$c60_1stgen_biodem <- "const2030" - - return(cfg) -} - -### (13) Afforestation (REDDaff) transformation ### -REDDaff_transformation <- function(cfg) { - # Afforestation policy following Nationally determined contributions - # and limited to tropical regions and 500 Mha because of the albedo effect - # (see also Fuss et al. 2018) - cfg$gms$c32_aff_policy <- "ndc" - cfg$gms$c32_aff_mask <- "onlytropical" - cfg$gms$s32_max_aff_area <- "500" - - # C price driven afforestation activated - cfg$gms$s56_c_price_induced_aff <- "1" - # all carbon pools - cfg$gms$c56_emis_policy <- "sdp_redd" - - return(cfg) -} - -### (13) Reducing emissions from deforestation (REDD) transformation ### -REDD_transformation <- function(cfg) { - - # all carbon pools - cfg$gms$c56_emis_policy <- "sdp_redd" - - return(cfg) -} - - -### (14) Land and water sparing transformation ### -landsparing_transformation <- function(cfg) { - # land protection following strict protection scenario (half or land's surface) - cfg$gms$c22_protect_scenario <- "HalfEarth" - - # water protection through environmental flow protection - cfg$gms$c42_env_flow_policy <- "on" - cfg$gms$c30_bioen_water <- "rainfed" # (already default anyways) - - return(cfg) -} - -### (15) Peatland transformation ### -peatland_transformation <- function(cfg) { - # peatland protection via pricing - cfg$gms$c56_emis_policy <- "sdp_peatland" - # peatland restoration - cfg$gms$s58_rewetting_switch <- "Inf" - - return(cfg) -} - -### (16) Air pollution intervention transformation ### -airPollution_transformation <- function(cfg) { - # crop residue burning is phasing out rather than at constant levels as in default - cfg$gms$c18_burn_scen <- "phaseout" - # savanna burning - # (not available yet) - # deforestation with timber harvest rather than burning - cfg$gms$c35_forest_damage_end <- 2030 - - return(cfg) -} - -### (NA) Agricultural employment transformation ### -employment_transformation <- function(cfg) { - # increase minimum wage (at costs of costs) - # (not available yet) - # increase labor productivity + wage (at costs of employment) - # (not available yet) - - return(cfg) -} - -### (18) Soil pricing transformation ### -soil_transformation <- function(cfg) { - # soil pricing - cfg$gms$c56_emis_policy <- "sdp_soil" +codeCheck <- FALSE - return(cfg) -} +### Business-as-usual +cfg <- fsecScenario(scenario = "c_BAU") +start_run(cfg = cfg, codeCheck = codeCheck) -################################################# -## Total SDP Scenario ## -################################################# -cfg <- general_settings(title = "FSEC_FSDP") -# Climate scenario: RCP 2.6 -cfg <- gms::setScenario(cfg, c("cc", "rcp2p6", "SSP1", "NDC", "ForestryEndo")) -cfg$input['cellular'] <- "rev4.73FSECmodeling_e2bdb6cd_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz" -### (1) Population and Health ### -cfg <- population_transformation(cfg = cfg) -### (2) Reduced inequality and Education Transformation ### -cfg <- inequalityANDeducation_transformation(cfg = cfg) -### (3) Improved institutions ### -cfg <- institution_transformation(cfg = cfg) -### (4) Energy and transfport transformation ### -cfg <- energy_transformation(cfg = cfg) -### (5) Diet health transformation ### -cfg <- diet_transformation(cfg = cfg) -### (6) Diet meat transformation ### -cfg <- meat_transformation(cfg = cfg) -### (7) Diet waste transformation ### -cfg <- waste_transformation(cfg = cfg) -### (NA) Diet inclustion transformation ### -#cfg <- dietInclusion_transformation(cfg = cfg) -### (8) Livestock management transformation ### -cfg <- livestock_transformation(cfg = cfg) -### (9) Crop efficiency transformation ### -cfg <- cropefficiency_transformation(cfg = cfg) -### (NA) Nitrogen transformation ### -#cfg <- nitrogen_transformation(cfg = cfg) -### (10) Biodiverstiy transformation ### -cfg <- biodiversity_transformation(cfg = cfg) -### (NA) Supply chain transformation ### -#cfg <- supplyChain_transformation(cfg = cfg) -### (11) Fair trade transformation ### -cfg <- fairTrade_transformation(cfg = cfg) -### (12) Bioeconomy transformation ### -cfg <- bioeconomy_transformation(cfg = cfg) -### (13) REDDaff transformation ### -cfg <- REDDaff_transformation(cfg = cfg) -### (14) REDD Transformation -cfg <- REDD_transformation(cfg = cfg) -### (15) Land and water sparing transformation ### -cfg <- landsparing_transformation(cfg = cfg) -### (16) Land and water sparing transformation ### -cfg <- peatland_transformation(cfg = cfg) -### (17) Air pollution intervention transformation ### -cfg <- airPollution_transformation(cfg = cfg) -### (NA) Agricultural employment transformation ### -#cfg <- employment_transformation(cfg = cfg) -### (19) Soil pricing transformation ## -cfg <- soil_transformation(cfg = cfg) -### Emission policy must be set separately in full-SDP scenario -# (because it would be overwritten in the different transformations) -cfg$gms$c56_emis_policy <- "sdp_all" # To Do: change to sdp_all once soil runs feasible +### FSDP Scenario +cfg <- fsecScenario(scenario = "e_FSDP") start_run(cfg = cfg, codeCheck = codeCheck) + diff --git a/scripts/start_functions.R b/scripts/start_functions.R index 5b2d5bd36c..0c16795c82 100644 --- a/scripts/start_functions.R +++ b/scripts/start_functions.R @@ -82,7 +82,7 @@ desc = "emission policy scenarios", items = scen56)) - gms::writeSets(sets, "modules/56_ghg_policy/price_jan20/sets.gms") + gms::writeSets(sets, "modules/56_ghg_policy/price_aug22/sets.gms") ### 60_bioenergy scen2nd60 <- magclass::read.magpie("modules/60_bioenergy/input/f60_bioenergy_dem.cs3") @@ -380,9 +380,15 @@ start_run <- function(cfg, scenario = NULL, codeCheck = TRUE, lock_model = TRUE) # Yield calibration calib_file <- "modules/14_yields/input/f14_yld_calib.csv" if(cfg$recalibrate=="ifneeded") { - # recalibrate if file does not exist - if(!file.exists(calib_file)) cfg$recalibrate <- TRUE else cfg$recalibrate <- FALSE - } + if(!file.exists(calib_file)) { + # recalibrate if file does not exist + cfg$recalibrate <- TRUE + } else { + # recalibrate if all calibration factors are 1, otherwise don't + cfg$recalibrate <- all(magclass::read.magpie(calib_file)==1) + } + } + if(cfg$recalibrate){ cat("Starting yield calibration factor calculation!\n") source("scripts/calibration/calc_calib.R") diff --git a/start.R b/start.R index 7188c80936..7ca9dbc3d0 100644 --- a/start.R +++ b/start.R @@ -66,6 +66,8 @@ runOutputs <- function(runscripts=NULL, submit=NULL) { } runsubmit <- function(runscripts, submit) { + if(!dir.exists("logs")) dir.create("logs") + for(rout in runscripts){ name <- paste0("./scripts/start/",rout) if(!file.exists(name)) { @@ -79,14 +81,14 @@ runOutputs <- function(runscripts=NULL, submit=NULL) { cat("Executing",name,"\n") rout_name <- sub("\\.R$","",sub("/","_",rout)) - sbatch_command <- paste0("sbatch --job-name=",rout_name," --output=",rout_name,"-%j.out --mail-type=END --wrap=\"Rscript ",name,"\"") + sbatch_command <- paste0("sbatch --job-name=",rout_name," --output=logs/",rout_name,"-%j.out --mail-type=END --wrap=\"Rscript ",name,"\"") if(submit=="direct") { tmp.env <- new.env() tmp.error <- try(sys.source(name,envir=tmp.env)) if(!is.null(tmp.error)) warning("Script ",name," was stopped by an error and not executed properly!") rm(tmp.env) } else if(submit=="background") { - log <- format(Sys.time(), paste0(rout_name,"-%Y-%H-%M-%S-%OS3.log")) + log <- format(Sys.time(), paste0("logs/", rout_name, "-%Y-%H-%M-%S-%OS3.log")) system2("Rscript",name, stderr = log, stdout = log, wait=FALSE) } else if(submit=="slurmpriority") { system(paste(sbatch_command,"--qos=priority"))