diff --git a/.Rbuildignore b/.Rbuildignore new file mode 100644 index 0000000000..9914e75a4b --- /dev/null +++ b/.Rbuildignore @@ -0,0 +1,3 @@ +^renv$ +^renv\.lock$ +^.*\.zenodo.json$ diff --git a/.Rprofile b/.Rprofile index 9de97a63aa..ccfe3ebf9b 100644 --- a/.Rprofile +++ b/.Rprofile @@ -1,22 +1,25 @@ -# source global .Rprofile (very important to load user specific settings) -# DO NOT EDIT THIS LINE! -if(file.exists("~/.Rprofile")) source("~/.Rprofile") +# | (C) 2008-2023 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 +Sys.setenv(RENV_PATHS_LIBRARY = "renv/library") +source("renv/activate.R") -# This profile can be used to link the model to a specified library snapshot -# (e.g. if your model version is from an older date and does not work with the -# newest libraries anymore) -# By default it is not active. Just uncomment the following lines and set the -# snapshot path to a path of your choice -# Please make also sure that in your config file this .Rprofile file is copied -# to the model output folder. Otherwise, the run itself will again use the -# default library set! +if (!"https://rse.pik-potsdam.de/r/packages" %in% getOption("repos")) { + options(repos = c(getOption("repos"), pik = "https://rse.pik-potsdam.de/r/packages")) +} +# bootstrapping, will only run once after this repo is freshly cloned +if (isTRUE(rownames(installed.packages(priority = "NA")) == "renv")) { + message("R package dependencies are not installed in this renv, installing now...") + renv::hydrate() # auto-detect and install all dependencies + message("Finished installing R package dependencies.") +} -# snapshot <- "/p/projects/rd3mod/R/libraries/snapshots/2020_03_10" -# if(file.exists(snapshot)) { -# cat("Setting libPaths to",snapshot,"\n") -# .libPaths(snapshot) -# } else { -# cat("Could not find",snapshot,"\n") -# } +# source global .Rprofile (very important to load user specific settings) +if (file.exists("~/.Rprofile")) { + source("~/.Rprofile") +} diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 2de3d792c1..6f03f253e7 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -1,23 +1,32 @@ #!/usr/bin/env Rscript -if(!requireNamespace("gms", quietly = TRUE)) install.packages("gms", repos = c("https://rse.pik-potsdam.de/r/packages/", "https://cloud.r-project.org")) +gmsRequiredVersion <- "0.24.1" +if (tryCatch(utils::packageVersion("gms") < gmsRequiredVersion, error = function(error) TRUE)) { + message("gms >= ", gmsRequiredVersion, " is required, installing now...") + install.packages("gms") +} + +message("Checking files for tabs... ", appendLF = FALSE) +gms::checkNoTabs(pattern = "\\.(R|Rprofile|gms|cfg|bib)$", excludeFolders = c("output", "renv", ".git")) +message("done.") # run codeCheck -null <- gms::codeCheck(strict=TRUE) +invisible(gms::codeCheck(strict = TRUE)) message("") -# make sure that files are not too big -maxfilesize <- function(max=512) { - files <- union(system("git ls-tree -r HEAD --name-only", intern=TRUE), - system("git diff --cached --name-only", intern=TRUE)) - out <- data.frame(files=files,size=round(file.size(files)/1024,2)) - out <- out[!is.na(out$size),] - out <- out[out$size > max,] - if(nrow(out)>0) { - stop(nrow(out), " files with size > ",max,"kB detected: \n",paste0(out$files," (", out$size, "kB)", collapse = "\n")) +# make sure that files are not too big +maxfilesize <- function(max) { + files <- union(system("git ls-tree -r HEAD --name-only", intern = TRUE), + system("git diff --cached --name-only", intern = TRUE)) + out <- data.frame(files = files, size = round(file.size(files) / 1024, 2)) + out <- out[!is.na(out$size), ] + out <- out[out$size > max, ] + if (nrow(out) > 0) { + stop(nrow(out), " files with size > ", max, "kB detected: \n", + paste0(out$files, " (", out$size, "kB)", collapse = "\n")) } - message("All files are smaller than ",max,"kB\n") + message("All files are smaller than ", max, "kB\n") } maxfilesize(250) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 7ee1df3b2d..9243ca1dba 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,57 +1,53 @@ -## :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. -- [ ] 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 `Rscript start.R --> "compilation check"` + - **Medium risk**: + - Run test runs via `Rscript start.R --> "test runs"` + - Check logs for errors/warnings + - **High risk**: + - Run test runs via `Rscript start.R --> "test runs"` + - Check logs for errors/warnings + - Default run from the PR target branch for comparison + - 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 +- [ ] content review done (at least 1) +- [ ] RSE review done (at least 1) diff --git a/.github/workflows/test-code.yaml b/.github/workflows/test-code.yaml index af57b9ec24..cad05908ee 100644 --- a/.github/workflows/test-code.yaml +++ b/.github/workflows/test-code.yaml @@ -9,41 +9,30 @@ on: - main - master - develop - + name: check jobs: check: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v2 - - uses: r-lib/actions/setup-r@v1 - - - name: Query dependencies - run: | - saveRDS("gms", ".github/depends.Rds", version = 2) - writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") - shell: Rscript {0} + - name: Remove .Rprofile + run: rm .Rprofile - - name: Cache R packages - uses: actions/cache@v2 + - uses: r-lib/actions/setup-r@v2 with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- + extra-repositories: https://cloud.r-project.org https://rse.pik-potsdam.de/r/packages/ - name: Install R dependencies - run: | - repos <- c("https://cloud.r-project.org","https://rse.pik-potsdam.de/r/packages/") - install.packages(c("remotes"), repos=repos) - remotes::install_cran("gms", repos=repos) - shell: Rscript {0} - + uses: r-lib/actions/setup-r-dependencies@v2 + with: + packages: gms + extra-packages: gms + - name: pre-commit Hook run: source(".githooks/pre-commit") shell: Rscript {0} - - diff --git a/.gitignore b/.gitignore index 775edb43a8..57660a15fd 100644 --- a/.gitignore +++ b/.gitignore @@ -26,9 +26,16 @@ magpie_calib.* #ignore run specific files and folders /225*/ /run_details/ +/logs/ *.out /scripts/npi_ndc/npi_ndc_overview.txt Rplots.pdf #ignore GAMS license gamslice.txt + +#ignore lock file +/.lock + +/renv.lock +.Rproj.user diff --git a/.lintr b/.lintr new file mode 100644 index 0000000000..c02af8f2f3 --- /dev/null +++ b/.lintr @@ -0,0 +1,2 @@ +linters: lucode2::lintrRules() +encoding: "UTF-8" diff --git a/.snapshot.Rprofile b/.snapshot.Rprofile new file mode 100644 index 0000000000..cb4dc70c79 --- /dev/null +++ b/.snapshot.Rprofile @@ -0,0 +1,23 @@ +# source global .Rprofile (very important to load user specific settings) +# DO NOT EDIT THIS LINE! +if(file.exists("~/.Rprofile")) source("~/.Rprofile") + + +# This profile can be used to link the model to a specified library snapshot +# (e.g. if your model version is from an older date and does not work with the +# newest libraries anymore). +# By default it is not active. Just uncomment the following lines and set the +# snapshot path to a path of your choice. +# Please make also sure that in your config file this .Rprofile file is copied +# to the model output folder. Otherwise, the run itself will again use the +# default library set! + +# PLEASE NOTE: snapshots ending with '_R4' require R 4.1 (piam/1.24 and newer), +# other snapshots require R 3.6 (piam/1.20) +# snapshot <- "/p/projects/rd3mod/R/libraries/snapshots/2022_10_28_R4" +# if(file.exists(snapshot)) { +# cat("Setting libPaths to",snapshot,"\n") +# .libPaths(snapshot, include.site = FALSE) +# } else { +# cat("Could not find",snapshot,"\n") +# } diff --git a/.zenodo.json b/.zenodo.json index a3cc08b380..d33ef2c3d7 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,6 +1,6 @@ { "title": "MAgPIE - An Open Source land-use modeling framework", - "version": "4.3.4", + "version": "4.6.7", "creators": [ { "name": "Dietrich, Jan Philipp", @@ -65,10 +65,18 @@ "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" }, + { + "name": "Singh, Vartika", + "affiliation": "Potsdam Institute for Climate Impact Research" + }, { "name": "Ambrósio, Geanderson", "affiliation": "Potsdam Institute for Climate Impact Research" @@ -81,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", @@ -96,5 +109,5 @@ "license": { "id": "AGPL-3.0-or-later" }, - "publication_date": "2021-04-30" + "publication_date": "2023-05-10" } diff --git a/CHANGELOG.md b/CHANGELOG.md index ccd993bec9..4777e041ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,28 +2,502 @@ # Changelog All notable changes to this project will be documented in this file. -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). +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). + + +## [4.6.7] - 2023-05-10 + +### changed +- **09_drivers** Harmonization of sets for population, gdp, pal and demography +- **56_ghg_policy** added emission policies without GHG emissions from peatlands +- **config** added scenario `SSP2EU` in scenario_config.csv +- **config** modified `eat_lancet_diet` in scenario_config.csv +- **config** update of additional data to rev4.43 +- **config** update of regional and cellular inputs to 4.85 in default.cfg and scenario_config.csv +- **scripts** added output script for forest area change at cluster level +- **scripts** NDC/NPI calculations can now handle 59k and 67k cell inputs + +### added +- **15_food** added an option in `s15_exo_diet` to allow for exogenous diet scenario for India + + +## [4.6.6] - 2023-05-10 + +### changed +- **config** updated scenario_fsec.csv to reflect new GST validation +- **scripts** included new output indicator for water +- **scripts** updated global surface temperature maps to new RCPs per scenario + + +## [4.6.5] - 2023-03-29 + +### changed +- **22_land_conservation** Replaced old options for land conservation by new conservation priority areas. These include among others a new 30by30 template (based on Key Biodiversity Areas, unprotected habitat in Biodiversity Hotspots, Ecoregions with a high beta-diversity from the Global Safety Net (Dinerstein et al. 2020) and critical connectivity areas (Brennan et al. 2022), a new Half Earth template based on the Global Safety Net (Dinerstein et al. 2020) and land conservation of irrecoverable carbon (Noon et al. 2022). +- **56_ghg_policy** renamed `cfg$mute_ghgprices_until` to `cfg$gms$c56_mute_ghgprices_until` and changed the default to `y2030`, i.e. no GHG emission pricing in the AFOLU sector before (and including) 2030. This setting will be also used in coupled REMIND-MAgPIE runs. +- **config** input data revision to rev4.82 to include new conservation priority areas +- **config** new options for conservation priority areas (including new 30 by 30 protection) +- **scripts** calc_calib.R bug fix. If the calibration factor of a region is equal to the maximum allowed value, its divergence is set the maximum allowed divergence. +- **scripts** Disaggregation of BII merged into standard extra/disaggregation.R +- **scripts** Disaggregation of land use to 0.5° now takes land conservation into account - i.e. cropland expansion is not mapped to areas that are subject to land conservation + +### added +- **56_ghg_policy** added switch `s56_minimum_cprice` +- **config** minimum CO2 price (`s56_minimum_cprice`) of 5 USD per tCO2 (18 USD per tC) for all future time steps in case of NDC policy to guide land-use decisions +- **scripts** added output script which writes landuse data on cluster resolution to a shapefile + +### removed +- **56_ghg_policy** removed `s56_ghgprice_phase_in` and `s56_ghgprice_start` +- **scripts** removed argument `mute_ghgprices_until`, now handeld in GAMS code + +### fixed +- **31_past** fixed pasture suitability to SSP2 before and including 2020 (only relevant for grassland implementation) +- **56_ghg_policy** the renamed switch `c56_mute_ghgprices_until` is now always used for coupled as well as standalone runs. +- **scripts** Fixed occasional memory failure in the disaggregation script + + +## [4.6.4] - 2023-02-22 + +### changed +- **15_food** Interpret EAT-Lancet guidelines not as target but as lower/upper limits +- **config** changed order of output scripts. Some functions in rds_report require gridded outputs. +- **config** input data revision to rev4.81 for trade margin bugfix +- **config** scenario_fsec.csv updated input data tgz +- **config** scenario_fsec.csv updated to new biodiversity scenario +- **scripts** fsec.R and project_FSEC_Scenarios.R include capitalSubst and landscapeElements scenarios +- **scripts** highres.R changed default resolution to c1000 +- **scripts** recalibrate.R and recalibrate_realization were modified to always use best_calib for the yield calibration. +- **scripts** updated FSEC scenario start and output scripts +- **scripts** when manually running output scripts for multiple runs the lockfile is only created once +- **sticky_labor** changed labor cost share constraint from regional to cellular level +- **sticky_labor** renamed equation `q38_labor_capital_ratio` to `q38_labor_share_target` + +### added +- **15_food** half_overweight scenario added +- **21_trade** New Bilateral trade realization selfsuff_reduced_bilat22 for bilateral trade within selffsuff constraints +- **32_forestry** added switch `s32_aff_prot` for protection of afforested areas (0=until end of planning horizon 1=forever) +- **56_ghg_policy** added two scenarios for GHG emission pricing and options for afforestation +- **config** added options for afforestation assumptions and updated additional data to 4.38 +- **config** added setting cfg$keep_restarts which controls whether restart files should be kept after a run finished +- **config** changed default for `s_use_gdx` from 2 to 0 +- **scripts** added restart points after each time step from which the model can now be restarted if the simulation aborts at some point +- **scripts** added SLURM dayMax submission type for standby QOS +- **sticky_labor** `nl_fix`, `nl_relax` and `nl_release` added + +### removed +- **42_water_demand** removed fm_multicropping factor because of fallow inconsistency + +### fixed +- **14_yields** nl_fix updated to current equation +- **32_forestry** pm_land_conservation(t,j,"secdforest","restore") now accounts for the rotation length in timber plantations to avoid infeasibilities +- **44_biodiversity** added regional layer `i` in `bii_target` realisation to make it compatible with the high-resolution parallel optimization output script +- **59_som** division by zero prevented by if condition +- **scripts** fixed a bug where renvs for high resolution runs were missing some packages +- **scripts** fixed in the calc_calib.R script the saving of calib_factors used in each iteration to ensure that they correspond to the divergence reported. Changed divergence from zero to NA for those iterations where calib_factors are above the limit. The best_calib selection criterion was changed from selecting the factors of the iteration with the lowest standard deviation to the selection, for each region, of the factor of the iteration with the lowest divergence. Also, factors from the first iteration are now not considered, and if two different factors had the same divergence for a region, the one of the latest iteration is picked. + + +## [4.6.3] - 2023-01-19 + +### changed +- **15_food** changed `anthro_iso_jun22` realisation such that results in case of `exo_diet = 1/0` and `exo_waste = 1/0` are identical until 2020 +- **30_crop** identical assumptions for bioenergy until 2020 +- **38_factor_costs** changed name of set `req` to `factors` (also used in 11_costs, 57_maccs, 70_livestock) +- **38_factos_costs** sticky_labor realization: included option to set a labor share target +- **62_material** Bioplastic demand identical in all scenarios until 2020 +- **config** added `s38_target_labor_share`, `s38_targetyear_labor_share` and `s38_target_fulfillment` to define labor share target scnarios +- **config** and **38_factor_costs** changed name of `s38_fix_capital_need` to `s38_startyear_labor_substitution` +- **config** update input data to rev4.79 + +### added +- **31_past** added additional limitation (single climate scenario input) for **grasslands_apr22** +- **59_som** added new **cellpool_jan23** realization with updated 2019 IPCC guidelines values +- **scripts** added start script which starts an empty model just regenerating a previous run + +### fixed +- **scripts** make sure that `c_title` in the GAMS code is not containing dots which otherwise could lead to compilation errors + + +## [4.6.2] - 2023-01-12 + +### changed +- **36_employment** include labor costs from MACCs in employment +- **38_factor_cots** renamed `p36_cost_shares` to `pm_cost_share_crops` +- **57_maccs** split costs into labor and capital +- **config** scenario_fsec.csv update +- **config** updated SHAPE SDP scenarios in scenario_config.csv +- **scripts** FSDP_collect FSDP_process fsec.R updates + +### added +- **renv** MAgPIE now runs in an isolated, stable, reproducible R package environment +- **scripts** added output script that generates a short mif containing only variables relevant for the REMIND coupling +- **scripts** added output script that generates subnational validation outputs for fable_India projects +- **setup** required R packages are automatically installed + + +## [4.6.1] - 2022-12-13 + +### changed +- **42_water_demand** replaced `f42_env_flow_policy` with macro +- **30_crop** replaced `f30_scenario_fader` with macro +- **30_crop/config** changed switch `c30_rotation_scenario_speed` to `s30_rotation_scenario_target` +- **30_crop/config** changed switch `c30_snv_target` to `s30_snv_scenario_target` +- **config** changed default value for `c30_marginal_land` from `'all_marginal'` to `'q33_marginal'` for better spatial cropland patterns + +### added +- **10_land** added `vm_lu_transitions` as interface +- **10_land** added interface `fm_land_iso` for consistency +- **30_crop/config** added switch `s30_rotation_scenario_start` +- **30_crop/config** added switch `s30_snv_scenario_start` +- **30_crop/config** added switch for set `land_snv`for defining which land cover types are allowed in the semi-natural vegetation policy in cropland scenarios +- **39_landconversion** scalar `s39_reward_crop_reduction` provides a cropland reduction reward + +### removed +- **10_land** removed `feb15` realization +- **10_land** removed the interfaces `vm_croplandexpansion` and `vm_croplandreduction` +- **30_crop** removed `f30_scenario_fader.csv`input +- **39_landconversion** removed `s39_reward_shr` +- **config** validation_short.R output script is no longer run by default after each run +- **scripts** removed remind2::deletePlus in coupling interface of start_function + +### fixed +- **59_som** fixed land use change tracking for non-cropland pools in the `cellpool_aug16` realization +- **config** changed default value for s56_limit_ch4_n2o_price from 1000 to 4000 for consistency with c57_macc_version = "PBL_2022" +- **scripts** rewrite of land conversion cost calibration script `landconversion_cost.R` + + +## [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 +- **09_drivers** separation of GDP and population scenarios +- **09_drivers** changed `i09_gdp_pc_mer_iso` to `im_gdp_pc_mer_iso` +- **11_costs** Split of production costs per sector, addded new separated costs to the costs function. +- **13_tc** changed vm_tech_cost upper bound to share of regional GDP PPP (s13_max_gdp_shr) +- **13_tc** Replace endo_jan18 realization by endo_jan22. The new realization adds a new dimension to vm_tau separating crop from managed pastures tau. +- **15_food** added more options to define convergence towards exogenous food intake and waste scenarios accounting for different transition periods +- **18_residues** The variable that include production costs vm_cost_prod for residues changed to a new independent variable called vm_cost_prod_kres +(specific to residues). +- **30_crop** renamed switch `s30_set_aside_shr`, `s30_set_aside_shr_noselect` and `c30_set_aside_target` to `s30_snv_shr`, `s30_snv_shr_noselect` and `c30_snv_target`. +- **31_past** The variable that include production costs vm_cost_prod for pasture changed to a new independent variable called vm_cost_prod_past +(specific to past). +- **31_past** added new realization implementing the separation of rangelands and managed pastures for the production of grass biomass. +- **32_forestry** simplification and bugfix of afforestation limit. `c32_max_aff_area_glo` renamed to `s32_max_aff_area_glo` in default.cfg. +- **34_urban** added set urban_scen34 and the switch c34_urban_scenario +- **35_natveg** corrected naming of Frontier Forests (FF) to Intact Forest Landscapes (IFL) and changed input data for BH_IFL implementation. +- **35_natveg** implementation of land protection moved to new module `22_land_conservation` +- **38_factor_costs** Sticky free/dynamic switch was removed and the realization was split into two realizations: the new per_ton_fao_may22 (free) and sticky_feb18 (dynamic). vm_cost_prod(i,kall) is now vm_cost_prod_crop(i,req) for crops factor costs. The results are now given differentiating between capital and labor for all realizations (new set req). +- **42_water_demand** Added new input data on pumping costs for India, equation to calculate water costs and scalars for policy shocks +- **44_biodiversity** Improved documentation, simplification of equations and flexible options for price on biodiversity loss +- **56_ghg_policy** additional scenarios for c56_emis_policy +- **56_ghg_policy** Deactivated GHG emission policies were not accounted for in the MACCs module. This has been corrected by an extension of the interface `im_pollutant_prices`, which now has an additional dimension for emission sources `emis_source`. In this context some equations in `56_ghg_policy` have been simplified (sets: `emis_source_reg`, `emis_source_cell`). Also, GHG emissions from peatlands have been fully integrated into `56_ghg_policy`. +- **70_livestock** vm_cost_prod(i,kall) is now vm_cost_prod_livst(i,req) for livestock factor costs (req indicates differentiation between capital and labor) and vm_cost_prod_fish(i) for fish. +- **80_optimization** Updated solver settings +- **config** Update of regional and grid inputs from 4.68 to rev4.69, and additional files to 4.17. Removed free/dynamic sticky switch, and added scalars used in mixed_regional factor costs realization. +- **config** added s13_max_gdp_shr setting for tech cost upper bound as share of GDP PPP +- **config** included switch for non-agricultural water demand (s42_watdem_nonagr_scenario) in scenario_config.csv +- **config** included SHAPE SDP scenarios in scenario_config.csv +- **config** Update default tau realization from endo_jan18 to endo_jan22 +- **config** Added new SSP scenario switch for pasture suitability cfg$gms$c31_past_suit_scen +- **config** Added new switch to limiting calibration to relative or absolute managed pastures yields: cfg$gms$s31_limit_calib. +- **inputs** updated non-agricultural water use scenarios (watdem_nonagr_grper.cs3) +- **modules** Moved interface `vm_carbon_stock` from 52_carbon to 56_ghg_policy +- **scripts** replaced redundant files config.log and config.Rdata with a config.yml +- **scripts** updated FSEC modeling start script and added FSEC calibration scripts +- **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 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 projects/paper_grassland.R +- **scripts** scripts/output/extra/emulator.R Remove dependency on deprecated R package "magpie" + +### added +- **core** macros for linear and sigmoidal time interpolation +- **22_land_conservation** added new module and realisation for land conservation. The realisation also includes a new WDPA initialisation data set (from 1995 to 2020) for protected areas under legal protection, meeting IUCN and CBD protected area definitions. The module also adds the interface `pm_land_conservation`. +- **30_crop** new module realizations including crop rotation scenarios by strict constraints (`rotation_apr22`) and by penalties (`penalty_apr22`) +- **36_employment** added new module to calculate agricultural employment. Includes one realization (`exo_may22`) in which employment is calculated based on the total labor costs (for crop and livestock production) +- **38_factor_costs** mixed_reg_feb17 realization added. This realization includes differences in productions costs between irrigated and rainfed crops, with the option of regional differentiation as well. per_ton_fao_may22 realization added. This realization corresponds to the old sticky_feb18 free. +- **38_factor_costs** added switch `c38_fac_req` to choose between global and regional crop factor requirements. The default is "glo" (which corresponds to the previous implementation) +- **44_biodiversity** added new realization `bii_target`, which calculates the BII at the level of 71 biomes and allows to set targets for BII (e.g. no decrease in the future) +- **52_carbon** added land carbon sink adjustment factors, needed in R post-processing +- **70_livestock** added switch `c70_fac_req_regr` to choose between global and regionally calibrated regression to calculate livestock factor requirements. The default is "glo" (which corresponds to the previous implementation) +- **config** added option for CO2 emission pricing `cfg$gms$c56_carbon_stock_pricing` +- **config** added cfg$gms$s70_past_mngmnt_factor_fix with default 2005 (previous default was 2010). The previous setting caused a strong spike in CO2 emissions from pasture expansion in SSA. With 2005, this can be avoided. +- **inputs** New input files added: + f13_pastr_tau_hist.csv -> historical tau for managed pastures. + f31_pastr_suitability.cs3 -> Managed pasture suitability + f31_LUH2v2.cs3 -> LUH2v2 land classes separating rangelands from managed pastures + f31_grassl_yld.cs3 -> Rangelands and managed pastures grass yields + f31_grass_bio_hist.cs3 -> Historical grass biomass demand +- **modules** New dimension in `vm_carbon_stock` for different carbon stock types (actual, previousLandPattern, previousCarbonDensity) +- **scripts** output/projects/FSEC_StevenLord.R to create output for Steven Lord in the FSEC context +- **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** 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 + +### removed +- **38_factor_costs** mixed_feb17 and fixed_per_ton_mar18 realizations removed because they are not being used at the moment. + +### fixed +- **09_drivers** bugfix concerning the use of the switch c09_gdp_scenario for defining population assumptions +- **09_drivers** introduced new sets for PAL and demography scenarios to account for only partial coverage of available socio-economic gdp and population scenarios +- **18_residues** off realization; missing variable declarations +- **34_urban** exo_nov21 realization; bugfix in calculation of biodiversity value +- **41_area_equipped_for_irrigation** static realization. bugfix in presolve.gms: f41_irrig_luh("y1995",j) +- **44_biodiversity** fixed accounting for time step length in realization `bv_btc_mar21` +- **50_nr_soil_budget** off realization; missing variable declarations +- **56_ghg_policy** Some equations in `56_ghg_policy` have been simplified. Also, GHG emissions from peatlands have been fully integrated into `56_ghg_policy`. +- **56_ghg_policy and config** removed switch `s56_reward_neg_emis` +- **59_som** static realization; avoid division by zero +- **62_material** exo_flexreg_apr16 realization; avoid division by zero +- **80_optimization** nlp_par realization; bugfix i2 in submission loop +- **inputs** included data for Sudan +- **scripts** calibration; set NA values to 1 +- **scripts** fixed misleading warning in check_config +- **scripts** fixed configuration error in FSEC output scripts, FSEC_dietaryIndicators.R and FSEC_environmentalPollutants.R +- **scripts** scripts/start/extra/emulator.R Throw an error if no file can be found to take the GHG prices from + + +## [4.4.0] - 2021-12-13 + +### changed +- **additional_data** NDCs for Chinas afforestation now start earlier (1995) in line with observed afforestation. +- **config** comments added for correct use of nitrogen switches +- **inputs** new default LPJmL version with growing season adaptation (gsadapt) on +- **51_nitrogen** parameter change in rescaled_jan21, now including regionalized climate-dependent leaching factors +- **config** Update default configuration to new input data (especially cellular inputs) including all module realization updates (14_yield, 22_processing, 30_crop, 38_factor_costs, 39_landconversion). Moreover, climate impatcs (cc options for biophysical inputs) are activiated as default. New best_calib calibration routine is activated as default. +- **config** peatland module on by default (cfg$gms$peatland <- "on") +- **config** update default setting for 2nd generation bioenergy demand and GHG prices +- **config** update default setting for the 42_water_demand module (to all_sectors_aug13) +- **scripts** output/extra/disaggregation.R updated to account for country-specific set-aside shares in post-processing +- **scripts** output/extra/disaggregation.R updated to account for sub-categories of "forestry" +- **scripts** Default recalibration routine does not read in previous calibration factors anymore +- **09_drivers** Update sets in drivers to include new SDP and Ariadne GDP and Pop scenarios +- **21_trade** In the exo and off realization, equations corrected to be consistent with the mapping between supreg h and regions i. Bugfixes in trade exo and off realizations. Added scaling factor for exo realization. +- **inputs** Update of GDP and population scenarios based upon recent historic data from WDI (complemented with growth rates given by the James2019 dataset), short term projections until 2025 from IMF (for GDPpc) and WB (for pop) and reconverge to the original SSP GDPpc levels by 2100. +- **inputs** Update of all input data that are based on FAO, using the most up-to-date version of FAOSTAT datasets available at the date of input calculations via automated download. +- **inputs** Update of additional data to rev4.07 +- **scripts** scripts/start/projects/project_LAMACLIMA.R -> scripts/start/projects/project_LAMACLIMA_WP4.R +- **58_peatland** "On" realization: Degraded peatland is estimated differently, based on an additional calibration factor. +- **43_water_availability** changed scaling factor +- **10_land** Converted "v10_landreduction" to interface "vm_landreduction", used in "modules/39_landconversion/calib" +- **52_carbon** Removed interface "vm_carbon_stock_change", no longer needed +- **scripts** recalibrate_realizations.R and recalibrate.R adjusted for land conversion cost calibration + default time steps for convenient validation of results +- **scripts** start_functions adjustments for land conversion cost calibration +- **scripts** start.R added SLURM medium as choice +- **scripts** yield calibration, "best" setting uses factors from iteration with lowest standard deviation +- **14_yield** read-in file f14_yld_calib.csv if exists. Set default calibration factors to 1 in case f14_yld_calib.csv does not exist +- **13_tc** different educated guess for vm_tau in 1995 +- **scaling** Update of scaling factors. removed duplicates +- **32_foresty** Avoid division by zero (observed under higher regional resolutions) +- **35_natveg** Avoid division by zero (observed under higher regional resolutions) +- **70_livestock** Avoid division by zero (observed under higher regional resolutions) +- **60_bioenergy** Minimum dedicated 2nd generation bioenergy demand assumed in each region raised from 0.01 to 1 mio. GJ per yr, and added as option in the config file (s60_2ndgen_bioenergy_dem_min) +- **config** Remove elements from the parameter list of start_run(), instead include them as regular settings in the default.cfg. +- **scripts** Add option to take ghg prices from different file than the regular reporting file (used in the REMIND coupling) +- **60_bioenergy** Switch off fixing the bioenergy demand to SSP2 until 2020 if MAgPIE runs coupled (to REMIND) or for emulator runs (to derive biomass supply crurves). +- **56_ghg_policy** Switch off fixing the GHG prices to SSP2 until 2020 if MAgPIE runs coupled (to REMIND) or for emulator runs (to derive biomass supply crurves). +- **scripts** start/test_runs.R added SSP1, SSP2 and SSP5 as default test runs + +### added +- **34_urban** New exo_nov21 exogenous realization of urban land expansion +- **21_trade** Missing interface parameter for failing exo realization runs +- **59_som** exogenous pathway for vm_nr_som via f59_som_exogenous +- **config** Addition of a new scenario column (Tland) in scenario_config.csv +- **config** Added option c32_max_aff_area, which allows to provide a file with regional limits for afforestation +- **14_yield** parameter created to save historical cellular yields and to be used in the sticky realization of 38_factor_costs and in the 17_production module +- **17_production** switch added to decide if initialization of cellular crop production is needed or not. Also, a parameter to calculate initial production based on input cellular crop patterns and semicalibrated yields (potential yields calibrated to FAO values). +- **scripts** Added calibration script to generate default calibration for different factor costs realization +- **scripts** scripts/output/extra/disaggregation_LUH2.R script for exporting spatial output in LUH2 format (NetCDF) +- **37_labor_prod** labor productivity module with two realizations: off and exo +- **38_factor_costs** new realization "sticky_labor", based on "sticky_feb18" but accounting for changes in labor productivity +- **15_food** Added additional solve with CONOPT3 in case of modelstat 7 +- **scripts** Added script "landconversion_cost.R" for land conversion cost calibration in scripts/calibration, for matching historic cropland in 2015 +- **39_landconversion_cost** added new realization "calib", which uses the calibration factors derived by "landconversion_cost.R" +- **scripts** Added start script for yield and land conversion cost calibration "recalibrate_all.R" +- **scripts** added script validation_short.R with aggregated crop types (cutting the PDF size in half) -> replaces validation.R in default.cfg +- **scripts** added start script "scripts/start/Rprofile.R" for adding a R snapshot to the ".Rprofile" file +- **config** file "land_carbon_sink_adjust_grassi.mz" added to cfg$files2export$start +- **config** Inclusion of LAMACLIMA scenarios in scenario_config.csv +- **output.R** added SLURM standby maxMem and SLURM priority maxMem; needed for some output scripts (e.g. disaggregation_LUH2.R) + +### removed +- **32_foresty** Removed static realization +- **35_natveg** Removed static realization +- **scripts** lpjml_addon script is removed and all calls within dependend starting scripts +- **scripts** output/extra/disaggregation_transitions_.R moved to deprecated folder +- **scripts** output/extra/disaggregation_cropsplit.R moved to deprecated folder +- **14_yield** Removed `biocorrect` and `dynamic_aug18` realizations +- **20_processing** Removed `substitution_dec18` realization +- **30_crop** Removed `endo_jun13` realization +- **scripts** scripts/start/extra/highres.R +- **39_landconversion_cost** removed realizations "global_static_aug18" and "devstate" + +### fixed +- **80_optimization** Improved solve logic in "nlp_apr17" and "nlp_par" realization, multiple bugfixes and switch to solvelink=3 in "nlp_par" +- **58_peatland** fixed rare infeasibility in "on" realization +- **10_land** fixed rare infeasibility in "landmatrix_dec18" realization +- **38_factor_costs** For the sticky_feb18 realization correction in initial capital stocks, use of production initial values, and 05USDppp units changed to 05USDMER for sticky so it matches the units of the other realizations +- **80_optimization** Bug fixes in the nlp_par (parallel optimization) and improved code to collect failing handles. +- **32_foresty** Avoid division by zero in q32_establishment_dynamic_yield +- **35_natveg** fixed land protection to SSP2 default (WDPA) for historic period +- **15_food** New iteration needs to be started before setting food prices for curr_iter15 +- **scripts** scripts/output/extra/highres.R bugfixes +- **38_factor_costs** units in sticky_feb18 +- **32_foresty** Global afforestation limit s32_max_aff_area was not effective in case of parallel optimization -> added option c32_max_aff_area, which allows to provide a file with regional limits for afforestation; +- **73_timber** plausible cost for balance variable in case of s73_timber_demand_switch = 0 to avoid cost distortion +- **56_ghg_policy** choose the correct scenario for fixing the GHG prices until sm_fix_SSP2 + + +## [4.3.5] - 2021-09-02 + +### changed +- **13_tc** added switch to ignore historic tau patterns in historic time steps (new default) +- **16_demand** Moved most of cropping related set definitions (k, kve, kcr) from **16_demand** to **14_yield** +- **32_foresty** Added option to choose a rotation length calculation criteria +- **35_natveg** Calculation of land protection policies revised and moved from presolve.gms to preloop.gms +- **38_factor_costs** Realization `sticky_feb18` extended to differentiate capital requirements between regions and their specific development status (GDP) in each time step of the magpie run. The changes in the `sticky` realization also include an additional switch so it can be operated as `dynamic` (change of each region capital share at each time step) or `free` (capital shares equal to zero and equivalent to the `fixed_per_ton_mar18` realization). Bugfix in the yearly update of the variable input requirements. Addition of the time dimension and clean up of names of parameters used in the realization. Removal of the management factor (this factor was not being used, it was being cancelled out in previous calculations). Correction of the costs, they are given in 05USDppp. +- **39_landconversion** lower costs for expansion of forestry land +- **58_peatland** Peatland area is initialized in 1995 based on levels for the year 2015, and hold fixed depending on `s58_fix_peatland`. This provides a better proxy for peatland area and associated GHG emissions for the historic period, which where assumed zero in previous versions. +- **80_optimization** **nlp_par** parallelizes now on superregional level `h` instead of regional level `i` as before. +- **script** Added forestry run script which used LPJmL addon +- **script** New standard for cluster to region mapping (rds-files) is used in all scripts. If old spam files are provided by input data, rds-mapping file is created. +- **script** updated test run script. Update of the sticky run script. +- **start scripts** improved function for GAMS set creation from R and outsourced it to package `gms` +- **inputs** Changed file format from cs2 to cs2b for cellular input files with a single data column +- **scenario_config** added RCPs as columns for use with setSceanrio function. This required the addition of "gms$" in the 1st column. + + +### added +- **73_timber** Added construction wood demand scenarios based on Churkina et al. 2020 +- **script(s)** Added scripts to replicate runs for Mishra et al. 2021 (in review : https://doi.org/10.5194/gmd-2021-76) +- **13_tc** Added new interfaces for tau factor of the previous time step (`pcm_tau`) +- **14_yield** Added new realization `managementcalib_aug19` that is able to calibrate yield data coming from uncalibrated crop models (e.g. LPJmL yields for unlimited N supply). The yield calibration is either a purely multipicative factor or is limited to additive change in case of a underestimated FAO yield by the initial crop model yields (based on the switch `s14_limit_calib`). For pastures spillover of crop yield increases due to technological change from the previous time step are allowed and can be scaled using `s14_yld_past_switch`. +- **20_processing** Added new almost identical realization that excludes a calibration of the oil crop demand for oils (Note: old realization can be removed, when old yield realizations are deleted). +- **30_crop** Added new realization `endo_apr21`. The realisation includes new input data for available cropland and a new switch `c30_marginal_land`, which provides different options for including marginal land as cropland. Furthermore, a given share of the available cropland can be set aside for the provisioning of natures contribution to people and to promote biodiversity. The new switches `s30_set_aside_shr` and `c30_set_aside_target` are included to specify the share that should be set aside and the target year. +- **30_crop** Added new interface parameter historic croparea (`fm_croparea`) +- **30_crop** Added new option `policy_countries30` for country specific set aside share +- **35_natveg** Added new option `"FF+BH"` for protected areas. +- **35_natveg** Added new option `policy_countries35` for country specific land protection +- **38_factor_costs** Added scaling factors for improving model run time +- **39_landconversion** new realization `devstate` in which global land conversion costs are scaled with regional development state (0-1) +- **41_area_equipped_for_irrigation** Added switch for using different input data including new LUH2v2 consistent initialisation pattern. +- **41_area_equipped_for_irrigation** Added scalar for depreciation rate that depreciates certain area in every timestep, defined by switch in config. +- **58_peatland** Added option for one-time and recurring costs of peatland degradation (USD05MER per ha) +- **calibration run** has two new features: 1. Upper bound to cropland factor can be added (`crop_calib_max`). 2. Best calibration factor (factor with the lowest divergence) can be picked individually for each regions based on all calibration factors calculated during the calibration run iteration (`best_calib`). +- **disaggregation** Added new disaggregation script that is in line with new crop realisation and can account for cropland availabilty on grid level during disaggregation (see `interpolateAvlCroplandWeighted()` in package `luscale` for further details). +- **sets** added superregional layer `h` as additional spatial layer and moved constraints in **13_tc** and **21_trade** partly to the superregional level. + +### removed +- **13_tc** Removed disfuctional setting c13_tccost = "mixed" +- **core** removed sets ac_young and ac_mature (no longer needed due to changes in 44_biodiversity) + +### fixed +- **32_foresty** BII coefficients for CO2 price driven afforestation +- **32_foresty** growth curve CO2 price driven afforestation +- **32_foresty** NPI/NDC afforestation infeasibility +- **32_foresty** Correct distribution from LUH data to plantations and ndcs +- **35_natveg** option to fade out damage from shifting agriculture by 2030 +- **44_biodiversity** ac0 included in pricing of biodiversity loss + ## [4.3.4] - 2021-04-30 ### changed - **51_nitrogen** New calculations for emissions from agricultural residues (vm_res_ag_burn) +- **53_methane** New calculations for emissions from agricultural residues (vm_res_ag_burn) - **citation file** added new contributors ### added - **config** The set "kfo_rd" (livst_rum, livst_milk), which is used in the food substitution scenarios c15_rumdairy_scp_scen and c15_rumdairyscen, has been added to the default.cfg file. This allows for sensitivity scenarios (e.g. only livst_milk or only livst_rum). +- A new scenario (nocc_hist) was added to the cc/nocc switch. In this scenario, parameters affected by the cc/nocc switch in **14_yields**,**42_water_demand**,**43_water_availability**,**52_carbon**,**59_som** keep their historical/variable values up to the year defined by sm_fix_cc. Afterwards, sm_fix_cc values are kept constant for the overall run horizon. ### fixed +- **09_drivers** migration of sm_fix_SSP2 and sm_fix_cc declaration from the core declarations to the drivers module. This will allow to set the scalars properly . +- - **15_food** single-cell protein substitution scenarios included in intersolve.gms. - **20_processing** The "mixed" scenario for single-cell protein production (c20_scp_type) was not working as expected. The corresponding code in 20_processing has been updated. -- **15_food** single-cell protein substitution scenarios included in intersolve.gms. ## [4.3.3] - 2021-03-30 ### added -- **44_biodiversity** New biodiversity module. The realization bv_btc_mar21 now allows to calculate an area-based biodiversity value across all land types. Switch `c44_price_bv_loss` to implement cost for biodiversity loss. - **15_food*** added 3 sigmoid food substitution scenarios +- **44_biodiversity** New biodiversity module. The realization bv_btc_mar21 now allows to calculate an area-based biodiversity value across all land types. Switch `c44_price_bv_loss` to implement cost for biodiversity loss. - **56_ghg_policy** Automatic sets for scenarios - **60_bioenergy** Automatic sets for scenarios - **70_livestock*** added 3 sigmoid feed substitution scenarios @@ -78,6 +552,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **32_forestry** Bugfixes for "ac_est" and carbon treshold afforestation; removed plantations from "vm_cdr_aff". - **core** bugfix m_fillmissingyears macro; was running over t before; now running over t_all_ + ## [4.3.1] - 2020-11-03 ### added @@ -88,6 +563,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **52_carbon** Bugfix "p52_scaling_factor" for climate change runs - **73_timber** New scenario switch `c73_wood_scen`. + ## [4.3.0] - 2020-09-15 ### added @@ -115,6 +591,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **35_natveg** Clearer calculations for harvested area for timber production. - **52_carbon** Fix to the Carbon densities received from LPJmL for timber plantations. + ## [4.2.1] - 2020-05-15 ### added @@ -132,7 +609,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **NPI/NDC policy calculations** revision of calculation method - ## [4.2.0] - 2020-04-15 This release version is focussed on consistency between the MAgPIE setup and the [REMIND model] and result of a validation exercise of the coupled (REMIND 2.1)-(MAgPIE 4.2) system. @@ -213,6 +689,7 @@ This release version is focussed on consistency between the MAgPIE setup and the - **71_diagg_lvst** adjusted monogastric disaggregation for more flexiblity to avoid infeasibilities with EFPs (see 42_water_demand) - **15_food** correction regarding the convergence measure of the iterative execution of the food demand model and MAgPIE; correction accounting for unusual time step length in body height calculations; body height regression parameters updated + ## [4.0.1] - 2018-10-05 ### fixed @@ -224,7 +701,18 @@ 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.3.4...develop +[Unreleased]: https://github.com/magpiemodel/magpie/compare/v4.6.7...develop +[4.6.7]: https://github.com/magpiemodel/magpie/compare/v4.6.6...v4.6.7 +[4.6.6]: https://github.com/magpiemodel/magpie/compare/v4.6.5...v4.6.6 +[4.6.5]: https://github.com/magpiemodel/magpie/compare/v4.6.4...v4.6.5 +[4.6.4]: https://github.com/magpiemodel/magpie/compare/v4.6.3...v4.6.4 +[4.6.3]: https://github.com/magpiemodel/magpie/compare/v4.6.2...v4.6.3 +[4.6.2]: https://github.com/magpiemodel/magpie/compare/v4.6.1...v4.6.2 +[4.6.1]: https://github.com/magpiemodel/magpie/compare/v4.6.0...v4.6.1 +[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 [4.3.4]: https://github.com/magpiemodel/magpie/compare/v4.3.3...v4.3.4 [4.3.3]: https://github.com/magpiemodel/magpie/compare/v4.3.2...v4.3.3 [4.3.2]: https://github.com/magpiemodel/magpie/compare/v4.3.1...v4.3.2 diff --git a/CITATION.cff b/CITATION.cff index 12dc83da8a..d298f0f5df 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -77,11 +77,21 @@ 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" email: dklein@pik-potsdam.de + - family-names: Singh + given-names: Vartika + affiliation: "Potsdam Institute for Climate Impact Research" + email: vasingh@pik-potsdam.de + - family-names: Ambrósio given-names: Geanderson affiliation: "Potsdam Institute for Climate Impact Research" @@ -96,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 @@ -109,8 +125,8 @@ authors: email: popp@pik-potsdam.de title: MAgPIE - An Open Source land-use modeling framework -version: 4.3.4 -date-released: 2021-04-30 +version: 4.6.7 +date-released: 2023-05-10 repository-code: https://github.com/magpiemodel/magpie keywords: - landuse diff --git a/DESCRIPTION b/DESCRIPTION new file mode 100644 index 0000000000..ffe0b1d813 --- /dev/null +++ b/DESCRIPTION @@ -0,0 +1,43 @@ +Package: magpiemodel +Description: Refer to README.md for a description of the MAgPIE model. + This file only lists dependencies and is called DESCRIPTION for + technical reasons. +Imports: + callr, + citation, + curl, + data.table, + dplyr, + gdx, + gdxrrw, + ggplot2, + ggrepel, + gms (>= 0.24.0), + here, + iamc, + lucode2 (>= 0.36.0), + luplot, + luscale, + lusweave, + m4fsdp, + madrat, + magclass, + magpie4, + MagpieNCGains, + magpiesets, + mip, + mrcommons, + patchwork, + piamenv (>= 0.3.4), + quitte, + raster, + remulator, + renv, + stringr, + txtplot, + withr +Suggests: + goxygen, + languageserver, + qgraph +Encoding: UTF-8 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/Makefile b/Makefile new file mode 100644 index 0000000000..3a844b1205 --- /dev/null +++ b/Makefile @@ -0,0 +1,46 @@ +.PHONY: help docs update-renv update-renv-all archive-renv restore-renv check check-fix start output +.DEFAULT_GOAL := help + +# extracts the help text and formats it nicely +HELP_PARSING = 'm <- readLines("Makefile");\ + m <- grep("\#\#", m, value=TRUE);\ + command <- sub("^([^ ]*) *\#\#(.*)", "\\1", m);\ + help <- sub("^([^ ]*) *\#\#(.*)", "\\2", m);\ + cat(sprintf("%-18s%s", command, help), sep="\n")' + +help: ## Show this help. + @Rscript -e $(HELP_PARSING) + +docs: ## Generate/update model HTML documentation in the doc/ folder. + Rscript -e 'goxygen::goxygen(); warnings()' + @echo -e '\nOpen\ndoc/html/index.htm\nin your browser to view the generated documentation.' + +update-renv: ## Upgrade all pik-piam packages in your renv to the respective + ## latest release and write renv.lock to archive. + Rscript -e 'piamenv::updateRenv()' + +update-renv-all: ## Upgrade all packages (including CRAN packages) in your renv + ## to the respective latest release and write renv.lock to archive. + Rscript -e 'renv::update(exclude = "renv"); piamenv::archiveRenv()' + +archive-renv: ## Write renv.lock to archive. + Rscript -e 'piamenv::archiveRenv()' + +restore-renv: ## Restore renv to the state described in interactively + ## selected renv.lock from the archive or a run folder. + Rscript -e 'piamenv::restoreRenv()' + +check: ## Check if the GAMS code follows the coding etiquette + ## using gms::codeCheck. + Rscript -e 'invisible(gms::codeCheck(strict = TRUE))' + +check-fix: ## Check if the GAMS code follows the coding etiquette + ## and offer fixing any problems directly if possible + ## using gms::codeCheck. + Rscript -e 'invisible(gms::codeCheck(strict = TRUE, interactive = TRUE))' + +start: ## Start a MAgPIE run. + Rscript start.R + +output: ## Run an output script. + Rscript output.R diff --git a/README.md b/README.md index 5b6b7fa302..72cb867ea6 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.3.4 can be found at -https://rse.pik-potsdam.de/doc/magpie/4.3.4/ +The model documentation for version 4.6.7 can be found at +https://rse.pik-potsdam.de/doc/magpie/4.6.7/ A most recent version of the documentation can also be extracted from the model source code via the R package goxygen @@ -33,7 +33,7 @@ model source code via the R package goxygen package and run the main function (goxygen) in the main folder of the model. The resulting documentation can be found in the folder "doc". -Please find a set of tutorials here https://github.com/magpiemodel/tutorials. +Please find a set of tutorials here https://magpiemodel.github.io/tutorials/. This guide will give you a brief technical introduction in how to install, run and use the model and how to analyse the model output. @@ -43,7 +43,7 @@ The Coding Etiquette explains also the naming conventions and other structural characteristics. ## COPYRIGHT -Copyright 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +Copyright 2008-2022 Potsdam Institute for Climate Impact Research (PIK) ## LICENSE This program is free software: you can redistribute it and/or modify @@ -82,36 +82,11 @@ In addition *R* (https://www.r-project.org/) is required for pre- and postprocessing and run management (needs to be added to the PATH variable as well). -Some R packages are required to run MAgPIE. All are either distributed via -the offical R CRAN or via a separate repository hosted at -PIK (PIK-CRAN). Before proceeding PIK-CRAN should be added to the list of -available repositories via: -``` -options(repos = c(CRAN = "@CRAN@", pik = "https://rse.pik-potsdam.de/r/packages")) -``` - -Under Windows you need to install Rtools -(https://cran.r-project.org/bin/windows/Rtools/) and to add it to the PATH -variable. After that you can run the following lines of code: - -``` -pkgs <- c("gdxrrw", - "ggplot2", - "curl", - "gdx", - "gms", - "magclass", - "madrat", - "mip", - "lucode2", - "magpie4", - "magpiesets", - "lusweave", - "luscale", - "goxygen", - "luplot") -install.packages(pkgs) -``` +Several R packages are required to run MAgPIE. Under Windows you first need to install +Rtools (https://cran.r-project.org/bin/windows/Rtools/) and to add it to the PATH +variable. When running R from the MAgPIE folder for the first time all +required packages are automatically installed into an isolated, +project specific R package environment (renv). For post-processing model outputs *Latex* is required (https://www.latex-project.org/get/). To be seen by the model it also needs to added to the PATH variable of your system. @@ -213,7 +188,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.3.2/#howtocite) 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.7/#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 38bdb16b5d..75052a6582 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -22,12 +22,15 @@ cfg$model <- "main.gms" #def = "main.gms" #### input settings #### # which input data sets should be used? +cfg$input <- c(regional = "rev4.85_h12_magpie.tgz", + cellular = "rev4.85_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", + validation = "rev4.85_h12_validation.tgz", + additional = "additional_data_rev4.43.tgz", + calibration = "calibration_H12_per_ton_fao_may22_glo_23Mar23.tgz") -cfg$input <- c("isimip_rcp-IPSL_CM5A_LR-rcp2p6-co2_rev52_c200_690d3718e151be1b450b394c1064b1c5.tgz", - "rev4.58_h12_magpie.tgz", - "rev4.58_h12_validation.tgz", - "calibration_H12_c200_23Feb21.tgz", - "additional_data_rev4.00.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 @@ -45,6 +48,7 @@ cfg$repositories <- append(list("https://rse.pik-potsdam.de/data/magpie/public"= getOption("magpie_repos")) + # Should input data be downloaded from source even if cfg$input did not change? cfg$force_download <- FALSE @@ -61,17 +65,48 @@ cfg$recalibrate <- "ifneeded" # def = "ifneeded" cfg$calib_accuracy <- 0.05 # def = 0.05 # What is the maximum number of iterations if the precision goal is not reached? cfg$calib_maxiter <- 20 # def = 20 -# factor determining how much the new calibration factor influences the result -# (0-1) -cfg$damping_factor <- 0.98 # def= 0.98 +# Factor determining how much the divergence infuences the new +# calibration factor in each calibration iteration (0-1) +cfg$damping_factor <- 0.96 # def= 0.96 # switch on/of calibration of cropland (pasture will be left untouched) cfg$calib_cropland <- TRUE # def= TRUE - +# set upper limit for cropland calibration factor +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 divergence are used. +cfg$best_calib <- TRUE # def = TRUE + +# Settings for land conversion cost calibration (cropland) +# The calibration routine derives regional calibration factors for +# costs of cropland expansion and rewards for cropland reduction, +# with the goal to match historical regional cropland in 2015. +# * (TRUE): Land conversion cost calibration will be performed +# * (ifneeded): Land conversion cost calibration will only be executed if the input file "f39_calib.csv" is missing +# * (FALSE): Land conversion cost calibration will not be performed +cfg$recalibrate_landconversion_cost <- "ifneeded" #def "ifneeded" +# Up to which accuracy shall be recalibrated? +cfg$calib_accuracy_landconversion_cost <- 0.05 # def = 0.05 +# What is the maximum number of iterations if the precision goal is not reached? +cfg$calib_maxiter_landconversion_cost <- 40 # def = 40 +# Restart from existing calibration factors (TRUE or FALSE) +cfg$restart_landconversion_cost <- FALSE # def = FALSE +# Factor determining how much the divergence infuences the new +# calibration factor in each calibration iteration (0-1) +cfg$damping_factor_landconversion_cost <- 0.96 # def= 0.96 +# Set upper limit for cropland calibration factor +cfg$cost_calib_max_landconversion_cost <- 3 # def= 3 +# Set lower limit for cropland calibration factor +cfg$cost_calib_min_landconversion_cost <- 0.05 # def= 0.05 +# 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 divergence are used. +cfg$best_calib_landconversion_cost <- FALSE # def = FALSE # Settings for NPI/NDC recalculation # * (TRUE): NPI/NDC recalculation will be performed # * (ifneeded): NPI/NDC recalculation will only be executed if current input files are zero -# * and policy switches (p32_aff_pol, p35_ad_pol, p35_emis_pol) are set to "npi" or "ndc". +# * and policy switches (c32_aff_pol, c35_ad_pol) are set to "npi" or "ndc". # * If policy switches are set to "none" (default) NPI/NDC recalculation will not be performed # * (FALSE): NPI/NDC recalculation will not be performed cfg$recalc_npi_ndc <- "ifneeded" # def = ifneeded @@ -89,11 +124,8 @@ cfg$gms$c_timesteps <- "coup2100" # historic time steps cfg$gms$c_past <- "till_2010" -# Year until which all parameters are fixed to SSP2 values -cfg$gms$sm_fix_SSP2 <- 2020 - # use of gdx files -cfg$gms$s_use_gdx <- 2 # def = 2 +cfg$gms$s_use_gdx <- 0 # def = 0 #* 0: gdx will not be loaded #* 1: gdx is loaded in the first time step #* 2: gdx is loaded in all time steps @@ -105,44 +137,71 @@ cfg$gms$s_use_gdx <- 2 # def = 2 #### Useful shortcuts #### # Vector of all iso countries (used for regional policy implementations) all_iso_countries <- "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" + 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" + +# * Based on https://tntcat.iiasa.ac.at/SspDb/dsd?Action=htmlpage&page=10#regiondefs +oecd90andEU <- "ALB,AUS,AUT,BEL,BIH,BGR,CAN,CYP,CZE,DNK,EST,FIN,FRA, + DEU,GRC,HUN,HRV,ISL,IRL,ITA,JPN,LUX,LVA,LTU,MLT,MNE, + NLD,NOR,NZL,POL,PRT,ROU,SRB,SVK,SVN,ESP,SWE,CHE,MKD,TUR, + GBR,USA" # ***--------------------- 09_drivers ---------------------------------------- # * (aug17): default drivers cfg$gms$drivers <- "aug17" # def = aug17 cfg$gms$c09_pop_scenario <- "SSP2" # def = SSP2 cfg$gms$c09_gdp_scenario <- "SSP2" # def = SSP2 -# * options: SSP: "SSP1", "SSP2", "SSP3", "SSP4", "SSP5" -# * SRES: "A1", "A2", "B1", "B2" +# * options: SSP: "SSP1", "SSP2", "SSP2EU", "SSP3", "SSP4", "SSP5" +# * SDP: "SDP", "SDP_EI", "SDP_MC", "SDP_RC" +# * Note: SSP2EU a European Commission population/income scenario for +# * Ariadne project. SDP is same as SSP1 income, while SDP_EI, SDP_RC, SDP_MC +# * see different GDP trajectories as described in SHAPE project. + +# * Physical activity level scenario: +cfg$gms$c09_pal_scenario <- "SSP2" # def = SSP2 +# * options: SSP: "SSP1", "SSP2", "SSP2EU", "SSP3", "SSP4", "SSP5" +# * SDP: "SDP", "SDP_EI", "SDP_MC", "SDP_RC" + +# Year until which all parameters are fixed to SSP2 values +cfg$gms$sm_fix_SSP2 <- 2020 + +# Year until which all parameters affected by climate change are fixed to historical values +cfg$gms$sm_fix_cc <- 2020 # ***--------------------- 10_land ---------------------------------------- # * (feb15): default land realization # * (landmatrix_dec18): includes a land transition matrix cfg$gms$land <- "landmatrix_dec18" # def = landmatrix_dec18 +# * Artificial cost for balance variables (USD05MER per ha) +# * The balance variables in the land module avoid infeasibilities due to +# * differences in accuracy between parameters and variables in GAMS. +# * High costs make sure that the balance variables are only used as a last resort. +cfg$gms$s10_cost_balance <- 1000000 # def = 1000000 + + # ***--------------------- 11_costs ------ -------------------------------- # * (default): default cost realization cfg$gms$costs <- "default" # def = default @@ -197,37 +256,67 @@ cfg$gms$s12_hist_interest_hic_noselect <- "0.04" # def = 0.04 # ***--------------------- 13_tc ----------------------------------------- -# * (endo_jun18): endogenous technological change with full cost accounting and -# * stepwise updated crop area information +# * (endo_jan22): endogenous technological change with full cost accounting and +# * stepwise updated crop and managed pastures area information # * (exo): exogenous technological change (removes non-linearities from the model); -# * requires an existing model run with endo tc for generating the input file -# * f13_tau_scenario.csv -cfg$gms$tc <- "endo_jun18" # def = endo_jun18 +# * requires an existing model run with endo tc for generating the input file +# * f13_tau_scenario.csv +cfg$gms$tc <- "endo_jan22" # def = endo_jan22 + +# * tc cost scenario crops: low, medium or high +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 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 -# * tc cost scenario: low, medium or high -cfg$gms$c13_tccost <- "medium" # ***--------------------- 14_yield -------------------------------------- -# * (biocorrect): cropland TC applied on pasture yields -# * (dynamic_aug18): pasture yields increase based on exogenuous demand-side proxy -# * for growth rate of cattle stocks -cfg$gms$yields <- "dynamic_aug18" # def = dynamic_aug18 +# * (managementcalib_aug19): calibrate potential LPJmL-yields to FAO regional numbers, +# * pasture yields increase based on exogenous demand-side proxy +# * for growth rate of cattle stocks +cfg$gms$yields <- "managementcalib_aug19" # def = managementcalib_aug19 # * yield scenario -# * options: cc (climate change) -# * nocc (no climate change) -cfg$gms$c14_yields_scenario <- "nocc" # def = "nocc" +# * options: cc (climate change) +# * nocc (no climate change) +# * nocc_hist (no climate change after year defined by sm_fix_cc) +cfg$gms$c14_yields_scenario <- "cc" # def = "cc" # * switch determing the effectivity of translating crop tc into pasture yield # * increase. Value has to be in the range of 0 (no pasture yield growth) -# * and 1 (pasture yields increase linearily with tau) -# * only used in biocorrect realization +# * and 1 (pasture yields increase linearily with tau). Only used in the realizations: +# * biocorrect (tc of current time step) and managementcalib (tc of previous time step). cfg$gms$s14_yld_past_switch <- 0.25 # def = 0.25 +# * Switch that allows selecting how yield calibration factors will be calculated. +# * If 0, crop yields calibration will be calculated as multiplicative relative values. +# * If 1, calibration values will be limited to additive absolute values when modeled yields strongly +# * underestimate historical values. For more information, read the description on the 'preloop' +# * file of module 14_yield. +# * options: 1 (limit to absolute values) +# * 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 @@ -237,10 +326,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" @@ -267,9 +352,9 @@ cfg$gms$s15_milk_share_fadeout_india <- 1 # def = 1 # * and transition periods (applied after food demand model is executed) # * options consist of 3 parts: functional form (lin,sigmoid), target (zero, 20pc, 50pc, 80pc, 90pc) and transition period (10_50: from 2010 to 2050, 20_50: from 2020 to 2050) # * Example for sigmoid_50pc_20_50: -# * Functional form: sigmoid (S-shaped) -# * Target: 50percent reduction at end of transition period (2050 in this case) -# * Transition period: start in 2020, end in 2050 +# * Functional form: sigmoid (S-shaped) +# * Target: 50percent reduction at end of transition period (2050 in this case) +# * Transition period: start in 2020, end in 2050 # * options: 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, @@ -281,10 +366,10 @@ cfg$gms$c15_livescen <- "constant" # def = constant cfg$gms$c15_rumdairy_scp_scen <- "constant" # def = constant cfg$gms$c15_rumdairyscen <- "constant" # def = constant -# * Set items of kfo_rd. This option allows for sensitivity scenarios (e.g. only livst_milk). +# * Set items of kfo_rd. This option allows for sensitivity scenarios. # * kfo_rd is used in the food substitution scenarios c15_rumdairy_scp_scen and c15_rumdairyscen (see above) -# * options: "livst_rum,livst_milk", "livst_rum" or "livst_milk" -cfg$gms$kfo_rd <- "livst_rum,livst_milk" #def = livst_rum,livst_milk +# * options: "livst_rum,livst_milk", "livst_rum" or "livst_milk" +cfg$gms$kfo_rd <- "livst_rum" #def = livst_rum # * Reduction of livestock products towards a kcal/cap/day intake target with or w/o substitution # * maximum kcal/cap/day intake target used for downwards convergence of livestock products @@ -294,21 +379,17 @@ cfg$gms$s15_kcal_pc_livestock_intake_target <- "430" # def = 430 cfg$gms$c15_livescen_target <- "constant" # def = constant # * fade-out of livestock products (0) or substitution of livestock products with plant-based products (1) # * options: 0 (=fade-out), 1 (=substitution) -cfg$gms$s15_livescen_target_subst <- 1 # def = 1 - - -# * target year for transition to exogenous scenarios -# * only active for exogenous scenario switches that are set to 1 -# * currently available: waste (s15_exo_waste) and EAT Lancet diets (s15_exo_diet) -# * options: y2030, y2050 -cfg$gms$c15_exo_scen_targetyear <- "y2050" # def = y2050 +cfg$gms$s15_livescen_target_subst <- 1 # def = 1 +# ***** Start configuration of exogenous food intake and waste scenarios ***** +# +# # * switch for transition to food waste scenarios # * (1): transition towards exogenous food waste target # * (0): regression-based estimation of food waste cfg$gms$s15_exo_waste <- 0 # def = 0 - +# # * scenario target for the ratio between food demand and intake # * only activated if s15_exo_waste is set to 1 # * options: scalars >1 @@ -316,29 +397,61 @@ cfg$gms$s15_exo_waste <- 0 # def = 0 # * (1.2): corresponds to 20% food waste ~ half waste of HIC cfg$gms$s15_waste_scen <- 1.2 # def = 1.2 - -# * switch for transition to EAT Lancet diet scenarios +# * switch for transition to exogenous diet scenarios (EAT Lancet and National Institute of Nutrition (NIN)) +# * (2): transition towards exogenous diets (NIN for India and EAT for other regions) +# * Please use this switch in combination with cfg$gms$c15_EAT_scen <- "FLX_hmilk" +# * If only India's diet needs to be changed, then set cfg$gms$scen_countries15 <- "IND" # * (1): transition towards exogenous diets and food demand # * (0): regression-based estimation of diets and food demand 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 +# * half_overweight, no_underweight_half_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 +# * half_overweight: number of people with BMI>25 is halved compared to baseline (have BMI 20-25 instead) +# * no_underweight_half_overweight: combination of no_underweight and half_overweight +# * 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) cfg$gms$s15_alc_scen <- 0.014 # def = 0.014 - +# +# # * Switch and specification of countries for which exogenous food scenarios # * (EAT Lancet diet and food waste scenarios), food substitution scenarios and # * c15_food_scenario shall be applied @@ -347,7 +460,23 @@ 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 ***** # * calibration to historical values @@ -363,6 +492,11 @@ cfg$gms$demand <- "sector_may15" # def = sector_may15 # * (flexreg_apr16): default production aggregation cfg$gms$production <- "flexreg_apr16" # def = flexreg_apr16 +#* Additional switch to initialize cellular production +# * (on) : it initializes cellular production +# * (off) : it does not initialize cellular production +cfg$gms$c17_prod_init <- "on" # default = on + # ***--------------------- 18_residues ----------------------------------- # * (flexreg_apr16): detailed residue calculations # * (off): off @@ -375,13 +509,14 @@ cfg$gms$c18_burn_scen <- "phaseout" # def = phaseout # ***--------------------- 20_processing --------------------------------- -# * (substitution_dec18) : processing with couple products allowing for substitution +# * (substitution_may21) : processing with couple products allowing for substitution # * (off): off -cfg$gms$processing <- "substitution_dec18" # def = substitution_dec18 +cfg$gms$processing <- "substitution_may21" # def = substitution_may21 + # * SCP route # * single-cell microbial protein production route -# * options: mixed, methane, sugar, cellulose, hydrogen +# * options: mixed, methane, sugar, cellulose, hydrogen # * Mapping of scp route to feedstock: methane:foddr, sugar:sugar_cane, cellulose:begr # * Note that hydrogen does not require land-based inputs # * Mixed assumes equal shares of methane, sugar, cellulose and hydrogen @@ -403,28 +538,152 @@ cfg$gms$trade <- "selfsuff_reduced" # def = selfsuff_reduced # * crops: 20% in 2030, 30% in 2050,2100 # * (l909595r809090): livestock/secondary: 10% in 2030, 5% in 2050,2100 # * crops: 20% in 2030, 10% in 2050,2100 +# * Initial values for the trade balance reduction in 1995 are 1, i.e. all trade in +# * 1995 happens through the self-sufficiency pool. For later time steps, additional +# * scenarios of trade liberalization (i.e. of allocation to the comparative advantage pool) +# * are implemented based on Schmitz et al. 2012 (also described in Popp et al. 2017) + cfg$gms$c21_trade_liberalization <- "l909090r808080" # def = l909090r808080 -# * whether trade tariff should be considered +# * whether trade tariff should be considered at all # * (0) without trade tariff # * (1) with trade tariff cfg$gms$s21_trade_tariff <- 1 # def =1 +# * whether to fade out trade tariffs (bilateral trade realization) # def = 0 +cfg$gms$s21_trade_tariff_fadeout <- 0 + +# * start year of fadeout if s21_trade_tariff_fadeout = 1 # def = 2020 +cfg$gms$s21_trade_tariff_startyear <- 2020 + +# * end year of fadeout if s21_trade_tariff_fadeout = 1 # def = 2050 +cfg$gms$s21_trade_tariff_targetyear <- 2050 + +# ***--------------------- 22_land_conservation -------------------------------------- +# * (area_based_apr22): Area-based conservation (baseline and future) +# * based on WDPA and conservation priority areas +cfg$gms$land_conservation <- "area_based_apr22" # def = area_based_apr22 + +# * Additional land conservation target based on conservation priority areas +# * during future time steps (after `cfg$gms$sm_fix_SSP2`). +# * ("none") No additional land conservation target (WDPA only) +# * ("30by30") 30 % of global land surface in Key Biodiversity Areas (KBA), +# * GSN Distinct Species Assemblages & Critical Connectivity Areas + WDPA +# * ("KBA") Key Biodiversity Areas + WDPA +# * ("GSN_DSA") Global Safety Net: Distinct Species Assemblages + WDPA +# * ("GSN_RarePhen") Global Safety Net: Rare Phenomena + WDPA +# * ("GSN_AreaIntct") Global Safety Net: Areas of Intactness + WDPA +# * ("GSN_ClimTier1") Global Safety Net: Climate Stabilisation Tier 1 + WDPA +# * ("GSN_ClimTier2") Global Safety Net: Climate Stabilisation Tier 2 + WDPA +# * ("CCA") Critical Connectivity Areas (Brennan et al. 2022) + WDPA +# * ("IrrC_XXpc") Land area that covers XX percent of total global irrecoverable carbon +# * as defined by Noon et al. (2022), where XX correponds to either +# * 50, 75, 95, or 99 percent + WDPA +# * ("IrrC_XXpc_30by30") 30by30 + Land area that covers XX percent of total global irrecoverable +# * carbon as defined by Noon et al. (2022), where XX correponds to either +# * 50, 75, 95, or 99 percent + WDPA +# * ("BH") Biodiversity Hotspots + WDPA +# * ("IFL") Intact Forest Landscapes + WDPA +# * ("BH_IFL") Biodiversity Hotspots + Intact Forest Landscapes + WDPA +# * ("GSN_HalfEarth") Full protection of areas within the Global Safety Net, which +# * roughly corresponds to 50 percent of the global land surface +# * ("PBL_HalfEarth") Ecoregion-based approach to protecting half of the global land surface +# * Note: c22_protect_scenario applies to countries selected in policy_countries22 +# * c22_protect_scenario_noselect applies to all other countries. +cfg$gms$c22_protect_scenario <- "none" # def = None +cfg$gms$c22_protect_scenario_noselect <- "none" # def = None +# * Switch and specification of countries for which land conservation policies in +# * c22_protect_scenario apply. +# * Options: list of iso-codes of countries where land conservation should be applied +# * Note: must be written in the format: "IND, BRA, DEU" +# * Default: all iso countries +cfg$gms$policy_countries22 <- all_iso_countries + +# * Whether land restoration is carried out in areas targeted by land conservation +# * (1) Land is fully restored in conservation priority areas +# * (0) Only remaining forest and other land areas are conserved +cfg$gms$s22_restore_land <- 1 # def = 1 + +# * Start and target year of land conservation option ('c22_protect_scenario'). +# * Defines when full protection based on 'future options' is reached, using a +# * sigmoidal trajectory. NOTE: This switch is only relevant +# * if one of the 'future options' (e.g. BH) is chosen. +# * Start year: +cfg$gms$s22_conservation_start <- 2020 # def = 2020 +# * Target year (year when full protection is reached): +cfg$gms$s22_conservation_target <- 2030 # def = 2030 + # ***--------------------- 29_ageclass ----------------------------------- # * (feb21): Distribution of age-classes according to Poulter et al 2018 cfg$gms$ageclass <- "feb21" # def = feb21 # ***--------------------- 30_crop --------------------------------------- -# * (endo_jun13): dynamic cropland -cfg$gms$crop <- "endo_jun13" # def = endo_jun13 +# * (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_apr22): 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" # * (c30_bioen_water): switch for irrigation of bioenergy crops; options: rainfed, irrigated, all -cfg$gms$c30_bioen_water <- "rainfed" # def = "rainfed" +cfg$gms$c30_bioen_water <- "rainfed" # def = "rainfed" +# * (c30_rotation_constraints): switch for rotational constraints: on, off +cfg$gms$c30_rotation_constraints <- "on" # def = "on" +# * (c30_rotation_scenario): scenarios for constraints. +# * In realization rotation_apr22: min (minimal constraints), default (best guess), good (good practice), +# * good_20div (good practice - 20% for other crops), setaside (default plus fallow), +# * legumes (minimum share of legumes), agroforestry (minimum share of perennials), sixfoldrotation +# * (crops can only repeat after 6 years), agroecology (mix of previous scenarios) +# * In realization penalty_apr22: none (no incentives), default (best guess), fallow (increased fallow incentives), +# * legumes (increased incentives for legumes), agroforestry (increased incentives for perennials), agroecology (mix) +# * In realization endo_apr21: no scenarios exist. +cfg$gms$c30_rotation_scenario <- "default" # def = "default" +# * Year by which rotation scenario is fully implemented: +# * Start year: +cfg$gms$s30_rotation_scenario_start <- 2020 # def = 2020 +# * Target year (year when full implementation is reached): +cfg$gms$s30_rotation_scenario_target <- 2050 # def = 2050 + + +# * Switch to determine whether marginal land (suitability index below 0.33) should be included +# * in the total available cropland. Options are: +# * ("all_marginal"): All marginal land can be used for crop cultivation +# * ("q33_marginal"): The bottom tertile of marginal land is excluded +# * ("no_marginal"): Marginal land is completely excluded from crop cultivation +# * Note: Option "q33_marginal" produces the highest spatial correlation +# * with observed cropland patterns and is recommended for productive runs. +cfg$gms$c30_marginal_land <- "q33_marginal" # def = "q33_marginal" + +# * Share of available cropland that is withheld for maintaining semi-natural vegetation (SNV) +# * in cropland areas, including grassland, forest and other land. For example, +# * a share of 0.2 corresponds to 20 % of SNV in terms of the available cropland. +# * Accepted values are between 0 and 1 +# Note: s30_snv_shr applies to countries selected in policy_countries30 +# s30_snv_shr_noselect applies to all other countries. +cfg$gms$s30_snv_shr <- 0 # def = 0 +cfg$gms$s30_snv_shr_noselect <- 0 # def = 0 +# * Year by which SNV policy ('s30_snv_shr') is fully implemented. +# * Start year: +cfg$gms$s30_snv_scenario_start <- 2020 # def = 2020 +# * Target year (year when full implementation is reached): +cfg$gms$s30_snv_scenario_target <- 2030 # def = 2030 +# * Switch and specification of countries for which SNV policy in +# * s30_snv_shr apply. +# * Options: list of iso-codes of countries where SNV policy should be applied +# * Note: must be written in the format: "IND, BRA, DEU" +# * Default: all iso countries +cfg$gms$policy_countries30 <- all_iso_countries +# * Land types included in the SNV policy. This option allows for sensitivity analyses. +# * plausible options: "secdforest, forestry, past, other", +# * "secdforest, other", +# * "secdforest, past, other" etc. +cfg$gms$land_snv <- "secdforest, forestry, past, other" #def = "secdforest, forestry, past, other" # ***--------------------- 31_past --------------------------------------- # * (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) @@ -435,16 +694,43 @@ 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) +# * 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. +# * If 0, grassland yield calibration will be calculated as multiplicative relative values. +# * If 1, calibration values will be limited to additive absolute values when modeled yields strongly +# * underestimate historical values. For more information, read the description on the 'preloop' +# * file of module 31_past. + +# * options: 1 (limit to absolute values) +# * 0 (pure relative calibration) +cfg$gms$s31_limit_calib <- 1 # def = 1 + # ***--------------------- 32_forestry ----------------------------------- -# * (static_sep16) : Static forestry sector -# * (dynamic_feb21): Dynamic forestry sector including afforestation with detailed age-classes +# * (dynamic_feb21): Dynamic forestry sector including afforestation with detailed age-classes cfg$gms$forestry <- "dynamic_feb21" # def = dynamic_feb21 # * afforestation planing horizon (years) cfg$gms$s32_planing_horizon <- 50 # def = 50 -# * switch for using natveg (0) or plantation (1) growth curves for afforestation -cfg$gms$s32_aff_plantation <- 0 # def = 0 +# * Settings for CO2 price driven afforestation (Growth curve and BII) + +# * Growth curve for CO2 price driven afforestation +# * Switch for using natural vegetation (0) or plantation (1) growth curves towards LPJmL natural +# * vegetation carbon density. +# * Afforestation following plantation growth curves reflects managed or assistent regrowth, +# * and might also include non-native species. +cfg$gms$s32_aff_plantation <- 0 # def = 0 + +# * BII coefficient for CO2 price driven afforestation +# * Switch for using secondary vegetation (0) or timber (1) BII coefficients for CO2 price driven afforestation +# * The recommend setting is to map the BII coefficient to the choice of the growth curve. +# * natural vegetation growth curve (0): secondary vegetation BII coefficient (0) +# * plantation growth curve (1): timber BII coefficient (1) +# * However, afforestation with plantations (1) could possibly be done in a biodiversity friendly way (0) +cfg$gms$s32_aff_bii_coeff <- 0 # def = 0 # Afforestation policy # * ("none"): no prescribed afforestation @@ -452,9 +738,21 @@ cfg$gms$s32_aff_plantation <- 0 # def = 0 # * ("ndc"): prescribed afforestation based on NPI+NDC policies cfg$gms$c32_aff_policy <- "npi" # def = "npi" -# maximum total global afforestation in Mha (Inf = no constraint) +# Maximum total global afforestation in Mha (Inf = no constraint) +# Note 1: the limit applies to the sum of endogenous CO2 price driven and exogenous NPI/NDC afforestation +# Note 2: a limit of 0 or below the level of exogenous NPI/NDC afforestation will be a automatically raised to the level of exogenous NPI/NDC afforestation cfg$gms$s32_max_aff_area <- Inf # def = Inf +# Protection of afforested areas (endogenous CO2 price driven) +# 0=until end of planning horizon (see s32_planing_horizon) +# 1=forever +cfg$gms$s32_aff_prot <- 0 # def = 0 + +# Type of afforestation constraint +cfg$gms$s32_max_aff_area_glo <- 1 # def = 1 +# * (1): global limit based on s32_max_aff_area +# * (0): regional limit based on the input file "f32_max_aff_area.cs4" + # Switch to determine whether afforestation should be limited to # certain latitudinal zones # * ("unrestricted"): No regions excluded @@ -539,35 +837,43 @@ cfg$gms$c32_incr_rate <- "h5s2l1" # def = "h5s2l1" # * All plantations are harvested at rotation age. Plantation establishment is endogenous. cfg$gms$s32_hvarea = 0 # def = 0 +# Type of rotation length selection criteria +# * ("mean_annual_increment") = Harvesting when the average annual increment is maximum +# * ("current_annual_increment") = Harvesting when the marginal increment is maximum +# * ("instantaneous_growth_rate") = Harvest when instantaneous growth rate is equal to interest rate + +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 --------------------------------------- -# * (static): static urban -cfg$gms$urban <- "static" # def = static +# * 34_urban includes urban land +# * (static) static urban land fixed on 1995 patterns from LUH2v2 +# * (exo_nov21) has exogenous future urban land patterns based on LUH2v2 +cfg$gms$urban <- "exo_nov21" # def = exo_nov21 + +# * Additional settings for exo_nov21 realization only: +cfg$gms$c34_urban_scenario <- "SSP2" # def = SSP2 +# * options: SSP: "SSP1", "SSP2", "SSP3", "SSP4", "SSP5" # ***--------------------- 35_natveg -------------------------------------- # * 35_natveg includes primforest, secdforest and other land -# * (static): Static natural vegetation land -# * (dynamic_feb21): Dynamic natural vegetation land with detailed age-classes +# * (dynamic_feb21): Dynamic natural vegetation land with detailed age-classes cfg$gms$natveg <- "dynamic_feb21" # def = dynamic_feb21 -# * protected areas (primforest,secdforest,other land) -# * (WDPA) WDPA IUCN catI+II -# * (BH) Biodiversity Hotspots + WDPA -# * (FF) Frontier Forests + WDPA -# * (CPD) Centres of Plant Diversity + WDPA -# * (LW) last of the wild + WDPA -# * (none) no protection -# * (forest) forest protection (primforest+secdforest) -# * (full) full protection -# * (HalfEarth) protection of half land and sea -cfg$gms$c35_protect_scenario <- "WDPA" # def = WDPA - # Avoided Deforestation policy # * ("none"): no avoided deforestation # * ("npi"): avoided deforestation based on NPI policies # * ("ndc"): avoided deforestation based on NPI+NDC policies cfg$gms$c35_ad_policy <- "npi" # def = "npi" -# Avoided Other Land Conversion policye +# Avoided Other Land Conversion policy # * ("none"): no avoided other land conversion # * ("npi"): avoided other land conversion based on NPI policies # * ("ndc"): avoided other land conversion based on NPI+NDC policies @@ -579,27 +885,124 @@ cfg$gms$c35_aolc_policy <- "npi" # def = "npi" # * (2): Distribution of secondary forest according to Poulter et al 2018 based on MODIS satellite data cfg$gms$s35_secdf_distribution <- 0 # def = 0 -# Natural damages in natural forests +# Damages in natural forests # * (0): No damage simulated -# * (1): Damage from shifting agriculture -cfg$gms$s35_forest_damage <- 1 # def = 1 +# * (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 # Harvesting switch for timber production # * 0 = No timber production from natveg, no age-class shifting # * 1 = No timber production from natveg but with age-class shifting # * 2 = Timber production from natveg including age-class shifting -cfg$gms$s35_hvarea = 0 # def = 0 +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_labor +# * realization of the [38_factor_costs] module. +# * (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: +# * Climate change impact scenario. Options: "rcp119", "rcp585" +cfg$gms$c37_labor_rcp <- "rcp119" # default = "rcp119" +# * Heat assessment metric. Options: "ISO", "HOTHAPS" +cfg$gms$c37_labor_metric <- "ISO" # default = "ISO" +# * Labour intensity. Options: "300W", "400W" +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 ------------------------------- -# * (fixed_per_ton_mar18): factor costs fixed per ton -# * (mixed_feb17): reimplementation of MAgPIE 3.0 default +# * 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 -cfg$gms$factor_costs <- "mixed_feb17" # default = mixed_feb17 +# * (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 + +# * 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: + +# * Year until which the capital share should be fixed to the historical values, not allowing for endogenous +# * substitution between labor and capital. +cfg$gms$s38_startyear_labor_substitution <- 2020 # default 2020 + +# * The following two settings are to create exogenous scenarios in which capital is substituted by labor to increase +# * employment: +# * The taget labor share defins a global target for labor share out of labor + capital needed per unit +# * of output. If 0, no target is set. +cfg$gms$s38_target_labor_share <- 0 # default 0 + +# * The target year defines the year for which the global target labor share should be set. +cfg$gms$s38_targetyear_labor_share <- 2050 + +# * The target fulfillment share indicates the share by which a region moves from its baseline +# * labor share towards the target value +cfg$gms$s38_target_fulfillment <- 0.5 # default 0.5 # ***--------------------- 39_landconversion ----------------------------- -# * (global_static_aug18): global static land conversion costs for establishment -# * and land clearing -cfg$gms$landconversion <- "global_static_aug18" # def = global_static_aug18 +# * (calib): Costs for cropland expansion are scaled with a regional calibration factor +# * Costs for pasture and forestry expansion are global static +cfg$gms$landconversion <- "calib" # def = calib +# * Cost for cropland expansion before calibration (USD05MER per hectare) +cfg$gms$s39_cost_establish_crop <- 10000 #def = 10000 +# * Reward for cropland reduction before calibration (USD05MER per hectare) +cfg$gms$s39_reward_crop_reduction <- 6000 +# * Cost for pasture land expansion (USD05MER per hectare) +cfg$gms$s39_cost_establish_past <- 8000 #def = 8000 +# * Cost for foresty land expansion (USD05MER per hectare) +cfg$gms$s39_cost_establish_forestry <- 1000 #def = 1000 +# * Cost for urban land expansion (USD05MER per hectare) +cfg$gms$s39_cost_establish_urban <- 10000 #def = 10000 +# * Switch for ignoring land conversion cost calibration factors +# * Options: 1 (ignore calibration factors) +# * 0 (use calibration factors) +cfg$gms$s39_ignore_calib <- 0 #def = 0 # ***--------------------- 40_transport ---------------------------------- # * (off): no transport costs @@ -616,17 +1019,28 @@ cfg$gms$s40_pasture_transport_costs <- 0 # def = 0 # * (endo_apr13): endogenous, cost driven expansion cfg$gms$area_equipped_for_irrigation <- "endo_apr13" # def = endo_apr13 +# * switch for initialization area +# * (LUH2v2): area equipped for irrigation based on LUH2v2 +# * (Siebert): area equipped for irrigation from Siebert et al. +cfg$gms$c41_initial_irrigation_area <- "LUH2v2" # def = LUH2v2 + +# * Sets the rate of depreciation of irrigation infrastructure in every timestep. +# * Only applicable when (endo_apr13) realization is selected +cfg$gms$s41_AEI_depreciation <- 0 # def = 0 + + # ***--------------------- 42_water_demand -------------------------------- # * (agr_sector_aug13): fixed fraction of water available is reserved # * for other uses -# * (all_sectors_aug13): industrial, eletricity and domestic demand are +# * (all_sectors_aug13): manufacturing, electricity and domestic demand are # * retrieved from WATERGAP data. -cfg$gms$water_demand<- "agr_sector_aug13" # def = agr_sector_aug13 +cfg$gms$water_demand<- "all_sectors_aug13" # def = all_sectors_aug13 # * water demand scenario -# * options: cc (climate change) -# * nocc (no climate change) -cfg$gms$c42_watdem_scenario <- "nocc" # def = "nocc" +# * options: cc (climate change) +# * nocc (no climate change) +# * nocc_hist (no climate change after year defined by sm_fix_cc) +cfg$gms$c42_watdem_scenario <- "cc" # def = "cc" # * Choice of fraction of available water that is not # * available for agriculture (only affects agr_sector_aug13 realization) @@ -634,10 +1048,10 @@ cfg$gms$s42_reserved_fraction <- 0.5 # def = 0.5 # * Scenario for non agricultural water demand from WATERGAP # * (only affects all_sector_aug13 realization) -# * (1): SSP2 -# * (2): A2 -# * (3): B1 -cfg$gms$s42_watdem_nonagr_scenario <- 1 # def = 1 +# * (1): ssp1 +# * (2): ssp2 +# * (3): ssp3 +cfg$gms$s42_watdem_nonagr_scenario <- 2 # def = 2 # * Switch to determine the irrigation efficiency scenario # * (1): global static value @@ -655,12 +1069,20 @@ cfg$gms$s42_irrigation_efficiency <- 0.66 # def=0.66 # * (mixed): EFP policy only in hic regions cfg$gms$c42_env_flow_policy <- "off" # def = "off" +# * Start and target year of environmental flow protection policy ('c42_env_flow_policy'). +# * Defines when linear fading in of policy starts and when the target of +# * full protection based on 's42_env_flow_scenario' is reached +# * Start year: +cfg$gms$s42_efp_startyear <- 2020 # def = 2020 +# * Target year (year when full protection is reached): +cfg$gms$s42_efp_targetyear <- 2040 # def = 2040 + # * Switch and specification of countries for which environmental flow policy # * shall apply. # * Options: list of iso-codes of countries where EFP should be in effect. # * Note: must be written in the format: "IND, BRA, DEU" # * Default: all iso countries -cfg$gms$EFP_countries <- all_iso_countries # def = all_iso_countries +cfg$gms$EFP_countries <- all_iso_countries # def = all_iso_countries # * Environmental flow protection scenario # * (0): do not consider environmental flows. @@ -686,25 +1108,82 @@ cfg$gms$s42_env_flow_fraction <- 0.2 # def = 0.2 # * missing protection policy cfg$gms$s42_env_flow_base_fraction <- 0.05 # def = 0.05 +# * Switch to activate pumping costs (only available for India currently), Set to 1 if want to use for India +cfg$gms$s42_pumping <- 0 # def = 0 + +# * Year in which pumping costs will be implemented +cfg$gms$s42_multiplier_startyear <- 1995 # def = 1995 + +# * Scalar to change pumping costs for sensitivity analysis, takes numeric values +# * Default value is 0 for all regions, set value to 1 for India default analysis +# * Only applicable when s42_pumping is equal to 1 +cfg$gms$s42_multiplier <- 0 # def = 0 + # ***--------------------- 43_water_availability -------------------------- # * (total_water_aug13): surface and ground water resources available cfg$gms$water_availability <- "total_water_aug13" # def = total_water_aug13 # * water availability scenario -# * options: cc (climate change) -# * nocc (no climate change) -cfg$gms$c43_watavail_scenario <- "nocc" # def = "nocc" +# * options: cc (climate change) +# * nocc (no climate change) +# * nocc_hist (no climate change after year defined by sm_fix_cc) +cfg$gms$c43_watavail_scenario <- "cc" # def = "cc" # ***------------------------- 44_biodiversity ------------------------------ -# * (bv_btc_mar21): biodiversity value (BV) calculation following the Bending the Curve initiative (BTC) and incentive to increase BV based on price on BV loss. -cfg$gms$biodiversity <- "bv_btc_mar21" # def = bv_btc_mar21 +# * (bii_target): Biodiversity Intactness Index (BII) for 71 biomes with the option to define a lower bound for BII at biome level +# * (bv_btc_mar21): Global optimization of range-rarity weighted biodiversity stocks based on a price for losses and gains +cfg$gms$biodiversity <- "bii_target" # def = bii_target + +# * Start year for linear increase towards BII target value (in bii_target) or biodiversity target price (in bv_btc_mar21) +cfg$gms$s44_start_year <- 2025 #def = 2025 + +# * Year in which the BII target value (in bii_target) or biodiversity target price (in bv_btc_mar21) is reached +cfg$gms$s44_target_year <- 2100 #def = 2100 + +# ** Options for realization `bii_target` +# * This realisation allows to define a target value and year for the Biodiversity Intactness Index (BII) +# * that is applied in each biome type of each biogeographic realm or at the global level. +# * The lower bound increases in each biome linearly from the BII level in the start year (s44_start_year) to the value defined in `s44_bii_lower_bound` in the target year (s44_target_year). +# * The BII has been proposed as a control variable for changes in ecosystem functioning at the global scale +# * and has shown to capture increasing levels of ecosystem degradation. Steffen et al. (2015, 10.1126/science.1259855) have proposed +# * a premliminary boundary of 0.9 at the biome level (safe space) but with an uncertainty range of 0.9-0.3, +# * in which ecosystem degradation may undermine stable ecosystem functioning and the supply of nature's +# * contributions to people (NCP). With BII values below 0.3, the area's biodiversity has been depleted, +# * causing high risk of ecosystem collapse. Estimates for the global BII range between 0.7975 in 1970 and 0.7754 +# * in 2000. https://www.nhm.ac.uk/our-science/data/biodiversity-indicators/biodiversity-intactness-index-data +# * In MAgPIE, the global BII value is about 0.8 in 1995 and declines to 0.795 by 2020. + +# * Lower bound for BII in target year; plausible range: 0-1 +cfg$gms$s44_bii_lower_bound <- 0 #def = 0 + +# * Indicative outcomes for `s44_bii_lower_bound` based on c44_bii_decrease = 1, s44_start_year = 2025 and s44_target_year = 2100. +# * < 0.7: continued decrease of global BII +# * 0.74: no further decrease of global BII +# * 0.76: moderate increase of global BII +# * >= 0.78: (very) strong increase of global BII accomplished by high conversion of pasture to non-forest natural land + +# * BII lower bound implementation (binary) +# * options: 0 (no decrease allowed) or 1 (decrease allowed) +# * 0 (no decrease allowed): If the biome-level BII in `s44_start_year` exceeds the lower bound defined in `s44_bii_lower_bound, the BII value in the start year is used as lower bound for BII in all future time steps. +# * 1 (decrease allowed): The lower bound for BII can decrease over time, depending on the biome-level BII in the start year and the lower bound defined in `s44_bii_lower_bound. +# * Note: The BII constraint is defined as a minimum constraint. Therefore, the actual BII can be higher than the lower bound. +cfg$gms$c44_bii_decrease <- 1 #def = 1 + + +# ** Options for realization `bv_btc_mar21` + +# * Price for biodiversity stock loss/gain in target year (USD per ha) +# * Plausible range: 0-10000 +# * Indicative outcomes +# * 0: decrease of BII +# * 3000: rather constant BII +# * 6000: moderate increase of BII +# * 10000: stronger increase of BII +cfg$gms$s44_target_price <- 0 #def = 0 + +# * Price for biodiversity stock loss/gain in start year (USD per ha) +cfg$gms$s44_start_price <- 0 #def = 0 -# * Price on loss of biodiversity / reward for increase of biodiversity -# * Unit: USD per ha of biodiversity value loss -# * Options: p0, p1, p1_p10, p10, p10_p100, p1_p1000, p10_p10000 -# * Pattern: p_p in USD, while -# * the price path between the starting and end points follows a sigmaoid trajectory. -cfg$gms$c44_price_bv_loss <- "p0" # def = "p0"; # ***------------------------- 45_climate --------------------------------- # * (static): static koeppengeiger climate classification data @@ -712,28 +1191,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 -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. @@ -748,28 +1261,34 @@ 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 -------------------------------------- # * (normal_dec17): regrowth of carbon stocks in all c pools starts from pasture levels # * (off): carbon calculations deactivated cfg$gms$carbon <- "normal_dec17" # def = normal_dec17 +# * RCP scenario of land carbon sink adjustment factor, from Grassi et al 2021 +# * options: RCP19, RCP26, RCP34, RCP45, RCP60, RCPBU +cfg$gms$c52_land_carbon_sink_rcp <- "RCPBU" + + # * carbon scenario -# * options: cc (climate change) -# * nocc (no climate change) -cfg$gms$c52_carbon_scenario <- "nocc" # def = "nocc" +# * options: cc (climate change) +# * nocc (no climate change) +# * nocc_hist (no climate change after year defined by sm_fix_cc) +cfg$gms$c52_carbon_scenario <- "cc" # def = "cc" # * Minimum threshold of carbon density (tC/ha) in timber plantations 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 @@ -785,8 +1304,7 @@ cfg$gms$awms <- "ipcc2006_aug16" # def = ipcc2006_aug16 # * option: "ssp1", "ssp2", "ssp3", "ssp4", "ssp5", "constant", "a1", "a2", "b1","b2", #* "GoodPractice" # * Note: c55_scen_conf applies to countries selected in scen_countries55 -# * c55_scen_conf_noselect applies to all other countries. In default, all countries -# * are selected and only c55_scen_conf has to be set. +# * c55_scen_conf_noselect applies to all other countries. # * Available scenarios for c55_scen_conf_noselect are identical to c55_scen_conf cfg$gms$c55_scen_conf <- "ssp2" # def = ssp2 cfg$gms$c55_scen_conf_noselect <- "ssp2" # def = ssp2 @@ -799,56 +1317,84 @@ 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 - -# * Switch for phasing-in GHG price over a 20 year period (1=on 0=off) -cfg$gms$s56_ghgprice_phase_in <- 0 # def = 0 - -# * start year of GHG emission pricing phase-in (only used if s56_ghgprice_phase_in=1) -cfg$gms$s56_ghgprice_start <- 2025 # def = 2025 +cfg$gms$s56_ghgprice_devstate_scaling <- 0 # def = 0 # * reduction factor for CO2 price (only used in price_jan19) # * lowers the economic incentive for CO2 emission reduction (avoided deforestation) and afforestation -cfg$gms$s56_cprice_red_factor <- 1 # def = 1 - -# * GHG pollutant price scenario +cfg$gms$s56_cprice_red_factor <- 1 # def = 1 + +# * GHG emission price scenario +# * Note: For best consistency it is recommended to use trajectories from the most recent +# * coupled REMIND-MAgPIE runs. Currently, this is R21M42. +# * Note on available scenarios from coupled REMIND-MAgPIE runs +# * NPi: Current policies; above 3.0°C in 2100 +# * PkBudg900: Budget with 900 GtCO2; well-below 1.5°C in 2100 (PkBudg1000 for SDP) +# * PkBudg1300: Budget with 1300 GtCO2; well-below 2.0°C in 2100 +# * # * Available scenarios: -# * R2M41-SSP2-Budg1300,R2M41-SSP2-Budg600, -# * R2M41-SSP2-Budg950,R2M41-SSP2-NDC,R2M41-SSP2-NPi, -# * SSPDB-SSP1-20-IMAGE,SSPDB-SSP1-20-REMIND-MAGPIE, -# * SSPDB-SSP1-26-IMAGE,SSPDB-SSP1-26-REMIND-MAGPIE, -# * SSPDB-SSP1-34-IMAGE,SSPDB-SSP1-34-REMIND-MAGPIE, -# * SSPDB-SSP1-37-REMIND-MAGPIE, -# * SSPDB-SSP1-45-IMAGE,SSPDB-SSP1-45-REMIND-MAGPIE, -# * SSPDB-SSP1-Ref-IMAGE,SSPDB-SSP1-Ref-REMIND-MAGPIE, -# * SSPDB-SSP2-18-MESSAGE-GLOBIOM,SSPDB-SSP2-19-MESSAGE-GLOBIOM, -# * SSPDB-SSP2-20-MESSAGE-GLOBIOM,SSPDB-SSP2-20-REMIND-MAGPIE, -# * SSPDB-SSP2-26-MESSAGE-GLOBIOM,SSPDB-SSP2-26-REMIND-MAGPIE, -# * SSPDB-SSP2-34-MESSAGE-GLOBIOM,SSPDB-SSP2-34-REMIND-MAGPIE, -# * SSPDB-SSP2-37-REMIND-MAGPIE, -# * SSPDB-SSP2-45-MESSAGE-GLOBIOM,SSPDB-SSP2-45-REMIND-MAGPIE, -# * SSPDB-SSP2-60-MESSAGE-GLOBIOM,SSPDB-SSP2-60-REMIND-MAGPIE, -# * SSPDB-SSP2-Ref-MESSAGE-GLOBIOM,SSPDB-SSP2-Ref-REMIND-MAGPIE, -# * SSPDB-SSP3-34-AIM-CGE,SSPDB-SSP3-45-AIM-CGE, -# * SSPDB-SSP3-60-AIM-CGE,SSPDB-SSP4-26-GCAM4, -# * SSPDB-SSP4-34-GCAM4,SSPDB-SSP4-45-GCAM4, -# * SSPDB-SSP4-60-GCAM4,SSPDB-SSP4-Ref-GCAM4, -# * SSPDB-SSP5-20-REMIND-MAGPIE,SSPDB-SSP5-26-REMIND-MAGPIE, -# * SSPDB-SSP5-34-REMIND-MAGPIE,SSPDB-SSP5-37-REMIND-MAGPIE, -# * SSPDB-SSP5-45-REMIND-MAGPIE,SSPDB-SSP5-60-REMIND-MAGPIE, -# * SSPDB-SSP5-Ref-REMIND-MAGPIE, +# * Coupled REMIND-MAgPIE runs +# * R21M42-SDP-NPi, R21M42-SDP-PkBudg1000, R21M42-SDP-PkBudg1100, R21M42-SDP-PkBudg900, +# * R21M42-SSP1-NPi, R21M42-SSP1-PkBudg1100, R21M42-SSP1-PkBudg1300, R21M42-SSP1-PkBudg900, +# * R21M42-SSP2-NPi, R21M42-SSP2-PkBudg1100, R21M42-SSP2-PkBudg1300, R21M42-SSP2-PkBudg900, +# * R21M42-SSP5-NPi, R21M42-SSP5-PkBudg1100, R21M42-SSP5-PkBudg1300, R21M42-SSP5-PkBudg900, +# * R2M41-SSP2-NPi, R2M41-SSP2-NDC, R2M41-SSP2-Budg1300, R2M41-SSP2-Budg600, R2M41-SSP2-Budg950 +# * Standalone REMIND runs from Strefler et al 2021; well-below 2.0°C in 2100 +# * https://www.nature.com/articles/s41467-021-22211-2 +# * PIK_GDP, PIK_H2C, PIK_HBL, PIK_HOS, PIK_LIN, PIK_NPI, PIK_OPT +# * SSP Database 2018, various SSP, RCP and Model combinations +# * https://tntcat.iiasa.ac.at/SspDb +# * Caution: using trajectories from other models or older MAgPIE versions might be +# * inconsistent with the current MAgPIE version. +# * SSPDB-SSP1-20-IMAGE,SSPDB-SSP1-20-REMIND-MAGPIE, +# * SSPDB-SSP1-26-IMAGE,SSPDB-SSP1-26-REMIND-MAGPIE, +# * SSPDB-SSP1-34-IMAGE,SSPDB-SSP1-34-REMIND-MAGPIE, +# * SSPDB-SSP1-37-REMIND-MAGPIE, +# * SSPDB-SSP1-45-IMAGE,SSPDB-SSP1-45-REMIND-MAGPIE, +# * SSPDB-SSP1-Ref-IMAGE,SSPDB-SSP1-Ref-REMIND-MAGPIE, +# * SSPDB-SSP2-18-MESSAGE-GLOBIOM,SSPDB-SSP2-19-MESSAGE-GLOBIOM, +# * SSPDB-SSP2-20-MESSAGE-GLOBIOM,SSPDB-SSP2-20-REMIND-MAGPIE, +# * SSPDB-SSP2-26-MESSAGE-GLOBIOM,SSPDB-SSP2-26-REMIND-MAGPIE, +# * SSPDB-SSP2-34-MESSAGE-GLOBIOM,SSPDB-SSP2-34-REMIND-MAGPIE, +# * SSPDB-SSP2-37-REMIND-MAGPIE, +# * SSPDB-SSP2-45-MESSAGE-GLOBIOM,SSPDB-SSP2-45-REMIND-MAGPIE, +# * SSPDB-SSP2-60-MESSAGE-GLOBIOM,SSPDB-SSP2-60-REMIND-MAGPIE, +# * SSPDB-SSP2-Ref-MESSAGE-GLOBIOM,SSPDB-SSP2-Ref-REMIND-MAGPIE, +# * SSPDB-SSP3-34-AIM-CGE,SSPDB-SSP3-45-AIM-CGE, +# * SSPDB-SSP3-60-AIM-CGE,SSPDB-SSP4-26-GCAM4, +# * SSPDB-SSP4-34-GCAM4,SSPDB-SSP4-45-GCAM4, +# * SSPDB-SSP4-60-GCAM4,SSPDB-SSP4-Ref-GCAM4, +# * SSPDB-SSP5-20-REMIND-MAGPIE,SSPDB-SSP5-26-REMIND-MAGPIE, +# * SSPDB-SSP5-34-REMIND-MAGPIE,SSPDB-SSP5-37-REMIND-MAGPIE, +# * SSPDB-SSP5-45-REMIND-MAGPIE,SSPDB-SSP5-60-REMIND-MAGPIE, +# * SSPDB-SSP5-Ref-REMIND-MAGPIE, +# * Used for producing coupled runs with REMIND-MAgPIE or for exogenous input (see below) # * coupling # * Note: c56_pollutant_prices applies to countries selected in policy_countries56 -# * c56_pollutant_prices_noselect applies to all other countries. In default, all countries -# * are selected and only c56_pollutant_prices has to be set. +# * c56_pollutant_prices_noselect applies to all other countries. # * Available scenarios for c56_pollutant_prices_noselect are identical to c56_pollutant_prices # * (see above) except for emulator and coupling (which can only be chosen for c56_pollutant_prices) -cfg$gms$c56_pollutant_prices <- "R2M41-SSP2-NPi" # def = R2M41-SSP2-NPi -cfg$gms$c56_pollutant_prices_noselect <- "R2M41-SSP2-NPi" # def = R2M41-SSP2-NPi +cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-NPi" # def = R21M42-SSP2-NPi +cfg$gms$c56_pollutant_prices_noselect <- "R21M42-SSP2-NPi" # def = R21M42-SSP2-NPi + +# * The following two settings can be used to provide exogenous ghg prices +# * via a file that is not part of the input data. This is currently used +# * in the REMIND-MAgPIE coupling to read in the REMIND data. +# * Takes effect only if cfg$gms$c56_pollutant_prices is set to "coupling" + +# * Use ghg prices from the mif file specified here +cfg$path_to_report_ghgprices <- NA + +# * Mute GHG prices until (and including) the year given here +# * Note: minimum C price (see below) will be set regardless of this setting +cfg$gms$c56_mute_ghgprices_until <- "y2030" # def = y2030 + +# * Minium C price (USD per tC) for future time steps until (and including) the year defined in `c56_mute_ghgprices_until` +# * Note: in case of NDC policy a C price of 18 USD per tC (5 USD per tCO2) is used to guide land-use decisions (set via scenario_config.csv) +cfg$gms$s56_minimum_cprice <- 0 # def = 0 # * Switch and specification of countries for which pollutant pricing in # * c56_pollutant_prices applies. @@ -857,80 +1403,148 @@ cfg$gms$c56_pollutant_prices_noselect <- "R2M41-SSP2-NPi" # def = R2M41-SSP2 # * Default: all iso countries # * Note: Only for exogenous scenarios. Does not take any effect when "coupling" / # * "emulator" is selected above. -cfg$gms$policy_countries56 <- all_iso_countries +cfg$gms$policy_countries56 <- all_iso_countries # def = all_iso_countries # * Switch for C price driven afforestation (1=on 0=off) -cfg$gms$s56_c_price_induced_aff <- 1 +cfg$gms$s56_c_price_induced_aff <- 1 # def = on + +# * C price used as incentive for afforestation +# * Note: This setting should only be changed by experienced users +# * Options: forestry_vegc, primforest_vegc, secdforest_vegc +# * This setting interacts with `c56_emis_policy`. +# * If "forestry" is not included in `c56_emis_policy` (e.g. reddnatveg_nosoil), there will be no C-price driven afforestation unless `c56_cprice_aff` is changed to primforest_vegc or secdforest_vegc. +cfg$gms$c56_cprice_aff <- "forestry_vegc" # def = forestry_vegc # * C price expectation for afforestation decision-making in years # * 0 is myopic behaviour (only C price of current time step) # * reflects perfect-foresight if equal to s32_planing_horizon # * should not be higher than s32_planing_horizon -cfg$gms$s56_c_price_exp_aff <- 50 # def = 50 +cfg$gms$s56_c_price_exp_aff <- 50 # def = 50 # * share of carbon credits for afforestation projects pooled in a buffer # * Values > 0 will reduced the incentive for c price induced afforestation # * a plausible value is 0.2, based on the Gold Standard for afforestation projects -cfg$gms$s56_buffer_aff <- 0.2 # def = 0.2 +cfg$gms$s56_buffer_aff <- 0.2 # def = 0.2 # * Upper limit for CH4 and N2O GHG price (USD05MER per tC) # * Limits GHG prices selected in c56_pollutant_prices to the chosen value. -# * CH4 and N2O GHG prices are limited by default to 1000 USD05MER per tC equivalent, -# * which induces the maximum abatement possible in the 57_maccs module. -# * Beyond 1000 USD05MER per tC equivalent no further technical mitigation is possible -# * but would increase food prices. -cfg$gms$s56_limit_ch4_n2o_price <- 1000 # def = 1000 - -# * emission 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 +# * CH4 and N2O GHG prices are limited by default to 4000 USD05MER per tC equivalent, +# * which induces the maximum abatement possible with c57_macc_version = "PBL_2022" +# * Beyond 4000 USD05MER per tC equivalent no further technical mitigation is possible +# * but would increase agricultural prices. +# * Suggested limits for different c57_macc_version settings +# * PBL_2007: 1000 (200 steps, 5 USD each) +# * PBL_2019: 4000 (200 steps, 20 USD each) +# * PBL_2022: 4000 (200 steps, 20 USD each) +cfg$gms$s56_limit_ch4_n2o_price <- 4000 # def = 4000 + +# * NOTE: The following 2 options for emission pricing have strong interactions in runs with CO2 prices and should only be changed by experienced users. +# * 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 (not including any GHG sources), +# * redd_nosoil (Above ground CO2 emis from LUC in forest; all CH4 and N2O emissions), +# * redd_nosoil_nopeat (same as redd_nosoil but without GHG emissions from peatlands), +# * reddnatveg_nosoil (Above ground CO2 emis from LUC in forest and natveg; all CH4 and N2O emissions), +# * reddnatveg_nosoil_nopeat (same as reddnatveg_nosoil but without GHG emissions from peatlands), +# * redd+_nosoil (Above ground CO2 emis from LUC in forest and forestry; all CH4 and N2O emissions), +# * redd+_nosoil_nopeat (same as redd+_nosoil but without GHG emissions from peatlands), +# * redd+natveg_nosoil (Above ground CO2 emis from LUC in forest, forestry and natveg; all CH4 and N2O emissions), +# * redd+natveg_nosoil_nopeat (same as redd+natveg_nosoil but without GHG emissions from peatlands), +# * 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 -cfg$gms$c56_emis_policy <- "redd+natveg_nosoil" # def = redd+natveg_nosoil - -# * Treatment of negative costs originating from negative co2 emissions -# * reward negative co2 emissions (-Inf) or not (0) -# * s56_reward_neg_emis is applied on the emission policy chosen in c56_emis_policy -# * In case of carbon pricing s56_reward_neg_emis = -Inf results in increase of other land -# * For runs with afforestation s56_reward_neg_emis should be 0 (default setting) -cfg$gms$s56_reward_neg_emis <- 0 # def = 0 +# * 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_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) +# * ecoSysProtAll_agMgmtOff: (Above ground CO2 emis from LUC in forest, forestry, natveg; All types of emis from peatland; No further CH4/N2O/other emis related to ag. management) +cfg$gms$c56_emis_policy <- "redd+natveg_nosoil" # def = redd+natveg_nosoil + +# * CO2 emissions subject to carbon pricing +# * options: actual, actualNoAcEst +# * actual: CO2 emissions for pricing are based on the difference of actual carbon stocks between time steps +# * actualNoAcEst: CO2 emissions for pricing are based on actual carbon stocks but +# * without newly established forest and non-forest areas. Note that re/afforestation is covered by a separate mechanism. +c56_carbon_stock_pricing <- "actualNoAcEst" # def = actualNoAcEst -# * Peatland GHG emission pricing -# * 0=off -# * 1=on -cfg$gms$s56_peatland_policy <- 0 # def = 0 # ***--------------------- 57_maccs --------------------------------------- -# * (on_sep16): maccs for non-CO2 emission mitigation activated -# * (off_jul16): maccs for non-CO2 emission mitigation deactivated -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): off -# * (on): Peatland GHG emissions based on IPCC 2014 factors -cfg$gms$peatland <- "off" # def = off +# * (off): Peatland area and associated GHG emissions are assumed zero +# * (on): Peatland area is initialized with present-day degraded and intact peatland. +# * GHG emissions are calculated using IPCC Tier 1 emission factors (2013 Wetland supplement). +cfg$gms$peatland <- "on" # def = on # * peatland rewetting # * options: 0 (off) # * Inf (on) -cfg$gms$s58_rewetting_switch <- 0 # def = 0 +cfg$gms$s58_rewetting_switch <- Inf # def = Inf -# * Costs for peatland rewetting (USD05MER per ha) +# * One-time and recurring costs for peatland rewetting (USD05MER per ha) cfg$gms$s58_rewet_cost_onetime <- 7000 # def = 7000 cfg$gms$s58_rewet_cost_recur <- 200 # def = 200 +# * One-time and recurring costs for peatland degradation (USD05MER per ha) +# * Can be used to test area-based incentives for peatland protection and restoration, +# * complementary or in addition to pricing GHG emissions from degraded peatlands (see s56_peatland_policy). +# * One-time costs apply on the conversion of intact (and rewetted) peatland to degraded peatland. +# * Therefore, one-time costs can used to incentivize the protection of intact peatlands. +# * Recurring costs apply on the level of degraded peatland. Therefore, recurring costs, +# * in combination with one-time costs, can be used to incentivize peatland restoration. +cfg$gms$s58_degrad_cost_onetime <- 0 # def = 0 +cfg$gms$s58_degrad_cost_recur <- 0 # def = 0 + +# * Artificial cost for balance variables (USD05MER per ha) +# * The balance variables in the peatland module avoid infeasibilities due to +# * differences in accuracy between parameters and variables in GAMS. +# * High costs make sure that the balance variables are only used as a last resort. +cfg$gms$s58_cost_balance <- 1e+06 # def = 1e+06 + +# * Switch for fixing peatland area to 2015 levels from 1995 onwards until the given year +# * Note: The initial peatland area is only available for the year 2015. +# * Fixing the peatland area in previous time steps to 2015 levels provides a better +# * proxy for GHG emissions from peatlands than assuming no peatland area. +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 +# * (cellpool_jan23): dynamic soil organic matter pool on cellular level +# * with updated, regionalized stock change factors (IPCC guidelines 2019) +cfg$gms$som <- "static_jan19" # def = static_jan19 # * static realization switch # * options: cellular (use preprocessed cellular stock change factors) @@ -940,15 +1554,21 @@ cfg$gms$c59_static_spatial_level <- "cellular" # * cellpool realization switches # * som climate impact scenario -# * options: cc (climate change) -# * nocc (no climate change) -cfg$gms$c59_som_scenario <- "nocc" # def = "nocc" +# * options: cc (climate change) +# * nocc (no climate change) +# * nocc_hist (no climate change after year defined by sm_fix_cc) +cfg$gms$c59_som_scenario <- "cc" # def = "cc" # * irrigation feedback # * options: on (higher carbon sequestration under irrigation) # * off (no carbon sequestration under irrigation) cfg$gms$c59_irrigation_scenario <- "on" # def = "on" +# * Exogenous nr release through som loss (only in static realization) +# * options: constant (constant from 2020) +# * fadeout_2050 (fading out till 2050) +cfg$gms$c59_exo_scen <- "constant" + # ***--------------------- 60_bioenergy ----------------------------------- # * (1stgen_priced_dec18): exogenous and price-based 1st generation bioenergy # * demand, 2nd generation residues exogeneous, @@ -962,37 +1582,61 @@ cfg$gms$bioenergy <- "1stgen_priced_dec18" # def = 1stgen_priced_dec18 cfg$gms$c60_1stgen_biodem <- "const2020" # def = const2020 # * 2nd generation bioenergy demand scenario +# * Note: For best consistency it is recommended to use trajectories from the most recent +# * coupled REMIND-MAgPIE runs. Currently, this is R21M42. +# * Note on available scenarios from coupled REMIND-MAgPIE runs +# * NPi: Current policies; above 3.0°C in 2100 +# * PkBudg900: Budget with 900 GtCO2; well-below 1.5°C in 2100 (PkBudg1000 for SDP) +# * PkBudg1300: Budget with 1300 GtCO2; well-below 2.0°C in 2100 +# * # * Available scenarios: -# * R2M41-SSP2-Budg1300,R2M41-SSP2-Budg600, -# * R2M41-SSP2-Budg950,R2M41-SSP2-NDC,R2M41-SSP2-NPi, -# * SSPDB-SSP1-20-IMAGE,SSPDB-SSP1-20-REMIND-MAGPIE, -# * SSPDB-SSP1-26-IMAGE,SSPDB-SSP1-26-REMIND-MAGPIE, -# * SSPDB-SSP1-34-IMAGE,SSPDB-SSP1-34-REMIND-MAGPIE, -# * SSPDB-SSP1-37-REMIND-MAGPIE, -# * SSPDB-SSP1-45-IMAGE,SSPDB-SSP1-45-REMIND-MAGPIE, -# * SSPDB-SSP1-Ref-IMAGE,SSPDB-SSP1-Ref-REMIND-MAGPIE, -# * SSPDB-SSP2-18-MESSAGE-GLOBIOM,SSPDB-SSP2-19-MESSAGE-GLOBIOM, -# * SSPDB-SSP2-20-MESSAGE-GLOBIOM,SSPDB-SSP2-20-REMIND-MAGPIE, -# * SSPDB-SSP2-26-MESSAGE-GLOBIOM,SSPDB-SSP2-26-REMIND-MAGPIE, -# * SSPDB-SSP2-34-MESSAGE-GLOBIOM,SSPDB-SSP2-34-REMIND-MAGPIE, -# * SSPDB-SSP2-37-REMIND-MAGPIE, -# * SSPDB-SSP2-45-MESSAGE-GLOBIOM,SSPDB-SSP2-45-REMIND-MAGPIE, -# * SSPDB-SSP2-60-MESSAGE-GLOBIOM,SSPDB-SSP2-60-REMIND-MAGPIE, -# * SSPDB-SSP2-Ref-MESSAGE-GLOBIOM,SSPDB-SSP2-Ref-REMIND-MAGPIE, -# * SSPDB-SSP3-34-AIM-CGE,SSPDB-SSP3-45-AIM-CGE, -# * SSPDB-SSP3-60-AIM-CGE,SSPDB-SSP4-26-GCAM4, -# * SSPDB-SSP4-34-GCAM4,SSPDB-SSP4-45-GCAM4, -# * SSPDB-SSP4-60-GCAM4,SSPDB-SSP4-Ref-GCAM4, -# * SSPDB-SSP5-20-REMIND-MAGPIE,SSPDB-SSP5-26-REMIND-MAGPIE, -# * SSPDB-SSP5-34-REMIND-MAGPIE,SSPDB-SSP5-37-REMIND-MAGPIE, -# * SSPDB-SSP5-45-REMIND-MAGPIE,SSPDB-SSP5-60-REMIND-MAGPIE, -# * SSPDB-SSP5-Ref-REMIND-MAGPIE, +# * Coupled REMIND-MAgPIE runs +# * R21M42-SDP-NPi, R21M42-SDP-PkBudg1000, R21M42-SDP-PkBudg1100, R21M42-SDP-PkBudg900, +# * R21M42-SSP1-NPi, R21M42-SSP1-PkBudg1100, R21M42-SSP1-PkBudg1300, R21M42-SSP1-PkBudg900, +# * R21M42-SSP2-NPi, R21M42-SSP2-PkBudg1100, R21M42-SSP2-PkBudg1300, R21M42-SSP2-PkBudg900, +# * R21M42-SSP5-NPi, R21M42-SSP5-PkBudg1100, R21M42-SSP5-PkBudg1300, R21M42-SSP5-PkBudg900, +# * R2M41-SSP2-NPi, R2M41-SSP2-NDC, R2M41-SSP2-Budg1300, R2M41-SSP2-Budg600, R2M41-SSP2-Budg950 +# * Standalone REMIND runs from Strefler et al 2021; well-below 2.0°C in 2100 +# * https://www.nature.com/articles/s41467-021-22211-2 +# * PIK_GDP, PIK_H2C, PIK_HBL, PIK_HOS, PIK_LIN, PIK_NPI, PIK_OPT +# * SSP Database 2018, various SSP, RCP and Model combinations +# * https://tntcat.iiasa.ac.at/SspDb +# * Caution: using trajectories from other models or older MAgPIE versions might be +# * inconsistent with the current MAgPIE version. +# * SSPDB-SSP1-20-IMAGE,SSPDB-SSP1-20-REMIND-MAGPIE, +# * SSPDB-SSP1-26-IMAGE,SSPDB-SSP1-26-REMIND-MAGPIE, +# * SSPDB-SSP1-34-IMAGE,SSPDB-SSP1-34-REMIND-MAGPIE, +# * SSPDB-SSP1-37-REMIND-MAGPIE, +# * SSPDB-SSP1-45-IMAGE,SSPDB-SSP1-45-REMIND-MAGPIE, +# * SSPDB-SSP1-Ref-IMAGE,SSPDB-SSP1-Ref-REMIND-MAGPIE, +# * SSPDB-SSP2-18-MESSAGE-GLOBIOM,SSPDB-SSP2-19-MESSAGE-GLOBIOM, +# * SSPDB-SSP2-20-MESSAGE-GLOBIOM,SSPDB-SSP2-20-REMIND-MAGPIE, +# * SSPDB-SSP2-26-MESSAGE-GLOBIOM,SSPDB-SSP2-26-REMIND-MAGPIE, +# * SSPDB-SSP2-34-MESSAGE-GLOBIOM,SSPDB-SSP2-34-REMIND-MAGPIE, +# * SSPDB-SSP2-37-REMIND-MAGPIE, +# * SSPDB-SSP2-45-MESSAGE-GLOBIOM,SSPDB-SSP2-45-REMIND-MAGPIE, +# * SSPDB-SSP2-60-MESSAGE-GLOBIOM,SSPDB-SSP2-60-REMIND-MAGPIE, +# * SSPDB-SSP2-Ref-MESSAGE-GLOBIOM,SSPDB-SSP2-Ref-REMIND-MAGPIE, +# * SSPDB-SSP3-34-AIM-CGE,SSPDB-SSP3-45-AIM-CGE, +# * SSPDB-SSP3-60-AIM-CGE,SSPDB-SSP4-26-GCAM4, +# * SSPDB-SSP4-34-GCAM4,SSPDB-SSP4-45-GCAM4, +# * SSPDB-SSP4-60-GCAM4,SSPDB-SSP4-Ref-GCAM4, +# * SSPDB-SSP5-20-REMIND-MAGPIE,SSPDB-SSP5-26-REMIND-MAGPIE, +# * SSPDB-SSP5-34-REMIND-MAGPIE,SSPDB-SSP5-37-REMIND-MAGPIE, +# * SSPDB-SSP5-45-REMIND-MAGPIE,SSPDB-SSP5-60-REMIND-MAGPIE, +# * SSPDB-SSP5-Ref-REMIND-MAGPIE, +# * Used for producing coupled runs with REMIND-MAgPIE or for exogenous input (see below) # * coupling # * Note: c60_2ndgen_biodem applies to countries selected in scen_countries60 -# * c60_2ndgen_biodem_noselect applies to all other countries. In default, all countries -# * are selected and only c60_2ndgen_biodem has to be set. -cfg$gms$c60_2ndgen_biodem <- "R2M41-SSP2-NPi" # def = R2M41-SSP2-NPi -cfg$gms$c60_2ndgen_biodem_noselect <- "R2M41-SSP2-NPi" # def = R2M41-SSP2-NPi +# * c60_2ndgen_biodem_noselect applies to all other countries. +cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-NPi" # def = R21M42-SSP2-NPi +cfg$gms$c60_2ndgen_biodem_noselect <- "R21M42-SSP2-NPi" # def = R21M42-SSP2-NPi + +# * The following setting can be used to provide exogenous bioenergy demand +# * via a .mif file that is not part of the input data. This is currently used +# * in the REMIND-MAgPIE coupling to read in the REMIND data. +# * Takes effect only if cfg$gms$c60_2ndgen_biodem is set to "coupling" +cfg$path_to_report_bioenergy <- NA # * Switch and specification of countries for which 2nd gen bioenergy demand # * scenario applies. @@ -1012,6 +1656,11 @@ cfg$gms$c60_res_2ndgenBE_dem <- "ssp2" # def = ssp2 # * (0): global cfg$gms$c60_biodem_level <- 1 # def = 1 +# * Minimum dedicated 2nd generation bioenergy demand assumed in each region (mio. GJ per yr) +# * Without a minimum demand, there is the risk that some regions won't have a price for 2nd generation bioenergy. +# * Therefore, the minimum demand is of particular importance for the coupling with REMIND. +cfg$gms$s60_2ndgen_bioenergy_dem_min <- 1 # def = 1 + # * first generation bioenergy subsidy (USD05MER per ton) cfg$gms$c60_bioenergy_subsidy <- 300 # def = 300 @@ -1020,29 +1669,52 @@ 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 +# * Year until the pasture management factor is fixed to 1 +cfg$gms$s70_past_mngmnt_factor_fix <- "2005" # def = 2005 + # * feed scenario -# * options: ssp1, ssp2, ssp3, ssp4, ssp5, constant +# * options: SSP: ssp1, ssp2, ssp3, ssp4, ssp5 +# * SDP: SDP, SDP_EI, SDP_MC, SDP_RC +# * other: constant cfg$gms$c70_feed_scen <- "ssp2" # def = ssp2 # * Feed substitution scenarios. # * options consist of 3 parts: functional form (lin,sigmoid), target (zero, 20pc, 50pc, 80pc, 90pc) and transition period (10_50: from 2010 to 2050, 20_50: from 2020 to 2050) # * Example for sigmoid_50pc_20_50: -# * Functional form: sigmoid (S-shaped) -# * Target: 50percent reduction at end of transition period (2050 in this case) -# * Transition period: start in 2020, end in 2050 +# * Functional form: sigmoid (S-shaped) +# * Target: 50percent reduction at end of transition period (2050 in this case) +# * Transition period: start in 2020, end in 2050 # * options: 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 # * Cereal feed substituted by SCP cfg$gms$c70_cereal_scp_scen <- "constant" # def = constant -# * Fooder feed substituted by SCP +# * Fodder feed substituted by SCP cfg$gms$c70_foddr_scp_scen <- "constant" # def = constant +# * Regional (reg) or global (glo) regression for livestock factor requirements. +# * Typically, the same version (glo or reg) should be chosen for c38_fac_req +# * for consistency. +cfg$gms$c70_fac_req_regr <- "glo" # def = glo + # ***--------------------- 71_disagg_lvst ----------------------------------- # * (off): default # * (foragebased_aug18): Disaggregation of livestock to cells @@ -1081,12 +1753,12 @@ s73_timber_prod_cost <- 2000 # def = 2000 s73_timber_harvest_cost <- 2000 # def = 2000 # Cost multiplier for harvesting costs to make natural vegetation harvest expensive -# than timber plantation harvst. This provides a signal to the model to harvest +# than timber plantation harvest. This provides a signal to the model to harvest # timber plantations first. s73_cost_multiplier <- 1.5 # def = 1.5 # Cost of production without using any land in case the model is running into infeasibilities. -# This is a last ditch effort for the model and the variable assocaited with this cost +# This is a last ditch effort for the model and the variable associated with this cost # should not be used in a normally feasible model run (USD/tDM) s73_free_prod_cost <- 1000000 # def = 1000000 @@ -1096,12 +1768,34 @@ s73_free_prod_cost <- 1000000 # def = 1000000 # * ("construction") = Higher demand for construction wood in future cfg$gms$c73_wood_scen <- "default" # def = "default" +# Building material demand +# * ("BAU") = Business as usual, only 0.5% of urban dwellers need timber buildings +# * ("10pc") = 10% of urban dwellers need timber buildings +# * ("50pc") = 50% of urban dwellers need timber buildings +# * ("90pc") = 90% of urban dwellers need timber buildings + +cfg$gms$c73_build_demand <- "BAU" # def = "BAU" + +# Linearized multiplier for scaling construction wood demand for easier demand +# scenario tests. The expansion factor is applied over next 80 years starting in +# 2020. +cfg$gms$s73_expansion <- 0 # def = 0 + # ***------------------- 80_optimization ------------------------------------ # * (nlp_apr17): solve procedure solving the whole, nonlinear problem # * at once # * (lp_nlp_apr17): alternative approach in which the nonlinear terms are # * fixed first so that the linear problem can be solved # * before the full problem is solved +# * (nlp_par): Parallel optimization of regions. Allows to use higher +# * spatial resolution but works only with exogenous trade patterns +# * from a run with lower resolution solved with nlp_apr17. +# * Usage: add "extra/highres" as output script. This will start a +# * second model run with higher resolution. +# * Make sure that the cellular input file specified in +# * scripts/output/extra/highres.R exists. +# * See scripts/output/extra/highres.R for details. + cfg$gms$optimization <- "nlp_apr17" # def = nlp_apr17 # maximal number of solve iterations @@ -1120,13 +1814,22 @@ cfg$gms$s80_num_nonopt_allowed <- Inf # * 1: using optfile for specified solver settings # * 0: default settings (optfile will be ignored) -cfg$gms$s80_optfile <- 0 +cfg$gms$s80_optfile <- 1 #*******************************END MODULE SETUP******************************** #### 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 @@ -1136,12 +1839,17 @@ cfg$sequential <- NA # Selection of QOS to be used for submitted runs on cluster. # Will be ignored for all other runs. # * options: short (24h max, no preemption) +# * short_maxMem (same as short but with 16 CPUs and max Memory) # * medium (1 week max, no preemption) # * priority (immediate start, but slots limited to 5 in parallel) +# * priority_maxMem (same as priority but with 16 CPUs and max Memory) # * standby (1 week max, preemption possible) +# * standby_dayMax (24h max, preemption possible) +# * standby_maxMem_dayMax (same as standby_dayMax but with 16 CPUs and max Memory) +# * standby_maxMem (same as standby but with 16 CPUs and max Memory) # * NULL (educated guess of best option based # * available resources) -cfg$qos <- NULL # def = NULL +cfg$qos <- NULL # def = NULL # How should log information be treated? # (0:no output, 2:write to full.log 3:show in console) @@ -1150,7 +1858,7 @@ cfg$logoption <- 2 # Should output.R generate output? # List of output scripts that should be used # Available scripts can be found in scripts/output/ -cfg$output <- c("rds_report","validation","extra/disaggregation") +cfg$output <- c("output_check", "extra/disaggregation", "rds_report") # Set the format for the results folder # :date: is a placeholder for the current time stamp (e.g. "results:date:") @@ -1161,20 +1869,28 @@ cfg$results_folder <- "output/:title::date:" cfg$files2export <- list() # Files that should be copied before MAgPIE is started cfg$files2export$start <- c("input/info.txt", - "modules/10_land/input/avl_land_t_0.5.mz", + "input/avl_land_full_t_0.5.mz", + "input/luh2_side_layers_0.5.mz", "modules/14_yields/input/lpj_yields_0.5.mz", + "modules/22_land_conservation/input/wdpa_baseline_0.5.mz", + "modules/22_land_conservation/input/consv_prio_areas_0.5.mz", + "modules/30_crop/endo_apr21/input/avl_cropland_0.5.mz", "modules/50_nr_soil_budget/input/f50_NitrogenFixationRateNatural_0.5.mz", "modules/50_nr_soil_budget/input/f50_AtmosphericDepositionRates_0.5.mz", + "input/f34_urbanland_0.5.mz", "input/spatial_header.rda", "scripts/run_submit/submit.R", "scripts/run_submit/submit_*.sh", ".Rprofile", - "input/*.spam", - "input/lpj_envflow_total_c200.mz", - "input/lpj_watavail_total_c200.mz", + "input/clustermap*.rds", + "input/lpj_envflow_total_*.mz", + "input/lpj_watavail_total_*.mz", "input/validation.mif", "calib_*.cs3", - "input/spamplot_*.pdf") + "land_conversion_cost_calib_*.cs3", + "input/spamplot_*.pdf", + "input/regionmapping*.csv", + "input/kba_land_0.5.mz") # Files that should be copied after the MAgPIE run is finished cfg$files2export$end <- NULL @@ -1186,9 +1902,15 @@ cfg$runstatistics <- "/p/projects/rd3mod/models/statistics/magpie" # should usually not be changed cfg$model_name <- "MAgPIE" -# model version of the overall model (use extension "-rc" for release candidate -# and "-dev" for developer version) -cfg$model_version <- "4.0-rc" +# a list of additional information characterizing this run. Can be used +# to save relevant information about the run and can, in contrast to all other +# setting, contain list elements which do not exist in the reference +# configuration +cfg$info <- list() + +# Should the restart files of each iteration be kept in the output folder (TRUE) +# or deleted after the run finished (FALSE) +cfg$keep_restarts <- FALSE # Should the model run in developer mode? This will loosen some restrictions, # such as temporary toleration of coding etiquette violations diff --git a/config/scenario_config.csv b/config/scenario_config.csv index 2277111a6c..5d45847bd7 100644 --- a/config/scenario_config.csv +++ b/config/scenario_config.csv @@ -1,45 +1,85 @@ -;cc;nocc;SSP1;SSP2;SSP3;SSP4;SSP5;SDP;BASE;NPI;NDC;coupling;emulator;input;eat_lancet_diet;SUSTAg1;SUSTAg2;SUSTAg3;SUSTAg4;SUSTAg5;ForestryEndo;ForestryExo;ForestryOff -c09_pop_scenario;;;SSP1;SSP2;SSP3;SSP4;SSP5;SSP1;;;;;;;;SSP1;SSP2;SSP3;SSP4;SSP5;;; -c09_gdp_scenario;;;SSP1;SSP2;SSP3;SSP4;SSP5;SSP1;;;;;;;;SSP1;SSP2;SSP3;SSP4;SSP5;;; -c15_food_scenario;;;SSP1;SSP2;SSP3;SSP4;SSP5;SSP1;;;;;;;SSP1;SSP1;SSP2;SSP3;SSP4;SSP5;;; -s15_elastic_demand;;;0;0;0;0;0;0;;;;;;;0;1;1;1;1;1;;; -c15_exo_scen_targetyear;;;;;;;;y2050;;;;;;;y2050;;;;;;;; -s15_exo_waste;;;0;0;0;0;0;1;;;;;;;1;0;0;0;0;0;;; -s15_waste_scen;;;;;;;;1.2;;;;;;;1.2;;;;;;;; -s15_exo_diet;;;0;0;0;0;0;1;;;;;;;1;0;0;0;0;0;;; -c15_kcal_scen;;;;;;;;healthy_BMI;;;;;;;healthy_BMI;;;;;;;; -c15_EAT_scen;;;;;;;;FLX;;;;;;;FLX;;;;;;;; -c21_trade_liberalization;;;l908080r807070;l909090r808080;l909595r809090;l908080r807070;l908080r807070;l908080r807070;;;;;;;;l908080r807070;l909090r808080;l909595r809090;l908080r807070;l908080r807070;;; -s32_max_aff_area;;;Inf;Inf;Inf;Inf;Inf;500;;;;;;;;Inf;Inf;Inf;Inf;Inf;;; -c32_aff_mask;;;noboreal;noboreal;noboreal;noboreal;noboreal;onlytropical;;;;;;;;noboreal;noboreal;noboreal;noboreal;noboreal;;; -c32_aff_policy;;;;;;;;;none;npi;ndc;;;;;;;;;;;; -c35_ad_policy;;;;;;;;;none;npi;ndc;;;;;;;;;;;; -c35_aolc_policy;;;;;;;;;none;npi;ndc;;;;;;;;;;;; -c35_protect_scenario;;;WDPA;WDPA;WDPA;WDPA;WDPA;BH;;;;;;;;WDPA;WDPA;WDPA;WDPA;WDPA;;; -s42_irrig_eff_scenario;;;2;2;2;2;2;3;;;;;;;;1;1;1;1;1;;; -c42_env_flow_policy;;;on;off;off;mixed;on;on;;;;;;;;on;off;off;mixed;on;;; -c50_scen_neff;;;neff65_70_starty2010;neff60_60_starty2010;neff55_60_starty2010;neff65_70_starty2010;neff55_60_starty2010;neff75_80_starty2010;;;;;;;;neff65_70_starty2010;neff60_60_starty2010;neff55_60_starty2010;neff65_70_starty2010;neff55_60_starty2010;;; -c50_scen_neff_noselect;;;neff65_70_starty2010;neff60_60_starty2010;neff55_60_starty2010;neff65_70_starty2010;neff55_60_starty2010;neff75_80_starty2010;;;;;;;;neff65_70_starty2010;neff60_60_starty2010;neff55_60_starty2010;neff65_70_starty2010;neff55_60_starty2010;;; -c55_scen_conf;;;ssp1;ssp2;ssp3;ssp4;ssp5;ssp1;;;;;;;;ssp1;ssp2;ssp3;ssp4;ssp5;;; -c55_scen_conf_noselect;;;ssp1;ssp2;ssp3;ssp4;ssp5;ssp1;;;;;;;;ssp1;ssp2;ssp3;ssp4;ssp5;;; -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;;; -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;;; -maccs;;;;;;;;;;;;;;;;on_sep16;on_sep16;on_sep16;on_sep16;on_sep16;;; -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;;; -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;;; -c60_1stgen_biodem;;;phaseout2020;const2020;const2030;const2020;phaseout2020;phaseout2020;;;;;;;;phaseout2020;const2020;const2030;const2020;phaseout2020;;; -c60_biodem_level;;;;;;;;;;;;1;0;;;;;;;;;; -c60_bioenergy_subsidy;;;;;;;;;;;;;;;;;;;;;;; -c60_res_2ndgenBE_dem;;;ssp1;ssp2;ssp3;ssp4;ssp5;sdp;;;;;;;;ssp1;ssp2;ssp3;ssp4;ssp5;;; -c70_feed_scen;;;ssp1;ssp2;ssp3;ssp4;ssp5;ssp1;;;;;;;;ssp1;ssp2;ssp3;ssp4;ssp5;;; -c_timesteps;;;;;;;;;;;;less_TS;less_TS;;;;;;;;;; -c14_yields_scenario;cc;nocc;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;; -c42_watdem_scenario;cc;nocc;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;; -c43_watavail_scenario;cc;nocc;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;; -c52_carbon_scenario;cc;nocc;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;; -c59_som_scenario;cc;nocc;;;;;;;;;;;;cc;;cc;cc;cc;cc;cc;;; -s32_initial_distribution;;;;;;;;;;;;;;;;;;;;;4;4;0 -s32_hvarea;;;;;;;;;;;;;;;;;;;;;2;1;0 -s35_secdf_distribution;;;;;;;;;;;;;;;;;;;;;2;2;0 -s35_hvarea;;;;;;;;;;;;;;;;;;;;;2;2;0 -s73_timber_demand_switch;;;;;;;;;;;;;;;;;;;;;1;1;0 +;cc;nocc;nocc_hist;SSP1;SSP2;SSP2EU;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;SSP2EU;SSP3;SSP4;SSP5;SSP1;SSP1;SSP1;SSP1;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;; +gms$c09_gdp_scenario;;;;SSP1;SSP2;SSP2EU;SSP3;SSP4;SSP5;SSP1;SDP_EI;SDP_RC;SDP_MC;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;; +gms$c09_pal_scenario;;;;SSP1;SSP2;SSP2EU;SSP3;SSP4;SSP5;SSP1;SSP2;SSP1;SSP1;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;; +gms$c15_food_scenario;;;;SSP1;SSP2;SSP2;SSP3;SSP4;SSP5;SSP1;SSP2;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;0;;;;;;;;;;;;;;;;;; +gms$c15_rumdairy_scp_scen;;;;constant;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;0;1;1;1;1;;;;;;;1;0;0;1;0;0;1;0;0;1;1;;;;;;;;;;;;;; +gms$s15_waste_scen;;;;;;;;;;1.2;1.3;1.2;1.25;;;;;;;1.2;1.2;;1.2;;;1.2;;;;;;;;;;;;;;;;;; +gms$s15_exo_diet;;;;0;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;l909090r808080;l909595r809090;l908080r807070;l908080r807070;l908080r807070;l908080r807070;l909595r809090;l908080r807070;;;;;;;;;l908080r807070;l908080r807070;l908080r807070;l908080r807070;l908080r807070;;;;;;;;;;;;;;;;;; +gms$c22_protect_scenario;;;;none;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;rainfed;all;rainfed;rainfed;;;;;;;rainfed;;;;;;;;;;;;;;;;;;;;;;;; +gms$s30_snv_shr;;;;0;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$s30_snv_scenario_target;;;;;;;;;;;;;2030;;;;;;;;;2030;2030;2030;2030;2030;;;;;;;;;;;;;;;;;; +gms$c31_past_suit_scen;;;;ssp126;ssp245;ssp245;ssp370;ssp460;ssp585;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ssp126;ssp126;ssp245;ssp460;ssp370;ssp585 +gms$s32_aff_plantation;;;;0;0;0;0;0;0;0;1;0;0;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;; +gms$s32_aff_bii_coeff;;;;0;0;0;0;0;0;0;1;0;0;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;; +gms$s32_max_aff_area;;;;Inf;Inf;Inf;Inf;Inf;Inf;500;350;0;700;;;;;;;500;;Inf;Inf;Inf;500;500;;;;;;;;;;;;;;;;;; +gms$c32_aff_mask;;;;noboreal;noboreal;noboreal;noboreal;noboreal;noboreal;onlytropical;onlytropical;onlytropical;onlytropical;;;;;;;onlytropical;;noboreal;noboreal;noboreal;noboreal;noboreal;;;;;;;;;;;;;;;;;; +gms$c34_urban_scenario;;;;SSP1;SSP2;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$s32_planing_horizon;;;;50;50;50;50;50;50;50;30;50;50;;;;;;;50;;;;;;;;;;;;;;;;;;;;;;;; +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;2050;2030;2030;2030;2030;2030;;;;;;;2030;;2030;2030;2030;2030;2030;;;;;;;;;;;;;;;;;; +gms$s42_watdem_nonagr_scenario;;;;1;2;2;3;2;1;1;1;3;1;;;;;;;;;2;1;2;2;1;;;;;;;;;;;;;;;;;; +gms$s42_irrig_eff_scenario;;;;2;2;2;2;2;2;3;3;3;3;;;;;;;3;;3;3;3;3;3;;;;;;;;;;;;;;;;;; +gms$c42_env_flow_policy;;;;on;off;off;off;mixed;on;on;on;on;on;;;;;;;on;;on;on;on;on;on;;;;;;;;;;;;;;;;;; +gms$s42_efp_targetyear;;;;2040;2040;2040;2040;2040;2040;2040;2050;2070;2050;;;;;;;2040;;2040;2040;2040;2040;2040;;;;;;;;;;;;;;;;;; +gms$s44_target_price;;;;0;0;0;0;0;0;0;0;0;0;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;; +gms$c50_scen_neff;;;;baseeff_add3_add10_add20_max75;baseeff_add3_add5_add10_max65;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_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;ssp2;ssp3;ssp4;ssp5;ssp1;ssp1;ssp1;ssp1;;;;;;;ssp1;;ssp1;ssp1;ssp1;ssp1;ssp1;;;;;;;;;;;;;;;;;; +gms$c55_scen_conf_noselect;;;;ssp1;ssp2;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_c_price_exp_aff;;;;50;50;50;50;50;50;50;30;50;50;;;;;;;50;;;;;;;;;;;;;;;;;;;;;;;; +gms$s56_buffer_aff;;;;0.2;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+natveg_nosoil;redd+_nosoil;all_nosoil;;;;;;;redd+natveg_nosoil;;;;;;;;;;;;;;;;;;;;;;;; +gms$s56_minimum_cprice;;;;;;;;;;;;;;0;0;18;;;;;;;;;;;;;;;;;;;;;;;;;;;; +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;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;ssp2;ssp3;ssp4;ssp5;sdp;ssp2;sdp;sdp;;;;;;;sdp;;ssp4;sdp;ssp4;ssp4;sdp;;;;;;;;;;;;;;;;;; +gms$c70_feed_scen;;;;ssp1;ssp2;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.85_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.85_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.85_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.85_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.85_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.85_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..bacf5d1ae8 --- /dev/null +++ b/config/scenario_fsec.csv @@ -0,0 +1,73 @@ +;FSEC;population;institutions;energy;bioplastics;capitalSubst;minWage;noUnderweight;halfOverweight;fruitsNutsVegSeeds;monogastrics;ruminants;pulses;processed;fish;waste;awms;livestock;cropefficiency;nueMAC;riceMAC;biodiversity;fairTrade;timberCities;REDDaff;REDD;landscapeElements;landSharing;landSparing;waterSparing;peatland;soil;allDiet;allDietAndWaste;allEnvPrice;allEmisPrice;SSP1;SSP2;SSP3;SSP4;SSP5;RCP19;RCP26;RCP34;RCP45;RCP60;RCP70;RCP85;SSP1energy +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;half_overweight;endo;endo;endo;endo;endo;endo;endo;;;;;;;;;;;;;;;;;no_underweight_half_overweight;no_underweight_half_overweight;;;;;;;;;;;;;;; +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;;;;;;;;;;;;;;;;;0;0;;;;;;;;;;;;;;; +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$c15_food_scenario;;;SSP1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c21_trade_liberalization;;;;;;;;;;;;;;;;;;;;;;;l908080r807070;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c22_protect_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;BH_IFL;;;;;;;;;;;;;;;;;;;; +gms$crop;penalty_apr22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c30_rotation_scenario;default;;;;;;;;;;;;;;;;;;;;;;;;;;;agroecology;;;;;;;;;;;;;;;;;;;;; +gms$s30_rotation_scenario_target;2050;;;;;;;;;;;;;;;;;;;;;;;;;;;2050;;;;;;;;;;;;;;;;;;;;; +gms$c30_marginal_land;q33_marginal;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c30_bioen_water;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rainfed;;;;;;;;;;;;;;;;;;; +gms$s30_snv_scenario_target;;;;;;;;;;;;;;;;;;;;;;;;;;;2050;;;;;;;;;;;;;;;;;;;;;; +gms$s30_snv_shr;;;;;;;;;;;;;;;;;;;;;;;;;;;0.2;;;;;;;;;;;;;;;;;;;;;; +gms$past;endo_jun13;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c31_past_suit_scen;ssp245;ssp126;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ssp126;ssp126;ssp126;ssp245;ssp370;ssp460;ssp585;ssp126;ssp126;ssp245;ssp245;ssp460;ssp370;ssp585; +gms$c32_aff_policy;;;;;;;;;;;;;;;;;;;;;;;;;ndc;;;;;;;;;;;;;;;;;;;;;;;; +gms$c32_aff_mask;;;;;;;;;;;;;;;;;;;;;;;;;onlytropical;;;;;;;;;;;;;;;;;;;;;;;; +gms$s32_max_aff_area;;;;;;;;;;;;;;;;;;;;;;;;;500;;;;;;;;;;;;;;;;;;;;;;;; +gms$c34_urban_scenario;;SSP1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$s35_forest_damage_end;2050;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2050;2050;2050;2050;2050;;;;;;;; +gms$s36_minimum_wage;0;;;;;;3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$factor_costs;sticky_labor;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c38_fac_req;reg;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$s38_target_labor_share;0;;;;;0.8;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$s42_watdem_nonagr_scenario;;;;1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c42_env_flow_policy;off;;;;;;;;;;;;;;;;;;;;;;;;;;;;;on;;;;;;;;;;;;;;;;;;; +gms$s42_efp_startyear;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2020;;;;;;;;;;;;;;;;;;; +gms$s42_efp_targetyear;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2050;;;;;;;;;;;;;;;;;;; +gms$s44_bii_lower_bound;;;;;;;;;;;;;;;;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c44_bii_decrease;;;;;;;;;;;;;;;;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$nitrogen;rescaled_jan21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c50_scen_neff;;;baseeff_add3_add10_add20_max75;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c50_scen_neff_noselect;;;baseeff_add3_add10_add20_max75;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c52_land_carbon_sink_rcp;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;RCP19;RCP26;RCP34;RCP45;RCP60;RCPBU;RCPBU; +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-SSP2-PkBudg900;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;R21M42-SSP1-PkBudg900 +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.84_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.84_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.84_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.84_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.84_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.84_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.84_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz; +input['regional'];rev4.84_FSEC_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['validation'];rev4.86_FSEC_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['additional'];additional_data_rev4.37.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['calibration'];calibration_FSEC_24Mar23.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +magicc_emis_scen;bjoernAR6_C_SSP2-NDC.mif;;;bjoernAR6_C_SSP2-PkBudg900.mif;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;bjoernAR6_C_SSP1-NDC.mif;;;;;;;;;;;;bjoernAR6_C_SSP1-PkBudg900.mif diff --git a/core/calculations.gms b/core/calculations.gms index 31821df030..c42132a158 100644 --- a/core/calculations.gms +++ b/core/calculations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -32,15 +32,23 @@ file dummy; dummy.pw=2000; put dummy; * clear ct set ct(t) = no; +pt(t) = no; ***************************TIMESTEP LOOP START********************************** -loop (t, +$label TimeLoop +$if not set TIMESTEP $set TIMESTEP 0 -* set ct to current time period - ct(t) = yes; +loop (t$(m_year(t) > %TIMESTEP%), +* set ct to current time period + ct(t) = yes; + pt(t) = yes$(ord(t) = 1); + pt(t-1) = yes$(ord(t) > 1); + display "Year"; display ct; + display "Previous Year"; + display pt; $batinclude "./modules/include.gms" presolve @@ -82,8 +90,12 @@ $batinclude "./modules/include.gms" postsolve **********************WRITE ALL DATA IN 1 GDX FILE****************************** Execute_Unload "fulldata.gdx"; -* clear ct set +* clear ct and pt set ct(t) = no; + pt(t) = no$(ord(t) = 1); + pt(t-1) = no$(ord(t) > 1); + + put_utility 'save' / 'restart_' t.tl:0;; ******************************************************************************** ); ****************************TIMESTEP LOOP END*********************************** diff --git a/core/declarations.gms b/core/declarations.gms index b7867c8311..d9063d43bb 100644 --- a/core/declarations.gms +++ b/core/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,7 +7,7 @@ scalars sm_intersolve if 0 finish loop or if 1 iterate optimization (1) /0/ - sm_fix_SSP2 year until which all parameters are fixed to SSP2 values (year) / 2020 / + ; *** EOF declarations.gms *** diff --git a/core/load_gdx.gms b/core/load_gdx.gms index 3118d5b4a9..ba75e4b3cf 100644 --- a/core/load_gdx.gms +++ b/core/load_gdx.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/core/macros.gms b/core/macros.gms index a0c3aff4b0..1c8bdd6f0f 100644 --- a/core/macros.gms +++ b/core/macros.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -72,3 +72,28 @@ $macro m_fillmissingyears(input,sets) loop(t_all, \ ); \ ct_all(t_all) = no; \ ); + +* macro for linear interpolation +$macro m_linear_interpol(input,start_year,target_year,start_value,target_value) \ + input(t_all)$(m_year(t_all) > start_year AND m_year(t_all) < target_year) = ((m_year(t_all)-start_year) / (target_year-start_year)); \ + input(t_all) = start_value + input(t_all) * (target_value-start_value); \ + input(t_all)$(m_year(t_all) <= start_year) = start_value; \ + input(t_all)$(m_year(t_all) >= target_year) = target_value; + +* macro for sigmoid interpolation (S-shaped curve) +$macro m_sigmoid_interpol(input,start_year,target_year,start_value,target_value) \ + input(t_all)$(m_year(t_all) >= start_year AND m_year(t_all) <= target_year) = ((m_year(t_all)-start_year) / (target_year-start_year)); \ + input(t_all) = 1 / (1 + exp(-10*(input(t_all)-0.5))); \ + input(t_all) = start_value + input(t_all) * (target_value-start_value); \ + input(t_all)$(m_year(t_all) <= start_year) = start_value; \ + input(t_all)$(m_year(t_all) >= target_year) = target_value; + +* macro for simple carbon stocks +$macro m_carbon_stock(land,carbon_density,item) \ + (land(j2,item) * sum(ct,carbon_density(ct,j2,item,ag_pools)))$(sameas(stockType,"actual")) + \ + (land(j2,item) * sum(ct,carbon_density(ct,j2,item,ag_pools)))$(sameas(stockType,"actualNoAcEst")); + +* macro for carbon stocks with age classes +$macro m_carbon_stock_ac(land,carbon_density,sets,sets_sub) \ + sum((&&sets), land(j2,&&sets) * sum(ct, carbon_density(ct,j2,&&sets,ag_pools)))$(sameas(stockType,"actual")) + \ + sum((&&sets_sub), land(j2,&&sets_sub) * sum(ct, carbon_density(ct,j2,&&sets_sub,ag_pools)))$(sameas(stockType,"actualNoAcEst")); diff --git a/core/sets.gms b/core/sets.gms index 14f3d5e60f..13be12ee50 100644 --- a/core/sets.gms +++ b/core/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -9,114 +9,118 @@ *############################################################################### *######################## R SECTION START (SETS) ############################### -*THIS CODE IS CREATED AUTOMATICALLY, DO NOT MODIFY THESE LINES DIRECTLY -*ANY DIRECT MODIFICATION WILL BE LOST AFTER NEXT INPUT DOWNLOAD -*CHANGES CAN BE DONE USING THE INPUT DOWNLOADER UNDER SCRIPTS/DOWNLOAD -*THERE YOU CAN ALSO FIND ADDITIONAL INFORMATION +* THIS CODE IS CREATED AUTOMATICALLY, DO NOT MODIFY THESE LINES DIRECTLY +* ANY DIRECT MODIFICATION WILL BE LOST AFTER NEXT AUTOMATIC UPDATE! sets - i all economic regions / - CAZ,CHA,EUR,IND,JPN,LAM,MEA,NEU,OAS,REF,SSA,USA / - - iso list of iso countries / - 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 / - - j number of LPJ cells / - CAZ_1*CAZ_28, - CHA_29*CHA_52, - EUR_53*EUR_62, - IND_63*IND_69, - JPN_70*JPN_72, - LAM_73*LAM_125, - MEA_126*MEA_142, - NEU_143*NEU_150, - OAS_151*OAS_172, - REF_173*REF_179, - SSA_180*SSA_190, - USA_191*USA_200 / - - cell(i,j) number of LPJ cells per region i / - CAZ . CAZ_1*CAZ_28 - CHA . CHA_29*CHA_52 - EUR . EUR_53*EUR_62 - IND . IND_63*IND_69 - JPN . JPN_70*JPN_72 - LAM . LAM_73*LAM_125 - MEA . MEA_126*MEA_142 - NEU . NEU_143*NEU_150 - OAS . OAS_151*OAS_172 - REF . REF_173*REF_179 - SSA . SSA_180*SSA_190 - USA . USA_191*USA_200 / - - i_to_iso(i,iso) mapping regions to iso countries / - CAZ . (AUS,CAN,HMD,NZL,SPM) - CHA . (CHN,HKG,MAC,TWN) - EUR . (ALA,AUT,BEL,BGR,CYP,CZE,DEU,DNK,ESP,EST) - EUR . (FIN,FRA,FRO,GBR,GGY,GIB,GRC,HRV,HUN,IMN) - EUR . (IRL,ITA,JEY,LTU,LUX,LVA,MLT,NLD,POL,PRT) - EUR . (ROU,SVK,SVN,SWE) - IND . (IND) - JPN . (JPN) - LAM . (ABW,AIA,ARG,ATA,ATG,BES,BHS,BLM,BLZ,BMU) - LAM . (BOL,BRA,BRB,BVT,CHL,COL,CRI,CUB,CUW,CYM) - LAM . (DMA,DOM,ECU,FLK,GLP,GRD,GTM,GUF,GUY,HND) - LAM . (HTI,JAM,KNA,LCA,MAF,MEX,MSR,MTQ,NIC,PAN) - LAM . (PER,PRI,PRY,SGS,SLV,SUR,SXM,TCA,TTO,URY) - LAM . (VCT,VEN,VGB,VIR) - MEA . (ARE,BHR,DZA,EGY,ESH,IRN,IRQ,ISR,JOR,KWT) - MEA . (LBN,LBY,MAR,OMN,PSE,QAT,SAU,SDN,SYR,TUN) - MEA . (YEM) - NEU . (ALB,AND,BIH,CHE,GRL,ISL,LIE,MCO,MKD,MNE) - NEU . (NOR,SJM,SMR,SRB,TUR,VAT) - OAS . (AFG,ASM,ATF,BGD,BRN,BTN,CCK,COK,CXR,FJI) - OAS . (FSM,GUM,IDN,IOT,KHM,KIR,KOR,LAO,LKA,MDV) - OAS . (MHL,MMR,MNG,MNP,MYS,NCL,NFK,NIU,NPL,NRU) - OAS . (PAK,PCN,PHL,PLW,PNG,PRK,PYF,SGP,SLB,THA) - OAS . (TKL,TLS,TON,TUV,UMI,VNM,VUT,WLF,WSM) - REF . (ARM,AZE,BLR,GEO,KAZ,KGZ,MDA,RUS,TJK,TKM) - REF . (UKR,UZB) - SSA . (AGO,BDI,BEN,BFA,BWA,CAF,CIV,CMR,COD,COG) - SSA . (COM,CPV,DJI,ERI,ETH,GAB,GHA,GIN,GMB,GNB) - SSA . (GNQ,KEN,LBR,LSO,MDG,MLI,MOZ,MRT,MUS,MWI) - SSA . (MYT,NAM,NER,NGA,REU,RWA,SEN,SHN,SLE,SOM) - SSA . (SSD,STP,SWZ,SYC,TCD,TGO,TZA,UGA,ZAF,ZMB) - SSA . (ZWE) - USA . (USA) / + h all superregional economic regions + / CAZ, CHA, EUR, IND, JPN, LAM, MEA, NEU, OAS, REF, SSA, USA / + + i all economic regions + / CAZ, CHA, EUR, IND, JPN, LAM, MEA, NEU, OAS, REF, SSA, USA / + + supreg(h,i) mapping of superregions to its regions + / CAZ . (CAZ) + CHA . (CHA) + EUR . (EUR) + IND . (IND) + JPN . (JPN) + LAM . (LAM) + MEA . (MEA) + NEU . (NEU) + OAS . (OAS) + REF . (REF) + SSA . (SSA) + USA . (USA) / + + iso list of iso countries + / 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 / + + j number of LPJ cells + / CAZ_1*CAZ_6, + CHA_7*CHA_23, + EUR_24*EUR_32, + IND_33*IND_40, + JPN_41, + LAM_42*LAM_85, + MEA_86*MEA_111, + NEU_112*NEU_118, + OAS_119*OAS_128, + REF_129*REF_141, + SSA_142*SSA_179, + USA_180*USA_200 / + + cell(i,j) number of LPJ cells per region i + / CAZ . (CAZ_1*CAZ_6) + CHA . (CHA_7*CHA_23) + EUR . (EUR_24*EUR_32) + IND . (IND_33*IND_40) + JPN . (JPN_41) + LAM . (LAM_42*LAM_85) + MEA . (MEA_86*MEA_111) + NEU . (NEU_112*NEU_118) + OAS . (OAS_119*OAS_128) + REF . (REF_129*REF_141) + SSA . (SSA_142*SSA_179) + USA . (USA_180*USA_200) / + + i_to_iso(i,iso) mapping regions to iso countries + / CAZ . (AUS, CAN, HMD, NZL, SPM) + CHA . (CHN, HKG, MAC, TWN) + EUR . (ALA, AUT, BEL, BGR, CYP, CZE, DEU, DNK, ESP, EST, FIN, FRA, FRO) + EUR . (GBR, GGY, GIB, GRC, HRV, HUN, IMN, IRL, ITA, JEY, LTU, LUX, LVA) + EUR . (MLT, NLD, POL, PRT, ROU, SVK, SVN, SWE) + IND . (IND) + JPN . (JPN) + LAM . (ABW, AIA, ARG, ATA, ATG, BES, BHS, BLM, BLZ, BMU, BOL, BRA, BRB) + LAM . (BVT, CHL, COL, CRI, CUB, CUW, CYM, DMA, DOM, ECU, FLK, GLP, GRD) + LAM . (GTM, GUF, GUY, HND, HTI, JAM, KNA, LCA, MAF, MEX, MSR, MTQ, NIC) + LAM . (PAN, PER, PRI, PRY, SGS, SLV, SUR, SXM, TCA, TTO, URY, VCT, VEN) + LAM . (VGB, VIR) + MEA . (ARE, BHR, DZA, EGY, ESH, IRN, IRQ, ISR, JOR, KWT, LBN, LBY, MAR) + MEA . (OMN, PSE, QAT, SAU, SDN, SYR, TUN, YEM) + NEU . (ALB, AND, BIH, CHE, GRL, ISL, LIE, MCO, MKD, MNE, NOR, SJM, SMR) + NEU . (SRB, TUR, VAT) + OAS . (AFG, ASM, ATF, BGD, BRN, BTN, CCK, COK, CXR, FJI, FSM, GUM, IDN) + OAS . (IOT, KHM, KIR, KOR, LAO, LKA, MDV, MHL, MMR, MNG, MNP, MYS, NCL) + OAS . (NFK, NIU, NPL, NRU, PAK, PCN, PHL, PLW, PNG, PRK, PYF, SGP, SLB) + OAS . (THA, TKL, TLS, TON, TUV, UMI, VNM, VUT, WLF, WSM) + REF . (ARM, AZE, BLR, GEO, KAZ, KGZ, MDA, RUS, TJK, TKM, UKR, UZB) + SSA . (AGO, BDI, BEN, BFA, BWA, CAF, CIV, CMR, COD, COG, COM, CPV, DJI) + SSA . (ERI, ETH, GAB, GHA, GIN, GMB, GNB, GNQ, KEN, LBR, LSO, MDG, MLI) + SSA . (MOZ, MRT, MUS, MWI, MYT, NAM, NER, NGA, REU, RWA, SEN, SHN, SLE) + SSA . (SOM, SSD, STP, SWZ, SYC, TCD, TGO, TZA, UGA, ZAF, ZMB, ZWE) + USA . (USA) / ; *######################### R SECTION END (SETS) ################################ *############################################################################### sets + h2(h) Superregional (dynamic set) i2(i) World regions (dynamic set) j2(j) Spatial Clusters (dynamic set) ; + +h2(h) = yes; i2(i) = yes; j2(j) = yes; @@ -163,8 +167,10 @@ sets time_annual Annual extended time steps y1980, y1985, y1990, y1995, y2000, y2005, y2010, y2015 / + ; + set t_past(t_all) Timesteps with observed data $If "%c_past%"== "till_2010" /y1965, y1970, y1975, y1980, y1985, y1990,y1995, y2000, y2005, y2010/; $If "%c_past%"== "till_1965" /y1965/; @@ -183,6 +189,7 @@ $If "%c_timesteps%"== "5year2050" /y1995,y2000,y2005,y2010,y2015,y2020,y2025,y20 $If "%c_timesteps%"== "5year2070" /y1995,y2000,y2005,y2010,y2015,y2020,y2025,y2030,y2035,y2040,y2045,y2050,y2055,y2060,y2065,y2070/; $If "%c_timesteps%"== "quicktest" /y1995,y2010,y2025/; $If "%c_timesteps%"== "quicktest2" /y1995,y2020,y2050,y2100/; +$If "%c_timesteps%"== "calib" /y1995,y2000,y2005,y2010,y2015/; $If "%c_timesteps%"== "1" /y1995/; $If "%c_timesteps%"== "2" /y1995,y2000/; $If "%c_timesteps%"== "3" /y1995,y2000,y2010/; @@ -203,6 +210,7 @@ $If "%c_timesteps%"=="17" /y1995,y2000,y2010,y2020,y2030,y2040,y2050,y2060,y2070 $If "%c_timesteps%"=="past" /y1965,y1970,y1975,y1980,y1985,y1990,y1995,y2000,y2005,y2010/; $If "%c_timesteps%"=="pastandfuture" /y1965,y1970,y1975,y1980,y1985,y1990,y1995,y2000,y2005,y2010,y2015,y2020,y2025,y2030,y2035,y2040,y2045,y2050,y2055,y2060,y2065,y2070,y2075,y2080,y2085,y2090,y2095,y2100/; set ct(t) Current time period; +set pt(t) Previous time period; set ct_all(t_all) Current time period for loops over t_all; alias(t,t2); @@ -230,7 +238,7 @@ sets wat_src Type of water source / surface, ground, technical, ren_ground / ***WATER DEMAND sectors*** - wat_dem Water demand sectors / agriculture, industry, electricity, domestic, ecosystem / + wat_dem Water demand sectors / agriculture, domestic, manufacturing, electricity, ecosystem / ***LAND POOLS*** land Land pools @@ -257,14 +265,6 @@ sets ac105,ac110,ac115,ac120,ac125,ac130,ac135,ac140,ac145, ac150,ac155,acx / - ac_young(ac) age classes young - / ac5,ac10,ac15,ac20,ac25,ac30 / - - ac_mature(ac) age classes mature - / ac35,ac40,ac45,ac50,ac55,ac60,ac65,ac70,ac75,ac80,ac85,ac90, - ac95,ac100,ac105,ac110,ac115,ac120,ac125,ac130,ac135,ac140, - ac145,ac150,ac155,acx / - ac_est(ac) Dynamic subset of age classes for establishment ac_sub(ac) Dynamic subset of age classes excluding establishment @@ -300,30 +300,17 @@ sets primforest_vegc, primforest_litc, primforest_soilc, secdforest_vegc, secdforest_litc, secdforest_soilc, urban_vegc, urban_litc, urban_soilc, other_vegc, other_litc, other_soilc, - beccs/ + peatland/ - emis_source_reg(emis_source) Regional emission sources - / inorg_fert, man_crop, awms, resid, man_past, som, - rice, ent_ferm, beccs / + emis_oneoff(emis_source) oneoff emission sources + / crop_vegc, crop_litc, crop_soilc, past_vegc, past_litc, past_soilc, forestry_vegc, + forestry_litc, forestry_soilc, primforest_vegc, primforest_litc, primforest_soilc, + secdforest_vegc, secdforest_litc, secdforest_soilc, + urban_vegc, urban_litc, urban_soilc, other_vegc, other_litc, other_soilc / - emis_source_cell(emis_source) Cellular emission sources - / crop_vegc, crop_litc, crop_soilc, - past_vegc, past_litc, past_soilc, - forestry_vegc, forestry_litc, forestry_soilc, - primforest_vegc, primforest_litc, primforest_soilc, -secdforest_vegc, secdforest_litc, secdforest_soilc, urban_vegc, urban_litc, urban_soilc, - other_vegc, other_litc, other_soilc / - - emis_co2(emis_source_cell) Land pool CO2 emission sources - / crop_vegc, crop_litc, crop_soilc, - past_vegc, past_litc, past_soilc, - forestry_vegc, forestry_litc, forestry_soilc, - primforest_vegc, primforest_litc, primforest_soilc, -secdforest_vegc, secdforest_litc, secdforest_soilc, urban_vegc, urban_litc, urban_soilc, - other_vegc, other_litc, other_soilc / - - co2_forestry(emis_source_cell) Sources of forestry land CO2 emissions - /forestry_vegc, forestry_litc, forestry_soilc/ + emis_annual(emis_source) annual emission sources + / inorg_fert, man_crop, awms, resid, man_past, som, + rice, ent_ferm, resid_burn, peatland / c_pools Carbon pools /vegc,litc,soilc/ @@ -333,7 +320,7 @@ secdforest_vegc, secdforest_litc, secdforest_soilc, urban_vegc, urban_litc, ***RELATIONSHIPS BETWEEN DIFFERENT SETS*** - emis_land(emis_co2,land,c_pools) Mapping between land and carbon pools + emis_land(emis_oneoff,land,c_pools) Mapping between land and carbon pools /crop_vegc . (crop) . (vegc) crop_litc . (crop) . (litc) crop_soilc . (crop) . (soilc) @@ -357,12 +344,6 @@ secdforest_vegc, secdforest_litc, secdforest_soilc, urban_vegc, urban_litc, other_soilc . (other) . (soilc) / - emis_co2_to_forestry(co2_forestry,c_pools) Mapping between forestry land and carbon pools - /forestry_vegc . (vegc) - forestry_litc . (litc) - forestry_soilc . (soilc) - / - ; alias(ac,ac2); diff --git a/literature.bib b/literature.bib index 0c8a3b0b07..3478c9b626 100644 --- a/literature.bib +++ b/literature.bib @@ -7,1280 +7,1468 @@ @Article{dietrich_magpie4 NUMBER = {4}, PAGES = {1299--1317}, URL = {https://www.geosci-model-dev.net/12/1299/2019/}, - DOI = {10.5194/gmd-12-1299-2019} + DOI = {10.5194/gmd-12-1299-2019}, } @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}, +} + +@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}, } @misc{FAOSTAT, - author = {FAOSTAT}, - title = {{FAOSTAT Database}}, - publisher = {The Food and Agriculture Organization of the United Nations (FAO)}, - year = {2016}, - address = {Rome}, - url = {http://www.fao.org/faostat/en/}, - } + author = {FAOSTAT}, + title = {{FAOSTAT Database}}, + publisher = {The Food and Agriculture Organization of the United Nations (FAO)}, + year = {2016}, + address = {Rome}, + url = {http://www.fao.org/faostat/en/}, +} @techreport{Calzadilla2011GTAP, - author = {Alvaro Calzadilla and Katrin Rehdanz and Richard S.J. Tol}, - title = {The GTAP-W model: Accounting for water use in agriculture}, - number = {1745}, - publisher = {Kiel Institute for the World Economy (IfW)}, - type = {Kiel Working Paper}, - address = {Kiel}, - url = {http://hdl.handle.net/10419/54939}, - year = {2011} + author = {Alvaro Calzadilla and Katrin Rehdanz and Richard S.J. Tol}, + title = {The GTAP-W model: Accounting for water use in agriculture}, + number = {1745}, + publisher = {Kiel Institute for the World Economy (IfW)}, + type = {Kiel Working Paper}, + address = {Kiel}, + url = {http://hdl.handle.net/10419/54939}, + year = {2011} } @article{LUCAS200785, -title = "Long-term reduction potential of non-CO2 greenhouse gases", -journal = "Environmental Science & Policy", -volume = "10", -number = "2", -pages = "85 - 103", -year = "2007", -issn = "1462-9011", -doi = "https://doi.org/10.1016/j.envsci.2006.10.007", -url = "http://www.sciencedirect.com/science/article/pii/S1462901106001316", -author = "Paul L. Lucas and Detlef P. van Vuuren and Jos G.J. Olivier and Michel G.J. den Elzen", -keywords = "Non-CO, Abatement potential, Technology development, Mitigation scenarios" + title = "Long-term reduction potential of non-CO2 greenhouse gases", + journal = "Environmental Science & Policy", + volume = "10", + number = "2", + pages = "85 - 103", + year = "2007", + issn = "1462-9011", + doi = "https://doi.org/10.1016/j.envsci.2006.10.007", + url = "http://www.sciencedirect.com/science/article/pii/S1462901106001316", + author = "Paul L. Lucas and Detlef P. van Vuuren and Jos G.J. Olivier and Michel G.J. den Elzen", + keywords = "Non-CO, Abatement potential, Technology development, Mitigation scenarios" } @techreport{ipcc_2006_2006, - title = {2006 {IPCC} {Guidelines} for {National} {Greenhouse} {Gas} {Inventories}, {Prepared} by the {National} {Greenhouse} {Gas} {Inventories} {Programme}}, - author = {{IPCC}}, - collaborator = {Eggleston, H. S. and Buendia, L. and Miwa, K. and Ngara, T. and Tanabe, K. and Hayama, K.}, - year = {2006}, - file = {V4_02_Ch2_Generic.pdf:D\:\\Dissertation\\Bibliographie\\storage\\GXSDRG43\\V4_02_Ch2_Generic.pdf:application/pdf} + title = {2006 {IPCC} {Guidelines} for {National} {Greenhouse} {Gas} {Inventories}, {Prepared} by the {National} {Greenhouse} {Gas} {Inventories} {Programme}}, + author = {{IPCC}}, + collaborator = {Eggleston, H. S. and Buendia, L. and Miwa, K. and Ngara, T. and Tanabe, K. and Hayama, K.}, + year = {2006}, } - + @article{kreidenweis_pasture_2018, - title = {Pasture intensification is insufficient to relieve pressure on conservation priority areas in open agricultural markets}, - volume = {0}, - copyright = {© 2018 John Wiley \& Sons Ltd}, - issn = {1365-2486}, - url = {https://onlinelibrary.wiley.com/doi/abs/10.1111/gcb.14272}, - doi = {10.1111/gcb.14272}, - abstract = {Agricultural expansion is a leading driver of biodiversity loss across the world, but little is known on how future land-use change may encroach on remaining natural vegetation. This uncertainty is, in part, due to unknown levels of future agricultural intensification and international trade. Using an economic land-use model, we assessed potential future losses of natural vegetation with a focus on how these may threaten biodiversity hotspots and intact forest landscapes. We analysed agricultural expansion under proactive and reactive biodiversity protection scenarios, and for different rates of pasture intensification. We found growing food demand to lead to a significant expansion of cropland at the expense of pastures and natural vegetation. In our reference scenario, global cropland area increased by more than 400 Mha between 2015 and 2050, mostly in Africa and Latin America. Grazing intensification was a main determinant of future land-use change. In Africa, higher rates of pasture intensification resulted in smaller losses of natural vegetation, and reduced pressure on biodiversity hotspots and intact forest landscapes. Investments into raising pasture productivity in conjunction with proactive land-use planning appear essential in Africa to reduce further losses of areas with high conservation value. In Latin America, in contrast, higher pasture productivity resulted in increased livestock exports, highlighting that unchecked trade can reduce the land savings of pasture intensification. Reactive protection of sensitive areas significantly reduced the conversion of natural ecosystems in Latin America. We conclude that protection strategies need to adapt to region-specific trade positions. In regions with a high involvement in international trade, area-based conservation measures should be preferred over strategies aimed at increasing pasture productivity, which by themselves might not be sufficient to protect biodiversity effectively.}, - language = {en}, - number = {0}, - urldate = {2018-05-28}, - journal = {Global Change Biology}, - author = {Kreidenweis, Ulrich and Humpenöder, Florian and Kehoe, Laura and Kuemmerle, Tobias and Bodirsky, Benjamin Leon and Lotze-Campen, Hermann and Popp, Alexander}, - year = {2018}, - keywords = {biodiversity hotspots, grazing intensification, intact forest landscapes, land sparing, land-use modelling, protected areas}, - file = {Full Text PDF:/Users/flo/Zotero/storage/ADJQ3QCI/Kreidenweis et al. - Pasture intensification is insufficient to relieve.pdf:application/pdf;Snapshot:/Users/flo/Zotero/storage/5DJ3IA3A/gcb.html:text/html} + title = {Pasture intensification is insufficient to relieve pressure on conservation priority areas in open agricultural markets}, + volume = {0}, + copyright = {© 2018 John Wiley \& Sons Ltd}, + issn = {1365-2486}, + url = {https://onlinelibrary.wiley.com/doi/abs/10.1111/gcb.14272}, + doi = {10.1111/gcb.14272}, + abstract = {Agricultural expansion is a leading driver of biodiversity loss across the world, but little is known on how future land-use change may encroach on remaining natural vegetation. This uncertainty is, in part, due to unknown levels of future agricultural intensification and international trade. Using an economic land-use model, we assessed potential future losses of natural vegetation with a focus on how these may threaten biodiversity hotspots and intact forest landscapes. We analysed agricultural expansion under proactive and reactive biodiversity protection scenarios, and for different rates of pasture intensification. We found growing food demand to lead to a significant expansion of cropland at the expense of pastures and natural vegetation. In our reference scenario, global cropland area increased by more than 400 Mha between 2015 and 2050, mostly in Africa and Latin America. Grazing intensification was a main determinant of future land-use change. In Africa, higher rates of pasture intensification resulted in smaller losses of natural vegetation, and reduced pressure on biodiversity hotspots and intact forest landscapes. Investments into raising pasture productivity in conjunction with proactive land-use planning appear essential in Africa to reduce further losses of areas with high conservation value. In Latin America, in contrast, higher pasture productivity resulted in increased livestock exports, highlighting that unchecked trade can reduce the land savings of pasture intensification. Reactive protection of sensitive areas significantly reduced the conversion of natural ecosystems in Latin America. We conclude that protection strategies need to adapt to region-specific trade positions. In regions with a high involvement in international trade, area-based conservation measures should be preferred over strategies aimed at increasing pasture productivity, which by themselves might not be sufficient to protect biodiversity effectively.}, + language = {en}, + number = {0}, + urldate = {2018-05-28}, + journal = {Global Change Biology}, + author = {Kreidenweis, Ulrich and Humpenöder, Florian and Kehoe, Laura and Kuemmerle, Tobias and Bodirsky, Benjamin Leon and Lotze-Campen, Hermann and Popp, Alexander}, + year = {2018}, + keywords = {biodiversity hotspots, grazing intensification, intact forest landscapes, land sparing, land-use modelling, protected areas}, } @article{ramankutty_suitability_2002, - title = {The global distribution of cultivable lands: current patterns and sensitivity to possible climate change}, - volume = {11}, - shorttitle = {The global distribution of cultivable lands}, - url = {http://onlinelibrary.wiley.com/doi/10.1046/j.1466-822x.2002.00294.x/full}, - number = {5}, - urldate = {2014-09-04}, - journal = {Global Ecology and Biogeography}, - author = {Ramankutty, Navin and Foley, Jonathan A. and Norman, John and McSweeney, Kevin}, - year = {2002}, - pages = {377--392}, - file = {Ramankutty_etal_GEB2002.pdf:/Users/flo/Zotero/storage/PJAB52Z8/Ramankutty_etal_GEB2002.pdf:application/pdf} + title = {The global distribution of cultivable lands: current patterns and sensitivity to possible climate change}, + volume = {11}, + shorttitle = {The global distribution of cultivable lands}, + url = {http://onlinelibrary.wiley.com/doi/10.1046/j.1466-822x.2002.00294.x/full}, + number = {5}, + urldate = {2014-09-04}, + journal = {Global Ecology and Biogeography}, + author = {Ramankutty, Navin and Foley, Jonathan A. and Norman, John and McSweeney, Kevin}, + year = {2002}, + pages = {377--392}, } @book{lotze-campen_trade-offs_2009, - title = {The trade-offs between agricultural expansion, intensification and trade: a global bio-economic modelling approach}, - publisher = {FORESIGHT Expert Workshop on Global Food Modelling}, - author = {Lotze-Campen, Hermann and Popp, Alexander and Beringer, T. and M\"uller, Christoph and Bondeau, A. and Rost, S. and Lucht, W.}, - year = {2009} + title = {The trade-offs between agricultural expansion, intensification and trade: a global bio-economic modelling approach}, + publisher = {FORESIGHT Expert Workshop on Global Food Modelling}, + author = {Lotze-Campen, Hermann and Popp, Alexander and Beringer, T. and M\"uller, Christoph and Bondeau, A. and Rost, S. and Lucht, W.}, + year = {2009} } @article{lotze-campen_global_2008, - title = {Global food demand, productivity growth, and the scarcity of land and water resources: a spatially explicit mathematical programming approach}, - volume = {39}, - shorttitle = {Global food demand, productivity growth, and the scarcity of land and water resources}, - number = {3}, - journal = {Agricultural Economics}, - author = {Lotze-Campen, Hermann and M\"uller, Christoph and Bondeau, A. and Rost, S. and Popp, Alexander and Lucht, W.}, - year = {2008}, - pages = {325--338}, - file = {Lotze-Campen et al 2008.pdf:D\:\\Dissertation\\Bibliographie\\storage\\XJ27FXP3\\Lotze-Campen et al 2008.pdf:application/pdf} + title = {Global food demand, productivity growth, and the scarcity of land and water resources: a spatially explicit mathematical programming approach}, + volume = {39}, + shorttitle = {Global food demand, productivity growth, and the scarcity of land and water resources}, + number = {3}, + journal = {Agricultural Economics}, + author = {Lotze-Campen, Hermann and M\"uller, Christoph and Bondeau, A. and Rost, S. and Popp, Alexander and Lucht, W.}, + year = {2008}, + pages = {325--338}, } @inproceedings{krause_spatially-explicit_2009, - address = {Beijing, China}, - title = {Spatially-explicit scenarios on global cropland expansion and available forest land in an integrated modelling framework.}, - booktitle = {27th {International} {Association} of {Agricultural} {Economists} {Conference}}, - author = {Krause, Michael and Lotze-Campen, Hermann and Popp, Alexander}, - year = {2009} + address = {Beijing, China}, + title = {Spatially-explicit scenarios on global cropland expansion and available forest land in an integrated modelling framework.}, + booktitle = {27th {International} {Association} of {Agricultural} {Economists} {Conference}}, + author = {Krause, Michael and Lotze-Campen, Hermann and Popp, Alexander}, + year = {2009} } @article{krause_implicit_nodate, - title = {The implicit value of foregone global cropland expansion – {What} is the impact of forest conservation?}, - author = {Krause, Michael and Lotze-Campen, H. and Popp, Alexander} + title = {The implicit value of foregone global cropland expansion – {What} is the impact of forest conservation?}, + author = {Krause, Michael and Lotze-Campen, H. and Popp, Alexander} } @article{lotze-campen_scenarios_2009, - title = {Scenarios of global bioenergy production: {The} trade-offs between agricultural expansion, intensification and trade}, - shorttitle = {Scenarios of global bioenergy production}, - number = {221}, - journal = {Ecological Modelling}, - author = {Lotze-Campen, Hermann and Popp, Alexander and Beringer, Tim and M\"uller, Christoph and Bondeau, A. and Rost, S. and Lucht, W.}, - year = {2009}, - pages = {2188 -- 2196}, - file = {Lotze-Campen et al. - 2009 - Scenarios of global bioenergy production The trad.pdf:D\:\\Dissertation\\Bibliographie\\storage\\EX7Z9G5T\\Lotze-Campen et al. - 2009 - Scenarios of global bioenergy production The trad.pdf:application/pdf} + title = {Scenarios of global bioenergy production: {The} trade-offs between agricultural expansion, intensification and trade}, + shorttitle = {Scenarios of global bioenergy production}, + number = {221}, + journal = {Ecological Modelling}, + author = {Lotze-Campen, Hermann and Popp, Alexander and Beringer, Tim and M\"uller, Christoph and Bondeau, A. and Rost, S. and Lucht, W.}, + year = {2009}, + pages = {2188 -- 2196}, } @article{schmitz_trading_2012, - title = {Trading more food: {Implications} for land use, greenhouse gas emissions, and the food system}, - volume = {22}, - issn = {09593780}, - shorttitle = {Trading more food}, - url = {http://linkinghub.elsevier.com/retrieve/pii/S0959378011001488}, - doi = {10.1016/j.gloenvcha.2011.09.013}, - number = {1}, - urldate = {2011-10-20}, - journal = {Global Environmental Change}, - author = {Schmitz, Christoph and Biewald, Anne and Lotze-Campen, Hermann and Popp, Alexander and Dietrich, Jan Philipp and Bodirsky, Benjamin Leon and Krause, Michael and Weindl, Isabelle}, - year = {2012}, - pages = {189--209}, - file = {main2.pdf:D\:\\Dissertation\\Bibliographie\\storage\\2QX97EZJ\\main2.pdf:application/pdf;Schmitz et al. - 2012 - Trading more food Implications for land use, gree.pdf:D\:\\Dissertation\\Bibliographie\\storage\\MJMK8XRD\\Schmitz et al. - 2012 - Trading more food Implications for land use, gree.pdf:application/pdf} + title = {Trading more food: {Implications} for land use, greenhouse gas emissions, and the food system}, + volume = {22}, + issn = {09593780}, + shorttitle = {Trading more food}, + url = {http://linkinghub.elsevier.com/retrieve/pii/S0959378011001488}, + doi = {10.1016/j.gloenvcha.2011.09.013}, + number = {1}, + urldate = {2011-10-20}, + journal = {Global Environmental Change}, + author = {Schmitz, Christoph and Biewald, Anne and Lotze-Campen, Hermann and Popp, Alexander and Dietrich, Jan Philipp and Bodirsky, Benjamin Leon and Krause, Michael and Weindl, Isabelle}, + year = {2012}, + pages = {189--209}, } @inproceedings{weindl_impact_2010, - address = {Stuttgart, Germany}, - title = {Impact of livestock feeding technologies on global greenhouse gas emissions}, - volume = {91277}, - booktitle = {Climate {Change} in {World} {Agriculture}: {Mitigation}, {Adaptation}, {Trade} and {Food} {Security}}, - publisher = {International Agricultural Trade Research Consortium}, - author = {Weindl, Isabelle and Lotze-Campen, Hermann and Popp, Alexander and Bodirsky, Benjamin Leon and Rolinski, Susanne}, - month = jun, - year = {2010}, - pages = {1--21}, - file = {Weindl et al. - 2010 - Impact of livestock feeding technologies on global.pdf:D\:\\Dissertation\\Bibliographie\\storage\\KRPS6JDF\\Weindl et al. - 2010 - Impact of livestock feeding technologies on global.pdf:application/pdf;weindl_livestock_impacts_on_GHG-updated.ppt:D\:\\Dissertation\\Bibliographie\\storage\\B8J5T4ZR\\weindl_livestock_impacts_on_GHG-updated.ppt:application/msword} + address = {Stuttgart, Germany}, + title = {Impact of livestock feeding technologies on global greenhouse gas emissions}, + volume = {91277}, + booktitle = {Climate {Change} in {World} {Agriculture}: {Mitigation}, {Adaptation}, {Trade} and {Food} {Security}}, + publisher = {International Agricultural Trade Research Consortium}, + author = {Weindl, Isabelle and Lotze-Campen, Hermann and Popp, Alexander and Bodirsky, Benjamin Leon and Rolinski, Susanne}, + month = jun, + year = {2010}, + pages = {1--21}, } @misc{schmitz_implementing_2010, - address = {Penang (Malaysia)}, - title = {Implementing endogenous technological change in a global land-use model.}, - url = {www.gtap.agecon.purdue.edu/resources/download/5584.pdf}, - author = {Schmitz, Christoph and Dietrich, Jan Philipp and Lotze-Campen, Hermann and M\"uller, Christoph and Popp, Alexander}, - month = jun, - year = {2010} + address = {Penang (Malaysia)}, + title = {Implementing endogenous technological change in a global land-use model.}, + url = {www.gtap.agecon.purdue.edu/resources/download/5584.pdf}, + author = {Schmitz, Christoph and Dietrich, Jan Philipp and Lotze-Campen, Hermann and M\"uller, Christoph and Popp, Alexander}, + month = jun, + year = {2010} } @article{popp_additional_2012, - title = {Additional {CO}2 emissions from land use change -- forest conservation as a precondition for sustainable production of second generation bioenergy.}, - volume = {74}, - journal = {Ecological Economics}, - author = {Popp, Alexander and Krause, Michael and Dietrich, Jan Philipp and Lotze-Campen, Hermann and Leimbach, Marian and Beringer, Tim and Bauer, Nico}, - year = {2012}, - pages = {64--70}, - file = {Popp et al. - 2012 - Additional CO2 emissions from land use change -- f.pdf:D\:\\Dissertation\\Bibliographie\\storage\\P4QJS7AC\\Popp et al. - 2012 - Additional CO2 emissions from land use change -- f.pdf:application/pdf} + title = {Additional {CO}2 emissions from land use change -- forest conservation as a precondition for sustainable production of second generation bioenergy.}, + volume = {74}, + journal = {Ecological Economics}, + author = {Popp, Alexander and Krause, Michael and Dietrich, Jan Philipp and Lotze-Campen, Hermann and Leimbach, Marian and Beringer, Tim and Bauer, Nico}, + year = {2012}, + pages = {64--70}, } @article{popp_economic_2011, - title = {The economic potential of bioenergy for climate change mitigation with special attention given to implications for the land system}, - volume = {6}, - number = {034017}, - journal = {Environmental Research Letters}, - author = {Popp, Alexander and Dietrich, Jan Philipp and Lotze-Campen, Hermann and Klein, David and Bauer, N. and Krause, Michael and Beringer, T. and Gerten, D. and Edenhofer, O.}, - year = {2011}, - pages = {1--9}, - file = {Popp et al. - 2011 - The economic potential of bioenergy for climate ch.pdf:D\:\\Dissertation\\Bibliographie\\storage\\H8DJW4WK\\Popp et al. - 2011 - The economic potential of bioenergy for climate ch.pdf:application/pdf} + title = {The economic potential of bioenergy for climate change mitigation with special attention given to implications for the land system}, + volume = {6}, + number = {034017}, + journal = {Environmental Research Letters}, + author = {Popp, Alexander and Dietrich, Jan Philipp and Lotze-Campen, Hermann and Klein, David and Bauer, N. and Krause, Michael and Beringer, T. and Gerten, D. and Edenhofer, O.}, + year = {2011}, + pages = {1--9}, } @article{bodirsky_current_2012, - title = {Current state and future scenarios of the global agricultural nitrogen cycle}, - volume = {9}, - issn = {1810-6285}, - url = {http://www.biogeosciences-discuss.net/9/2755/2012/}, - doi = {10.5194/bgd-9-2755-2012}, - number = {3}, - urldate = {2012-03-13}, - journal = {Biogeosciences Discuss.}, - author = {Bodirsky, Benjamin Leon and Popp, Alexander and Weindl, Isabelle and Dietrich, Jan Philipp and Rolinski, Susanne and Scheiffele, Lena and Schmitz, Christoph and Lotze-Campen, Hermann}, - month = mar, - year = {2012}, - pages = {2755--2821}, - file = {bgd-9-C604-2012.pdf:D\:\\Dissertation\\Bibliographie\\storage\\2XV9TJPV\\bgd-9-C604-2012.pdf:application/pdf;bgd-9-C905-2012.pdf:D\:\\Dissertation\\Bibliographie\\storage\\BH6DPUUV\\bgd-9-C905-2012.pdf:application/pdf;bgd-9-C2463-2012.pdf:D\:\\Dissertation\\Bibliographie\\storage\\PE4WF8B8\\bgd-9-C2463-2012.pdf:application/pdf;Biogeosciences Discuss. PDF:D\:\\Dissertation\\Bibliographie\\storage\\8WUT58K5\\Bodirsky et al. - 2012 - Current state and future scenarios of the global a.pdf:application/pdf;Biogeosciences Discuss. Snapshot:D\:\\Dissertation\\Bibliographie\\storage\\8CAQXZ47\\Bodirsky et al. - 2012 - Current state and future scenarios of the global a.html:text/html} + title = {Current state and future scenarios of the global agricultural nitrogen cycle}, + volume = {9}, + issn = {1810-6285}, + url = {http://www.biogeosciences-discuss.net/9/2755/2012/}, + doi = {10.5194/bgd-9-2755-2012}, + number = {3}, + urldate = {2012-03-13}, + journal = {Biogeosciences Discuss.}, + author = {Bodirsky, Benjamin Leon and Popp, Alexander and Weindl, Isabelle and Dietrich, Jan Philipp and Rolinski, Susanne and Scheiffele, Lena and Schmitz, Christoph and Lotze-Campen, Hermann}, + month = mar, + year = {2012}, + pages = {2755--2821}, } @article{bodirsky_n2o_2012, - title = {N2O emissions from the global agricultural nitrogen cycle – current state and future scenarios}, - volume = {9}, - issn = {1726-4189}, - url = {http://www.biogeosciences.net/9/4169/2012/}, - doi = {10.5194/bg-9-4169-2012}, - number = {10}, - urldate = {2012-10-31}, - journal = {Biogeosciences}, - author = {Bodirsky, Benjamin Leon and Popp, Alexander and Weindl, Isabelle and Dietrich, Jan Philipp and Rolinski, Susanne and Scheiffele, Lena and Schmitz, Christoph and Lotze-Campen, Hermann}, - month = oct, - year = {2012}, - pages = {4169--4197}, - file = {Bodirsky et al. - 2012 - N2O emissions from the global agricultural nitroge.pdf:D\:\\Dissertation\\Bibliographie\\storage\\ICF7BCNT\\Bodirsky et al. - 2012 - N2O emissions from the global agricultural nitroge.pdf:application/pdf;supplementary_model_outputs.xls:D\:\\Dissertation\\Bibliographie\\storage\\3W2RXT8B\\supplementary_model_outputs.xls:application/msword} + title = {N2O emissions from the global agricultural nitrogen cycle – current state and future scenarios}, + volume = {9}, + issn = {1726-4189}, + url = {http://www.biogeosciences.net/9/4169/2012/}, + doi = {10.5194/bg-9-4169-2012}, + number = {10}, + urldate = {2012-10-31}, + journal = {Biogeosciences}, + author = {Bodirsky, Benjamin Leon and Popp, Alexander and Weindl, Isabelle and Dietrich, Jan Philipp and Rolinski, Susanne and Scheiffele, Lena and Schmitz, Christoph and Lotze-Campen, Hermann}, + month = oct, + year = {2012}, + pages = {4169--4197}, } @article{popp_food_2010, - title = {Food consumption, diet shifts and associated non-{CO}2 greenhouse gases from agricultural production}, - volume = {20}, - issn = {09593780}, - url = {http://linkinghub.elsevier.com/retrieve/pii/S0959378010000075}, - doi = {10.1016/j.gloenvcha.2010.02.001}, - number = {3}, - urldate = {2012-10-31}, - journal = {Global Environmental Change}, - author = {Popp, Alexander and Lotze-Campen, Hermann and Bodirsky, Benjamin}, - month = aug, - year = {2010}, - pages = {451--462}, - file = {Food consumption, diet shifts and associated non-CO2 greenhouse gases from agricultural production - 1-s2.0-S0959378010000075-main.pdf:D\:\\Dissertation\\Bibliographie\\storage\\HIEWB6DE\\1-s2.0-S0959378010000075-main.pdf:application/pdf;Popp et al. - 2010 - Food consumption, diet shifts and associated non-C.pdf:D\:\\Dissertation\\Bibliographie\\storage\\9EJQUAT4\\Popp et al. - 2010 - Food consumption, diet shifts and associated non-C.pdf:application/pdf;popp et al.pdf:D\:\\Dissertation\\Bibliographie\\storage\\9CMGNTED\\popp et al.pdf:application/pdf} + title = {Food consumption, diet shifts and associated non-{CO}2 greenhouse gases from agricultural production}, + volume = {20}, + issn = {09593780}, + url = {http://linkinghub.elsevier.com/retrieve/pii/S0959378010000075}, + doi = {10.1016/j.gloenvcha.2010.02.001}, + number = {3}, + urldate = {2012-10-31}, + journal = {Global Environmental Change}, + author = {Popp, Alexander and Lotze-Campen, Hermann and Bodirsky, Benjamin}, + month = aug, + year = {2010}, + pages = {451--462}, } @article{popp_sustainability_2011, - title = {On sustainability of bioenergy production: {Integrating} co-emissions from agricultural intensification}, - volume = {35}, - issn = {09619534}, - shorttitle = {On sustainability of bioenergy production}, - url = {http://linkinghub.elsevier.com/retrieve/pii/S0961953410002230}, - doi = {10.1016/j.biombioe.2010.06.014}, - number = {12}, - urldate = {2012-10-31}, - journal = {Biomass and Bioenergy}, - author = {Popp, Alexander and Lotze-Campen, Hermann and Leimbach, Marian and Knopf, Brigitte and Beringer, Tim and Bauer, Nico and Bodirsky, Benjamin}, - month = dec, - year = {2011}, - pages = {4770--4780}, - file = {Popp et al. - 2010 - On sustainability of bioenergy production Integra.pdf:D\:\\Dissertation\\Bibliographie\\storage\\7REFCZI2\\Popp et al. - 2010 - On sustainability of bioenergy production Integra.pdf:application/pdf} + title = {On sustainability of bioenergy production: {Integrating} co-emissions from agricultural intensification}, + volume = {35}, + issn = {09619534}, + shorttitle = {On sustainability of bioenergy production}, + url = {http://linkinghub.elsevier.com/retrieve/pii/S0961953410002230}, + doi = {10.1016/j.biombioe.2010.06.014}, + number = {12}, + urldate = {2012-10-31}, + journal = {Biomass and Bioenergy}, + author = {Popp, Alexander and Lotze-Campen, Hermann and Leimbach, Marian and Knopf, Brigitte and Beringer, Tim and Bauer, Nico and Bodirsky, Benjamin}, + month = dec, + year = {2011}, + pages = {4770--4780}, } @article{bodirsky_global_2015, - title = {Global food demand scenarios for the 21st century}, - doi = {10.1371/journal.pone.0139201}, - journal = {PLoS ONE}, - author = {Bodirsky, Benjamin Leon and Rolinski, Susanne and Biewald, Anne and Weindl, Isabelle and Popp, Alexander and Lotze-Campen, H.}, - year = {2015}, - file = {Bodirsky et al. - Food demand projections for the 21st century.pdf:D\:\\Dissertation\\Bibliographie\\storage\\URVM3GAD\\Bodirsky et al. - Food demand projections for the 21st century.pdf:application/pdf;Global food demand scenarios for the 21st century.pdf:D\:\\Dissertation\\Bibliographie\\storage\\MWXWJMRU\\Global food demand scenarios for the 21st century.pdf:application/pdf} + title = {Global food demand scenarios for the 21st century}, + doi = {10.1371/journal.pone.0139201}, + journal = {PLoS ONE}, + author = {Bodirsky, Benjamin Leon and Rolinski, Susanne and Biewald, Anne and Weindl, Isabelle and Popp, Alexander and Lotze-Campen, H.}, + year = {2015}, } @article{krause_conservation_2013, - title = {Conservation of undisturbed natural forests and economic impacts on agriculture}, - volume = {30}, - issn = {02648377}, - url = {http://linkinghub.elsevier.com/retrieve/pii/S0264837712000543}, - doi = {10.1016/j.landusepol.2012.03.020}, - number = {1}, - urldate = {2013-02-12}, - journal = {Land Use Policy}, - author = {Krause, Michael and Lotze-Campen, Hermann and Popp, Alexander and Dietrich, Jan Philipp and Bonsch, Markus}, - month = jan, - year = {2013}, - pages = {344--354}, - file = {Krause et al. - 2013 - Conservation of undisturbed natural forests and ec.pdf:D\:\\Dissertation\\Bibliographie\\storage\\TB6XWXH6\\Krause et al. - 2013 - Conservation of undisturbed natural forests and ec.pdf:application/pdf} + title = {Conservation of undisturbed natural forests and economic impacts on agriculture}, + volume = {30}, + issn = {02648377}, + url = {http://linkinghub.elsevier.com/retrieve/pii/S0264837712000543}, + doi = {10.1016/j.landusepol.2012.03.020}, + number = {1}, + urldate = {2013-02-12}, + journal = {Land Use Policy}, + author = {Krause, Michael and Lotze-Campen, Hermann and Popp, Alexander and Dietrich, Jan Philipp and Bonsch, Markus}, + month = jan, + year = {2013}, + pages = {344--354}, } @techreport{bodirsky_how_2009, - title = {How can each sector contribute to 2C?}, - url = {http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.177.8150&rep=rep1&type=pdf}, - urldate = {2013-06-11}, - institution = {PIK Potsdam}, - author = {Bodirsky, Benjamin Leon and Kampman, B. and Lotze-Campen, Hermann and Markowska, A. and Monjon, S. and Neuhoff, K. and Noleppa, S. and Popp, Alexander and del Río González, P. and Spielmans, S. and Strohschein, J.}, - year = {2009}, - file = {Bodirsky et al. - How can each sector contribute to 2C.pdf:D\:\\Dissertation\\Bibliographie\\storage\\WUW8JPDN\\Bodirsky et al. - How can each sector contribute to 2C.pdf:application/pdf} + title = {How can each sector contribute to 2C?}, + url = {http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.177.8150&rep=rep1&type=pdf}, + urldate = {2013-06-11}, + institution = {PIK Potsdam}, + author = {Bodirsky, Benjamin Leon and Kampman, B. and Lotze-Campen, Hermann and Markowska, A. and Monjon, S. and Neuhoff, K. and Noleppa, S. and Popp, Alexander and del Río González, P. and Spielmans, S. and Strohschein, J.}, + year = {2009}, } @article{schmitz_blue_2013, - title = {Blue water scarcity and the economic impacts of future agricultural trade and demand}, - volume = {49}, - copyright = {©2013. American Geophysical Union. All Rights Reserved.}, - issn = {1944-7973}, - url = {http://onlinelibrary.wiley.com/doi/10.1002/wrcr.20188/abstract}, - doi = {10.1002/wrcr.20188}, - abstract = {An increasing demand for agricultural goods affects the pressure on global water resources over the coming decades. In order to quantify these effects, we have developed a new agroeconomic water scarcity indicator, considering explicitly economic processes in the agricultural system. The indicator is based on the water shadow price generated by an economic land use model linked to a global vegetation-hydrology model. Irrigation efficiency is implemented as a dynamic input depending on the level of economic development. We are able to simulate the heterogeneous distribution of water supply and agricultural water demand for irrigation through the spatially explicit representation of agricultural production. This allows in identifying regional hot spots of blue water scarcity and explicit shadow prices for water. We generate scenarios based on moderate policies regarding future trade liberalization and the control of livestock-based consumption, dependent on different population and gross domestic product (GDP) projections. Results indicate increased water scarcity in the future, especially in South Asia, the Middle East, and north Africa. In general, water shadow prices decrease with increasing liberalization, foremost in South Asia, Southeast Asia, and the Middle East. Policies to reduce livestock consumption in developed countries not only lower the domestic pressure on water but also alleviate water scarcity to a large extent in developing countries. It is shown that one of the two policy options would be insufficient for most regions to retain water scarcity in 2045 on levels comparable to 2005.}, - language = {en}, - number = {6}, - urldate = {2013-08-16}, - journal = {Water Resources Research}, - author = {Schmitz, Christoph and Lotze-Campen, Hermann and Gerten, Dieter and Dietrich, Jan Philipp and Bodirsky, Benjamin and Biewald, Anne and Popp, Alexander}, - year = {2013}, - keywords = {water scarcity, land use model, irrigation efficiency, trade liberalization, livestock consumption}, - pages = {3601--3617}, - file = {Full Text PDF:D\:\\Dissertation\\Bibliographie\\storage\\ZKUG46RN\\Schmitz et al. - 2013 - Blue water scarcity and the economic impacts of fu.pdf:application/pdf;Snapshot:D\:\\Dissertation\\Bibliographie\\storage\\4I9N95NZ\\abstract.html:text/html} + title = {Blue water scarcity and the economic impacts of future agricultural trade and demand}, + volume = {49}, + copyright = {©2013. American Geophysical Union. All Rights Reserved.}, + issn = {1944-7973}, + url = {http://onlinelibrary.wiley.com/doi/10.1002/wrcr.20188/abstract}, + doi = {10.1002/wrcr.20188}, + abstract = {An increasing demand for agricultural goods affects the pressure on global water resources over the coming decades. In order to quantify these effects, we have developed a new agroeconomic water scarcity indicator, considering explicitly economic processes in the agricultural system. The indicator is based on the water shadow price generated by an economic land use model linked to a global vegetation-hydrology model. Irrigation efficiency is implemented as a dynamic input depending on the level of economic development. We are able to simulate the heterogeneous distribution of water supply and agricultural water demand for irrigation through the spatially explicit representation of agricultural production. This allows in identifying regional hot spots of blue water scarcity and explicit shadow prices for water. We generate scenarios based on moderate policies regarding future trade liberalization and the control of livestock-based consumption, dependent on different population and gross domestic product (GDP) projections. Results indicate increased water scarcity in the future, especially in South Asia, the Middle East, and north Africa. In general, water shadow prices decrease with increasing liberalization, foremost in South Asia, Southeast Asia, and the Middle East. Policies to reduce livestock consumption in developed countries not only lower the domestic pressure on water but also alleviate water scarcity to a large extent in developing countries. It is shown that one of the two policy options would be insufficient for most regions to retain water scarcity in 2045 on levels comparable to 2005.}, + language = {en}, + number = {6}, + urldate = {2013-08-16}, + journal = {Water Resources Research}, + author = {Schmitz, Christoph and Lotze-Campen, Hermann and Gerten, Dieter and Dietrich, Jan Philipp and Bodirsky, Benjamin and Biewald, Anne and Popp, Alexander}, + year = {2013}, + keywords = {water scarcity, land use model, irrigation efficiency, trade liberalization, livestock consumption}, + pages = {3601--3617}, } @article{bodirsky_stuck_nodate, - title = {Stuck in the {Anthropocene}. {The} case of reactive {Nitrogen}.}, - journal = {Nature Communications}, - author = {Bodirsky, Benjamin Leon and Popp, Alexander and Lotze-Campen, Hermann and Dietrich, Jan Philipp and Rolinski, Susanne and Weindl, Isabelle and Schmitz, Christoph and M\"uller, Christoph and Bonsch, Markus and Humpenöder, Florian and Biewald, Anne and Stevanovic, Miodrag}, - file = {Bodirsky et al_0000_Stuck in the Anthropocene.xls:D\:\\Dissertation\\Bibliographie\\storage\\C5JSJS5U\\Bodirsky et al_0000_Stuck in the Anthropocene.xls:application/msword;Bodirsky et al. - Stuck in the Anthropocene. The case of reactive Ni.pdf:D\:\\Dissertation\\Bibliographie\\storage\\H5NEZFA9\\Bodirsky et al. - Stuck in the Anthropocene. The case of reactive Ni.pdf:application/pdf} + title = {Stuck in the {Anthropocene}. {The} case of reactive {Nitrogen}.}, + journal = {Nature Communications}, + author = {Bodirsky, Benjamin Leon and Popp, Alexander and Lotze-Campen, Hermann and Dietrich, Jan Philipp and Rolinski, Susanne and Weindl, Isabelle and Schmitz, Christoph and M\"uller, Christoph and Bonsch, Markus and Humpenöder, Florian and Biewald, Anne and Stevanovic, Miodrag}, } @article{dietrich_measuring_2012, - title = {Measuring agricultural land-use intensity – {A} global analysis using a model-assisted approach}, - volume = {232}, - issn = {03043800}, - url = {http://linkinghub.elsevier.com/retrieve/pii/S0304380012001093}, - doi = {10.1016/j.ecolmodel.2012.03.002}, - urldate = {2013-10-17}, - journal = {Ecological Modelling}, - author = {Dietrich, Jan Philipp and Schmitz, Christoph and M\"uller, Christoph and Fader, Marianela and Lotze-Campen, Hermann and Popp, Alexander}, - month = may, - year = {2012}, - pages = {109--118}, - file = {Dietrich et al 2012 EcolModelling.pdf:D\:\\Dissertation\\Bibliographie\\storage\\45WT64QX\\Dietrich et al 2012 EcolModelling.pdf:application/pdf} + title = {Measuring agricultural land-use intensity – {A} global analysis using a model-assisted approach}, + volume = {232}, + issn = {03043800}, + url = {http://linkinghub.elsevier.com/retrieve/pii/S0304380012001093}, + doi = {10.1016/j.ecolmodel.2012.03.002}, + urldate = {2013-10-17}, + journal = {Ecological Modelling}, + author = {Dietrich, Jan Philipp and Schmitz, Christoph and M\"uller, Christoph and Fader, Marianela and Lotze-Campen, Hermann and Popp, Alexander}, + month = may, + year = {2012}, + pages = {109--118}, } @article{klein_value_2013, - title = {The value of bioenergy in low stabilization scenarios: an assessment using {REMIND}-{MAgPIE}}, - issn = {0165-0009, 1573-1480}, - shorttitle = {The value of bioenergy in low stabilization scenarios}, - url = {http://link.springer.com/article/10.1007/s10584-013-0940-z}, - doi = {10.1007/s10584-013-0940-z}, - abstract = {This study investigates the use of bioenergy for achieving stringent climate stabilization targets and it analyzes the economic drivers behind the choice of bioenergy technologies. We apply the integrated assessment framework REMIND-MAgPIE to show that bioenergy, particularly if combined with carbon capture and storage (CCS) is a crucial mitigation option with high deployment levels and high technology value. If CCS is available, bioenergy is exclusively used with CCS. We find that the ability of bioenergy to provide negative emissions gives rise to a strong nexus between biomass prices and carbon prices. Ambitious climate policy could result in bioenergy prices of 70 /GJ(oreven430/GJ (or even 430 /GJ if bioenergy potential is limited to 100 EJ/year), which indicates a strong demand for bioenergy. For low stabilization scenarios with BECCS availability, we find that the carbon value of biomass tends to exceed its pure energy value. Therefore, the driving factor behind investments into bioenergy conversion capacities for electricity and hydrogen production are the revenues generated from negative emissions, rather than from energy production. However, in REMIND modern bioenergy is predominantly used to produce low-carbon fuels, since the transport sector has significantly fewer low-carbon alternatives to biofuels than the power sector. Since negative emissions increase the amount of permissible emissions from fossil fuels, given a climate target, bioenergy acts as a complement to fossils rather than a substitute. This makes the short-term and long-term deployment of fossil fuels dependent on the long-term availability of BECCS.}, - language = {en}, - urldate = {2013-10-09}, - journal = {Climatic Change}, - author = {Klein, David and Luderer, Gunnar and Kriegler, Elmar and Strefler, Jessica and Bauer, Nico and Leimbach, Marian and Popp, Alexander and Dietrich, Jan Philipp and Humpenöder, Florian and Lotze-Campen, Hermann and Edenhofer, Ottmar}, - year = {2013}, - keywords = {Atmospheric Sciences, Climate Change Impacts}, - pages = {1--14}, - file = {Klein et al_The value of bioenergy in low stabilization scenarios.pdf:D\:\\Dissertation\\Bibliographie\\storage\\DF9W32JG\\Klein et al_The value of bioenergy in low stabilization scenarios.pdf:application/pdf;Snapshot:D\:\\Dissertation\\Bibliographie\\storage\\KIDBMZJI\\s10584-013-0940-z.html:text/html} + title = {The value of bioenergy in low stabilization scenarios: an assessment using {REMIND}-{MAgPIE}}, + issn = {0165-0009, 1573-1480}, + shorttitle = {The value of bioenergy in low stabilization scenarios}, + url = {http://link.springer.com/article/10.1007/s10584-013-0940-z}, + doi = {10.1007/s10584-013-0940-z}, + abstract = {This study investigates the use of bioenergy for achieving stringent climate stabilization targets and it analyzes the economic drivers behind the choice of bioenergy technologies. We apply the integrated assessment framework REMIND-MAgPIE to show that bioenergy, particularly if combined with carbon capture and storage (CCS) is a crucial mitigation option with high deployment levels and high technology value. If CCS is available, bioenergy is exclusively used with CCS. We find that the ability of bioenergy to provide negative emissions gives rise to a strong nexus between biomass prices and carbon prices. Ambitious climate policy could result in bioenergy prices of 70 /GJ(oreven430/GJ (or even 430 /GJ if bioenergy potential is limited to 100 EJ/year), which indicates a strong demand for bioenergy. For low stabilization scenarios with BECCS availability, we find that the carbon value of biomass tends to exceed its pure energy value. Therefore, the driving factor behind investments into bioenergy conversion capacities for electricity and hydrogen production are the revenues generated from negative emissions, rather than from energy production. However, in REMIND modern bioenergy is predominantly used to produce low-carbon fuels, since the transport sector has significantly fewer low-carbon alternatives to biofuels than the power sector. Since negative emissions increase the amount of permissible emissions from fossil fuels, given a climate target, bioenergy acts as a complement to fossils rather than a substitute. This makes the short-term and long-term deployment of fossil fuels dependent on the long-term availability of BECCS.}, + language = {en}, + urldate = {2013-10-09}, + journal = {Climatic Change}, + author = {Klein, David and Luderer, Gunnar and Kriegler, Elmar and Strefler, Jessica and Bauer, Nico and Leimbach, Marian and Popp, Alexander and Dietrich, Jan Philipp and Humpenöder, Florian and Lotze-Campen, Hermann and Edenhofer, Ottmar}, + year = {2013}, + keywords = {Atmospheric Sciences, Climate Change Impacts}, + pages = {1--14}, } @article{dietrich_forecasting_2014, - title = {Forecasting technological change in agriculture—{An} endogenous implementation in a global land use model}, - volume = {81}, - issn = {00401625}, - url = {http://edoc.gfz-potsdam.de/pik/display.epl?mode=doc&id=5818}, - doi = {10.1016/j.techfore.2013.02.003}, - urldate = {2013-10-17}, - journal = {Technological Forecasting and Social Change}, - author = {Dietrich, Jan Philipp and Schmitz, Christoph and Lotze-Campen, Hermann and Popp, Alexander and M\"uller, Christoph}, - year = {2014}, - pages = {236--249}, + title = {Forecasting technological change in agriculture—{An} endogenous implementation in a global land use model}, + volume = {81}, + issn = {00401625}, + url = {http://edoc.gfz-potsdam.de/pik/display.epl?mode=doc&id=5818}, + doi = {10.1016/j.techfore.2013.02.003}, + urldate = {2013-10-17}, + journal = {Technological Forecasting and Social Change}, + author = {Dietrich, Jan Philipp and Schmitz, Christoph and Lotze-Campen, Hermann and Popp, Alexander and M\"uller, Christoph}, + year = {2014}, + pages = {236--249}, } @article{dietrich_reducing_2013, - title = {Reducing the loss of information and gaining accuracy with clustering methods in a global land-use model}, - volume = {263}, - issn = {0304-3800}, - url = {http://www.sciencedirect.com/science/article/pii/S0304380013002603}, - doi = {10.1016/j.ecolmodel.2013.05.009}, - abstract = {Abstract + title = {Reducing the loss of information and gaining accuracy with clustering methods in a global land-use model}, + volume = {263}, + issn = {0304-3800}, + url = {http://www.sciencedirect.com/science/article/pii/S0304380013002603}, + doi = {10.1016/j.ecolmodel.2013.05.009}, + abstract = {Abstract Global land-use models have to deal with processes on several spatial scales, ranging from the global scale down to the farm level. The increasing complexity of modern land-use models combined with the problem of limited computational resources represents a challenge to modelers. One solution of this problem is to perform spatial aggregation based on a regular grid or administrative units such as countries. Unfortunately this type of aggregation flattens many regional differences and produces a homogenized map of the world. In this paper we present an alternative aggregation approach using clustering methods. Clustering reduces the loss of information due to aggregation by choosing an appropriate aggregation pattern. We investigate different clustering methods, examining their quality in terms of information conservation. Our results indicate that clustering is always a good choice and preferable compared to grid-based aggregation. Although all the clustering methods we tested delivered a higher degree of information conservation than grid-based aggregation, the choice of clustering method is not arbitrary. Comparing outputs of a model fed with original data and a model fed with aggregated data, bottom-up clustering delivered the best results for the whole range of numbers of clusters tested.}, - urldate = {2013-11-15}, - journal = {Ecological Modelling}, - author = {Dietrich, Jan Philipp and Popp, Alexander and Lotze-Campen, Hermann}, - month = aug, - year = {2013}, - keywords = {land use model, Aggregation, Downscaling, Clustering, Information conservation, Scale}, - pages = {233--243}, - file = {Reducing the loss of information and gaining accuracy with clustering methods in a global land-use model - 1-s2.0-S0304380013002603-main.pdf:D\:\\Dissertation\\Bibliographie\\storage\\US8NUNNB\\1-s2.0-S0304380013002603-main.pdf:application/pdf;ScienceDirect Snapshot:D\:\\Dissertation\\Bibliographie\\storage\\GWA63H4U\\S0304380013002603.html:text/html} + urldate = {2013-11-15}, + journal = {Ecological Modelling}, + author = {Dietrich, Jan Philipp and Popp, Alexander and Lotze-Campen, Hermann}, + month = aug, + year = {2013}, + keywords = {land use model, Aggregation, Downscaling, Clustering, Information conservation, Scale}, + pages = {233--243}, } @article{bodirsky_reactive_2014, - title = {Reactive nitrogen requirements to feed the world in 2050 and potential to mitigate nitrogen pollution}, - volume = {5}, - issn = {2041-1723}, - url = {http://www.nature.com/doifinder/10.1038/ncomms4858}, - doi = {10.1038/ncomms4858}, - urldate = {2014-05-13}, - journal = {Nature Communications}, - author = {Bodirsky, Benjamin Leon and Popp, Alexander and Lotze-Campen, Hermann and Dietrich, Jan Philipp and Rolinski, Susanne and Weindl, Isabelle and Schmitz, Christoph and M\"uller, Christoph and Bonsch, Markus and Humpenöder, Florian and Biewald, Anne and Stevanovic, Miodrag}, - month = may, - year = {2014}, - file = {Bodirsky et al. - 2014 - Reactive nitrogen requirements to feed the world i.pdf:D\:\\Dissertation\\Bibliographie\\storage\\R7XMSXPR\\Bodirsky et al. - 2014 - Reactive nitrogen requirements to feed the world i.pdf:application/pdf;Supplementary Data 1_Bodirsky et al_2014_Reactive nitrogen requirements to feed the world in 2050 and potential to.xls:D\:\\Dissertation\\Bibliographie\\storage\\RQFP2NNQ\\Bodirsky et al_2014_Reactive nitrogen requirements to feed the world in 2050 and potential to.xls:application/msword;Supplementary Data 2_Bodirsky et al_2014_Reactive nitrogen requirements to feed the world in 2050 and potential to.xls:D\:\\Dissertation\\Bibliographie\\storage\\8S5EJV5D\\Bodirsky et al_2014_Reactive nitrogen requirements to feed the world in 2050 and potential to.xls:application/msword} + title = {Reactive nitrogen requirements to feed the world in 2050 and potential to mitigate nitrogen pollution}, + volume = {5}, + issn = {2041-1723}, + url = {http://www.nature.com/doifinder/10.1038/ncomms4858}, + doi = {10.1038/ncomms4858}, + urldate = {2014-05-13}, + journal = {Nature Communications}, + author = {Bodirsky, Benjamin Leon and Popp, Alexander and Lotze-Campen, Hermann and Dietrich, Jan Philipp and Rolinski, Susanne and Weindl, Isabelle and Schmitz, Christoph and M\"uller, Christoph and Bonsch, Markus and Humpenöder, Florian and Biewald, Anne and Stevanovic, Miodrag}, + month = may, + year = {2014}, } @article{humpenoder_investigating_2014, - title = {Investigating afforestation and bioenergy {CCS} as climate change mitigation strategies}, - volume = {9}, - issn = {1748-9326}, - url = {http://stacks.iop.org/1748-9326/9/i=6/a=064029?key=crossref.5fa44a1462d2acebebaa002315d8e4a6}, - doi = {10.1088/1748-9326/9/6/064029}, - number = {6}, - urldate = {2014-06-24}, - journal = {Environmental Research Letters}, - author = {Humpenöder, Florian and Popp, Alexander and Dietrich, Jan Philip and Klein, David and Lotze-Campen, Hermann and Bonsch, Markus and Bodirsky, Benjamin Leon and Weindl, Isabelle and Stevanovic, Miodrag and M\"uller, Christoph}, - month = may, - year = {2014}, - pages = {064029}, - file = {1748-9326_9_6_064029.pdf:D\:\\Dissertation\\Bibliographie\\storage\\5EI6J7WN\\1748-9326_9_6_064029.pdf:application/pdf} + title = {Investigating afforestation and bioenergy {CCS} as climate change mitigation strategies}, + volume = {9}, + issn = {1748-9326}, + url = {http://stacks.iop.org/1748-9326/9/i=6/a=064029?key=crossref.5fa44a1462d2acebebaa002315d8e4a6}, + doi = {10.1088/1748-9326/9/6/064029}, + number = {6}, + urldate = {2014-06-24}, + journal = {Environmental Research Letters}, + author = {Humpenöder, Florian and Popp, Alexander and Dietrich, Jan Philip and Klein, David and Lotze-Campen, Hermann and Bonsch, Markus and Bodirsky, Benjamin Leon and Weindl, Isabelle and Stevanovic, Miodrag and M\"uller, Christoph}, + month = may, + year = {2014}, + pages = {064029}, } @article{klein_global_2014, - title = {The global economic long-term potential of modern biomass in a climate-constrained world}, - volume = {9}, - issn = {1748-9326}, - url = {http://iopscience.iop.org/1748-9326/9/7/074017}, - doi = {10.1088/1748-9326/9/7/074017}, - abstract = {Low-stabilization scenarios consistent with the 2 °C target project large-scale deployment of purpose-grown lignocellulosic biomass. In case a GHG price regime integrates emissions from energy conversion and from land-use/land-use change, the strong demand for bioenergy and the pricing of terrestrial emissions are likely to coincide. We explore the global potential of purpose-grown lignocellulosic biomass and ask the question how the supply prices of biomass depend on prices for greenhouse gas (GHG) emissions from the land-use sector. Using the spatially explicit global land-use optimization model MAgPIE, we construct bioenergy supply curves for ten world regions and a global aggregate in two scenarios, with and without a GHG tax. We find that the implementation of GHG taxes is crucial for the slope of the supply function and the GHG emissions from the land-use sector. Global supply prices start at \$5 GJ−1 and increase almost linearly, doubling at 150 EJ (in 2055 and 2095). The GHG tax increases bioenergy prices by \$5 GJ−1 in 2055 and by \$10 GJ−1 in 2095, since it effectively stops deforestation and thus excludes large amounts of high-productivity land. Prices additionally increase due to costs for N2O emissions from fertilizer use. The GHG tax decreases global land-use change emissions by one-third. However, the carbon emissions due to bioenergy production increase by more than 50\% from conversion of land that is not under emission control. Average yields required to produce 240 EJ in 2095 are roughly 600 GJ ha−1 yr−1 with and without tax.}, - language = {en}, - number = {7}, - urldate = {2014-08-06}, - journal = {Environmental Research Letters}, - author = {Klein, David and Humpenöder, Florian and Bauer, Nico and Dietrich, Jan Philipp and Popp, Alexander and Bodirsky, Benjamin Leon and Bonsch, Markus and Lotze-Campen, Hermann}, - year = {2014}, - pages = {074017}, - file = {Klein et al_2014_The global economic long-term potential of modern biomass in a.pdf:D\:\\Dissertation\\Bibliographie\\storage\\59HJI5RF\\Klein et al_2014_The global economic long-term potential of modern biomass in a.pdf:application/pdf;Snapshot:D\:\\Dissertation\\Bibliographie\\storage\\4SGCT3IG\\074017.html:text/html} + title = {The global economic long-term potential of modern biomass in a climate-constrained world}, + volume = {9}, + issn = {1748-9326}, + url = {http://iopscience.iop.org/1748-9326/9/7/074017}, + doi = {10.1088/1748-9326/9/7/074017}, + abstract = {Low-stabilization scenarios consistent with the 2 °C target project large-scale deployment of purpose-grown lignocellulosic biomass. In case a GHG price regime integrates emissions from energy conversion and from land-use/land-use change, the strong demand for bioenergy and the pricing of terrestrial emissions are likely to coincide. We explore the global potential of purpose-grown lignocellulosic biomass and ask the question how the supply prices of biomass depend on prices for greenhouse gas (GHG) emissions from the land-use sector. Using the spatially explicit global land-use optimization model MAgPIE, we construct bioenergy supply curves for ten world regions and a global aggregate in two scenarios, with and without a GHG tax. We find that the implementation of GHG taxes is crucial for the slope of the supply function and the GHG emissions from the land-use sector. Global supply prices start at \$5 GJ−1 and increase almost linearly, doubling at 150 EJ (in 2055 and 2095). The GHG tax increases bioenergy prices by \$5 GJ−1 in 2055 and by \$10 GJ−1 in 2095, since it effectively stops deforestation and thus excludes large amounts of high-productivity land. Prices additionally increase due to costs for N2O emissions from fertilizer use. The GHG tax decreases global land-use change emissions by one-third. However, the carbon emissions due to bioenergy production increase by more than 50\% from conversion of land that is not under emission control. Average yields required to produce 240 EJ in 2095 are roughly 600 GJ ha−1 yr−1 with and without tax.}, + language = {en}, + number = {7}, + urldate = {2014-08-06}, + journal = {Environmental Research Letters}, + author = {Klein, David and Humpenöder, Florian and Bauer, Nico and Dietrich, Jan Philipp and Popp, Alexander and Bodirsky, Benjamin Leon and Bonsch, Markus and Lotze-Campen, Hermann}, + year = {2014}, + pages = {074017}, } @article{lotze-campen_impacts_2014, - title = {Impacts of increased bioenergy demand on global food markets: an {AgMIP} economic model intercomparison}, - volume = {45}, - issn = {01695150}, - shorttitle = {Impacts of increased bioenergy demand on global food markets}, - url = {http://doi.wiley.com/10.1111/agec.12092}, - doi = {10.1111/agec.12092}, - language = {en}, - number = {1}, - urldate = {2014-10-14}, - journal = {Agricultural Economics}, - author = {Lotze-Campen, Hermann and von Lampe, Martin and Kyle, Page and Fujimori, Shinichiro and Havlik, Petr and van Meijl, Hans and Hasegawa, Tomoko and Popp, Alexander and Schmitz, Christoph and Tabeau, Andrzej and Valin, Hugo and Willenbockel, Dirk and Wise, Marshall}, - month = jan, - year = {2014}, - pages = {103--116}, - file = {agec12092.pdf:D\:\\Dissertation\\Bibliographie\\storage\\S7VJTC5H\\agec12092.pdf:application/pdf} + title = {Impacts of increased bioenergy demand on global food markets: an {AgMIP} economic model intercomparison}, + volume = {45}, + issn = {01695150}, + shorttitle = {Impacts of increased bioenergy demand on global food markets}, + url = {http://doi.wiley.com/10.1111/agec.12092}, + doi = {10.1111/agec.12092}, + language = {en}, + number = {1}, + urldate = {2014-10-14}, + journal = {Agricultural Economics}, + author = {Lotze-Campen, Hermann and von Lampe, Martin and Kyle, Page and Fujimori, Shinichiro and Havlik, Petr and van Meijl, Hans and Hasegawa, Tomoko and Popp, Alexander and Schmitz, Christoph and Tabeau, Andrzej and Valin, Hugo and Willenbockel, Dirk and Wise, Marshall}, + month = jan, + year = {2014}, + pages = {103--116}, } @article{bonsch_trade-offs_2014, - title = {Trade-offs between land and water requirements for large-scale bioenergy production}, - copyright = {© 2014 John Wiley \& Sons Ltd}, - issn = {1757-1707}, - url = {http://onlinelibrary.wiley.com/doi/10.1111/gcbb.12226/abstract}, - doi = {10.1111/gcbb.12226}, - abstract = {Bioenergy is expected to play an important role in the future energy mix as it can substitute fossil fuels and contribute to climate change mitigation. However, large-scale bioenergy cultivation may put substantial pressure on land and water resources. While irrigated bioenergy production can reduce the pressure on land due to higher yields, associated irrigation water requirements may lead to degradation of freshwater ecosystems and to conflicts with other potential users. In this article, we investigate the trade-offs between land and water requirements of large-scale bioenergy production. To this end, we adopt an exogenous demand trajectory for bioenergy from dedicated energy crops, targeted at limiting greenhouse gas emissions in the energy sector to 1100 Gt carbon dioxide equivalent until 2095. We then use the spatially explicit global land- and water-use allocation model MAgPIE to project the implications of this bioenergy target for global land and water resources. We find that producing 300 EJ yr−1 of bioenergy in 2095 from dedicated bioenergy crops is likely to double agricultural water withdrawals if no explicit water protection policies are implemented. Since current human water withdrawals are dominated by agriculture and already lead to ecosystem degradation and biodiversity loss, such a doubling will pose a severe threat to freshwater ecosystems. If irrigated bioenergy production is prohibited to prevent negative impacts of bioenergy cultivation on water resources, bioenergy land requirements for meeting a 300 EJ yr−1 bioenergy target increase substantially (+ 41\%) – mainly at the expense of pasture areas and tropical forests. Thus, avoiding negative environmental impacts of large-scale bioenergy production will require policies that balance associated water and land requirements.}, - language = {en}, - urldate = {2014-11-07}, - journal = {GCB Bioenergy}, - author = {Bonsch, Markus and Humpenöder, Florian and Popp, Alexander and Bodirsky, Benjamin and Dietrich, Jan Philipp and Rolinski, Susanne and Biewald, Anne and Lotze-Campen, Hermann and Weindl, Isabelle and Gerten, Dieter and Stevanovic, Miodrag}, - month = nov, - year = {2014}, - keywords = {sustainability, Bioenergy, land, land-use model, projection, water, water-land nexus}, - pages = {n/a--n/a}, - file = {Full Text PDF:D\:\\Dissertation\\Bibliographie\\storage\\CEBG4ARI\\Bonsch et al. - 2014 - Trade-offs between land and water requirements for.pdf:application/pdf;Snapshot:D\:\\Dissertation\\Bibliographie\\storage\\NP2ZIC24\\abstract.html:text/html} + title = {Trade-offs between land and water requirements for large-scale bioenergy production}, + copyright = {© 2014 John Wiley \& Sons Ltd}, + issn = {1757-1707}, + url = {http://onlinelibrary.wiley.com/doi/10.1111/gcbb.12226/abstract}, + doi = {10.1111/gcbb.12226}, + abstract = {Bioenergy is expected to play an important role in the future energy mix as it can substitute fossil fuels and contribute to climate change mitigation. However, large-scale bioenergy cultivation may put substantial pressure on land and water resources. While irrigated bioenergy production can reduce the pressure on land due to higher yields, associated irrigation water requirements may lead to degradation of freshwater ecosystems and to conflicts with other potential users. In this article, we investigate the trade-offs between land and water requirements of large-scale bioenergy production. To this end, we adopt an exogenous demand trajectory for bioenergy from dedicated energy crops, targeted at limiting greenhouse gas emissions in the energy sector to 1100 Gt carbon dioxide equivalent until 2095. We then use the spatially explicit global land- and water-use allocation model MAgPIE to project the implications of this bioenergy target for global land and water resources. We find that producing 300 EJ yr−1 of bioenergy in 2095 from dedicated bioenergy crops is likely to double agricultural water withdrawals if no explicit water protection policies are implemented. Since current human water withdrawals are dominated by agriculture and already lead to ecosystem degradation and biodiversity loss, such a doubling will pose a severe threat to freshwater ecosystems. If irrigated bioenergy production is prohibited to prevent negative impacts of bioenergy cultivation on water resources, bioenergy land requirements for meeting a 300 EJ yr−1 bioenergy target increase substantially (+ 41\%) – mainly at the expense of pasture areas and tropical forests. Thus, avoiding negative environmental impacts of large-scale bioenergy production will require policies that balance associated water and land requirements.}, + language = {en}, + urldate = {2014-11-07}, + journal = {GCB Bioenergy}, + author = {Bonsch, Markus and Humpenöder, Florian and Popp, Alexander and Bodirsky, Benjamin and Dietrich, Jan Philipp and Rolinski, Susanne and Biewald, Anne and Lotze-Campen, Hermann and Weindl, Isabelle and Gerten, Dieter and Stevanovic, Miodrag}, + month = nov, + year = {2014}, + keywords = {sustainability, Bioenergy, land, land-use model, projection, water, water-land nexus}, + pages = {n/a--n/a}, } @article{popp_land-use_2014, - title = {Land-use protection for climate change mitigation}, - volume = {4}, - copyright = {© 2014 Nature Publishing Group}, - issn = {1758-678X}, - url = {http://www.nature.com/nclimate/journal/vaop/ncurrent/full/nclimate2444.html}, - doi = {10.1038/nclimate2444}, - abstract = {Land-use change, mainly the conversion of tropical forests to agricultural land, is a massive source of carbon emissions and contributes substantially to global warming. Therefore, mechanisms that aim to reduce carbon emissions from deforestation are widely discussed. A central challenge is the avoidance of international carbon leakage if forest conservation is not implemented globally. Here, we show that forest conservation schemes, even if implemented globally, could lead to another type of carbon leakage by driving cropland expansion in non-forested areas that are not subject to forest conservation schemes (non-forest leakage). These areas have a smaller, but still considerable potential to store carbon. We show that a global forest policy could reduce carbon emissions by 77 Gt CO2, but would still allow for decreases in carbon stocks of non-forest land by 96 Gt CO2 until 2100 due to non-forest leakage effects. Furthermore, abandonment of agricultural land and associated carbon uptake through vegetation regrowth is hampered. Effective mitigation measures thus require financing structures and conservation investments that cover the full range of carbon-rich ecosystems. However, our analysis indicates that greater agricultural productivity increases would be needed to compensate for such restrictions on agricultural expansion.}, - language = {en}, - urldate = {2014-11-17}, - journal = {Nature Climate Change}, - author = {Popp, Alexander and Humpenöder, Florian and Weindl, Isabelle and Bodirsky, Benjamin Leon and Bonsch, Markus and Lotze-Campen, Hermann and M\"uller, Christoph and Biewald, Anne and Rolinski, Susanne and Stevanovic, Miodrag and Dietrich, Jan Philipp}, - month = nov, - year = {2014}, - pages = {1095--1098}, - file = {Popp et al_2014_Land-use protection for climate change mitigation.pdf:D\:\\Dissertation\\Bibliographie\\storage\\PS5QW9ZP\\Popp et al_2014_Land-use protection for climate change mitigation.pdf:application/pdf;Snapshot:D\:\\Dissertation\\Bibliographie\\storage\\XIQ4D2E5\\nclimate2444.html:text/html} + title = {Land-use protection for climate change mitigation}, + volume = {4}, + copyright = {© 2014 Nature Publishing Group}, + issn = {1758-678X}, + url = {http://www.nature.com/nclimate/journal/vaop/ncurrent/full/nclimate2444.html}, + doi = {10.1038/nclimate2444}, + abstract = {Land-use change, mainly the conversion of tropical forests to agricultural land, is a massive source of carbon emissions and contributes substantially to global warming. Therefore, mechanisms that aim to reduce carbon emissions from deforestation are widely discussed. A central challenge is the avoidance of international carbon leakage if forest conservation is not implemented globally. Here, we show that forest conservation schemes, even if implemented globally, could lead to another type of carbon leakage by driving cropland expansion in non-forested areas that are not subject to forest conservation schemes (non-forest leakage). These areas have a smaller, but still considerable potential to store carbon. We show that a global forest policy could reduce carbon emissions by 77 Gt CO2, but would still allow for decreases in carbon stocks of non-forest land by 96 Gt CO2 until 2100 due to non-forest leakage effects. Furthermore, abandonment of agricultural land and associated carbon uptake through vegetation regrowth is hampered. Effective mitigation measures thus require financing structures and conservation investments that cover the full range of carbon-rich ecosystems. However, our analysis indicates that greater agricultural productivity increases would be needed to compensate for such restrictions on agricultural expansion.}, + language = {en}, + urldate = {2014-11-17}, + journal = {Nature Climate Change}, + author = {Popp, Alexander and Humpenöder, Florian and Weindl, Isabelle and Bodirsky, Benjamin Leon and Bonsch, Markus and Lotze-Campen, Hermann and M\"uller, Christoph and Biewald, Anne and Rolinski, Susanne and Stevanovic, Miodrag and Dietrich, Jan Philipp}, + month = nov, + year = {2014}, + pages = {1095--1098}, } @misc{bodirsky_scenarios_2015, - address = {Berlin}, - title = {Scenarios of future agricultural phosphorus stocks and flows}, - author = {Bodirsky, Benjamin Leon}, - collaborator = {Heintz, Veikko and Lotze-Campen, Hermann and Popp, Alexander and Rolinski, Susanne and Lutz, Femke and Stevanovic, Miodrag and M\"uller, Christoph and Dietrich, Jan Philipp and Weindl, Isabelle and Bonsch, Markus and Humpenöder, Florian}, - year = {2015}, - file = {phosphorus Bodirsky poster ESPC2.pdf:D\:\\Dissertation\\Bibliographie\\storage\\TAM2BW9Z\\Bodirsky poster ESPC2.pdf:application/pdf} + address = {Berlin}, + title = {Scenarios of future agricultural phosphorus stocks and flows}, + author = {Bodirsky, Benjamin Leon}, + collaborator = {Heintz, Veikko and Lotze-Campen, Hermann and Popp, Alexander and Rolinski, Susanne and Lutz, Femke and Stevanovic, Miodrag and M\"uller, Christoph and Dietrich, Jan Philipp and Weindl, Isabelle and Bonsch, Markus and Humpenöder, Florian}, + year = {2015}, } @article{klein_bio-igcc_2011, - series = {10th {International} {Conference} on {Greenhouse} {Gas} {Control} {Technologies}}, - title = {Bio-{IGCC} with {CCS} as a long-term mitigation option in a coupled energy-system and land-use model}, - volume = {4}, - issn = {1876-6102}, - url = {http://www.sciencedirect.com/science/article/pii/S1876610211003985}, - doi = {10.1016/j.egypro.2011.02.201}, - abstract = {This study analyses the impact of techno-economic performance of the BIGCC process and the effect of different biomass feedstocks on the technology’s long term deployment in climate change mitigation scenarios. As the BIGCC technology demands high amounts of biomass raw material it also affects the land-use sector and is dependent on conditions and constraints on the land-use side. To represent the interaction of biomass demand and supply side the global energy-economy-climate model ReMIND is linked to the global land-use model MAgPIE. The link integrates biomass demand and price as well as emission prices and land-use emissions. Results indicate that BIGCC with CCS could serve as an important mitigation option and that it could even be the main bioenergy conversion technology sharing 33\% of overall mitigation in 2100. The contribution of BIGCC technology to long-term climate change mitigation is much higher if grass is used as fuel instead of wood, provided that the grass-based process is highly efficient. The capture rate has to significantly exceed 60\% otherwise the technology is not applied. The overall primary energy consumption of biomass reacts much more sensitive to price changes of the biomass than to techno-economic performance of the BIGCC process. As biomass is mainly used with CCS technologies high amounts of carbon are captured ranging from 130 GtC to 240 GtC (cumulated from 2005–2100) in different scenarios.}, - urldate = {2015-06-10}, - journal = {Energy Procedia}, - author = {Klein, David and Bauer, Nico and Bodirsky, Benjamin and Dietrich, Jan Philipp and Popp, Alexander}, - year = {2011}, - keywords = {land use, Biomass, IGCC, Carbon capture and sequestration, Soft link}, - pages = {2933--2940}, - file = {Klein et al_2011_Bio-IGCC with CCS as a long-term mitigation option in a coupled energy-system.pdf:D\:\\Dissertation\\Bibliographie\\storage\\EAXAURBB\\Klein et al_2011_Bio-IGCC with CCS as a long-term mitigation option in a coupled energy-system.pdf:application/pdf;ScienceDirect Snapshot:D\:\\Dissertation\\Bibliographie\\storage\\365XTA86\\S1876610211003985.html:text/html} + series = {10th {International} {Conference} on {Greenhouse} {Gas} {Control} {Technologies}}, + title = {Bio-{IGCC} with {CCS} as a long-term mitigation option in a coupled energy-system and land-use model}, + volume = {4}, + issn = {1876-6102}, + url = {http://www.sciencedirect.com/science/article/pii/S1876610211003985}, + doi = {10.1016/j.egypro.2011.02.201}, + abstract = {This study analyses the impact of techno-economic performance of the BIGCC process and the effect of different biomass feedstocks on the technology’s long term deployment in climate change mitigation scenarios. As the BIGCC technology demands high amounts of biomass raw material it also affects the land-use sector and is dependent on conditions and constraints on the land-use side. To represent the interaction of biomass demand and supply side the global energy-economy-climate model ReMIND is linked to the global land-use model MAgPIE. The link integrates biomass demand and price as well as emission prices and land-use emissions. Results indicate that BIGCC with CCS could serve as an important mitigation option and that it could even be the main bioenergy conversion technology sharing 33\% of overall mitigation in 2100. The contribution of BIGCC technology to long-term climate change mitigation is much higher if grass is used as fuel instead of wood, provided that the grass-based process is highly efficient. The capture rate has to significantly exceed 60\% otherwise the technology is not applied. The overall primary energy consumption of biomass reacts much more sensitive to price changes of the biomass than to techno-economic performance of the BIGCC process. As biomass is mainly used with CCS technologies high amounts of carbon are captured ranging from 130 GtC to 240 GtC (cumulated from 2005–2100) in different scenarios.}, + urldate = {2015-06-10}, + journal = {Energy Procedia}, + author = {Klein, David and Bauer, Nico and Bodirsky, Benjamin and Dietrich, Jan Philipp and Popp, Alexander}, + year = {2011}, + keywords = {land use, Biomass, IGCC, Carbon capture and sequestration, Soft link}, + pages = {2933--2940}, } @article{nelson_climate_2014, - title = {Climate change effects on agriculture: {Economic} responses to biophysical shocks}, - volume = {111}, - issn = {0027-8424, 1091-6490}, - shorttitle = {Climate change effects on agriculture}, - url = {http://www.pnas.org/content/111/9/3274}, - doi = {10.1073/pnas.1222465110}, - abstract = {Agricultural production is sensitive to weather and thus directly affected by climate change. Plausible estimates of these climate change impacts require combined use of climate, crop, and economic models. Results from previous studies vary substantially due to differences in models, scenarios, and data. This paper is part of a collective effort to systematically integrate these three types of models. We focus on the economic component of the assessment, investigating how nine global economic models of agriculture represent endogenous responses to seven standardized climate change scenarios produced by two climate and five crop models. These responses include adjustments in yields, area, consumption, and international trade. We apply biophysical shocks derived from the Intergovernmental Panel on Climate Change’s representative concentration pathway with end-of-century radiative forcing of 8.5 W/m2. The mean biophysical yield effect with no incremental CO2 fertilization is a 17\% reduction globally by 2050 relative to a scenario with unchanging climate. Endogenous economic responses reduce yield loss to 11\%, increase area of major crops by 11\%, and reduce consumption by 3\%. Agricultural production, cropland area, trade, and prices show the greatest degree of variability in response to climate change, and consumption the lowest. The sources of these differences include model structure and specification; in particular, model assumptions about ease of land use conversion, intensification, and trade. This study identifies where models disagree on the relative responses to climate shocks and highlights research activities needed to improve the representation of agricultural adaptation responses to climate change.}, - language = {en}, - number = {9}, - urldate = {2015-07-03}, - journal = {Proceedings of the National Academy of Sciences}, - author = {Nelson, Gerald C. and Valin, Hugo and Sands, Ronald D. and Havlík, Petr and Ahammad, Helal and Deryng, Delphine and Elliott, Joshua and Fujimori, Shinichiro and Hasegawa, Tomoko and Heyhoe, Edwina and Kyle, Page and Lampe, Martin Von and Lotze-Campen, Hermann and d’Croz, Daniel Mason and Meijl, Hans van and Mensbrugghe, Dominique van der and M\"uller, Christoph and Popp, Alexander and Robertson, Richard and Robinson, Sherman and Schmid, Erwin and Schmitz, Christoph and Tabeau, Andrzej and Willenbockel, Dirk}, - month = apr, - year = {2014}, - pmid = {24344285}, - keywords = {Integrated assessment, Agricultural productivity, climate change adaptation, model intercomparison}, - pages = {3274--3279}, - file = {Nelson et al_2014_Climate change effects on agriculture.pdf:D\:\\Dissertation\\Bibliographie\\storage\\DIQKMG9G\\Nelson et al_2014_Climate change effects on agriculture.pdf:application/pdf;Snapshot:D\:\\Dissertation\\Bibliographie\\storage\\NW99D3UG\\3274.html:text/html} + title = {Climate change effects on agriculture: {Economic} responses to biophysical shocks}, + volume = {111}, + issn = {0027-8424, 1091-6490}, + shorttitle = {Climate change effects on agriculture}, + url = {http://www.pnas.org/content/111/9/3274}, + doi = {10.1073/pnas.1222465110}, + abstract = {Agricultural production is sensitive to weather and thus directly affected by climate change. Plausible estimates of these climate change impacts require combined use of climate, crop, and economic models. Results from previous studies vary substantially due to differences in models, scenarios, and data. This paper is part of a collective effort to systematically integrate these three types of models. We focus on the economic component of the assessment, investigating how nine global economic models of agriculture represent endogenous responses to seven standardized climate change scenarios produced by two climate and five crop models. These responses include adjustments in yields, area, consumption, and international trade. We apply biophysical shocks derived from the Intergovernmental Panel on Climate Change’s representative concentration pathway with end-of-century radiative forcing of 8.5 W/m2. The mean biophysical yield effect with no incremental CO2 fertilization is a 17\% reduction globally by 2050 relative to a scenario with unchanging climate. Endogenous economic responses reduce yield loss to 11\%, increase area of major crops by 11\%, and reduce consumption by 3\%. Agricultural production, cropland area, trade, and prices show the greatest degree of variability in response to climate change, and consumption the lowest. The sources of these differences include model structure and specification; in particular, model assumptions about ease of land use conversion, intensification, and trade. This study identifies where models disagree on the relative responses to climate shocks and highlights research activities needed to improve the representation of agricultural adaptation responses to climate change.}, + language = {en}, + number = {9}, + urldate = {2015-07-03}, + journal = {Proceedings of the National Academy of Sciences}, + author = {Nelson, Gerald C. and Valin, Hugo and Sands, Ronald D. and Havlík, Petr and Ahammad, Helal and Deryng, Delphine and Elliott, Joshua and Fujimori, Shinichiro and Hasegawa, Tomoko and Heyhoe, Edwina and Kyle, Page and Lampe, Martin Von and Lotze-Campen, Hermann and d’Croz, Daniel Mason and Meijl, Hans van and Mensbrugghe, Dominique van der and M\"uller, Christoph and Popp, Alexander and Robertson, Richard and Robinson, Sherman and Schmid, Erwin and Schmitz, Christoph and Tabeau, Andrzej and Willenbockel, Dirk}, + month = apr, + year = {2014}, + pmid = {24344285}, + keywords = {Integrated assessment, Agricultural productivity, climate change adaptation, model intercomparison}, + pages = {3274--3279}, } @article{bonsch_environmental_2015, - title = {Environmental flow provision: {Implications} for agricultural water and land-use at the global scale}, - volume = {30}, - issn = {0959-3780}, - shorttitle = {Environmental flow provision}, - url = {http://www.sciencedirect.com/science/article/pii/S0959378014001964}, - doi = {10.1016/j.gloenvcha.2014.10.015}, - abstract = {Human activity has led to freshwater ecosystem degradation in the past and is likely to continue doing so if no appropriate protection mechanisms are implemented. One potential protection measure is the reallocation of water from human use to environmental purposes – also called environmental flows. Such reallocation may decrease the availability of irrigation water with possible adverse effects on agricultural production. In this analysis, we provide an initial quantitative estimate of how the allocation of annual volumes of water for environmental flow protection (EFP) might influence the food production system on a global scale. The application of a spatially explicit global land and water-use allocation model (MAgPIE) allows us to explore the effect of EFP on agricultural water withdrawals. We will also examine associated reactions in terms of land-use changes and agricultural intensification. Our results suggest that the implications of conserving annual volumes of water for EFP on the land-use system are moderate on an aggregate global level. Cropland expansion into unmanaged land arising from increased food demand up to 2045 is higher by a factor 5–9 than cropland expansion induced by EFP. Global forest losses associated with EFP remain below 1\% of current forest area. Production reallocation and associated land-use change hotspots suggest that local effects are of more concern than aggregate cropland expansion and deforestation.}, - urldate = {2015-08-13}, - journal = {Global Environmental Change}, - author = {Bonsch, Markus and Popp, Alexander and Biewald, Anne and Rolinski, Susanne and Schmitz, Christoph and Weindl, Isabelle and Stevanovic, Miodrag and Högner, Kathrin and Heinke, Jens and Ostberg, Sebastian and Dietrich, Jan Philipp and Bodirsky, Benjamin and Lotze-Campen, Hermann and Humpenöder, Florian}, - month = jan, - year = {2015}, - keywords = {Global, Environmental flows, Water-use, Land-use, Land–water-nexus, Model}, - pages = {113--132}, - file = {Bonsch et al_2015_Environmental flow provision.pdf:D\:\\Dissertation\\Bibliographie\\storage\\Z5Q8GVFX\\Bonsch et al_2015_Environmental flow provision.pdf:application/pdf;ScienceDirect Snapshot:D\:\\Dissertation\\Bibliographie\\storage\\FZKIQTNV\\S0959378014001964.html:text/html} + title = {Environmental flow provision: {Implications} for agricultural water and land-use at the global scale}, + volume = {30}, + issn = {0959-3780}, + shorttitle = {Environmental flow provision}, + url = {http://www.sciencedirect.com/science/article/pii/S0959378014001964}, + doi = {10.1016/j.gloenvcha.2014.10.015}, + abstract = {Human activity has led to freshwater ecosystem degradation in the past and is likely to continue doing so if no appropriate protection mechanisms are implemented. One potential protection measure is the reallocation of water from human use to environmental purposes – also called environmental flows. Such reallocation may decrease the availability of irrigation water with possible adverse effects on agricultural production. In this analysis, we provide an initial quantitative estimate of how the allocation of annual volumes of water for environmental flow protection (EFP) might influence the food production system on a global scale. The application of a spatially explicit global land and water-use allocation model (MAgPIE) allows us to explore the effect of EFP on agricultural water withdrawals. We will also examine associated reactions in terms of land-use changes and agricultural intensification. Our results suggest that the implications of conserving annual volumes of water for EFP on the land-use system are moderate on an aggregate global level. Cropland expansion into unmanaged land arising from increased food demand up to 2045 is higher by a factor 5–9 than cropland expansion induced by EFP. Global forest losses associated with EFP remain below 1\% of current forest area. Production reallocation and associated land-use change hotspots suggest that local effects are of more concern than aggregate cropland expansion and deforestation.}, + urldate = {2015-08-13}, + journal = {Global Environmental Change}, + author = {Bonsch, Markus and Popp, Alexander and Biewald, Anne and Rolinski, Susanne and Schmitz, Christoph and Weindl, Isabelle and Stevanovic, Miodrag and Högner, Kathrin and Heinke, Jens and Ostberg, Sebastian and Dietrich, Jan Philipp and Bodirsky, Benjamin and Lotze-Campen, Hermann and Humpenöder, Florian}, + month = jan, + year = {2015}, + keywords = {Global, Environmental flows, Water-use, Land-use, Land–water-nexus, Model}, + pages = {113--132}, } @article{wang_taking_2016, - title = {Taking account of governance: {Implications} for land-use dynamics, food prices, and trade patterns}, - volume = {122}, - issn = {0921-8009}, - shorttitle = {Taking account of governance}, - url = {http://www.sciencedirect.com/science/article/pii/S0921800915004619}, - doi = {10.1016/j.ecolecon.2015.11.018}, - abstract = {Deforestation, mainly caused by unsustainable agricultural expansion, results in a loss of biodiversity and an increase in greenhouse gas emissions, as well as impinges on local livelihoods. Countries' governance performance, particularly with respect to property rights security, exerts significant impacts on land-use patterns by affecting agricultural yield-related technological investment and cropland expansion. This study aims to incorporate governance factors into a recursive agro-economic dynamic model to simulate governance impacts on land-use patterns at the global scale. Due to the difficulties of including governance indicators directly into numerical models, we use lending interest rates as discount rates to reflect risk-accounting factors associated with different governance scenarios. In addition to a reference scenario, three scenarios with high, low and mixed divergent discount rates are formed to represent weak, strong and fragmented governance. We find that weak governance leads to slower yield growth, increased cropland expansion and associated deforestation, mainly in Latin America, Sub-Saharan Africa, South Asia and Southeast Asia. This is associated with increasing food prices, particularly in Sub-Saharan Africa and Southeast Asia. By contrast, strong governance performance provides a stable political and economic situation which may bring down deforestation rates, stimulate investment in agricultural technologies, and induce fairly strong decreases in food prices.}, - urldate = {2016-02-19}, - journal = {Ecological Economics}, - author = {Wang, Xiaoxi and Biewald, Anne and Dietrich, Jan Philipp and Schmitz, Christoph and Lotze-Campen, Hermann and Humpenöder, Florian and Bodirsky, Benjamin Leon and Popp, Alexander}, - month = feb, - year = {2016}, - keywords = {Deforestation, Governance, Cropland expansion, Food prices, Land-use intensity}, - pages = {12--24} + title = {Taking account of governance: {Implications} for land-use dynamics, food prices, and trade patterns}, + volume = {122}, + issn = {0921-8009}, + shorttitle = {Taking account of governance}, + url = {http://www.sciencedirect.com/science/article/pii/S0921800915004619}, + doi = {10.1016/j.ecolecon.2015.11.018}, + abstract = {Deforestation, mainly caused by unsustainable agricultural expansion, results in a loss of biodiversity and an increase in greenhouse gas emissions, as well as impinges on local livelihoods. Countries' governance performance, particularly with respect to property rights security, exerts significant impacts on land-use patterns by affecting agricultural yield-related technological investment and cropland expansion. This study aims to incorporate governance factors into a recursive agro-economic dynamic model to simulate governance impacts on land-use patterns at the global scale. Due to the difficulties of including governance indicators directly into numerical models, we use lending interest rates as discount rates to reflect risk-accounting factors associated with different governance scenarios. In addition to a reference scenario, three scenarios with high, low and mixed divergent discount rates are formed to represent weak, strong and fragmented governance. We find that weak governance leads to slower yield growth, increased cropland expansion and associated deforestation, mainly in Latin America, Sub-Saharan Africa, South Asia and Southeast Asia. This is associated with increasing food prices, particularly in Sub-Saharan Africa and Southeast Asia. By contrast, strong governance performance provides a stable political and economic situation which may bring down deforestation rates, stimulate investment in agricultural technologies, and induce fairly strong decreases in food prices.}, + urldate = {2016-02-19}, + journal = {Ecological Economics}, + author = {Wang, Xiaoxi and Biewald, Anne and Dietrich, Jan Philipp and Schmitz, Christoph and Lotze-Campen, Hermann and Humpenöder, Florian and Bodirsky, Benjamin Leon and Popp, Alexander}, + month = feb, + year = {2016}, + keywords = {Deforestation, Governance, Cropland expansion, Food prices, Land-use intensity}, + pages = {12--24} } @article{bodirsky_global_2015-1, - title = {Global {Food} {Demand} {Scenarios} for the 21st {Century}}, - volume = {10}, - url = {http://dx.doi.org/10.1371/journal.pone.0139201}, - doi = {10.1371/journal.pone.0139201}, - abstract = {Long-term food demand scenarios are an important tool for studying global food security and for analysing the environmental impacts of agriculture. We provide a simple and transparent method to create scenarios for future plant-based and animal-based calorie demand, using time-dependent regression models between calorie demand and income. The scenarios can be customized to a specific storyline by using different input data for gross domestic product (GDP) and population projections and by assuming different functional forms of the regressions. Our results confirm that total calorie demand increases with income, but we also found a non-income related positive time-trend. The share of animal-based calories is estimated to rise strongly with income for low-income groups. For high income groups, two ambiguous relations between income and the share of animal-based products are consistent with historical data: First, a positive relation with a strong negative time-trend and second a negative relation with a slight negative time-trend. The fits of our regressions are highly significant and our results compare well to other food demand estimates. The method is exemplarily used to construct four food demand scenarios until the year 2100 based on the storylines of the IPCC Special Report on Emissions Scenarios (SRES). We find in all scenarios a strong increase of global food demand until 2050 with an increasing share of animal-based products, especially in developing countries.}, - number = {11}, - urldate = {2015-11-05}, - journal = {PLoS ONE}, - author = {Bodirsky, Benjamin Leon and Rolinski, Susanne and Biewald, Anne and Weindl, Isabelle and Popp, Alexander and Lotze-Campen, Hermann}, - month = nov, - year = {2015}, - pages = {e0139201}, - file = {Bodirsky et al_2015_Global Food Demand Scenarios for the 21st Century.pdf:D\:\\Dissertation\\Bibliographie\\storage\\PWG92ZSN\\Bodirsky et al_2015_Global Food Demand Scenarios for the 21st Century.pdf:application/pdf} + title = {Global {Food} {Demand} {Scenarios} for the 21st {Century}}, + volume = {10}, + url = {http://dx.doi.org/10.1371/journal.pone.0139201}, + doi = {10.1371/journal.pone.0139201}, + abstract = {Long-term food demand scenarios are an important tool for studying global food security and for analysing the environmental impacts of agriculture. We provide a simple and transparent method to create scenarios for future plant-based and animal-based calorie demand, using time-dependent regression models between calorie demand and income. The scenarios can be customized to a specific storyline by using different input data for gross domestic product (GDP) and population projections and by assuming different functional forms of the regressions. Our results confirm that total calorie demand increases with income, but we also found a non-income related positive time-trend. The share of animal-based calories is estimated to rise strongly with income for low-income groups. For high income groups, two ambiguous relations between income and the share of animal-based products are consistent with historical data: First, a positive relation with a strong negative time-trend and second a negative relation with a slight negative time-trend. The fits of our regressions are highly significant and our results compare well to other food demand estimates. The method is exemplarily used to construct four food demand scenarios until the year 2100 based on the storylines of the IPCC Special Report on Emissions Scenarios (SRES). We find in all scenarios a strong increase of global food demand until 2050 with an increasing share of animal-based products, especially in developing countries.}, + number = {11}, + urldate = {2015-11-05}, + journal = {PLoS ONE}, + author = {Bodirsky, Benjamin Leon and Rolinski, Susanne and Biewald, Anne and Weindl, Isabelle and Popp, Alexander and Lotze-Campen, Hermann}, + month = nov, + year = {2015}, + pages = {e0139201}, } @article{wiebe_climate_2015, - title = {Climate change impacts on agriculture in 2050 under a range of plausible socioeconomic and emissions scenarios}, - volume = {10}, - issn = {1748-9326}, - url = {http://stacks.iop.org/1748-9326/10/i=8/a=085010}, - doi = {10.1088/1748-9326/10/8/085010}, - abstract = {Previous studies have combined climate, crop and economic models to examine the impact of climate change on agricultural production and food security, but results have varied widely due to differences in models, scenarios and input data. Recent work has examined (and narrowed) these differences through systematic model intercomparison using a high-emissions pathway to highlight the differences. This paper extends that analysis to explore a range of plausible socioeconomic scenarios and emission pathways. Results from multiple climate and economic models are combined to examine the global and regional impacts of climate change on agricultural yields, area, production, consumption, prices and trade for coarse grains, rice, wheat, oilseeds and sugar crops to 2050. We find that climate impacts on global average yields, area, production and consumption are similar across shared socioeconomic pathways (SSP 1, 2 and 3, as we implement them based on population, income and productivity drivers), except when changes in trade policies are included. Impacts on trade and prices are higher for SSP 3 than SSP 2, and higher for SSP 2 than for SSP 1. Climate impacts for all variables are similar across low to moderate emissions pathways (RCP 4.5 and RCP 6.0), but increase for a higher emissions pathway (RCP 8.5). It is important to note that these global averages may hide regional variations. Projected reductions in agricultural yields due to climate change by 2050 are larger for some crops than those estimated for the past half century, but smaller than projected increases to 2050 due to rising demand and intrinsic productivity growth. Results illustrate the sensitivity of climate change impacts to differences in socioeconomic and emissions pathways. Yield impacts increase at high emissions levels and vary with changes in population, income and technology, but are reduced in all cases by endogenous changes in prices and other variables.}, - language = {en}, - number = {8}, - urldate = {2015-10-15}, - journal = {Environmental Research Letters}, - author = {Wiebe, Keith and Lotze-Campen, Hermann and Sands, Ronald and Tabeau, Andrzej and Mensbrugghe, Dominique van der and {Anne Biewald} and Bodirsky, Benjamin and Islam, Shahnila and Kavallari, Aikaterini and Mason-D’Croz, Daniel and {Christoph M\"uller} and Popp, Alexander and Robertson, Richard and Robinson, Sherman and Meijl, Hans van and Willenbockel, Dirk}, - year = {2015}, - pages = {085010}, - file = {Wiebe et al_2015_Climate change impacts on agriculture in 2050 under a range of plausible.pdf:D\:\\Dissertation\\Bibliographie\\storage\\PI86FZG2\\Wiebe et al_2015_Climate change impacts on agriculture in 2050 under a range of plausible.pdf:application/pdf} + title = {Climate change impacts on agriculture in 2050 under a range of plausible socioeconomic and emissions scenarios}, + volume = {10}, + issn = {1748-9326}, + url = {http://stacks.iop.org/1748-9326/10/i=8/a=085010}, + doi = {10.1088/1748-9326/10/8/085010}, + abstract = {Previous studies have combined climate, crop and economic models to examine the impact of climate change on agricultural production and food security, but results have varied widely due to differences in models, scenarios and input data. Recent work has examined (and narrowed) these differences through systematic model intercomparison using a high-emissions pathway to highlight the differences. This paper extends that analysis to explore a range of plausible socioeconomic scenarios and emission pathways. Results from multiple climate and economic models are combined to examine the global and regional impacts of climate change on agricultural yields, area, production, consumption, prices and trade for coarse grains, rice, wheat, oilseeds and sugar crops to 2050. We find that climate impacts on global average yields, area, production and consumption are similar across shared socioeconomic pathways (SSP 1, 2 and 3, as we implement them based on population, income and productivity drivers), except when changes in trade policies are included. Impacts on trade and prices are higher for SSP 3 than SSP 2, and higher for SSP 2 than for SSP 1. Climate impacts for all variables are similar across low to moderate emissions pathways (RCP 4.5 and RCP 6.0), but increase for a higher emissions pathway (RCP 8.5). It is important to note that these global averages may hide regional variations. Projected reductions in agricultural yields due to climate change by 2050 are larger for some crops than those estimated for the past half century, but smaller than projected increases to 2050 due to rising demand and intrinsic productivity growth. Results illustrate the sensitivity of climate change impacts to differences in socioeconomic and emissions pathways. Yield impacts increase at high emissions levels and vary with changes in population, income and technology, but are reduced in all cases by endogenous changes in prices and other variables.}, + language = {en}, + number = {8}, + urldate = {2015-10-15}, + journal = {Environmental Research Letters}, + author = {Wiebe, Keith and Lotze-Campen, Hermann and Sands, Ronald and Tabeau, Andrzej and Mensbrugghe, Dominique van der and {Anne Biewald} and Bodirsky, Benjamin and Islam, Shahnila and Kavallari, Aikaterini and Mason-D’Croz, Daniel and {Christoph M\"uller} and Popp, Alexander and Robertson, Richard and Robinson, Sherman and Meijl, Hans van and Willenbockel, Dirk}, + year = {2015}, + pages = {085010}, } @article{weindl_livestock_2015, - title = {Livestock in a changing climate: production system transitions as an adaptation strategy for agriculture}, - volume = {10}, - issn = {1748-9326}, - shorttitle = {Livestock in a changing climate}, - url = {http://stacks.iop.org/1748-9326/10/i=9/a=094021}, - doi = {10.1088/1748-9326/10/9/094021}, - abstract = {Livestock farming is the world’s largest land use sector and utilizes around 60\% of the global biomass harvest. Over the coming decades, climate change will affect the natural resource base of livestock production, especially the productivity of rangeland and feed crops. Based on a comprehensive impact modeling chain, we assess implications of different climate projections for agricultural production costs and land use change and explore the effectiveness of livestock system transitions as an adaptation strategy. Simulated climate impacts on crop yields and rangeland productivity generate adaptation costs amounting to 3\% of total agricultural production costs in 2045 (i.e. 145 billion US\$). Shifts in livestock production towards mixed crop-livestock systems represent a resource- and cost-efficient adaptation option, reducing agricultural adaptation costs to 0.3\% of total production costs and simultaneously abating deforestation by about 76 million ha globally. The relatively positive climate impacts on grass yields compared with crop yields favor grazing systems inter alia in South Asia and North America. Incomplete transitions in production systems already have a strong adaptive and cost reducing effect: a 50\% shift to mixed systems lowers agricultural adaptation costs to 0.8\%. General responses of production costs to system transitions are robust across different global climate and crop models as well as regarding assumptions on CO 2 fertilization, but simulated values show a large variation. In the face of these uncertainties, public policy support for transforming livestock production systems provides an important lever to improve agricultural resource management and lower adaptation costs, possibly even contributing to emission reduction.}, - language = {en}, - number = {9}, - urldate = {2015-10-22}, - journal = {Environmental Research Letters}, - author = {Weindl, Isabelle and Lotze-Campen, Hermann and Popp, Alexander and M\"uller, Christoph and Havlík, Petr and {Mario Herrero} and Schmitz, Christoph and Rolinski, Susanne}, - year = {2015}, - pages = {094021}, - file = {Weindl et al_2015_Livestock in a changing climate.pdf:D\:\\Dissertation\\Bibliographie\\storage\\2PAVK94H\\Weindl et al_2015_Livestock in a changing climate.pdf:application/pdf} + title = {Livestock in a changing climate: production system transitions as an adaptation strategy for agriculture}, + volume = {10}, + issn = {1748-9326}, + shorttitle = {Livestock in a changing climate}, + url = {http://stacks.iop.org/1748-9326/10/i=9/a=094021}, + doi = {10.1088/1748-9326/10/9/094021}, + abstract = {Livestock farming is the world's largest land use sector and utilizes around 60\% of the global biomass harvest. Over the coming decades, climate change will affect the natural resource base of livestock production, especially the productivity of rangeland and feed crops. Based on a comprehensive impact modeling chain, we assess implications of different climate projections for agricultural production costs and land use change and explore the effectiveness of livestock system transitions as an adaptation strategy. Simulated climate impacts on crop yields and rangeland productivity generate adaptation costs amounting to 3\% of total agricultural production costs in 2045 (i.e. 145 billion US\$). Shifts in livestock production towards mixed crop-livestock systems represent a resource- and cost-efficient adaptation option, reducing agricultural adaptation costs to 0.3\% of total production costs and simultaneously abating deforestation by about 76 million ha globally. The relatively positive climate impacts on grass yields compared with crop yields favor grazing systems inter alia in South Asia and North America. Incomplete transitions in production systems already have a strong adaptive and cost reducing effect: a 50\% shift to mixed systems lowers agricultural adaptation costs to 0.8\%. General responses of production costs to system transitions are robust across different global climate and crop models as well as regarding assumptions on CO 2 fertilization, but simulated values show a large variation. In the face of these uncertainties, public policy support for transforming livestock production systems provides an important lever to improve agricultural resource management and lower adaptation costs, possibly even contributing to emission reduction.}, + language = {en}, + number = {9}, + urldate = {2015-10-22}, + journal = {Environmental Research Letters}, + author = {Weindl, Isabelle and Lotze-Campen, Hermann and Popp, Alexander and M\"uller, Christoph and Havlík, Petr and {Mario Herrero} and Schmitz, Christoph and Rolinski, Susanne}, + year = {2015}, + pages = {094021}, } @article{popp_land_nodate, - title = {Land use futures in the {Shared} {Socio}-{Economic} {Pathways}}, - journal = {Global Environmental Change}, - author = {Popp, Alexander and Calvin, Katherine and Fujimori, Shinichiro and Havlik, Petr and Humpenöder, Florian and Stehfest, Elke and Bodirsky, Benjamin Leon and Dietrich, Jan Philipp and Doelmann, Jonathan and Gusti, Mykola and Hasegawa, Tomoko and Kyle, Page and Obersteiner, Michael and Tabeau, Andrzej and Takahashi, Kiyoshi and Valin, Hugo and Waldhoff, Stephanie and Weindl, Isabelle and Wise, Marshall and Kriegler, Elmar and Lotze-Campen, Hermann and Fricko, Oliver and Riahi, Keywan and Vuuren, Detlef van}, - file = {Popp et al SI.docx:D\:\\Dissertation\\Bibliographie\\storage\\S42V3BUD\\Popp et al SI.docx:application/vnd.openxmlformats-officedocument.wordprocessingml.document;Popp et al_submitted_Land use futures in the Shared Socio-Economic Pathways.docx:D\:\\Dissertation\\Bibliographie\\storage\\XCF32NXR\\Popp et al_submitted_Land use futures in the Shared Socio-Economic Pathways.docx:application/vnd.openxmlformats-officedocument.wordprocessingml.document} + title = {Land use futures in the {Shared} {Socio}-{Economic} {Pathways}}, + journal = {Global Environmental Change}, + author = {Popp, Alexander and Calvin, Katherine and Fujimori, Shinichiro and Havlik, Petr and Humpenöder, Florian and Stehfest, Elke and Bodirsky, Benjamin Leon and Dietrich, Jan Philipp and Doelmann, Jonathan and Gusti, Mykola and Hasegawa, Tomoko and Kyle, Page and Obersteiner, Michael and Tabeau, Andrzej and Takahashi, Kiyoshi and Valin, Hugo and Waldhoff, Stephanie and Weindl, Isabelle and Wise, Marshall and Kriegler, Elmar and Lotze-Campen, Hermann and Fricko, Oliver and Riahi, Keywan and Vuuren, Detlef van}, } @article{schmitz_land-use_2014, - title = {Land-use change trajectories up to 2050: insights from a global agro-economic model comparison}, - volume = {45}, - copyright = {© 2013 International Association of Agricultural Economists}, - issn = {1574-0862}, - shorttitle = {Land-use change trajectories up to 2050}, - url = {http://onlinelibrary.wiley.com/doi/10.1111/agec.12090/abstract}, - doi = {10.1111/agec.12090}, - abstract = {Changes in agricultural land use have important implications for environmental services. Previous studies of agricultural land-use futures have been published indicating large uncertainty due to different model assumptions and methodologies. In this article we present a first comprehensive comparison of global agro-economic models that have harmonized drivers of population, GDP, and biophysical yields. The comparison allows us to ask two research questions: (1) How much cropland will be used under different socioeconomic and climate change scenarios? (2) How can differences in model results be explained? The comparison includes four partial and six general equilibrium models that differ in how they model land supply and amount of potentially available land. We analyze results of two different socioeconomic scenarios and three climate scenarios (one with constant climate). Most models (7 out of 10) project an increase of cropland of 10–25\% by 2050 compared to 2005 (under constant climate), but one model projects a decrease. Pasture land expands in some models, which increase the treat on natural vegetation further. Across all models most of the cropland expansion takes place in South America and sub-Saharan Africa. In general, the strongest differences in model results are related to differences in the costs of land expansion, the endogenous productivity responses, and the assumptions about potential cropland.}, - language = {en}, - number = {1}, - urldate = {2015-12-16}, - journal = {Agricultural Economics}, - author = {Schmitz, Christoph and van Meijl, Hans and Kyle, Page and Nelson, Gerald C. and Fujimori, Shinichiro and Gurgel, Angelo and Havlik, Petr and Heyhoe, Edwina and d'Croz, Daniel Mason and Popp, Alexander and Sands, Ron and Tabeau, Andrzej and van der Mensbrugghe, Dominique and von Lampe, Martin and Wise, Marshall and Blanc, Elodie and Hasegawa, Tomoko and Kavallari, Aikaterini and Valin, Hugo}, - month = jan, - year = {2014}, - keywords = {Land-use change, Q11, C68, Q54, model intercomparison, C61, Land-use models, Land expansion}, - pages = {69--84}, - file = {Snapshot:D\:\\Dissertation\\Bibliographie\\storage\\WMK7HMP9\\abstract.html:text/html} + title = {Land-use change trajectories up to 2050: insights from a global agro-economic model comparison}, + volume = {45}, + copyright = {© 2013 International Association of Agricultural Economists}, + issn = {1574-0862}, + shorttitle = {Land-use change trajectories up to 2050}, + url = {http://onlinelibrary.wiley.com/doi/10.1111/agec.12090/abstract}, + doi = {10.1111/agec.12090}, + abstract = {Changes in agricultural land use have important implications for environmental services. Previous studies of agricultural land-use futures have been published indicating large uncertainty due to different model assumptions and methodologies. In this article we present a first comprehensive comparison of global agro-economic models that have harmonized drivers of population, GDP, and biophysical yields. The comparison allows us to ask two research questions: (1) How much cropland will be used under different socioeconomic and climate change scenarios? (2) How can differences in model results be explained? The comparison includes four partial and six general equilibrium models that differ in how they model land supply and amount of potentially available land. We analyze results of two different socioeconomic scenarios and three climate scenarios (one with constant climate). Most models (7 out of 10) project an increase of cropland of 10–25\% by 2050 compared to 2005 (under constant climate), but one model projects a decrease. Pasture land expands in some models, which increase the treat on natural vegetation further. Across all models most of the cropland expansion takes place in South America and sub-Saharan Africa. In general, the strongest differences in model results are related to differences in the costs of land expansion, the endogenous productivity responses, and the assumptions about potential cropland.}, + language = {en}, + number = {1}, + urldate = {2015-12-16}, + journal = {Agricultural Economics}, + author = {Schmitz, Christoph and van Meijl, Hans and Kyle, Page and Nelson, Gerald C. and Fujimori, Shinichiro and Gurgel, Angelo and Havlik, Petr and Heyhoe, Edwina and d'Croz, Daniel Mason and Popp, Alexander and Sands, Ron and Tabeau, Andrzej and van der Mensbrugghe, Dominique and von Lampe, Martin and Wise, Marshall and Blanc, Elodie and Hasegawa, Tomoko and Kavallari, Aikaterini and Valin, Hugo}, + month = jan, + year = {2014}, + keywords = {Land-use change, Q11, C68, Q54, model intercomparison, C61, Land-use models, Land expansion}, + pages = {69--84}, } @techreport{biewald_impact_2015, - address = {Potsdam}, - title = {The impact of climate change on costs of food and people exposed to hunger at subnational scale}, - url = {https://www.pik-potsdam.de/research/publications/pikreports/.files/pr128.pdf}, - number = {128}, - urldate = {2016-02-24}, - institution = {PIK}, - author = {Biewald, Anne and Lotze-Campen, Hermann and Otto, Ilona and Brinckmann, Nils and Weindl, Isabelle and Popp, Alexander and Schellnhuber, Hans Joachim and Bodirsky, Benjamin}, - year = {2015}, - file = {pr128.pdf:D\:\\Dissertation\\Bibliographie\\storage\\ANRSHSB7\\pr128.pdf:application/pdf} + address = {Potsdam}, + title = {The impact of climate change on costs of food and people exposed to hunger at subnational scale}, + url = {https://www.pik-potsdam.de/research/publications/pikreports/.files/pr128.pdf}, + number = {128}, + urldate = {2016-02-24}, + institution = {PIK}, + author = {Biewald, Anne and Lotze-Campen, Hermann and Otto, Ilona and Brinckmann, Nils and Weindl, Isabelle and Popp, Alexander and Schellnhuber, Hans Joachim and Bodirsky, Benjamin}, + year = {2015}, } @article{humpenoder_land-use_2015, - title = {Land-{Use} and {Carbon} {Cycle} {Responses} to {Moderate} {Climate} {Change}: {Implications} for {Land}-{Based} {Mitigation}?}, - volume = {49}, - issn = {0013-936X, 1520-5851}, - shorttitle = {Land-{Use} and {Carbon} {Cycle} {Responses} to {Moderate} {Climate} {Change}}, - url = {http://pubs.acs.org/doi/abs/10.1021/es506201r}, - doi = {10.1021/es506201r}, - language = {en}, - number = {11}, - urldate = {2016-03-08}, - journal = {Environmental Science \& Technology}, - author = {Humpenöder, Florian and Popp, Alexander and Stevanovic, Miodrag and M\"uller, Christoph and Bodirsky, Benjamin Leon and Bonsch, Markus and Dietrich, Jan Philipp and Lotze-Campen, Hermann and Weindl, Isabelle and Biewald, Anne and Rolinski, Susanne}, - month = jun, - year = {2015}, - pages = {6731--6739}, - file = {es506201r.pdf:D\:\\Dissertation\\Bibliographie\\storage\\M6U9N3H4\\es506201r.pdf:application/pdf} + title = {Land-{Use} and {Carbon} {Cycle} {Responses} to {Moderate} {Climate} {Change}: {Implications} for {Land}-{Based} {Mitigation}?}, + volume = {49}, + issn = {0013-936X, 1520-5851}, + shorttitle = {Land-{Use} and {Carbon} {Cycle} {Responses} to {Moderate} {Climate} {Change}}, + url = {http://pubs.acs.org/doi/abs/10.1021/es506201r}, + doi = {10.1021/es506201r}, + language = {en}, + number = {11}, + urldate = {2016-03-08}, + journal = {Environmental Science \& Technology}, + author = {Humpenöder, Florian and Popp, Alexander and Stevanovic, Miodrag and M\"uller, Christoph and Bodirsky, Benjamin Leon and Bonsch, Markus and Dietrich, Jan Philipp and Lotze-Campen, Hermann and Weindl, Isabelle and Biewald, Anne and Rolinski, Susanne}, + month = jun, + year = {2015}, + pages = {6731--6739}, } @article{kreidenweis_afforestation_2016, - title = {Afforestation to mitigate climate change: impacts on food prices under consideration of albedo effects}, - volume = {11}, - issn = {1748-9326}, - shorttitle = {Afforestation to mitigate climate change}, - url = {http://stacks.iop.org/1748-9326/11/i=8/a=085001}, - doi = {10.1088/1748-9326/11/8/085001}, - abstract = {Ambitious climate targets, such as the 2 °C target, are likely to require the removal of carbon dioxide from the atmosphere. Afforestation is one such mitigation option but could, through the competition for land, also lead to food prices hikes. In addition, afforestation often decreases land-surface albedo and the amount of short-wave radiation reflected back to space, which results in a warming effect. In particular in the boreal zone, such biophysical warming effects following from afforestation are estimated to offset the cooling effect from carbon sequestration. We assessed the food price response of afforestation, and considered the albedo effect with scenarios in which afforestation was restricted to certain latitudinal zones. In our study, afforestation was incentivized by a globally uniform reward for carbon uptake in the terrestrial biosphere. This resulted in large-scale afforestation (2580 Mha globally) and substantial carbon sequestration (860 GtCO 2 ) up to the end of the century. However, it was also associated with an increase in food prices of about 80\% by 2050 and a more than fourfold increase by 2100. When afforestation was restricted to the tropics the food price response was substantially reduced, while still almost 60\% cumulative carbon sequestration was achieved. In the medium term, the increase in prices was then lower than the increase in income underlying our scenario projections. Moreover, our results indicate that more liberalised trade in agricultural commodities could buffer the food price increases following from afforestation in tropical regions.}, - language = {en}, - number = {8}, - urldate = {2016-07-28}, - journal = {Environmental Research Letters}, - author = {Kreidenweis, Ulrich and Humpenöder, Florian and Stevanovic, Miodrag and Bodirsky, Benjamin Leon and {Elmar Kriegler} and Lotze-Campen, Hermann and Popp, Alexander}, - year = {2016}, - pages = {085001}, - file = {Kreidenweis et al_2016_Afforestation to mitigate climate change.pdf:D\:\\Dissertation\\Bibliographie\\storage\\8EDBJ5UK\\Kreidenweis et al_2016_Afforestation to mitigate climate change.pdf:application/pdf} + title = {Afforestation to mitigate climate change: impacts on food prices under consideration of albedo effects}, + volume = {11}, + issn = {1748-9326}, + shorttitle = {Afforestation to mitigate climate change}, + url = {http://stacks.iop.org/1748-9326/11/i=8/a=085001}, + doi = {10.1088/1748-9326/11/8/085001}, + abstract = {Ambitious climate targets, such as the 2 °C target, are likely to require the removal of carbon dioxide from the atmosphere. Afforestation is one such mitigation option but could, through the competition for land, also lead to food prices hikes. In addition, afforestation often decreases land-surface albedo and the amount of short-wave radiation reflected back to space, which results in a warming effect. In particular in the boreal zone, such biophysical warming effects following from afforestation are estimated to offset the cooling effect from carbon sequestration. We assessed the food price response of afforestation, and considered the albedo effect with scenarios in which afforestation was restricted to certain latitudinal zones. In our study, afforestation was incentivized by a globally uniform reward for carbon uptake in the terrestrial biosphere. This resulted in large-scale afforestation (2580 Mha globally) and substantial carbon sequestration (860 GtCO 2 ) up to the end of the century. However, it was also associated with an increase in food prices of about 80\% by 2050 and a more than fourfold increase by 2100. When afforestation was restricted to the tropics the food price response was substantially reduced, while still almost 60\% cumulative carbon sequestration was achieved. In the medium term, the increase in prices was then lower than the increase in income underlying our scenario projections. Moreover, our results indicate that more liberalised trade in agricultural commodities could buffer the food price increases following from afforestation in tropical regions.}, + language = {en}, + number = {8}, + urldate = {2016-07-28}, + journal = {Environmental Research Letters}, + author = {Kreidenweis, Ulrich and Humpenöder, Florian and Stevanovic, Miodrag and Bodirsky, Benjamin Leon and {Elmar Kriegler} and Lotze-Campen, Hermann and Popp, Alexander}, + year = {2016}, + pages = {085001}, } @article{stevanovic_impact_2016, - title = {The impact of high-end climate change on agricultural welfare}, - volume = {2}, - copyright = {Copyright © 2016, The Authors. This is an open-access article distributed under the terms of the Creative Commons Attribution-NonCommercial license, which permits use, distribution, and reproduction in any medium, so long as the resultant use is not for commercial advantage and provided the original work is properly cited.}, - issn = {2375-2548}, - url = {http://advances.sciencemag.org/content/2/8/e1501452}, - doi = {10.1126/sciadv.1501452}, - language = {en}, - number = {8}, - urldate = {2016-08-25}, - journal = {Science Advances}, - author = {Stevanovic, Miodrag and Popp, Alexander and Lotze-Campen, Hermann and Dietrich, Jan Philipp and M\"uller, Christoph and Bonsch, Markus and Schmitz, Christoph and Bodirsky, Benjamin Leon and Humpenöder, Florian and Weindl, Isabelle}, - month = aug, - year = {2016}, - pages = {e1501452}, + title = {The impact of high-end climate change on agricultural welfare}, + volume = {2}, + copyright = {Copyright © 2016, The Authors. This is an open-access article distributed under the terms of the Creative Commons Attribution-NonCommercial license, which permits use, distribution, and reproduction in any medium, so long as the resultant use is not for commercial advantage and provided the original work is properly cited.}, + issn = {2375-2548}, + url = {http://advances.sciencemag.org/content/2/8/e1501452}, + doi = {10.1126/sciadv.1501452}, + language = {en}, + number = {8}, + urldate = {2016-08-25}, + journal = {Science Advances}, + author = {Stevanovic, Miodrag and Popp, Alexander and Lotze-Campen, Hermann and Dietrich, Jan Philipp and M\"uller, Christoph and Bonsch, Markus and Schmitz, Christoph and Bodirsky, Benjamin Leon and Humpenöder, Florian and Weindl, Isabelle}, + month = aug, + year = {2016}, + pages = {e1501452}, } @article{stevanovic_agriculture_nodate, - title = {Agriculture, {Forestry}, and {Other} {Land}-{Use} {Emissions} {Abatement}: {Mitigation} {Strategies} and {Consequences} for {Food} {Prices}}, - journal = {Environmental Science \& Technology}, - author = {Stevanovic, Miodrag and Popp, Alexander and Bodirsky, Benjamin L. and Humpenöder, Florian and M\"uller, Christoph and Weindl, Isabelle and Dietrich, Jan Philip and Lotze-Campen, Hermann and Kreidenweis, Ulrich and Rolinski, Susanne and Biewald, Anne and Wang, Xiaoxi} + title = {Agriculture, {Forestry}, and {Other} {Land}-{Use} {Emissions} {Abatement}: {Mitigation} {Strategies} and {Consequences} for {Food} {Prices}}, + journal = {Environmental Science \& Technology}, + author = {Stevanovic, Miodrag and Popp, Alexander and Bodirsky, Benjamin L. and Humpenöder, Florian and M\"uller, Christoph and Weindl, Isabelle and Dietrich, Jan Philip and Lotze-Campen, Hermann and Kreidenweis, Ulrich and Rolinski, Susanne and Biewald, Anne and Wang, Xiaoxi} } @article{popp_land-use_nodate, - title = {Land-use futures in the shared socio-economic pathways}, - issn = {0959-3780}, - url = {http://www.sciencedirect.com/science/article/pii/S0959378016303399}, - doi = {10.1016/j.gloenvcha.2016.10.002}, - abstract = {In the future, the land system will be facing new intersecting challenges. While food demand, especially for resource-intensive livestock based commodities, is expected to increase, the terrestrial system has large potentials for climate change mitigation through improved agricultural management, providing biomass for bioenergy, and conserving or even enhancing carbon stocks of ecosystems. However, uncertainties in future socio-economic land use drivers may result in very different land-use dynamics and consequences for land-based ecosystem services. This is the first study with a systematic interpretation of the Shared Socio-Economic Pathways (SSPs) in terms of possible land-use changes and their consequences for the agricultural system, food provision and prices as well as greenhouse gas emissions. Therefore, five alternative Integrated Assessment Models with distinctive land-use modules have been used for the translation of the SSP narratives into quantitative projections. The model results reflect the general storylines of the SSPs and indicate a broad range of potential land-use futures with global agricultural land of 4900 mio ha in 2005 decreasing by 810 mio ha until 2100 at the lower (SSP1) and increasing by 1080 mio ha (SSP3) at the upper end. Greenhouse gas emissions from land use and land use change, as a direct outcome of these diverse land-use dynamics, and agricultural production systems differ strongly across SSPs (e.g. cumulative land use change emissions between 2005 and 2100 range from −54 to 402 Gt CO2). The inclusion of land-based mitigation efforts, particularly those in the most ambitious mitigation scenarios, further broadens the range of potential land futures and can strongly affect greenhouse gas dynamics and food prices. In general, it can be concluded that low demand for agricultural commodities, rapid growth in agricultural productivity and globalized trade, all most pronounced in a SSP1 world, have the potential to enhance the extent of natural ecosystems, lead to lowest greenhouse gas emissions from the land system and decrease food prices over time. The SSP-based land use pathways presented in this paper aim at supporting future climate research and provide the basis for further regional integrated assessments, biodiversity research and climate impact analysis.}, - urldate = {2016-12-23}, - journal = {Global Environmental Change}, - author = {Popp, Alexander and Calvin, Katherine and Fujimori, Shinichiro and Havlik, Petr and Humpenöder, Florian and Stehfest, Elke and Bodirsky, Benjamin Leon and Dietrich, Jan Philipp and Doelmann, Jonathan C. and Gusti, Mykola and Hasegawa, Tomoko and Kyle, Page and Obersteiner, Michael and Tabeau, Andrzej and Takahashi, Kiyoshi and Valin, Hugo and Waldhoff, Stephanie and Weindl, Isabelle and Wise, Marshall and Kriegler, Elmar and Lotze-Campen, Hermann and Fricko, Oliver and Riahi, Keywan and Vuuren, Detlef P. van}, - keywords = {land use, Emissions, mitigation, Scenarios, Integrated assessment, Food prices, SSP}, - file = {Popp et al_Land-use futures in the shared socio-economic pathways.pdf:D\:\\Dissertation\\Bibliographie\\storage\\ZUCFU4AQ\\Popp et al_Land-use futures in the shared socio-economic pathways.pdf:application/pdf;ScienceDirect Snapshot:D\:\\Dissertation\\Bibliographie\\storage\\BEHGIUR5\\S0959378016303399.html:text/html} + title = {Land-use futures in the shared socio-economic pathways}, + issn = {0959-3780}, + url = {http://www.sciencedirect.com/science/article/pii/S0959378016303399}, + doi = {10.1016/j.gloenvcha.2016.10.002}, + abstract = {In the future, the land system will be facing new intersecting challenges. While food demand, especially for resource-intensive livestock based commodities, is expected to increase, the terrestrial system has large potentials for climate change mitigation through improved agricultural management, providing biomass for bioenergy, and conserving or even enhancing carbon stocks of ecosystems. However, uncertainties in future socio-economic land use drivers may result in very different land-use dynamics and consequences for land-based ecosystem services. This is the first study with a systematic interpretation of the Shared Socio-Economic Pathways (SSPs) in terms of possible land-use changes and their consequences for the agricultural system, food provision and prices as well as greenhouse gas emissions. Therefore, five alternative Integrated Assessment Models with distinctive land-use modules have been used for the translation of the SSP narratives into quantitative projections. The model results reflect the general storylines of the SSPs and indicate a broad range of potential land-use futures with global agricultural land of 4900 mio ha in 2005 decreasing by 810 mio ha until 2100 at the lower (SSP1) and increasing by 1080 mio ha (SSP3) at the upper end. Greenhouse gas emissions from land use and land use change, as a direct outcome of these diverse land-use dynamics, and agricultural production systems differ strongly across SSPs (e.g. cumulative land use change emissions between 2005 and 2100 range from −54 to 402 Gt CO2). The inclusion of land-based mitigation efforts, particularly those in the most ambitious mitigation scenarios, further broadens the range of potential land futures and can strongly affect greenhouse gas dynamics and food prices. In general, it can be concluded that low demand for agricultural commodities, rapid growth in agricultural productivity and globalized trade, all most pronounced in a SSP1 world, have the potential to enhance the extent of natural ecosystems, lead to lowest greenhouse gas emissions from the land system and decrease food prices over time. The SSP-based land use pathways presented in this paper aim at supporting future climate research and provide the basis for further regional integrated assessments, biodiversity research and climate impact analysis.}, + urldate = {2016-12-23}, + journal = {Global Environmental Change}, + author = {Popp, Alexander and Calvin, Katherine and Fujimori, Shinichiro and Havlik, Petr and Humpenöder, Florian and Stehfest, Elke and Bodirsky, Benjamin Leon and Dietrich, Jan Philipp and Doelmann, Jonathan C. and Gusti, Mykola and Hasegawa, Tomoko and Kyle, Page and Obersteiner, Michael and Tabeau, Andrzej and Takahashi, Kiyoshi and Valin, Hugo and Waldhoff, Stephanie and Weindl, Isabelle and Wise, Marshall and Kriegler, Elmar and Lotze-Campen, Hermann and Fricko, Oliver and Riahi, Keywan and Vuuren, Detlef P. van}, + keywords = {land use, Emissions, mitigation, Scenarios, Integrated assessment, Food prices, SSP}, } @article{stevanovic_mitigation_2017, - title = {Mitigation {Strategies} for {Greenhouse} {Gas} {Emissions} from {Agriculture} and {Land}-{Use} {Change}: {Consequences} for {Food} {Prices}}, - volume = {51}, - issn = {0013-936X}, - shorttitle = {Mitigation {Strategies} for {Greenhouse} {Gas} {Emissions} from {Agriculture} and {Land}-{Use} {Change}}, - url = {http://dx.doi.org/10.1021/acs.est.6b04291}, - doi = {10.1021/acs.est.6b04291}, - abstract = {The land use sector of agriculture, forestry, and other land use (AFOLU) plays a central role in ambitious climate change mitigation efforts. Yet, mitigation policies in agriculture may be in conflict with food security related targets. Using a global agro–economic model, we analyze the impacts on food prices under mitigation policies targeting either incentives for producers (e.g., through taxes) or consumer preferences (e.g., through education programs). Despite having a similar reduction potential of 43–44\% in 2100, the two types of policy instruments result in opposite outcomes for food prices. Incentive-based mitigation, such as protecting carbon-rich forests or adopting low-emission production techniques, increase land scarcity and production costs and thereby food prices. Preference-based mitigation, such as reduced household waste or lower consumption of animal-based products, decreases land scarcity, prevents emissions leakage, and concentrates production on the most productive sites and consequently lowers food prices. Whereas agricultural emissions are further abated in the combination of these mitigation measures, the synergy of strategies fails to substantially lower food prices. Additionally, we demonstrate that the efficiency of agricultural emission abatement is stable across a range of greenhouse-gas (GHG) tax levels, while resulting food prices exhibit a disproportionally larger spread.}, - number = {1}, - urldate = {2017-01-05}, - journal = {Environmental Science \& Technology}, - author = {Stevanovic, Miodrag and Popp, Alexander and Bodirsky, Benjamin Leon and Humpenöder, Florian and M\"uller, Christoph and Weindl, Isabelle and Dietrich, Jan Philipp and Lotze-Campen, Hermann and Kreidenweis, Ulrich and Rolinski, Susanne and Biewald, Anne and Wang, Xiaoxi}, - month = jan, - year = {2017}, - pages = {365--374}, + title = {Mitigation {Strategies} for {Greenhouse} {Gas} {Emissions} from {Agriculture} and {Land}-{Use} {Change}: {Consequences} for {Food} {Prices}}, + volume = {51}, + issn = {0013-936X}, + shorttitle = {Mitigation {Strategies} for {Greenhouse} {Gas} {Emissions} from {Agriculture} and {Land}-{Use} {Change}}, + url = {http://dx.doi.org/10.1021/acs.est.6b04291}, + doi = {10.1021/acs.est.6b04291}, + abstract = {The land use sector of agriculture, forestry, and other land use (AFOLU) plays a central role in ambitious climate change mitigation efforts. Yet, mitigation policies in agriculture may be in conflict with food security related targets. Using a global agro–economic model, we analyze the impacts on food prices under mitigation policies targeting either incentives for producers (e.g., through taxes) or consumer preferences (e.g., through education programs). Despite having a similar reduction potential of 43–44\% in 2100, the two types of policy instruments result in opposite outcomes for food prices. Incentive-based mitigation, such as protecting carbon-rich forests or adopting low-emission production techniques, increase land scarcity and production costs and thereby food prices. Preference-based mitigation, such as reduced household waste or lower consumption of animal-based products, decreases land scarcity, prevents emissions leakage, and concentrates production on the most productive sites and consequently lowers food prices. Whereas agricultural emissions are further abated in the combination of these mitigation measures, the synergy of strategies fails to substantially lower food prices. Additionally, we demonstrate that the efficiency of agricultural emission abatement is stable across a range of greenhouse-gas (GHG) tax levels, while resulting food prices exhibit a disproportionally larger spread.}, + number = {1}, + urldate = {2017-01-05}, + journal = {Environmental Science \& Technology}, + author = {Stevanovic, Miodrag and Popp, Alexander and Bodirsky, Benjamin Leon and Humpenöder, Florian and M\"uller, Christoph and Weindl, Isabelle and Dietrich, Jan Philipp and Lotze-Campen, Hermann and Kreidenweis, Ulrich and Rolinski, Susanne and Biewald, Anne and Wang, Xiaoxi}, + month = jan, + year = {2017}, + pages = {365--374}, } @article{kriegler_fossil-fueled_2017, - title = {Fossil-fueled development ({SSP}5): {An} energy and resource intensive scenario for the 21st century}, - volume = {42}, - issn = {0959-3780}, - shorttitle = {Fossil-fueled development ({SSP}5)}, - url = {http://www.sciencedirect.com/science/article/pii/S0959378016300711}, - doi = {10.1016/j.gloenvcha.2016.05.015}, - abstract = {This paper presents a set of energy and resource intensive scenarios based on the concept of Shared Socio-Economic Pathways (SSPs). The scenario family is characterized by rapid and fossil-fueled development with high socio-economic challenges to mitigation and low socio-economic challenges to adaptation (SSP5). A special focus is placed on the SSP5 marker scenario developed by the REMIND-MAgPIE integrated assessment modeling framework. The SSP5 baseline scenarios exhibit very high levels of fossil fuel use, up to a doubling of global food demand, and up to a tripling of energy demand and greenhouse gas emissions over the course of the century, marking the upper end of the scenario literature in several dimensions. These scenarios are currently the only SSP scenarios that result in a radiative forcing pathway as high as the highest Representative Concentration Pathway (RCP8.5). This paper further investigates the direct impact of mitigation policies on the SSP5 energy, land and emissions dynamics confirming high socio-economic challenges to mitigation in SSP5. Nonetheless, mitigation policies reaching climate forcing levels as low as in the lowest Representative Concentration Pathway (RCP2.6) are accessible in SSP5. The SSP5 scenarios presented in this paper aim to provide useful reference points for future climate change, climate impact, adaption and mitigation analysis, and broader questions of sustainable development.}, - urldate = {2017-04-19}, - journal = {Global Environmental Change}, - author = {Kriegler, Elmar and Bauer, Nico and Popp, Alexander and Humpenöder, Florian and Leimbach, Marian and Strefler, Jessica and Baumstark, Lavinia and Bodirsky, Benjamin Leon and Hilaire, Jérôme and Klein, David and Mouratiadou, Ioanna and Weindl, Isabelle and Bertram, Christoph and Dietrich, Jan-Philipp and Luderer, Gunnar and Pehl, Michaja and Pietzcker, Robert and Piontek, Franziska and Lotze-Campen, Hermann and Biewald, Anne and Bonsch, Markus and Giannousakis, Anastasis and Kreidenweis, Ulrich and M\"uller, Christoph and Rolinski, Susanne and Schultes, Anselm and Schwanitz, Jana and Stevanovic, Miodrag and Calvin, Katherine and Emmerling, Johannes and Fujimori, Shinichiro and Edenhofer, Ottmar}, - month = jan, - year = {2017}, - keywords = {Land-use change, Integrated assessment modeling, Shared Socio-economic Pathway, SSP5, Emission scenario, Energy transformation}, - pages = {297--315}, - file = {Kriegler et al_2017_Fossil-fueled development (SSP5).pdf:D\:\\Dissertation\\Bibliographie\\storage\\9AQM88TX\\Kriegler et al_2017_Fossil-fueled development (SSP5).pdf:application/pdf;mmc1.docx:D\:\\Dissertation\\Bibliographie\\storage\\KM3PTGHX\\mmc1.docx:application/vnd.openxmlformats-officedocument.wordprocessingml.document;ScienceDirect Snapshot:D\:\\Dissertation\\Bibliographie\\storage\\JB6XHVN6\\S0959378016300711.html:text/html} + title = {Fossil-fueled development ({SSP}5): {An} energy and resource intensive scenario for the 21st century}, + volume = {42}, + issn = {0959-3780}, + shorttitle = {Fossil-fueled development ({SSP}5)}, + url = {http://www.sciencedirect.com/science/article/pii/S0959378016300711}, + doi = {10.1016/j.gloenvcha.2016.05.015}, + abstract = {This paper presents a set of energy and resource intensive scenarios based on the concept of Shared Socio-Economic Pathways (SSPs). The scenario family is characterized by rapid and fossil-fueled development with high socio-economic challenges to mitigation and low socio-economic challenges to adaptation (SSP5). A special focus is placed on the SSP5 marker scenario developed by the REMIND-MAgPIE integrated assessment modeling framework. The SSP5 baseline scenarios exhibit very high levels of fossil fuel use, up to a doubling of global food demand, and up to a tripling of energy demand and greenhouse gas emissions over the course of the century, marking the upper end of the scenario literature in several dimensions. These scenarios are currently the only SSP scenarios that result in a radiative forcing pathway as high as the highest Representative Concentration Pathway (RCP8.5). This paper further investigates the direct impact of mitigation policies on the SSP5 energy, land and emissions dynamics confirming high socio-economic challenges to mitigation in SSP5. Nonetheless, mitigation policies reaching climate forcing levels as low as in the lowest Representative Concentration Pathway (RCP2.6) are accessible in SSP5. The SSP5 scenarios presented in this paper aim to provide useful reference points for future climate change, climate impact, adaption and mitigation analysis, and broader questions of sustainable development.}, + urldate = {2017-04-19}, + journal = {Global Environmental Change}, + author = {Kriegler, Elmar and Bauer, Nico and Popp, Alexander and Humpenöder, Florian and Leimbach, Marian and Strefler, Jessica and Baumstark, Lavinia and Bodirsky, Benjamin Leon and Hilaire, Jérôme and Klein, David and Mouratiadou, Ioanna and Weindl, Isabelle and Bertram, Christoph and Dietrich, Jan-Philipp and Luderer, Gunnar and Pehl, Michaja and Pietzcker, Robert and Piontek, Franziska and Lotze-Campen, Hermann and Biewald, Anne and Bonsch, Markus and Giannousakis, Anastasis and Kreidenweis, Ulrich and M\"uller, Christoph and Rolinski, Susanne and Schultes, Anselm and Schwanitz, Jana and Stevanovic, Miodrag and Calvin, Katherine and Emmerling, Johannes and Fujimori, Shinichiro and Edenhofer, Ottmar}, + month = jan, + year = {2017}, + keywords = {Land-use change, Integrated assessment modeling, Shared Socio-economic Pathway, SSP5, Emission scenario, Energy transformation}, + pages = {297--315}, } @article{popp_land-use_2017, - title = {Land-use futures in the shared socio-economic pathways}, - volume = {42}, - issn = {0959-3780}, - url = {http://www.sciencedirect.com/science/article/pii/S0959378016303399}, - doi = {10.1016/j.gloenvcha.2016.10.002}, - abstract = {In the future, the land system will be facing new intersecting challenges. While food demand, especially for resource-intensive livestock based commodities, is expected to increase, the terrestrial system has large potentials for climate change mitigation through improved agricultural management, providing biomass for bioenergy, and conserving or even enhancing carbon stocks of ecosystems. However, uncertainties in future socio-economic land use drivers may result in very different land-use dynamics and consequences for land-based ecosystem services. This is the first study with a systematic interpretation of the Shared Socio-Economic Pathways (SSPs) in terms of possible land-use changes and their consequences for the agricultural system, food provision and prices as well as greenhouse gas emissions. Therefore, five alternative Integrated Assessment Models with distinctive land-use modules have been used for the translation of the SSP narratives into quantitative projections. The model results reflect the general storylines of the SSPs and indicate a broad range of potential land-use futures with global agricultural land of 4900 mio ha in 2005 decreasing by 743 mio ha until 2100 at the lower (SSP1) and increasing by 1080 mio ha (SSP3) at the upper end. Greenhouse gas emissions from land use and land use change, as a direct outcome of these diverse land-use dynamics, and agricultural production systems differ strongly across SSPs (e.g. cumulative land use change emissions between 2005 and 2100 range from −54 to 402 Gt CO2). The inclusion of land-based mitigation efforts, particularly those in the most ambitious mitigation scenarios, further broadens the range of potential land futures and can strongly affect greenhouse gas dynamics and food prices. In general, it can be concluded that low demand for agricultural commodities, rapid growth in agricultural productivity and globalized trade, all most pronounced in a SSP1 world, have the potential to enhance the extent of natural ecosystems, lead to lowest greenhouse gas emissions from the land system and decrease food prices over time. The SSP-based land use pathways presented in this paper aim at supporting future climate research and provide the basis for further regional integrated assessments, biodiversity research and climate impact analysis.}, - urldate = {2017-04-19}, - journal = {Global Environmental Change}, - author = {Popp, Alexander and Calvin, Katherine and Fujimori, Shinichiro and Havlik, Petr and Humpenöder, Florian and Stehfest, Elke and Bodirsky, Benjamin Leon and Dietrich, Jan Philipp and Doelmann, Jonathan C. and Gusti, Mykola and Hasegawa, Tomoko and Kyle, Page and Obersteiner, Michael and Tabeau, Andrzej and Takahashi, Kiyoshi and Valin, Hugo and Waldhoff, Stephanie and Weindl, Isabelle and Wise, Marshall and Kriegler, Elmar and Lotze-Campen, Hermann and Fricko, Oliver and Riahi, Keywan and Vuuren, Detlef P. van}, - month = jan, - year = {2017}, - keywords = {land use, Emissions, mitigation, Scenarios, Integrated assessment, Food prices, SSP}, - pages = {331--345}, - file = {Popp et al_2017_Land-use futures in the shared socio-economic pathways.pdf:D\:\\Dissertation\\Bibliographie\\storage\\GDZ2DUXQ\\Popp et al_2017_Land-use futures in the shared socio-economic pathways.pdf:application/pdf;ScienceDirect Snapshot:D\:\\Dissertation\\Bibliographie\\storage\\R7UWJ824\\S0959378016303399.html:text/html} + title = {Land-use futures in the shared socio-economic pathways}, + volume = {42}, + issn = {0959-3780}, + url = {http://www.sciencedirect.com/science/article/pii/S0959378016303399}, + doi = {10.1016/j.gloenvcha.2016.10.002}, + abstract = {In the future, the land system will be facing new intersecting challenges. While food demand, especially for resource-intensive livestock based commodities, is expected to increase, the terrestrial system has large potentials for climate change mitigation through improved agricultural management, providing biomass for bioenergy, and conserving or even enhancing carbon stocks of ecosystems. However, uncertainties in future socio-economic land use drivers may result in very different land-use dynamics and consequences for land-based ecosystem services. This is the first study with a systematic interpretation of the Shared Socio-Economic Pathways (SSPs) in terms of possible land-use changes and their consequences for the agricultural system, food provision and prices as well as greenhouse gas emissions. Therefore, five alternative Integrated Assessment Models with distinctive land-use modules have been used for the translation of the SSP narratives into quantitative projections. The model results reflect the general storylines of the SSPs and indicate a broad range of potential land-use futures with global agricultural land of 4900 mio ha in 2005 decreasing by 743 mio ha until 2100 at the lower (SSP1) and increasing by 1080 mio ha (SSP3) at the upper end. Greenhouse gas emissions from land use and land use change, as a direct outcome of these diverse land-use dynamics, and agricultural production systems differ strongly across SSPs (e.g. cumulative land use change emissions between 2005 and 2100 range from −54 to 402 Gt CO2). The inclusion of land-based mitigation efforts, particularly those in the most ambitious mitigation scenarios, further broadens the range of potential land futures and can strongly affect greenhouse gas dynamics and food prices. In general, it can be concluded that low demand for agricultural commodities, rapid growth in agricultural productivity and globalized trade, all most pronounced in a SSP1 world, have the potential to enhance the extent of natural ecosystems, lead to lowest greenhouse gas emissions from the land system and decrease food prices over time. The SSP-based land use pathways presented in this paper aim at supporting future climate research and provide the basis for further regional integrated assessments, biodiversity research and climate impact analysis.}, + urldate = {2017-04-19}, + journal = {Global Environmental Change}, + author = {Popp, Alexander and Calvin, Katherine and Fujimori, Shinichiro and Havlik, Petr and Humpenöder, Florian and Stehfest, Elke and Bodirsky, Benjamin Leon and Dietrich, Jan Philipp and Doelmann, Jonathan C. and Gusti, Mykola and Hasegawa, Tomoko and Kyle, Page and Obersteiner, Michael and Tabeau, Andrzej and Takahashi, Kiyoshi and Valin, Hugo and Waldhoff, Stephanie and Weindl, Isabelle and Wise, Marshall and Kriegler, Elmar and Lotze-Campen, Hermann and Fricko, Oliver and Riahi, Keywan and Vuuren, Detlef P. van}, + month = jan, + year = {2017}, + keywords = {land use, Emissions, mitigation, Scenarios, Integrated assessment, Food prices, SSP}, + pages = {331--345}, } @article{lotze-campen_cross-scale_2017, - title = {A cross-scale impact assessment of {European} nature protection policies under contrasting future socio-economic pathways}, - issn = {1436-3798, 1436-378X}, - url = {https://link.springer.com/article/10.1007/s10113-017-1167-8}, - doi = {10.1007/s10113-017-1167-8}, - abstract = {Protection of natural or semi-natural ecosystems is an important part of societal strategies for maintaining biodiversity, ecosystem services, and achieving overall sustainable development. The assessment of multiple emerging land use trade-offs is complicated by the fact that land use changes occur and have consequences at local, regional, and even global scale. Outcomes also depend on the underlying socio-economic trends. We apply a coupled, multi-scale modelling system to assess an increase in nature protection areas as a key policy option in the European Union (EU). The main goal of the analysis is to understand the interactions between policy-induced land use changes across different scales and sectors under two contrasting future socio-economic pathways. We demonstrate how complementary insights into land system change can be gained by coupling land use models for agriculture, forestry, and urban areas for Europe, in connection with other world regions. The simulated policy case of nature protection shows how the allocation of a certain share of total available land to newly protected areas, with specific management restrictions imposed, may have a range of impacts on different land-based sectors until the year 2040. Agricultural land in Europe is slightly reduced, which is partly compensated for by higher management intensity. As a consequence of higher costs, total calorie supply per capita is reduced within the EU. While wood harvest is projected to decrease, carbon sequestration rates increase in European forests. At the same time, imports of industrial roundwood from other world regions are expected to increase. Some of the aggregate effects of nature protection have very different implications at the local to regional scale in different parts of Europe. Due to nature protection measures, agricultural production is shifted from more productive land in Europe to on average less productive land in other parts of the world. This increases, at the global level, the allocation of land resources for agriculture, leading to a decrease in tropical forest areas, reduced carbon stocks, and higher greenhouse gas emissions outside of Europe. The integrated modelling framework provides a method to assess the land use effects of a single policy option while accounting for the trade-offs between locations, and between regional, European, and global scales.}, - language = {en}, - urldate = {2017-05-16}, - journal = {Regional Environmental Change}, - author = {Lotze-Campen, Hermann and Verburg, Peter H. and Popp, Alexander and Lindner, Marcus and Verkerk, Pieter J. and Moiseyev, Alexander and Schrammeijer, Elizabeth and Helming, John and Tabeau, Andrzej and Schulp, Catharina J. E. and Zanden, Emma H. van der and Lavalle, Carlo and Silva, Filipe Batista e and Walz, Ariane and Bodirsky, Benjamin}, - month = may, - year = {2017}, - pages = {1--12}, - file = {Lotze-Campen et al_2017_A cross-scale impact assessment of European nature protection policies under.pdf:D\:\\Dissertation\\Bibliographie\\storage\\9BCGPGDD\\Lotze-Campen et al_2017_A cross-scale impact assessment of European nature protection policies under.pdf:application/pdf;Snapshot:D\:\\Dissertation\\Bibliographie\\storage\\73IHRHPU\\10.html:text/html} + title = {A cross-scale impact assessment of {European} nature protection policies under contrasting future socio-economic pathways}, + issn = {1436-3798, 1436-378X}, + url = {https://link.springer.com/article/10.1007/s10113-017-1167-8}, + doi = {10.1007/s10113-017-1167-8}, + abstract = {Protection of natural or semi-natural ecosystems is an important part of societal strategies for maintaining biodiversity, ecosystem services, and achieving overall sustainable development. The assessment of multiple emerging land use trade-offs is complicated by the fact that land use changes occur and have consequences at local, regional, and even global scale. Outcomes also depend on the underlying socio-economic trends. We apply a coupled, multi-scale modelling system to assess an increase in nature protection areas as a key policy option in the European Union (EU). The main goal of the analysis is to understand the interactions between policy-induced land use changes across different scales and sectors under two contrasting future socio-economic pathways. We demonstrate how complementary insights into land system change can be gained by coupling land use models for agriculture, forestry, and urban areas for Europe, in connection with other world regions. The simulated policy case of nature protection shows how the allocation of a certain share of total available land to newly protected areas, with specific management restrictions imposed, may have a range of impacts on different land-based sectors until the year 2040. Agricultural land in Europe is slightly reduced, which is partly compensated for by higher management intensity. As a consequence of higher costs, total calorie supply per capita is reduced within the EU. While wood harvest is projected to decrease, carbon sequestration rates increase in European forests. At the same time, imports of industrial roundwood from other world regions are expected to increase. Some of the aggregate effects of nature protection have very different implications at the local to regional scale in different parts of Europe. Due to nature protection measures, agricultural production is shifted from more productive land in Europe to on average less productive land in other parts of the world. This increases, at the global level, the allocation of land resources for agriculture, leading to a decrease in tropical forest areas, reduced carbon stocks, and higher greenhouse gas emissions outside of Europe. The integrated modelling framework provides a method to assess the land use effects of a single policy option while accounting for the trade-offs between locations, and between regional, European, and global scales.}, + language = {en}, + urldate = {2017-05-16}, + journal = {Regional Environmental Change}, + author = {Lotze-Campen, Hermann and Verburg, Peter H. and Popp, Alexander and Lindner, Marcus and Verkerk, Pieter J. and Moiseyev, Alexander and Schrammeijer, Elizabeth and Helming, John and Tabeau, Andrzej and Schulp, Catharina J. E. and Zanden, Emma H. van der and Lavalle, Carlo and Silva, Filipe Batista e and Walz, Ariane and Bodirsky, Benjamin}, + month = may, + year = {2017}, + pages = {1--12}, } @article{weindl_livestock_2017, - title = {Livestock production and the water challenge of future food supply: {Implications} of agricultural management and dietary choices}, - volume = {47}, - issn = {0959-3780}, - shorttitle = {Livestock production and the water challenge of future food supply}, - url = {http://www.sciencedirect.com/science/article/pii/S0959378017303692}, - doi = {10.1016/j.gloenvcha.2017.09.010}, - abstract = {Human activities use more than half of accessible freshwater, above all for agriculture. Most approaches for reconciling water conservation with feeding a growing population focus on the cropping sector. However, livestock production is pivotal to agricultural resource use, due to its low resource-use efficiency upstream in the food supply chain. Using a global modelling approach, we quantify the current and future contribution of livestock production, under different demand- and supply-side scenarios, to the consumption of “green” precipitation water infiltrated into the soil and “blue” freshwater withdrawn from rivers, lakes and reservoirs. Currently, cropland feed production accounts for 38\% of crop water consumption and grazing involves 29\% of total agricultural water consumption (9990km3yr−1). Our analysis shows that changes in diets and livestock productivity have substantial implications for future consumption of agricultural blue water (19–36\% increase compared to current levels) and green water (26–69\% increase), but they can, at best, slow down trends of rising water requirements for decades to come. However, moderate productivity reductions in highly intensive livestock systems are possible without aggravating water scarcity. Productivity gains in developing regions decrease total agricultural water consumption, but lead to expansion of irrigated agriculture, due to the shift from grassland/green water to cropland/blue water resources. While the magnitude of the livestock water footprint gives cause for concern, neither dietary choices nor changes in livestock productivity will solve the water challenge of future food supply, unless accompanied by dedicated water protection policies.}, - number = {Supplement C}, - urldate = {2017-11-01}, - journal = {Global Environmental Change}, - author = {Weindl, Isabelle and Bodirsky, Benjamin Leon and Rolinski, Susanne and Biewald, Anne and Lotze-Campen, Hermann and M\"uller, Christoph and Dietrich, Jan Philipp and Humpenöder, Florian and Stevanovic, Miodrag and Schaphoff, Sibyll and Popp, Alexander}, - month = nov, - year = {2017}, - keywords = {livestock, water scarcity, Productivity, consumptive water use, Dietary changes, Water resources}, - pages = {121--132}, - file = {ScienceDirect Snapshot:D\:\\Dissertation\\Bibliographie\\storage\\NFCJMAWA\\S0959378017303692.html:text/html;Weindl et al_2017_Livestock production and the water challenge of future food supply.pdf:D\:\\Dissertation\\Bibliographie\\storage\\WRQZAGWU\\Weindl et al_2017_Livestock production and the water challenge of future food supply.pdf:application/pdf} + title = {Livestock production and the water challenge of future food supply: {Implications} of agricultural management and dietary choices}, + volume = {47}, + issn = {0959-3780}, + shorttitle = {Livestock production and the water challenge of future food supply}, + url = {http://www.sciencedirect.com/science/article/pii/S0959378017303692}, + doi = {10.1016/j.gloenvcha.2017.09.010}, + abstract = {Human activities use more than half of accessible freshwater, above all for agriculture. Most approaches for reconciling water conservation with feeding a growing population focus on the cropping sector. However, livestock production is pivotal to agricultural resource use, due to its low resource-use efficiency upstream in the food supply chain. Using a global modelling approach, we quantify the current and future contribution of livestock production, under different demand- and supply-side scenarios, to the consumption of “green” precipitation water infiltrated into the soil and “blue” freshwater withdrawn from rivers, lakes and reservoirs. Currently, cropland feed production accounts for 38\% of crop water consumption and grazing involves 29\% of total agricultural water consumption (9990km3yr−1). Our analysis shows that changes in diets and livestock productivity have substantial implications for future consumption of agricultural blue water (19–36\% increase compared to current levels) and green water (26–69\% increase), but they can, at best, slow down trends of rising water requirements for decades to come. However, moderate productivity reductions in highly intensive livestock systems are possible without aggravating water scarcity. Productivity gains in developing regions decrease total agricultural water consumption, but lead to expansion of irrigated agriculture, due to the shift from grassland/green water to cropland/blue water resources. While the magnitude of the livestock water footprint gives cause for concern, neither dietary choices nor changes in livestock productivity will solve the water challenge of future food supply, unless accompanied by dedicated water protection policies.}, + number = {Supplement C}, + urldate = {2017-11-01}, + journal = {Global Environmental Change}, + author = {Weindl, Isabelle and Bodirsky, Benjamin Leon and Rolinski, Susanne and Biewald, Anne and Lotze-Campen, Hermann and M\"uller, Christoph and Dietrich, Jan Philipp and Humpenöder, Florian and Stevanovic, Miodrag and Schaphoff, Sibyll and Popp, Alexander}, + month = nov, + year = {2017}, + keywords = {livestock, water scarcity, Productivity, consumptive water use, Dietary changes, Water resources}, + pages = {121--132}, } @article{weindl_livestock_2017-1, - title = {Livestock and human use of land: {Productivity} trends and dietary choices as drivers of future land and carbon dynamics}, - volume = {159}, - issn = {0921-8181}, - shorttitle = {Livestock and human use of land}, - url = {http://www.sciencedirect.com/science/article/pii/S0921818117301480}, - doi = {10.1016/j.gloplacha.2017.10.002}, - abstract = {Land use change has been the primary driving force of human alteration of terrestrial ecosystems. With 80\% of agricultural land dedicated to livestock production, the sector is an important lever to attenuate land requirements for food production and carbon emissions from land use change. In this study, we quantify impacts of changing human diets and livestock productivity on land dynamics and depletion of carbon stored in vegetation, litter and soils. Across all investigated productivity pathways, lower consumption of livestock products can substantially reduce deforestation (47–55\%) and cumulative carbon losses (34–57\%). On the supply side, already minor productivity growth in extensive livestock production systems leads to substantial CO2 emission abatement, but the emission saving potential of productivity gains in intensive systems is limited, also involving trade-offs with soil carbon stocks. If accounting for uncertainties related to future trade restrictions, crop yields and pasture productivity, the range of projected carbon savings from changing diets increases to 23–78\%. Highest abatement of carbon emissions (63–78\%) can be achieved if reduced consumption of animal-based products is combined with sustained investments into productivity increases in plant production. Our analysis emphasizes the importance to integrate demand- and supply-side oriented mitigation strategies and to combine efforts in the crop and livestock sector to enable synergies for climate protection.}, - number = {Supplement C}, - urldate = {2017-11-01}, - journal = {Global and Planetary Change}, - author = {Weindl, Isabelle and Popp, Alexander and Bodirsky, Benjamin Leon and Rolinski, Susanne and Lotze-Campen, Hermann and Biewald, Anne and Humpenöder, Florian and Dietrich, Jan Philipp and Stevanovic, Miodrag}, - month = dec, - year = {2017}, - keywords = {land use, Deforestation, Greenhouse gas mitigation, Livestock productivity, Diets, Carbon emissions}, - pages = {1--10}, - file = {ScienceDirect Snapshot:D\:\\Dissertation\\Bibliographie\\storage\\TBGT6HB2\\S0921818117301480.html:text/html;Weindl et al_2017_Livestock and human use of land.pdf:D\:\\Dissertation\\Bibliographie\\storage\\BJ5UJEN6\\Weindl et al_2017_Livestock and human use of land.pdf:application/pdf} + title = {Livestock and human use of land: {Productivity} trends and dietary choices as drivers of future land and carbon dynamics}, + volume = {159}, + issn = {0921-8181}, + shorttitle = {Livestock and human use of land}, + url = {http://www.sciencedirect.com/science/article/pii/S0921818117301480}, + doi = {10.1016/j.gloplacha.2017.10.002}, + abstract = {Land use change has been the primary driving force of human alteration of terrestrial ecosystems. With 80\% of agricultural land dedicated to livestock production, the sector is an important lever to attenuate land requirements for food production and carbon emissions from land use change. In this study, we quantify impacts of changing human diets and livestock productivity on land dynamics and depletion of carbon stored in vegetation, litter and soils. Across all investigated productivity pathways, lower consumption of livestock products can substantially reduce deforestation (47–55\%) and cumulative carbon losses (34–57\%). On the supply side, already minor productivity growth in extensive livestock production systems leads to substantial CO2 emission abatement, but the emission saving potential of productivity gains in intensive systems is limited, also involving trade-offs with soil carbon stocks. If accounting for uncertainties related to future trade restrictions, crop yields and pasture productivity, the range of projected carbon savings from changing diets increases to 23–78\%. Highest abatement of carbon emissions (63–78\%) can be achieved if reduced consumption of animal-based products is combined with sustained investments into productivity increases in plant production. Our analysis emphasizes the importance to integrate demand- and supply-side oriented mitigation strategies and to combine efforts in the crop and livestock sector to enable synergies for climate protection.}, + number = {Supplement C}, + urldate = {2017-11-01}, + journal = {Global and Planetary Change}, + author = {Weindl, Isabelle and Popp, Alexander and Bodirsky, Benjamin Leon and Rolinski, Susanne and Lotze-Campen, Hermann and Biewald, Anne and Humpenöder, Florian and Dietrich, Jan Philipp and Stevanovic, Miodrag}, + month = dec, + year = {2017}, + keywords = {land use, Deforestation, Greenhouse gas mitigation, Livestock productivity, Diets, Carbon emissions}, + pages = {1--10}, } @techreport{meijl_challenges_2017, - address = {Luxembourg}, - title = {Challenges of {Global} {Agriculture} in a {Climate} {Change} {Context} by 2050 - {AgCLIM}50}, - url = {https://publications.europa.eu/portal2012-portlet/html/downloadHandler.jsp?identifier=8724c378-562d-11e7-a5ca-01aa75ed71a1&format=pdf&language=en&productionSystem=cellar&part=}, - urldate = {2017-11-01}, - institution = {Publications Office of the European Union}, - author = {Meijl, Hans van and Havlik, Petr and Lotze-Campen, Hermann and Stehfest, Elke and Witzke, Peter and Perez Dominguez, Ignacio and Bodirsky, Benjamin Leon and van Dijk, Michiel and Doelman, Jonathan and Fellmann, T. and Humpenöder, Florian and Levin-Koopman, J and M\"uller, Christoph and Popp, Alexander and Tabeau, Andrzej and Valin, Hugo}, - year = {2017}, - pages = {64}, - file = {downloadHandler.pdf:D\:\\Dissertation\\Bibliographie\\storage\\KTKJZTJ5\\downloadHandler.pdf:application/pdf} + address = {Luxembourg}, + title = {Challenges of {Global} {Agriculture} in a {Climate} {Change} {Context} by 2050 - {AgCLIM}50}, + url = {https://publications.europa.eu/portal2012-portlet/html/downloadHandler.jsp?identifier=8724c378-562d-11e7-a5ca-01aa75ed71a1&format=pdf&language=en&productionSystem=cellar&part=}, + urldate = {2017-11-01}, + institution = {Publications Office of the European Union}, + author = {Meijl, Hans van and Havlik, Petr and Lotze-Campen, Hermann and Stehfest, Elke and Witzke, Peter and Perez Dominguez, Ignacio and Bodirsky, Benjamin Leon and van Dijk, Michiel and Doelman, Jonathan and Fellmann, T. and Humpenöder, Florian and Levin-Koopman, J and M\"uller, Christoph and Popp, Alexander and Tabeau, Andrzej and Valin, Hugo}, + year = {2017}, + pages = {64}, } @article{krause_global_2017, - title = {Global consequences of afforestation and bioenergy cultivation on ecosystem service indicators}, - volume = {14}, - issn = {1726-4189}, - url = {https://www.biogeosciences.net/14/4829/2017/}, - doi = {10.5194/bg-14-4829-2017}, - abstract = {Land management for carbon storage is discussed as being indispensable for climate change mitigation because of its large potential to remove carbon dioxide from the atmosphere, and to avoid further emissions from deforestation. However, the acceptance and feasibility of land-based mitigation projects depends on potential side effects on other important ecosystem functions and their services. Here, we use projections of future land use and land cover for different land-based mitigation options from two land-use models (IMAGE and MAgPIE) and evaluate their effects with a global dynamic vegetation model (LPJ-GUESS). In the land-use models, carbon removal was achieved either via growth of bioenergy crops combined with carbon capture and storage, via avoided deforestation and afforestation, or via a combination of both. We compare these scenarios to a reference scenario without land-based mitigation and analyse the LPJ-GUESS simulations with the aim of assessing synergies and trade-offs across a range of ecosystem service indicators: carbon storage, surface albedo, evapotranspiration, water runoff, crop production, nitrogen loss, and emissions of biogenic volatile organic compounds. In our mitigation simulations cumulative carbon storage by year 2099 ranged between 55 and 89 GtC. Other ecosystem service indicators were influenced heterogeneously both positively and negatively, with large variability across regions and land-use scenarios. Avoided deforestation and afforestation led to an increase in evapotranspiration and enhanced emissions of biogenic volatile organic compounds, and to a decrease in albedo, runoff, and nitrogen loss. Crop production could also decrease in the afforestation scenarios as a result of reduced crop area, especially for MAgPIE land-use patterns, if assumed increases in crop yields cannot be realized. Bioenergy-based climate change mitigation was projected to affect less area globally than in the forest expansion scenarios, and resulted in less pronounced changes in most ecosystem service indicators than forest-based mitigation, but included a possible decrease in nitrogen loss, crop production, and biogenic volatile organic compounds emissions.}, - number = {21}, - urldate = {2017-11-03}, - journal = {Biogeosciences}, - author = {Krause, A. and Pugh, T. A. M. and Bayer, A. D. and Doelman, J. C. and Humpenöder, F. and Anthoni, P. and Olin, S. and Bodirsky, B. L. and Popp, A. and Stehfest, E. and Arneth, A.}, - month = nov, - year = {2017}, - pages = {4829--4850}, - file = {Krause et al_2017_Global consequences of afforestation and bioenergy cultivation on ecosystem.pdf:D\:\\Dissertation\\Bibliographie\\storage\\PKIRMHI8\\Krause et al_2017_Global consequences of afforestation and bioenergy cultivation on ecosystem.pdf:application/pdf} + title = {Global consequences of afforestation and bioenergy cultivation on ecosystem service indicators}, + volume = {14}, + issn = {1726-4189}, + url = {https://www.biogeosciences.net/14/4829/2017/}, + doi = {10.5194/bg-14-4829-2017}, + abstract = {Land management for carbon storage is discussed as being indispensable for climate change mitigation because of its large potential to remove carbon dioxide from the atmosphere, and to avoid further emissions from deforestation. However, the acceptance and feasibility of land-based mitigation projects depends on potential side effects on other important ecosystem functions and their services. Here, we use projections of future land use and land cover for different land-based mitigation options from two land-use models (IMAGE and MAgPIE) and evaluate their effects with a global dynamic vegetation model (LPJ-GUESS). In the land-use models, carbon removal was achieved either via growth of bioenergy crops combined with carbon capture and storage, via avoided deforestation and afforestation, or via a combination of both. We compare these scenarios to a reference scenario without land-based mitigation and analyse the LPJ-GUESS simulations with the aim of assessing synergies and trade-offs across a range of ecosystem service indicators: carbon storage, surface albedo, evapotranspiration, water runoff, crop production, nitrogen loss, and emissions of biogenic volatile organic compounds. In our mitigation simulations cumulative carbon storage by year 2099 ranged between 55 and 89 GtC. Other ecosystem service indicators were influenced heterogeneously both positively and negatively, with large variability across regions and land-use scenarios. Avoided deforestation and afforestation led to an increase in evapotranspiration and enhanced emissions of biogenic volatile organic compounds, and to a decrease in albedo, runoff, and nitrogen loss. Crop production could also decrease in the afforestation scenarios as a result of reduced crop area, especially for MAgPIE land-use patterns, if assumed increases in crop yields cannot be realized. Bioenergy-based climate change mitigation was projected to affect less area globally than in the forest expansion scenarios, and resulted in less pronounced changes in most ecosystem service indicators than forest-based mitigation, but included a possible decrease in nitrogen loss, crop production, and biogenic volatile organic compounds emissions.}, + number = {21}, + urldate = {2017-11-03}, + journal = {Biogeosciences}, + author = {Krause, A. and Pugh, T. A. M. and Bayer, A. D. and Doelman, J. C. and Humpenöder, F. and Anthoni, P. and Olin, S. and Bodirsky, B. L. and Popp, A. and Stehfest, E. and Arneth, A.}, + month = nov, + year = {2017}, + pages = {4829--4850}, } @article{humpenoeder_bioenergy_2018, - title = {Large-scale bioenergy production: how to resolve sustainability trade-offs?}, - volume = {13}, - copyright = {All rights reserved}, - issn = {1748-9326}, - shorttitle = {Large-scale bioenergy production}, - url = {http://stacks.iop.org/1748-9326/13/i=2/a=024011}, - doi = {10.1088/1748-9326/aa9e3b}, - abstract = {Large-scale 2nd generation bioenergy deployment is a key element of 1.5 °C and 2 °C transformation pathways. However, large-scale bioenergy production might have negative sustainability implications and thus may conflict with the Sustainable Development Goal (SDG) agenda. Here, we carry out a multi-criteria sustainability assessment of large-scale bioenergy crop production throughout the 21st century (300 EJ in 2100) using a global land-use model. Our analysis indicates that large-scale bioenergy production without complementary measures results in negative effects on the following sustainability indicators: deforestation, CO 2 emissions from land-use change, nitrogen losses, unsustainable water withdrawals and food prices. One of our main findings is that single-sector environmental protection measures next to large-scale bioenergy production are prone to involve trade-offs among these sustainability indicators—at least in the absence of more efficient land or water resource use. For instance, if bioenergy production is accompanied by forest protection, deforestation and associated emissions (SDGs 13 and 15) decline substantially whereas food prices (SDG 2) increase. However, our study also shows that this trade-off strongly depends on the development of future food demand. In contrast to environmental protection measures, we find that agricultural intensification lowers some side-effects of bioenergy production substantially (SDGs 13 and 15) without generating new trade-offs—at least among the sustainability indicators considered here. Moreover, our results indicate that a combination of forest and water protection schemes, improved fertilization efficiency, and agricultural intensification would reduce the side-effects of bioenergy production most comprehensively. However, although our study includes more sustainability indicators than previous studies on bioenergy side-effects, our study represents only a small subset of all indicators relevant for the SDG agenda. Based on this, we argue that the development of policies for regulating externalities of large-scale bioenergy production should rely on broad sustainability assessments to discover potential trade-offs with the SDG agenda before implementation.}, - language = {en}, - number = {2}, - urldate = {2018-02-01}, - journal = {Environmental Research Letters}, - author = {Humpenöder, Florian and Popp, Alexander and Bodirsky, Benjamin Leon and Weindl, Isabelle and Biewald, Anne and {Hermann Lotze-Campen} and Dietrich, Jan Philipp and Klein, David and Kreidenweis, Ulrich and Müller, Christoph and {Susanne Rolinski} and Stevanovic, Miodrag}, - year = {2018}, - pages = {024011}, - file = {ERL_024011_SD.pdf:/Users/flo/Zotero/storage/Q9H26XN5/ERL_024011_SD.pdf:application/pdf;ERL_024011_SD.xls:/Users/flo/Zotero/storage/78AY2QKG/ERL_024011_SD.xls:application/msword;Humpenöder et al. - 2018 - Large-scale bioenergy production how to resolve s.pdf:/Users/flo/Zotero/storage/7DUNJWV9/Humpenöder et al. - 2018 - Large-scale bioenergy production how to resolve s.pdf:application/pdf} + title = {Large-scale bioenergy production: how to resolve sustainability trade-offs?}, + volume = {13}, + copyright = {All rights reserved}, + issn = {1748-9326}, + shorttitle = {Large-scale bioenergy production}, + url = {http://stacks.iop.org/1748-9326/13/i=2/a=024011}, + doi = {10.1088/1748-9326/aa9e3b}, + abstract = {Large-scale 2nd generation bioenergy deployment is a key element of 1.5 °C and 2 °C transformation pathways. However, large-scale bioenergy production might have negative sustainability implications and thus may conflict with the Sustainable Development Goal (SDG) agenda. Here, we carry out a multi-criteria sustainability assessment of large-scale bioenergy crop production throughout the 21st century (300 EJ in 2100) using a global land-use model. Our analysis indicates that large-scale bioenergy production without complementary measures results in negative effects on the following sustainability indicators: deforestation, CO 2 emissions from land-use change, nitrogen losses, unsustainable water withdrawals and food prices. One of our main findings is that single-sector environmental protection measures next to large-scale bioenergy production are prone to involve trade-offs among these sustainability indicators—at least in the absence of more efficient land or water resource use. For instance, if bioenergy production is accompanied by forest protection, deforestation and associated emissions (SDGs 13 and 15) decline substantially whereas food prices (SDG 2) increase. However, our study also shows that this trade-off strongly depends on the development of future food demand. In contrast to environmental protection measures, we find that agricultural intensification lowers some side-effects of bioenergy production substantially (SDGs 13 and 15) without generating new trade-offs—at least among the sustainability indicators considered here. Moreover, our results indicate that a combination of forest and water protection schemes, improved fertilization efficiency, and agricultural intensification would reduce the side-effects of bioenergy production most comprehensively. However, although our study includes more sustainability indicators than previous studies on bioenergy side-effects, our study represents only a small subset of all indicators relevant for the SDG agenda. Based on this, we argue that the development of policies for regulating externalities of large-scale bioenergy production should rely on broad sustainability assessments to discover potential trade-offs with the SDG agenda before implementation.}, + language = {en}, + number = {2}, + urldate = {2018-02-01}, + journal = {Environmental Research Letters}, + author = {Humpenöder, Florian and Popp, Alexander and Bodirsky, Benjamin Leon and Weindl, Isabelle and Biewald, Anne and {Hermann Lotze-Campen} and Dietrich, Jan Philipp and Klein, David and Kreidenweis, Ulrich and Müller, Christoph and {Susanne Rolinski} and Stevanovic, Miodrag}, + year = {2018}, + pages = {024011}, +} + +@article{humpenoder_peatland_2020, + title = {Peatland protection and restoration are key for climate change mitigation}, + volume = {15}, + copyright = {All rights reserved}, + issn = {1748-9326}, + url = {https://doi.org/10.1088%2F1748-9326%2Fabae2a}, + doi = {10.1088/1748-9326/abae2a}, + abstract = {Peatlands cover only about 3\% the global land area, but store about twice as much carbon as global forest biomass. If intact peatlands are drained for agriculture or other human uses, peat oxidation can result in considerable CO2 emissions and other greenhouse gases (GHG) for decades or even centuries. Despite their importance, emissions from degraded peatlands have so far not been included explicitly in mitigation pathways compatible with the Paris Agreement. Such pathways include land-demanding mitigation options like bioenergy or afforestation with substantial consequences for the land system. Therefore, besides GHG emissions owing to the historic conversion of intact peatlands, the increased demand for land in current mitigation pathways could result in drainage of presently intact peatlands, e.g. for bioenergy production. Here, we present the first quantitative model-based projections of future peatland dynamics and associated GHG emissions in the context of a 2 °C mitigation pathway. Our spatially explicit land-use modelling approach with global coverage simultaneously accounts for future food demand, based on population and income projections, and land-based mitigation measures. Without dedicated peatland policy and even in the case of peatland protection, our results indicate that the land system would remain a net source of CO2 throughout the 21st century. This result is in contrast to the outcome of current mitigation pathways, in which the land system turns into a net carbon sink by 2100. However, our results indicate that it is possible to reconcile land use and GHG emissions in mitigation pathways through a peatland protection and restoration policy. According to our results, the land system would turn into a global net carbon sink by 2100, as projected by current mitigation pathways, if about 60\% of present-day degraded peatlands would be rewetted in the coming decades, next to the protection of intact peatlands.}, + language = {en}, + number = {10}, + urldate = {2020-10-12}, + journal = {Environmental Research Letters}, + author = {Humpenöder, Florian and Karstens, Kristine and Lotze-Campen, Hermann and Leifeld, Jens and Menichetti, Lorenzo and Barthelmes, Alexandra and Popp, Alexander}, + month = oct, + year = {2020}, + note = {Publisher: IOP Publishing}, + pages = {104093}, } @article{valin_fooddemand_2013, - title = {The future of food demand: understanding differences in global economic models}, - issn = {1574-0862}, - shorttitle = {The future of food demand}, - url = {https://onlinelibrary.wiley.com/doi/pdf/10.1111/agec.12089}, - doi = {10.1111/agec.12089}, - abstract = {Understanding the capacity of agricultural systems to feed the world population under climate change requires projecting future food demand. This article reviews demand modeling approaches from 10 global economic models participating in the Agricultural Model Intercomparison and Improvement Project (AgMIP). We compare food demand projections in 2050 for various regions and agricultural products under harmonized scenarios of socioeconomic development, climate change, and bioenergy expansion. In the reference scenario (SSP2), food demand increases by 59–98% between 2005 and 2050, slightly higher than the most recent FAO projection of 54% from 2005/2007. The range of results is large, in particular for animal calories (between 61% and 144%), caused by differences in demand systems specifications, and in income and price elasticities. The results are more sensitive to socioeconomic assumptions than to climate change or bioenergy scenarios. When considering a world with higher population and lower economic growth (SSP3), consumption per capita drops on average by 9% for crops and 18% for livestock. The maximum effect of climate change on calorie availability is −6% at the global level, and the effect of biofuel production on calorie availability is even smaller.}, - language = {en}, - urldate = {2018-04-09}, - journal = {Agricultural Economics}, - author = {Valin, Hugo and Sands, Ronald D. and van der Mensbrugghe, Dominique and Nelson, Gerald C. and Ahammad, Helal and Blanc, Elodie and Bodirsky, Benjamin and Fujimori, Shinichiro and Hasegawa, Tomoko and Havlik, Petr and Heyhoe, Edwina and Kyle, Page and Mason-D'Croz, Daniel and Paltsev, Sergey and Rolinski, Susanne and Tabeau, Andrzej and van Meijl, Hans and von Lampe, Martin and Willenbockel, Dirk}, - year = {2013}, - volume = {45}, - number = {1}, - pages = {51-67}, - keywords = {World food demand, Socioeconomic pathways, Climate change, Computable general equilibrium, Partial equilibrium, C63, C68, Q11, Q54}, - file = {} + title = {The future of food demand: understanding differences in global economic models}, + issn = {1574-0862}, + shorttitle = {The future of food demand}, + url = {https://onlinelibrary.wiley.com/doi/pdf/10.1111/agec.12089}, + doi = {10.1111/agec.12089}, + abstract = {Understanding the capacity of agricultural systems to feed the world population under climate change requires projecting future food demand. This article reviews demand modeling approaches from 10 global economic models participating in the Agricultural Model Intercomparison and Improvement Project (AgMIP). We compare food demand projections in 2050 for various regions and agricultural products under harmonized scenarios of socioeconomic development, climate change, and bioenergy expansion. In the reference scenario (SSP2), food demand increases by 59–98% between 2005 and 2050, slightly higher than the most recent FAO projection of 54% from 2005/2007. The range of results is large, in particular for animal calories (between 61% and 144%), caused by differences in demand systems specifications, and in income and price elasticities. The results are more sensitive to socioeconomic assumptions than to climate change or bioenergy scenarios. When considering a world with higher population and lower economic growth (SSP3), consumption per capita drops on average by 9% for crops and 18% for livestock. The maximum effect of climate change on calorie availability is −6% at the global level, and the effect of biofuel production on calorie availability is even smaller.}, + language = {en}, + urldate = {2018-04-09}, + journal = {Agricultural Economics}, + author = {Valin, Hugo and Sands, Ronald D. and van der Mensbrugghe, Dominique and Nelson, Gerald C. and Ahammad, Helal and Blanc, Elodie and Bodirsky, Benjamin and Fujimori, Shinichiro and Hasegawa, Tomoko and Havlik, Petr and Heyhoe, Edwina and Kyle, Page and Mason-D'Croz, Daniel and Paltsev, Sergey and Rolinski, Susanne and Tabeau, Andrzej and van Meijl, Hans and von Lampe, Martin and Willenbockel, Dirk}, + year = {2013}, + volume = {45}, + number = {1}, + pages = {51-67}, + keywords = {World food demand, Socioeconomic pathways, Climate change, Computable general equilibrium, Partial equilibrium, C63, C68, Q11, Q54}, } @techreport{nelson_transport_2008, - address = {Luxembourg}, - title = {Travel time to major cities: A global map of Accessibility}, - url = {http://forobs.jrc.ec.europa.eu/products/gam/index.php}, - urldate = {2018-09-04}, - doi = {10.2788/95835}, - isbn = {978-92-79-09771-3}, - institution = {Office for Official Publications of the European Communities}, - author = {Nelson, A}, - year = {2008} + address = {Luxembourg}, + title = {Travel time to major cities: A global map of Accessibility}, + url = {http://forobs.jrc.ec.europa.eu/products/gam/index.php}, + urldate = {2018-09-04}, + doi = {10.2788/95835}, + isbn = {978-92-79-09771-3}, + institution = {Office for Official Publications of the European Communities}, + author = {Nelson, A}, + year = {2008} } @article{mueller_projecting_2014, - title = {Projecting future crop productivity for global economic modeling.}, - journal = {Agricultural Economics}, - volume = {45}, - number = {1}, - pages = {37-50}, - author = {M\"uller, C., and Robertson, R. D.}, - year = {2014} + title = {Projecting future crop productivity for global economic modeling.}, + journal = {Agricultural Economics}, + volume = {45}, + number = {1}, + pages = {37-50}, + author = {M\"uller, C., and Robertson, R. D.}, + year = {2014} } - @article{hurtt2018luh2, - title={LUH2: Harmonization of global land-use scenarios for the period 850-2100}, - author={Hurtt, George C and Chini, Louise P and Sahajpal, Ritvik and Frolking, Steve E and Bodirsky, Benjamin and Calvin, Katherine V and Doelman, Jonathan C and Fisk, Justin and Fujimori, Shinichiro and Goldewijk, Kees and et al.}, - journal={AGUFM}, - volume={2018}, - pages={GC13A--01}, - year={2018} + title = {LUH2: Harmonization of global land-use scenarios for the period 850-2100}, + author = {Hurtt, George C and Chini, Louise P and Sahajpal, Ritvik and Frolking, Steve E and Bodirsky, Benjamin and Calvin, Katherine V and Doelman, Jonathan C and Fisk, Justin and Fujimori, Shinichiro and Goldewijk, Kees and et al.}, + journal = {AGUFM}, + volume = {2018}, + pages = {GC13A--01}, + year = {2018} } @article{biemans_water_2011, - author = {H. Biemans and I. Haddeland and P. Kabat and F. Ludwig and R. W. A. Hutjes and J. Heinke and W. von Bloh and D. Gerten}, - title = {Impact of reservoirs on river discharge and irrigation water supply during the 20th century}, - journal = {Water Resources Research}, - volume = {47}, - number = {3}, - pages = {}, - issn = {1944-7973}, - keywords = {global water resources, irrigation, reservoirs, human impacts}, - doi = {10.1029/2009WR008929}, - url = {https://agupubs.onlinelibrary.wiley.com/doi/abs/10.1029/2009WR008929}, - urldate = {2018-14-04}, - eprint = {https://agupubs.onlinelibrary.wiley.com/doi/pdf/10.1029/2009WR008929}, - abstract = {This paper presents a quantitative estimation of the impact of reservoirs on discharge and irrigation water supply during the 20th century at global, continental, and river basin scale. Compared to a natural situation the combined effect of reservoir operation and irrigation extractions decreased mean annual discharge to oceans and significantly changed the timing of this discharge. For example, in Europe, May discharge decreased by 10\%, while in February it increased by 8\%. At the end of the 20th century, reservoir operations and irrigation extractions decreased annual global discharge by about 2.1\% (930 km3 yr−1). Simulation results show that reservoirs contribute significantly to irrigation water supply in many regions. Basins that rely heavily on reservoir water are the Colorado and Columbia River basins in the United States and several large basins in India, China, and central Asia (e.g., in the Krishna and Huang He basins, reservoirs more than doubled surface water supply). Continents gaining the most are North America, Africa, and Asia, where reservoirs supplied 57, 22, and 360 km3 yr−1 respectively between 1981–2000, which is in all cases 40\% more than the availability in the situation without reservoirs. Globally, the irrigation water supply from reservoirs increased from around 18 km3 yr−1 (adding 5\% to surface water supply) at the beginning of the 20th century to 460 km3 yr−1 (adding almost 40\% to surface water supply) at the end of the 20th century. The analysis is performed using a newly developed and validated reservoir operation scheme within a global‐scale hydrology and vegetation model (LPJmL).}, - year = {2011}, + author = {H. Biemans and I. Haddeland and P. Kabat and F. Ludwig and R. W. A. Hutjes and J. Heinke and W. von Bloh and D. Gerten}, + title = {Impact of reservoirs on river discharge and irrigation water supply during the 20th century}, + journal = {Water Resources Research}, + volume = {47}, + number = {3}, + pages = {}, + issn = {1944-7973}, + keywords = {global water resources, irrigation, reservoirs, human impacts}, + doi = {10.1029/2009WR008929}, + url = {https://agupubs.onlinelibrary.wiley.com/doi/abs/10.1029/2009WR008929}, + urldate = {2018-14-04}, + eprint = {https://agupubs.onlinelibrary.wiley.com/doi/pdf/10.1029/2009WR008929}, + abstract = {This paper presents a quantitative estimation of the impact of reservoirs on discharge and irrigation water supply during the 20th century at global, continental, and river basin scale. Compared to a natural situation the combined effect of reservoir operation and irrigation extractions decreased mean annual discharge to oceans and significantly changed the timing of this discharge. For example, in Europe, May discharge decreased by 10\%, while in February it increased by 8\%. At the end of the 20th century, reservoir operations and irrigation extractions decreased annual global discharge by about 2.1\% (930 km3 yr−1). Simulation results show that reservoirs contribute significantly to irrigation water supply in many regions. Basins that rely heavily on reservoir water are the Colorado and Columbia River basins in the United States and several large basins in India, China, and central Asia (e.g., in the Krishna and Huang He basins, reservoirs more than doubled surface water supply). Continents gaining the most are North America, Africa, and Asia, where reservoirs supplied 57, 22, and 360 km3 yr−1 respectively between 1981–2000, which is in all cases 40\% more than the availability in the situation without reservoirs. Globally, the irrigation water supply from reservoirs increased from around 18 km3 yr−1 (adding 5\% to surface water supply) at the beginning of the 20th century to 460 km3 yr−1 (adding almost 40\% to surface water supply) at the end of the 20th century. The analysis is performed using a newly developed and validated reservoir operation scheme within a global‐scale hydrology and vegetation model (LPJmL).}, + year = {2011}, } @article{bondeau_lpjml_2007, - author = {Alberte Bondeau and Pascalle C. Smith and Sönke Zaehle And Sibyll Schaphoff and Wolfgang Lucht and Wolfgang Cramer and Dieter Gerten and Hermann Lotze-Campen and Christoph M\"uller and Markus Reichstein and Benjamin Smith}, - title = {Modelling the role of agriculture for the 20th century global terrestrial carbon balance}, - journal = {Global Change Biology}, - volume = {13}, - number = {3}, - pages = {679-706}, - issn = {1365-2486}, - keywords = {agriculture, crop functional type, global biogeochemistry}, - doi = {10.1111/j.1365-2486.2006.01305.x}, - url = {https://onlinelibrary.wiley.com/doi/abs/10.1111/j.1365-2486.2006.01305.x}, - urldate = {2018-14-04}, - eprint = {https://onlinelibrary.wiley.com/doi/pdf/10.1111/j.1365-2486.2006.01305.x}, - abstract = {Abstract In order to better assess the role of agriculture within the global climate‐vegetation system, we present a model of the managed planetary land surface, Lund–Potsdam–Jena managed Land (LPJmL), which simulates biophysical and biogeochemical processes as well as productivity and yield of the most important crops worldwide, using a concept of crop functional types (CFTs). Based on the LPJ‐Dynamic Global Vegetation Model, LPJmL simulates the transient changes in carbon and water cycles due to land use, the specific phenology and seasonal CO2 fluxes of agricultural‐dominated areas, and the production of crops and grazing land. It uses 13 CFTs (11 arable crops and two managed grass types), with specific parameterizations of phenology connected to leaf area development. Carbon is allocated daily towards four carbon pools, one being the yield-bearing storage organs. Management (irrigation, treatment of residues, intercropping) can be considered in order to capture their effect on productivity, on soil organic carbon and on carbon extracted from the ecosystem. For transient simulations for the 20th century, a global historical land use data set was developed, providing the annual cover fraction of the 13 CFTs, rain‐fed and/or irrigated, within 0.5° grid cells for the period 1901–2000, using published data on land use, crop distributions and irrigated areas. Several key results are compared with observations. The simulated spatial distribution of sowing dates for temperate cereals is comparable with the reported crop calendars. The simulated seasonal canopy development agrees better with satellite observations when actual cropland distribution is taken into account. Simulated yields for temperate cereals and maize compare well with FAO statistics. Monthly carbon fluxes measured at three agricultural sites also compare well with simulations. Global simulations indicate a ∼24\% (respectively ∼10\%) reduction in global vegetation (respectively soil) carbon due to agriculture, and 6–9 Pg C of yearly harvested biomass in the 1990s. In contrast to simulations of the potential natural vegetation showing the land biosphere to be an increasing carbon sink during the 20th century, LPJmL simulates a net carbon source until the 1970s (due to land use), and a small sink (mostly due to changing climate and CO2) after 1970. This is comparable with earlier LPJ simulations using a more simple land use scheme, and within the uncertainty range of estimates in the 1980s and 1990s. The fluxes attributed to land use change compare well with Houghton's estimates on the land use related fluxes until the 1970s, but then they begin to diverge, probably due to the different rates of deforestation considered. The simulated impacts of agriculture on the global water cycle for the 1990s are∼5\% (respectively∼20\%) reduction in transpiration (respectively interception), and∼44\% increase in evaporation. Global runoff, which includes a simple irrigation scheme, is practically not affected.}, - year = {2007}, + author = {Alberte Bondeau and Pascalle C. Smith and Sönke Zaehle And Sibyll Schaphoff and Wolfgang Lucht and Wolfgang Cramer and Dieter Gerten and Hermann Lotze-Campen and Christoph M\"uller and Markus Reichstein and Benjamin Smith}, + title = {Modelling the role of agriculture for the 20th century global terrestrial carbon balance}, + journal = {Global Change Biology}, + volume = {13}, + number = {3}, + pages = {679-706}, + issn = {1365-2486}, + keywords = {agriculture, crop functional type, global biogeochemistry}, + doi = {10.1111/j.1365-2486.2006.01305.x}, + url = {https://onlinelibrary.wiley.com/doi/abs/10.1111/j.1365-2486.2006.01305.x}, + urldate = {2018-14-04}, + eprint = {https://onlinelibrary.wiley.com/doi/pdf/10.1111/j.1365-2486.2006.01305.x}, + abstract = {Abstract In order to better assess the role of agriculture within the global climate‐vegetation system, we present a model of the managed planetary land surface, Lund–Potsdam–Jena managed Land (LPJmL), which simulates biophysical and biogeochemical processes as well as productivity and yield of the most important crops worldwide, using a concept of crop functional types (CFTs). Based on the LPJ‐Dynamic Global Vegetation Model, LPJmL simulates the transient changes in carbon and water cycles due to land use, the specific phenology and seasonal CO2 fluxes of agricultural‐dominated areas, and the production of crops and grazing land. It uses 13 CFTs (11 arable crops and two managed grass types), with specific parameterizations of phenology connected to leaf area development. Carbon is allocated daily towards four carbon pools, one being the yield-bearing storage organs. Management (irrigation, treatment of residues, intercropping) can be considered in order to capture their effect on productivity, on soil organic carbon and on carbon extracted from the ecosystem. For transient simulations for the 20th century, a global historical land use data set was developed, providing the annual cover fraction of the 13 CFTs, rain‐fed and/or irrigated, within 0.5° grid cells for the period 1901–2000, using published data on land use, crop distributions and irrigated areas. Several key results are compared with observations. The simulated spatial distribution of sowing dates for temperate cereals is comparable with the reported crop calendars. The simulated seasonal canopy development agrees better with satellite observations when actual cropland distribution is taken into account. Simulated yields for temperate cereals and maize compare well with FAO statistics. Monthly carbon fluxes measured at three agricultural sites also compare well with simulations. Global simulations indicate a ∼24\% (respectively ∼10\%) reduction in global vegetation (respectively soil) carbon due to agriculture, and 6–9 Pg C of yearly harvested biomass in the 1990s. In contrast to simulations of the potential natural vegetation showing the land biosphere to be an increasing carbon sink during the 20th century, LPJmL simulates a net carbon source until the 1970s (due to land use), and a small sink (mostly due to changing climate and CO2) after 1970. This is comparable with earlier LPJ simulations using a more simple land use scheme, and within the uncertainty range of estimates in the 1980s and 1990s. The fluxes attributed to land use change compare well with Houghton's estimates on the land use related fluxes until the 1970s, but then they begin to diverge, probably due to the different rates of deforestation considered. The simulated impacts of agriculture on the global water cycle for the 1990s are∼5\% (respectively∼20\%) reduction in transpiration (respectively interception), and∼44\% increase in evaporation. Global runoff, which includes a simple irrigation scheme, is practically not affected.}, + year = {2007}, } @book{narayanan_gtap7_2008, - author = {Narayanan, G. Badri and Walmsley,Terrie L., Eds.}, - title = {Global Trade, Assistance, and Production: The GTAP 7 Data Base}, - publisher = {Center for Global Trade Analysis, Purdue University}, - url = {http://www.gtap.agecon.purdue.edu/databases/v7/v7_doco.asp}, - urldate = {2018-24-04}, - year = {2008}, + author = {Narayanan, G. Badri and Walmsley,Terrie L., Eds.}, + title = {Global Trade, Assistance, and Production: The GTAP 7 Data Base}, + publisher = {Center for Global Trade Analysis, Purdue University}, + url = {http://www.gtap.agecon.purdue.edu/databases/v7/v7_doco.asp}, + urldate = {2018-24-04}, + year = {2008}, } @article{siebert_FAO_2007, - author = {Stefan Siebert and Petra Döll and Sebastian Feick and Jippe Hoogeveen and Karen Frenken}, - title = {Global Map of Irrigation Areas version 4.0.1.}, - journal = {Johann Wolfgang Goethe University, Frankfurt am Main, Germany / Food and Agriculture Organization of the United Nations, Rome, Italy.}, - url = {http://www.fao.org/nr/water/aquastat/irrigationmap/index10.stm}, - year = {2007}, + author = {Stefan Siebert and Petra Döll and Sebastian Feick and Jippe Hoogeveen and Karen Frenken}, + title = {Global Map of Irrigation Areas version 4.0.1.}, + journal = {Johann Wolfgang Goethe University, Frankfurt am Main, Germany / Food and Agriculture Organization of the United Nations, Rome, Italy.}, + url = {http://www.fao.org/nr/water/aquastat/irrigationmap/index10.stm}, + year = {2007}, +} + +@book{fao_aquastat_2016, + address = {Rome}, + title = {{AQUASTAT} core database}, + publisher = {Food and Agriculture Organization of the United Nations (FAO)}, + author = {{FAO}}, + url = {{https://data.harvestportal.org/de/dataset/fao-aquastat/resource/c4668555-eb76-4882-83b1-230038e24f02?inner_span=True}}, + year = {2016}, + note = {Database accessed on 2023/02/06} } @techreport{worldbank_irrigation_1995, - title = {World Bank and Irrigation}, - institution = {World Bank}, - author = {William I. Jones}, - year = {1995}, - address = {Washington, D.C.}, + title = {World Bank and Irrigation}, + institution = {World Bank}, + author = {William I. Jones}, + year = {1995}, + address = {Washington, D.C.}, } @techreport{PIK_report104_2007, - title = {DEVELOPMENT OF FUNCTIONAL IRRIGATION TYPES FOR IMPROVED GLOBAL CROP MODELLING}, - institution = {PIK}, - author = {Janine Rohwer and Dieter Gerten and Wolfgang Lucht}, - year = {2007}, - address = {Potsdam}, + title = {DEVELOPMENT OF FUNCTIONAL IRRIGATION TYPES FOR IMPROVED GLOBAL CROP MODELLING}, + institution = {PIK}, + author = {Janine Rohwer and Dieter Gerten and Wolfgang Lucht}, + year = {2007}, + address = {Potsdam}, } @book{smakhtin_water_2004, - author = {Smakhtin, V. and C. Revenga and P. Döll and et al}, - title = {Taking into Account Environmental Water Requirements in Global-scale Water Resources Assessments}, - year = {2004}, + author = {Smakhtin, V. and C. Revenga and P. Döll and et al}, + title = {Taking into Account Environmental Water Requirements in Global-scale Water Resources Assessments}, + year = {2004}, } -@article{watergap_water_2003, - title = {Development and Testing of the WaterGAP 2 Global Model of Water Use and Availability}, - author = {Alcamo, J. and P. DÖLL and T. Henrichs and et al.}, - journal = {Hydrological Sciences Journal}, - volume = {48}, - number = {3}, - pages = {317–337}, - year = {2003}, +@article{wada_modeling_2016, + title = {Modeling global water use for the 21st century: the Water Futures and Solutions (WFaS) initiative and its approaches}, + author = {Wada, Y. and Flörke, M. and Hanasaki, N. et al.}, + journal = {Geosci. Model Dev.}, + volume = {9}, + pages = {175-222}, + year = {2016}, } @article{rubel_observed_2010, - title = {Observed and projected climate shifts 1901-2100 depicted by world maps of the {Köppen}-{Geiger} climate classification}, - issn = {,}, - url = {https://www.schweizerbart.de/papers/metz/detail/19/74932/Observed_and_projected_climate_shifts_1901_2100_de?af=crossref}, - doi = {10.1127/0941-2948/2010/0430}, - language = {en}, - urldate = {2018-05-22}, - journal = {Meteorologische Zeitschrift}, - author = {Rubel, Franz and Kottek, Markus}, - month = apr, - year = {2010}, - pages = {135--141}, - file = {Snapshot:D\:\\Dropbox\\zotero\\storage\\LAUHZEGW\\Observed_and_projected_climate_shifts_1901_2100_de.html:text/html} + title = {Observed and projected climate shifts 1901-2100 depicted by world maps of the {Köppen}-{Geiger} climate classification}, + issn = {,}, + url = {https://www.schweizerbart.de/papers/metz/detail/19/74932/Observed_and_projected_climate_shifts_1901_2100_de?af=crossref}, + doi = {10.1127/0941-2948/2010/0430}, + language = {en}, + urldate = {2018-05-22}, + journal = {Meteorologische Zeitschrift}, + author = {Rubel, Franz and Kottek, Markus}, + month = apr, + year = {2010}, + pages = {135--141}, } @phdthesis{wirsenius_human_2000, - type = {Doctoral thesis}, - title = {Human {Use} of {Land} and {Organic} {Materials}: {Modeling} the {Turnover} of {Biomass} in the {Global} {Food} {System}}, - shorttitle = {Human {Use} of {Land} and {Organic} {Materials}}, - url = {http://publications.lib.chalmers.se/publication/827-human-use-of-land-and-organic-materials-modeling-the-turnover-of-biomass-in-the-global-food-system}, - abstract = {This thesis is directed towards the issue of the long-term demand and supply of biomass for food, energy and materials. In the coming decades, the global requirements for biomass for such services are likely to increase substantially. Therefore, improved knowledge of options for mitigating the long-term production requirements and the associated effects on the Earth system is essential. {\textless}p /{\textgreater}The thesis gives a thorough survey of the current flows of biomass in the food system. This survey was carried out by means of a physical model which was developed as part of the work. For eight world regions, the model is used to calculate the necessary production of crops and other phytomass from a prescribed end-use of food, efficiency in food production and processing, as well as use of by-products and residues. The model includes all major categories of phytomass used in the food system, depicts all flows and processes on a mass and energy balance basis, and contains detailed descriptions of the production and use of all major by-products and residues generated within the system. {\textless}p /{\textgreater}The global appropriation of terrestrial phytomass production induced by the food system was estimated to some 13 Pg dry matter per year in 1992-94. Of this phytomass, about 0.97 Pg, or 7.5 percent, ended up as food commodities eaten. Animal food systems accounted for roughly two-thirds of the total appropriation of phytomass, whereas their contribution to the human diet was about one-tenth. Use of by-products and residues as feed, and for other purposes within the food system, was estimated to about 1.8 Pg dry matter, or 14 percent of the total phytomass appropriation. {\textless}p /{\textgreater}The results also show large differences in efficiency for animal food systems, between regions as well as between separate commodities. The feed conversion efficiencies of cattle meat systems were estimated to about 2 percent in industrial regions, and around 0.5 percent in most non-industrial regions (on gross energy basis). For pig and poultry systems, feed conversion efficiencies were roughly a factor of ten higher. The differences suggest that there is a substantial scope for mitigating the long-term production demand for crops and other phytomass by increases in efficiency and changes in dietary preferences.}, - language = {English}, - urldate = {2014-09-08}, - school = {Chalmers University of Technology}, - author = {Wirsenius, Stefan}, - year = {2000}, - keywords = {livestock, Diet, efficiency, biomass, Feed, global food system, industrial ecology, physical model}, + type = {Doctoral thesis}, + title = {Human {Use} of {Land} and {Organic} {Materials}: {Modeling} the {Turnover} of {Biomass} in the {Global} {Food} {System}}, + shorttitle = {Human {Use} of {Land} and {Organic} {Materials}}, + url = {http://publications.lib.chalmers.se/publication/827-human-use-of-land-and-organic-materials-modeling-the-turnover-of-biomass-in-the-global-food-system}, + abstract = {This thesis is directed towards the issue of the long-term demand and supply of biomass for food, energy and materials. In the coming decades, the global requirements for biomass for such services are likely to increase substantially. Therefore, improved knowledge of options for mitigating the long-term production requirements and the associated effects on the Earth system is essential. {\textless}p /{\textgreater}The thesis gives a thorough survey of the current flows of biomass in the food system. This survey was carried out by means of a physical model which was developed as part of the work. For eight world regions, the model is used to calculate the necessary production of crops and other phytomass from a prescribed end-use of food, efficiency in food production and processing, as well as use of by-products and residues. The model includes all major categories of phytomass used in the food system, depicts all flows and processes on a mass and energy balance basis, and contains detailed descriptions of the production and use of all major by-products and residues generated within the system. {\textless}p /{\textgreater}The global appropriation of terrestrial phytomass production induced by the food system was estimated to some 13 Pg dry matter per year in 1992-94. Of this phytomass, about 0.97 Pg, or 7.5 percent, ended up as food commodities eaten. Animal food systems accounted for roughly two-thirds of the total appropriation of phytomass, whereas their contribution to the human diet was about one-tenth. Use of by-products and residues as feed, and for other purposes within the food system, was estimated to about 1.8 Pg dry matter, or 14 percent of the total phytomass appropriation. {\textless}p /{\textgreater}The results also show large differences in efficiency for animal food systems, between regions as well as between separate commodities. The feed conversion efficiencies of cattle meat systems were estimated to about 2 percent in industrial regions, and around 0.5 percent in most non-industrial regions (on gross energy basis). For pig and poultry systems, feed conversion efficiencies were roughly a factor of ten higher. The differences suggest that there is a substantial scope for mitigating the long-term production demand for crops and other phytomass by increases in efficiency and changes in dietary preferences.}, + language = {English}, + urldate = {2014-09-08}, + school = {Chalmers University of Technology}, + author = {Wirsenius, Stefan}, + year = {2000}, + keywords = {livestock, Diet, efficiency, biomass, Feed, global food system, industrial ecology, physical model}, } @techreport{ipcc_2006_2006, - address = {IGES, Japan}, - title = {2006 {IPCC} {Guidelines} for {National} {Greenhouse} {Gas} {Inventories}}, - institution = {National Greenhouse Gas Inventories Programme}, - author = {IPCC}, - editor = {Eggleston, H.S. and Buendia, L. and Miwa, K. and Ngara, T. and Tanabe, K.}, - year = {2006} + address = {IGES, Japan}, + title = {2006 {IPCC} {Guidelines} for {National} {Greenhouse} {Gas} {Inventories}}, + institution = {National Greenhouse Gas Inventories Programme}, + author = {IPCC}, + editor = {Eggleston, H.S. and Buendia, L. and Miwa, K. and Ngara, T. and Tanabe, K.}, + year = {2006} } +@misc{calvo_buendia_ipcc_2019, + title = {{{IPCC}} 2019, 2019 {{Refinement}} to the 2006 {{IPCC Guidelines}} for {{National Greenhouse Gas Inventories}},}, + publisher = {Published: IPCC, Switzerland}, + year = {2019}, + editor = {E. {Calvo Buendia} and K. Tanabe and A. Kranjc and J. Baasansuren and M. Fukuda and S. Ngarize and A.Osako and Y. Pyrozhenko and P. Shermanau and S. Federici (eds)}, +} @article{lal_world_2005, - title = {World crop residues production and implications of its use as a biofuel}, - volume = {31}, - issn = {0160-4120}, - doi = {10.1016/j.envint.2004.09.005}, - abstract = {Reducing and off-setting anthropogenic emissions of CO(2) and other greenhouse gases (GHGs) are important strategies of mitigating the greenhouse effect. Thus, the need for developing carbon (C) neutral and renewable sources of energy is more than ever before. Use of crop residue as a possible source of feedstock for bioenergy production must be critically and objectively assessed because of its positive impact on soil C sequestration, soil quality maintenance and ecosystem functions. The amount of crop residue produced in the US is estimated at 367x10(6) Mg/year for 9 cereal crops, 450x10(6) Mg/year for 14 cereals and legumes, and 488x10(6) Mg/year for 21 crops. The amount of crop residue produced in the world is estimated at 2802x10(6) Mg/year for cereal crops, 3107x10(6) Mg/year for 17 cereals and legumes, and 3758x10(6) Mg/year for 27 food crops. The fuel value of the total annual residue produced is estimated at 1.5x10(15) kcal, about 1 billion barrels (bbl) of diesel equivalent, or about 8 quads for the US; and 11.3x10(15) kcal, about 7.5 billion bbl of diesel or 60 quads for the world. However, even a partial removal (30-40\%) of crop residue from land can exacerbate soil erosion hazard, deplete the SOC pool, accentuate emission of CO(2) and other GHGs from soil to the atmosphere, and exacerbate the risks of global climate change. Therefore, establishing bioenergy plantations of site-specific species with potential of producing 10-15 Mg biomass/year is an option that needs to be considered. This option will require 40-60 million hectares of land in the US and about 250 million hectares worldwide to establish bioenergy plantations.}, - language = {eng}, - number = {4}, - journal = {Environment International}, - author = {Lal, R.}, - month = may, - year = {2005}, - pmid = {15788197}, - keywords = {Agriculture, Bioelectric Energy Sources, Biomass, Carbon, Ecosystem, Greenhouse Effect, Plants, Edible, Refuse Disposal, Soil}, - pages = {575--584} + title = {World crop residues production and implications of its use as a biofuel}, + volume = {31}, + issn = {0160-4120}, + doi = {10.1016/j.envint.2004.09.005}, + abstract = {Reducing and off-setting anthropogenic emissions of CO(2) and other greenhouse gases (GHGs) are important strategies of mitigating the greenhouse effect. Thus, the need for developing carbon (C) neutral and renewable sources of energy is more than ever before. Use of crop residue as a possible source of feedstock for bioenergy production must be critically and objectively assessed because of its positive impact on soil C sequestration, soil quality maintenance and ecosystem functions. The amount of crop residue produced in the US is estimated at 367x10(6) Mg/year for 9 cereal crops, 450x10(6) Mg/year for 14 cereals and legumes, and 488x10(6) Mg/year for 21 crops. The amount of crop residue produced in the world is estimated at 2802x10(6) Mg/year for cereal crops, 3107x10(6) Mg/year for 17 cereals and legumes, and 3758x10(6) Mg/year for 27 food crops. The fuel value of the total annual residue produced is estimated at 1.5x10(15) kcal, about 1 billion barrels (bbl) of diesel equivalent, or about 8 quads for the US; and 11.3x10(15) kcal, about 7.5 billion bbl of diesel or 60 quads for the world. However, even a partial removal (30-40\%) of crop residue from land can exacerbate soil erosion hazard, deplete the SOC pool, accentuate emission of CO(2) and other GHGs from soil to the atmosphere, and exacerbate the risks of global climate change. Therefore, establishing bioenergy plantations of site-specific species with potential of producing 10-15 Mg biomass/year is an option that needs to be considered. This option will require 40-60 million hectares of land in the US and about 250 million hectares worldwide to establish bioenergy plantations.}, + language = {eng}, + number = {4}, + journal = {Environment International}, + author = {Lal, R.}, + month = may, + year = {2005}, + pmid = {15788197}, + keywords = {Agriculture, Bioelectric Energy Sources, Biomass, Carbon, Ecosystem, Greenhouse Effect, Plants, Edible, Refuse Disposal, Soil}, + pages = {575--584} } @article{feller_dungung_2007, - title = {D\"ungung im {Freilandgem\"usebau}}, - language = {de}, - journal = {Schriftenreihe des Leibniz- Instituts f\"ur Gem\"use- und Zierpflanzenbau (IGZ)}, - author = {Feller, C. and Fink, M. and Laber, H. and Maync, A. and Paschold, P. and Scharpf, H. and Sclaghecken, J. and Strohmeyer, K. and Weier, U. and Ziegler, J.}, - year = {2007}, - pages = {265} + title = {D\"ungung im {Freilandgem\"usebau}}, + language = {de}, + journal = {Schriftenreihe des Leibniz- Instituts f\"ur Gem\"use- und Zierpflanzenbau (IGZ)}, + author = {Feller, C. and Fink, M. and Laber, H. and Maync, A. and Paschold, P. and Scharpf, H. and Sclaghecken, J. and Strohmeyer, K. and Weier, U. and Ziegler, J.}, + year = {2007}, + pages = {265} } @article{smil_nitrogen_1999, - title = {Nitrogen in crop production: {An} account of global flows}, - volume = {13}, - copyright = {Copyright 1999 by the American Geophysical Union.}, - issn = {1944-9224}, - shorttitle = {Nitrogen in crop production}, - url = {https://agupubs.onlinelibrary.wiley.com/doi/abs/10.1029/1999GB900015}, - doi = {10.1029/1999GB900015}, - abstract = {Human activities have roughly doubled the amount of reactive N that enters the element's biospheric cycle. Crop production is by far the single largest cause of this anthropogenic alteration. Inorganic fertilizers now provide 80 Tg N yr−1 (Tg = 1012 g), managed (symbiotic) biofixation adds about 20 Tg N yr−1, and between 28 and 36 Tg N yr−1 are recycled in organic wastes. Anthropogenic inputs (including N in seeds and irrigation water) now supply about 85\% of 170 (151–186) Tg N reaching the world's cropland every year. About half of this input, 85 Tg N yr−1, is taken up by harvested crops and their residues. Quantification of N losses from crop fields is beset by major uncertainties. Losses to the atmosphere (denitrification and volatilization) amount to 26–60 Tg N yr−1, while waters receive (from leaching and erosion) 32–45 Tg N yr−1. These N losses are the major reason behind the growing concerns about the enrichment of the biosphere with reactive N. The best evidence suggests that in spite of some significant local and regional losses, the world's agricultural land accumulates N. The addition of 3–4 billion people before the year 2050 will require further substantial increases of N input in cropping, but a large share of this demand can come from improved efficiency of N fertilizer use.}, - language = {en}, - number = {2}, - urldate = {2018-07-09}, - journal = {Global Biogeochemical Cycles}, - author = {Smil, Vaclav}, - year = {1999}, - pages = {647--662}, - file = {Full Text PDF:D\:\\Dropbox\\zotero\\storage\\9JDJDVQY\\Smil - Nitrogen in crop production An account of global .pdf:application/pdf;Snapshot:D\:\\Dropbox\\zotero\\storage\\D75AZCTW\\1999GB900015.html:text/html} + title = {Nitrogen in crop production: {An} account of global flows}, + volume = {13}, + copyright = {Copyright 1999 by the American Geophysical Union.}, + issn = {1944-9224}, + shorttitle = {Nitrogen in crop production}, + url = {https://agupubs.onlinelibrary.wiley.com/doi/abs/10.1029/1999GB900015}, + doi = {10.1029/1999GB900015}, + abstract = {Human activities have roughly doubled the amount of reactive N that enters the element's biospheric cycle. Crop production is by far the single largest cause of this anthropogenic alteration. Inorganic fertilizers now provide 80 Tg N yr−1 (Tg = 1012 g), managed (symbiotic) biofixation adds about 20 Tg N yr−1, and between 28 and 36 Tg N yr−1 are recycled in organic wastes. Anthropogenic inputs (including N in seeds and irrigation water) now supply about 85\% of 170 (151–186) Tg N reaching the world's cropland every year. About half of this input, 85 Tg N yr−1, is taken up by harvested crops and their residues. Quantification of N losses from crop fields is beset by major uncertainties. Losses to the atmosphere (denitrification and volatilization) amount to 26–60 Tg N yr−1, while waters receive (from leaching and erosion) 32–45 Tg N yr−1. These N losses are the major reason behind the growing concerns about the enrichment of the biosphere with reactive N. The best evidence suggests that in spite of some significant local and regional losses, the world's agricultural land accumulates N. The addition of 3–4 billion people before the year 2050 will require further substantial increases of N input in cropping, but a large share of this demand can come from improved efficiency of N fertilizer use.}, + language = {en}, + number = {2}, + urldate = {2018-07-09}, + journal = {Global Biogeochemical Cycles}, + author = {Smil, Vaclav}, + year = {1999}, + pages = {647--662}, } @article{sathaye_ghg_2005, - title = {{GHG} {Mitigation} {Potential}, {Costs} and {Benefits} in {Global} {Forests}: {A} {Dynamic} {Partial} {Equilibrium} {Approach}}, - shorttitle = {{GHG} {Mitigation} {Potential}, {Costs} and {Benefits} in {Global} {Forests}}, - url = {http://escholarship.org/uc/item/92d5m16v}, - abstract = {This paper reports on the global potential for carbon sequestration in forest plantations, and the reduction of carbon emissions from deforestation, in response to six carbon price scenarios from 2000 to 2100. These carbon price scenarios cover a range typically seen in global integrated assessment models. The world forest sector was disaggregated into ten regions, four largely temperate, developed regions: the European Union, Oceania, Russia, and the United States; and six developing, mostly tropical, regions: Africa, Central America, China, India, Rest of Asia, and South America. Three mitigation options -- long- and short-rotation forestry, and the reduction of deforestation -- were analyzed using a global dynamic partial equilibrium model (GCOMAP). Key findings of this work are that cumulative carbon gain ranges from 50.9 to 113.2 Gt C by 2100, higher carbon prices early lead to earlier carbon gain and vice versa, and avoided deforestation accounts for 51 to 78 percent of modeled carbon gains by 2100. The estimated present value of cumulative welfare change in the sector ranges from a decline of \$158 billion to a gain of \$81 billion by 2100. The decline is associated with a decrease in deforestation.}, - urldate = {2013-03-06}, - journal = {Lawrence Berkeley National Laboratory}, - author = {Sathaye, Jayant and Makundi, Willy and Dale, Larry and Chan, Peter and Andrasko, Kenneth}, - month = mar, - year = {2005}, - keywords = {Environmental Energy Technologies, GCOMAP GHG mitigation global forests partial equilibrium model}, - file = {Sathaye et al. - 2005 - GHG Mitigation Potential, Costs and Benefits in Gl.pdf:/Users/flo/Zotero/storage/C4F4DAWA/Sathaye et al. - 2005 - GHG Mitigation Potential, Costs and Benefits in Gl.pdf:application/pdf} + title = {{GHG} {Mitigation} {Potential}, {Costs} and {Benefits} in {Global} {Forests}: {A} {Dynamic} {Partial} {Equilibrium} {Approach}}, + shorttitle = {{GHG} {Mitigation} {Potential}, {Costs} and {Benefits} in {Global} {Forests}}, + url = {http://escholarship.org/uc/item/92d5m16v}, + abstract = {This paper reports on the global potential for carbon sequestration in forest plantations, and the reduction of carbon emissions from deforestation, in response to six carbon price scenarios from 2000 to 2100. These carbon price scenarios cover a range typically seen in global integrated assessment models. The world forest sector was disaggregated into ten regions, four largely temperate, developed regions: the European Union, Oceania, Russia, and the United States; and six developing, mostly tropical, regions: Africa, Central America, China, India, Rest of Asia, and South America. Three mitigation options -- long- and short-rotation forestry, and the reduction of deforestation -- were analyzed using a global dynamic partial equilibrium model (GCOMAP). Key findings of this work are that cumulative carbon gain ranges from 50.9 to 113.2 Gt C by 2100, higher carbon prices early lead to earlier carbon gain and vice versa, and avoided deforestation accounts for 51 to 78 percent of modeled carbon gains by 2100. The estimated present value of cumulative welfare change in the sector ranges from a decline of \$158 billion to a gain of \$81 billion by 2100. The decline is associated with a decrease in deforestation.}, + urldate = {2013-03-06}, + journal = {Lawrence Berkeley National Laboratory}, + author = {Sathaye, Jayant and Makundi, Willy and Dale, Larry and Chan, Peter and Andrasko, Kenneth}, + month = mar, + year = {2005}, + keywords = {Environmental Energy Technologies, GCOMAP GHG mitigation global forests partial equilibrium model}, } @article{robinson_mapping_2014, - title = {Mapping the {Global} {Distribution} of {Livestock}}, - volume = {9}, - issn = {1932-6203}, - url = {http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0096084}, - doi = {10.1371/journal.pone.0096084}, - number = {5}, - urldate = {2017-09-15}, - journal = {PLOS ONE}, - author = {Robinson, Timothy P. and Wint, G. R. William and Conchedda, Giulia and Boeckel, Thomas P. Van and Ercoli, Valentina and Palamara, Elisa and Cinardi, Giuseppina and D'Aietti, Laura and Hay, Simon I. and Gilbert, Marius}, - month = may, - year = {2014}, - keywords = {Chicken models, Chickens, Ducks, Ecosystems, Forecasting, Livestock, Statistical distributions, Swine}, - pages = {e96084}, - file = {Full Text PDF:C\:\\Users\\karstens\\AppData\\Roaming\\Zotero\\Zotero\\Profiles\\tudvyaev.default\\zotero\\storage\\FDQX9TVH\\Robinson et al. - 2014 - Mapping the Global Distribution of Livestock.pdf:application/pdf;Snapshot:C\:\\Users\\karstens\\AppData\\Roaming\\Zotero\\Zotero\\Profiles\\tudvyaev.default\\zotero\\storage\\79AQ7K3G\\article.html:text/html} + title = {Mapping the {Global} {Distribution} of {Livestock}}, + volume = {9}, + issn = {1932-6203}, + url = {http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0096084}, + doi = {10.1371/journal.pone.0096084}, + number = {5}, + urldate = {2017-09-15}, + journal = {PLOS ONE}, + author = {Robinson, Timothy P. and Wint, G. R. William and Conchedda, Giulia and Boeckel, Thomas P. Van and Ercoli, Valentina and Palamara, Elisa and Cinardi, Giuseppina and D'Aietti, Laura and Hay, Simon I. and Gilbert, Marius}, + month = may, + year = {2014}, + keywords = {Chicken models, Chickens, Ducks, Ecosystems, Forecasting, Livestock, Statistical distributions, Swine}, + pages = {e96084}, } @article{pikaar_decoupling_2018, - title = {Decoupling livestock from land use through industrial feed production pathways}, - volume = {52}, + title = {Decoupling livestock from land use through industrial feed production pathways}, + volume = {52}, number= {13}, - journal = {Environmental Science and Technology}, - author = {Pikaar, I. and Matassa, S. and Bodirsky, B. L. and Weindl, I. and Humpenöder, F. and Rabaey, K. and Boon, N. and Bruschi, M. and Yuan, Z. and Van Zanten, H. and Herrero, M. and Verstraete, W. and Popp, A.}, + journal = {Environmental Science and Technology}, + author = {Pikaar, I. and Matassa, S. and Bodirsky, B. L. and Weindl, I. and Humpenöder, F. and Rabaey, K. and Boon, N. and Bruschi, M. and Yuan, Z. and Van Zanten, H. and Herrero, M. and Verstraete, W. and Popp, A.}, month = {july}, year = {2018}, - pages = {7351--7359}, + pages = {7351--7359}, doi = {10.1021/acs.est.8b00216}, } @techreport{valco_thecost_2016, - title = {The Cost of Ginning Cotton - 2016 Survey Results}, - institution = {National Cotton Ginners Association}, - author = {Valco, T. D. and Ashley, H. and Findley, D. S. and Green, J. K. and Isom, R. A. and Price, T. L.}, + title = {The Cost of Ginning Cotton - 2016 Survey Results}, + institution = {National Cotton Ginners Association}, + author = {Valco, T. D. and Ashley, H. and Findley, D. S. and Green, J. K. and Isom, R. A. and Price, T. L.}, year = {2016}, } @techreport{adanacioglu_profitability_2011, - title = {Profitability and Efficiency in the Cotton Ginning Industry: A Case Study from the Aegean Region of Turkey}, - institution = {custoseagronegocioonline}, - author = {Adanacioglu, Hakan and Olgun, F. A.}, + title = {Profitability and Efficiency in the Cotton Ginning Industry: A Case Study from the Aegean Region of Turkey}, + institution = {custoseagronegocioonline}, + author = {Adanacioglu, Hakan and Olgun, F. A.}, year = {2011}, } - @article{braakhekke_modelling_2019, - title = {Modelling forest plantations for carbon uptake with the {LPJmL} dynamic global vegetation model}, - issn = {2190-4979}, - url = {https://www.earth-syst-dynam-discuss.net/esd-2019-13/}, - doi = {https://doi.org/10.5194/esd-2019-13}, - abstract = {{\textless}p{\textgreater}{\textless}strong{\textgreater}Abstract.{\textless}/strong{\textgreater} We present an extension of the dynamic global vegetation model LPJmL to simulate planted forests intended for C sequestration. We implemented three functional types to simulate plantation trees in temperate, tropical, and boreal climates. The parameters of these functional types were optimized to fit target growth curves (TGCs). These curves represent the evolution of stemwood C over time in typical productive plantations and were derived by combining field observations and LPJmL estimates for equivalent natural forests. While the calibrated model underestimates stemwood C growth rates compared to the TGCs, it represents substantial improvement over using natural forests to represent afforestation. Based on a simulation experiment in which we compared global natural forest versus global forest plantation, we found that forest plantations allow for much larger C uptake rates on the time scale of 100 years, with a maximum difference of a factor 1.9, around 54 years. In subsequent simulations for an ambitious but realistic scenario in which 650\ Mha (14\ \% of global managed land, 4.5\ \% of global land surface) is converted to forest over 85 years, we found that natural forests take up 37\ PgC versus 48\ PgC for forest plantations. Comparing these results to estimations of C sequestration required to achieve the 2\ \°C climate target, we conclude that afforestation can offer a substantial contribution to climate mitigation. Full evaluation of afforestation as a climate change mitigation strategy requires an integrated assessment which considers all relevant aspects, including costs, biodiversity, and trade-offs with other land-use types. Our extended version of LPJmL can contribute such an assessment by providing improved estimates of C uptake rates by forest plantations.{\textless}/p{\textgreater}}, - language = {English}, - urldate = {2019-04-16}, - journal = {Earth System Dynamics Discussions}, - author = {Braakhekke, Maarten C. and Doelman, Jonathan C. and Baas, Peter and Müller, Christoph and Schaphoff, Sibyll and Stehfest, Elke and Vuuren, Detlef P. van}, - month = apr, - year = {2019}, - pages = {1--24}, - file = {Braakhekke et al. - 2019 - Modelling forest plantations for carbon uptake wit.pdf:/Users/flo/Zotero/storage/LEZHHBYN/Braakhekke et al. - 2019 - Modelling forest plantations for carbon uptake wit.pdf:application/pdf;Snapshot:/Users/flo/Zotero/storage/JXG2FBYH/esd-2019-13.html:text/html} + title = {Modelling forest plantations for carbon uptake with the {LPJmL} dynamic global vegetation model}, + issn = {2190-4979}, + url = {https://www.earth-syst-dynam-discuss.net/esd-2019-13/}, + doi = {https://doi.org/10.5194/esd-2019-13}, + abstract = {{\textless}p{\textgreater}{\textless}strong{\textgreater}Abstract.{\textless}/strong{\textgreater} We present an extension of the dynamic global vegetation model LPJmL to simulate planted forests intended for C sequestration. We implemented three functional types to simulate plantation trees in temperate, tropical, and boreal climates. The parameters of these functional types were optimized to fit target growth curves (TGCs). These curves represent the evolution of stemwood C over time in typical productive plantations and were derived by combining field observations and LPJmL estimates for equivalent natural forests. While the calibrated model underestimates stemwood C growth rates compared to the TGCs, it represents substantial improvement over using natural forests to represent afforestation. Based on a simulation experiment in which we compared global natural forest versus global forest plantation, we found that forest plantations allow for much larger C uptake rates on the time scale of 100 years, with a maximum difference of a factor 1.9, around 54 years. In subsequent simulations for an ambitious but realistic scenario in which 650\ Mha (14\ \% of global managed land, 4.5\ \% of global land surface) is converted to forest over 85 years, we found that natural forests take up 37\ PgC versus 48\ PgC for forest plantations. Comparing these results to estimations of C sequestration required to achieve the 2\ \°C climate target, we conclude that afforestation can offer a substantial contribution to climate mitigation. Full evaluation of afforestation as a climate change mitigation strategy requires an integrated assessment which considers all relevant aspects, including costs, biodiversity, and trade-offs with other land-use types. Our extended version of LPJmL can contribute such an assessment by providing improved estimates of C uptake rates by forest plantations.{\textless}/p{\textgreater}}, + language = {English}, + urldate = {2019-04-16}, + journal = {Earth System Dynamics Discussions}, + author = {Braakhekke, Maarten C. and Doelman, Jonathan C. and Baas, Peter and Müller, Christoph and Schaphoff, Sibyll and Stehfest, Elke and Vuuren, Detlef P. van}, + month = apr, + year = {2019}, + pages = {1--24}, } @article{lauri_timber_demand, -url = {http://dx.doi.org/10.1561/112.00000504}, -year = {2019}, -volume = {34}, -journal = {Journal of Forest Economics}, -title = {Global Woody Biomass Harvest Volumes and Forest Area Use Under Different SSP-RCP Scenarios}, -doi = {10.1561/112.00000504}, -issn = {1104-6899}, -number = {3-4}, -pages = {285-309}, -author = {Pekka Lauri and Nicklas Forsell and Mykola Gusti and Anu Korosuo and Petr Havlík and Michael Obersteiner} + url = {http://dx.doi.org/10.1561/112.00000504}, + year = {2019}, + volume = {34}, + journal = {Journal of Forest Economics}, + title = {Global Woody Biomass Harvest Volumes and Forest Area Use Under Different SSP-RCP Scenarios}, + doi = {10.1561/112.00000504}, + issn = {1104-6899}, + number = {3-4}, + pages = {285-309}, + author = {Pekka Lauri and Nicklas Forsell and Mykola Gusti and Anu Korosuo and Petr Havlík and Michael Obersteiner} } @article{morland2018supply, - title={Supply and demand functions for global wood markets: specification and plausibility testing of econometric models within the global forest sector}, - author={Morland, Christian and Schier, Franziska and Janzen, Niels and Weimar, Holger}, - journal={Forest Policy and Economics}, - volume={92}, - pages={92--105}, - year={2018}, - publisher={Elsevier} + title = {Supply and demand functions for global wood markets: specification and plausibility testing of econometric models within the global forest sector}, + author = {Morland, Christian and Schier, Franziska and Janzen, Niels and Weimar, Holger}, + journal = {Forest Policy and Economics}, + volume = {92}, + pages = {92--105}, + year = {2018}, + publisher = {Elsevier} } @book{amacher2009economics, - title={Economics of forest resources}, - author={Amacher, Gregory S and Ollikainen, Markku and Koskela, Erkki}, - year={2009}, - publisher={Mit Press Cambridge} + title = {Economics of forest resources}, + author = {Amacher, Gregory S and Ollikainen, Markku and Koskela, Erkki}, + year = {2009}, + publisher = {Mit Press Cambridge} } @article{Harmsen2019, - title = {Long-term marginal abatement cost curves of non-{CO2} greenhouse gases}, - volume = {99}, - issn = {1462-9011}, - url = {http://www.sciencedirect.com/science/article/pii/S146290111830889X}, - doi = {10.1016/j.envsci.2019.05.013}, - abstract = {This study presents a new comprehensive set of long-term Marginal Abatement Cost (MAC) curves of all major non-CO2 greenhouse gas emission sources. The work builds on existing short-term MAC curve datasets and recent literature on individual mitigation measures. The new MAC curves include current technology and costs information as well as estimates of technology development and removal of implementation barriers to capture long-term dynamics. Compared to earlier work, we find a higher projected maximum reduction potential (MRP) of nitrous oxide (N2O) and a lower MRP of methane (CH4). The combined MRP for all non-CO2 gases is similar but has been extended to also capture mitigation measures that can be realized at higher implementation costs. When applying the new MAC curves in a cost-optimal, integrated assessment model-based 2.6 W/m2 scenario, the total non-CO2 mitigation is projected to be 10.9 Mt CO2 equivalents in 2050 (i.e. 58\% reduction compared to baseline emissions) and 15.6 Mt CO2equivalents in 2100 (i.e. a 71\% reduction). In applying the new MAC curves, we account for inertia in thline implementation speed of mitigation measures. Although this does not strongly impact results in an optimal strategy, it means that the contribution of non-CO2 mitigation could be more limited if ambitious climate policy is delayed.}, - urldate = {2019-09-13}, - journal = {Environmental Science \& Policy}, - author = {Harmsen, J. H. M. and van Vuuren, Detlef P. and Nayak, Dali R. and Hof, Andries F. and Höglund-Isaksson, Lena and Lucas, Paul L. and Nielsen, Jens B. and Smith, Pete and Stehfest, Elke}, - month = sep, - year = {2019}, - keywords = {Climate policy, Mitigation, MAC curves, Non-CO}, - pages = {136--149}, - file = {AFOLU-measures.xlsx:/Users/flo/Zotero/storage/2CNKSIRF/AFOLU-measures.xlsx:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;Harmsen et al. - 2019 - Long-term marginal abatement cost curves of non-CO.pdf:/Users/flo/Zotero/storage/CAIRMB5Q/Harmsen et al. - 2019 - Long-term marginal abatement cost curves of non-CO.pdf:application/pdf;ScienceDirect Snapshot:/Users/flo/Zotero/storage/9P28Z2WX/S146290111830889X.html:text/html} + title = {Long-term marginal abatement cost curves of non-{CO2} greenhouse gases}, + volume = {99}, + issn = {1462-9011}, + url = {http://www.sciencedirect.com/science/article/pii/S146290111830889X}, + doi = {10.1016/j.envsci.2019.05.013}, + abstract = {This study presents a new comprehensive set of long-term Marginal Abatement Cost (MAC) curves of all major non-CO2 greenhouse gas emission sources. The work builds on existing short-term MAC curve datasets and recent literature on individual mitigation measures. The new MAC curves include current technology and costs information as well as estimates of technology development and removal of implementation barriers to capture long-term dynamics. Compared to earlier work, we find a higher projected maximum reduction potential (MRP) of nitrous oxide (N2O) and a lower MRP of methane (CH4). The combined MRP for all non-CO2 gases is similar but has been extended to also capture mitigation measures that can be realized at higher implementation costs. When applying the new MAC curves in a cost-optimal, integrated assessment model-based 2.6 W/m2 scenario, the total non-CO2 mitigation is projected to be 10.9 Mt CO2 equivalents in 2050 (i.e. 58\% reduction compared to baseline emissions) and 15.6 Mt CO2equivalents in 2100 (i.e. a 71\% reduction). In applying the new MAC curves, we account for inertia in thline implementation speed of mitigation measures. Although this does not strongly impact results in an optimal strategy, it means that the contribution of non-CO2 mitigation could be more limited if ambitious climate policy is delayed.}, + urldate = {2019-09-13}, + journal = {Environmental Science \& Policy}, + author = {Harmsen, J. H. M. and van Vuuren, Detlef P. and Nayak, Dali R. and Hof, Andries F. and Höglund-Isaksson, Lena and Lucas, Paul L. and Nielsen, Jens B. and Smith, Pete and Stehfest, Elke}, + month = sep, + year = {2019}, + keywords = {Climate policy, Mitigation, MAC curves, Non-CO}, + pages = {136--149}, } - @article{Lynch2020, - title = {Demonstrating {GWP}*: a means of reporting warming-equivalent emissions that captures the contrasting impacts of short- and long-lived climate pollutants}, - volume = {15}, - issn = {1748-9326}, - shorttitle = {Demonstrating {GWP}{\textbackslash}ast}, - url = {https://doi.org/10.1088%2F1748-9326%2Fab6d7e}, - doi = {10.1088/1748-9326/ab6d7e}, - abstract = {The atmospheric lifetime and radiative impacts of different climate pollutants can both differ markedly, so metrics that equate emissions using a single scaling factor, such as the 100-year Global Warming Potential (GWP100), can be misleading. An alternative approach is to report emissions as ‘warming-equivalents’ that result in similar warming impacts without requiring a like-for-like weighting per emission. GWP*, an alternative application of GWPs where the CO2-equivalence of short-lived climate pollutant emissions is predominantly determined by changes in their emission rate, provides a straightforward means of generating warming-equivalent emissions. In this letter we illustrate the contrasting climate impacts resulting from emissions of methane, a short-lived greenhouse gas, and CO2, and compare GWP100 and GWP* CO2-equivalents for a number of simple emissions scenarios. We demonstrate that GWP* provides a useful indication of warming, while conventional application of GWP100 falls short in many scenarios and particularly when methane emissions are stable or declining, with important implications for how we consider ‘zero emission’ or ‘climate neutral’ targets for sectors emitting different compositions of gases. We then illustrate how GWP* can provide an improved means of assessing alternative mitigation strategies. GWP* allows warming-equivalent emissions to be calculated directly from CO2-equivalent emissions reported using GWP100, consistent with the Paris Rulebook agreed by the UNFCCC, on condition that short-lived and cumulative climate pollutants are aggregated separately, which is essential for transparency. It provides a direct link between emissions and anticipated warming impacts, supporting stocktakes of progress towards a long-term temperature goal and compatible with cumulative emissions budgets.}, - language = {en}, - number = {4}, - urldate = {2020-11-20}, - journal = {Environmental Research Letters}, - author = {Lynch, John and Cain, Michelle and Pierrehumbert, Raymond and Allen, Myles}, - month = apr, - year = {2020}, - note = {Publisher: IOP Publishing}, - pages = {044023}, - file = {IOP Full Text PDF:/Users/flo/Zotero/storage/6ZT6ANT3/Lynch et al. - 2020 - Demonstrating GWPast a means of reporting warmin.pdf:application/pdf} + title = {Demonstrating {GWP}*: a means of reporting warming-equivalent emissions that captures the contrasting impacts of short- and long-lived climate pollutants}, + volume = {15}, + issn = {1748-9326}, + shorttitle = {Demonstrating {GWP}{\textbackslash}ast}, + url = {https://doi.org/10.1088%2F1748-9326%2Fab6d7e}, + doi = {10.1088/1748-9326/ab6d7e}, + abstract = {The atmospheric lifetime and radiative impacts of different climate pollutants can both differ markedly, so metrics that equate emissions using a single scaling factor, such as the 100-year Global Warming Potential (GWP100), can be misleading. An alternative approach is to report emissions as ‘warming-equivalents’ that result in similar warming impacts without requiring a like-for-like weighting per emission. GWP*, an alternative application of GWPs where the CO2-equivalence of short-lived climate pollutant emissions is predominantly determined by changes in their emission rate, provides a straightforward means of generating warming-equivalent emissions. In this letter we illustrate the contrasting climate impacts resulting from emissions of methane, a short-lived greenhouse gas, and CO2, and compare GWP100 and GWP* CO2-equivalents for a number of simple emissions scenarios. We demonstrate that GWP* provides a useful indication of warming, while conventional application of GWP100 falls short in many scenarios and particularly when methane emissions are stable or declining, with important implications for how we consider ‘zero emission’ or ‘climate neutral’ targets for sectors emitting different compositions of gases. We then illustrate how GWP* can provide an improved means of assessing alternative mitigation strategies. GWP* allows warming-equivalent emissions to be calculated directly from CO2-equivalent emissions reported using GWP100, consistent with the Paris Rulebook agreed by the UNFCCC, on condition that short-lived and cumulative climate pollutants are aggregated separately, which is essential for transparency. It provides a direct link between emissions and anticipated warming impacts, supporting stocktakes of progress towards a long-term temperature goal and compatible with cumulative emissions budgets.}, + language = {en}, + number = {4}, + urldate = {2020-11-20}, + journal = {Environmental Research Letters}, + author = {Lynch, John and Cain, Michelle and Pierrehumbert, Raymond and Allen, Myles}, + month = apr, + year = {2020}, + note = {Publisher: IOP Publishing}, + pages = {044023}, } - @article{Allen_2018, - title = {A solution to the misrepresentations of {CO2}-equivalent emissions of short-lived climate pollutants under ambitious mitigation}, - volume = {1}, - issn = {2397-3722}, - url = {http://www.nature.com/articles/s41612-018-0026-8}, - doi = {10.1038/s41612-018-0026-8}, - language = {en}, - number = {1}, - urldate = {2019-12-03}, - journal = {npj Climate and Atmospheric Science}, - author = {Allen, Myles R. and Shine, Keith P. and Fuglestvedt, Jan S. and Millar, Richard J. and Cain, Michelle and Frame, David J. and Macey, Adrian H.}, - month = dec, - year = {2018}, - pages = {16}, - file = {Allen et al. - 2018 - A solution to the misrepresentations of CO2-equiva.pdf:/Users/flo/Zotero/storage/4G25D8UJ/Allen et al. - 2018 - A solution to the misrepresentations of CO2-equiva.pdf:application/pdf} + title = {A solution to the misrepresentations of {CO2}-equivalent emissions of short-lived climate pollutants under ambitious mitigation}, + volume = {1}, + issn = {2397-3722}, + url = {http://www.nature.com/articles/s41612-018-0026-8}, + doi = {10.1038/s41612-018-0026-8}, + language = {en}, + number = {1}, + urldate = {2019-12-03}, + journal = {npj Climate and Atmospheric Science}, + author = {Allen, Myles R. and Shine, Keith P. and Fuglestvedt, Jan S. and Millar, Richard J. and Cain, Michelle and Frame, David J. and Macey, Adrian H.}, + month = dec, + year = {2018}, + pages = {16}, } @article{oswalt2019forest, - title={Forest resources of the United States, 2017: A technical document supporting the Forest Service 2020 RPA Assessment}, - author={Oswalt, Sonja N and Smith, W Brad and Miles, Patrick D and Pugh, Scott A}, - journal={Gen. Tech. Rep. WO-97. Washington, DC: US Department of Agriculture, Forest Service, Washington Office.}, - volume={97}, - year={2019} + title = {Forest resources of the United States, 2017: A technical document supporting the Forest Service 2020 RPA Assessment}, + author = {Oswalt, Sonja N and Smith, W Brad and Miles, Patrick D and Pugh, Scott A}, + journal = {Gen. Tech. Rep. WO-97. Washington, DC: US Department of Agriculture, Forest Service, Washington Office.}, + volume = {97}, + year = {2019} } @article{pokharel2017factors, - title={Factors affecting utilization of woody residues for bioenergy production in the southern United States}, - author={Pokharel, Raju and Grala, Robert K and Grebner, Donald L and Grado, Stephen C}, - journal={Biomass and Bioenergy}, - volume={105}, - pages={278--287}, - year={2017}, - publisher={Elsevier} + title = {Factors affecting utilization of woody residues for bioenergy production in the southern United States}, + author = {Pokharel, Raju and Grala, Robert K and Grebner, Donald L and Grado, Stephen C}, + journal = {Biomass and Bioenergy}, + volume = {105}, + pages = {278--287}, + year = {2017}, + publisher = {Elsevier} } @article{poulter2018global, - title={The global forest age dataset (GFADv1. 0)}, - author={Poulter, Benjamin and Arag{\~a}o, Luiz and Adela, N and Bellassen, Valentin and Ciais, Philippe and Kato, Tomomichi and Lin, Xin and Nachin, Baatarbileg and Luyssaert, Sebastiaan and Pederson, Niel and others}, - year={2018}, - publisher={NASA National Aeronautics and Space Administration, PANGAEA} + title = {The global forest age dataset (GFADv1. 0)}, + author = {Poulter, Benjamin and Arag{\~a}o, Luiz and Adela, N and Bellassen, Valentin and Ciais, Philippe and Kato, Tomomichi and Lin, Xin and Nachin, Baatarbileg and Luyssaert, Sebastiaan and Pederson, Niel and others}, + year = {2018}, + publisher = {NASA National Aeronautics and Space Administration, PANGAEA} +} + +@article{zabel_global_2014, + title = {Global {{Agricultural Land Resources}} \textendash{} {{A High Resolution Suitability Evaluation}} and {{Its Perspectives}} until 2100 under {{Climate Change Conditions}}}, + author = {Zabel, Florian and Putzenlechner, Birgitta and Mauser, Wolfram}, + year = {2014}, + month = sep, + volume = {9}, + pages = {e107522}, + publisher = {{Public Library of Science}}, + issn = {1932-6203}, + doi = {10.1371/journal.pone.0107522}, + abstract = {Changing natural conditions determine the land's suitability for agriculture. The growing demand for food, feed, fiber and bioenergy increases pressure on land and causes trade-offs between different uses of land and ecosystem services. Accordingly, an inventory is required on the changing potentially suitable areas for agriculture under changing climate conditions. We applied a fuzzy logic approach to compute global agricultural suitability to grow the 16 most important food and energy crops according to the climatic, soil and topographic conditions at a spatial resolution of 30 arc seconds. We present our results for current climate conditions (1981\textendash 2010), considering today's irrigated areas and separately investigate the suitability of densely forested as well as protected areas, in order to investigate their potentials for agriculture. The impact of climate change under SRES A1B conditions, as simulated by the global climate model ECHAM5, on agricultural suitability is shown by comparing the time-period 2071\textendash 2100 with 1981\textendash 2010. Our results show that climate change will expand suitable cropland by additionally 5.6 million km2, particularly in the Northern high latitudes (mainly in Canada, China and Russia). Most sensitive regions with decreasing suitability are found in the Global South, mainly in tropical regions, where also the suitability for multiple cropping decreases.}, + journal = {PLOS ONE}, + keywords = {Agricultural irrigation,Agricultural land,Agricultural soil science,Agriculture,Climate change,Conservation science,Crops,Forests}, + language = {en}, + number = {9} +} + +@article{Heinke.2013, + author = {Heinke, J. and Ostberg, S. and Schaphoff, S. and Frieler, K. and M{\"u}ller, C. and Gerten, D. and Meinshausen, M. and Lucht, W.}, + year = {2013}, + title = {A new climate dataset for systematic assessments of climate change impacts as a function of global warming}, + pages = {1689--1703}, + volume = {6}, + number = {5}, + journal = {Geoscientific Model Development}, + doi = {10.5194/gmd-6-1689-2013}, +} + +@article{KleinGoldewijk.2017, + abstract = {(Waridity)}, + author = {{Klein Goldewijk}, Kees and Beusen, Arthur and Doelman, Jonathan and Stehfest, Elke}, + year = {2017}, + title = {Anthropogenic land use estimates for the Holocene -- HYDE 3.2}, + pages = {927--953}, + volume = {9}, + number = {2}, + journal = {Earth System Science Data}, + doi = {10.5194/essd-9-927-2017}, +} + +@article{churkina2020buildings, + title = {Buildings as a global carbon sink}, + author = {Churkina, Galina and Organschi, Alan and Reyer, Christopher PO and Ruff, Andrew and Vinke, Kira and Liu, Zhu and Reck, Barbara K and Graedel, TE and Schellnhuber, Hans Joachim}, + journal = {Nature Sustainability}, + volume = {3}, + number = {4}, + pages = {269--276}, + year = {2020}, + publisher = {Nature Publishing Group} +} + +@misc{orlov_ces_2021, + title = {{CES} production function in {GAMS} with climate change impacts on labor producitivy}, + url = {https://zenodo.org/record/4983177}, + abstract = {This is a conceptual GAMS model for including climate change impacts on labor producitivy into a neoclassical Constant Elasticity of Substitution (CES) or Cobb Douglas (CD) production function.}, + urldate = {2021-06-18}, + publisher = {Zenodo}, + author = {Orlov, Anton and Humpenöder, Florian}, + month = jun, + year = {2021}, + doi = {10.5281/zenodo.4983177}, + note = {Language: eng}, + keywords = {CES production function, climate change impacts, GAMS, labor producitivy}, +} + +@article{orlov_labor_2021, + title = {Global {Economic} {Responses} to {Heat} {Stress} {Impacts} on {Worker} {Productivity} in {Crop} {Production}}, + issn = {2511-1280, 2511-1299}, + url = {https://link.springer.com/10.1007/s41885-021-00091-6}, + doi = {10.1007/s41885-021-00091-6}, + abstract = {The impacts of climate change on the food system are a key concern for societies and policy makers globally. Assessments of the biophysical impacts of crop productivity show modest but uncertain impacts. But crop growth is not the only factor that matters for the food production. Climate impacts on the labour force through increased heat stress also need to be considered. Here, we provide projections for the integrated climate-induced impacts on crop yields and worker productivity on the agro-economy in a global multisector economic model. Biophysical impacts are derived from a multi-model ensemble, which is based on a combination of climate and crop models, and the economic analysis is conducted for different socio-economic pathways. This framework allows for a comprehensive assessment of biophysical and socio-economic risks, and outlines rapid risk increases for high-warming scenarios. Considering heat effects on labour productivity, regional production costs could increase by up to 10 percentage points or more in vulnerable tropical regions such as South and South-East Asia, and Africa. Heat stress effects on labour might offset potential benefits through productivity gains due to the carbon dioxide fertilisation effect. Agricultural adaptation through increased mechanisation might allow to alleviate some of the negative heat stress effects under optimistic scenarios of socio-economic development. Our results highlight the vulnerability of the food system to climate change impacts through multiple impact channels. Overall, we find a consistently negative impact of future climate change on crop production when accounting for worker productivity next to crop yields.}, + language = {en}, + urldate = {2021-08-18}, + journal = {Economics of Disasters and Climate Change}, + author = {Orlov, Anton and Daloz, Anne Sophie and Sillmann, Jana and Thiery, Wim and Douzal, Clara and Lejeune, Quentin and Schleussner, Carl}, + month = aug, + year = {2021}, +} + +@techreport{leclere_biodiv_2018, + type = {Other}, + title = {Towards pathways bending the curve terrestrial biodiversity trends within the 21st century}, + copyright = {cc\_by\_sa\_4}, + url = {http://pure.iiasa.ac.at/id/eprint/15241/}, + abstract = {Unless actions are taken to reduce multiple anthropogenic pressures, biodiversity is expected to continue declining at an alarming rate. Models and scenarios can be used to help design the pathways to sustain a thriving nature and its ability to contribute to people. This approach has so far been hampered by the complexity associated with combining projections of pressures on, and subsequent responses from, biodiversity. Most previous assessments have projected continuous biodiversity declines and very few have identified pathways for reversing the loss of biodiversity without jeopardizing other objectives such as development or climate mitigation. The Bending The Curve initiative set out to advance quantitative modelling techniques towards ambitious scenarios for biodiversity. In this proof-of-concept analysis, we developed a modelling approach that demonstrates how global land use and biodiversity models can shed light on wedges able to bend the curve of biodiversity trends as affected by land-use change, the biggest current threat to biodiversity. In order to address the uncertainties associated with such pathways we used a multi-model framework and relied on the Shared Socioeconomic Pathway/Representative Concentration Pathway scenario framework. This report describes the details of this modelling approach.}, + language = {en}, + urldate = {2018-10-17}, + author = {Leclere, D. and Obersteiner, M. and Alkemade, R. and Almond, R. and Barrett, M. and Bunting, G. and Burgess, N. and Butchart, S. and Chaudhary, A. and Cornell, S. and De Palma, A. and DeClerck, F. and Di Fulvio, F. and Di Marco, M. and Doelman, J. and Dürauer, M. and Ferrier, S. and Freeman, R. and Fritz, S. and Fujimori, S. and Grooten, M. and Harfoot, M. and Harwood, T. and Hasegawa, T. and Havlik, P. and Hellweg, S. and Herrero, M. and Hilbers, J. and Hill, S. and Hoskins, A. and Humpenöder, F. and Kram, T. and Krisztin, T. and Lotze-Campen, H. and Mace, G. and Matsui, T. and Meyer, C. and Nel, D. and Newbold, T. and Ohashi, H. and Popp, A. and Purvis, A. and Schipper, A. and Schmidt-Traub, G. and Stehfest, E. and Strassburg, B. and Tabeau, A. and Valin, H. and van Meijl, H. and van Vuuren, D. and van Zeist, W. and Visconti, P. and Ware, C. and Watson, J. and Wu, W. and Young, L.}, + month = may, + year = {2018}, + doi = {10.22022/ESM/04-2018.15241}, +} + +@article{leclere_bending_2020, + title = {Bending the curve of terrestrial biodiversity needs an integrated strategy}, + volume = {585}, + copyright = {2020 The Author(s), under exclusive licence to Springer Nature Limited}, + issn = {1476-4687}, + url = {https://www.nature.com/articles/s41586-020-2705-y}, + doi = {10.1038/s41586-020-2705-y}, + abstract = {Increased efforts are required to prevent further losses to terrestrial biodiversity and the ecosystem services that it  provides1,2. Ambitious targets have been proposed, such as reversing the declining trends in biodiversity3; however, just feeding the growing human population will make this a challenge4. Here we use an ensemble of land-use and biodiversity models to assess whether—and how—humanity can reverse the declines in terrestrial biodiversity caused by habitat conversion, which is a major threat to biodiversity5. We show that immediate efforts, consistent with the broader sustainability agenda but of unprecedented ambition and coordination, could enable the provision of food for the growing human population while reversing the global terrestrial biodiversity trends caused by habitat conversion. If we decide to increase the extent of land under conservation management, restore degraded land and generalize landscape-level conservation planning, biodiversity trends from habitat conversion could become positive by the mid-twenty-first century on average across models (confidence interval, 2042–2061), but this was not the case for all models. Food prices could increase and, on average across models, almost half (confidence interval, 34–50\%) of the future biodiversity losses could not be avoided. However, additionally tackling the drivers of land-use change could avoid conflict with affordable food provision and reduces the environmental effects of the food-provision system. Through further sustainable intensification and trade, reduced food waste and more plant-based human diets, more than two thirds of future biodiversity losses are avoided and the biodiversity trends from habitat conversion are reversed by 2050 for almost all of the models. Although limiting further loss will remain challenging in several biodiversity-rich regions, and other threats—such as climate change—must be addressed to truly reverse the declines in biodiversity, our results show that ambitious conservation efforts and food system transformation are central to an effective post-2020 biodiversity strategy.}, + language = {en}, + number = {7826}, + urldate = {2020-10-12}, + journal = {Nature}, + author = {Leclère, David and Obersteiner, Michael and Barrett, Mike and Butchart, Stuart H. M. and Chaudhary, Abhishek and De Palma, Adriana and DeClerck, Fabrice A. J. and Di Marco, Moreno and Doelman, Jonathan C. and Dürauer, Martina and Freeman, Robin and Harfoot, Michael and Hasegawa, Tomoko and Hellweg, Stefanie and Hilbers, Jelle P. and Hill, Samantha L. L. and Humpenöder, Florian and Jennings, Nancy and Krisztin, Tamás and Mace, Georgina M. and Ohashi, Haruka and Popp, Alexander and Purvis, Andy and Schipper, Aafke M. and Tabeau, Andrzej and Valin, Hugo and van Meijl, Hans and van Zeist, Willem-Jan and Visconti, Piero and Alkemade, Rob and Almond, Rosamunde and Bunting, Gill and Burgess, Neil D. and Cornell, Sarah E. and Di Fulvio, Fulvio and Ferrier, Simon and Fritz, Steffen and Fujimori, Shinichiro and Grooten, Monique and Harwood, Thomas and Havlík, Petr and Herrero, Mario and Hoskins, Andrew J. and Jung, Martin and Kram, Tom and Lotze-Campen, Hermann and Matsui, Tetsuya and Meyer, Carsten and Nel, Deon and Newbold, Tim and Schmidt-Traub, Guido and Stehfest, Elke and Strassburg, Bernardo B. N. and van Vuuren, Detlef P. and Ware, Chris and Watson, James E. M. and Wu, Wenchao and Young, Lucy}, + month = sep, + year = {2020}, + note = {Number: 7826; Publisher: Nature Publishing Group}, + pages = {551--556}, +} + +@online{iucn_iucn_2020, + title = {The {{IUCN Red List}} of {{Threatened Species}}}, + author = {{IUCN}}, + date = {2020}, + url = {https://www.iucnredlist.org}, + urldate = {2020-11-25} +} + +@incollection{purvis_chapter_2018, + title = {Chapter {{Five}} - {{Modelling}} and {{Projecting}} the {{Response}} of {{Local Terrestrial Biodiversity Worldwide}} to {{Land Use}} and {{Related Pressures}}: {{The PREDICTS Project}}}, + shorttitle = {Chapter {{Five}} - {{Modelling}} and {{Projecting}} the {{Response}} of {{Local Terrestrial Biodiversity Worldwide}} to {{Land Use}} and {{Related Pressures}}}, + booktitle = {Advances in {{Ecological Research}}}, + author = {Purvis, Andy and Newbold, Tim and De Palma, Adriana and Contu, Sara and Hill, Samantha L. L. and Sanchez-Ortiz, Katia and Phillips, Helen R. P. and Hudson, Lawrence N. and Lysenko, Igor and Börger, Luca and Scharlemann, Jörn P. W.}, + editor = {Bohan, David A. and Dumbrell, Alex J. and Woodward, Guy and Jackson, Michelle}, + date = {2018-01-01}, + series = {Next {{Generation Biomonitoring}}: {{Part}} 1}, + volume = {58}, + pages = {201--241}, + publisher = {{Academic Press}}, + doi = {10.1016/bs.aecr.2017.12.003}, + url = {http://www.sciencedirect.com/science/article/pii/S0065250417300284}, + urldate = {2020-02-25}, + abstract = {The PREDICTS project (Projecting Responses of Ecological Diversity In Changing Terrestrial Systems) has collated ecological survey data from hundreds of published biodiversity comparisons of sites facing different land-use and related pressures, and used the resulting taxonomically and geographically broad database (abundance and occurrence data for over 50,000 species and over 30,000 sites in nearly 100 countries) to develop global biodiversity models, indicators, and projections. After outlining the science and science-policy gaps that motivated PREDICTS, this review discusses the key design decisions that helped it to achieve its objectives. In particular, we discuss basing models on a large, taxonomically, and geographically representative database, so that they may be applicable to biodiversity more broadly; space-for-time substitution, which allows estimation of pressure-state models without the need for representative time-series data; and collation of raw data rather than statistical results, greatly expanding the range of response variables that can be modelled. The heterogeneity of data in the PREDICTS database has presented a range of modelling challenges: we discuss these with a focus on our implementation of the Biodiversity Intactness Index, an indicator with considerable policy potential but which had not previously been estimated from primary biodiversity data. We then summarise the findings from analyses of how land use and related pressures affect local (α) diversity and spatial turnover (β diversity), and how these effects are mediated by ecological attributes of species. We discuss the relevance of our findings for policy, before ending with some directions of ongoing and possible future research.}, + langid = {english}, + keywords = {Alpha diversity,Beta diversity,Biodiversity indicators,Biodiversity intactness index,Biodiversity models,Hockey-stick graph,Meta-analysis,Representativeness}, +} + +@article{wilson_2016, + title = {Greenhouse gas emission factors associated with rewetting of organic soils}, + volume = {17}, + issn = {1819-754X}, + url = {http://doi.org/10.19189/MaP.2016.OMB.222}, + doi = {10.19189/MaP.2016.OMB.222}, + abstract = {Drained organic soils are a significant source of greenhouse gas (GHG) emissions to the atmosphere. Rewetting these soils may reduce GHG emissions and could also create suitable conditions for return of the carbon (C) sink function characteristic of undrained organic soils. In this article we expand on the work relating to rewetted organic soils that was carried out for the 2014 Intergovernmental Panel on Climate Change (IPCC) Wetlands Supplement. We describe the methods and scientific approach used to derive the Tier 1 emission factors (the rate of emission per unit of activity) for the full suite of GHG and waterborne C fluxes associated with rewetting of organic soils. We recorded a total of 352 GHG and waterborne annual flux data points from an extensive literature search and these were disaggregated by flux type (i.e. CO2, CH4, N2O and DOC), climate zone and nutrient status. Our results showed fundamental differences between the GHG dynamics of drained and rewetted organic soils and, based on the 100 year global warming potential of each gas, indicated that rewetting of drained organic soils leads to: net annual removals of CO2 in the majority of organic soil classes; an increase in annual CH4 emissions; a decrease in N2O and DOC losses; and a lowering of net GHG emissions. Data published since the Wetlands Supplement (n = 58) generally support our derivations. Significant data gaps exist, particularly with regard to tropical organic soils, DOC and N2O. We propose that the uncertainty associated with our derivations could be significantly reduced by the development of country specific emission factors that could in turn be disaggregated by factors such as vegetation composition, water table level, time since rewetting and previous land use history.}, + language = {en}, + number = {4}, + urldate = {2019-04-29}, + journal = {Mires and Peat}, + author = {Wilson, D. and Blain, D. and Couwenberg, J.}, + month = apr, + year = {2016}, + pages = {4 28 pp}, +} + +@article{brooks_global_2006, + title = {Global {Biodiversity} {Conservation} {Priorities}}, + volume = {313}, + url = {https://www.science.org/doi/10.1126/science.1127609}, + doi = {10.1126/science.1127609}, + number = {5783}, + urldate = {2022-05-18}, + journal = {Science}, + author = {Brooks, T. M. and Mittermeier, R. A. and da Fonseca, G. A. B. and Gerlach, J. and Hoffmann, M. and Lamoreux, J. F. and Mittermeier, C. G. and Pilgrim, J. D. and Rodrigues, A. S. L.}, + month = jul, + year = {2006}, + note = {Publisher: American Association for the Advancement of Science}, + pages = {58--61}, +} + +@article{olson_biome_2001, + title = {Terrestrial {Ecoregions} of the {World}: {A} {New} {Map} of {Life} on {Earth}: {A} new global map of terrestrial ecoregions provides an innovative tool for conserving biodiversity}, + volume = {51}, + issn = {0006-3568}, + shorttitle = {Terrestrial {Ecoregions} of the {World}}, + url = {https://doi.org/10.1641/0006-3568(2001)051[0933:TEOTWA]2.0.CO;2}, + doi = {10.1641/0006-3568(2001)051[0933:TEOTWA]2.0.CO;2}, + number = {11}, + urldate = {2022-06-02}, + journal = {BioScience}, + author = {Olson, David M. and Dinerstein, Eric and Wikramanayake, Eric D. and Burgess, Neil D. and Powell, George V. N. and Underwood, Emma C. and D'amico, Jennifer A. and Itoua, Illanga and Strand, Holly E. and Morrison, John C. and Loucks, Colby J. and Allnutt, Thomas F. and Ricketts, Taylor H. and Kura, Yumiko and Lamoreux, John F. and Wettengel, Wesley W. and Hedao, Prashant and Kassem, Kenneth R.}, + month = nov, + year = {2001}, + pages = {933--938}, } diff --git a/main.gms b/main.gms index 53f98949ae..d64f7ecb03 100644 --- a/main.gms +++ b/main.gms @@ -1,10 +1,12 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 set RESTARTPOINT $goto %RESTARTPOINT% + $title magpie *' @title MAgPIE - Modelling Framework @@ -66,10 +68,10 @@ $title magpie *' from land-use change dynamics, i.e. from conversion of different biomes into agricultural land *' and consequent loss of terrestrial carbon stocks (@popp_land-use_2014), also including the *' depletion of organic matter in soils ([59_som]). The land also serves as a sink for atmospheric -*' carbon when agricultural land is set aside from production and the associated regrowth of natural +*' carbon when agricultural land is taken out of production and the associated regrowth of natural *' vegetation generates negative emissions from land-use change. *' Nitrogen emissions ([51_nitrogen]) are estimated based on nitrogen budgets for croplands, -*' pastures ([50_nr_budgets]) and the livestock sector ([55_awms]) (@bodirsky_reactive_2014). +*' pastures ([50_nr_soil_budget]) and the livestock sector ([55_awms]) (@bodirsky_reactive_2014). *' CH4 emissions are based on *' livestock feed and rice cultivation areas (@popp_food_2010). In the case of mitigation *' policies for the land sector, the model can reduce CO2 emissions by restraining land-use @@ -146,23 +148,23 @@ $title magpie *##################### R SECTION START (VERSION INFO) ########################## * -* Used data set: isimip_rcp-IPSL_CM5A_LR-rcp2p6-co2_rev52_c200_690d3718e151be1b450b394c1064b1c5.tgz +* Used data set: rev4.85_h12_magpie.tgz * md5sum: NA -* Repository: https://rse.pik-potsdam.de/data/magpie/public +* Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output * -* Used data set: rev4.58_h12_magpie.tgz +* Used data set: rev4.85_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz * md5sum: NA -* Repository: https://rse.pik-potsdam.de/data/magpie/public +* Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output * -* Used data set: rev4.58_h12_validation.tgz +* Used data set: rev4.85_h12_validation.tgz * md5sum: NA -* Repository: https://rse.pik-potsdam.de/data/magpie/public +* Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output * -* Used data set: calibration_H12_c200_23Feb21.tgz +* Used data set: additional_data_rev4.43.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: additional_data_rev4.00.tgz +* Used data set: calibration_H12_per_ton_fao_may22_glo_23Mar23.tgz * md5sum: NA * Repository: https://rse.pik-potsdam.de/data/magpie/public * @@ -173,31 +175,27 @@ $title magpie * * Number of cells per region: * CAZ CHA EUR IND JPN LAM MEA NEU OAS REF SSA USA -* 28 24 10 7 3 53 17 8 22 7 11 10 +* 6 17 9 8 1 44 26 7 10 13 38 21 * -* Regionscode: 690d3718e151be1b450b394c1064b1c5 +* Regionscode: 62eff8f7 * -* Regions data revision: 4.58 +* Regions data revision: 4.85 * * lpj2magpie settings: -* * LPJmL data folder: /p/projects/landuse/data/input/lpj_input/isimip_rcp/IPSL_CM5A_LR/rcp2p6/co2 -* * Additional input folder: /p/projects/landuse/data/input/other/rev52 -* * Revision: 52 -* * Call: lpj2magpie(input_folder = path(cfg$lpj_input_folder, gsub("-", "/", cfg$input)), input2_folder = path(cfg$additional_input_folder, paste("rev", floor(cfg$revision), sep = "")), output_file = lpj2magpie_file, rev = cfg$revision) +* * LPJmL data: MRI-ESM2-0:ssp370 +* * Revision: 4.85 * * aggregation settings: * * Input resolution: 0.5 * * Output resolution: c200 -* * Input file: /p/projects/landuse/data/input/archive/isimip_rcp-IPSL_CM5A_LR-rcp2p6-co2_rev52_0.5.tgz -* * Output file: /p/projects/landuse/data/input/archive/isimip_rcp-IPSL_CM5A_LR-rcp2p6-co2_rev52_c200_690d3718e151be1b450b394c1064b1c5.tgz -* * Regionscode: 690d3718e151be1b450b394c1064b1c5 -* * (clustering) n-repeat: 5 -* * (clustering) n-redistribute: 0 -* * Call: aggregation(input_file = lpj2magpie_file, regionmapping = paste0("../", cfg$regionmapping), output_file = aggregation_file, rev = cfg$revision, res_high = cfg$high_res, res_low = cfg$low_res, hcells = cfg$highres_cells, weight = cfg$cluster_weight, nrepeat = cfg$nrepeat, nredistribute = cfg$nredistribute, sum_spam_file = cfg$spamfile, debug = FALSE, seed = cfg$seed) -* +* * Regionscode: 62eff8f7 +* * Number of clusters per region: +* CAZ CHA EUR IND JPN LAM MEA NEU OAS REF SSA USA +* 6 17 9 8 1 44 26 7 10 13 38 21 +* * Call: withCallingHandlers(expr, message = messageHandler, warning = warningHandler, error = errorHandler) * * -* Last modification (input data): Fri Apr 30 11:03:40 2021 +* Last modification (input data): Fri Apr 28 16:30:54 2023 * *###################### R SECTION END (VERSION INFO) ########################### @@ -221,12 +219,12 @@ $offlisting **************************MODEL SPECIFIC SCALARS******************************** * Key parameters during model runs -$setglobal c_timesteps coup2100 +$setglobal c_timesteps calib $setglobal c_past till_2010 -$setglobal c_title default +$setglobal c_title BilatPRFade_ON_Nofadeout scalars -s_use_gdx use of gdx files / 2 / +s_use_gdx use of gdx files / 0 / ; ******************************************************************************** @@ -236,47 +234,50 @@ $setglobal drivers aug17 $setglobal land landmatrix_dec18 $setglobal costs default $setglobal interest_rate select_apr20 -$setglobal tc endo_jun18 -$setglobal yields dynamic_aug18 +$setglobal tc endo_jan22 +$setglobal yields managementcalib_aug19 -$setglobal food anthropometrics_jan18 +$setglobal food anthro_iso_jun22 $setglobal demand sector_may15 $setglobal production flexreg_apr16 $setglobal residues flexreg_apr16 -$setglobal processing substitution_dec18 +$setglobal processing substitution_may21 $setglobal trade selfsuff_reduced +$setglobal land_conservation area_based_apr22 $setglobal ageclass feb21 -$setglobal crop endo_jun13 +$setglobal crop penalty_apr22 $setglobal past endo_jun13 $setglobal forestry dynamic_feb21 -$setglobal urban static +$setglobal urban exo_nov21 $setglobal natveg dynamic_feb21 -$setglobal factor_costs mixed_feb17 -$setglobal landconversion global_static_aug18 +$setglobal employment exo_may22 +$setglobal labor_prod off +$setglobal factor_costs sticky_feb18 +$setglobal landconversion calib $setglobal transport gtap_nov12 $setglobal area_equipped_for_irrigation endo_apr13 -$setglobal water_demand agr_sector_aug13 +$setglobal water_demand all_sectors_aug13 $setglobal water_availability total_water_aug13 -$setglobal biodiversity bv_btc_mar21 +$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 peatland off +$setglobal ghg_policy price_aug22 +$setglobal maccs on_aug22 +$setglobal peatland on $setglobal som static_jan19 $setglobal bioenergy 1stgen_priced_dec18 diff --git a/modules/09_drivers/aug17/declarations.gms b/modules/09_drivers/aug17/declarations.gms index 817d4d1e7b..77fbe354b0 100644 --- a/modules/09_drivers/aug17/declarations.gms +++ b/modules/09_drivers/aug17/declarations.gms @@ -1,31 +1,39 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -parameters +parameters * Population - im_pop_iso(t_all,iso) Population (mio. per yr) - im_pop(t_all,i) Population (mio. per yr) + im_pop_iso(t_all,iso) Population (mio. per yr) + im_pop(t_all,i) Population (mio. per yr) + i09_pop_raw(t_all,i,pop_gdp_scen09) Population (mio. per yr) * GDP in MER - i09_gdp_mer_iso(t_all,iso) Income in market exchange rates (mio. USD05MER per yr) - i09_gdp_mer(t_all,i) Income in market exchange rates (mio. USD05MER per yr) + i09_gdp_mer_iso(t_all,iso) Income in market exchange rates (mio. USD05MER per yr) + im_gdp_pc_mer_iso(t_all,iso) Income in market exchange rates (mio. USD05MER per yr) + i09_gdp_mer_raw(t_all,i,pop_gdp_scen09) Income in market exchange rates (mio. USD05MER per yr) - im_gdp_pc_mer(t_all,i) Per capita income in market exchange rates (USD05MER per cap per yr) - i09_gdp_pc_mer_iso(t_all,iso) Per capita income in market exchange rates (USD05MER per cap per yr) + i09_gdp_pc_mer_raw(t_all,i,pop_gdp_scen09) Per capita income in market exchange rates (USD05MER per cap per yr) + im_gdp_pc_mer(t_all,i) Per capita income in market exchange rates (USD05MER per cap per yr) + i09_gdp_pc_mer_iso_raw(t_all,iso,pop_gdp_scen09) Per capita income in market exchange rates (USD05MER per cap per yr) * GDP in PPP - i09_gdp_ppp_iso(t_all,iso) Income in purchasing power parity (mio. USD05PPP per yr) - i09_gdp_ppp(t_all,i) Income in purchasing power parity (mio. USD05PPP per yr) + i09_gdp_ppp_iso(t_all,iso) Income in purchasing power parity (mio. USD05PPP per yr) + i09_gdp_ppp_raw(t_all,i,pop_gdp_scen09) Income in purchasing power parity (mio. USD05PPP per yr) - i09_gdp_pc_ppp(t_all,i) Per capita income in purchasing power parity (USD05PPP per cap per yr) - im_gdp_pc_ppp_iso(t_all,iso) Per capita income in purchasing power parity (USD05PPP per cap per yr) + i09_gdp_pc_ppp_raw(t_all,i,pop_gdp_scen09) Per capita income in purchasing power parity (USD05PPP per cap per yr) + i09_gdp_pc_ppp_iso_raw(t_all,iso,pop_gdp_scen09) Per capita income in purchasing power parity (USD05PPP per cap per yr) + im_gdp_pc_ppp_iso(t_all,iso) Per capita income in purchasing power parity (USD05PPP per cap per yr) * Development State - im_development_state(t_all,i) Development state according to the World Bank definition where 0=low income country 1=high income country in high income level (1) - im_physical_inactivity(t_all,iso,sex,age) Share of population which is physically inactive (1) - im_demography(t_all,iso,sex,age) Population by groups (mio. per yr) + im_development_state(t_all,i) Development state according to the World Bank definition where 0=low income country 1=high income country in high income level (1) + im_physical_inactivity(t_all,iso,sex,age) Share of population which is physically inactive (1) + im_demography(t_all,iso,sex,age) Population by groups (mio. per yr) + +* Years where SSPs and nocc/cc scenarios diverge + sm_fix_SSP2 year until which all parameters are fixed to SSP2 values (year) / 2020 / + sm_fix_cc year until which all parameters affected by cc are fixed to historical values (year) / 2020 / ; diff --git a/modules/09_drivers/aug17/input.gms b/modules/09_drivers/aug17/input.gms index 0318df4ad4..afa04155d9 100644 --- a/modules/09_drivers/aug17/input.gms +++ b/modules/09_drivers/aug17/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,42 +6,44 @@ *** | Contact: magpie@pik-potsdam.de $setglobal c09_pop_scenario SSP2 -* options: SSP: "SSP1", "SSP2", "SP3", "SSP4", "SSP5" -* SDP: "SDP" -* SRES: "a1", "a2", "b1", "b2" +* options: SSP: "SSP1", "SSP2", "SP3", "SSP4", "SSP5", "SSP2EU" +* SDP: "SDP", SDP_EI", "SDP_MC", "SDP_RC" $setglobal c09_gdp_scenario SSP2 -* options: SSP: "SSP1", "SSP2", "SSP3", "SSP4", "SSP5" -* SDP: "SDP" -* SRES: "a1", "a2", "b1", "b2" +* options: SSP: "SSP1", "SSP2", "SSP3", "SSP4", "SSP5", "SSP2EU" +* SDP: "SDP", "SDP_EI", "SDP_MC", "SDP_RC" +$setglobal c09_pal_scenario SSP2 +* options: SSP: "SSP1", "SSP2", "SSP3", "SSP4", "SSP5", "SSP2EU" +* SDP: "SDP", "SDP_EI", "SDP_MC", "SDP_RC" -table f09_gdp_ppp_iso(t_all,iso,gdp_scen09) Income in purchasing power parity (mio. USD05PPP per yr) + +table f09_gdp_ppp_iso(t_all,iso,pop_gdp_scen09) Income in purchasing power parity (mio. USD05PPP per yr) $ondelim $include "./modules/09_drivers/input/f09_gdp_ppp_iso.csv" $offdelim; -table f09_gdp_mer_iso(t_all,iso,gdp_scen09) Income in market exchange rates (mio. USD05MER per yr) +table f09_gdp_mer_iso(t_all,iso,pop_gdp_scen09) Income in market exchange rates (mio. USD05MER per yr) $ondelim $include "./modules/09_drivers/input/f09_gdp_mer_iso.csv" $offdelim; -table f09_pop_iso(t_all,iso,pop_scen09) Population (mio. capita per yr) +table f09_pop_iso(t_all,iso,pop_gdp_scen09) Population (mio. capita per yr) $ondelim $include "./modules/09_drivers/input/f09_pop_iso.csv" $offdelim; -table f09_development_state(t_all,i,gdp_scen09) Development state according to the World Bank definition where 0=low income country 1=high income country in high income level (1) +table f09_development_state(t_all,i,pop_gdp_scen09) Development state according to the World Bank definition where 0=low income country 1=high income country in high income level (1) $ondelim $include "./modules/09_drivers/input/f09_development_state.cs3" $offdelim; -table f09_demography(t_all,iso,pop_scen09,sex,age) Population (mio. capita per yr) +table f09_demography(t_all,iso,pop_gdp_scen09,sex,age) Population (mio. capita per yr) $ondelim $include "./modules/09_drivers/input/f09_demography.cs3" $offdelim; -table f09_physical_inactivity(t_all,iso,gdp_scen09,sex,age) Share of population which is physically inactive (1) +table f09_physical_inactivity(t_all,iso,pop_gdp_scen09,sex,age) Share of population which is physically inactive (1) $ondelim $include "./modules/09_drivers/input/f09_physical_inactivity.cs3" $offdelim; diff --git a/modules/09_drivers/aug17/preloop.gms b/modules/09_drivers/aug17/preloop.gms index a5cfc7c7e1..792dfdc74a 100644 --- a/modules/09_drivers/aug17/preloop.gms +++ b/modules/09_drivers/aug17/preloop.gms @@ -1,56 +1,60 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -* get the scenario GDP & Populaiton data for iso countries +* calculate GDP and population data for MAgPIE regions +i09_gdp_mer_raw(t_all,i,pop_gdp_scen09) = sum(i_to_iso(i,iso), f09_gdp_mer_iso(t_all,iso,pop_gdp_scen09)); +i09_gdp_ppp_raw(t_all,i,pop_gdp_scen09) = sum(i_to_iso(i,iso), f09_gdp_ppp_iso(t_all,iso,pop_gdp_scen09)); +i09_pop_raw(t_all,i,pop_gdp_scen09) = sum(i_to_iso(i,iso), f09_pop_iso(t_all,iso,pop_gdp_scen09)); + +* GPD per capita for MAgPIE regions +i09_gdp_pc_mer_raw(t_all,i,pop_gdp_scen09)$(i09_pop_raw(t_all,i,pop_gdp_scen09) > 0 ) = + i09_gdp_mer_raw(t_all,i,pop_gdp_scen09) / i09_pop_raw(t_all,i,pop_gdp_scen09) +; + +i09_gdp_pc_ppp_raw(t_all,i,pop_gdp_scen09)$(i09_pop_raw(t_all,i,pop_gdp_scen09) > 0 ) = + i09_gdp_ppp_raw(t_all,i,pop_gdp_scen09) / i09_pop_raw(t_all,i,pop_gdp_scen09) +; + +*' GDP per capita for ISO countries +i09_gdp_pc_ppp_iso_raw(t_all,iso,pop_gdp_scen09) = 0; +i09_gdp_pc_ppp_iso_raw(t_all,iso,pop_gdp_scen09)$(f09_gdp_ppp_iso(t_all,iso,pop_gdp_scen09) * f09_pop_iso(t_all,iso,pop_gdp_scen09) > 0) = f09_gdp_ppp_iso(t_all,iso,pop_gdp_scen09) / f09_pop_iso(t_all,iso,pop_gdp_scen09); +* Countries with no p.c. GDP information receive SSP2 average p.c. GDP +* SSP2 GDP was selected because diverging GDP and population information leads to diverging regional values +i09_gdp_pc_ppp_iso_raw(t_all,iso,pop_gdp_scen09)$(i09_gdp_pc_ppp_iso_raw(t_all,iso,pop_gdp_scen09) = 0) = sum(i_to_iso(i,iso), i09_gdp_pc_ppp_raw(t_all,i,"SSP2")); + +i09_gdp_pc_mer_iso_raw(t_all,iso,pop_gdp_scen09) = 0; +i09_gdp_pc_mer_iso_raw(t_all,iso,pop_gdp_scen09)$(f09_gdp_mer_iso(t_all,iso,pop_gdp_scen09) * f09_pop_iso(t_all,iso,pop_gdp_scen09) > 0) = f09_gdp_mer_iso(t_all,iso,pop_gdp_scen09) / f09_pop_iso(t_all,iso,pop_gdp_scen09); +* Countries with no p.c. GDP information receive SSP2 average p.c. GDP +* SSP2 GDP was selected because diverging GDP and population information leads to diverging regional values +i09_gdp_pc_mer_iso_raw(t_all,iso,pop_gdp_scen09)$(i09_gdp_pc_mer_iso_raw(t_all,iso,pop_gdp_scen09) = 0) = sum(i_to_iso(i,iso), i09_gdp_pc_mer_raw(t_all,i,"SSP2")); + +* select scenario for GDP, population, demography and physical inactivity loop(t_all, if(m_year(t_all) <= sm_fix_SSP2, im_physical_inactivity(t_all,iso,sex,age) = f09_physical_inactivity(t_all,iso,"SSP2",sex,age); - im_demography(t_all,iso,sex,age) = f09_demography(t_all,iso,"SSP2",sex,age)+0.000001; - i09_gdp_ppp_iso(t_all,iso) = f09_gdp_ppp_iso(t_all,iso,"SSP2"); - i09_gdp_mer_iso(t_all,iso) = f09_gdp_mer_iso(t_all,iso,"SSP2"); + im_demography(t_all,iso,sex,age) = f09_demography(t_all,iso,"SSP2",sex,age) + 0.000001; im_pop_iso(t_all,iso) = f09_pop_iso(t_all,iso,"SSP2"); + im_pop(t_all,i) = i09_pop_raw(t_all,i,"SSP2"); + im_gdp_pc_mer(t_all,i) = i09_gdp_pc_mer_raw(t_all,i,"SSP2"); + im_gdp_pc_mer_iso(t_all,iso) = i09_gdp_pc_mer_iso_raw(t_all,iso,"SSP2"); + im_gdp_pc_ppp_iso(t_all,iso) = i09_gdp_pc_ppp_iso_raw(t_all,iso,"SSP2"); im_development_state(t_all,i) = f09_development_state(t_all,i,"SSP2"); else - im_physical_inactivity(t_all,iso,sex,age) = f09_physical_inactivity(t_all,iso,"%c09_gdp_scenario%",sex,age); - im_demography(t_all,iso,sex,age) = f09_demography(t_all,iso,"%c09_gdp_scenario%",sex,age)+0.000001; - i09_gdp_ppp_iso(t_all,iso) = f09_gdp_ppp_iso(t_all,iso,"%c09_gdp_scenario%"); - i09_gdp_mer_iso(t_all,iso) = f09_gdp_mer_iso(t_all,iso,"%c09_gdp_scenario%"); + im_physical_inactivity(t_all,iso,sex,age) = f09_physical_inactivity(t_all,iso,"%c09_pal_scenario%",sex,age); + im_demography(t_all,iso,sex,age) = f09_demography(t_all,iso,"%c09_pop_scenario%",sex,age) + 0.000001; im_pop_iso(t_all,iso) = f09_pop_iso(t_all,iso,"%c09_pop_scenario%"); + im_pop(t_all,i) = i09_pop_raw(t_all,i,"%c09_pop_scenario%"); + im_gdp_pc_mer(t_all,i) = i09_gdp_pc_mer_raw(t_all,i,"%c09_gdp_scenario%"); + im_gdp_pc_mer_iso(t_all,iso) = i09_gdp_pc_mer_iso_raw(t_all,iso,"%c09_gdp_scenario%"); + im_gdp_pc_ppp_iso(t_all,iso) = i09_gdp_pc_ppp_iso_raw(t_all,iso,"%c09_gdp_scenario%"); im_development_state(t_all,i) = f09_development_state(t_all,i,"%c09_gdp_scenario%"); ); ); -* get the scenario GDP & Populaiton data for MAgPIE regions -i09_gdp_mer(t_all,i) = sum(i_to_iso(i,iso),i09_gdp_mer_iso(t_all,iso)); -i09_gdp_ppp(t_all,i) = sum(i_to_iso(i,iso),i09_gdp_ppp_iso(t_all,iso)); -im_pop(t_all,i) = sum(i_to_iso(i,iso),im_pop_iso(t_all,iso)); - -* GPD per capita for MAgPIE regions - im_gdp_pc_mer(t_all,i)$( - sum(i_to_iso(i,iso), - im_pop_iso(t_all,iso) - ) >0 ) = - sum(i_to_iso(i,iso), - i09_gdp_mer_iso(t_all,iso) - ) / sum(i_to_iso(i,iso), - im_pop_iso(t_all,iso) - ); - - i09_gdp_pc_ppp(t_all,i)$( - sum(i_to_iso(i,iso), - im_pop_iso(t_all,iso) - ) >0 ) = - sum(i_to_iso(i,iso), - i09_gdp_ppp_iso(t_all,iso) - ) / sum(i_to_iso(i,iso), - im_pop_iso(t_all,iso) - ); - -* GDP per capita for ISO countries -im_gdp_pc_ppp_iso(t_all,iso)=0; -im_gdp_pc_ppp_iso(t_all,iso)$(i09_gdp_ppp_iso(t_all,iso)*im_pop_iso(t_all,iso)>0) = i09_gdp_ppp_iso(t_all,iso)/im_pop_iso(t_all,iso); -im_gdp_pc_ppp_iso(t_all,iso)$(im_gdp_pc_ppp_iso(t_all,iso)=0) = sum(i_to_iso(i,iso), i09_gdp_pc_ppp(t_all,i)); +* Calculate GDP from p.c. GDP and population of previously selected scenarios +i09_gdp_mer_iso(t_all,iso) = im_gdp_pc_mer_iso(t_all,iso) * im_pop_iso(t_all,iso); +i09_gdp_ppp_iso(t_all,iso) = im_gdp_pc_ppp_iso(t_all,iso) * im_pop_iso(t_all,iso); diff --git a/modules/09_drivers/aug17/realization.gms b/modules/09_drivers/aug17/realization.gms index 366b2e20ed..e94e4962ec 100644 --- a/modules/09_drivers/aug17/realization.gms +++ b/modules/09_drivers/aug17/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/09_drivers/aug17/sets.gms b/modules/09_drivers/aug17/sets.gms index 0f2089fce4..5ea17cb20b 100644 --- a/modules/09_drivers/aug17/sets.gms +++ b/modules/09_drivers/aug17/sets.gms @@ -1,27 +1,23 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 - - pop_scen09 Population scenario - / SSP1, SSP2, SSP3, SSP4, SSP5, SDP, - a1, a2, b1, b2 / - gdp_scen09 GDP scenario - / SSP1, SSP2, SSP3, SSP4, SSP5, SDP, - a1,a2,b1,b2 / +sets + pop_gdp_scen09 Population and GDP scenario + / SSP1, SSP2, SSP3, SSP4, SSP5, + SDP, SDP_EI, SDP_MC, SDP_RC, SSP2EU / age Population age groups / 0--4, 5--9, 10--14, 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+ / + 80--84, 85--89, 90--94, 95--99, 100+ / sex Sex groups - /M,F/ + /M, F/ ; diff --git a/modules/09_drivers/module.gms b/modules/09_drivers/module.gms index 1671f24973..ffeb5dbafd 100644 --- a/modules/09_drivers/module.gms +++ b/modules/09_drivers/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/10_land/feb15/declarations.gms b/modules/10_land/feb15/declarations.gms deleted file mode 100644 index 42a7531891..0000000000 --- a/modules/10_land/feb15/declarations.gms +++ /dev/null @@ -1,48 +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 - - -parameters - pm_land_start(j,land) Land initialization area (mio. ha) - pcm_land(j,land) Land area in previous time step (mio. ha) -; - -variables - vm_landdiff Aggregated difference in land between current and previous time step (mio. ha) -; - -positive variables - vm_land(j,land) Land area of the different land types (mio. ha) - vm_landexpansion(j,land) Land expansion (mio. ha) - v10_landreduction(j,land) Land reduction (mio. ha) - vm_croplandexpansion(j,land) Sources of cropland expansion (mio. ha) - vm_croplandreduction(j,land) Targets of cropland reduction (mio. ha) - vm_cost_land_transition(j) Costs for lu transitions (mio. USD05MER per yr) -; - -equations - q10_land(j) Land conversion constraint (mio. ha) - q10_landexpansion(j,land) Land expansion constraint (mio. ha) - q10_landreduction(j,land) Land reduction constraint (mio. ha) - q10_landdiff Land difference constraint (mio. ha) -; - -*#################### R SECTION START (OUTPUT DECLARATIONS) #################### -parameters - ov_landdiff(t,type) Aggregated difference in land between current and previous time step (mio. ha) - ov_land(t,j,land,type) Land area of the different land types (mio. ha) - ov_landexpansion(t,j,land,type) Land expansion (mio. ha) - ov10_landreduction(t,j,land,type) Land reduction (mio. ha) - ov_croplandexpansion(t,j,land,type) Sources of cropland expansion (mio. ha) - ov_croplandreduction(t,j,land,type) Targets of cropland reduction (mio. ha) - ov_cost_land_transition(t,j,type) Costs for lu transitions (mio. USD05MER per yr) - oq10_land(t,j,type) Land conversion constraint (mio. ha) - oq10_landexpansion(t,j,land,type) Land expansion constraint (mio. ha) - oq10_landreduction(t,j,land,type) Land reduction constraint (mio. ha) - oq10_landdiff(t,type) Land difference constraint (mio. ha) -; -*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/10_land/feb15/equations.gms b/modules/10_land/feb15/equations.gms deleted file mode 100644 index d42a099a5f..0000000000 --- a/modules/10_land/feb15/equations.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 -*' This realization defines the total amount of land to be constant over time. - - q10_land(j2) .. - sum(land, vm_land(j2,land)) =e= sum(land, pm_land_start(j2,land)); - -*' The following two equations calculate the land expansion and land contraction. - - q10_landexpansion(j2,land) .. - vm_landexpansion(j2,land) =g= vm_land(j2,land)-pcm_land(j2,land); - q10_landreduction(j2,land) .. - v10_landreduction(j2,land) =g= pcm_land(j2,land)-vm_land(j2,land); - -*' The gross changes in land are calculated based on land expansion, land -*' contraction and land changes from within the modules [35_natveg] -*' and [32_forestry]: - - q10_landdiff .. - vm_landdiff =e= sum((j2,land), vm_landexpansion(j2,land) - + v10_landreduction(j2,land)) - + vm_landdiff_natveg - + vm_landdiff_forestry; diff --git a/modules/10_land/feb15/input.gms b/modules/10_land/feb15/input.gms deleted file mode 100644 index 0c670d2ab8..0000000000 --- a/modules/10_land/feb15/input.gms +++ /dev/null @@ -1,18 +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 f10_land(t_ini10,j,land) Different land type areas (mio. ha) -$ondelim -$include "./modules/10_land/input/avl_land_t.cs3" -$offdelim -; - -table fm_luh2_side_layers(j,luh2_side_layers10) luh2 side layers (grid cell share) -$ondelim -$include "./modules/10_land/input/luh2_side_layers.cs3" -$offdelim -; diff --git a/modules/10_land/feb15/not_used.txt b/modules/10_land/feb15/not_used.txt deleted file mode 100644 index 4327f1b371..0000000000 --- a/modules/10_land/feb15/not_used.txt +++ /dev/null @@ -1 +0,0 @@ -name,type,reason diff --git a/modules/10_land/feb15/postsolve.gms b/modules/10_land/feb15/postsolve.gms deleted file mode 100644 index c72216d5f3..0000000000 --- a/modules/10_land/feb15/postsolve.gms +++ /dev/null @@ -1,56 +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 - -*** Land Patterns are transferred to next timestep -pcm_land(j,land) = vm_land.l(j,land); - -*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_landdiff(t,"marginal") = vm_landdiff.m; - ov_land(t,j,land,"marginal") = vm_land.m(j,land); - ov_landexpansion(t,j,land,"marginal") = vm_landexpansion.m(j,land); - ov10_landreduction(t,j,land,"marginal") = v10_landreduction.m(j,land); - ov_croplandexpansion(t,j,land,"marginal") = vm_croplandexpansion.m(j,land); - ov_croplandreduction(t,j,land,"marginal") = vm_croplandreduction.m(j,land); - ov_cost_land_transition(t,j,"marginal") = vm_cost_land_transition.m(j); - oq10_land(t,j,"marginal") = q10_land.m(j); - oq10_landexpansion(t,j,land,"marginal") = q10_landexpansion.m(j,land); - oq10_landreduction(t,j,land,"marginal") = q10_landreduction.m(j,land); - oq10_landdiff(t,"marginal") = q10_landdiff.m; - ov_landdiff(t,"level") = vm_landdiff.l; - ov_land(t,j,land,"level") = vm_land.l(j,land); - ov_landexpansion(t,j,land,"level") = vm_landexpansion.l(j,land); - ov10_landreduction(t,j,land,"level") = v10_landreduction.l(j,land); - ov_croplandexpansion(t,j,land,"level") = vm_croplandexpansion.l(j,land); - ov_croplandreduction(t,j,land,"level") = vm_croplandreduction.l(j,land); - ov_cost_land_transition(t,j,"level") = vm_cost_land_transition.l(j); - oq10_land(t,j,"level") = q10_land.l(j); - oq10_landexpansion(t,j,land,"level") = q10_landexpansion.l(j,land); - oq10_landreduction(t,j,land,"level") = q10_landreduction.l(j,land); - oq10_landdiff(t,"level") = q10_landdiff.l; - ov_landdiff(t,"upper") = vm_landdiff.up; - ov_land(t,j,land,"upper") = vm_land.up(j,land); - ov_landexpansion(t,j,land,"upper") = vm_landexpansion.up(j,land); - ov10_landreduction(t,j,land,"upper") = v10_landreduction.up(j,land); - ov_croplandexpansion(t,j,land,"upper") = vm_croplandexpansion.up(j,land); - ov_croplandreduction(t,j,land,"upper") = vm_croplandreduction.up(j,land); - ov_cost_land_transition(t,j,"upper") = vm_cost_land_transition.up(j); - oq10_land(t,j,"upper") = q10_land.up(j); - oq10_landexpansion(t,j,land,"upper") = q10_landexpansion.up(j,land); - oq10_landreduction(t,j,land,"upper") = q10_landreduction.up(j,land); - oq10_landdiff(t,"upper") = q10_landdiff.up; - ov_landdiff(t,"lower") = vm_landdiff.lo; - ov_land(t,j,land,"lower") = vm_land.lo(j,land); - ov_landexpansion(t,j,land,"lower") = vm_landexpansion.lo(j,land); - ov10_landreduction(t,j,land,"lower") = v10_landreduction.lo(j,land); - ov_croplandexpansion(t,j,land,"lower") = vm_croplandexpansion.lo(j,land); - ov_croplandreduction(t,j,land,"lower") = vm_croplandreduction.lo(j,land); - ov_cost_land_transition(t,j,"lower") = vm_cost_land_transition.lo(j); - oq10_land(t,j,"lower") = q10_land.lo(j); - oq10_landexpansion(t,j,land,"lower") = q10_landexpansion.lo(j,land); - oq10_landreduction(t,j,land,"lower") = q10_landreduction.lo(j,land); - oq10_landdiff(t,"lower") = q10_landdiff.lo; -*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/10_land/feb15/presolve.gms b/modules/10_land/feb15/presolve.gms deleted file mode 100644 index dd03dbac6f..0000000000 --- a/modules/10_land/feb15/presolve.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 - -vm_land.l(j,land) = pcm_land(j,land); diff --git a/modules/10_land/feb15/realization.gms b/modules/10_land/feb15/realization.gms deleted file mode 100644 index 78847e2b4b..0000000000 --- a/modules/10_land/feb15/realization.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 - -*' @limitations This realization does not track sources and targets of land transitions. -*' Interface variables like vm_croplandexpansion and vm_croplandreduction -*' are therefore not meaningful. - -*####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/10_land/feb15/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/10_land/feb15/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/10_land/feb15/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/10_land/feb15/equations.gms" -$Ifi "%phase%" == "start" $include "./modules/10_land/feb15/start.gms" -$Ifi "%phase%" == "preloop" $include "./modules/10_land/feb15/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/10_land/feb15/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/10_land/feb15/postsolve.gms" -*######################## R SECTION END (PHASES) ############################### diff --git a/modules/10_land/feb15/sets.gms b/modules/10_land/feb15/sets.gms deleted file mode 100644 index d4a095ffa0..0000000000 --- a/modules/10_land/feb15/sets.gms +++ /dev/null @@ -1,19 +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 - t_ini10 Time periods with land initialization data - / y1995, y2000, y2005, y2010, y2015 / - - luh2_side_layers10 side layers from LUH2 - / manpast, rangeland, primveg, secdveg, forested, nonforested / - - potnatveg(luh2_side_layers10) potentially forested biomes - / forested, nonforested / - -; - diff --git a/modules/10_land/feb15/start.gms b/modules/10_land/feb15/start.gms deleted file mode 100644 index 9a4a7d611f..0000000000 --- a/modules/10_land/feb15/start.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 - -*due to some rounding errors the input data currently may contain in some cases -*very small, negative numbers. These numbers have to be set to 0 as area -*cannot be smaller than 0! -pm_land_start(j,land) = f10_land("y1995",j,land); -pm_land_start(j,land)$(pm_land_start(j,land)<0) = 0; - -pcm_land(j,land) = pm_land_start(j,land); -vm_land.l(j,land) = pcm_land(j,land); - -*** EOF pre.gms *** diff --git a/modules/10_land/input/files b/modules/10_land/input/files index 92ec2c0eee..27b769596d 100644 --- a/modules/10_land/input/files +++ b/modules/10_land/input/files @@ -2,3 +2,4 @@ avl_land_t.cs3 avl_land_t_0.5.mz luh2_side_layers.cs3 +avl_land_t_iso.cs3 diff --git a/modules/10_land/landmatrix_dec18/declarations.gms b/modules/10_land/landmatrix_dec18/declarations.gms index d5d42a9c3a..7b53d1b487 100644 --- a/modules/10_land/landmatrix_dec18/declarations.gms +++ b/modules/10_land/landmatrix_dec18/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -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 @@ -17,43 +17,39 @@ variables positive variables vm_land(j,land) Land area of the different land types (mio. ha) vm_landexpansion(j,land) Land expansion (mio. ha) - v10_landreduction(j,land) Land reduction (mio. ha) - vm_croplandexpansion(j,land) Sources of cropland expansion (mio. ha) - vm_croplandreduction(j,land) Targets of cropland reduction (mio. ha) - vm_cost_land_transition(j) Costs for lu transitions (mio. USD05MER per yr) - v10_lu_transitions(j,land_from10,land_to10) Land transitions between time steps (mio. ha) + vm_landreduction(j,land) Land reduction (mio. ha) + vm_cost_land_transition(j) Costs for lu transitions (mio. USD05MER per yr) + vm_lu_transitions(j,land_from,land_to) Land transitions between time steps (mio. ha) + v10_balance_positive(j) Balance variable for land transitions (mio. ha) + v10_balance_negative(j) Balance variable for land transitions (mio. ha) ; equations - q10_transition_matrix(j) Land transition constraint cell area (mio. ha) - q10_transition_to(j,land_to10) Land transition constraint to (mio. ha) - q10_transition_from(j,land_from10) Land transition constraint from (mio. ha) - q10_landexpansion(j,land_to10) Land expansion constraint (mio. ha) - q10_landreduction(j,land_from10) Land reduction constraint (mio. ha) - q10_croplandreduction(j,land_to10) Cropland reduction constraint (mio. ha) - q10_croplandexpansion(j,land_from10) Cropland expansion constraint (mio. ha) - q10_cost(j) Costs for lu transitions (mio. USD05MER per yr) - q10_landdiff Land difference constraint (mio. ha) + q10_transition_matrix(j) Land transition constraint cell area (mio. ha) + q10_transition_to(j,land_to) Land transition constraint to (mio. ha) + q10_transition_from(j,land_from) Land transition constraint from (mio. ha) + q10_landexpansion(j,land_to) Land expansion constraint (mio. ha) + q10_landreduction(j,land_from) Land reduction constraint (mio. ha) + q10_cost(j) Costs for lu transitions (mio. USD05MER per yr) + q10_landdiff Land difference constraint (mio. ha) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_landdiff(t,type) Aggregated difference in land between current and previous time step (mio. ha) - ov_land(t,j,land,type) Land area of the different land types (mio. ha) - ov_landexpansion(t,j,land,type) Land expansion (mio. ha) - ov10_landreduction(t,j,land,type) Land reduction (mio. ha) - ov_croplandexpansion(t,j,land,type) Sources of cropland expansion (mio. ha) - ov_croplandreduction(t,j,land,type) Targets of cropland reduction (mio. ha) - ov_cost_land_transition(t,j,type) Costs for lu transitions (mio. USD05MER per yr) - ov10_lu_transitions(t,j,land_from10,land_to10,type) Land transitions between time steps (mio. ha) - oq10_transition_matrix(t,j,type) Land transition constraint cell area (mio. ha) - oq10_transition_to(t,j,land_to10,type) Land transition constraint to (mio. ha) - oq10_transition_from(t,j,land_from10,type) Land transition constraint from (mio. ha) - oq10_landexpansion(t,j,land_to10,type) Land expansion constraint (mio. ha) - oq10_landreduction(t,j,land_from10,type) Land reduction constraint (mio. ha) - oq10_croplandreduction(t,j,land_to10,type) Cropland reduction constraint (mio. ha) - oq10_croplandexpansion(t,j,land_from10,type) Cropland expansion constraint (mio. ha) - oq10_cost(t,j,type) Costs for lu transitions (mio. USD05MER per yr) - oq10_landdiff(t,type) Land difference constraint (mio. ha) + ov_landdiff(t,type) Aggregated difference in land between current and previous time step (mio. ha) + ov_land(t,j,land,type) Land area of the different land types (mio. ha) + ov_landexpansion(t,j,land,type) Land expansion (mio. ha) + ov_landreduction(t,j,land,type) Land reduction (mio. ha) + ov_cost_land_transition(t,j,type) Costs for lu transitions (mio. USD05MER per yr) + ov_lu_transitions(t,j,land_from,land_to,type) Land transitions between time steps (mio. ha) + ov10_balance_positive(t,j,type) Balance variable for land transitions (mio. ha) + ov10_balance_negative(t,j,type) Balance variable for land transitions (mio. ha) + oq10_transition_matrix(t,j,type) Land transition constraint cell area (mio. ha) + oq10_transition_to(t,j,land_to,type) Land transition constraint to (mio. ha) + oq10_transition_from(t,j,land_from,type) Land transition constraint from (mio. ha) + oq10_landexpansion(t,j,land_to,type) Land expansion constraint (mio. ha) + oq10_landreduction(t,j,land_from,type) Land reduction constraint (mio. ha) + oq10_cost(t,j,type) Costs for lu transitions (mio. USD05MER per yr) + oq10_landdiff(t,type) Land difference constraint (mio. ha) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/10_land/landmatrix_dec18/equations.gms b/modules/10_land/landmatrix_dec18/equations.gms index 41cee3702f..03185686ca 100644 --- a/modules/10_land/landmatrix_dec18/equations.gms +++ b/modules/10_land/landmatrix_dec18/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -9,55 +9,52 @@ *' The following three equations describe the general structure of the land transition matrix. *' The first equation defines the total amount of land to be constant over time. +*' The two balancing variables `v10_balance_positive` and `v10_balance_negative` are needed +*' to avoid technical infeasibilities due to small differences in accuracy between +*' variables and parameters in GAMS. The use of `v10_balance_positive` and +*' `v10_balance_negative` is minimized by putting a high cost factor on these variables +*' (`q10_cost`). In practice, `v10_balance_positive` and +*' `v10_balance_negative`should deviate from zero only in exceptional cases. q10_transition_matrix(j2) .. - sum((land_from10,land_to10), v10_lu_transitions(j2,land_from10,land_to10)) =e= - sum(land, pcm_land(j2,land)); + sum((land_from,land_to), vm_lu_transitions(j2,land_from,land_to)) + + v10_balance_positive(j2) - v10_balance_negative(j2) =e= + sum(land, pcm_land(j2,land)); - q10_transition_to(j2,land_to10) .. - sum(land_from10, v10_lu_transitions(j2,land_from10,land_to10)) =e= - vm_land(j2,land_to10); + q10_transition_to(j2,land_to) .. + sum(land_from, vm_lu_transitions(j2,land_from,land_to)) =e= + vm_land(j2,land_to); - q10_transition_from(j2,land_from10) .. - sum(land_to10, v10_lu_transitions(j2,land_from10,land_to10)) =e= - pcm_land(j2,land_from10); + q10_transition_from(j2,land_from) .. + sum(land_to, vm_lu_transitions(j2,land_from,land_to)) =e= + pcm_land(j2,land_from); *' The following two equations calculate land expansion and land contraction based *' on the above land transition matrix. - q10_landexpansion(j2,land_to10) .. - vm_landexpansion(j2,land_to10) =e= - sum(land_from10$(not sameas(land_from10,land_to10)), - v10_lu_transitions(j2,land_from10,land_to10)); + q10_landexpansion(j2,land_to) .. + vm_landexpansion(j2,land_to) =e= + sum(land_from$(not sameas(land_from,land_to)), + vm_lu_transitions(j2,land_from,land_to)); - q10_landreduction(j2,land_from10) .. - v10_landreduction(j2,land_from10) =e= - sum(land_to10$(not sameas(land_from10,land_to10)), - v10_lu_transitions(j2,land_from10,land_to10)); - -*' Additionally the following two equations calculate the sources and targets -*' of all cropland related conversions. - -q10_croplandreduction(j2,land_to10) .. - vm_croplandreduction(j2,land_to10) =e= - v10_lu_transitions(j2,"crop",land_to10); - -q10_croplandexpansion(j2,land_from10) .. - vm_croplandexpansion(j2,land_from10) =e= - v10_lu_transitions(j2,land_from10,"crop"); + q10_landreduction(j2,land_from) .. + vm_landreduction(j2,land_from) =e= + sum(land_to$(not sameas(land_from,land_to)), + vm_lu_transitions(j2,land_from,land_to)); *' Small costs of 1 $ per ha on gross land-use change avoid unrealistic patterns in the land transition matrix q10_cost(j2) .. vm_cost_land_transition(j2) =e= - sum(land, vm_landexpansion(j2,land) + v10_landreduction(j2,land)) * 1; + sum(land, vm_landexpansion(j2,land) + vm_landreduction(j2,land)) * 1 + + (v10_balance_positive(j2) + v10_balance_negative(j2)) * s10_cost_balance; *' The gross changes in land are calculated based on land expansion, land *' contraction and land changes from within the modules [35_natveg] *' and [32_forestry]: q10_landdiff .. - vm_landdiff =e= sum((j2,land), vm_landexpansion(j2,land) - + v10_landreduction(j2,land)) + vm_landdiff =e= sum((j2,land), vm_landexpansion(j2,land) + + vm_landreduction(j2,land)) + vm_landdiff_natveg + vm_landdiff_forestry; diff --git a/modules/10_land/landmatrix_dec18/input.gms b/modules/10_land/landmatrix_dec18/input.gms index 0c670d2ab8..56f4edb78c 100644 --- a/modules/10_land/landmatrix_dec18/input.gms +++ b/modules/10_land/landmatrix_dec18/input.gms @@ -1,10 +1,14 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 +scalars + s10_cost_balance Artificial cost for balance variable (USD05MER per ha) / 1e+06 / +; + table f10_land(t_ini10,j,land) Different land type areas (mio. ha) $ondelim $include "./modules/10_land/input/avl_land_t.cs3" @@ -16,3 +20,9 @@ $ondelim $include "./modules/10_land/input/luh2_side_layers.cs3" $offdelim ; + +table fm_land_iso(t_ini10,iso,land) Land area for different land pools at ISO level (mio. ha) +$ondelim +$include "./modules/10_land/input/avl_land_t_iso.cs3" +$offdelim +; diff --git a/modules/10_land/landmatrix_dec18/postsolve.gms b/modules/10_land/landmatrix_dec18/postsolve.gms index 08f47c112d..50a2d71fdd 100644 --- a/modules/10_land/landmatrix_dec18/postsolve.gms +++ b/modules/10_land/landmatrix_dec18/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -9,72 +9,64 @@ pcm_land(j,land) = vm_land.l(j,land); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_landdiff(t,"marginal") = vm_landdiff.m; - ov_land(t,j,land,"marginal") = vm_land.m(j,land); - ov_landexpansion(t,j,land,"marginal") = vm_landexpansion.m(j,land); - ov10_landreduction(t,j,land,"marginal") = v10_landreduction.m(j,land); - ov_croplandexpansion(t,j,land,"marginal") = vm_croplandexpansion.m(j,land); - ov_croplandreduction(t,j,land,"marginal") = vm_croplandreduction.m(j,land); - ov_cost_land_transition(t,j,"marginal") = vm_cost_land_transition.m(j); - ov10_lu_transitions(t,j,land_from10,land_to10,"marginal") = v10_lu_transitions.m(j,land_from10,land_to10); - oq10_transition_matrix(t,j,"marginal") = q10_transition_matrix.m(j); - oq10_transition_to(t,j,land_to10,"marginal") = q10_transition_to.m(j,land_to10); - oq10_transition_from(t,j,land_from10,"marginal") = q10_transition_from.m(j,land_from10); - oq10_landexpansion(t,j,land_to10,"marginal") = q10_landexpansion.m(j,land_to10); - oq10_landreduction(t,j,land_from10,"marginal") = q10_landreduction.m(j,land_from10); - oq10_croplandreduction(t,j,land_to10,"marginal") = q10_croplandreduction.m(j,land_to10); - oq10_croplandexpansion(t,j,land_from10,"marginal") = q10_croplandexpansion.m(j,land_from10); - oq10_cost(t,j,"marginal") = q10_cost.m(j); - oq10_landdiff(t,"marginal") = q10_landdiff.m; - ov_landdiff(t,"level") = vm_landdiff.l; - ov_land(t,j,land,"level") = vm_land.l(j,land); - ov_landexpansion(t,j,land,"level") = vm_landexpansion.l(j,land); - ov10_landreduction(t,j,land,"level") = v10_landreduction.l(j,land); - ov_croplandexpansion(t,j,land,"level") = vm_croplandexpansion.l(j,land); - ov_croplandreduction(t,j,land,"level") = vm_croplandreduction.l(j,land); - ov_cost_land_transition(t,j,"level") = vm_cost_land_transition.l(j); - ov10_lu_transitions(t,j,land_from10,land_to10,"level") = v10_lu_transitions.l(j,land_from10,land_to10); - oq10_transition_matrix(t,j,"level") = q10_transition_matrix.l(j); - oq10_transition_to(t,j,land_to10,"level") = q10_transition_to.l(j,land_to10); - oq10_transition_from(t,j,land_from10,"level") = q10_transition_from.l(j,land_from10); - oq10_landexpansion(t,j,land_to10,"level") = q10_landexpansion.l(j,land_to10); - oq10_landreduction(t,j,land_from10,"level") = q10_landreduction.l(j,land_from10); - oq10_croplandreduction(t,j,land_to10,"level") = q10_croplandreduction.l(j,land_to10); - oq10_croplandexpansion(t,j,land_from10,"level") = q10_croplandexpansion.l(j,land_from10); - oq10_cost(t,j,"level") = q10_cost.l(j); - oq10_landdiff(t,"level") = q10_landdiff.l; - ov_landdiff(t,"upper") = vm_landdiff.up; - ov_land(t,j,land,"upper") = vm_land.up(j,land); - ov_landexpansion(t,j,land,"upper") = vm_landexpansion.up(j,land); - ov10_landreduction(t,j,land,"upper") = v10_landreduction.up(j,land); - ov_croplandexpansion(t,j,land,"upper") = vm_croplandexpansion.up(j,land); - ov_croplandreduction(t,j,land,"upper") = vm_croplandreduction.up(j,land); - ov_cost_land_transition(t,j,"upper") = vm_cost_land_transition.up(j); - ov10_lu_transitions(t,j,land_from10,land_to10,"upper") = v10_lu_transitions.up(j,land_from10,land_to10); - oq10_transition_matrix(t,j,"upper") = q10_transition_matrix.up(j); - oq10_transition_to(t,j,land_to10,"upper") = q10_transition_to.up(j,land_to10); - oq10_transition_from(t,j,land_from10,"upper") = q10_transition_from.up(j,land_from10); - oq10_landexpansion(t,j,land_to10,"upper") = q10_landexpansion.up(j,land_to10); - oq10_landreduction(t,j,land_from10,"upper") = q10_landreduction.up(j,land_from10); - oq10_croplandreduction(t,j,land_to10,"upper") = q10_croplandreduction.up(j,land_to10); - oq10_croplandexpansion(t,j,land_from10,"upper") = q10_croplandexpansion.up(j,land_from10); - oq10_cost(t,j,"upper") = q10_cost.up(j); - oq10_landdiff(t,"upper") = q10_landdiff.up; - ov_landdiff(t,"lower") = vm_landdiff.lo; - ov_land(t,j,land,"lower") = vm_land.lo(j,land); - ov_landexpansion(t,j,land,"lower") = vm_landexpansion.lo(j,land); - ov10_landreduction(t,j,land,"lower") = v10_landreduction.lo(j,land); - ov_croplandexpansion(t,j,land,"lower") = vm_croplandexpansion.lo(j,land); - ov_croplandreduction(t,j,land,"lower") = vm_croplandreduction.lo(j,land); - ov_cost_land_transition(t,j,"lower") = vm_cost_land_transition.lo(j); - ov10_lu_transitions(t,j,land_from10,land_to10,"lower") = v10_lu_transitions.lo(j,land_from10,land_to10); - oq10_transition_matrix(t,j,"lower") = q10_transition_matrix.lo(j); - oq10_transition_to(t,j,land_to10,"lower") = q10_transition_to.lo(j,land_to10); - oq10_transition_from(t,j,land_from10,"lower") = q10_transition_from.lo(j,land_from10); - oq10_landexpansion(t,j,land_to10,"lower") = q10_landexpansion.lo(j,land_to10); - oq10_landreduction(t,j,land_from10,"lower") = q10_landreduction.lo(j,land_from10); - oq10_croplandreduction(t,j,land_to10,"lower") = q10_croplandreduction.lo(j,land_to10); - oq10_croplandexpansion(t,j,land_from10,"lower") = q10_croplandexpansion.lo(j,land_from10); - oq10_cost(t,j,"lower") = q10_cost.lo(j); - oq10_landdiff(t,"lower") = q10_landdiff.lo; + ov_landdiff(t,"marginal") = vm_landdiff.m; + ov_land(t,j,land,"marginal") = vm_land.m(j,land); + ov_landexpansion(t,j,land,"marginal") = vm_landexpansion.m(j,land); + ov_landreduction(t,j,land,"marginal") = vm_landreduction.m(j,land); + ov_cost_land_transition(t,j,"marginal") = vm_cost_land_transition.m(j); + ov_lu_transitions(t,j,land_from,land_to,"marginal") = vm_lu_transitions.m(j,land_from,land_to); + ov10_balance_positive(t,j,"marginal") = v10_balance_positive.m(j); + ov10_balance_negative(t,j,"marginal") = v10_balance_negative.m(j); + oq10_transition_matrix(t,j,"marginal") = q10_transition_matrix.m(j); + oq10_transition_to(t,j,land_to,"marginal") = q10_transition_to.m(j,land_to); + oq10_transition_from(t,j,land_from,"marginal") = q10_transition_from.m(j,land_from); + oq10_landexpansion(t,j,land_to,"marginal") = q10_landexpansion.m(j,land_to); + oq10_landreduction(t,j,land_from,"marginal") = q10_landreduction.m(j,land_from); + oq10_cost(t,j,"marginal") = q10_cost.m(j); + oq10_landdiff(t,"marginal") = q10_landdiff.m; + ov_landdiff(t,"level") = vm_landdiff.l; + ov_land(t,j,land,"level") = vm_land.l(j,land); + ov_landexpansion(t,j,land,"level") = vm_landexpansion.l(j,land); + ov_landreduction(t,j,land,"level") = vm_landreduction.l(j,land); + ov_cost_land_transition(t,j,"level") = vm_cost_land_transition.l(j); + ov_lu_transitions(t,j,land_from,land_to,"level") = vm_lu_transitions.l(j,land_from,land_to); + ov10_balance_positive(t,j,"level") = v10_balance_positive.l(j); + ov10_balance_negative(t,j,"level") = v10_balance_negative.l(j); + oq10_transition_matrix(t,j,"level") = q10_transition_matrix.l(j); + oq10_transition_to(t,j,land_to,"level") = q10_transition_to.l(j,land_to); + oq10_transition_from(t,j,land_from,"level") = q10_transition_from.l(j,land_from); + oq10_landexpansion(t,j,land_to,"level") = q10_landexpansion.l(j,land_to); + oq10_landreduction(t,j,land_from,"level") = q10_landreduction.l(j,land_from); + oq10_cost(t,j,"level") = q10_cost.l(j); + oq10_landdiff(t,"level") = q10_landdiff.l; + ov_landdiff(t,"upper") = vm_landdiff.up; + ov_land(t,j,land,"upper") = vm_land.up(j,land); + ov_landexpansion(t,j,land,"upper") = vm_landexpansion.up(j,land); + ov_landreduction(t,j,land,"upper") = vm_landreduction.up(j,land); + ov_cost_land_transition(t,j,"upper") = vm_cost_land_transition.up(j); + ov_lu_transitions(t,j,land_from,land_to,"upper") = vm_lu_transitions.up(j,land_from,land_to); + ov10_balance_positive(t,j,"upper") = v10_balance_positive.up(j); + ov10_balance_negative(t,j,"upper") = v10_balance_negative.up(j); + oq10_transition_matrix(t,j,"upper") = q10_transition_matrix.up(j); + oq10_transition_to(t,j,land_to,"upper") = q10_transition_to.up(j,land_to); + oq10_transition_from(t,j,land_from,"upper") = q10_transition_from.up(j,land_from); + oq10_landexpansion(t,j,land_to,"upper") = q10_landexpansion.up(j,land_to); + oq10_landreduction(t,j,land_from,"upper") = q10_landreduction.up(j,land_from); + oq10_cost(t,j,"upper") = q10_cost.up(j); + oq10_landdiff(t,"upper") = q10_landdiff.up; + ov_landdiff(t,"lower") = vm_landdiff.lo; + ov_land(t,j,land,"lower") = vm_land.lo(j,land); + ov_landexpansion(t,j,land,"lower") = vm_landexpansion.lo(j,land); + ov_landreduction(t,j,land,"lower") = vm_landreduction.lo(j,land); + ov_cost_land_transition(t,j,"lower") = vm_cost_land_transition.lo(j); + ov_lu_transitions(t,j,land_from,land_to,"lower") = vm_lu_transitions.lo(j,land_from,land_to); + ov10_balance_positive(t,j,"lower") = v10_balance_positive.lo(j); + ov10_balance_negative(t,j,"lower") = v10_balance_negative.lo(j); + oq10_transition_matrix(t,j,"lower") = q10_transition_matrix.lo(j); + oq10_transition_to(t,j,land_to,"lower") = q10_transition_to.lo(j,land_to); + oq10_transition_from(t,j,land_from,"lower") = q10_transition_from.lo(j,land_from); + oq10_landexpansion(t,j,land_to,"lower") = q10_landexpansion.lo(j,land_to); + oq10_landreduction(t,j,land_from,"lower") = q10_landreduction.lo(j,land_from); + oq10_cost(t,j,"lower") = q10_cost.lo(j); + oq10_landdiff(t,"lower") = q10_landdiff.lo; *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/10_land/landmatrix_dec18/preloop.gms b/modules/10_land/landmatrix_dec18/preloop.gms index f57a11cfac..ae47145544 100644 --- a/modules/10_land/landmatrix_dec18/preloop.gms +++ b/modules/10_land/landmatrix_dec18/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/10_land/landmatrix_dec18/presolve.gms b/modules/10_land/landmatrix_dec18/presolve.gms index 22b9fa52ad..e9a797f6d5 100644 --- a/modules/10_land/landmatrix_dec18/presolve.gms +++ b/modules/10_land/landmatrix_dec18/presolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -10,30 +10,15 @@ *' @code Some of the land use transitions are restricted: *' No planted forest on natveg areas -v10_lu_transitions.fx(j,"primforest","forestry") = 0; -*v10_lu_transitions.fx(j,"secdforest","forestry") = 0; -*v10_lu_transitions.fx(j,"other","forestry") = 0; +vm_lu_transitions.fx(j,"primforest","forestry") = 0; *' Conversions within natveg are not allowed -v10_lu_transitions.fx(j,"primforest","other") = 0; -v10_lu_transitions.fx(j,"secdforest","other") = 0; - -*' Forestry can only increase -*v10_lu_transitions.fx(j,"forestry",land_to10) = 0; -*v10_lu_transitions.up(j,"forestry","forestry") = Inf; +vm_lu_transitions.fx(j,"primforest","other") = 0; +vm_lu_transitions.fx(j,"secdforest","other") = 0; *' Primforest can only decrease -v10_lu_transitions.fx(j,land_from10,"primforest") = 0; -v10_lu_transitions.up(j,"primforest","primforest") = Inf; - -*' Secdforest can only decrease (during optimization) -*v10_lu_transitions.fx(j,land_from10,"secdforest") = 0; -*v10_lu_transitions.up(j,"secdforest","secdforest") = Inf; - -*' Urban land is fixed -v10_lu_transitions.fx(j,land_from10,"urban") = 0; -v10_lu_transitions.fx(j,"urban",land_to10) = 0; -v10_lu_transitions.fx(j,"urban","urban") = pcm_land(j,"urban"); +vm_lu_transitions.fx(j,land_from,"primforest") = 0; +vm_lu_transitions.up(j,"primforest","primforest") = Inf; *' @stop diff --git a/modules/10_land/landmatrix_dec18/realization.gms b/modules/10_land/landmatrix_dec18/realization.gms index 235aaa9783..2f1e4fb284 100644 --- a/modules/10_land/landmatrix_dec18/realization.gms +++ b/modules/10_land/landmatrix_dec18/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -8,7 +8,7 @@ *' @description The landmatrix_dec18 realization tracks land use transitions by *' directly counting sources and targets of conversions. -*' @limitations There are currently no known limitations of this realization. +*' @limitations This realization only accounts for net land use transitions. *####################### R SECTION START (PHASES) ############################## $Ifi "%phase%" == "sets" $include "./modules/10_land/landmatrix_dec18/sets.gms" diff --git a/modules/10_land/landmatrix_dec18/scaling.gms b/modules/10_land/landmatrix_dec18/scaling.gms index 7b1b9afdfd..62e3dab685 100644 --- a/modules/10_land/landmatrix_dec18/scaling.gms +++ b/modules/10_land/landmatrix_dec18/scaling.gms @@ -1,8 +1,8 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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_landdiff.scale = 10e4; +vm_landdiff.scale = 10e3; diff --git a/modules/10_land/landmatrix_dec18/sets.gms b/modules/10_land/landmatrix_dec18/sets.gms index 7444af546d..f1b38d6aab 100644 --- a/modules/10_land/landmatrix_dec18/sets.gms +++ b/modules/10_land/landmatrix_dec18/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -9,15 +9,12 @@ sets t_ini10 Time periods with land initialization data / y1995, y2000, y2005, y2010, y2015 / - land_from10(land) Land pools - / crop, past, forestry, primforest, secdforest, urban, other / + luh2_side_layers10 side layers from LUH2 + / manpast, rangeland, primveg, secdveg, forested, nonforested / - land_to10(land) Land pools - / crop, past, forestry, primforest, secdforest, urban, other / - - luh2_side_layers10 side layers from LUH2 - / manpast, rangeland, primveg, secdveg, forested, nonforested / - - potnatveg(luh2_side_layers10) potentially forested biomes - / forested, nonforested / + potnatveg(luh2_side_layers10) potentially forested biomes + / forested, nonforested / ; + + alias(land,land_from); + alias(land,land_to); diff --git a/modules/10_land/landmatrix_dec18/start.gms b/modules/10_land/landmatrix_dec18/start.gms index 9a4a7d611f..2211b09058 100644 --- a/modules/10_land/landmatrix_dec18/start.gms +++ b/modules/10_land/landmatrix_dec18/start.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/10_land/module.gms b/modules/10_land/module.gms index d2873ec743..d9a4355503 100644 --- a/modules/10_land/module.gms +++ b/modules/10_land/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -10,11 +10,11 @@ *' @description The land module coordinates and analyzes all land related activities *' by summing up all land types and calculating the gross changes in land use *' between two time steps of optimization given the recursive dynamic structure of -*' MAgPIE model. +*' MAgPIE model. The land module tracks land use transitions by directly counting +*' sources and targets of conversions. *' @authors Jan Philipp Dietrich, Florian Humpenoeder, Kristine Karstens *###################### R SECTION START (MODULETYPES) ########################## -$Ifi "%land%" == "feb15" $include "./modules/10_land/feb15/realization.gms" $Ifi "%land%" == "landmatrix_dec18" $include "./modules/10_land/landmatrix_dec18/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/11_costs/default/declarations.gms b/modules/11_costs/default/declarations.gms index 543f05a47e..2f1272c244 100644 --- a/modules/11_costs/default/declarations.gms +++ b/modules/11_costs/default/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/11_costs/default/equations.gms b/modules/11_costs/default/equations.gms index 08ae10dff2..ce57618e07 100644 --- a/modules/11_costs/default/equations.gms +++ b/modules/11_costs/default/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -12,16 +12,20 @@ *' The global costs of production are represented by the sum of regional *' production costs of different production activities. - q11_cost_reg(i2) .. v11_cost_reg(i2) =e= sum(kall,vm_cost_prod(i2,kall)) - + vm_cost_inv(i2) + q11_cost_reg(i2) .. v11_cost_reg(i2) =e= sum(factors,vm_cost_prod_crop(i2,factors)) + + sum(kres,vm_cost_prod_kres(i2,kres)) + + vm_cost_prod_past(i2) + + vm_cost_prod_fish(i2) + + sum(factors,vm_cost_prod_livst(i2,factors)) + sum((cell(i2,j2),land), vm_cost_landcon(j2,land)) + sum((cell(i2,j2),k), vm_cost_transp(j2,k)) + vm_tech_cost(i2) + + vm_rotation_penalty(i2) + vm_nr_inorg_fert_costs(i2) + vm_p_fert_costs(i2) + vm_emission_costs(i2) - vm_reward_cdr_aff(i2) - + vm_maccs_costs(i2) + + sum(factors,vm_maccs_costs(i2,factors)) + vm_cost_AEI(i2) + vm_cost_trade(i2) + vm_cost_fore(i2) @@ -33,8 +37,9 @@ + vm_costs_additional_mon(i2) + sum(cell(i2,j2),vm_cost_land_transition(j2)) + sum(cell(i2,j2), vm_peatland_cost(j2)) - + vm_peatland_emis_cost(i2) + sum(cell(i2,j2),vm_cost_bv_loss(j2)) + + sum(cell(i2,j2),vm_cost_urban(j2)) + + sum(cell(i2,j2),vm_water_cost(i2)) ; *' The total regional production cost calculation is based on the sum of different diff --git a/modules/11_costs/default/postsolve.gms b/modules/11_costs/default/postsolve.gms index 9defbbe7d5..42f957fcb1 100644 --- a/modules/11_costs/default/postsolve.gms +++ b/modules/11_costs/default/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/11_costs/default/realization.gms b/modules/11_costs/default/realization.gms index d9c891bb73..56694d1234 100644 --- a/modules/11_costs/default/realization.gms +++ b/modules/11_costs/default/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/11_costs/default/scaling.gms b/modules/11_costs/default/scaling.gms index 8531fed442..080316fbfc 100644 --- a/modules/11_costs/default/scaling.gms +++ b/modules/11_costs/default/scaling.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,10 +7,4 @@ vm_cost_glo.scale = 10e7; v11_cost_reg.scale(i) = 10e6; -vm_tech_cost.scale(i) = 10e3; -vm_cost_prod.scale(i,k) = 10e4; vm_cost_transp.scale(j,k) = 10e3; -vm_nr_inorg_fert_costs.scale(i) = 10e4; -vm_cost_fore.scale(i) = 10e4; -vm_emission_costs.scale(i) = 10e4; -vm_maccs_costs.scale(i) = 10e4; diff --git a/modules/11_costs/module.gms b/modules/11_costs/module.gms index f091c1c558..77c290263a 100644 --- a/modules/11_costs/module.gms +++ b/modules/11_costs/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/12_interest_rate/module.gms b/modules/12_interest_rate/module.gms index 341066080b..08202aeee0 100644 --- a/modules/12_interest_rate/module.gms +++ b/modules/12_interest_rate/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/12_interest_rate/select_apr20/declarations.gms b/modules/12_interest_rate/select_apr20/declarations.gms index 016f6a793d..f9f68cab68 100644 --- a/modules/12_interest_rate/select_apr20/declarations.gms +++ b/modules/12_interest_rate/select_apr20/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/12_interest_rate/select_apr20/input.gms b/modules/12_interest_rate/select_apr20/input.gms index 7d0e475aec..6f8b3bea31 100644 --- a/modules/12_interest_rate/select_apr20/input.gms +++ b/modules/12_interest_rate/select_apr20/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -20,30 +20,30 @@ scalars sets select_countries12(iso) countries to be affected by chosen interest rate scenario / 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 / + 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 / ; parameter f12_interest_fader(t_all) Protection scenario fader (1) diff --git a/modules/12_interest_rate/select_apr20/preloop.gms b/modules/12_interest_rate/select_apr20/preloop.gms index cad49cee6a..768a57b504 100644 --- a/modules/12_interest_rate/select_apr20/preloop.gms +++ b/modules/12_interest_rate/select_apr20/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/12_interest_rate/select_apr20/realization.gms b/modules/12_interest_rate/select_apr20/realization.gms index 1c00130270..403731a435 100644 --- a/modules/12_interest_rate/select_apr20/realization.gms +++ b/modules/12_interest_rate/select_apr20/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/13_tc/endo_jan22/declarations.gms b/modules/13_tc/endo_jan22/declarations.gms new file mode 100644 index 0000000000..21fac84236 --- /dev/null +++ b/modules/13_tc/endo_jan22/declarations.gms @@ -0,0 +1,39 @@ +*** | (C) 2008-2023 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 variable + vm_tau(h,tautype) Agricultural land use intensity tau (1) + vm_tech_cost(i) Total Annuitized costs of TC (mio. USD05PPP per yr) + v13_cost_tc(i,tautype) Technical change costs per region (mio. USD05PPP) + v13_tech_cost(i,tautype) Annuitized costs of TC for crops and pasture (mio. USD05PPP per yr) +; + +equations + q13_tech_cost(i, tautype) Total annuitized costs for TC (mio. USD05PPP) + q13_cost_tc(i, tautype) Costs for TC (mio. USD05PPP per yr) + q13_tech_cost_sum(i) Total Total annuitized costs for TC (mio. USD05PPP per yr) +; + +parameters + pc13_land(i, tautype) Crop and grass land area per region (mio ha) + pcm_tau(h, tautype) Tau factor of the previous time step (1) + pc13_tcguess(h, tautype) Guess for annual tc rates in the next time step (1) + i13_tc_factor(t) Regression factor (USD05PPP per ha) + i13_tc_exponent(t) Regression exponent (1) +; + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov_tau(t,h,tautype,type) Agricultural land use intensity tau (1) + ov_tech_cost(t,i,type) Total Annuitized costs of TC (mio. USD05PPP per yr) + ov13_cost_tc(t,i,tautype,type) Technical change costs per region (mio. USD05PPP) + ov13_tech_cost(t,i,tautype,type) Annuitized costs of TC for crops and pasture (mio. USD05PPP per yr) + oq13_tech_cost(t,i,tautype,type) Total annuitized costs for TC (mio. USD05PPP) + oq13_cost_tc(t,i,tautype,type) Costs for TC (mio. USD05PPP per yr) + oq13_tech_cost_sum(t,i,type) Total Total annuitized costs for TC (mio. USD05PPP per yr) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/13_tc/endo_jun18/equations.gms b/modules/13_tc/endo_jan22/equations.gms similarity index 77% rename from modules/13_tc/endo_jun18/equations.gms rename to modules/13_tc/endo_jan22/equations.gms index e5e2532ec0..f6bfbccda1 100644 --- a/modules/13_tc/endo_jun18/equations.gms +++ b/modules/13_tc/endo_jan22/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -17,10 +17,11 @@ *' 15 years into the future using the region specific interest *' rate `pm_interest`: -q13_cost_tc(i2) .. - v13_cost_tc(i2) =e= sum(ct, pc13_land(i2) * i13_tc_factor(ct,i2) - * vm_tau(i2)**i13_tc_exponent(ct,i2) - * (1+pm_interest(ct,i2))**15); +q13_cost_tc(i2, tautype) .. + v13_cost_tc(i2, tautype) =e= sum(ct, pc13_land(i2, tautype) * + i13_tc_factor(ct) * sum(supreg(h2,i2),vm_tau(h2,tautype))** + i13_tc_exponent(ct) * (1+pm_interest(ct,i2))**15); + *' The shifting is performed because investments into technological change *' require on average 15 years of research before a yield increase is achieved, @@ -36,6 +37,9 @@ q13_cost_tc(i2) .. *' time horizon by multiplication with the interest rate `pm_interest(i)` *' (annuity with infinite time horizon): -q13_tech_cost(i2) .. - vm_tech_cost(i2)=e= (vm_tau(i2)/pc13_tau(i2)-1) * v13_cost_tc(i2) +q13_tech_cost(i2, tautype) .. + v13_tech_cost(i2, tautype) =e= sum(supreg(h2,i2), vm_tau(h2,tautype)/pcm_tau(h2,tautype)-1) * v13_cost_tc(i2,tautype) * sum(ct,pm_interest(ct,i2)/(1+pm_interest(ct,i2))); + +q13_tech_cost_sum(i2) .. + vm_tech_cost(i2) =e= sum(tautype, v13_tech_cost(i2, tautype)); diff --git a/modules/13_tc/endo_jun18/input.gms b/modules/13_tc/endo_jan22/input.gms similarity index 60% rename from modules/13_tc/endo_jun18/input.gms rename to modules/13_tc/endo_jan22/input.gms index efd2b8ae14..454ffd8148 100644 --- a/modules/13_tc/endo_jun18/input.gms +++ b/modules/13_tc/endo_jan22/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,14 +6,19 @@ *** | Contact: magpie@pik-potsdam.de -parameter fm_tau1995(i) Agricultural land use intensity tau in 1995 (1) +scalars + s13_ignore_tau_historical ignore historical tau (1) or use it as lower bound (0) (binary) / 1 / + s13_max_gdp_shr Maximum tech cost as share of regional GDP / Inf / +; + +parameter fm_tau1995(h) Agricultural land use intensity tau in 1995 (1) / $ondelim $include "./modules/13_tc/input/fm_tau1995.cs4" $offdelim /; -parameter f13_tcguess(i) Guess for initial annual TC rates (1) +parameter f13_tcguess(h) Guess for initial annual TC rates (1) / $ondelim $include "./modules/13_tc/input/f13_tcguess.cs4" @@ -34,8 +39,14 @@ $include "./modules/13_tc/input/f13_tc_exponent.cs3" $offdelim ; -table f13_tau_historical(t_all,i) historical tau scenario (1) +table f13_tau_historical(t_all,h) historical tau scenario (1) $ondelim $include "./modules/13_tc/input/f13_tau_historical.csv" $offdelim ; + +table fm_pastr_tau_hist(t_all,h) Historical managed pasture tau (1) +$ondelim +$include "./modules/13_tc/input/f13_pastr_tau_hist.csv" +$offdelim +; diff --git a/modules/13_tc/endo_jun18/nl_fix.gms b/modules/13_tc/endo_jan22/nl_fix.gms similarity index 68% rename from modules/13_tc/endo_jun18/nl_fix.gms rename to modules/13_tc/endo_jan22/nl_fix.gms index e03efa9dde..b784ee209a 100644 --- a/modules/13_tc/endo_jun18/nl_fix.gms +++ b/modules/13_tc/endo_jan22/nl_fix.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,4 +7,4 @@ * ### nl_fix ### -vm_tau.fx(i) = max(vm_tau.lo(i), min(vm_tau.up(i), vm_tau.l(i))); +vm_tau.fx(h,tautype) = max(vm_tau.lo(h,tautype), min(vm_tau.up(h,tautype), vm_tau.l(h,tautype))); diff --git a/modules/13_tc/endo_jun18/nl_relax.gms b/modules/13_tc/endo_jan22/nl_relax.gms similarity index 75% rename from modules/13_tc/endo_jun18/nl_relax.gms rename to modules/13_tc/endo_jan22/nl_relax.gms index 1395d91653..b217e477eb 100644 --- a/modules/13_tc/endo_jun18/nl_relax.gms +++ b/modules/13_tc/endo_jan22/nl_relax.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,4 +7,4 @@ * ### nl_relax ### -vm_tau.l(i) = vm_tau.l(i) + 0.1; +vm_tau.l(h,tautype) = vm_tau.l(h,tautype) + 0.1; diff --git a/modules/13_tc/endo_jun18/nl_release.gms b/modules/13_tc/endo_jan22/nl_release.gms similarity index 69% rename from modules/13_tc/endo_jun18/nl_release.gms rename to modules/13_tc/endo_jan22/nl_release.gms index bfcf67c231..5f22d75717 100644 --- a/modules/13_tc/endo_jun18/nl_release.gms +++ b/modules/13_tc/endo_jan22/nl_release.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,5 +7,5 @@ * ### nl_release ### -vm_tau.lo(i) = pc13_tau(i); -vm_tau.up(i) = 2*pc13_tau(i); +vm_tau.lo(h,tautype) = pcm_tau(h,tautype); +vm_tau.up(h,tautype) = 2*pcm_tau(h,tautype); diff --git a/modules/13_tc/endo_jan22/postsolve.gms b/modules/13_tc/endo_jan22/postsolve.gms new file mode 100644 index 0000000000..1116099f19 --- /dev/null +++ b/modules/13_tc/endo_jan22/postsolve.gms @@ -0,0 +1,46 @@ +*** | (C) 2008-2023 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 + +* Overall TC cost for the current timestep + +if((ord(t)>1), + pc13_tcguess(h,tautype) = (vm_tau.l(h,tautype)/pcm_tau(h, tautype))**(1/m_yeardiff(t)) - 1; +); + +pcm_tau(h, tautype) = vm_tau.l(h, tautype); + + +*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### + ov_tau(t,h,tautype,"marginal") = vm_tau.m(h,tautype); + ov_tech_cost(t,i,"marginal") = vm_tech_cost.m(i); + ov13_cost_tc(t,i,tautype,"marginal") = v13_cost_tc.m(i,tautype); + ov13_tech_cost(t,i,tautype,"marginal") = v13_tech_cost.m(i,tautype); + oq13_tech_cost(t,i,tautype,"marginal") = q13_tech_cost.m(i,tautype); + oq13_cost_tc(t,i,tautype,"marginal") = q13_cost_tc.m(i,tautype); + oq13_tech_cost_sum(t,i,"marginal") = q13_tech_cost_sum.m(i); + ov_tau(t,h,tautype,"level") = vm_tau.l(h,tautype); + ov_tech_cost(t,i,"level") = vm_tech_cost.l(i); + ov13_cost_tc(t,i,tautype,"level") = v13_cost_tc.l(i,tautype); + ov13_tech_cost(t,i,tautype,"level") = v13_tech_cost.l(i,tautype); + oq13_tech_cost(t,i,tautype,"level") = q13_tech_cost.l(i,tautype); + oq13_cost_tc(t,i,tautype,"level") = q13_cost_tc.l(i,tautype); + oq13_tech_cost_sum(t,i,"level") = q13_tech_cost_sum.l(i); + ov_tau(t,h,tautype,"upper") = vm_tau.up(h,tautype); + ov_tech_cost(t,i,"upper") = vm_tech_cost.up(i); + ov13_cost_tc(t,i,tautype,"upper") = v13_cost_tc.up(i,tautype); + ov13_tech_cost(t,i,tautype,"upper") = v13_tech_cost.up(i,tautype); + oq13_tech_cost(t,i,tautype,"upper") = q13_tech_cost.up(i,tautype); + oq13_cost_tc(t,i,tautype,"upper") = q13_cost_tc.up(i,tautype); + oq13_tech_cost_sum(t,i,"upper") = q13_tech_cost_sum.up(i); + ov_tau(t,h,tautype,"lower") = vm_tau.lo(h,tautype); + ov_tech_cost(t,i,"lower") = vm_tech_cost.lo(i); + ov13_cost_tc(t,i,tautype,"lower") = v13_cost_tc.lo(i,tautype); + ov13_tech_cost(t,i,tautype,"lower") = v13_tech_cost.lo(i,tautype); + oq13_tech_cost(t,i,tautype,"lower") = q13_tech_cost.lo(i,tautype); + oq13_cost_tc(t,i,tautype,"lower") = q13_cost_tc.lo(i,tautype); + oq13_tech_cost_sum(t,i,"lower") = q13_tech_cost_sum.lo(i); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/13_tc/endo_jan22/preloop.gms b/modules/13_tc/endo_jan22/preloop.gms new file mode 100644 index 0000000000..006fa2973b --- /dev/null +++ b/modules/13_tc/endo_jan22/preloop.gms @@ -0,0 +1,20 @@ +*** | (C) 2008-2023 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 + +loop(t, + if(m_year(t) <= sm_fix_SSP2, + i13_tc_factor(t) = f13_tc_factor(t,"medium"); + i13_tc_exponent(t) = f13_tc_exponent(t,"medium"); + else + i13_tc_factor(t) = f13_tc_factor(t,"%c13_tccost%"); + i13_tc_exponent(t) = f13_tc_exponent(t,"%c13_tccost%"); + ); +); + +pcm_tau(h,"crop") = fm_tau1995(h); +pcm_tau(h,"pastr") = fm_pastr_tau_hist("y1995",h); +pc13_tcguess(h,tautype) = f13_tcguess(h); diff --git a/modules/13_tc/endo_jan22/presolve.gms b/modules/13_tc/endo_jan22/presolve.gms new file mode 100644 index 0000000000..403488a972 --- /dev/null +++ b/modules/13_tc/endo_jan22/presolve.gms @@ -0,0 +1,42 @@ +*** | (C) 2008-2023 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 + + +pc13_land(i,"pastr") = sum(cell(i,j),pcm_land(j,"past")); +pc13_land(i,"crop") = sum(cell(i,j),pcm_land(j,"crop")); + +if (sum(sameas(t_past,t),1) = 1 AND s13_ignore_tau_historical = 0, + vm_tau.lo(h,"pastr") = fm_pastr_tau_hist(t,h); + vm_tau.lo(h,"crop") = f13_tau_historical(t,h); +else + vm_tau.lo(h, tautype) = pcm_tau(h, tautype); +); + + vm_tau.up(h,tautype) = 2 * pcm_tau(h,tautype); + +* educated guess for vm_tau.l: +if(ord(t) = 1, + vm_tau.l(h,tautype) = pcm_tau(h,tautype); +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); + +if(m_year(t) > sm_fix_SSP2 AND s13_max_gdp_shr <> Inf, + +* We constrain tech cost to a defined share of regional GDP to avoid unrealistically +* high endogenous tech investments + vm_tech_cost.up(i) = + sum((i_to_iso(i,iso),ct), im_gdp_pc_ppp_iso(ct,iso) * im_pop_iso(ct,iso)) * s13_max_gdp_shr; + +* We set the initial solving basis for the tech cost to its upper bound to support the solver in finding +* a proper solution. Without such initial values, the model leave tech cost at 0 and as such ignore tau +* as an efficient part of the optimal solution. + vm_tech_cost.l(i) = vm_tech_cost.up(i); + +); diff --git a/modules/13_tc/endo_jun18/realization.gms b/modules/13_tc/endo_jan22/realization.gms similarity index 75% rename from modules/13_tc/endo_jun18/realization.gms rename to modules/13_tc/endo_jan22/realization.gms index e66bf9abb8..6704866921 100644 --- a/modules/13_tc/endo_jun18/realization.gms +++ b/modules/13_tc/endo_jan22/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -41,15 +41,15 @@ *####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/13_tc/endo_jun18/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/13_tc/endo_jun18/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/13_tc/endo_jun18/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/13_tc/endo_jun18/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/13_tc/endo_jun18/scaling.gms" -$Ifi "%phase%" == "preloop" $include "./modules/13_tc/endo_jun18/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/13_tc/endo_jun18/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/13_tc/endo_jun18/postsolve.gms" -$Ifi "%phase%" == "nl_fix" $include "./modules/13_tc/endo_jun18/nl_fix.gms" -$Ifi "%phase%" == "nl_release" $include "./modules/13_tc/endo_jun18/nl_release.gms" -$Ifi "%phase%" == "nl_relax" $include "./modules/13_tc/endo_jun18/nl_relax.gms" +$Ifi "%phase%" == "sets" $include "./modules/13_tc/endo_jan22/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/13_tc/endo_jan22/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/13_tc/endo_jan22/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/13_tc/endo_jan22/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/13_tc/endo_jan22/scaling.gms" +$Ifi "%phase%" == "preloop" $include "./modules/13_tc/endo_jan22/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/13_tc/endo_jan22/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/13_tc/endo_jan22/postsolve.gms" +$Ifi "%phase%" == "nl_fix" $include "./modules/13_tc/endo_jan22/nl_fix.gms" +$Ifi "%phase%" == "nl_release" $include "./modules/13_tc/endo_jan22/nl_release.gms" +$Ifi "%phase%" == "nl_relax" $include "./modules/13_tc/endo_jan22/nl_relax.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/13_tc/endo_jun18/scaling.gms b/modules/13_tc/endo_jan22/scaling.gms similarity index 72% rename from modules/13_tc/endo_jun18/scaling.gms rename to modules/13_tc/endo_jan22/scaling.gms index 5a269ace94..9720954370 100644 --- a/modules/13_tc/endo_jun18/scaling.gms +++ b/modules/13_tc/endo_jan22/scaling.gms @@ -1,9 +1,10 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -v13_cost_tc.scale(i) = 10e7; vm_tech_cost.scale(i) = 10e3; +v13_cost_tc.scale(i,tautype) = 10e6; +v13_tech_cost.scale(i,tautype) = 10e3; diff --git a/modules/13_tc/endo_jan22/sets.gms b/modules/13_tc/endo_jan22/sets.gms new file mode 100644 index 0000000000..8ae6c4010a --- /dev/null +++ b/modules/13_tc/endo_jan22/sets.gms @@ -0,0 +1,18 @@ +*** | (C) 2008-2023 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 + + scen13 tc cost scenario + /low, medium, high/ + + tautype tc type + / pastr, crop / + +; + +*** EOF sets.gms *** diff --git a/modules/13_tc/endo_jun18/tau_regional.png b/modules/13_tc/endo_jan22/tau_regional.png similarity index 100% rename from modules/13_tc/endo_jun18/tau_regional.png rename to modules/13_tc/endo_jan22/tau_regional.png diff --git a/modules/13_tc/endo_jun18/tc_schematic.png b/modules/13_tc/endo_jan22/tc_schematic.png similarity index 100% rename from modules/13_tc/endo_jun18/tc_schematic.png rename to modules/13_tc/endo_jan22/tc_schematic.png diff --git a/modules/13_tc/endo_jun18/tcc_regression.png b/modules/13_tc/endo_jan22/tcc_regression.png similarity index 100% rename from modules/13_tc/endo_jun18/tcc_regression.png rename to modules/13_tc/endo_jan22/tcc_regression.png diff --git a/modules/13_tc/endo_jun18/declarations.gms b/modules/13_tc/endo_jun18/declarations.gms deleted file mode 100644 index eccde769b0..0000000000 --- a/modules/13_tc/endo_jun18/declarations.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 - -positive variable - vm_tau(i) Agricultural land use intensity tau (1) - vm_tech_cost(i) Annuitized costs of TC (mio. USD05PPP per yr) - v13_cost_tc(i) Technical change costs per region (mio. USD05PPP) -; - -equations - q13_tech_cost(i) Total annuitized costs for TC (mio. USD05PPP) - q13_cost_tc(i) Costs for TC (mio. USD05PPP per yr) -; - -parameters - pc13_land(i) Crop land area per region (mio ha) - pc13_tau(i) Tau factor of the previous time step (1) - pc13_tcguess(i) Guess for annual tc rates in the next time step (1) - i13_tc_factor(t,i) Regression factor (USD05PPP per ha) - i13_tc_exponent(t,i) Regression exponent (1) -; - -*#################### R SECTION START (OUTPUT DECLARATIONS) #################### -parameters - ov_tau(t,i,type) Agricultural land use intensity tau (1) - ov_tech_cost(t,i,type) Annuitized costs of TC (mio. USD05PPP per yr) - ov13_cost_tc(t,i,type) Technical change costs per region (mio. USD05PPP) - oq13_tech_cost(t,i,type) Total annuitized costs for TC (mio. USD05PPP) - oq13_cost_tc(t,i,type) Costs for TC (mio. USD05PPP per yr) -; -*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/13_tc/endo_jun18/postsolve.gms b/modules/13_tc/endo_jun18/postsolve.gms deleted file mode 100644 index b57b067323..0000000000 --- a/modules/13_tc/endo_jun18/postsolve.gms +++ /dev/null @@ -1,38 +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 - -* Overall TC cost for the current timestep - -if((ord(t)>1), - pc13_tcguess(i) = (vm_tau.l(i)/pc13_tau(i))**(1/m_yeardiff(t)) - 1; -); - -pc13_tau(i) = vm_tau.l(i); - - -*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_tau(t,i,"marginal") = vm_tau.m(i); - ov_tech_cost(t,i,"marginal") = vm_tech_cost.m(i); - ov13_cost_tc(t,i,"marginal") = v13_cost_tc.m(i); - oq13_tech_cost(t,i,"marginal") = q13_tech_cost.m(i); - oq13_cost_tc(t,i,"marginal") = q13_cost_tc.m(i); - ov_tau(t,i,"level") = vm_tau.l(i); - ov_tech_cost(t,i,"level") = vm_tech_cost.l(i); - ov13_cost_tc(t,i,"level") = v13_cost_tc.l(i); - oq13_tech_cost(t,i,"level") = q13_tech_cost.l(i); - oq13_cost_tc(t,i,"level") = q13_cost_tc.l(i); - ov_tau(t,i,"upper") = vm_tau.up(i); - ov_tech_cost(t,i,"upper") = vm_tech_cost.up(i); - ov13_cost_tc(t,i,"upper") = v13_cost_tc.up(i); - oq13_tech_cost(t,i,"upper") = q13_tech_cost.up(i); - oq13_cost_tc(t,i,"upper") = q13_cost_tc.up(i); - ov_tau(t,i,"lower") = vm_tau.lo(i); - ov_tech_cost(t,i,"lower") = vm_tech_cost.lo(i); - ov13_cost_tc(t,i,"lower") = v13_cost_tc.lo(i); - oq13_tech_cost(t,i,"lower") = q13_tech_cost.lo(i); - oq13_cost_tc(t,i,"lower") = q13_cost_tc.lo(i); -*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/13_tc/endo_jun18/preloop.gms b/modules/13_tc/endo_jun18/preloop.gms deleted file mode 100644 index 02de0145f3..0000000000 --- a/modules/13_tc/endo_jun18/preloop.gms +++ /dev/null @@ -1,24 +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 - -loop(t, - if(m_year(t) <= sm_fix_SSP2, - i13_tc_factor(t,i) = f13_tc_factor(t,"medium"); - i13_tc_exponent(t,i) = f13_tc_exponent(t,"medium"); - else -$ifthen "%c13_tccost%" == "mixed" - i13_tc_factor(t,i) = sum(t_to_i_to_dev("y1995",i,dev), sum(scen13_to_dev(scen13,dev), f13_tc_factor(t,scen13))); - i13_tc_exponent(t,i) = sum(t_to_i_to_dev("y1995",i,dev), sum(scen13_to_dev(scen13,dev), f13_tc_exponent(t,scen13))); -$else - i13_tc_factor(t,i) = f13_tc_factor(t,"%c13_tccost%"); - i13_tc_exponent(t,i) = f13_tc_exponent(t,"%c13_tccost%"); -$endif - ); -); - -pc13_tau(i) = fm_tau1995(i); -pc13_tcguess(i) = f13_tcguess(i); diff --git a/modules/13_tc/endo_jun18/presolve.gms b/modules/13_tc/endo_jun18/presolve.gms deleted file mode 100644 index 8e47ba3560..0000000000 --- a/modules/13_tc/endo_jun18/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 - - -pc13_land(i) = sum(cell(i,j),pcm_land(j,"crop")); - -if (sum(sameas(t_past,t),1) = 1, - vm_tau.lo(i) = f13_tau_historical(t,i); -else - vm_tau.lo(i) = pc13_tau(i); -); - - vm_tau.up(i) = 2*pc13_tau(i); - -* educated guess for vm_tau.l: - vm_tau.l(i) = pc13_tau(i)*(1+pc13_tcguess(i))**m_yeardiff(t); - - vm_tech_cost.up(i) = 10e9; diff --git a/modules/13_tc/endo_jun18/sets.gms b/modules/13_tc/endo_jun18/sets.gms deleted file mode 100644 index 5a3a22528c..0000000000 --- a/modules/13_tc/endo_jun18/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 - t_to_i_to_dev(t_all,i,dev) Mapping between time region and economic development status - - scen13 tc cost scenario - /low, medium, high/ - - scen13_to_dev(scen13,dev) mapping between tc cost scenarios and development stages - / high . (lic) - medium . (mic) - low . (hic) / -; - -*** EOF sets.gms *** diff --git a/modules/13_tc/exo/declarations.gms b/modules/13_tc/exo/declarations.gms index d55bf997b9..523e85f92f 100644 --- a/modules/13_tc/exo/declarations.gms +++ b/modules/13_tc/exo/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,24 +6,22 @@ *** | Contact: magpie@pik-potsdam.de positive variable - vm_tau(i) Agricultural land use intensity tau (1) + vm_tau(h,tautype) Agricultural land use intensity tau (1) vm_tech_cost(i) Costs of TC (mio. USD05PPP per yr) ; parameters - p13_cost_tc(i) Technical change costs per region (mio. USD05PPP) - p13_tech_cost_annuity(i) Annuity costs of TC (mio. USD05PPP per yr) - pc13_land(i) Crop land area per region (mio ha) - pc13_tau(i) Tau factor of the previous time step (1) - p13_tech_cost_past(t,i) Costs for TC from past (mio. USD05PPP per yr) - pc13_tech_cost_past(i) Current costs for TC from past (mio. USD05PPP per yr) - i13_tc_factor(t,i) Regression factor (USD05PPP per ha) - i13_tc_exponent(t,i) Regression exponent (1) + p13_cost_tc(i,tautype) Technical change costs per region (mio. USD05PPP) + pc13_land(i,tautype) Crop and grass land area per region (mio ha) + pcm_tau(h,tautype) Tau factor of the previous time step (1) + i13_tc_factor(t) Regression factor (USD05PPP per ha) + i13_tc_exponent(t) Regression exponent (1) + p13_tech_cost(i,tautype) Annuitized costs of TC for crops and pasture (mio. USD05PPP per yr) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_tau(t,i,type) Agricultural land use intensity tau (1) - ov_tech_cost(t,i,type) Costs of TC (mio. USD05PPP per yr) + ov_tau(t,h,tautype,type) Agricultural land use intensity tau (1) + ov_tech_cost(t,i,type) Costs of TC (mio. USD05PPP per yr) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/13_tc/exo/input.gms b/modules/13_tc/exo/input.gms index a869450e0e..ed586381b2 100644 --- a/modules/13_tc/exo/input.gms +++ b/modules/13_tc/exo/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,7 +6,7 @@ *** | Contact: magpie@pik-potsdam.de -parameter fm_tau1995(i) Agricultural land use intensity tau in 1995 (1) +parameter fm_tau1995(h) Agricultural land use intensity tau in 1995 (1) / $ondelim $include "./modules/13_tc/input/fm_tau1995.cs4" @@ -27,8 +27,15 @@ $include "./modules/13_tc/input/f13_tc_exponent.cs3" $offdelim ; -table f13_tau_scenario(t_all,i) tau scenario (1) + +table f13_tau_scenario(t_all,h,tautype) tau scenario (1) $ondelim $include "./modules/13_tc/input/f13_tau_scenario.csv" $offdelim ; + +table fm_pastr_tau_hist(t_all,h) Historical managed pasture tau (1) +$ondelim +$include "./modules/13_tc/input/f13_pastr_tau_hist.csv" +$offdelim +; diff --git a/modules/13_tc/exo/not_used.txt b/modules/13_tc/exo/not_used.txt new file mode 100644 index 0000000000..0d06794292 --- /dev/null +++ b/modules/13_tc/exo/not_used.txt @@ -0,0 +1,3 @@ +name,type,reason +im_pop_iso,input,questionnaire +im_gdp_pc_ppp_iso,input,questionnaire diff --git a/modules/13_tc/exo/postsolve.gms b/modules/13_tc/exo/postsolve.gms index 3a3be22a10..871ad5d274 100644 --- a/modules/13_tc/exo/postsolve.gms +++ b/modules/13_tc/exo/postsolve.gms @@ -1,20 +1,19 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -p13_tech_cost_past(t2,i) = p13_tech_cost_past(t2,i) + p13_tech_cost_annuity(i); -pc13_tau(i) = vm_tau.l(i); +pcm_tau(h, tautype) = vm_tau.l(h, tautype); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_tau(t,i,"marginal") = vm_tau.m(i); - ov_tech_cost(t,i,"marginal") = vm_tech_cost.m(i); - ov_tau(t,i,"level") = vm_tau.l(i); - ov_tech_cost(t,i,"level") = vm_tech_cost.l(i); - ov_tau(t,i,"upper") = vm_tau.up(i); - ov_tech_cost(t,i,"upper") = vm_tech_cost.up(i); - ov_tau(t,i,"lower") = vm_tau.lo(i); - ov_tech_cost(t,i,"lower") = vm_tech_cost.lo(i); + ov_tau(t,h,tautype,"marginal") = vm_tau.m(h,tautype); + ov_tech_cost(t,i,"marginal") = vm_tech_cost.m(i); + ov_tau(t,h,tautype,"level") = vm_tau.l(h,tautype); + ov_tech_cost(t,i,"level") = vm_tech_cost.l(i); + ov_tau(t,h,tautype,"upper") = vm_tau.up(h,tautype); + ov_tech_cost(t,i,"upper") = vm_tech_cost.up(i); + ov_tau(t,h,tautype,"lower") = vm_tau.lo(h,tautype); + ov_tech_cost(t,i,"lower") = vm_tech_cost.lo(i); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/13_tc/exo/preloop.gms b/modules/13_tc/exo/preloop.gms index 501744555c..ae3c95d04e 100644 --- a/modules/13_tc/exo/preloop.gms +++ b/modules/13_tc/exo/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,19 +7,13 @@ loop(t, if(m_year(t) <= sm_fix_SSP2, - i13_tc_factor(t,i) = f13_tc_factor(t,"medium"); - i13_tc_exponent(t,i) = f13_tc_exponent(t,"medium"); + i13_tc_factor(t) = f13_tc_factor(t,"medium"); + i13_tc_exponent(t) = f13_tc_exponent(t,"medium"); else -$ifthen "%c13_tccost%" == "mixed" - i13_tc_factor(t,i) = sum(t_to_i_to_dev("y1995",i,dev), sum(scen13_to_dev(scen13,dev), f13_tc_factor(t,scen13))); - i13_tc_exponent(t,i) = sum(t_to_i_to_dev("y1995",i,dev), sum(scen13_to_dev(scen13,dev), f13_tc_exponent(t,scen13))); -$else - i13_tc_factor(t,i) = f13_tc_factor(t,"%c13_tccost%"); - i13_tc_exponent(t,i) = f13_tc_exponent(t,"%c13_tccost%"); -$endif + i13_tc_factor(t) = f13_tc_factor(t,"%c13_tccost%"); + i13_tc_exponent(t) = f13_tc_exponent(t,"%c13_tccost%"); ); ); -pc13_tau(i) = fm_tau1995(i); - -p13_tech_cost_past(t,i) = 0; +pcm_tau(h,"crop") = fm_tau1995(h); +pcm_tau(h,"pastr") = fm_pastr_tau_hist("y1995",h); diff --git a/modules/13_tc/exo/presolve.gms b/modules/13_tc/exo/presolve.gms index 28a3c25418..e05b1f8bf6 100644 --- a/modules/13_tc/exo/presolve.gms +++ b/modules/13_tc/exo/presolve.gms @@ -1,19 +1,27 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -pc13_land(i) = sum(cell(i,j),pcm_land(j,"crop")); +pc13_land(i,"pastr") = sum(cell(i,j),pcm_land(j,"past")); +pc13_land(i,"crop") = sum(cell(i,j),pcm_land(j,"crop")); -vm_tau.fx(i) = f13_tau_scenario(t,i); +if (smin((h,tautype), f13_tau_scenario(t,h,tautype)) <= 0, + abort "tau value of 0 detected in at least one region!"; +); -p13_cost_tc(i) = pc13_land(i) * i13_tc_factor(t,i) - * vm_tau.l(i)**i13_tc_exponent(t,i) +vm_tau.fx(h,tautype) = f13_tau_scenario(t,h,tautype); + +* The costs are shifted over 15 years (exponent 15) to reflect the average +* time it takes investments in tc to pay off. + +p13_cost_tc(i,tautype) = pc13_land(i,tautype) * i13_tc_factor(t) + * sum(supreg(h,i), vm_tau.l(h,tautype))**i13_tc_exponent(t) * (1+pm_interest(t,i))**15; -p13_tech_cost_annuity(i) = (vm_tau.l(i)/pc13_tau(i)-1) * p13_cost_tc(i) +p13_tech_cost(i,tautype) = (sum(supreg(h,i),vm_tau.l(h,tautype)/pcm_tau(h,tautype))-1) * p13_cost_tc(i,tautype) * pm_interest(t,i)/(1+pm_interest(t,i)); -vm_tech_cost.fx(i) = p13_tech_cost_annuity(i) + p13_tech_cost_past(t,i); +vm_tech_cost.fx(i) = sum(tautype, p13_tech_cost(i,tautype)); diff --git a/modules/13_tc/exo/realization.gms b/modules/13_tc/exo/realization.gms index 3f5d7c6d44..bceeb44a1a 100644 --- a/modules/13_tc/exo/realization.gms +++ b/modules/13_tc/exo/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/13_tc/exo/sets.gms b/modules/13_tc/exo/sets.gms index c0ce7c2b69..e8d2b4507a 100644 --- a/modules/13_tc/exo/sets.gms +++ b/modules/13_tc/exo/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,15 +6,12 @@ *** | Contact: magpie@pik-potsdam.de sets - t_to_i_to_dev(t_all,i,dev) Mapping between time region and economic development status - scen13 tc cost scenario - /low, medium, high/ + scen13 tc cost scenario + /low, medium, high/ - scen13_to_dev(scen13,dev) mapping between tc cost scenarios and development stages - / high . (lic) - medium . (mic) - low . (hic) / + tautype tc type + / pastr, crop / ; *** EOF sets.gms *** diff --git a/modules/13_tc/input/files b/modules/13_tc/input/files index 75d062c283..29f8c46fd4 100644 --- a/modules/13_tc/input/files +++ b/modules/13_tc/input/files @@ -5,3 +5,4 @@ f13_tcguess.cs4 f13_tc_exponent.cs3 f13_tc_factor.cs3 f13_tau_historical.csv +f13_pastr_tau_hist.csv diff --git a/modules/13_tc/module.gms b/modules/13_tc/module.gms index 47107c7b76..be7a2dfdfb 100644 --- a/modules/13_tc/module.gms +++ b/modules/13_tc/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -19,9 +19,9 @@ *' Calculated $\tau$ factors are then used for yields calculation by [14_yields] *' and by [38_factor_costs] for the calculation of factor costs. *' -*' @authors Jan Philipp Dietrich, Christoph Schmitz, Benjamin Bodirsky, Florian Humpenoeder +*' @authors Jan Philipp Dietrich, Christoph Schmitz, Benjamin Bodirsky, Florian Humpenoeder, Marcos Alves *###################### R SECTION START (MODULETYPES) ########################## -$Ifi "%tc%" == "endo_jun18" $include "./modules/13_tc/endo_jun18/realization.gms" +$Ifi "%tc%" == "endo_jan22" $include "./modules/13_tc/endo_jan22/realization.gms" $Ifi "%tc%" == "exo" $include "./modules/13_tc/exo/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/14_yields/biocorrect/declarations.gms b/modules/14_yields/biocorrect/declarations.gms deleted file mode 100644 index f5599973d6..0000000000 --- a/modules/14_yields/biocorrect/declarations.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 - -parameters -****** Yields - i14_yields(t,j,kve,w) Biophysical input yields (excluding technological change) (tDM per ha per yr) -; - -positive variables - vm_yld(j,kve,w) Yields (variable because of technical change) (tDM per ha per yr) -; - -equations - q14_yield_crop(j,kcr,w) Crop yields (tDM per ha per yr) - q14_yield_past(j,w) Pasture yields (tDM per ha per yr) -; - -*#################### R SECTION START (OUTPUT DECLARATIONS) #################### -parameters - ov_yld(t,j,kve,w,type) Yields (variable because of technical change) (tDM per ha per yr) - oq14_yield_crop(t,j,kcr,w,type) Crop yields (tDM per ha per yr) - oq14_yield_past(t,j,w,type) Pasture yields (tDM per ha per yr) -; -*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/14_yields/biocorrect/equations.gms b/modules/14_yields/biocorrect/equations.gms deleted file mode 100644 index 5a626053b0..0000000000 --- a/modules/14_yields/biocorrect/equations.gms +++ /dev/null @@ -1,24 +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 - -q14_yield_crop(j2,kcr,w) .. - vm_yld(j2,kcr,w) =e= sum(ct,i14_yields(ct,j2,kcr,w))*sum(cell(i2,j2),vm_tau(i2)/fm_tau1995(i2)); - -*' For the current time step of the optimization, cellular yields of irrigated -*' and rainfed crops are calculated by multiplying calibrated input yields from -*' LPJmL with the intensification rate relative to the initial time step 1995. - -q14_yield_past(j2,w) .. - vm_yld(j2,"pasture",w) =e= sum(ct,i14_yields(ct,j2,"pasture",w)) - *(1 + s14_yld_past_switch*(sum(cell(i2,j2),vm_tau(i2)/fm_tau1995(i2)) - 1)); - -*' In the case of pasture yields, technological change cannot be fully -*' translated into yield increases. To account for that, the parameter -*' `s14_yld_past_switch` is defined to capture a certain magnitude of spillovers -*' that can range from 0 (no spillover) to 1 (full spillover). diff --git a/modules/14_yields/biocorrect/input.gms b/modules/14_yields/biocorrect/input.gms deleted file mode 100644 index c4772bb70f..0000000000 --- a/modules/14_yields/biocorrect/input.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 - -$setglobal c14_yields_scenario nocc -* options: cc (climate change) -* nocc (no climate change) - -scalars - s14_yld_past_switch Spillover parameter for translating technological change in the crop sector into pasture yield increases (1) / 0.25 / -; - -******* Calibration factor -table f14_yld_calib(i,ltype14) Calibration factor for the LPJ yields (1) -$ondelim -$include "./modules/14_yields/input/f14_yld_calib.csv" -$offdelim; - -table f14_yields(t_all,j,kve,w) LPJ potential yields per cell (rainfed and irrigated) (tDM per ha per yr) -$ondelim -$include "./modules/14_yields/input/lpj_yields.cs3" -$offdelim -; -* set values to 1995 if nocc scenario is used -$if "%c14_yields_scenario%" == "nocc" f14_yields(t_all,j,kve,w) = f14_yields("y1995",j,kve,w); -m_fillmissingyears(f14_yields,"j,kve,w"); diff --git a/modules/14_yields/biocorrect/nl_fix.gms b/modules/14_yields/biocorrect/nl_fix.gms deleted file mode 100644 index 171252f2f4..0000000000 --- a/modules/14_yields/biocorrect/nl_fix.gms +++ /dev/null @@ -1,12 +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 - -* ### nl_fix ### - -vm_yld.fx(j,kcr,w) = sum(ct,i14_yields(ct,j,kcr,w))*sum(cell(i,j),vm_tau.l(i)/fm_tau1995(i)); -vm_yld.fx(j,"pasture",w) = sum(ct,i14_yields(ct,j,"pasture",w))*((1-s14_yld_past_switch) + s14_yld_past_switch*sum(cell(i,j),vm_tau.l(i)/fm_tau1995(i))); - diff --git a/modules/14_yields/biocorrect/not_used.txt b/modules/14_yields/biocorrect/not_used.txt deleted file mode 100644 index fe40ea2c47..0000000000 --- a/modules/14_yields/biocorrect/not_used.txt +++ /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 -name,type,reason -pm_land_start,input,questionnaire -pm_past_mngmnt_factor,input,questionnaire -pm_climate_class,input, not used -pm_carbon_density_ac,input, not used -pm_carbon_density_ac_forestry,input, not used -pm_timber_yield, input, not used -pm_timber_yield_initial, par, not used diff --git a/modules/14_yields/biocorrect/preloop.gms b/modules/14_yields/biocorrect/preloop.gms deleted file mode 100644 index 6be1ce8fe9..0000000000 --- a/modules/14_yields/biocorrect/preloop.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 - -i14_yields(t,j,kve,w) = f14_yields(t,j,kve,w); - -***YIELD CORRECTION FOR 2ND GENERATION BIOENERGY CROPS************************** -i14_yields(t,j,"begr",w) = i14_yields(t,j,"begr",w)*sum(cell(i,j),fm_tau1995(i))/smax(i,fm_tau1995(i)); -i14_yields(t,j,"betr",w) = i14_yields(t,j,"betr",w)*sum(cell(i,j),fm_tau1995(i))/smax(i,fm_tau1995(i)); - -***YIELD CALIBRATION************************************************************ -i14_yields(t,j,kcr,w) = i14_yields(t,j,kcr,w) *sum(cell(i,j),f14_yld_calib(i,"crop")); -i14_yields(t,j,"pasture",w) = i14_yields(t,j,"pasture",w)*sum(cell(i,j),f14_yld_calib(i,"past")); diff --git a/modules/14_yields/biocorrect/realization.gms b/modules/14_yields/biocorrect/realization.gms deleted file mode 100644 index 36318cf624..0000000000 --- a/modules/14_yields/biocorrect/realization.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 - -*' @description The biocorrect realization reads in the LPJmL data and performs -*' several corrections. -*' First, a bioenergy yield correction is performed. As there is currently no -*' robust information on bioenergy yields available in [@FAOSTAT], it is assumed -*' that the LPJmL yields for bioenergy correspond to the yields achieved under -*' the highest currently observed value of the $\tau$ factor representing -*' agricultural land use intensity. Bioenergy yields are downscaled -*' proportionally to the respective $\tau$ factor in the given region. -*' Second, yields for all other crops are corrected on the regional -*' level by applying a calibration factor that does not differentiate between -*' crops. Pasture yields have their own regional calibration factors. Applied -*' calibration factors are derived via comparing cropland and pasture areas in -*' the initial time step with values reported by FAO [@FAOSTAT]. -*' -*' @limitations The magnitude of spillover effects from technological change in -*' the crop sector towards improvements in pasture management is very uncertain. - -*####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/14_yields/biocorrect/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/14_yields/biocorrect/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/14_yields/biocorrect/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/14_yields/biocorrect/equations.gms" -$Ifi "%phase%" == "preloop" $include "./modules/14_yields/biocorrect/preloop.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/14_yields/biocorrect/postsolve.gms" -$Ifi "%phase%" == "nl_fix" $include "./modules/14_yields/biocorrect/nl_fix.gms" -$Ifi "%phase%" == "nl_release" $include "./modules/14_yields/biocorrect/nl_release.gms" -*######################## R SECTION END (PHASES) ############################### diff --git a/modules/14_yields/dynamic_aug18/declarations.gms b/modules/14_yields/dynamic_aug18/declarations.gms deleted file mode 100644 index 187cc4ce6b..0000000000 --- a/modules/14_yields/dynamic_aug18/declarations.gms +++ /dev/null @@ -1,33 +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 - -parameters - i14_yields(t,j,kve,w) Biophysical input yields (excluding technological change) (tDM per ha per yr) - p14_pyield_LPJ_reg(t_all,i) Regional average input yields aggregated from clusters with initial pasture area as weights (tDM per ha per yr) - p14_pyield_corr(t,i) Regional pasture management correction for historical time steps (1) - p14_growing_stock(t,j,ac,forest_land,forest_type) Forest growing stock (tDM per ha per yr) - pm_timber_yield(t,j,ac,forest_land) Forest growing stock (tDM per ha per yr) - 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) - ; - -positive variables - vm_yld(j,kve,w) Yields (variable because of technical change) (tDM per ha per yr) -; - -equations - q14_yield_crop(j,kcr,w) Crop yields (tDM per ha per yr) - q14_yield_past(j,w) Pasture yields (tDM per ha per yr) -; - -*#################### R SECTION START (OUTPUT DECLARATIONS) #################### -parameters - ov_yld(t,j,kve,w,type) Yields (variable because of technical change) (tDM per ha per yr) - oq14_yield_crop(t,j,kcr,w,type) Crop yields (tDM per ha per yr) - oq14_yield_past(t,j,w,type) Pasture yields (tDM per ha per yr) -; -*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/14_yields/dynamic_aug18/equations.gms b/modules/14_yields/dynamic_aug18/equations.gms deleted file mode 100644 index 695375d5dc..0000000000 --- a/modules/14_yields/dynamic_aug18/equations.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 - -*' @equations - -***CROP YIELD CALCULATIONS********************************************** -q14_yield_crop(j2,kcr,w) .. - vm_yld(j2,kcr,w) =e= sum(ct,i14_yields(ct,j2,kcr,w))*sum(cell(i2,j2),vm_tau(i2)/fm_tau1995(i2)); - - -***PASTURE YIELD CALCULATIONS******************************************* -*' Pasture yields are not linked to yield increases in the crop sector, but to -*' an exogenous pasture management factor `pm_past_mngmnt_factor`: - -q14_yield_past(j2,w) .. - vm_yld(j2,"pasture",w) =e= - sum(ct,(i14_yields(ct,j2,"pasture",w) - *sum(cell(i2,j2),pm_past_mngmnt_factor(ct,i2)))); diff --git a/modules/14_yields/dynamic_aug18/postsolve.gms b/modules/14_yields/dynamic_aug18/postsolve.gms deleted file mode 100644 index e816cf23ad..0000000000 --- a/modules/14_yields/dynamic_aug18/postsolve.gms +++ /dev/null @@ -1,25 +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_yld(t,j,kve,w,"marginal") = vm_yld.m(j,kve,w); - oq14_yield_crop(t,j,kcr,w,"marginal") = q14_yield_crop.m(j,kcr,w); - oq14_yield_past(t,j,w,"marginal") = q14_yield_past.m(j,w); - ov_yld(t,j,kve,w,"level") = vm_yld.l(j,kve,w); - oq14_yield_crop(t,j,kcr,w,"level") = q14_yield_crop.l(j,kcr,w); - oq14_yield_past(t,j,w,"level") = q14_yield_past.l(j,w); - ov_yld(t,j,kve,w,"upper") = vm_yld.up(j,kve,w); - oq14_yield_crop(t,j,kcr,w,"upper") = q14_yield_crop.up(j,kcr,w); - oq14_yield_past(t,j,w,"upper") = q14_yield_past.up(j,w); - ov_yld(t,j,kve,w,"lower") = vm_yld.lo(j,kve,w); - oq14_yield_crop(t,j,kcr,w,"lower") = q14_yield_crop.lo(j,kcr,w); - oq14_yield_past(t,j,w,"lower") = q14_yield_past.lo(j,w); -*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### - diff --git a/modules/14_yields/dynamic_aug18/preloop.gms b/modules/14_yields/dynamic_aug18/preloop.gms deleted file mode 100644 index d35e6ec41f..0000000000 --- a/modules/14_yields/dynamic_aug18/preloop.gms +++ /dev/null @@ -1,56 +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 - -i14_yields(t,j,kve,w) = f14_yields(t,j,kve,w); - -***YIELD CORRECTION FOR 2ND GENERATION BIOENERGY CROPS************************************* -i14_yields(t,j,"begr",w) = i14_yields(t,j,"begr",w)*sum(cell(i,j),fm_tau1995(i))/smax(i,fm_tau1995(i)); -i14_yields(t,j,"betr",w) = i14_yields(t,j,"betr",w)*sum(cell(i,j),fm_tau1995(i))/smax(i,fm_tau1995(i)); - -***YIELD CORRECTION FOR PASTURE ACCOUNTING FOR REGIONAL DIFFERENCES IN MANAGEMENT*** -p14_pyield_LPJ_reg(t,i) = (sum(cell(i,j),i14_yields(t,j,"pasture","rainfed")*pm_land_start(j,"past"))/sum(cell(i,j),pm_land_start(j,"past")) ); - -p14_pyield_corr(t,i) = (f14_pyld_hist(t,i)/p14_pyield_LPJ_reg(t,i))$(sum(sameas(t_past,t),1) = 1) - + sum(t_past,(f14_pyld_hist(t_past,i)/(p14_pyield_LPJ_reg(t_past,i)+0.000001))$(ord(t_past)=card(t_past)))$(sum(sameas(t_past,t),1) <> 1); -i14_yields(t,j,"pasture",w) = i14_yields(t,j,"pasture",w)*sum(cell(i,j),p14_pyield_corr(t,i)); - -***YIELD CALIBRATION*********************************************************************** -i14_yields(t,j,kcr,w) = i14_yields(t,j,kcr,w) *sum(cell(i,j),f14_yld_calib(i,"crop")); -i14_yields(t,j,"pasture",w) = i14_yields(t,j,"pasture",w)*sum(cell(i,j),f14_yld_calib(i,"past")); - -**** -**** -**** -p14_growing_stock_initial(j,ac,"forestry","plantations") = - ( - pm_carbon_density_ac_forestry("y1995",j,ac,"vegc") - / s14_carbon_fraction - * f14_aboveground_fraction("forestry") - / sum(clcl, pm_climate_class(j,clcl) * f14_ipcc_bce(clcl,"plantations")) - ) - ; - -p14_growing_stock_initial(j,ac,land_natveg,"natveg") = - ( - pm_carbon_density_ac("y1995",j,ac,"vegc") - / s14_carbon_fraction - * f14_aboveground_fraction(land_natveg) - / sum(clcl, pm_climate_class(j,clcl) * f14_ipcc_bce(clcl,"natveg")) - ) - ; -**** Hard constraint to always have a positive number in p14_growing_stock -p14_growing_stock_initial(j,ac,land_natveg,"natveg") = p14_growing_stock_initial(j,ac,land_natveg,"natveg")$(p14_growing_stock_initial(j,ac,land_natveg,"natveg")>0)+0.0001$(p14_growing_stock_initial(j,ac,land_natveg,"natveg")=0); -p14_growing_stock_initial(j,ac,"forestry","plantations") = p14_growing_stock_initial(j,ac,"forestry","plantations")$(p14_growing_stock_initial(j,ac,"forestry","plantations")>0)+0.0001$(p14_growing_stock_initial(j,ac,"forestry","plantations")=0); - -** Used in equations -*************************************************************** -** If the plantation yield switch is on, forestry yields are treated are plantation yields -pm_timber_yield_initial(j,ac,"forestry")$(s14_timber_plantation_yield = 1) = p14_growing_stock_initial(j,ac,"forestry","plantations") ; -** If the plantation yield switch is off, then the forestry yields are given the same values as secdforest yields, -pm_timber_yield_initial(j,ac,"forestry")$(s14_timber_plantation_yield = 0) = pm_timber_yield_initial(j,ac,"secdforest"); -** Natveg yields are unchanged and doesn't depend on plantation yield switch -pm_timber_yield_initial(j,ac,land_natveg) = p14_growing_stock_initial(j,ac,land_natveg,"natveg"); diff --git a/modules/14_yields/dynamic_aug18/realization.gms b/modules/14_yields/dynamic_aug18/realization.gms deleted file mode 100644 index 7c8a8c4d6c..0000000000 --- a/modules/14_yields/dynamic_aug18/realization.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 - -*' @description In the dynamic_aug18 realization, the crop yield calculations -*' are identical as in the above described realization (biocorrect). -*' Additionally, this realization also calculates the growing stocks in commercial -*' plantations and natural vegetation using LPJmL Carbon stocks. -*' -*' @limitations The exogenous implementation of pasture intensification cannot -*' capture feedbacks between land scarcity and efforts to improve pasture -*' management. - - -*####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/14_yields/dynamic_aug18/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/14_yields/dynamic_aug18/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/14_yields/dynamic_aug18/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/14_yields/dynamic_aug18/equations.gms" -$Ifi "%phase%" == "preloop" $include "./modules/14_yields/dynamic_aug18/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/14_yields/dynamic_aug18/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/14_yields/dynamic_aug18/postsolve.gms" -$Ifi "%phase%" == "nl_fix" $include "./modules/14_yields/dynamic_aug18/nl_fix.gms" -$Ifi "%phase%" == "nl_release" $include "./modules/14_yields/dynamic_aug18/nl_release.gms" -*######################## R SECTION END (PHASES) ############################### diff --git a/modules/14_yields/managementcalib_aug19/declarations.gms b/modules/14_yields/managementcalib_aug19/declarations.gms new file mode 100644 index 0000000000..baacf31688 --- /dev/null +++ b/modules/14_yields/managementcalib_aug19/declarations.gms @@ -0,0 +1,43 @@ +*** | (C) 2008-2023 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 + +parameters + i14_yields_calib(t,j,kve,w) Calibrated biophysical input yields (excluding technological change) (tDM per ha per yr) + p14_pyield_LPJ_reg(t_all,i) Regional average input yields aggregated from clusters with initial pasture area as weights (tDM per ha per yr) + p14_pyield_corr(t,i) Regional pasture management correction for historical time steps (1) + i14_croparea_total(t_all,w,j) Cellular croparea (mio. ha) + i14_modeled_yields_hist(t_all,i,kcr) Biophysical input yields average over region and water supply type at the historical reference year (tDM per ha per yr) + i14_fao_yields_hist(t,i,kcr) FAO yields per region at the historical referende year (tDM per ha per yr) + i14_lambda_yields(t,i,kcr) Scaling factor for non-linear management calibration (1) + i14_managementcalib(t,j,kcr,w) Regional management calibration factor accounting for FAO yield levels (1) + p14_growing_stock(t,j,ac,forest_land,forest_type) Forest growing stock (tDM per ha per yr) + pm_timber_yield(t,j,ac,forest_land) Forest growing stock (tDM per ha per yr) + 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 + vm_yld(j,kve,w) Yields (variable because of technical change) (tDM per ha per yr) +; + +equations + q14_yield_crop(j,kcr,w) Crop yields (tDM per ha per yr) + q14_yield_past(j,w) Pasture yields (tDM per ha per yr) +; + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov_yld(t,j,kve,w,type) Yields (variable because of technical change) (tDM per ha per yr) + oq14_yield_crop(t,j,kcr,w,type) Crop yields (tDM per ha per yr) + oq14_yield_past(t,j,w,type) Pasture yields (tDM per ha per yr) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/14_yields/managementcalib_aug19/equations.gms b/modules/14_yields/managementcalib_aug19/equations.gms new file mode 100644 index 0000000000..0488f75081 --- /dev/null +++ b/modules/14_yields/managementcalib_aug19/equations.gms @@ -0,0 +1,39 @@ +*** | (C) 2008-2023 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 + +***CROP YIELD CALCULATIONS********************************************** + +*' Technological change can increase the initial calibrated yields by: + +q14_yield_crop(j2,kcr,w) .. + vm_yld(j2,kcr,w) =e= sum(ct,i14_yields_calib(ct,j2,kcr,w)) * + sum((cell(i2,j2), supreg(h2,i2)), vm_tau(h2,"crop") / fm_tau1995(h2)); + +*' For the current time step of the optimization, cellular yields of irrigated +*' and rainfed crops are calculated by multiplying calibrated input yields from +*' LPJmL with the intensification rate relative to the initial time step 1995. + +***PASTURE YIELD CALCULATIONS******************************************* + +*' In the case of pasture yields, technological change cannot be fully +*' translated into yield increases, to address that, an exogenous pasture management +*' factor `pm_past_mngmnt_factor` is used to scale pasture yields based on the +*' number of cattle reared to fulfill the domestic demand for ruminant livestock +*' products in module 70. +*' +*' Additionally, the parameter `s14_yld_past_switch` can be used to capture a +*' certain magnitude of spillovers of the yield increase due to technological +*' change from the time step before. It can range from 0 (no spillover) to 1 +*' (full spillover). + +q14_yield_past(j2,w) .. + vm_yld(j2,"pasture",w) =e= + sum(ct,(i14_yields_calib(ct,j2,"pasture",w)) + * sum(cell(i2,j2),pm_past_mngmnt_factor(ct,i2))) + * (1 + s14_yld_past_switch*(sum((cell(i2,j2), supreg(h2,i2)), pcm_tau(h2, "crop")/fm_tau1995(h2)) - 1)); diff --git a/modules/14_yields/dynamic_aug18/input.gms b/modules/14_yields/managementcalib_aug19/input.gms similarity index 50% rename from modules/14_yields/dynamic_aug18/input.gms rename to modules/14_yields/managementcalib_aug19/input.gms index 4ab248257a..2eea9d4afb 100644 --- a/modules/14_yields/dynamic_aug18/input.gms +++ b/modules/14_yields/managementcalib_aug19/input.gms @@ -1,32 +1,46 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 c14_yields_scenario nocc -* options: cc (climate change) -* nocc (no climate change) +$setglobal c14_yields_scenario cc +* options: cc (climate change) +* nocc (no climate change) +* nocc_hist (no climate change after year defined by sm_fix_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 / +; scalars s14_timber_plantation_yield Plantation yield switch (0=natveg yields 1=plantation yields) (1) / 1 / s14_carbon_fraction Carbon fraction for conversion of biomass to dry matter (1) / 0.5/ ; + ******* Calibration factor +$onEmpty table f14_yld_calib(i,ltype14) Calibration factor for the LPJmL yields (1) $ondelim -$include "./modules/14_yields/input/f14_yld_calib.csv" -$offdelim; +$if exist "./modules/14_yields/input/f14_yld_calib.csv" $include "./modules/14_yields/input/f14_yld_calib.csv" +$offdelim +; +$offEmpty table f14_yields(t_all,j,kve,w) LPJmL potential yields per cell (rainfed and irrigated) (tDM per ha per yr) $ondelim $include "./modules/14_yields/input/lpj_yields.cs3" $offdelim ; -* set values to 1995 if nocc scenario is used +* set values to 1995 if nocc scenario is used, or to sm_fix_cc after sm_fix_cc if nocc_hist is used $if "%c14_yields_scenario%" == "nocc" f14_yields(t_all,j,kve,w) = f14_yields("y1995",j,kve,w); +$if "%c14_yields_scenario%" == "nocc_hist" f14_yields(t_all,j,kve,w)$(m_year(t_all) > sm_fix_cc) = f14_yields(t_all,j,kve,w)$(m_year(t_all) = sm_fix_cc); m_fillmissingyears(f14_yields,"j,kve,w"); table f14_pyld_hist(t_all,i) Modelled regional pasture yields in the past (tDM per ha per yr) @@ -34,6 +48,22 @@ $ondelim $include "./modules/14_yields/input/f14_pasture_yields_hist.csv" $offdelim; + +table f14_fao_yields_hist(t_all,i,kcr) FAO yields per region (tDM per ha per yr) +$ondelim +$include "./modules/14_yields/managementcalib_aug19/input/f14_region_yields.cs3" +$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 new file mode 100644 index 0000000000..cf2be7a6dc --- /dev/null +++ b/modules/14_yields/managementcalib_aug19/input/files @@ -0,0 +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/nl_fix.gms b/modules/14_yields/managementcalib_aug19/nl_fix.gms new file mode 100644 index 0000000000..193892ec47 --- /dev/null +++ b/modules/14_yields/managementcalib_aug19/nl_fix.gms @@ -0,0 +1,11 @@ +*** | (C) 2008-2023 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 + +* ### nl_fix ### + +vm_yld.fx(j,kcr,w) = sum(ct,i14_yields_calib(ct,j,kcr,w)) * sum((cell(i,j), supreg(h,i)),vm_tau.l(h, "crop") / fm_tau1995(h)); +vm_yld.fx(j,"pasture",w) = sum(ct,(i14_yields_calib(ct,j,"pasture",w)) * sum(cell(i,j), pm_past_mngmnt_factor(ct,i))) * (1 + s14_yld_past_switch * (sum((cell(i,j), supreg(h,i)), pcm_tau(h, "crop") / fm_tau1995(h)) - 1)); diff --git a/modules/14_yields/biocorrect/nl_release.gms b/modules/14_yields/managementcalib_aug19/nl_release.gms similarity index 86% rename from modules/14_yields/biocorrect/nl_release.gms rename to modules/14_yields/managementcalib_aug19/nl_release.gms index d4f67de511..266f0de831 100644 --- a/modules/14_yields/biocorrect/nl_release.gms +++ b/modules/14_yields/managementcalib_aug19/nl_release.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/14_yields/biocorrect/postsolve.gms b/modules/14_yields/managementcalib_aug19/postsolve.gms similarity index 95% rename from modules/14_yields/biocorrect/postsolve.gms rename to modules/14_yields/managementcalib_aug19/postsolve.gms index fa94d52220..8572264573 100644 --- a/modules/14_yields/biocorrect/postsolve.gms +++ b/modules/14_yields/managementcalib_aug19/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,6 +7,7 @@ + *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov_yld(t,j,kve,w,"marginal") = vm_yld.m(j,kve,w); oq14_yield_crop(t,j,kcr,w,"marginal") = q14_yield_crop.m(j,kcr,w); @@ -21,4 +22,3 @@ oq14_yield_crop(t,j,kcr,w,"lower") = q14_yield_crop.lo(j,kcr,w); oq14_yield_past(t,j,w,"lower") = q14_yield_past.lo(j,w); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### - diff --git a/modules/14_yields/managementcalib_aug19/preloop.gms b/modules/14_yields/managementcalib_aug19/preloop.gms new file mode 100644 index 0000000000..b674237a64 --- /dev/null +++ b/modules/14_yields/managementcalib_aug19/preloop.gms @@ -0,0 +1,194 @@ +*** | (C) 2008-2023 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 + +i14_yields_calib(t,j,kve,w) = f14_yields(t,j,kve,w); + +***YIELD CORRECTION FOR 2ND GENERATION BIOENERGY CROPS************************************* +i14_yields_calib(t,j,"begr",w) = f14_yields(t,j,"begr",w) * sum((supreg(h,i),cell(i,j)),fm_tau1995(h))/smax(h,fm_tau1995(h)); +i14_yields_calib(t,j,"betr",w) = f14_yields(t,j,"betr",w) * sum((supreg(h,i),cell(i,j)),fm_tau1995(h))/smax(h,fm_tau1995(h)); + +***YIELD CORRECTION FOR PASTURE ACCOUNTING FOR REGIONAL DIFFERENCES IN MANAGEMENT*** +p14_pyield_LPJ_reg(t,i) = (sum(cell(i,j),i14_yields_calib(t,j,"pasture","rainfed") * pm_land_start(j,"past")) / + sum(cell(i,j),pm_land_start(j,"past")) ); + +p14_pyield_corr(t,i) = (f14_pyld_hist(t,i)/p14_pyield_LPJ_reg(t,i))$(sum(sameas(t_past,t),1) = 1) + + sum(t_past,(f14_pyld_hist(t_past,i)/(p14_pyield_LPJ_reg(t_past,i)+0.000001))$(ord(t_past)=card(t_past)))$(sum(sameas(t_past,t),1) <> 1); +i14_yields_calib(t,j,"pasture",w) = i14_yields_calib(t,j,"pasture",w) * sum(cell(i,j),p14_pyield_corr(t,i)); + + +***YIELD MANAGEMENT CALIBRATION************************************************************ + + +*' @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 +*' '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`) +*' 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 +*' 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 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` +*' 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 +*' 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). + +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 +*' 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: + +i14_modeled_yields_hist(t_past,i,knbe14) + = (sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14) * f14_yields(t_past,j,knbe14,w)) / + sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14)))$(sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14))>0) + + (sum((cell(i,j),w), i14_croparea_total(t_past,w,j) * f14_yields(t_past,j,knbe14,w)) / + 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 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`: + +loop(t, + if(sum(sameas(t,"y1995"),1)=1, + + if ((s14_limit_calib = 0), + i14_lambda_yields(t,i,knbe14) = 1; + + Elseif (s14_limit_calib =1 ), + i14_lambda_yields(t,i,knbe14) = + 1$(f14_fao_yields_hist(t,i,knbe14) <= i14_modeled_yields_hist(t,i,knbe14)) + + sqrt(i14_modeled_yields_hist(t,i,knbe14)/f14_fao_yields_hist(t,i,knbe14))$ + (f14_fao_yields_hist(t,i,knbe14) > i14_modeled_yields_hist(t,i,knbe14)); + ); + + i14_fao_yields_hist(t,i,knbe14) = f14_fao_yields_hist(t,i,knbe14); + + Else + i14_modeled_yields_hist(t,i,knbe14) = i14_modeled_yields_hist(t-1,i,knbe14); + i14_FAO_yields_hist(t,i,knbe14) = i14_fao_yields_hist(t-1,i,knbe14); + i14_lambda_yields(t,i,knbe14) = i14_lambda_yields(t-1,i,knbe14); + ); +); + +*' 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)) / + f14_yields(t,j,knbe14,w) * + (f14_yields(t,j,knbe14,w) / (sum(cell(i,j),i14_modeled_yields_hist(t,i,knbe14))+10**(-8))) ** + sum(cell(i,j),i14_lambda_yields(t,i,knbe14)))$(f14_yields(t,j,knbe14,w)>0); + + +i14_yields_calib(t,j,knbe14,w) = i14_managementcalib(t,j,knbe14,w) * f14_yields(t,j,knbe14,w); +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 + + +***YIELD CALIBRATION*********************************************************************** + +*' @code +*' Calibrated yields are additionally adjusted by calibration factors 'f14_yld_calib' +*' determined in a calibration run. As MAgPIE optimizes yield patterns and FAO regional +*' yields are outlier corrected, historical production and croparea can only be reproduced +*' with this additional step of correction: + +* set default values in case of missing input file +if(sum((i,ltype14),f14_yld_calib(i,ltype14)) = 0, + f14_yld_calib(i,ltype14) = 1; +); + + +i14_yields_calib(t,j,kcr,w) = i14_yields_calib(t,j,kcr,w) *sum(cell(i,j),f14_yld_calib(i,"crop")); +i14_yields_calib(t,j,"pasture",w) = i14_yields_calib(t,j,"pasture",w)*sum(cell(i,j),f14_yld_calib(i,"past")); + +*' @stop + +**** +**** +**** +p14_growing_stock_initial(j,ac,"forestry","plantations") = + ( + pm_carbon_density_ac_forestry("y1995",j,ac,"vegc") + / s14_carbon_fraction + * f14_aboveground_fraction("forestry") + / sum(clcl, pm_climate_class(j,clcl) * f14_ipcc_bce(clcl,"plantations")) + ) + ; + +p14_growing_stock_initial(j,ac,land_natveg,"natveg") = + ( + pm_carbon_density_ac("y1995",j,ac,"vegc") + / s14_carbon_fraction + * f14_aboveground_fraction(land_natveg) + / sum(clcl, pm_climate_class(j,clcl) * f14_ipcc_bce(clcl,"natveg")) + ) + ; +**** Hard constraint to always have a positive number in p14_growing_stock +p14_growing_stock_initial(j,ac,land_natveg,"natveg") = p14_growing_stock_initial(j,ac,land_natveg,"natveg")$(p14_growing_stock_initial(j,ac,land_natveg,"natveg")>0)+0.0001$(p14_growing_stock_initial(j,ac,land_natveg,"natveg")=0); +p14_growing_stock_initial(j,ac,"forestry","plantations") = p14_growing_stock_initial(j,ac,"forestry","plantations")$(p14_growing_stock_initial(j,ac,"forestry","plantations")>0)+0.0001$(p14_growing_stock_initial(j,ac,"forestry","plantations")=0); + +** Used in equations +*************************************************************** +** If the plantation yield switch is on, forestry yields are treated as plantation yields +pm_timber_yield_initial(j,ac,"forestry")$(s14_timber_plantation_yield = 1) = p14_growing_stock_initial(j,ac,"forestry","plantations") ; +** If the plantation yield switch is off, then the forestry yields are given the same values as secdforest yields, +pm_timber_yield_initial(j,ac,"forestry")$(s14_timber_plantation_yield = 0) = pm_timber_yield_initial(j,ac,"secdforest"); +** Natveg yields are unchanged and do not depend on plantation yield switch +pm_timber_yield_initial(j,ac,land_natveg) = p14_growing_stock_initial(j,ac,land_natveg,"natveg"); diff --git a/modules/14_yields/dynamic_aug18/presolve.gms b/modules/14_yields/managementcalib_aug19/presolve.gms similarity index 90% rename from modules/14_yields/dynamic_aug18/presolve.gms rename to modules/14_yields/managementcalib_aug19/presolve.gms index 1c0b478fdd..d2001e34a3 100644 --- a/modules/14_yields/dynamic_aug18/presolve.gms +++ b/modules/14_yields/managementcalib_aug19/presolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -11,10 +11,10 @@ *** YIELDS -*` `pm_carbon_density_ac_forestry` for vegetation Carbon is above + below ground +*` `pm_carbon_density_ac_forestry` for vegetation Carbon is above- and belowground *' carbon density. We convert Carbon density in tC/ha to tDM/ha by using carbon *' fraction of `s14_carbon_fraction` in tC/tDM. For assessing wood harvesting -*' we need only above ground biomass information, therefore we multiply with +*' we need only aboveground biomass information, therefore we multiply with *' aboveground `f14_aboveground_fraction`. Additionally, we divide aboveground *' tree biomass by biomass conversion and expansion (BCE) factor to get stem *' biomass in tDM/ha. @@ -43,9 +43,9 @@ p14_growing_stock(t,j,ac,land_natveg,"natveg") = p14_growing_stock(t,j,ac,land_natveg,"natveg") = p14_growing_stock(t,j,ac,land_natveg,"natveg")$(p14_growing_stock(t,j,ac,land_natveg,"natveg")>0)+0.0001$(p14_growing_stock(t,j,ac,land_natveg,"natveg")=0); p14_growing_stock(t,j,ac,"forestry","plantations") = p14_growing_stock(t,j,ac,"forestry","plantations")$(p14_growing_stock(t,j,ac,"forestry","plantations")>0)+0.0001$(p14_growing_stock(t,j,ac,"forestry","plantations")=0); -** Used in equations +** Used in equations -- Annual value hence division by timestep *************************************************************** -** If the plantation yield switch is on, forestry yields are treated are plantation yields +** If the plantation yield switch is on, forestry yields are treated as plantation yields pm_timber_yield(t,j,ac,"forestry")$(s14_timber_plantation_yield = 1) = p14_growing_stock(t,j,ac,"forestry","plantations") ; ** Natveg yields are unchanged and doesn't depend on plantation yield switch pm_timber_yield(t,j,ac,land_natveg) = p14_growing_stock(t,j,ac,land_natveg,"natveg"); diff --git a/modules/14_yields/managementcalib_aug19/realization.gms b/modules/14_yields/managementcalib_aug19/realization.gms new file mode 100644 index 0000000000..f260b42bce --- /dev/null +++ b/modules/14_yields/managementcalib_aug19/realization.gms @@ -0,0 +1,39 @@ +*** | (C) 2008-2023 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 managementcalib_aug19 realization reads in the LPJmL data and +*' performs a number of calibrations. First, a bioenergy yield correction is performed. +*' As there is currently no robust information on bioenergy yields available in +*' [@FAOSTAT], it is assumed that the LPJmL yields for bioenergy correspond to the +*' 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 +*' realization also calculates the growth stocks in commercial plantations and natural +*' vegetation using LPJmL Carbon stocks. + +*' @limitations The exogenous implementation of pasture intensification cannot +*' capture feedbacks between land scarcity and efforts to improve pasture +*' management. Moreover, the magnitude of spillover effects from technological change +*' in the crop sector towards improvements in pasture management is very uncertain. + + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/14_yields/managementcalib_aug19/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/14_yields/managementcalib_aug19/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/14_yields/managementcalib_aug19/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/14_yields/managementcalib_aug19/equations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/14_yields/managementcalib_aug19/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/14_yields/managementcalib_aug19/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/14_yields/managementcalib_aug19/postsolve.gms" +$Ifi "%phase%" == "nl_fix" $include "./modules/14_yields/managementcalib_aug19/nl_fix.gms" +$Ifi "%phase%" == "nl_release" $include "./modules/14_yields/managementcalib_aug19/nl_release.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/14_yields/managementcalib_aug19/sets.gms b/modules/14_yields/managementcalib_aug19/sets.gms new file mode 100644 index 0000000000..5fac9eba23 --- /dev/null +++ b/modules/14_yields/managementcalib_aug19/sets.gms @@ -0,0 +1,32 @@ +*** | (C) 2008-2023 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 + ltype14 calibration land types + / crop, past / + + k(kall) Primary products + / tece, maiz, trce, rice_pro, soybean, rapeseed, groundnut, sunflower, + oilpalm, puls_pro, potato, cassav_sp, sugr_cane, sugr_beet, others, + foddr, pasture, cottn_pro, begr, betr, livst_rum, livst_pig, + livst_chick, livst_egg, livst_milk, fish, wood, woodfuel/ + + kve(k) Land-use activities + / tece, maiz, trce, rice_pro, soybean, rapeseed, groundnut, sunflower, + oilpalm, puls_pro, potato, cassav_sp, sugr_cane, sugr_beet, others, + foddr, pasture, cottn_pro, begr, betr / + + kcr(kve) Cropping activities + / tece, maiz, trce, rice_pro, soybean, rapeseed, groundnut, sunflower, + oilpalm, puls_pro, potato, cassav_sp, sugr_cane, sugr_beet, others, + foddr, cottn_pro, begr, betr / + + knbe14(kcr) Cropping activities excluding bioenergy plants + / tece, maiz, trce, rice_pro, soybean, rapeseed, groundnut, sunflower, + oilpalm, puls_pro, potato, cassav_sp, sugr_cane, sugr_beet, others, + foddr, cottn_pro / +; diff --git a/modules/14_yields/module.gms b/modules/14_yields/module.gms index 86c34938bc..e2341262dc 100644 --- a/modules/14_yields/module.gms +++ b/modules/14_yields/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -17,15 +17,16 @@ *' [@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]. *' -*' @authors Jan Philipp Dietrich, Isabelle Weindl, Florian Humpenöder, Anne Biewald - +*' @authors Jan Philipp Dietrich, Isabelle Weindl, Florian Humpenöder, +*' Anne Biewald, Kristine Karstens *###################### R SECTION START (MODULETYPES) ########################## -$Ifi "%yields%" == "biocorrect" $include "./modules/14_yields/biocorrect/realization.gms" -$Ifi "%yields%" == "dynamic_aug18" $include "./modules/14_yields/dynamic_aug18/realization.gms" +$Ifi "%yields%" == "managementcalib_aug19" $include "./modules/14_yields/managementcalib_aug19/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ 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..89a8964cf8 --- /dev/null +++ b/modules/15_food/anthro_iso_jun22/declarations.gms @@ -0,0 +1,252 @@ +*** | (C) 2008-2023 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..6cb9c227b4 --- /dev/null +++ b/modules/15_food/anthro_iso_jun22/equations.gms @@ -0,0 +1,207 @@ +*** | (C) 2008-2023 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..ca0b6813d4 --- /dev/null +++ b/modules/15_food/anthro_iso_jun22/exodietmacro.gms @@ -0,0 +1,474 @@ +*** | (C) 2008-2023 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 or s15_exo_diet = 2), + + +*' 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%" == "half_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")/2 + + p15_bmi_shr_calibrated(t,iso,sex,age,"high")/2 + + p15_bmi_shr_calibrated(t,iso,sex,age,"veryhigh")/2 + + p15_bmi_shr_calibrated(t,iso,sex,age,"medium"); + p15_bmi_shr_target(t,iso,sex,age,"mediumhigh")=p15_bmi_shr_calibrated(t,iso,sex,age,"mediumhigh")/2; + p15_bmi_shr_target(t,iso,sex,age,"high")=p15_bmi_shr_calibrated(t,iso,sex,age,"high")/2; + p15_bmi_shr_target(t,iso,sex,age,"veryhigh")=p15_bmi_shr_calibrated(t,iso,sex,age,"veryhigh")/2; + 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_half_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,"verylow") + + p15_bmi_shr_calibrated(t,iso,sex,age,"low") + + p15_bmi_shr_calibrated(t,iso,sex,age,"mediumhigh")/2 + + p15_bmi_shr_calibrated(t,iso,sex,age,"high")/2 + + p15_bmi_shr_calibrated(t,iso,sex,age,"veryhigh")/2 + + 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; + p15_bmi_shr_target(t,iso,sex,age,"mediumhigh")=p15_bmi_shr_calibrated(t,iso,sex,age,"mediumhigh")/2; + p15_bmi_shr_target(t,iso,sex,age,"high")=p15_bmi_shr_calibrated(t,iso,sex,age,"high")/2; + p15_bmi_shr_target(t,iso,sex,age,"veryhigh")=p15_bmi_shr_calibrated(t,iso,sex,age,"veryhigh")/2; + 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); + +*' upper bound for monogastric meat + if (s15_exo_monogastric=1, + i15_intake_detailed_scen_target(t,iso,EAT_monogastrics15)$(i15_intake_detailed_scen_target(t,iso,EAT_monogastrics15) > i15_intake_EATLancet(iso,EAT_monogastrics15)) + = i15_intake_EATLancet(iso,EAT_monogastrics15)); +*' upper bound for ruminant products + if (s15_exo_ruminant=1, + i15_intake_detailed_scen_target(t,iso,EAT_ruminants15)$(i15_intake_detailed_scen_target(t,iso,EAT_ruminants15) > i15_intake_EATLancet(iso,EAT_ruminants15)) + = i15_intake_EATLancet(iso,EAT_ruminants15)); +*' target value for fish + if (s15_exo_fish=1, + i15_intake_detailed_scen_target(t,iso,"fish") = i15_intake_EATLancet(iso,"fish")); +*' lower bound for fruits, veggies, nuts and seeds + if (s15_exo_fruitvegnut=1, + i15_intake_detailed_scen_target(t,iso,EAT_fruitvegnutseed15)$(i15_intake_detailed_scen_target(t,iso,EAT_fruitvegnutseed15) < i15_intake_EATLancet(iso,EAT_fruitvegnutseed15)) + = i15_intake_EATLancet(iso,EAT_fruitvegnutseed15)); +*' lower bound for pulses + if (s15_exo_pulses=1, + i15_intake_detailed_scen_target(t,iso,EAT_pulses15)$(i15_intake_detailed_scen_target(t,iso,EAT_pulses15) < i15_intake_EATLancet(iso,EAT_pulses15)) + = i15_intake_EATLancet(iso,EAT_pulses15)); +*' upper bound for sugar + if (s15_exo_sugar=1, + i15_intake_detailed_scen_target(t,iso,EAT_sugar15)$(i15_intake_detailed_scen_target(t,iso,EAT_sugar15) > i15_intake_EATLancet(iso,EAT_sugar15)) + = i15_intake_EATLancet(iso,EAT_sugar15)); +*' target value for oils + if (s15_exo_oils=1, + i15_intake_detailed_scen_target(t,iso,"oils") = i15_intake_EATLancet(iso,"oils")); +*' target value for brans + if (s15_exo_brans=1, + i15_intake_detailed_scen_target(t,iso,"brans") = i15_intake_EATLancet(iso,"brans")); +*' target value for single cell protein + if (s15_exo_scp=1, + i15_intake_detailed_scen_target(t,iso,"scp") = i15_intake_EATLancet(iso,"scp")); +*' upper bound for alcohol +* alcohol target is not part of EAT Lancet recommendation. Upper boundary is therefore included as specific switch s15_alc_scen + if (s15_exo_alcohol=1, + 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); + + +); +*' End of special postprocessing food demand scenarios. + + +*' 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); + + +* ###### 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); + +*' Demand intake detail + 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..45e9a4493e --- /dev/null +++ b/modules/15_food/anthro_iso_jun22/input.gms @@ -0,0 +1,261 @@ +*** | (C) 2008-2023 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, +* endo, no_underweight, no_overweight +* half_overweight, no_underweight_half_overweight + +$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; + + +**This file contains exogenous dietary recommendations for India and EAT Lancet recommendations for all other regions +**Different set elements for sets "t_scen15", "kcal_scen15" and "EAT_scen15" result in the identical target diet as per f15_intake_EATLancet +table f15_intake_NIN(t_scen15,iso,kcal_scen15,EAT_scen15,kfo) NIN scenarios for food-specific intake (kcal per capita per day) +$ondelim +$include "./modules/15_food/input/f15_intake_NIN_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..da0b5c907c --- /dev/null +++ b/modules/15_food/anthro_iso_jun22/intersolve.gms @@ -0,0 +1,156 @@ +*** | (C) 2008-2023 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..9c28615dab --- /dev/null +++ b/modules/15_food/anthro_iso_jun22/postsolve.gms @@ -0,0 +1,208 @@ +*** | (C) 2008-2023 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..80684940c3 --- /dev/null +++ b/modules/15_food/anthro_iso_jun22/preloop.gms @@ -0,0 +1,98 @@ +*** | (C) 2008-2023 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 + + 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); +*extra condition to see if India diet scenario has been selected + if(s15_exo_diet = 2, + i15_intake_EATLancet_all(iso,kcal_scen15,EAT_scen15,kfo) = f15_intake_NIN("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); + if(s15_exo_diet = 2, + i15_intake_EATLancet_all(iso,kcal_scen15,EAT_scen15,kfo) = f15_intake_NIN("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..2606232578 --- /dev/null +++ b/modules/15_food/anthro_iso_jun22/presolve.gms @@ -0,0 +1,332 @@ +*** | (C) 2008-2023 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..87624010d9 --- /dev/null +++ b/modules/15_food/anthro_iso_jun22/realization.gms @@ -0,0 +1,48 @@ +*** | (C) 2008-2023 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/20_processing/off/scaling.gms b/modules/15_food/anthro_iso_jun22/scaling.gms similarity index 63% rename from modules/20_processing/off/scaling.gms rename to modules/15_food/anthro_iso_jun22/scaling.gms index c3d0169a2c..d302122c32 100644 --- a/modules/20_processing/off/scaling.gms +++ b/modules/15_food/anthro_iso_jun22/scaling.gms @@ -1,9 +1,10 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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; +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..942de46d9e --- /dev/null +++ b/modules/15_food/anthro_iso_jun22/sets.gms @@ -0,0 +1,196 @@ +*** | (C) 2008-2023 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/anthropometrics_jan18/declarations.gms b/modules/15_food/anthropometrics_jan18/declarations.gms index 2fcd05d8b3..22224c44f3 100644 --- a/modules/15_food/anthropometrics_jan18/declarations.gms +++ b/modules/15_food/anthropometrics_jan18/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -110,7 +110,7 @@ parameters i15_rumdairy_scp_fadeout(t,i) Ruminant meat and dairy fadeout share to be replaced by SCP (1) i15_livestock_fadeout_threshold(t,i) Livestock fadeout share for threshold (1) - i15_protein_to_kcal_ratio(t,kfo) protein-to-kcal ratio (g protein per kcal) + 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) @@ -136,12 +136,12 @@ parameters 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_calibrated_orig(t,i,kfo) Auxiliary parameter for per capita food consumption - basis for convergence into waste and diet scenarios (kcal per capita per day) p15_kcal_pc_calibrated_livestock_orig(t,i) Auxiliary parameter for per capita livestock consumption - basis for scenarios of livestock food substitution (kcal per capita per day) - p15_kcal_pc_calibrated_rumdairy_orig(t,i) 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_calibrated_rumdairy_orig(t,i) 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_calibrated_plant_orig(t,i) 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,i,kfo_lp) Auxiliary parameter for livestock kcal structure - basis for scenarios of livestock food substitution (1) p15_rumdairy_kcal_structure_orig(t,i,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,i,kfo_pp) Auxiliary parameter for plant-based food kcal structure - basis for scenarios of livestock food substitution (1) - p15_kcal_pc_livestock_supply_target(i) Target of per capita livestock consumption (kcal per capita per day) + p15_kcal_pc_livestock_supply_target(i) 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_intake_total_iso_calibrated(t,iso) Total food intake in a country (kcal per capita per day) @@ -153,9 +153,10 @@ parameters * transition to exogenous scenario diets i15_intake_scen_target(t,i) Target for total per capita calorie intake according to an exogenous diet scenario (kcal per capita per day) + i15_intake_EATLancet_all(i,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(i,kfo) Food-specific per capita calorie intake according to EAT Lancet diet scenario (kcal per capita per day) i15_intake_detailed_scen_target(t,i,kfo) Target for food-specific per capita calorie intake according to an exogenous diet scenario (kcal per capita per day) - p15_intake_detailed_regr(t,i,kfo) Food-specific per capita calorie intake according to regression-based projections (kcal per capita per day) + p15_intake_detailed_regr(t,i,kfo) Food-specific per capita calorie intake according to regression-based projections (kcal per capita per day) p15_demand2intake_ratio_ref(i) Ratio between food calorie demand and intake for the historical time step of EAT Lancet diets (1) p15_foodwaste_growth(t,i) Increase in food waste over time relative to the historical time step of EAT Lancet diets (1) diff --git a/modules/15_food/anthropometrics_jan18/equations.gms b/modules/15_food/anthropometrics_jan18/equations.gms index 50a63f4bef..6cb9c227b4 100644 --- a/modules/15_food/anthropometrics_jan18/equations.gms +++ b/modules/15_food/anthropometrics_jan18/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/15_food/anthropometrics_jan18/input.gms b/modules/15_food/anthropometrics_jan18/input.gms index f1e60a7abf..cbf8b2f6ac 100644 --- a/modules/15_food/anthropometrics_jan18/input.gms +++ b/modules/15_food/anthropometrics_jan18/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -18,7 +18,8 @@ $setglobal c15_calibscen constant $setglobal c15_rum_share mixed * options: constant, halving2050, mixed -* Food substitution scenarios including functional forms, targets and transition periods +* 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, @@ -30,10 +31,7 @@ $setglobal c15_livescen constant $setglobal c15_rumdairyscen constant $setglobal c15_rumdairy_scp_scen constant $setglobal c15_livescen_target constant - - -$setglobal c15_exo_scen_targetyear y2050 -* options: y2030, y2050 +$setglobal c15_exo_foodscen lin_zero_20_50 $setglobal c15_kcal_scen healthy_BMI * options: healthy_BMI, 2100kcal, 2500kcal @@ -46,34 +44,34 @@ $setglobal c15_EAT_scen FLX * 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 / + 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,livst_milk /; +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 /; @@ -94,9 +92,9 @@ scalar s15_exo_diet Switch for transition towards exogenous diet scenario (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_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_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 /; @@ -240,10 +238,4 @@ $include "./modules/15_food/input/f15_calib_factor_FAOfsupply.cs4" $offdelim /; -table f15_exo_foodscen_fader(t_all,t_scen15) Fader that converges per capita food consumption to an exogenous diet scenario until the target year (1) -$ondelim -$include "./modules/15_food/input/f15_exo_foodscen_fader.csv" -$offdelim -; - *** EOF input.gms *** diff --git a/modules/15_food/anthropometrics_jan18/intersolve.gms b/modules/15_food/anthropometrics_jan18/intersolve.gms index d867f9836c..c980023b73 100644 --- a/modules/15_food/anthropometrics_jan18/intersolve.gms +++ b/modules/15_food/anthropometrics_jan18/intersolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,6 +7,16 @@ 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; + * retrieving interfaces from MAgPIE * calculate prices for providing 1 kcal per day of one commodity @@ -24,26 +34,25 @@ else p15_prices_kcal(t,iso,kfo,curr_iter15)=sum(i_to_iso(i,iso), q15_food_demand.m(i,kfo)); ); -* 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; - display "starting iteration number ", p15_iteration_counter; display "starting m15_food_demand model...."; -solve m15_food_demand USING nlp MAXIMIZING v15_objective ; +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 finished with modelstat "; display p15_modelstat; -if(( p15_modelstat(t)) > 2 and (p15_modelstat(t) ne 7 ), +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."; @@ -67,7 +76,7 @@ if(( p15_modelstat(t)) > 2 and (p15_modelstat(t) ne 7 ), p15_delta_income(t,i,curr_iter15) = p15_income_pc_real_ppp(t,i) / - ( sum(i_to_iso(i,iso), + ( sum(i_to_iso(i,iso), im_gdp_pc_ppp_iso(t,iso) * im_pop_iso(t,iso) ) / sum(i_to_iso(i,iso), @@ -219,8 +228,8 @@ i15_protein_to_kcal_ratio(t,kfo) = f15_nutrition_attributes(t,kfo,"protein")/f1 * 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_calibrated(t,i,"scp") = p15_kcal_pc_calibrated(t,i,"scp") + - sum(kfo_rd, p15_kcal_pc_calibrated(t,i,kfo_rd) * (1-i15_rumdairy_scp_fadeout(t,i)) * - i15_protein_to_kcal_ratio(t,kfo_rd)) / i15_protein_to_kcal_ratio(t,"scp"); + sum(kfo_rd, p15_kcal_pc_calibrated(t,i,kfo_rd) * (1-i15_rumdairy_scp_fadeout(t,i)) * + i15_protein_to_kcal_ratio(t,kfo_rd)) / i15_protein_to_kcal_ratio(t,"scp"); p15_kcal_pc_calibrated(t,i,kfo_rd) = p15_kcal_pc_calibrated(t,i,kfo_rd) * i15_rumdairy_scp_fadeout(t,i); @@ -245,9 +254,9 @@ p15_kcal_pc_calibrated(t,i,kfo_lp) = p15_livestock_kcal_structure_orig(t,i,kfo_l * (p15_kcal_pc_livestock_supply_target(i)*(1-i15_livestock_fadeout_threshold(t,i)) + p15_kcal_pc_calibrated_livestock_orig(t,i)*i15_livestock_fadeout_threshold(t,i)); p15_kcal_pc_calibrated(t,i,kfo_pp) = p15_plant_kcal_structure_orig(t,i,kfo_pp) - * (p15_kcal_pc_calibrated_plant_orig(t,i) - + (p15_kcal_pc_calibrated_livestock_orig(t,i) - - sum(kfo_lp, p15_kcal_pc_calibrated(t,i,kfo_lp))) * s15_livescen_target_subst); + * (p15_kcal_pc_calibrated_plant_orig(t,i) + + (p15_kcal_pc_calibrated_livestock_orig(t,i) - + sum(kfo_lp, p15_kcal_pc_calibrated(t,i,kfo_lp))) * s15_livescen_target_subst); ); @@ -338,14 +347,14 @@ if(s15_exo_diet = 1, * Food-specific calorie intake of the model-internal diet projections is * estimated from daily per capita food calorie demand: p15_intake_detailed_regr(t,i,kfo) = p15_kcal_pc_calibrated(t,i,kfo) - /(f15_calib_fsupply(i)*f15_overcons_FAOwaste(i,kfo)*p15_foodwaste_growth(t,i)); + /(f15_calib_fsupply(i)*f15_overcons_FAOwaste(i,kfo)*p15_foodwaste_growth(t,i)); * Via 's15_alc_scen' a maximum target for alcohol consumption is defined. if(s15_alc_scen>0, i15_intake_detailed_scen_target(t,i,"alcohol") = p15_intake_detailed_regr(t,i,"alcohol"); i15_intake_detailed_scen_target(t,i,"alcohol")$(i15_intake_detailed_scen_target(t,i,"alcohol") > s15_alc_scen*i15_intake_scen_target(t,i)) - = s15_alc_scen*i15_intake_scen_target(t,i); + = s15_alc_scen*i15_intake_scen_target(t,i); ); i15_intake_detailed_scen_target(t,i,EAT_staples) = ( @@ -385,7 +394,7 @@ if(s15_exo_diet = 1, - if (p15_modelstat(t) < 3, + if (p15_modelstat(t) <= 2, put_utility 'shell' / 'mv -f m15_food_demand_p.gdx m15_food_demand_' t.tl:0'.gdx'; ); diff --git a/modules/15_food/anthropometrics_jan18/postsolve.gms b/modules/15_food/anthropometrics_jan18/postsolve.gms index a9d5f18452..b0dbd73353 100644 --- a/modules/15_food/anthropometrics_jan18/postsolve.gms +++ b/modules/15_food/anthropometrics_jan18/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/15_food/anthropometrics_jan18/preloop.gms b/modules/15_food/anthropometrics_jan18/preloop.gms index fa6433c037..00e0fbe2ac 100644 --- a/modules/15_food/anthropometrics_jan18/preloop.gms +++ b/modules/15_food/anthropometrics_jan18/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -42,14 +42,14 @@ $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); + 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; + 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); + i15_milk_share_fadeout_india(t) = f15_milk_share_fadeout_india(t); ); display i15_milk_share_fadeout_india; @@ -81,14 +81,6 @@ p15_country_dummy(scen_countries15) = 1; p15_foodscen_region_shr(t_all,i) = sum(i_to_iso(i,iso), p15_country_dummy(iso) * im_pop_iso(t_all,iso)) / sum(i_to_iso(i,iso), im_pop_iso(t_all,iso)); - -* The target year for transition to exogenous scenario diets defines the speed -* of fading from regression based daily food consumption towards the scenario. -* Note: p15_foodscen_region_shr(t,i) is 1 in the default case) -i15_exo_foodscen_fader(t,i) = f15_exo_foodscen_fader(t,"%c15_exo_scen_targetyear%") * p15_foodscen_region_shr(t,i); - - - * Food substitution scenarios including functional forms, targets and transition periods * Note: p15_foodscen_region_shr(t,i) is 1 in the default case) i15_ruminant_fadeout(t,i) = 1 - p15_foodscen_region_shr(t,i)*(1-f15_food_substitution_fader(t,"%c15_rumscen%")); @@ -100,6 +92,10 @@ i15_rumdairy_scp_fadeout(t,i) = 1 - p15_foodscen_region_shr(t,i)*(1-f15_food_sub i15_livestock_fadeout_threshold(t,i) = 1 - p15_foodscen_region_shr(t,i)*(1-f15_food_substitution_fader(t,"%c15_livescen_target%")); +* Exogenous food intake and waste scenarios including functional forms, targets and transition periods +* Note: p15_foodscen_region_shr(t,i) is 1 in the default case) +i15_exo_foodscen_fader(t,i) = (1-f15_food_substitution_fader(t,"%c15_exo_foodscen%")) * p15_foodscen_region_shr(t,i); + * initial prices in $US per Kcal i15_prices_initial_kcal(iso,kfo)$(f15_nutrition_attributes("y1995",kfo,"kcal")>0) = f15_prices_initial(kfo) diff --git a/modules/15_food/anthropometrics_jan18/presolve.gms b/modules/15_food/anthropometrics_jan18/presolve.gms index 21cb125667..4cb9ed673d 100644 --- a/modules/15_food/anthropometrics_jan18/presolve.gms +++ b/modules/15_food/anthropometrics_jan18/presolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -95,17 +95,17 @@ if (sum(sameas(t_past,t),1) = 1, 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(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; + 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; ); @@ -236,12 +236,22 @@ display "starting demand model for initialisation run...."; 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 ; +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 ), + +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."; @@ -420,13 +430,13 @@ p15_kcal_pc_calibrated(t,i,kfo_pp) = p15_plant_kcal_structure_orig(t,i,kfo_pp) *** 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 +* 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_calibrated(t,i,"scp") = p15_kcal_pc_calibrated(t,i,"scp") + - sum(kfo_rd, p15_kcal_pc_calibrated(t,i,kfo_rd) * (1-i15_rumdairy_scp_fadeout(t,i)) * - i15_protein_to_kcal_ratio(t,kfo_rd)) / i15_protein_to_kcal_ratio(t,"scp"); + sum(kfo_rd, p15_kcal_pc_calibrated(t,i,kfo_rd) * (1-i15_rumdairy_scp_fadeout(t,i)) * + i15_protein_to_kcal_ratio(t,kfo_rd)) / i15_protein_to_kcal_ratio(t,"scp"); p15_kcal_pc_calibrated(t,i,kfo_rd) = p15_kcal_pc_calibrated(t,i,kfo_rd) * i15_rumdairy_scp_fadeout(t,i); @@ -451,9 +461,9 @@ p15_kcal_pc_calibrated(t,i,kfo_lp) = p15_livestock_kcal_structure_orig(t,i,kfo_l * (p15_kcal_pc_livestock_supply_target(i)*(1-i15_livestock_fadeout_threshold(t,i)) + p15_kcal_pc_calibrated_livestock_orig(t,i)*i15_livestock_fadeout_threshold(t,i)); p15_kcal_pc_calibrated(t,i,kfo_pp) = p15_plant_kcal_structure_orig(t,i,kfo_pp) - * (p15_kcal_pc_calibrated_plant_orig(t,i) - + (p15_kcal_pc_calibrated_livestock_orig(t,i) - - sum(kfo_lp, p15_kcal_pc_calibrated(t,i,kfo_lp))) * s15_livescen_target_subst); + * (p15_kcal_pc_calibrated_plant_orig(t,i) + + (p15_kcal_pc_calibrated_livestock_orig(t,i) - + sum(kfo_lp, p15_kcal_pc_calibrated(t,i,kfo_lp))) * s15_livescen_target_subst); ); @@ -545,6 +555,17 @@ p15_foodwaste_growth(t,i) = ( 1$(p15_demand2intake_ratio_ref(i) = 0) if(s15_exo_diet = 1, +* 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(i,kcal_scen15,EAT_scen15,kfo) = f15_intake_EATLancet("y2030",i,kcal_scen15,EAT_scen15,kfo); +$else + i15_intake_EATLancet_all(i,kcal_scen15,EAT_scen15,kfo) = f15_intake_EATLancet("y2050",i,kcal_scen15,EAT_scen15,kfo); +$endif + + + *' 1.) In a first step, the exogenous scenario diets are defined by selecting a *' scenario target for total daily per capita food intake and by choosing *' food-specific dietary patterns: @@ -557,11 +578,11 @@ $ifthen "%c15_kcal_scen%" == "healthy_BMI" sum((sex,age), im_demography(t,iso,sex,age)) ); i15_intake_EATLancet(i,kfo) = - f15_intake_EATLancet("%c15_exo_scen_targetyear%",i,"2100kcal","%c15_EAT_scen%",kfo); + i15_intake_EATLancet_all(i,"2100kcal","%c15_EAT_scen%",kfo); $else i15_intake_EATLancet(i,kfo) = - f15_intake_EATLancet("%c15_exo_scen_targetyear%",i,"%c15_kcal_scen%","%c15_EAT_scen%",kfo); - i15_intake_scen_target(t,i) = sum(kfo,i15_intake_EATLancet(i,kfo)); + i15_intake_EATLancet_all(i,"%c15_kcal_scen%","%c15_EAT_scen%",kfo); + i15_intake_scen_target(t,i) = sum(kfo,i15_intake_EATLancet(i,kfo)); $endif @@ -573,7 +594,7 @@ $endif * Food-specific calorie intake of the model-internal diet projections is * estimated from daily per capita food calorie demand: p15_intake_detailed_regr(t,i,kfo) = p15_kcal_pc_calibrated(t,i,kfo) - /(f15_calib_fsupply(i)*f15_overcons_FAOwaste(i,kfo)*p15_foodwaste_growth(t,i)); + /(f15_calib_fsupply(i)*f15_overcons_FAOwaste(i,kfo)*p15_foodwaste_growth(t,i)); i15_intake_detailed_scen_target(t,i,EAT_nonstaples) = i15_intake_EATLancet(i,EAT_nonstaples); @@ -583,7 +604,7 @@ i15_intake_detailed_scen_target(t,i,EAT_nonstaples) = i15_intake_EATLancet(i,EAT if(s15_alc_scen>0, i15_intake_detailed_scen_target(t,i,"alcohol") = p15_intake_detailed_regr(t,i,"alcohol"); i15_intake_detailed_scen_target(t,i,"alcohol")$(i15_intake_detailed_scen_target(t,i,"alcohol") > s15_alc_scen*i15_intake_scen_target(t,i)) - = s15_alc_scen*i15_intake_scen_target(t,i); + = s15_alc_scen*i15_intake_scen_target(t,i); ); i15_intake_detailed_scen_target(t,i,EAT_staples) = ( diff --git a/modules/15_food/anthropometrics_jan18/realization.gms b/modules/15_food/anthropometrics_jan18/realization.gms index 12cb931a06..b68f69bbf5 100644 --- a/modules/15_food/anthropometrics_jan18/realization.gms +++ b/modules/15_food/anthropometrics_jan18/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/15_food/anthropometrics_jan18/scaling.gms b/modules/15_food/anthropometrics_jan18/scaling.gms index d5413452b0..d302122c32 100644 --- a/modules/15_food/anthropometrics_jan18/scaling.gms +++ b/modules/15_food/anthropometrics_jan18/scaling.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/15_food/anthropometrics_jan18/sets.gms b/modules/15_food/anthropometrics_jan18/sets.gms index 315e8119a6..04a1576e6f 100644 --- a/modules/15_food/anthropometrics_jan18/sets.gms +++ b/modules/15_food/anthropometrics_jan18/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -152,7 +152,7 @@ sets / 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 / + 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 / diff --git a/modules/15_food/input/files b/modules/15_food/input/files index ecde92bbdd..c71a6ff7c9 100644 --- a/modules/15_food/input/files +++ b/modules/15_food/input/files @@ -17,9 +17,11 @@ 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_exo_foodscen_fader.csv +f15_intake_EATLancet_iso.cs3 f15_food_substitution_fader.csv f15_ruminant_fadeout_india.csv f15_milk_fadeout_india.csv f15_bodyheight_regr_paras.cs3 +f15_intake_NIN_iso.cs3 diff --git a/modules/15_food/module.gms b/modules/15_food/module.gms index b87d812084..b228f51668 100644 --- a/modules/15_food/module.gms +++ b/modules/15_food/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -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/16_demand/module.gms b/modules/16_demand/module.gms index 6d63496467..bc0980cd08 100644 --- a/modules/16_demand/module.gms +++ b/modules/16_demand/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/16_demand/sector_may15/declarations.gms b/modules/16_demand/sector_may15/declarations.gms index 8e98938144..01edc515ee 100644 --- a/modules/16_demand/sector_may15/declarations.gms +++ b/modules/16_demand/sector_may15/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/16_demand/sector_may15/equations.gms b/modules/16_demand/sector_may15/equations.gms index 6b3c35dc08..974203a3b4 100644 --- a/modules/16_demand/sector_may15/equations.gms +++ b/modules/16_demand/sector_may15/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/16_demand/sector_may15/input.gms b/modules/16_demand/sector_may15/input.gms index d658101a6d..16b7d251b5 100644 --- a/modules/16_demand/sector_may15/input.gms +++ b/modules/16_demand/sector_may15/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/16_demand/sector_may15/not_used.txt b/modules/16_demand/sector_may15/not_used.txt deleted file mode 100644 index da77c77f60..0000000000 --- a/modules/16_demand/sector_may15/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/16_demand/sector_may15/postsolve.gms b/modules/16_demand/sector_may15/postsolve.gms index 53b9dfe5c4..44a7fc6786 100644 --- a/modules/16_demand/sector_may15/postsolve.gms +++ b/modules/16_demand/sector_may15/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/16_demand/sector_may15/realization.gms b/modules/16_demand/sector_may15/realization.gms index e97497b169..9d1753df63 100644 --- a/modules/16_demand/sector_may15/realization.gms +++ b/modules/16_demand/sector_may15/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/16_demand/sector_may15/sets.gms b/modules/16_demand/sector_may15/sets.gms index b1ae452e46..2fc3950776 100644 --- a/modules/16_demand/sector_may15/sets.gms +++ b/modules/16_demand/sector_may15/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -13,12 +13,6 @@ sets kres(kall) Residues / res_cereals, res_fibrous, res_nonfibrous / - k(kall) Primary products - / tece, maiz, trce, rice_pro, soybean, rapeseed, groundnut, sunflower, - oilpalm, puls_pro, potato, cassav_sp, sugr_cane, sugr_beet, others, - foddr, pasture, cottn_pro, begr, betr, livst_rum, livst_pig, - livst_chick, livst_egg, livst_milk, fish, wood, woodfuel / - kap(k) Animal products / livst_rum,livst_pig,livst_chick, livst_egg, livst_milk, fish @@ -30,15 +24,6 @@ sets kforestry(k) forestry products / wood, woodfuel / - kve(k) Land-use activities - / tece, maiz, trce, rice_pro, soybean, rapeseed, groundnut, sunflower, - oilpalm, puls_pro, potato, cassav_sp, sugr_cane, sugr_beet, others, - foddr, pasture, cottn_pro, begr, betr / - - kcr(kve) Cropping activities - / tece, maiz, trce, rice_pro, soybean, rapeseed, groundnut, sunflower, - oilpalm, puls_pro, potato, cassav_sp, sugr_cane, sugr_beet, others, - foddr, cottn_pro, begr, betr / ; alias(kap,kap4); diff --git a/modules/17_production/flexreg_apr16/declarations.gms b/modules/17_production/flexreg_apr16/declarations.gms index dbf1c4cd41..235855f322 100644 --- a/modules/17_production/flexreg_apr16/declarations.gms +++ b/modules/17_production/flexreg_apr16/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -14,6 +14,10 @@ equations q17_prod_reg(i,k) Regional production (mio. tDM per yr) ; +parameters +pm_prod_init(j,kcr) Production initialization for year 1995 (tDM per yr) +; + *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters ov_prod(t,j,k,type) Production in each cell (mio. tDM per yr) @@ -21,4 +25,3 @@ parameters oq17_prod_reg(t,i,k,type) Regional production (mio. tDM per yr) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### - diff --git a/modules/17_production/flexreg_apr16/equations.gms b/modules/17_production/flexreg_apr16/equations.gms index 996c7aa5a4..6e0b683900 100644 --- a/modules/17_production/flexreg_apr16/equations.gms +++ b/modules/17_production/flexreg_apr16/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/51_nitrogen/ipcc2006_sep16/preloop.gms b/modules/17_production/flexreg_apr16/input.gms similarity index 78% rename from modules/51_nitrogen/ipcc2006_sep16/preloop.gms rename to modules/17_production/flexreg_apr16/input.gms index 5e4788d1a9..e317e37d3c 100644 --- a/modules/51_nitrogen/ipcc2006_sep16/preloop.gms +++ b/modules/17_production/flexreg_apr16/input.gms @@ -1,9 +1,8 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 c17_prod_init on diff --git a/modules/17_production/flexreg_apr16/postsolve.gms b/modules/17_production/flexreg_apr16/postsolve.gms index 8f3c089175..0d8e22852c 100644 --- a/modules/17_production/flexreg_apr16/postsolve.gms +++ b/modules/17_production/flexreg_apr16/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/51_nitrogen/ipcc2006_sep16/presolve.gms b/modules/17_production/flexreg_apr16/presolve.gms similarity index 56% rename from modules/51_nitrogen/ipcc2006_sep16/presolve.gms rename to modules/17_production/flexreg_apr16/presolve.gms index 1d691591ba..09413ece73 100644 --- a/modules/51_nitrogen/ipcc2006_sep16/presolve.gms +++ b/modules/17_production/flexreg_apr16/presolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,6 +6,13 @@ *** | Contact: magpie@pik-potsdam.de - vm_btm_reg.fx(i,emis_source_nonitrogen51,n_pollutants) = 0; -*** EOF solve.gms *** +pm_prod_init(j,kcr)=sum(w,fm_croparea("y1995",j,w,kcr)*pm_yields_semi_calib(j,kcr,w)); + +if (ord(t) = 1, + +$ifthen "%c17_prod_init%" == "on" +vm_prod.l(j,kcr) = pm_prod_init(j,kcr); +$endif + + ); diff --git a/modules/17_production/flexreg_apr16/realization.gms b/modules/17_production/flexreg_apr16/realization.gms index 4109823b4e..5cd048ea68 100644 --- a/modules/17_production/flexreg_apr16/realization.gms +++ b/modules/17_production/flexreg_apr16/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -16,6 +16,8 @@ *####################### R SECTION START (PHASES) ############################## $Ifi "%phase%" == "declarations" $include "./modules/17_production/flexreg_apr16/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/17_production/flexreg_apr16/input.gms" $Ifi "%phase%" == "equations" $include "./modules/17_production/flexreg_apr16/equations.gms" +$Ifi "%phase%" == "presolve" $include "./modules/17_production/flexreg_apr16/presolve.gms" $Ifi "%phase%" == "postsolve" $include "./modules/17_production/flexreg_apr16/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/17_production/module.gms b/modules/17_production/module.gms index 179a3b04d2..b48703a7cd 100644 --- a/modules/17_production/module.gms +++ b/modules/17_production/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/18_residues/flexreg_apr16/declarations.gms b/modules/18_residues/flexreg_apr16/declarations.gms index fd99cd7b4e..426853f7bd 100644 --- a/modules/18_residues/flexreg_apr16/declarations.gms +++ b/modules/18_residues/flexreg_apr16/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -13,6 +13,7 @@ positive variables v18_res_ag_recycling(i,kcr,attributes) Recylcing of crop residues to soils in respective attribute units DM GJ Nr P K WM C (mio. tX) vm_res_ag_burn(i,kcr,attributes) Residues burned on fields in respective attribute units DM GJ Nr P K WM C (mio. tX) vm_res_recycling(i,npk) Residues recycled to croplands in respective nutrients Nr P K units (mio. tX) + vm_cost_prod_kres(i,kres) Production costs of harvesting crop residues (mio. USD05MER per yr) ; equations @@ -42,6 +43,7 @@ parameters ov18_res_ag_recycling(t,i,kcr,attributes,type) Recylcing of crop residues to soils in respective attribute units DM GJ Nr P K WM C (mio. tX) ov_res_ag_burn(t,i,kcr,attributes,type) Residues burned on fields in respective attribute units DM GJ Nr P K WM C (mio. tX) ov_res_recycling(t,i,npk,type) Residues recycled to croplands in respective nutrients Nr P K units (mio. tX) + ov_cost_prod_kres(t,i,kres,type) Production costs of harvesting crop residues (mio. USD05MER per yr) oq18_prod_res_ag_reg(t,i,kcr,attributes,type) Production constraint of aboveground residues (mio. tDM) oq18_prod_res_bg_reg(t,i,kcr,dm_nr,type) Production constraint of belowground residues (mio. tDM) oq18_res_field_balance(t,i,kcr,attributes,type) Calculation of the residues amount recycled to soils (mio. tDM) diff --git a/modules/18_residues/flexreg_apr16/equations.gms b/modules/18_residues/flexreg_apr16/equations.gms index 18db2594e3..2384a6976d 100644 --- a/modules/18_residues/flexreg_apr16/equations.gms +++ b/modules/18_residues/flexreg_apr16/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -15,8 +15,8 @@ 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); + + 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)` @@ -110,9 +110,9 @@ *' and `res_nonfibrous`. q18_cost_prod_res(i2,kres) .. - vm_cost_prod(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..7d2eba21c6 100644 --- a/modules/18_residues/flexreg_apr16/input.gms +++ b/modules/18_residues/flexreg_apr16/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/18_residues/flexreg_apr16/not_used.txt b/modules/18_residues/flexreg_apr16/not_used.txt deleted file mode 100644 index da77c77f60..0000000000 --- a/modules/18_residues/flexreg_apr16/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/18_residues/flexreg_apr16/postsolve.gms b/modules/18_residues/flexreg_apr16/postsolve.gms index 550c1a790c..31c4585f65 100644 --- a/modules/18_residues/flexreg_apr16/postsolve.gms +++ b/modules/18_residues/flexreg_apr16/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -16,6 +16,7 @@ ov18_res_ag_recycling(t,i,kcr,attributes,"marginal") = v18_res_ag_recycling.m(i,kcr,attributes); ov_res_ag_burn(t,i,kcr,attributes,"marginal") = vm_res_ag_burn.m(i,kcr,attributes); ov_res_recycling(t,i,npk,"marginal") = vm_res_recycling.m(i,npk); + ov_cost_prod_kres(t,i,kres,"marginal") = vm_cost_prod_kres.m(i,kres); oq18_prod_res_ag_reg(t,i,kcr,attributes,"marginal") = q18_prod_res_ag_reg.m(i,kcr,attributes); oq18_prod_res_bg_reg(t,i,kcr,dm_nr,"marginal") = q18_prod_res_bg_reg.m(i,kcr,dm_nr); oq18_res_field_balance(t,i,kcr,attributes,"marginal") = q18_res_field_balance.m(i,kcr,attributes); @@ -30,6 +31,7 @@ ov18_res_ag_recycling(t,i,kcr,attributes,"level") = v18_res_ag_recycling.l(i,kcr,attributes); ov_res_ag_burn(t,i,kcr,attributes,"level") = vm_res_ag_burn.l(i,kcr,attributes); ov_res_recycling(t,i,npk,"level") = vm_res_recycling.l(i,npk); + ov_cost_prod_kres(t,i,kres,"level") = vm_cost_prod_kres.l(i,kres); oq18_prod_res_ag_reg(t,i,kcr,attributes,"level") = q18_prod_res_ag_reg.l(i,kcr,attributes); oq18_prod_res_bg_reg(t,i,kcr,dm_nr,"level") = q18_prod_res_bg_reg.l(i,kcr,dm_nr); oq18_res_field_balance(t,i,kcr,attributes,"level") = q18_res_field_balance.l(i,kcr,attributes); @@ -44,6 +46,7 @@ ov18_res_ag_recycling(t,i,kcr,attributes,"upper") = v18_res_ag_recycling.up(i,kcr,attributes); ov_res_ag_burn(t,i,kcr,attributes,"upper") = vm_res_ag_burn.up(i,kcr,attributes); ov_res_recycling(t,i,npk,"upper") = vm_res_recycling.up(i,npk); + ov_cost_prod_kres(t,i,kres,"upper") = vm_cost_prod_kres.up(i,kres); oq18_prod_res_ag_reg(t,i,kcr,attributes,"upper") = q18_prod_res_ag_reg.up(i,kcr,attributes); oq18_prod_res_bg_reg(t,i,kcr,dm_nr,"upper") = q18_prod_res_bg_reg.up(i,kcr,dm_nr); oq18_res_field_balance(t,i,kcr,attributes,"upper") = q18_res_field_balance.up(i,kcr,attributes); @@ -58,6 +61,7 @@ ov18_res_ag_recycling(t,i,kcr,attributes,"lower") = v18_res_ag_recycling.lo(i,kcr,attributes); ov_res_ag_burn(t,i,kcr,attributes,"lower") = vm_res_ag_burn.lo(i,kcr,attributes); ov_res_recycling(t,i,npk,"lower") = vm_res_recycling.lo(i,npk); + ov_cost_prod_kres(t,i,kres,"lower") = vm_cost_prod_kres.lo(i,kres); oq18_prod_res_ag_reg(t,i,kcr,attributes,"lower") = q18_prod_res_ag_reg.lo(i,kcr,attributes); oq18_prod_res_bg_reg(t,i,kcr,dm_nr,"lower") = q18_prod_res_bg_reg.lo(i,kcr,dm_nr); oq18_res_field_balance(t,i,kcr,attributes,"lower") = q18_res_field_balance.lo(i,kcr,attributes); diff --git a/modules/18_residues/flexreg_apr16/preloop.gms b/modules/18_residues/flexreg_apr16/preloop.gms index 4c216c22cf..dd1bb671f2 100644 --- a/modules/18_residues/flexreg_apr16/preloop.gms +++ b/modules/18_residues/flexreg_apr16/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/18_residues/flexreg_apr16/presolve.gms b/modules/18_residues/flexreg_apr16/presolve.gms index 8103da8449..fcc66887d6 100644 --- a/modules/18_residues/flexreg_apr16/presolve.gms +++ b/modules/18_residues/flexreg_apr16/presolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/18_residues/flexreg_apr16/realization.gms b/modules/18_residues/flexreg_apr16/realization.gms index 0e2525a48c..da093cda1d 100644 --- a/modules/18_residues/flexreg_apr16/realization.gms +++ b/modules/18_residues/flexreg_apr16/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -30,6 +30,7 @@ $Ifi "%phase%" == "sets" $include "./modules/18_residues/flexreg_apr16/sets.gms" $Ifi "%phase%" == "declarations" $include "./modules/18_residues/flexreg_apr16/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/18_residues/flexreg_apr16/input.gms" $Ifi "%phase%" == "equations" $include "./modules/18_residues/flexreg_apr16/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/18_residues/flexreg_apr16/scaling.gms" $Ifi "%phase%" == "preloop" $include "./modules/18_residues/flexreg_apr16/preloop.gms" $Ifi "%phase%" == "presolve" $include "./modules/18_residues/flexreg_apr16/presolve.gms" $Ifi "%phase%" == "postsolve" $include "./modules/18_residues/flexreg_apr16/postsolve.gms" diff --git a/modules/38_factor_costs/mixed_feb17/scaling.gms b/modules/18_residues/flexreg_apr16/scaling.gms similarity index 76% rename from modules/38_factor_costs/mixed_feb17/scaling.gms rename to modules/18_residues/flexreg_apr16/scaling.gms index ca13f46c0f..2e8ecb4d44 100644 --- a/modules/38_factor_costs/mixed_feb17/scaling.gms +++ b/modules/18_residues/flexreg_apr16/scaling.gms @@ -1,8 +1,8 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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_prod.scale(i,kall) = 10e4; +vm_cost_prod_kres.scale(i,kres) = 10e3; diff --git a/modules/18_residues/flexreg_apr16/sets.gms b/modules/18_residues/flexreg_apr16/sets.gms index a439f79040..428ccd5dbf 100644 --- a/modules/18_residues/flexreg_apr16/sets.gms +++ b/modules/18_residues/flexreg_apr16/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/18_residues/module.gms b/modules/18_residues/module.gms index b1b28f9553..3ef463f67b 100644 --- a/modules/18_residues/module.gms +++ b/modules/18_residues/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/18_residues/off/declarations.gms b/modules/18_residues/off/declarations.gms index 6b0c479ed7..f5e40bb190 100644 --- a/modules/18_residues/off/declarations.gms +++ b/modules/18_residues/off/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -8,8 +8,10 @@ positive variables vm_res_biomass_ag(i,kcr,attributes) production of aboveground residues in each region (mio. tDM) - vm_res_biomass_bg(i,kcr,dm_nr) production of belowground residues in each region (mio. tDM) - vm_res_recycling(i,npk) residues recycled to croplands (mio tons nutrients) + vm_res_biomass_bg(i,kcr,dm_nr) production of belowground residues in each region (mio. tDM) + vm_res_recycling(i,npk) residues recycled to croplands (mio tons nutrients) + vm_res_ag_burn(i,kcr,attributes) Residues burned on fields in respective attribute units DM GJ Nr P K WM C (mio. tX) + vm_cost_prod_kres(i,kres) Production costs of harvesting crop residues (mio. USD05MER per yr) ; @@ -18,6 +20,8 @@ parameters ov_res_biomass_ag(t,i,kcr,attributes,type) production of aboveground residues in each region (mio. tDM) ov_res_biomass_bg(t,i,kcr,dm_nr,type) production of belowground residues in each region (mio. tDM) ov_res_recycling(t,i,npk,type) residues recycled to croplands (mio tons nutrients) + ov_res_ag_burn(t,i,kcr,attributes,type) Residues burned on fields in respective attribute units DM GJ Nr P K WM C (mio. tX) + ov_cost_prod_kres(t,i,kres,type) Production costs of harvesting crop residues (mio. USD05MER per yr) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/38_factor_costs/fixed_per_ton_mar18/input.gms b/modules/18_residues/off/input.gms similarity index 56% rename from modules/38_factor_costs/fixed_per_ton_mar18/input.gms rename to modules/18_residues/off/input.gms index b71b374e19..a1d3ac1977 100644 --- a/modules/38_factor_costs/fixed_per_ton_mar18/input.gms +++ b/modules/18_residues/off/input.gms @@ -1,15 +1,13 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 - - -parameter f38_fac_req_per_ton(kcr) Factor requirement costs (USD05MER per tDM) -/ +table f18_multicropping(t_all,i) Multicropping indicator as ratio of area harvested by physical area (1) $ondelim -$include "./modules/38_factor_costs/input/f38_fac_req_per_ton.csv" -$offdelim -/; +$include "./modules/18_residues/input/f18_multicropping.csv" +$offdelim; + +*** EOF input.gms *** diff --git a/modules/18_residues/off/not_used.txt b/modules/18_residues/off/not_used.txt index 06eefbffe8..90acf4b328 100644 --- a/modules/18_residues/off/not_used.txt +++ b/modules/18_residues/off/not_used.txt @@ -1,13 +1,5 @@ -# | (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 im_development_state,input,questionnaire fm_attributes,input,questionnaire vm_prod_reg,input,questionnaire vm_area,input,questionnaire -vm_cost_prod,input,questionnaire diff --git a/modules/18_residues/off/postsolve.gms b/modules/18_residues/off/postsolve.gms index c77ae1dbf3..57e8d66e89 100644 --- a/modules/18_residues/off/postsolve.gms +++ b/modules/18_residues/off/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -9,13 +9,21 @@ ov_res_biomass_ag(t,i,kcr,attributes,"marginal") = vm_res_biomass_ag.m(i,kcr,attributes); ov_res_biomass_bg(t,i,kcr,dm_nr,"marginal") = vm_res_biomass_bg.m(i,kcr,dm_nr); ov_res_recycling(t,i,npk,"marginal") = vm_res_recycling.m(i,npk); + ov_res_ag_burn(t,i,kcr,attributes,"marginal") = vm_res_ag_burn.m(i,kcr,attributes); + ov_cost_prod_kres(t,i,kres,"marginal") = vm_cost_prod_kres.m(i,kres); ov_res_biomass_ag(t,i,kcr,attributes,"level") = vm_res_biomass_ag.l(i,kcr,attributes); ov_res_biomass_bg(t,i,kcr,dm_nr,"level") = vm_res_biomass_bg.l(i,kcr,dm_nr); ov_res_recycling(t,i,npk,"level") = vm_res_recycling.l(i,npk); + ov_res_ag_burn(t,i,kcr,attributes,"level") = vm_res_ag_burn.l(i,kcr,attributes); + ov_cost_prod_kres(t,i,kres,"level") = vm_cost_prod_kres.l(i,kres); ov_res_biomass_ag(t,i,kcr,attributes,"upper") = vm_res_biomass_ag.up(i,kcr,attributes); ov_res_biomass_bg(t,i,kcr,dm_nr,"upper") = vm_res_biomass_bg.up(i,kcr,dm_nr); ov_res_recycling(t,i,npk,"upper") = vm_res_recycling.up(i,npk); + ov_res_ag_burn(t,i,kcr,attributes,"upper") = vm_res_ag_burn.up(i,kcr,attributes); + ov_cost_prod_kres(t,i,kres,"upper") = vm_cost_prod_kres.up(i,kres); ov_res_biomass_ag(t,i,kcr,attributes,"lower") = vm_res_biomass_ag.lo(i,kcr,attributes); ov_res_biomass_bg(t,i,kcr,dm_nr,"lower") = vm_res_biomass_bg.lo(i,kcr,dm_nr); ov_res_recycling(t,i,npk,"lower") = vm_res_recycling.lo(i,npk); + ov_res_ag_burn(t,i,kcr,attributes,"lower") = vm_res_ag_burn.lo(i,kcr,attributes); + ov_cost_prod_kres(t,i,kres,"lower") = vm_cost_prod_kres.lo(i,kres); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/18_residues/off/preloop.gms b/modules/18_residues/off/preloop.gms index 1dff22a1da..e08cc17960 100644 --- a/modules/18_residues/off/preloop.gms +++ b/modules/18_residues/off/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -10,4 +10,5 @@ vm_res_biomass_ag.fx(i,kcr,attributes) = 0; vm_res_biomass_bg.fx(i,kcr,dm_nr) = 0; vm_res_recycling.fx(i,npk) = 0; -vm_res_ag_burn.fx(i,kcr,attributes) = 0; \ No newline at end of file +vm_res_ag_burn.fx(i,kcr,attributes) = 0; +vm_cost_prod_kres.fx(i,kres) = 0; diff --git a/modules/18_residues/off/realization.gms b/modules/18_residues/off/realization.gms index c8dfe3e893..54c2183ab3 100644 --- a/modules/18_residues/off/realization.gms +++ b/modules/18_residues/off/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -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/18_residues/off/sets.gms b/modules/18_residues/off/sets.gms index 69c1f2ceed..50fb41c7f1 100644 --- a/modules/18_residues/off/sets.gms +++ b/modules/18_residues/off/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/20_processing/module.gms b/modules/20_processing/module.gms index 3e714b4170..bb7062d8c4 100644 --- a/modules/20_processing/module.gms +++ b/modules/20_processing/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -15,6 +15,5 @@ *###################### R SECTION START (MODULETYPES) ########################## -$Ifi "%processing%" == "off" $include "./modules/20_processing/off/realization.gms" -$Ifi "%processing%" == "substitution_dec18" $include "./modules/20_processing/substitution_dec18/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/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/20_processing/substitution_dec18/not_used.txt b/modules/20_processing/substitution_dec18/not_used.txt deleted file mode 100644 index da77c77f60..0000000000 --- a/modules/20_processing/substitution_dec18/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/20_processing/substitution_dec18/declarations.gms b/modules/20_processing/substitution_may21/declarations.gms similarity index 91% rename from modules/20_processing/substitution_dec18/declarations.gms rename to modules/20_processing/substitution_may21/declarations.gms index bcb470b13a..f1180bba78 100644 --- a/modules/20_processing/substitution_dec18/declarations.gms +++ b/modules/20_processing/substitution_may21/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,9 +6,9 @@ *** | Contact: magpie@pik-potsdam.de parameters - i20_processing_shares(t_all,i,ksd,kpr) Shares of secondary products coming from a primary product (1) + i20_processing_shares(t_all,i,ksd,kpr) Shares of secondary products coming from a primary product (1) i20_processing_conversion_factors(t_all,processing20,ksd,kpr) Conversion factors of primary products into secondary products (1) - i20_processing_unitcosts(ksd,kpr) Costs of transforming x units kpr into 1 unit ksd (USD05MER per tDM) + i20_processing_unitcosts(ksd,kpr) Costs of transforming x units kpr into 1 unit ksd (USD05MER per tDM) ; @@ -25,7 +25,7 @@ variables ; equations - q20_processing(i,kpr,ksd) Processing equation (mio. tDM per yr) + q20_processing(i,kpr,ksd) Processing equation (mio. tDM per yr) q20_processing_aggregation_nocereals(i,kpr) Connecting processing activity to processing flows (mio. tDM per yr) q20_processing_aggregation_cereals(i,kcereals20) Connecting processing activity to food use for milling (mio. tDM per yr) q20_processing_aggregation_cotton(i) Connecting processing activity to production for cotton ginning (mio. tDM per yr) diff --git a/modules/20_processing/substitution_dec18/equations.gms b/modules/20_processing/substitution_may21/equations.gms similarity index 97% rename from modules/20_processing/substitution_dec18/equations.gms rename to modules/20_processing/substitution_may21/equations.gms index 3fce65606b..49b2e5f359 100644 --- a/modules/20_processing/substitution_dec18/equations.gms +++ b/modules/20_processing/substitution_may21/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,7 +6,7 @@ *** | Contact: magpie@pik-potsdam.de *' @equations -*' The series of equations below show the aggregation of secondary products from +*' The series of equations below show the aggregation of secondary products *' from non-cereals (through alcohol fermentation, single cell protein breeding, *' oil extracting, sugar refining or ethanol distilling processes), *' cereals (through milling process), and cotton (through ginning process). @@ -138,5 +138,5 @@ q20_substitution_utility_loss(i2) .. * 200 ) + sum((ksd,processing20,kpr), v20_dem_processing(i2,processing20,kpr) - *sum(ct,i20_processing_conversion_factors(ct,processing20,ksd,kpr)) - * (f20_quality_cost(ksd,kpr)+f20_calibration(ksd,kpr))); + * sum(ct,i20_processing_conversion_factors(ct,processing20,ksd,kpr)) + * f20_quality_cost(ksd,kpr)); diff --git a/modules/20_processing/substitution_dec18/input.gms b/modules/20_processing/substitution_may21/input.gms similarity index 84% rename from modules/20_processing/substitution_dec18/input.gms rename to modules/20_processing/substitution_may21/input.gms index 4ee9d9df56..a4d97fa3b9 100644 --- a/modules/20_processing/substitution_dec18/input.gms +++ b/modules/20_processing/substitution_may21/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -29,12 +29,7 @@ $offdelim ; table f20_quality_cost(ksd,kpr) Costs for difference in quality between secondary products from diverging origins (USD per tDM) $ondelim -$include "./modules/20_processing/substitution_dec18/input/f20_quality_cost.cs3" -$offdelim ; - -table f20_calibration(ksd,kpr) Additional calibration costs to avoid substitution in historical period (USD05 per tDM) -$ondelim -$include "./modules/20_processing/substitution_dec18/input/f20_calibration.cs3" +$include "./modules/20_processing/substitution_may21/input/f20_quality_cost.cs3" $offdelim ; table f20_scp_type_shr(scptype,scen20) selected scenario values for scp type (1) diff --git a/modules/20_processing/substitution_dec18/input/files b/modules/20_processing/substitution_may21/input/files similarity index 75% rename from modules/20_processing/substitution_dec18/input/files rename to modules/20_processing/substitution_may21/input/files index 6b280b1420..9e6ed21b06 100644 --- a/modules/20_processing/substitution_dec18/input/files +++ b/modules/20_processing/substitution_may21/input/files @@ -1,3 +1,2 @@ * list of files that are required here f20_quality_cost.cs3 -f20_calibration.cs3 diff --git a/modules/20_processing/substitution_dec18/postsolve.gms b/modules/20_processing/substitution_may21/postsolve.gms similarity index 99% rename from modules/20_processing/substitution_dec18/postsolve.gms rename to modules/20_processing/substitution_may21/postsolve.gms index f6179bac21..400f7a3639 100644 --- a/modules/20_processing/substitution_dec18/postsolve.gms +++ b/modules/20_processing/substitution_may21/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/20_processing/substitution_dec18/preloop.gms b/modules/20_processing/substitution_may21/preloop.gms similarity index 95% rename from modules/20_processing/substitution_dec18/preloop.gms rename to modules/20_processing/substitution_may21/preloop.gms index 17087c32a1..8d47b6cf62 100644 --- a/modules/20_processing/substitution_dec18/preloop.gms +++ b/modules/20_processing/substitution_may21/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/20_processing/substitution_dec18/presolve.gms b/modules/20_processing/substitution_may21/presolve.gms similarity index 92% rename from modules/20_processing/substitution_dec18/presolve.gms rename to modules/20_processing/substitution_may21/presolve.gms index fd11e486f0..28b39775d6 100644 --- a/modules/20_processing/substitution_dec18/presolve.gms +++ b/modules/20_processing/substitution_may21/presolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/20_processing/substitution_dec18/realization.gms b/modules/20_processing/substitution_may21/realization.gms similarity index 63% rename from modules/20_processing/substitution_dec18/realization.gms rename to modules/20_processing/substitution_may21/realization.gms index d78089858e..eceb1a3056 100644 --- a/modules/20_processing/substitution_dec18/realization.gms +++ b/modules/20_processing/substitution_may21/realization.gms @@ -1,17 +1,22 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 realization substitution_may21 excludes the calibration factors that are used in substitution_dec18 in order to reduce the substitution of oils by other oils. +*' +*' @authors Benjamin Leon Bodirsky, Florian Humpenöder, Edna Molina Bacca + *####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/20_processing/substitution_dec18/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/20_processing/substitution_dec18/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/20_processing/substitution_dec18/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/20_processing/substitution_dec18/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/20_processing/substitution_dec18/scaling.gms" -$Ifi "%phase%" == "preloop" $include "./modules/20_processing/substitution_dec18/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/20_processing/substitution_dec18/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/20_processing/substitution_dec18/postsolve.gms" +$Ifi "%phase%" == "sets" $include "./modules/20_processing/substitution_may21/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/20_processing/substitution_may21/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/20_processing/substitution_may21/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/20_processing/substitution_may21/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/20_processing/substitution_may21/scaling.gms" +$Ifi "%phase%" == "preloop" $include "./modules/20_processing/substitution_may21/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/20_processing/substitution_may21/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/20_processing/substitution_may21/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/20_processing/substitution_dec18/scaling.gms b/modules/20_processing/substitution_may21/scaling.gms similarity index 86% rename from modules/20_processing/substitution_dec18/scaling.gms rename to modules/20_processing/substitution_may21/scaling.gms index e0e81b8e8a..1fabb75910 100644 --- a/modules/20_processing/substitution_dec18/scaling.gms +++ b/modules/20_processing/substitution_may21/scaling.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/20_processing/substitution_dec18/sets.gms b/modules/20_processing/substitution_may21/sets.gms similarity index 96% rename from modules/20_processing/substitution_dec18/sets.gms rename to modules/20_processing/substitution_may21/sets.gms index 5fe33cc5ff..a4811db385 100644 --- a/modules/20_processing/substitution_dec18/sets.gms +++ b/modules/20_processing/substitution_may21/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/21_trade/exo/declarations.gms b/modules/21_trade/exo/declarations.gms index 96adbe284a..cc3443bdf8 100644 --- a/modules/21_trade/exo/declarations.gms +++ b/modules/21_trade/exo/declarations.gms @@ -1,26 +1,28 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 - +parameters +pm_selfsuff_ext(t_ext,h,kforestry) Self sufficiency for timber products in extended time frame (1) +; positive variables - vm_cost_trade(i) Regional trade costs (mio. USD05MER per yr) - v21_manna_from_heaven(i,kall) Last resort resource for otherwise infeasble trade balance constraints (mio. tDM per yr) + vm_cost_trade(i) Regional trade costs (mio. USD05MER per yr) + v21_manna_from_heaven(h,kall) Last resort resource for otherwise infeasible trade balance constraints (mio. tDM per yr) ; equations - q21_notrade(i,kall) Regional production constraint of non-tradable commodities (mio. tDM per yr) - q21_cost_trade(i) Regional trade costs (mio. USD05MER per yr) + q21_notrade(h,kall) Superregional production constraint of non-tradable commodities (mio. tDM per yr) + q21_cost_trade(h) Superregional trade costs (mio. USD05MER per yr) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters ov_cost_trade(t,i,type) Regional trade costs (mio. USD05MER per yr) - ov21_manna_from_heaven(t,i,kall,type) Last resort resource for otherwise infeasble trade balance constraints (mio. tDM per yr) - oq21_notrade(t,i,kall,type) Regional production constraint of non-tradable commodities (mio. tDM per yr) - oq21_cost_trade(t,i,type) Regional trade costs (mio. USD05MER per yr) + ov21_manna_from_heaven(t,h,kall,type) Last resort resource for otherwise infeasible trade balance constraints (mio. tDM per yr) + oq21_notrade(t,h,kall,type) Superregional production constraint of non-tradable commodities (mio. tDM per yr) + oq21_cost_trade(t,h,type) Superregional trade costs (mio. USD05MER per yr) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/21_trade/exo/equations.gms b/modules/21_trade/exo/equations.gms index 0fed207449..02477ae315 100644 --- a/modules/21_trade/exo/equations.gms +++ b/modules/21_trade/exo/equations.gms @@ -1,11 +1,14 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 - q21_notrade(i2,kall).. vm_prod_reg(i2,kall) =g= vm_supply(i2,kall) + sum(ct,f21_trade_balance(ct,i2,kall)) - v21_manna_from_heaven(i2,kall); +q21_notrade(h2,kall).. + sum(supreg(h2,i2),vm_prod_reg(i2,kall)) =g= sum(supreg(h2,i2), vm_supply(i2,kall)) + + sum(ct,f21_trade_balance(ct,h2,kall)) - v21_manna_from_heaven(h2,kall); + *' The regional production must be bigger than the regional demand plus exports *' from that region (or minus imports in case of a negative trade balance). As @@ -15,7 +18,8 @@ *' unlimited, but heavily expensive resource which can be used as last resort, *' if in any other case the model would become infeasible. - q21_cost_trade(i2).. vm_cost_trade(i2) =e= 10**6 * sum(kall,v21_manna_from_heaven(i2,kall)); +q21_cost_trade(h2).. sum(supreg(h2,i2),vm_cost_trade(i2)) =e= + 10**6 * sum(kall,v21_manna_from_heaven(h2,kall)); *' After each run trade costs `vm_cost_trade` as well as `v21_manna_from_heaven` *' should be checked for non-zero values as these will indicate inconsistencies diff --git a/modules/21_trade/exo/input.gms b/modules/21_trade/exo/input.gms index bc1fd1ae8d..536c1dc76b 100644 --- a/modules/21_trade/exo/input.gms +++ b/modules/21_trade/exo/input.gms @@ -1,11 +1,16 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 f21_trade_balance(t_all,i,kall) trade balance of positive exports and negative imports (mio. tDM per yr) +table f21_trade_balance(t_all,h,kall) trade balance of positive exports and negative imports (mio. tDM per yr) $ondelim $include "./modules/21_trade/input/f21_trade_balance.cs3" $offdelim; + +table f21_self_suff(t_all,h,kall) Superregional self-sufficiency rates (1) +$ondelim +$include "./modules/21_trade/input/f21_trade_self_suff.cs3" +$offdelim; diff --git a/modules/21_trade/exo/not_used.txt b/modules/21_trade/exo/not_used.txt deleted file mode 100644 index 22d6e682e4..0000000000 --- a/modules/21_trade/exo/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 -pm_selfsuff_ext, parameter, not used diff --git a/modules/21_trade/exo/postsolve.gms b/modules/21_trade/exo/postsolve.gms index 5ee3525a2d..11d3766fc9 100644 --- a/modules/21_trade/exo/postsolve.gms +++ b/modules/21_trade/exo/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -8,19 +8,19 @@ *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov_cost_trade(t,i,"marginal") = vm_cost_trade.m(i); - ov21_manna_from_heaven(t,i,kall,"marginal") = v21_manna_from_heaven.m(i,kall); - oq21_notrade(t,i,kall,"marginal") = q21_notrade.m(i,kall); - oq21_cost_trade(t,i,"marginal") = q21_cost_trade.m(i); + ov21_manna_from_heaven(t,h,kall,"marginal") = v21_manna_from_heaven.m(h,kall); + oq21_notrade(t,h,kall,"marginal") = q21_notrade.m(h,kall); + oq21_cost_trade(t,h,"marginal") = q21_cost_trade.m(h); ov_cost_trade(t,i,"level") = vm_cost_trade.l(i); - ov21_manna_from_heaven(t,i,kall,"level") = v21_manna_from_heaven.l(i,kall); - oq21_notrade(t,i,kall,"level") = q21_notrade.l(i,kall); - oq21_cost_trade(t,i,"level") = q21_cost_trade.l(i); + ov21_manna_from_heaven(t,h,kall,"level") = v21_manna_from_heaven.l(h,kall); + oq21_notrade(t,h,kall,"level") = q21_notrade.l(h,kall); + oq21_cost_trade(t,h,"level") = q21_cost_trade.l(h); ov_cost_trade(t,i,"upper") = vm_cost_trade.up(i); - ov21_manna_from_heaven(t,i,kall,"upper") = v21_manna_from_heaven.up(i,kall); - oq21_notrade(t,i,kall,"upper") = q21_notrade.up(i,kall); - oq21_cost_trade(t,i,"upper") = q21_cost_trade.up(i); + ov21_manna_from_heaven(t,h,kall,"upper") = v21_manna_from_heaven.up(h,kall); + oq21_notrade(t,h,kall,"upper") = q21_notrade.up(h,kall); + oq21_cost_trade(t,h,"upper") = q21_cost_trade.up(h); ov_cost_trade(t,i,"lower") = vm_cost_trade.lo(i); - ov21_manna_from_heaven(t,i,kall,"lower") = v21_manna_from_heaven.lo(i,kall); - oq21_notrade(t,i,kall,"lower") = q21_notrade.lo(i,kall); - oq21_cost_trade(t,i,"lower") = q21_cost_trade.lo(i); + ov21_manna_from_heaven(t,h,kall,"lower") = v21_manna_from_heaven.lo(h,kall); + oq21_notrade(t,h,kall,"lower") = q21_notrade.lo(h,kall); + oq21_cost_trade(t,h,"lower") = q21_cost_trade.lo(h); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/39_landconversion/global_static_aug18/preloop.gms b/modules/21_trade/exo/preloop.gms similarity index 53% rename from modules/39_landconversion/global_static_aug18/preloop.gms rename to modules/21_trade/exo/preloop.gms index 799e4ddb34..29b3f14108 100644 --- a/modules/39_landconversion/global_static_aug18/preloop.gms +++ b/modules/21_trade/exo/preloop.gms @@ -1,12 +1,10 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -i39_cost_establish(land) = 0; -i39_cost_establish(land_establish39) = s39_cost_establish; - -i39_cost_clearing(land) = 0; -i39_cost_clearing(land_clearing39) = s39_cost_clearing; +** Save self sufficiency values as a interface parameter needed in forestry module +pm_selfsuff_ext(t_ext,h,kforestry) = f21_self_suff("y2150",h,kforestry); +pm_selfsuff_ext(t_all,h,kforestry) = f21_self_suff(t_all,h,kforestry); diff --git a/modules/21_trade/exo/realization.gms b/modules/21_trade/exo/realization.gms index be5a913cb5..30541f9319 100644 --- a/modules/21_trade/exo/realization.gms +++ b/modules/21_trade/exo/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -17,5 +17,7 @@ $Ifi "%phase%" == "declarations" $include "./modules/21_trade/exo/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/21_trade/exo/input.gms" $Ifi "%phase%" == "equations" $include "./modules/21_trade/exo/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/21_trade/exo/scaling.gms" +$Ifi "%phase%" == "preloop" $include "./modules/21_trade/exo/preloop.gms" $Ifi "%phase%" == "postsolve" $include "./modules/21_trade/exo/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/51_nitrogen/ipcc2006_sep16/scaling.gms b/modules/21_trade/exo/scaling.gms similarity index 77% rename from modules/51_nitrogen/ipcc2006_sep16/scaling.gms rename to modules/21_trade/exo/scaling.gms index e06a29124a..18ecf3f022 100644 --- a/modules/51_nitrogen/ipcc2006_sep16/scaling.gms +++ b/modules/21_trade/exo/scaling.gms @@ -1,8 +1,8 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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_trade.scale(i) = 10e4; diff --git a/modules/21_trade/free_apr16/declarations.gms b/modules/21_trade/free_apr16/declarations.gms index 7ceac12e79..3f06ea91d3 100644 --- a/modules/21_trade/free_apr16/declarations.gms +++ b/modules/21_trade/free_apr16/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,9 +7,9 @@ parameters i21_trade_bal_reduction(t_all,k_trade) Trade balance reduction (1) - i21_trade_margin(i,k_trade) Trade margins (USD05MER per tDM) - i21_trade_tariff(i,k_trade) Trade tariffs (USD05MER per tDM) - pm_selfsuff_ext(t_ext,i,kforestry) Self sufficiency for timber products in extended time frame (1) + i21_trade_margin(h,k_trade) Trade margins (USD05MER per tDM) + i21_trade_tariff(h,k_trade) Trade tariffs (USD05MER per tDM) + pm_selfsuff_ext(t_ext,h,kforestry) Self sufficiency for timber products in extended time frame (1) ; positive variables @@ -18,13 +18,13 @@ positive variables equations q21_trade_glo(k_trade) Global production constraint (mio. tDM per yr) - q21_notrade(i,k_notrade) Regional production constraint of non-tradable commodities (mio. tDM per yr) + q21_notrade(h,k_notrade) Superregional production constraint of non-tradable commodities (mio. tDM per yr) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters ov_cost_trade(t,i,type) Regional trade costs (mio. USD05MER per yr) oq21_trade_glo(t,k_trade,type) Global production constraint (mio. tDM per yr) - oq21_notrade(t,i,k_notrade,type) Regional production constraint of non-tradable commodities (mio. tDM per yr) + oq21_notrade(t,h,k_notrade,type) Superregional production constraint of non-tradable commodities (mio. tDM per yr) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/21_trade/free_apr16/equations.gms b/modules/21_trade/free_apr16/equations.gms index dc21f9464e..72b49f63bc 100644 --- a/modules/21_trade/free_apr16/equations.gms +++ b/modules/21_trade/free_apr16/equations.gms @@ -1,10 +1,18 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 - q21_trade_glo(k_trade).. sum(i2 ,vm_prod_reg(i2,k_trade)) =g= sum(i2, vm_supply(i2,k_trade)); +*' @equations +*' For traded goods the only active constraint is that the global supply is larger or equal to demand. +*' This means that production can be freely allocated globally based on comparative advantages. - q21_notrade(i2,k_notrade).. vm_prod_reg(i2,k_notrade) =g= vm_supply(i2,k_notrade); +q21_trade_glo(k_trade).. sum(i2 ,vm_prod_reg(i2,k_trade)) =g= sum(i2, vm_supply(i2,k_trade)); + +*' +*' For non-tradable commodites, the regional supply should be larger or equal to the regional demand. + + q21_notrade(h2,k_notrade).. + sum(supreg(h2,i2),vm_prod_reg(i2,k_notrade)) =g= sum(supreg(h2,i2), vm_supply(i2,k_notrade)); diff --git a/modules/21_trade/free_apr16/input.gms b/modules/21_trade/free_apr16/input.gms index 072ef158e5..9e695e7f41 100644 --- a/modules/21_trade/free_apr16/input.gms +++ b/modules/21_trade/free_apr16/input.gms @@ -1,11 +1,11 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 f21_self_suff(t_all,i,kall) Regional self-sufficiency rates (1) +table f21_self_suff(t_all,h,kall) Superregional self-sufficiency rates (1) $ondelim $include "./modules/21_trade/input/f21_trade_self_suff.cs3" $offdelim; diff --git a/modules/21_trade/free_apr16/postsolve.gms b/modules/21_trade/free_apr16/postsolve.gms index a19e88a578..601fd3823e 100644 --- a/modules/21_trade/free_apr16/postsolve.gms +++ b/modules/21_trade/free_apr16/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -9,14 +9,14 @@ *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov_cost_trade(t,i,"marginal") = vm_cost_trade.m(i); oq21_trade_glo(t,k_trade,"marginal") = q21_trade_glo.m(k_trade); - oq21_notrade(t,i,k_notrade,"marginal") = q21_notrade.m(i,k_notrade); + oq21_notrade(t,h,k_notrade,"marginal") = q21_notrade.m(h,k_notrade); ov_cost_trade(t,i,"level") = vm_cost_trade.l(i); oq21_trade_glo(t,k_trade,"level") = q21_trade_glo.l(k_trade); - oq21_notrade(t,i,k_notrade,"level") = q21_notrade.l(i,k_notrade); + oq21_notrade(t,h,k_notrade,"level") = q21_notrade.l(h,k_notrade); ov_cost_trade(t,i,"upper") = vm_cost_trade.up(i); oq21_trade_glo(t,k_trade,"upper") = q21_trade_glo.up(k_trade); - oq21_notrade(t,i,k_notrade,"upper") = q21_notrade.up(i,k_notrade); + oq21_notrade(t,h,k_notrade,"upper") = q21_notrade.up(h,k_notrade); ov_cost_trade(t,i,"lower") = vm_cost_trade.lo(i); oq21_trade_glo(t,k_trade,"lower") = q21_trade_glo.lo(k_trade); - oq21_notrade(t,i,k_notrade,"lower") = q21_notrade.lo(i,k_notrade); + oq21_notrade(t,h,k_notrade,"lower") = q21_notrade.lo(h,k_notrade); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/21_trade/free_apr16/preloop.gms b/modules/21_trade/free_apr16/preloop.gms index d0a4fc9e59..a71c3b75c3 100644 --- a/modules/21_trade/free_apr16/preloop.gms +++ b/modules/21_trade/free_apr16/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -10,5 +10,5 @@ *set vm_cost_trade zero in order to avoid a free variable vm_cost_trade.fx(i) = 0; -pm_selfsuff_ext(t_ext,i,kforestry) = f21_self_suff("y2150",i,kforestry); -pm_selfsuff_ext(t_all,i,kforestry) = f21_self_suff(t_all,i,kforestry); +pm_selfsuff_ext(t_ext,h,kforestry) = f21_self_suff("y2150",h,kforestry); +pm_selfsuff_ext(t_all,h,kforestry) = f21_self_suff(t_all,h,kforestry); diff --git a/modules/21_trade/free_apr16/realization.gms b/modules/21_trade/free_apr16/realization.gms index ab85996f7f..6e3f83d5d9 100644 --- a/modules/21_trade/free_apr16/realization.gms +++ b/modules/21_trade/free_apr16/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/21_trade/free_apr16/sets.gms b/modules/21_trade/free_apr16/sets.gms index a7b5fa7bd1..19db0f2d6f 100644 --- a/modules/21_trade/free_apr16/sets.gms +++ b/modules/21_trade/free_apr16/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/21_trade/input/files b/modules/21_trade/input/files index be5b3e7f00..a2dc71b741 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_bal_reduction.cs3 +f21_trade_tariff_import.cs3 f21_trade_balance.cs3 +f21_trade_bal_reduction.cs3 diff --git a/modules/21_trade/module.gms b/modules/21_trade/module.gms index 721d0eeb0f..6d47501878 100644 --- a/modules/21_trade/module.gms +++ b/modules/21_trade/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -19,4 +19,5 @@ $Ifi "%trade%" == "exo" $include "./modules/21_trade/exo/realization.gms" $Ifi "%trade%" == "free_apr16" $include "./modules/21_trade/free_apr16/realization.gms" $Ifi "%trade%" == "off" $include "./modules/21_trade/off/realization.gms" $Ifi "%trade%" == "selfsuff_reduced" $include "./modules/21_trade/selfsuff_reduced/realization.gms" +$Ifi "%trade%" == "selfsuff_reduced_bilateral22" $include "./modules/21_trade/selfsuff_reduced_bilateral22/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/21_trade/off/declarations.gms b/modules/21_trade/off/declarations.gms index f0c4e9644a..0b1e72e5bf 100644 --- a/modules/21_trade/off/declarations.gms +++ b/modules/21_trade/off/declarations.gms @@ -1,22 +1,25 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 +parameters +pm_selfsuff_ext(t_ext,h,kforestry) Self sufficiency for timber products in extended time frame (1) +; positive variables vm_cost_trade(i) Regional trade costs (mio. USD05MER per yr) ; equations - q21_notrade(i,kall) Regional production constraint of non-tradable commodities (mio. tDM per yr) + q21_notrade(h,kall) Superregional production constraint of non-tradable commodities (mio. tDM per yr) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters ov_cost_trade(t,i,type) Regional trade costs (mio. USD05MER per yr) - oq21_notrade(t,i,kall,type) Regional production constraint of non-tradable commodities (mio. tDM per yr) + oq21_notrade(t,h,kall,type) Superregional production constraint of non-tradable commodities (mio. tDM per yr) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/21_trade/off/equations.gms b/modules/21_trade/off/equations.gms index 2b26b8f7d3..42c20f43c8 100644 --- a/modules/21_trade/off/equations.gms +++ b/modules/21_trade/off/equations.gms @@ -1,8 +1,13 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 - q21_notrade(i2,kall).. vm_prod_reg(i2,kall) =g= vm_supply(i2,kall); +*' @equations +*' For all commodites, the regional supply should be larger or equal to the +*' regional demand. + +q21_notrade(h2,kall).. + sum(supreg(h2,i2),vm_prod_reg(i2,kall)) =g= sum(supreg(h2,i2), vm_supply(i2,kall)); diff --git a/modules/38_factor_costs/mixed_feb17/input.gms b/modules/21_trade/off/input.gms similarity index 50% rename from modules/38_factor_costs/mixed_feb17/input.gms rename to modules/21_trade/off/input.gms index 80e5260830..536c1dc76b 100644 --- a/modules/38_factor_costs/mixed_feb17/input.gms +++ b/modules/21_trade/off/input.gms @@ -1,18 +1,16 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 f38_fac_req(kcr,w) Factor requirement costs (USD05MER per tDM) +table f21_trade_balance(t_all,h,kall) trade balance of positive exports and negative imports (mio. tDM per yr) $ondelim -$include "./modules/38_factor_costs/input/f38_fac_req.csv" +$include "./modules/21_trade/input/f21_trade_balance.cs3" $offdelim; -table f38_region_yield(i,kcr) Regional crop yields (tDM per ha) +table f21_self_suff(t_all,h,kall) Superregional self-sufficiency rates (1) $ondelim -$include "./modules/38_factor_costs/mixed_feb17/input/f38_region_yield.csv" +$include "./modules/21_trade/input/f21_trade_self_suff.cs3" $offdelim; diff --git a/modules/21_trade/off/not_used.txt b/modules/21_trade/off/not_used.txt deleted file mode 100644 index 22d6e682e4..0000000000 --- a/modules/21_trade/off/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 -pm_selfsuff_ext, parameter, not used diff --git a/modules/21_trade/off/postsolve.gms b/modules/21_trade/off/postsolve.gms index 965b61e1ea..a414883e5f 100644 --- a/modules/21_trade/off/postsolve.gms +++ b/modules/21_trade/off/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -8,11 +8,11 @@ *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov_cost_trade(t,i,"marginal") = vm_cost_trade.m(i); - oq21_notrade(t,i,kall,"marginal") = q21_notrade.m(i,kall); + oq21_notrade(t,h,kall,"marginal") = q21_notrade.m(h,kall); ov_cost_trade(t,i,"level") = vm_cost_trade.l(i); - oq21_notrade(t,i,kall,"level") = q21_notrade.l(i,kall); + oq21_notrade(t,h,kall,"level") = q21_notrade.l(h,kall); ov_cost_trade(t,i,"upper") = vm_cost_trade.up(i); - oq21_notrade(t,i,kall,"upper") = q21_notrade.up(i,kall); + oq21_notrade(t,h,kall,"upper") = q21_notrade.up(h,kall); ov_cost_trade(t,i,"lower") = vm_cost_trade.lo(i); - oq21_notrade(t,i,kall,"lower") = q21_notrade.lo(i,kall); + oq21_notrade(t,h,kall,"lower") = q21_notrade.lo(h,kall); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/21_trade/off/preloop.gms b/modules/21_trade/off/preloop.gms index 136d970efb..7e9c520fd8 100644 --- a/modules/21_trade/off/preloop.gms +++ b/modules/21_trade/off/preloop.gms @@ -1,11 +1,13 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 - +** Save self sufficiency values as a interface parameter needed in forestry module +pm_selfsuff_ext(t_ext,h,kforestry) = f21_self_suff("y2150",h,kforestry); +pm_selfsuff_ext(t_all,h,kforestry) = f21_self_suff(t_all,h,kforestry); *set vm_cost_trade zero in order to avoid a free variable vm_cost_trade.fx(i) = 0; diff --git a/modules/21_trade/off/realization.gms b/modules/21_trade/off/realization.gms index ab641080f6..3e5bed0943 100644 --- a/modules/21_trade/off/realization.gms +++ b/modules/21_trade/off/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -12,6 +12,7 @@ *####################### R SECTION START (PHASES) ############################## $Ifi "%phase%" == "declarations" $include "./modules/21_trade/off/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/21_trade/off/input.gms" $Ifi "%phase%" == "equations" $include "./modules/21_trade/off/equations.gms" $Ifi "%phase%" == "preloop" $include "./modules/21_trade/off/preloop.gms" $Ifi "%phase%" == "postsolve" $include "./modules/21_trade/off/postsolve.gms" diff --git a/modules/21_trade/selfsuff_reduced/declarations.gms b/modules/21_trade/selfsuff_reduced/declarations.gms index 82dd320b2f..480b010696 100644 --- a/modules/21_trade/selfsuff_reduced/declarations.gms +++ b/modules/21_trade/selfsuff_reduced/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,42 +7,42 @@ parameters i21_trade_bal_reduction(t_all,k_trade) Trade balance reduction (1) - i21_trade_margin(i,k_trade) Trade margins (USD05MER per tDM) - i21_trade_tariff(i,k_trade) Trade tariffs (USD05MER per tDM) - pm_selfsuff_ext(t_ext,i,kforestry) Self sufficiency for timber products in extended time frame (1) + i21_trade_margin(h,k_trade) Trade margins (USD05MER per tDM) + i21_trade_tariff(h,k_trade) Trade tariffs (USD05MER per tDM) + pm_selfsuff_ext(t_ext,h,kforestry) Self sufficiency for timber products in extended time frame (1) ; positive variables v21_excess_dem(k_trade) Global excess demand (mio. tDM per yr) - v21_excess_prod(i,k_trade) Regional excess production (mio. tDM per yr) + v21_excess_prod(h,k_trade) Superregional excess production (mio. tDM per yr) vm_cost_trade(i) Regional trade costs (mio. USD05MER per yr) - v21_cost_trade_reg(i,k_trade) Regional trade costs for each tradable commodity (mio. USD05MER per yr) + v21_cost_trade_reg(h,k_trade) Superregional trade costs for each tradable commodity (mio. USD05MER per yr) ; equations q21_trade_glo(k_trade) Global production constraint (mio. tDM per yr) - q21_notrade(i,k_notrade) Regional production constraint of non-tradable commodities (mio. tDM per yr) - q21_trade_reg(i,k_trade) Regional trade balances i.e. minimum self-sufficiency ratio (1) - q21_trade_reg_up(i,k_trade) Regional trade balances i.e. maximum self-sufficiency ratio (1) + q21_notrade(h,k_notrade) Superregional production constraint of non-tradable commodities (mio. tDM per yr) + q21_trade_reg(h,k_trade) Superregional trade balances i.e. minimum self-sufficiency ratio (1) + q21_trade_reg_up(h,k_trade) Superregional trade balances i.e. maximum self-sufficiency ratio (1) q21_excess_dem(k_trade) Global excess demand (mio. tDM per yr) - q21_excess_supply(i,k_trade) Regional excess production (mio. tDM per yr) - q21_cost_trade(i) Regional trade costs (mio. USD05MER per yr) - q21_cost_trade_reg(i,k_trade) Regional trade costs for each tradable commodity (mio. USD05MER per yr) + q21_excess_supply(h,k_trade) Superregional excess production (mio. tDM per yr) + q21_cost_trade(h) Superregional trade costs (mio. USD05MER per yr) + q21_cost_trade_reg(h,k_trade) Superregional trade costs for each tradable commodity (mio. USD05MER per yr) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters ov21_excess_dem(t,k_trade,type) Global excess demand (mio. tDM per yr) - ov21_excess_prod(t,i,k_trade,type) Regional excess production (mio. tDM per yr) + ov21_excess_prod(t,h,k_trade,type) Superregional excess production (mio. tDM per yr) ov_cost_trade(t,i,type) Regional trade costs (mio. USD05MER per yr) - ov21_cost_trade_reg(t,i,k_trade,type) Regional trade costs for each tradable commodity (mio. USD05MER per yr) + ov21_cost_trade_reg(t,h,k_trade,type) Superregional trade costs for each tradable commodity (mio. USD05MER per yr) oq21_trade_glo(t,k_trade,type) Global production constraint (mio. tDM per yr) - oq21_notrade(t,i,k_notrade,type) Regional production constraint of non-tradable commodities (mio. tDM per yr) - oq21_trade_reg(t,i,k_trade,type) Regional trade balances i.e. minimum self-sufficiency ratio (1) - oq21_trade_reg_up(t,i,k_trade,type) Regional trade balances i.e. maximum self-sufficiency ratio (1) + oq21_notrade(t,h,k_notrade,type) Superregional production constraint of non-tradable commodities (mio. tDM per yr) + oq21_trade_reg(t,h,k_trade,type) Superregional trade balances i.e. minimum self-sufficiency ratio (1) + oq21_trade_reg_up(t,h,k_trade,type) Superregional trade balances i.e. maximum self-sufficiency ratio (1) oq21_excess_dem(t,k_trade,type) Global excess demand (mio. tDM per yr) - oq21_excess_supply(t,i,k_trade,type) Regional excess production (mio. tDM per yr) - oq21_cost_trade(t,i,type) Regional trade costs (mio. USD05MER per yr) - oq21_cost_trade_reg(t,i,k_trade,type) Regional trade costs for each tradable commodity (mio. USD05MER per yr) + oq21_excess_supply(t,h,k_trade,type) Superregional excess production (mio. tDM per yr) + oq21_cost_trade(t,h,type) Superregional trade costs (mio. USD05MER per yr) + oq21_cost_trade_reg(t,h,k_trade,type) Superregional trade costs for each tradable commodity (mio. USD05MER per yr) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/21_trade/selfsuff_reduced/equations.gms b/modules/21_trade/selfsuff_reduced/equations.gms index 70274654c1..3cfe741cc5 100644 --- a/modules/21_trade/selfsuff_reduced/equations.gms +++ b/modules/21_trade/selfsuff_reduced/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -14,8 +14,8 @@ sum(i2, vm_supply(i2,k_trade)) + sum(ct,f21_trade_balanceflow(ct,k_trade)); *' *' For non-tradable commodites, the regional supply should be larger or equal to the regional demand. - q21_notrade(i2,k_notrade).. - vm_prod_reg(i2,k_notrade) =g= vm_supply(i2,k_notrade); + q21_notrade(h2,k_notrade).. + sum(supreg(h2,i2),vm_prod_reg(i2,k_notrade)) =g= sum(supreg(h2,i2), vm_supply(i2,k_notrade)); *' The following equation indicates the regional trade constraint for the self-sufficiency pool. *' The share of regional demand that has to be fulfilled through the self-sufficiency pool is @@ -26,46 +26,46 @@ *' Lower bound for production. - q21_trade_reg(i2,k_trade).. - vm_prod_reg(i2,k_trade) =g= - (vm_supply(i2,k_trade) + v21_excess_prod(i2,k_trade)) + q21_trade_reg(h2,k_trade).. + sum(supreg(h2,i2),vm_prod_reg(i2,k_trade)) =g= + (sum(supreg(h2,i2),vm_supply(i2,k_trade)) + v21_excess_prod(h2,k_trade)) *sum(ct,i21_trade_bal_reduction(ct,k_trade)) - $(sum(ct,f21_self_suff(ct,i2,k_trade) >= 1)) - + vm_supply(i2,k_trade)*sum(ct,f21_self_suff(ct,i2,k_trade)) + $(sum(ct,f21_self_suff(ct,h2,k_trade) >= 1)) + + sum(supreg(h2,i2),vm_supply(i2,k_trade))*sum(ct,f21_self_suff(ct,h2,k_trade)) *sum(ct,i21_trade_bal_reduction(ct,k_trade)) - $(sum(ct,f21_self_suff(ct,i2,k_trade) < 1)); + $(sum(ct,f21_self_suff(ct,h2,k_trade) < 1)); -*' Upper bound for production. - - q21_trade_reg_up(i2,k_trade) .. - vm_prod_reg(i2,k_trade) =l= - ((vm_supply(i2,k_trade) + v21_excess_prod(i2,k_trade))/sum(ct,i21_trade_bal_reduction(ct,k_trade))) - $(sum(ct,f21_self_suff(ct,i2,k_trade) >= 1)) - + (vm_supply(i2,k_trade)*sum(ct,f21_self_suff(ct,i2,k_trade))/sum(ct,i21_trade_bal_reduction(ct,k_trade))) - $(sum(ct,f21_self_suff(ct,i2,k_trade) < 1)); +*' Upper bound for production. + + q21_trade_reg_up(h2,k_trade) .. + sum(supreg(h2,i2),vm_prod_reg(i2,k_trade)) =l= + ((sum(supreg(h2,i2),vm_supply(i2,k_trade)) + v21_excess_prod(h2,k_trade))/sum(ct,i21_trade_bal_reduction(ct,k_trade))) + $(sum(ct,f21_self_suff(ct,h2,k_trade) >= 1)) + + (sum(supreg(h2,i2),vm_supply(i2,k_trade))*sum(ct,f21_self_suff(ct,h2,k_trade))/sum(ct,i21_trade_bal_reduction(ct,k_trade))) + $(sum(ct,f21_self_suff(ct,h2,k_trade) < 1)); *' The global excess demand of each tradable good `v21_excess_demad` equals to *' the sum over all the imports of importing regions. q21_excess_dem(k_trade).. v21_excess_dem(k_trade) =g= - sum(i2, vm_supply(i2,k_trade)*(1 - sum(ct,f21_self_suff(ct,i2,k_trade))) - $(sum(ct,f21_self_suff(ct,i2,k_trade)) < 1)) + sum(h2, sum(supreg(h2,i2),vm_supply(i2,k_trade))*(1 - sum(ct,f21_self_suff(ct,h2,k_trade))) + $(sum(ct,f21_self_suff(ct,h2,k_trade)) < 1)) + sum(ct,f21_trade_balanceflow(ct,k_trade)); *' Distributing the global excess demand to exporting regions is based on regional export shares [@schmitz_trading_2012]. *' Export shares are derived from FAO data (see @schmitz_trading_2012 for details). They are 0 for importing regions. - q21_excess_supply(i2,k_trade).. - v21_excess_prod(i2,k_trade) =e= - v21_excess_dem(k_trade)*sum(ct,f21_exp_shr(ct,i2,k_trade)); + q21_excess_supply(h2,k_trade).. + v21_excess_prod(h2,k_trade) =e= + v21_excess_dem(k_trade)*sum(ct,f21_exp_shr(ct,h2,k_trade)); * Trade costs are associated with exporting regions. They are dependent on net exports, trade margin, and tariffs. - q21_cost_trade_reg(i2,k_trade).. - v21_cost_trade_reg(i2,k_trade) =g= - (i21_trade_margin(i2,k_trade) + i21_trade_tariff(i2,k_trade)) - *(vm_prod_reg(i2,k_trade)-vm_supply(i2,k_trade)); + q21_cost_trade_reg(h2,k_trade).. + v21_cost_trade_reg(h2,k_trade) =g= + (i21_trade_margin(h2,k_trade) + i21_trade_tariff(h2,k_trade)) + *sum(supreg(h2,i2), vm_prod_reg(i2,k_trade)-vm_supply(i2,k_trade)); * Regional trade costs are the costs for each region aggregated over all the tradable commodities. - q21_cost_trade(i2).. - vm_cost_trade(i2) =e= sum(k_trade,v21_cost_trade_reg(i2,k_trade)); + q21_cost_trade(h2).. + sum(supreg(h2,i2),vm_cost_trade(i2)) =e= sum(k_trade,v21_cost_trade_reg(h2,k_trade)); diff --git a/modules/21_trade/selfsuff_reduced/input.gms b/modules/21_trade/selfsuff_reduced/input.gms index 8e9aa949d4..1185f72439 100644 --- a/modules/21_trade/selfsuff_reduced/input.gms +++ b/modules/21_trade/selfsuff_reduced/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -18,12 +18,12 @@ $ondelim $include "./modules/21_trade/input/f21_trade_bal_reduction.cs3" $offdelim; -table f21_self_suff(t_all,i,kall) Regional self-sufficiency rates (1) +table f21_self_suff(t_all,h,kall) Superregional self-sufficiency rates (1) $ondelim $include "./modules/21_trade/input/f21_trade_self_suff.cs3" $offdelim; -table f21_exp_shr(t_all,i,kall) Regional and crop-specific export share (1) +table f21_exp_shr(t_all,h,kall) Superregional and crop-specific export share (1) $ondelim $include "./modules/21_trade/input/f21_trade_export_share.cs3" $offdelim; @@ -33,13 +33,13 @@ $ondelim $include "./modules/21_trade/input/f21_trade_balanceflow.cs3" $offdelim; -table f21_trade_margin(i,kall) Costs of freight and insurance (USD05MER per tDM) +table f21_trade_margin(h,kall) Costs of freight and insurance (USD05MER per tDM) $ondelim $include "./modules/21_trade/input/f21_trade_margin.cs3" $offdelim ; -table f21_trade_tariff(i,kall) Specific duty tariffs (USD05MER per tDM) +table f21_trade_tariff(h,kall) Specific duty tariffs (USD05MER per tDM) $ondelim $include "./modules/21_trade/input/f21_trade_tariff.cs3" $offdelim diff --git a/modules/21_trade/selfsuff_reduced/postsolve.gms b/modules/21_trade/selfsuff_reduced/postsolve.gms index ceaa8d3da8..e9626ade70 100644 --- a/modules/21_trade/selfsuff_reduced/postsolve.gms +++ b/modules/21_trade/selfsuff_reduced/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,51 +7,51 @@ *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov21_excess_dem(t,k_trade,"marginal") = v21_excess_dem.m(k_trade); - ov21_excess_prod(t,i,k_trade,"marginal") = v21_excess_prod.m(i,k_trade); + ov21_excess_prod(t,h,k_trade,"marginal") = v21_excess_prod.m(h,k_trade); ov_cost_trade(t,i,"marginal") = vm_cost_trade.m(i); - ov21_cost_trade_reg(t,i,k_trade,"marginal") = v21_cost_trade_reg.m(i,k_trade); + ov21_cost_trade_reg(t,h,k_trade,"marginal") = v21_cost_trade_reg.m(h,k_trade); oq21_trade_glo(t,k_trade,"marginal") = q21_trade_glo.m(k_trade); - oq21_notrade(t,i,k_notrade,"marginal") = q21_notrade.m(i,k_notrade); - oq21_trade_reg(t,i,k_trade,"marginal") = q21_trade_reg.m(i,k_trade); - oq21_trade_reg_up(t,i,k_trade,"marginal") = q21_trade_reg_up.m(i,k_trade); + oq21_notrade(t,h,k_notrade,"marginal") = q21_notrade.m(h,k_notrade); + oq21_trade_reg(t,h,k_trade,"marginal") = q21_trade_reg.m(h,k_trade); + oq21_trade_reg_up(t,h,k_trade,"marginal") = q21_trade_reg_up.m(h,k_trade); oq21_excess_dem(t,k_trade,"marginal") = q21_excess_dem.m(k_trade); - oq21_excess_supply(t,i,k_trade,"marginal") = q21_excess_supply.m(i,k_trade); - oq21_cost_trade(t,i,"marginal") = q21_cost_trade.m(i); - oq21_cost_trade_reg(t,i,k_trade,"marginal") = q21_cost_trade_reg.m(i,k_trade); + oq21_excess_supply(t,h,k_trade,"marginal") = q21_excess_supply.m(h,k_trade); + oq21_cost_trade(t,h,"marginal") = q21_cost_trade.m(h); + oq21_cost_trade_reg(t,h,k_trade,"marginal") = q21_cost_trade_reg.m(h,k_trade); ov21_excess_dem(t,k_trade,"level") = v21_excess_dem.l(k_trade); - ov21_excess_prod(t,i,k_trade,"level") = v21_excess_prod.l(i,k_trade); + ov21_excess_prod(t,h,k_trade,"level") = v21_excess_prod.l(h,k_trade); ov_cost_trade(t,i,"level") = vm_cost_trade.l(i); - ov21_cost_trade_reg(t,i,k_trade,"level") = v21_cost_trade_reg.l(i,k_trade); + ov21_cost_trade_reg(t,h,k_trade,"level") = v21_cost_trade_reg.l(h,k_trade); oq21_trade_glo(t,k_trade,"level") = q21_trade_glo.l(k_trade); - oq21_notrade(t,i,k_notrade,"level") = q21_notrade.l(i,k_notrade); - oq21_trade_reg(t,i,k_trade,"level") = q21_trade_reg.l(i,k_trade); - oq21_trade_reg_up(t,i,k_trade,"level") = q21_trade_reg_up.l(i,k_trade); + oq21_notrade(t,h,k_notrade,"level") = q21_notrade.l(h,k_notrade); + oq21_trade_reg(t,h,k_trade,"level") = q21_trade_reg.l(h,k_trade); + oq21_trade_reg_up(t,h,k_trade,"level") = q21_trade_reg_up.l(h,k_trade); oq21_excess_dem(t,k_trade,"level") = q21_excess_dem.l(k_trade); - oq21_excess_supply(t,i,k_trade,"level") = q21_excess_supply.l(i,k_trade); - oq21_cost_trade(t,i,"level") = q21_cost_trade.l(i); - oq21_cost_trade_reg(t,i,k_trade,"level") = q21_cost_trade_reg.l(i,k_trade); + oq21_excess_supply(t,h,k_trade,"level") = q21_excess_supply.l(h,k_trade); + oq21_cost_trade(t,h,"level") = q21_cost_trade.l(h); + oq21_cost_trade_reg(t,h,k_trade,"level") = q21_cost_trade_reg.l(h,k_trade); ov21_excess_dem(t,k_trade,"upper") = v21_excess_dem.up(k_trade); - ov21_excess_prod(t,i,k_trade,"upper") = v21_excess_prod.up(i,k_trade); + ov21_excess_prod(t,h,k_trade,"upper") = v21_excess_prod.up(h,k_trade); ov_cost_trade(t,i,"upper") = vm_cost_trade.up(i); - ov21_cost_trade_reg(t,i,k_trade,"upper") = v21_cost_trade_reg.up(i,k_trade); + ov21_cost_trade_reg(t,h,k_trade,"upper") = v21_cost_trade_reg.up(h,k_trade); oq21_trade_glo(t,k_trade,"upper") = q21_trade_glo.up(k_trade); - oq21_notrade(t,i,k_notrade,"upper") = q21_notrade.up(i,k_notrade); - oq21_trade_reg(t,i,k_trade,"upper") = q21_trade_reg.up(i,k_trade); - oq21_trade_reg_up(t,i,k_trade,"upper") = q21_trade_reg_up.up(i,k_trade); + oq21_notrade(t,h,k_notrade,"upper") = q21_notrade.up(h,k_notrade); + oq21_trade_reg(t,h,k_trade,"upper") = q21_trade_reg.up(h,k_trade); + oq21_trade_reg_up(t,h,k_trade,"upper") = q21_trade_reg_up.up(h,k_trade); oq21_excess_dem(t,k_trade,"upper") = q21_excess_dem.up(k_trade); - oq21_excess_supply(t,i,k_trade,"upper") = q21_excess_supply.up(i,k_trade); - oq21_cost_trade(t,i,"upper") = q21_cost_trade.up(i); - oq21_cost_trade_reg(t,i,k_trade,"upper") = q21_cost_trade_reg.up(i,k_trade); + oq21_excess_supply(t,h,k_trade,"upper") = q21_excess_supply.up(h,k_trade); + oq21_cost_trade(t,h,"upper") = q21_cost_trade.up(h); + oq21_cost_trade_reg(t,h,k_trade,"upper") = q21_cost_trade_reg.up(h,k_trade); ov21_excess_dem(t,k_trade,"lower") = v21_excess_dem.lo(k_trade); - ov21_excess_prod(t,i,k_trade,"lower") = v21_excess_prod.lo(i,k_trade); + ov21_excess_prod(t,h,k_trade,"lower") = v21_excess_prod.lo(h,k_trade); ov_cost_trade(t,i,"lower") = vm_cost_trade.lo(i); - ov21_cost_trade_reg(t,i,k_trade,"lower") = v21_cost_trade_reg.lo(i,k_trade); + ov21_cost_trade_reg(t,h,k_trade,"lower") = v21_cost_trade_reg.lo(h,k_trade); oq21_trade_glo(t,k_trade,"lower") = q21_trade_glo.lo(k_trade); - oq21_notrade(t,i,k_notrade,"lower") = q21_notrade.lo(i,k_notrade); - oq21_trade_reg(t,i,k_trade,"lower") = q21_trade_reg.lo(i,k_trade); - oq21_trade_reg_up(t,i,k_trade,"lower") = q21_trade_reg_up.lo(i,k_trade); + oq21_notrade(t,h,k_notrade,"lower") = q21_notrade.lo(h,k_notrade); + oq21_trade_reg(t,h,k_trade,"lower") = q21_trade_reg.lo(h,k_trade); + oq21_trade_reg_up(t,h,k_trade,"lower") = q21_trade_reg_up.lo(h,k_trade); oq21_excess_dem(t,k_trade,"lower") = q21_excess_dem.lo(k_trade); - oq21_excess_supply(t,i,k_trade,"lower") = q21_excess_supply.lo(i,k_trade); - oq21_cost_trade(t,i,"lower") = q21_cost_trade.lo(i); - oq21_cost_trade_reg(t,i,k_trade,"lower") = q21_cost_trade_reg.lo(i,k_trade); + oq21_excess_supply(t,h,k_trade,"lower") = q21_excess_supply.lo(h,k_trade); + oq21_cost_trade(t,h,"lower") = q21_cost_trade.lo(h); + oq21_cost_trade_reg(t,h,k_trade,"lower") = q21_cost_trade_reg.lo(h,k_trade); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/21_trade/selfsuff_reduced/preloop.gms b/modules/21_trade/selfsuff_reduced/preloop.gms index 7fef72500e..b336661fbd 100644 --- a/modules/21_trade/selfsuff_reduced/preloop.gms +++ b/modules/21_trade/selfsuff_reduced/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -13,15 +13,15 @@ i21_trade_bal_reduction(t_all,"wood") = i21_trade_bal_reduction(t_all,"wood") * ); i21_trade_bal_reduction(t_all,"woodfuel") = i21_trade_bal_reduction(t_all,"wood"); -i21_trade_margin(i,k_trade) = f21_trade_margin(i,k_trade); +i21_trade_margin(h,k_trade) = f21_trade_margin(h,k_trade); if ((s21_trade_tariff=1), - i21_trade_tariff(i,k_trade) = f21_trade_tariff(i,k_trade); + i21_trade_tariff(h,k_trade) = f21_trade_tariff(h,k_trade); elseif (s21_trade_tariff=0), - i21_trade_tariff(i,k_trade) = 0; + i21_trade_tariff(h,k_trade) = 0; ); -pm_selfsuff_ext(t_ext,i,kforestry) = f21_self_suff("y2150",i,kforestry); -pm_selfsuff_ext(t_all,i,kforestry) = f21_self_suff(t_all,i,kforestry); +pm_selfsuff_ext(t_ext,h,kforestry) = f21_self_suff("y2150",h,kforestry); +pm_selfsuff_ext(t_all,h,kforestry) = f21_self_suff(t_all,h,kforestry); *Implausible jumps in selfsuff for wood in some regions. -pm_selfsuff_ext(tstart21,i,kforestry) = f21_self_suff("y2010",i,kforestry); +pm_selfsuff_ext(tstart21,h,kforestry) = f21_self_suff("y2010",h,kforestry); diff --git a/modules/21_trade/selfsuff_reduced/realization.gms b/modules/21_trade/selfsuff_reduced/realization.gms index 625809b317..db2e26e34a 100644 --- a/modules/21_trade/selfsuff_reduced/realization.gms +++ b/modules/21_trade/selfsuff_reduced/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/21_trade/selfsuff_reduced/scaling.gms b/modules/21_trade/selfsuff_reduced/scaling.gms index a7ea1d7003..16f66cac53 100644 --- a/modules/21_trade/selfsuff_reduced/scaling.gms +++ b/modules/21_trade/selfsuff_reduced/scaling.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,4 +6,4 @@ *** | Contact: magpie@pik-potsdam.de vm_cost_trade.scale(i) = 10e4; -v21_cost_trade_reg.scale(i,k_trade) = 10e2; +v21_cost_trade_reg.scale(h,k_trade) = 10e2; diff --git a/modules/21_trade/selfsuff_reduced/sets.gms b/modules/21_trade/selfsuff_reduced/sets.gms index 42c5557bd8..c1a76fa8a3 100644 --- a/modules/21_trade/selfsuff_reduced/sets.gms +++ b/modules/21_trade/selfsuff_reduced/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -21,7 +21,7 @@ sets potato,cassav_sp,sugr_cane,sugr_beet,others,cottn_pro, oils,oilcakes,sugar,molasses,alcohol,ethanol,distillers_grain,brans,scp,fibres, livst_rum, livst_pig,livst_chick, livst_egg, livst_milk, fish, wood, woodfuel / - + * We limit trade of secondary products as this allows for extreme specialisation * in the implementation. Exception is sugar, where we allow the secondary product * trade but not the primary as primaries are hardly traded in reality diff --git a/modules/21_trade/selfsuff_reduced_bilateral22/declarations.gms b/modules/21_trade/selfsuff_reduced_bilateral22/declarations.gms new file mode 100644 index 0000000000..f4ae346181 --- /dev/null +++ b/modules/21_trade/selfsuff_reduced_bilateral22/declarations.gms @@ -0,0 +1,62 @@ +*** | (C) 2008-2023 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 + +parameters + i21_trade_bal_reduction(t_all,k_trade) Trade balance reduction (1) + i21_trade_margin(i_ex,i_im,k_trade) Trade transport and admin costs (USD05MER per tDM) + i21_trade_tariff(t_all, i_ex,i_im,k_trade) Trade tariffs (USD05MER per tDM) + pm_selfsuff_ext(t_ext,h,kforestry) Self sufficiency for timber products in extended time frame (1) +; + +positive variables + v21_excess_dem(k_trade) Demand exceeding the minimum self-sufficiency (mio. tDM per yr) + v21_excess_prod(h,k_trade) Superregional production exceeding the minimum self-sufficiency production (mio. tDM per yr) + v21_trade(i_ex,i_im,k_trade) Amounts traded bilaterally (mio. tDM per yr) + v21_cost_tariff_reg(i,k_trade) Regional trade tariffs for each tradable commodity (mio. USD05MER per yr) + v21_cost_margin_reg(i,k_trade) Rregional trade margins for each tradable commodity (mio. USD05MER per yr) + vm_cost_trade(i) Regional trade costs (mio. USD05MER per yr) + v21_cost_trade_reg(i,k_trade) Superregional trade costs for each tradable commodity (mio. USD05MER per yr) +; + +equations + q21_trade_glo(k_trade) Global production constraint (mio. tDM per yr) + q21_notrade(h,k_notrade) Superregional production constraint of non-tradable commodities (mio. tDM per yr) + q21_trade_reg(h,k_trade) Superregional trade balances i.e. minimum self-sufficiency ratio (1) + q21_trade_reg_up(h,k_trade) Superregional trade balances i.e. maximum self-sufficiency ratio (1) + q21_excess_dem(k_trade) Global excess demand (mio. tDM per yr) + q21_excess_supply(h,k_trade) Superregional excess production (mio. tDM per yr) + q21_trade_bilat(h, k_trade) Superregional bilateral trade requirements (mio. tDM per yr) + q21_costs_tariffs(i, k_trade) Regional trade tariff costs (mio. USD05MER per yr) + q21_costs_margins(i,k_trade) Regional bilateral trade requirements + q21_cost_trade_reg(i,k_trade) Regional trade costs for each tradable commodity (mio. USD05MER per yr) + q21_cost_trade_reg(i,k_trade) Superregional trade costs for each tradable commodity (mio. USD05MER per yr) + q21_cost_trade(i) Superregional trade costs (mio. USD05MER per yr) +; + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov21_excess_dem(t,k_trade,type) Demand exceeding the minimum self-sufficiency (mio. tDM per yr) + ov21_excess_prod(t,h,k_trade,type) Superregional production exceeding the minimum self-sufficiency production (mio. tDM per yr) + ov21_trade(t,i_ex,i_im,k_trade,type) Amounts traded bilaterally (mio. tDM per yr) + ov21_cost_tariff_reg(t,i,k_trade,type) Regional trade tariffs for each tradable commodity (mio. USD05MER per yr) + ov21_cost_margin_reg(t,i,k_trade,type) Rregional trade margins for each tradable commodity (mio. USD05MER per yr) + ov_cost_trade(t,i,type) Regional trade costs (mio. USD05MER per yr) + ov21_cost_trade_reg(t,i,k_trade,type) Superregional trade costs for each tradable commodity (mio. USD05MER per yr) + oq21_trade_glo(t,k_trade,type) Global production constraint (mio. tDM per yr) + oq21_notrade(t,h,k_notrade,type) Superregional production constraint of non-tradable commodities (mio. tDM per yr) + oq21_trade_reg(t,h,k_trade,type) Superregional trade balances i.e. minimum self-sufficiency ratio (1) + oq21_trade_reg_up(t,h,k_trade,type) Superregional trade balances i.e. maximum self-sufficiency ratio (1) + oq21_excess_dem(t,k_trade,type) Global excess demand (mio. tDM per yr) + oq21_excess_supply(t,h,k_trade,type) Superregional excess production (mio. tDM per yr) + oq21_trade_bilat(t,h,k_trade,type) Superregional bilateral trade requirements (mio. tDM per yr) + oq21_costs_tariffs(t,i,k_trade,type) Regional trade tariff costs (mio. USD05MER per yr) + oq21_costs_margins(t,i,k_trade,type) Regional bilateral trade requirements + oq21_cost_trade_reg(t,i,k_trade,type) Regional trade costs for each tradable commodity (mio. USD05MER per yr) + oq21_cost_trade_reg(t,i,k_trade,type) Superregional trade costs for each tradable commodity (mio. USD05MER per yr) + oq21_cost_trade(t,i,type) Superregional trade costs (mio. USD05MER per yr) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/21_trade/selfsuff_reduced_bilateral22/equations.gms b/modules/21_trade/selfsuff_reduced_bilateral22/equations.gms new file mode 100644 index 0000000000..e39a34b31c --- /dev/null +++ b/modules/21_trade/selfsuff_reduced_bilateral22/equations.gms @@ -0,0 +1,86 @@ +*** | (C) 2008-2023 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 +*' In the comparative advantage pool, the active constraint ensures that superregional and thus global supply is larger or equal to demand. +*' This means that production can be freely allocated globally based on comparative advantages. + + q21_trade_glo(k_trade).. + sum(i2 ,vm_prod_reg(i2,k_trade)) =g= + sum(i2, vm_supply(i2,k_trade)) + sum(ct,f21_trade_balanceflow(ct,k_trade)); + +*' amount produced superregionally must be equal to supply + net trade +q21_trade_bilat(h2,k_trade).. + sum(supreg(h2, i2), vm_prod_reg(i2, k_trade)) =g= sum(supreg(h2,i2), vm_supply(i2, k_trade) - + sum(i_ex, v21_trade(i_ex, i2, k_trade)) + sum(i_im, v21_trade(i2, i_im, k_trade))); +*' +*' For non-tradable commodites, the regional supply should be larger or equal to the regional demand. + q21_notrade(h2,k_notrade).. + sum(supreg(h2,i2),vm_prod_reg(i2,k_notrade)) =g= sum(supreg(h2,i2), vm_supply(i2,k_notrade)); + +*' The following equation indicates the regional trade constraint for the self-sufficiency pool. +*' The share of regional demand that has to be fulfilled through the self-sufficiency pool is +*' determined by a trade balance reduction factor for each commodity `i21_trade_bal_reduction(ct,k_trade)` +*' according to the following equations [@schmitz_trading_2012]. +*' If the trade balance reduction equals 1 (`f21_self_suff(ct,i2,k_trade) = 1`), all demand enters the self-sufficiency pool. +*' If it equals 0, all demand enters the comparative advantage pool. + +*' Lower bound for production. + + q21_trade_reg(h2,k_trade).. + sum(supreg(h2,i2),vm_prod_reg(i2,k_trade)) =g= + (sum(supreg(h2,i2),vm_supply(i2,k_trade)) + v21_excess_prod(h2,k_trade)) + *sum(ct,i21_trade_bal_reduction(ct,k_trade)) + $(sum(ct,f21_self_suff(ct,h2,k_trade) >= 1)) + + sum(supreg(h2,i2),vm_supply(i2,k_trade))*sum(ct,f21_self_suff(ct,h2,k_trade)) + *sum(ct,i21_trade_bal_reduction(ct,k_trade)) + $(sum(ct,f21_self_suff(ct,h2,k_trade) < 1)); + +*' Upper bound for production. + + q21_trade_reg_up(h2,k_trade) .. + sum(supreg(h2,i2),vm_prod_reg(i2,k_trade)) =l= + ((sum(supreg(h2,i2),vm_supply(i2,k_trade)) + v21_excess_prod(h2,k_trade))/sum(ct,i21_trade_bal_reduction(ct,k_trade))) + $(sum(ct,f21_self_suff(ct,h2,k_trade) >= 1)) + + (sum(supreg(h2,i2),vm_supply(i2,k_trade))*sum(ct,f21_self_suff(ct,h2,k_trade))/sum(ct,i21_trade_bal_reduction(ct,k_trade))) + $(sum(ct,f21_self_suff(ct,h2,k_trade) < 1)); + +*' The global excess demand of each tradable good `v21_excess_demad` equals to +*' the sum over all the imports of importing regions. + + q21_excess_dem(k_trade).. + v21_excess_dem(k_trade) =g= + sum(h2, sum(supreg(h2,i2),vm_supply(i2,k_trade))*(1 - sum(ct,f21_self_suff(ct,h2,k_trade))) + $(sum(ct,f21_self_suff(ct,h2,k_trade)) < 1)) + + sum(ct,f21_trade_balanceflow(ct,k_trade)); + +*' Distributing the global excess demand to exporting regions is based on regional export shares [@schmitz_trading_2012]. +*' Export shares are derived from FAO data (see @schmitz_trading_2012 for details). They are 0 for importing regions. + + q21_excess_supply(h2,k_trade).. + v21_excess_prod(h2,k_trade) =e= + v21_excess_dem(k_trade)*sum(ct,f21_exp_shr(ct,h2,k_trade)); + +*' Trade tariffs are associated with exporting regions. They are dependent on net exports and tariff levels. + q21_costs_tariffs(i2,k_trade).. + v21_cost_tariff_reg(i2,k_trade) =g= + sum(i_im, sum(ct, i21_trade_tariff(ct, i2,i_im,k_trade)) * v21_trade(i2,i_im,k_trade)); + +*' Trade margins costs assigned currently to exporting region. Margins at region level +q21_costs_margins(i2,k_trade).. + v21_cost_margin_reg(i2,k_trade) =g= + sum(i_im, i21_trade_margin(i2,i_im,k_trade) * v21_trade(i2,i_im,k_trade)); + +*' regional trade values are the sum of transport margin and tariff costs +q21_cost_trade_reg(i2,k_trade).. + v21_cost_trade_reg(i2,k_trade) =g= + v21_cost_tariff_reg(i2,k_trade) + v21_cost_margin_reg(i2,k_trade); + + +*' Regional trade costs are the costs for each region aggregated over all the tradable commodities. + q21_cost_trade(i2).. + vm_cost_trade(i2) =e= sum(k_trade, v21_cost_trade_reg(i2,k_trade)); diff --git a/modules/21_trade/selfsuff_reduced_bilateral22/input.gms b/modules/21_trade/selfsuff_reduced_bilateral22/input.gms new file mode 100644 index 0000000000..0d910acc56 --- /dev/null +++ b/modules/21_trade/selfsuff_reduced_bilateral22/input.gms @@ -0,0 +1,51 @@ +*** | (C) 2008-2023 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 c21_trade_liberalization l909090r808080 +* options are "regionalized" and "globalized" and "fragmented" + +scalars + s21_trade_tariff Trade tariff switch (1=on 0=off) (1) / 1 / + s21_trade_tariff_fadeout fadeout scenario setting for trade tariffs / 0 / + s21_trade_tariff_startyear year to start fading out trade tariffs / 2020 / + s21_trade_tariff_targetyear year to finish fading out trade tariffs / 2050 / + s21_trade_bal_damper Fraction to ease self sufficiency pool trade for roundwood /0.75/ +; + +table f21_trade_bal_reduction(t_all,trade_groups21,trade_regime21) Share of inelastic trade pool (1) +$ondelim +$include "./modules/21_trade/input/f21_trade_bal_reduction.cs3" +$offdelim; + +table f21_self_suff(t_all,h,kall) Superregional self-sufficiency rates (1) +$ondelim +$include "./modules/21_trade/input/f21_trade_self_suff.cs3" +$offdelim; + +table f21_exp_shr(t_all,h,kall) Superregional and crop-specific export share (1) +$ondelim +$include "./modules/21_trade/input/f21_trade_export_share.cs3" +$offdelim; + +table f21_trade_balanceflow(t_all,kall) Domestic balance flows (mio. tDM per yr) +$ondelim +$include "./modules/21_trade/input/f21_trade_balanceflow.cs3" +$offdelim; + +parameter f21_trade_margin(i_ex,i_im,kall) Costs of freight and insurance (USD05MER per tDM) +/ +$ondelim +$include "./modules/21_trade/selfsuff_reduced_bilateral22/input/f21_trade_margin_bilat.cs5" +$offdelim +/; + +parameter f21_trade_tariff(i_ex,i_im,kall) Specific duty tariffs (USD05MER per tDM) +/ +$ondelim +$include "./modules/21_trade/selfsuff_reduced_bilateral22/input/f21_trade_tariff_bilat.cs5" +$offdelim +/; diff --git a/modules/21_trade/selfsuff_reduced_bilateral22/input/files b/modules/21_trade/selfsuff_reduced_bilateral22/input/files new file mode 100644 index 0000000000..7993469cec --- /dev/null +++ b/modules/21_trade/selfsuff_reduced_bilateral22/input/files @@ -0,0 +1,3 @@ +* list of files that are required here +f21_trade_margin_bilat.cs5 +f21_trade_tariff_bilat.cs5 diff --git a/modules/21_trade/selfsuff_reduced_bilateral22/postsolve.gms b/modules/21_trade/selfsuff_reduced_bilateral22/postsolve.gms new file mode 100644 index 0000000000..5b3637644c --- /dev/null +++ b/modules/21_trade/selfsuff_reduced_bilateral22/postsolve.gms @@ -0,0 +1,85 @@ +*** | (C) 2008-2023 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) ##################### + ov21_excess_dem(t,k_trade,"marginal") = v21_excess_dem.m(k_trade); + ov21_excess_prod(t,h,k_trade,"marginal") = v21_excess_prod.m(h,k_trade); + ov21_trade(t,i_ex,i_im,k_trade,"marginal") = v21_trade.m(i_ex,i_im,k_trade); + ov21_cost_tariff_reg(t,i,k_trade,"marginal") = v21_cost_tariff_reg.m(i,k_trade); + ov21_cost_margin_reg(t,i,k_trade,"marginal") = v21_cost_margin_reg.m(i,k_trade); + ov_cost_trade(t,i,"marginal") = vm_cost_trade.m(i); + ov21_cost_trade_reg(t,i,k_trade,"marginal") = v21_cost_trade_reg.m(i,k_trade); + oq21_trade_glo(t,k_trade,"marginal") = q21_trade_glo.m(k_trade); + oq21_notrade(t,h,k_notrade,"marginal") = q21_notrade.m(h,k_notrade); + oq21_trade_reg(t,h,k_trade,"marginal") = q21_trade_reg.m(h,k_trade); + oq21_trade_reg_up(t,h,k_trade,"marginal") = q21_trade_reg_up.m(h,k_trade); + oq21_excess_dem(t,k_trade,"marginal") = q21_excess_dem.m(k_trade); + oq21_excess_supply(t,h,k_trade,"marginal") = q21_excess_supply.m(h,k_trade); + oq21_trade_bilat(t,h,k_trade,"marginal") = q21_trade_bilat.m(h,k_trade); + oq21_costs_tariffs(t,i,k_trade,"marginal") = q21_costs_tariffs.m(i,k_trade); + oq21_costs_margins(t,i,k_trade,"marginal") = q21_costs_margins.m(i,k_trade); + oq21_cost_trade_reg(t,i,k_trade,"marginal") = q21_cost_trade_reg.m(i,k_trade); + oq21_cost_trade_reg(t,i,k_trade,"marginal") = q21_cost_trade_reg.m(i,k_trade); + oq21_cost_trade(t,i,"marginal") = q21_cost_trade.m(i); + ov21_excess_dem(t,k_trade,"level") = v21_excess_dem.l(k_trade); + ov21_excess_prod(t,h,k_trade,"level") = v21_excess_prod.l(h,k_trade); + ov21_trade(t,i_ex,i_im,k_trade,"level") = v21_trade.l(i_ex,i_im,k_trade); + ov21_cost_tariff_reg(t,i,k_trade,"level") = v21_cost_tariff_reg.l(i,k_trade); + ov21_cost_margin_reg(t,i,k_trade,"level") = v21_cost_margin_reg.l(i,k_trade); + ov_cost_trade(t,i,"level") = vm_cost_trade.l(i); + ov21_cost_trade_reg(t,i,k_trade,"level") = v21_cost_trade_reg.l(i,k_trade); + oq21_trade_glo(t,k_trade,"level") = q21_trade_glo.l(k_trade); + oq21_notrade(t,h,k_notrade,"level") = q21_notrade.l(h,k_notrade); + oq21_trade_reg(t,h,k_trade,"level") = q21_trade_reg.l(h,k_trade); + oq21_trade_reg_up(t,h,k_trade,"level") = q21_trade_reg_up.l(h,k_trade); + oq21_excess_dem(t,k_trade,"level") = q21_excess_dem.l(k_trade); + oq21_excess_supply(t,h,k_trade,"level") = q21_excess_supply.l(h,k_trade); + oq21_trade_bilat(t,h,k_trade,"level") = q21_trade_bilat.l(h,k_trade); + oq21_costs_tariffs(t,i,k_trade,"level") = q21_costs_tariffs.l(i,k_trade); + oq21_costs_margins(t,i,k_trade,"level") = q21_costs_margins.l(i,k_trade); + oq21_cost_trade_reg(t,i,k_trade,"level") = q21_cost_trade_reg.l(i,k_trade); + oq21_cost_trade_reg(t,i,k_trade,"level") = q21_cost_trade_reg.l(i,k_trade); + oq21_cost_trade(t,i,"level") = q21_cost_trade.l(i); + ov21_excess_dem(t,k_trade,"upper") = v21_excess_dem.up(k_trade); + ov21_excess_prod(t,h,k_trade,"upper") = v21_excess_prod.up(h,k_trade); + ov21_trade(t,i_ex,i_im,k_trade,"upper") = v21_trade.up(i_ex,i_im,k_trade); + ov21_cost_tariff_reg(t,i,k_trade,"upper") = v21_cost_tariff_reg.up(i,k_trade); + ov21_cost_margin_reg(t,i,k_trade,"upper") = v21_cost_margin_reg.up(i,k_trade); + ov_cost_trade(t,i,"upper") = vm_cost_trade.up(i); + ov21_cost_trade_reg(t,i,k_trade,"upper") = v21_cost_trade_reg.up(i,k_trade); + oq21_trade_glo(t,k_trade,"upper") = q21_trade_glo.up(k_trade); + oq21_notrade(t,h,k_notrade,"upper") = q21_notrade.up(h,k_notrade); + oq21_trade_reg(t,h,k_trade,"upper") = q21_trade_reg.up(h,k_trade); + oq21_trade_reg_up(t,h,k_trade,"upper") = q21_trade_reg_up.up(h,k_trade); + oq21_excess_dem(t,k_trade,"upper") = q21_excess_dem.up(k_trade); + oq21_excess_supply(t,h,k_trade,"upper") = q21_excess_supply.up(h,k_trade); + oq21_trade_bilat(t,h,k_trade,"upper") = q21_trade_bilat.up(h,k_trade); + oq21_costs_tariffs(t,i,k_trade,"upper") = q21_costs_tariffs.up(i,k_trade); + oq21_costs_margins(t,i,k_trade,"upper") = q21_costs_margins.up(i,k_trade); + oq21_cost_trade_reg(t,i,k_trade,"upper") = q21_cost_trade_reg.up(i,k_trade); + oq21_cost_trade_reg(t,i,k_trade,"upper") = q21_cost_trade_reg.up(i,k_trade); + oq21_cost_trade(t,i,"upper") = q21_cost_trade.up(i); + ov21_excess_dem(t,k_trade,"lower") = v21_excess_dem.lo(k_trade); + ov21_excess_prod(t,h,k_trade,"lower") = v21_excess_prod.lo(h,k_trade); + ov21_trade(t,i_ex,i_im,k_trade,"lower") = v21_trade.lo(i_ex,i_im,k_trade); + ov21_cost_tariff_reg(t,i,k_trade,"lower") = v21_cost_tariff_reg.lo(i,k_trade); + ov21_cost_margin_reg(t,i,k_trade,"lower") = v21_cost_margin_reg.lo(i,k_trade); + ov_cost_trade(t,i,"lower") = vm_cost_trade.lo(i); + ov21_cost_trade_reg(t,i,k_trade,"lower") = v21_cost_trade_reg.lo(i,k_trade); + oq21_trade_glo(t,k_trade,"lower") = q21_trade_glo.lo(k_trade); + oq21_notrade(t,h,k_notrade,"lower") = q21_notrade.lo(h,k_notrade); + oq21_trade_reg(t,h,k_trade,"lower") = q21_trade_reg.lo(h,k_trade); + oq21_trade_reg_up(t,h,k_trade,"lower") = q21_trade_reg_up.lo(h,k_trade); + oq21_excess_dem(t,k_trade,"lower") = q21_excess_dem.lo(k_trade); + oq21_excess_supply(t,h,k_trade,"lower") = q21_excess_supply.lo(h,k_trade); + oq21_trade_bilat(t,h,k_trade,"lower") = q21_trade_bilat.lo(h,k_trade); + oq21_costs_tariffs(t,i,k_trade,"lower") = q21_costs_tariffs.lo(i,k_trade); + oq21_costs_margins(t,i,k_trade,"lower") = q21_costs_margins.lo(i,k_trade); + oq21_cost_trade_reg(t,i,k_trade,"lower") = q21_cost_trade_reg.lo(i,k_trade); + oq21_cost_trade_reg(t,i,k_trade,"lower") = q21_cost_trade_reg.lo(i,k_trade); + oq21_cost_trade(t,i,"lower") = q21_cost_trade.lo(i); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/21_trade/selfsuff_reduced_bilateral22/preloop.gms b/modules/21_trade/selfsuff_reduced_bilateral22/preloop.gms new file mode 100644 index 0000000000..5b78c5c4d8 --- /dev/null +++ b/modules/21_trade/selfsuff_reduced_bilateral22/preloop.gms @@ -0,0 +1,37 @@ +*** | (C) 2008-2023 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 + +i21_trade_bal_reduction(t_all,k_trade)=f21_trade_bal_reduction(t_all,"easytrade","%c21_trade_liberalization%"); +i21_trade_bal_reduction(t_all,k_hardtrade21)=f21_trade_bal_reduction(t_all,"hardtrade","%c21_trade_liberalization%"); + +loop(t_all$(m_year(t_all)>=2015), +i21_trade_bal_reduction(t_all,"wood") = i21_trade_bal_reduction(t_all,"wood") * s21_trade_bal_damper; +); +i21_trade_bal_reduction(t_all,"woodfuel") = i21_trade_bal_reduction(t_all,"wood"); + +i21_trade_margin(i_ex,i_im,k_trade) = f21_trade_margin(i_ex,i_im,k_trade); + +if ((s21_trade_tariff=1), + i21_trade_tariff(t_all, i_ex,i_im,k_trade) = f21_trade_tariff(i_ex,i_im,k_trade); +elseif (s21_trade_tariff=0), + i21_trade_tariff(t_all, i_ex,i_im,k_trade) = 0; +); + +if ((s21_trade_tariff_fadeout=1), +loop(t_all, + i21_trade_tariff(t_all,i_ex,i_im,k_trade)$(m_year(t_all) > s21_trade_tariff_startyear AND m_year(t_all) < s21_trade_tariff_targetyear) = (1-((m_year(t_all)-s21_trade_tariff_startyear) / + (s21_trade_tariff_targetyear-s21_trade_tariff_startyear)) * + i21_trade_tariff(t_all,i_ex,i_im,k_trade)); +i21_trade_tariff(t_all,i_ex,i_im,k_trade)$(m_year(t_all) <= s21_trade_tariff_startyear) = i21_trade_tariff(t_all,i_ex,i_im,k_trade); +i21_trade_tariff(t_all,i_ex,i_im,k_trade)$(m_year(t_all) >= s21_trade_tariff_targetyear) = 0 ; +); +); + +pm_selfsuff_ext(t_ext,h,kforestry) = f21_self_suff("y2150",h,kforestry); +pm_selfsuff_ext(t_all,h,kforestry) = f21_self_suff(t_all,h,kforestry); +*Implausible jumps in selfsuff for wood in some regions. +pm_selfsuff_ext(tstart21,h,kforestry) = f21_self_suff("y2010",h,kforestry); diff --git a/modules/21_trade/selfsuff_reduced_bilateral22/realization.gms b/modules/21_trade/selfsuff_reduced_bilateral22/realization.gms new file mode 100644 index 0000000000..b56307c997 --- /dev/null +++ b/modules/21_trade/selfsuff_reduced_bilateral22/realization.gms @@ -0,0 +1,35 @@ +*** | (C) 2008-2023 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 Within this realization, there are two ways for a region to fulfill +*' its demand for agricultural products: a self-sufficiency pool based on +*' historical region specific trade patterns, and a comparative advantage pool +*' based on most cost-efficient production. + +*' In the self-sufficiency pool, regional self-sufficiency ratios `f21_self_suff_seedred_1995(i,k)` defines +*' how much of the demand of each region `i` for each traded goods `k_trade` has to be met by domestic production. +*' Self sufficiency ratios smaller than one indicate that the region imports from the world market, +*' while self-sufficiencies greater than one indicate that the region produces for export. + +*' This realization uses world-region-level bilateral trade margins and tariffs for traded goods. +*' +*' ![Implementation of trade.](trade_pools.png){ width=100% } + +*' @limitations This realization depends on predetermined self-sufficiency rates and export shares, +*' which leads to a relative fixed trade pattern. Bilateral trade happens within the above, based on bilateral tariffs and margins. +*' Other notable difference from selfsuff_reduced is that bilateral margins are now defined over regions (as these are transport costs) +*' as opposed to super-regions (which delimit free trade zones or similar large regions) + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/21_trade/selfsuff_reduced_bilateral22/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/21_trade/selfsuff_reduced_bilateral22/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/21_trade/selfsuff_reduced_bilateral22/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/21_trade/selfsuff_reduced_bilateral22/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/21_trade/selfsuff_reduced_bilateral22/scaling.gms" +$Ifi "%phase%" == "preloop" $include "./modules/21_trade/selfsuff_reduced_bilateral22/preloop.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/21_trade/selfsuff_reduced_bilateral22/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/21_trade/selfsuff_reduced_bilateral22/scaling.gms b/modules/21_trade/selfsuff_reduced_bilateral22/scaling.gms new file mode 100644 index 0000000000..723b9957f0 --- /dev/null +++ b/modules/21_trade/selfsuff_reduced_bilateral22/scaling.gms @@ -0,0 +1,9 @@ +*** | (C) 2008-2023 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_trade.scale(i) = 10e4; +v21_cost_trade_reg.scale(i,k_trade) = 10e2; diff --git a/modules/21_trade/selfsuff_reduced_bilateral22/sets.gms b/modules/21_trade/selfsuff_reduced_bilateral22/sets.gms new file mode 100644 index 0000000000..c49d2f7cf1 --- /dev/null +++ b/modules/21_trade/selfsuff_reduced_bilateral22/sets.gms @@ -0,0 +1,59 @@ +*** | (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 + tstart21(t_all) Historic time steps + / y1995, y2000, y2005, y2010 / + +*sets need to be adopted to new categories + k_notrade(kall) Production activities of non-tradable commodites + / oilpalm, foddr, pasture, res_cereals, res_fibrous, res_nonfibrous,begr,betr / +* oilpalm not traded, only its oil and oilcake due to FAOSTAT complications, and as trade is little +* foddr is not traded as too bulky +* pasture it not traded as too bulky +* begr and betr are not traded because biomass is traded in REMIND + k_trade(kall) Production activities of tradable commodities + / tece,maiz,trce,rice_pro,soybean,rapeseed,groundnut,sunflower,puls_pro, + potato,cassav_sp,sugr_cane,sugr_beet,others,cottn_pro, + oils,oilcakes,sugar,molasses,alcohol,ethanol,distillers_grain,brans,scp,fibres, + livst_rum, livst_pig,livst_chick, livst_egg, livst_milk, fish, wood, woodfuel / + +* We limit trade of secondary products as this allows for extreme specialisation +* in the implementation. Exception is sugar, where we allow the secondary product +* trade but not the primary as primaries are hardly traded in reality + k_hardtrade21(k_trade) Products where trade should be limited + / sugr_cane,sugr_beet, + oils,oilcakes,alcohol,ethanol,distillers_grain,brans,scp,fibres, + livst_rum, livst_pig,livst_chick, livst_egg, livst_milk, fish / + + trade_regime21 Trade scenarios + / + free2000, + regionalized, + globalized, + fragmented, + a909090, + a908080, + a909595, + a808080, + a807070, + a809090, + l909090r808080, + l908080r807070, + l909595r809090 + / + + trade_groups21 Trade groups + / easytrade,hardtrade / + +; + +alias(h,h3); +alias(h,h_ex); +alias(h,h_im); +alias(i,i_ex); +alias(i,i_im); diff --git a/modules/21_trade/selfsuff_reduced_bilateral22/trade_pools.png b/modules/21_trade/selfsuff_reduced_bilateral22/trade_pools.png new file mode 100644 index 0000000000..327aee8ad4 Binary files /dev/null and b/modules/21_trade/selfsuff_reduced_bilateral22/trade_pools.png differ diff --git a/modules/22_land_conservation/area_based_apr22/declarations.gms b/modules/22_land_conservation/area_based_apr22/declarations.gms new file mode 100644 index 0000000000..a19f26a3d6 --- /dev/null +++ b/modules/22_land_conservation/area_based_apr22/declarations.gms @@ -0,0 +1,24 @@ +*** | (C) 2008-2023 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 + +scalars + s22_shift number of 5-year age-classes corresponding to current time step length (1) +; + +parameters + p22_conservation_area(t,j,land) Total land conservation area for all land types (mio. ha) + pm_land_conservation(t,j,land,consv_type) Land protection and restoration for all land types (mio. ha) + p22_conservation_fader(t_all) Land conservation fader (1) + p22_add_consv(t,j,consv22_all,land) Addtional land conservation in conservation priority areas (mio. ha) + p22_secdforest_restore_pot(t,j) Potential secondary forest restoration area (mio. ha) + p22_past_restore_pot(t,j) Potential pasture restoration area (mio. ha) + p22_other_restore_pot(t,j) Potential other land restoration area (mio. ha) + p22_country_weight(i) Land conservation country weight per region (1) + p22_country_dummy(iso) Dummy parameter indicating whether country is affected by selected land conservation policy (1) + i22_land_iso(iso) Total land area at ISO level (mio. ha) +; + diff --git a/modules/22_land_conservation/area_based_apr22/input.gms b/modules/22_land_conservation/area_based_apr22/input.gms new file mode 100644 index 0000000000..71b39fa69a --- /dev/null +++ b/modules/22_land_conservation/area_based_apr22/input.gms @@ -0,0 +1,61 @@ +*** | (C) 2008-2023 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 c22_protect_scenario none +$setglobal c22_protect_scenario_noselect none + +scalars +s22_restore_land If land restoration is allowed (0=no 1=yes) / 1 / +s22_conservation_start Land conservation start year / 2020 / +s22_conservation_target Land conservation target year / 2030 / +; + +* Set-switch for countries affected by regional land conservation policy +* Default: all iso countries selected +sets + policy_countries22(iso) countries to be affected by land conservation policy + / 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 / +; + +table f22_wdpa_baseline(t_all,j,land) Initial protected area as derived from WDPA until 2020 (mio. ha) +$ondelim +$include "./modules/22_land_conservation/input/wdpa_baseline.cs3" +$offdelim +; +* fix to 2020 values for years after 2020 +m_fillmissingyears(f22_wdpa_baseline,"j,land"); + +table f22_consv_prio(j,consv_prio22,land) Conservation priority areas (mio. ha) +$ondelim +$include "./modules/22_land_conservation/input/consv_prio_areas.cs3" +$offdelim +; + diff --git a/modules/22_land_conservation/area_based_apr22/preloop.gms b/modules/22_land_conservation/area_based_apr22/preloop.gms new file mode 100644 index 0000000000..965c36f7d2 --- /dev/null +++ b/modules/22_land_conservation/area_based_apr22/preloop.gms @@ -0,0 +1,36 @@ +*** | (C) 2008-2023 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 + +* -------------------------- +* Calculate country weights +* -------------------------- + +* Regional share of land conservation policies in selective countries: +* Country switch to determine countries for which land conservation shall be applied. +* In the default case, the land conservation affects all countries when activated. +p22_country_dummy(iso) = 0; +p22_country_dummy(policy_countries22) = 1; +* Because MAgPIE is not run at country-level, but at region level, a region +* share is calculated that translates the countries' influence to regional level. +* Countries are weighted by total land area. +i22_land_iso(iso) = sum(land, fm_land_iso("y1995",iso,land)); +p22_country_weight(i) = sum(i_to_iso(i,iso), p22_country_dummy(iso) * i22_land_iso(iso)) / sum(i_to_iso(i,iso), i22_land_iso(iso)); + +* --------------------------------------------------------------------- +* Initialise addtional land protection in conservation priority areas +* --------------------------------------------------------------------- + +** Trajectory for implementation of land conservation +* sigmoidal interpolation between 2020 and target year +m_sigmoid_interpol(p22_conservation_fader,s22_conservation_start,s22_conservation_target,0,1); + +** Initialise additional conservation area +p22_add_consv(t,j,consv22_all,land) = 0; + +* Get additional conservation area in conservation priority areas +p22_add_consv(t,j,consv_prio22,land) = f22_consv_prio(j,consv_prio22,land)*p22_conservation_fader(t); + diff --git a/modules/22_land_conservation/area_based_apr22/presolve.gms b/modules/22_land_conservation/area_based_apr22/presolve.gms new file mode 100644 index 0000000000..c8a25b07fa --- /dev/null +++ b/modules/22_land_conservation/area_based_apr22/presolve.gms @@ -0,0 +1,104 @@ +*** | (C) 2008-2023 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 + +* ================== +* Land conservation +* ================== + +* Define natural vegetation conservation options based on +* remaining natural vegation in current time step + +* Include all remaining primary forest areas in IFL conservation target +p22_add_consv(t,j,"IFL","primforest") = pcm_land(j,"primforest") * p22_conservation_fader(t); +p22_add_consv(t,j,"BH_IFL","primforest") = pcm_land(j,"primforest") * p22_conservation_fader(t); + + +if(m_year(t) <= sm_fix_SSP2, +* from 1995 to 2020 land conservation is based on +* historic trends as derived from WDPA + p22_conservation_area(t,j,land) = f22_wdpa_baseline(t,j,land); + +else + +** Future land conservation only pertains to natural vegetation classes (land_natveg) +p22_conservation_area(t,j,land) = f22_wdpa_baseline(t,j,land); +* future options for land conservation are added to the WDPA baseline +p22_conservation_area(t,j,land_natveg) = + f22_wdpa_baseline(t,j,land_natveg) + + sum(cell(i,j), + p22_add_consv(t,j,"%c22_protect_scenario%",land_natveg) * p22_country_weight(i) + + p22_add_consv(t,j,"%c22_protect_scenario_noselect%",land_natveg) * (1-p22_country_weight(i)) + ); +); + +* ----------------------- +* Protect remaining land +* ----------------------- + +* Note: protected area reported in the WDPA baseline data can be higher +* than what is reported in the LUH2v2 data. +pm_land_conservation(t,j,land,"protect") = p22_conservation_area(t,j,land); +pm_land_conservation(t,j,land,"protect")$(pm_land_conservation(t,j,land,"protect") > pcm_land(j,land)) = pcm_land(j,land); + + +* ------------------- +* Land restoration +* ------------------- + +if(s22_restore_land = 1 OR m_year(t) <= sm_fix_SSP2, + +** Calculate restoration targets +* Grassland +pm_land_conservation(t,j,"past","restore")$(p22_conservation_area(t,j,"past") > pcm_land(j,"past")) = + p22_conservation_area(t,j,"past") - pcm_land(j,"past"); +* Forest land +* Total forest restoration requirements are attributed to +* secdforest, as primforest cannot be restored by definition +pm_land_conservation(t,j,"secdforest","restore") = + (p22_conservation_area(t,j,"primforest") + p22_conservation_area(t,j,"secdforest")) + - (pcm_land(j,"primforest") + pcm_land(j,"secdforest")); +pm_land_conservation(t,j,"secdforest","restore")$(pm_land_conservation(t,j,"secdforest","restore") < 0) = 0; +* Other land +pm_land_conservation(t,j,"other","restore")$(p22_conservation_area(t,j,"other") > pcm_land(j,"other")) = + p22_conservation_area(t,j,"other") - pcm_land(j,"other"); + +* Adjust forest, grassland and other land restoration depending on given land available for restoration (restoration potential) + +* Secondary forest restoration is limited by secondary forest restoration potential +p22_secdforest_restore_pot(t,j) = sum(land, pcm_land(j, land)) + - pcm_land(j, "urban") + - sum(land_natveg, pcm_land(j, land_natveg)) + - pm_land_conservation(t,j,"past","protect"); +p22_secdforest_restore_pot(t,j)$(p22_secdforest_restore_pot(t,j) < 0) = 0; +pm_land_conservation(t,j,"secdforest","restore")$(pm_land_conservation(t,j,"secdforest","restore") > p22_secdforest_restore_pot(t,j)) = p22_secdforest_restore_pot(t,j); + +* Grassland restoration is limited by grassland restoration potential +p22_past_restore_pot(t,j) = sum(land, pcm_land(j, land)) + - pcm_land(j, "urban") + - sum(forest_land, pcm_land(j, forest_land)) + - pm_land_conservation(t,j,"past","protect") + - pm_land_conservation(t,j,"secdforest","restore"); +p22_past_restore_pot(t,j)$(p22_past_restore_pot(t,j) < 0) = 0; +pm_land_conservation(t,j,"past","restore")$(pm_land_conservation(t,j,"past","restore") > p22_past_restore_pot(t,j)) = p22_past_restore_pot(t,j); + +* Other land restoration is limited by other land restoration potential +p22_other_restore_pot(t,j) = sum(land, pcm_land(j, land)) + - pcm_land(j, "urban") + - sum(forest_land, pcm_land(j, forest_land)) + - sum(consv_type, pm_land_conservation(t,j,"past",consv_type)) + - pm_land_conservation(t,j,"secdforest","restore"); +p22_other_restore_pot(t,j)$(p22_other_restore_pot(t,j) < 0) = 0; +pm_land_conservation(t,j,"other","restore")$(pm_land_conservation(t,j,"other","restore") > p22_other_restore_pot(t,j)) = p22_other_restore_pot(t,j); + +else + +* set restoration to zero +pm_land_conservation(t,j,land,"restore") = 0; + +); + + diff --git a/modules/22_land_conservation/area_based_apr22/realization.gms b/modules/22_land_conservation/area_based_apr22/realization.gms new file mode 100644 index 0000000000..493ad0414c --- /dev/null +++ b/modules/22_land_conservation/area_based_apr22/realization.gms @@ -0,0 +1,38 @@ +*** | (C) 2008-2023 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 realization initialises land stocks reserved for land conservation across +*' grassland, forest and other land pools. +*' Land reserved for area-based conservation is derived from WDPA and is based on observed +*' land conservation trends. In 1995, the total area under land conservation (across all land +*' types) in the input data set is 864.31 Mha and, by 5-year time steps, increases to +*' 1662.02 Mha in 2020 (13.06 % of the total land area, excluding inland water bodies under +*' protection). After 2020 land conservation is held constant at 2020 values. The protected area +*' based on WDPA includes all areas under legal protection meeting the IUCN and CBD protected +*' area definitions (including IUCN categories Ia, Ib, III, IV, V, VI and 'not assigned' but +*' legally designated areas). Natural vegetation (natveg) and grassland ('past') within protected +*' areas cannot be converted to other land types. On top of the WDPA baseline protection, there are +*' future options to protect different conservation priority areas such as biodiversity hotspots (BH), +*' centers of plant diversity (CBD), Intact Forest Landscapes (IFL) and last of the wild (LW), +*' taken from @brooks_global_2006. +*' Future land conservation is distributed proportionally across natural vegetation types +*' (primary forest, secondary forest and other natural land). +*' @stop + +*' +*' @limitations Land cover in the WDPA baseline data is estimated based on ESA-CCI +*' land-use/land-cover maps from 1995 to 2020, while land pools in MAgPIE are intialised +*' based on LUH2v2 data (forest areas are additionally harmonised with FAO data). +*' This leads to slight mismatches in some areas. + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/22_land_conservation/area_based_apr22/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/22_land_conservation/area_based_apr22/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/22_land_conservation/area_based_apr22/input.gms" +$Ifi "%phase%" == "preloop" $include "./modules/22_land_conservation/area_based_apr22/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/22_land_conservation/area_based_apr22/presolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/22_land_conservation/area_based_apr22/sets.gms b/modules/22_land_conservation/area_based_apr22/sets.gms new file mode 100644 index 0000000000..c3fd6518fa --- /dev/null +++ b/modules/22_land_conservation/area_based_apr22/sets.gms @@ -0,0 +1,23 @@ +*** | (C) 2008-2023 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 + + consv22_all All conservation options + / none, 30by30, KBA, GSN_DSA, GSN_RarePhen, GSN_AreaIntct, GSN_ClimTier1, GSN_ClimTier2, + BH, IFL, BH_IFL, IrrC_50pc, IrrC_75pc, IrrC_95pc, IrrC_99pc, IrrC_75pc_30by30, + IrrC_95pc_30by30, IrrC_99pc_30by30, IrrC_100pc, CCA, GSN_HalfEarth, PBL_HalfEarth / + + consv_prio22(consv22_all) Conservation priority areas + / 30by30, KBA, GSN_DSA, GSN_RarePhen, GSN_AreaIntct, GSN_ClimTier1, GSN_ClimTier2, + BH, IFL, BH_IFL, IrrC_50pc, IrrC_75pc, IrrC_95pc, IrrC_99pc, IrrC_75pc_30by30, + IrrC_95pc_30by30, IrrC_99pc_30by30, IrrC_100pc, CCA, GSN_HalfEarth, PBL_HalfEarth / + + consv_type Type of land conservation + / protect, restore / + +; diff --git a/modules/22_land_conservation/input/files b/modules/22_land_conservation/input/files new file mode 100644 index 0000000000..d9408d439e --- /dev/null +++ b/modules/22_land_conservation/input/files @@ -0,0 +1,6 @@ +* list of files that are required here +avl_land_t_iso.cs3 +wdpa_baseline.cs3 +wdpa_baseline_0.5.mz +consv_prio_areas.cs3 +consv_prio_areas_0.5.mz diff --git a/modules/22_land_conservation/module.gms b/modules/22_land_conservation/module.gms new file mode 100644 index 0000000000..6b4cdf48b0 --- /dev/null +++ b/modules/22_land_conservation/module.gms @@ -0,0 +1,22 @@ +*** | (C) 2008-2023 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 + +*' @title Land conservation +*' +*' @description The land conservation (land_conservation) module initialises +*' land under legal protection for all land types, and provides future +*' options for land conservation based on conservation priority areas. +*' Based on the land area of the different land-use types (`pcm_land`) +*' from the previous time step, this module also calculates restoration +*' requirements to fulfil land conservation targets. Both the information on +*' the protection of remaining land areas as well as information on restoration +*' is transferred to the other land modules via the interface `pm_land_conservation`. +*' @authors Patrick v. Jeetze + +*###################### R SECTION START (MODULETYPES) ########################## +$Ifi "%land_conservation%" == "area_based_apr22" $include "./modules/22_land_conservation/area_based_apr22/realization.gms" +*###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/29_ageclass/feb21/declarations.gms b/modules/29_ageclass/feb21/declarations.gms index ed2d5d10eb..f1aef51a7f 100644 --- a/modules/29_ageclass/feb21/declarations.gms +++ b/modules/29_ageclass/feb21/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/29_ageclass/feb21/input.gms b/modules/29_ageclass/feb21/input.gms index ef340c6e29..cfabaa0fcf 100644 --- a/modules/29_ageclass/feb21/input.gms +++ b/modules/29_ageclass/feb21/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/29_ageclass/feb21/preloop.gms b/modules/29_ageclass/feb21/preloop.gms index 76900ff709..0d6b2c88f5 100644 --- a/modules/29_ageclass/feb21/preloop.gms +++ b/modules/29_ageclass/feb21/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/29_ageclass/feb21/realization.gms b/modules/29_ageclass/feb21/realization.gms index 0a8f6fab35..7fe7990889 100644 --- a/modules/29_ageclass/feb21/realization.gms +++ b/modules/29_ageclass/feb21/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/29_ageclass/feb21/sets.gms b/modules/29_ageclass/feb21/sets.gms index 7e57679e1f..2f1910db43 100644 --- a/modules/29_ageclass/feb21/sets.gms +++ b/modules/29_ageclass/feb21/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/29_ageclass/module.gms b/modules/29_ageclass/module.gms index 72b994682e..17a3499c44 100644 --- a/modules/29_ageclass/module.gms +++ b/modules/29_ageclass/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/30_crop/endo_apr21/declarations.gms b/modules/30_crop/endo_apr21/declarations.gms new file mode 100644 index 0000000000..628262432a --- /dev/null +++ b/modules/30_crop/endo_apr21/declarations.gms @@ -0,0 +1,54 @@ +*** | (C) 2008-2023 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 + +parameters + p30_avl_cropland(t,j) Total available land for crop cultivation (mio. ha) + p30_country_snv_weight(i) SNV policy country weight per region (1) + p30_snv_shr(t,j) Share of semi-natural vegetation in cropland areas (1) + p30_country_dummy(iso) Dummy parameter indicating whether country is affected by selected SNV policy (1) + i30_avl_cropland_iso(iso) Available land area for cropland at ISO level (mio. ha) + p30_snv_scenario_fader(t_all) SNV scenario fader (1) + p30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) +; + +positive variables +* Fallow land is cropland which is temporarily fallow. Croparea+fallow=cropland + vm_fallow(j) Fallow land (mio. ha) + vm_area(j,kcr,w) Agricultural production area (mio. ha) + vm_rotation_penalty(i) Penalty for violating rotational constraints (USD05MER) +; + +equations + q30_cropland(j) Total cropland calculation (mio. ha) + q30_avl_cropland(j) Available cropland constraint (mio. ha) + q30_rotation_max(j,crp30,w) Local maximum rotational constraints (mio. ha) + q30_rotation_min(j,crp30,w) Local minimum rotational constraints (mio. ha) + q30_prod(j,kcr) Production of cropped products (mio. tDM) + q30_carbon(j,ag_pools,stockType) Cropland above ground carbon content calculation (mio. tC) + q30_bv_ann(j,potnatveg) Biodiversity value of annual cropland (mio. ha) + q30_bv_per(j,potnatveg) Biodiversity value of perennial cropland (mio. ha) + q30_land_snv(j) Land constraint for the SNV policy in cropland areas (mio. ha) +; + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov_fallow(t,j,type) Fallow land (mio. ha) + ov_area(t,j,kcr,w,type) Agricultural production area (mio. ha) + ov_rotation_penalty(t,i,type) Penalty for violating rotational constraints (USD05MER) + oq30_cropland(t,j,type) Total cropland calculation (mio. ha) + oq30_avl_cropland(t,j,type) Available cropland constraint (mio. ha) + oq30_rotation_max(t,j,crp30,w,type) Local maximum rotational constraints (mio. ha) + oq30_rotation_min(t,j,crp30,w,type) Local minimum rotational constraints (mio. ha) + oq30_prod(t,j,kcr,type) Production of cropped products (mio. tDM) + oq30_carbon(t,j,ag_pools,stockType,type) Cropland above ground carbon content calculation (mio. tC) + oq30_bv_ann(t,j,potnatveg,type) Biodiversity value of annual cropland (mio. ha) + oq30_bv_per(t,j,potnatveg,type) Biodiversity value of perennial cropland (mio. ha) + oq30_land_snv(t,j,type) Land constraint for the SNV policy in cropland areas (mio. ha) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### + +*** EOF declarations.gms *** diff --git a/modules/30_crop/endo_jun13/equations.gms b/modules/30_crop/endo_apr21/equations.gms similarity index 53% rename from modules/30_crop/endo_jun13/equations.gms rename to modules/30_crop/endo_apr21/equations.gms index a420899db4..da0f4ce868 100644 --- a/modules/30_crop/endo_jun13/equations.gms +++ b/modules/30_crop/endo_apr21/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -12,13 +12,25 @@ q30_cropland(j2) .. sum((kcr,w), vm_area(j2,kcr,w)) =e= vm_land(j2,"crop"); -*' We assume that crop production can only take place on suitable cropland area; -*' we use a suitability index (SI) map from @ramankutty_suitability_2002 to exclude areas -*' from cropland production that have low suitability, e.g. due to strong slopes. -*' The cultivated area therefore has to be smaller than the "si0" cropland area: +*' We assume that crop production can only take place on suitable cropland area. +*' We use a suitability index (SI) map from @zabel_global_2014 to exclude areas +*' from cropland production that have a low suitability, e.g. due to steep slopes, +*' to estimate the available cropland area. The cultivated area therefore has +*' to be smaller than the available cropland area. Moreover, the available cropland +*' can be reduced by constraining the cropland area in favour of other land types, +*' in order to increase compositional heterogeneity of land types at the cell level. - q30_suitability(j2) .. - vm_land(j2,"crop") =l= f30_land_si(j2,"si0"); + q30_avl_cropland(j2) .. + vm_land(j2,"crop") =l= sum(ct, p30_avl_cropland(ct,j2)); + +*' The semi-natural land constraint in cropland areas for sustaining critical regulating NCP +*' for agricultural production is added on top of land conserved for other reasons +*' (e.g. conservation of intact ecosystems or protection of biodiversity hotspots). + q30_land_snv(j2) .. + sum(land_snv, vm_land(j2,land_snv)) + =g= + sum(ct, p30_snv_shr(ct,j2)) * vm_land(j2,"crop") + + sum((ct,land_snv,consv_type), pm_land_conservation(ct,j2,land_snv,consv_type)); *' As additional constraints minimum and maximum rotational constraints limit *' the placing of crops. On the one hand, these rotational constraints reflect @@ -43,22 +55,19 @@ q30_prod(j2,kcr) .. vm_prod(j2,kcr) =e= sum(w, vm_area(j2,kcr,w) * vm_yld(j2,kcr,w)); -*' Due to the high uncertainty in 2nd generation bioenergy production, irrigated -*' production of bioenergy is deactivated (see presolve statements of crop -*' realization). - *' The carbon content of the above ground carbon pools are calculated as a total *' for all cropland : - q30_carbon(j2,ag_pools) .. - vm_carbon_stock(j2,"crop",ag_pools) =e= - vm_land(j2,"crop") * sum(ct,fm_carbon_density(ct,j2,"crop",ag_pools)); + q30_carbon(j2,ag_pools,stockType) .. + vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= + m_carbon_stock(vm_land,fm_carbon_density,"crop"); *' The biodiversity value for cropland is calculated separately for annual and perennial crops: q30_bv_ann(j2,potnatveg) .. vm_bv(j2,"crop_ann",potnatveg) - =e= - sum((crop_ann30,w), vm_area(j2,crop_ann30,w)) * fm_bii_coeff("crop_ann",potnatveg) * fm_luh2_side_layers(j2,potnatveg); + =e= + sum((crop_ann30,w), vm_area(j2,crop_ann30,w)) * fm_bii_coeff("crop_ann",potnatveg) * fm_luh2_side_layers(j2,potnatveg); q30_bv_per(j2,potnatveg) .. vm_bv(j2,"crop_per",potnatveg) - =e= - sum((crop_per30,w), vm_area(j2,crop_per30,w)) * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); + =e= + (vm_land(j2,"crop") - sum((crop_ann30,w), vm_area(j2,crop_ann30,w))) + * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); diff --git a/modules/30_crop/endo_apr21/input.gms b/modules/30_crop/endo_apr21/input.gms new file mode 100644 index 0000000000..db30cd69a8 --- /dev/null +++ b/modules/30_crop/endo_apr21/input.gms @@ -0,0 +1,115 @@ +*** | (C) 2008-2023 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 c30_bioen_type all +* options: begr, betr, all + +$setglobal c30_bioen_water rainfed +* options: rainfed, irrigated, all + +$setglobal c30_marginal_land q33_marginal +* options: all_marginal, q33_marginal, no_marginal + +$setglobal c30_snv_target none +* options: none, by2030, by2020 + +$setglobal c30_rotation_constraints on +*options: on, off + +scalars +s30_snv_shr Share of available cropland that is witheld for other land cover types (1) / 0 / +s30_snv_shr_noselect Share of available cropland that is witheld for other land cover types (1) / 0 / +s30_snv_scenario_start SNV scenario start year / 2020 / +s30_snv_scenario_target SNV scenario target year / 2030 / +s30_rotation_scenario_start Rotation scenario start year / 2020 / +s30_rotation_scenario_target Rotation scenario target year / 2050 / +; + +* Set-switch for countries affected by regional SNV policy +* Default: all iso countries selected +sets + policy_countries30(iso) countries to be affected by SNV policy / 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 / + +land_snv(land) land types allowed in the SNV policy / secdforest, forestry, past, other / +; + +$ifthen "%c30_bioen_type%" == "all" bioen_type_30(kbe30) = yes; +$else bioen_type_30("%c30_bioen_type%") = yes; +$endif + +$ifthen "%c30_bioen_water%" == "all" bioen_water_30(w) = yes; +$else bioen_water_30("%c30_bioen_water%") = yes; +$endif + +********* CROPAREA INITIALISATION ********************************************** + +table fm_croparea(t_all,j,w,kcr) Different croparea type areas (mio. ha) +$ondelim +$include "./modules/30_crop/endo_apr21/input/f30_croparea_w_initialisation.cs3" +$offdelim +; +m_fillmissingyears(fm_croparea,"j,w,kcr"); + +********* CROP-ROTATIONAL CONSTRAINT ******************************************* + +parameter f30_rotation_max_shr(crp30) Maximum allowed area shares for each crop type (1) +/ +$ondelim +$include "./modules/30_crop/endo_apr21/input/f30_rotation_max.csv" +$offdelim +/; +$if "%c30_rotation_constraints%" == "off" f30_rotation_max_shr(crp30) = 1; + + +parameter f30_rotation_min_shr(crp30) Minimum allowed area shares for each crop type (1) +/ +$ondelim +$include "./modules/30_crop/endo_apr21/input/f30_rotation_min.csv" +$offdelim +/; +$if "%c30_rotation_constraints%" == "off" f30_rotation_min_shr(crp30) = 0; + + +********* AVAILABLE CROPLAND ******************************************* + + +table f30_avl_cropland(j,marginal_land30) Available land area for cropland (mio. ha) +$ondelim +$include "./modules/30_crop/endo_apr21/input/avl_cropland.cs3" +$offdelim +; + +table f30_avl_cropland_iso(iso,marginal_land30) Available land area for cropland at ISO level (mio. ha) +$ondelim +$include "./modules/30_crop/endo_apr21/input/avl_cropland_iso.cs3" +$offdelim +; + diff --git a/modules/30_crop/endo_apr21/input/files b/modules/30_crop/endo_apr21/input/files new file mode 100644 index 0000000000..d3bdc6145d --- /dev/null +++ b/modules/30_crop/endo_apr21/input/files @@ -0,0 +1,7 @@ +* list of files that are required here +f30_rotation_max.csv +f30_rotation_min.csv +avl_cropland.cs3 +avl_cropland_0.5.mz +f30_croparea_w_initialisation.cs3 +avl_cropland_iso.cs3 diff --git a/modules/30_crop/endo_apr21/not_used.txt b/modules/30_crop/endo_apr21/not_used.txt new file mode 100644 index 0000000000..1fd7a8461c --- /dev/null +++ b/modules/30_crop/endo_apr21/not_used.txt @@ -0,0 +1,2 @@ +name,type,reason +vm_AEI,input,questionnaire diff --git a/modules/30_crop/endo_apr21/postsolve.gms b/modules/30_crop/endo_apr21/postsolve.gms new file mode 100644 index 0000000000..33550027e2 --- /dev/null +++ b/modules/30_crop/endo_apr21/postsolve.gms @@ -0,0 +1,58 @@ +*** | (C) 2008-2023 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_fallow(t,j,"marginal") = vm_fallow.m(j); + ov_area(t,j,kcr,w,"marginal") = vm_area.m(j,kcr,w); + ov_rotation_penalty(t,i,"marginal") = vm_rotation_penalty.m(i); + oq30_cropland(t,j,"marginal") = q30_cropland.m(j); + oq30_avl_cropland(t,j,"marginal") = q30_avl_cropland.m(j); + oq30_rotation_max(t,j,crp30,w,"marginal") = q30_rotation_max.m(j,crp30,w); + oq30_rotation_min(t,j,crp30,w,"marginal") = q30_rotation_min.m(j,crp30,w); + oq30_prod(t,j,kcr,"marginal") = q30_prod.m(j,kcr); + oq30_carbon(t,j,ag_pools,stockType,"marginal") = q30_carbon.m(j,ag_pools,stockType); + oq30_bv_ann(t,j,potnatveg,"marginal") = q30_bv_ann.m(j,potnatveg); + oq30_bv_per(t,j,potnatveg,"marginal") = q30_bv_per.m(j,potnatveg); + oq30_land_snv(t,j,"marginal") = q30_land_snv.m(j); + ov_fallow(t,j,"level") = vm_fallow.l(j); + ov_area(t,j,kcr,w,"level") = vm_area.l(j,kcr,w); + ov_rotation_penalty(t,i,"level") = vm_rotation_penalty.l(i); + oq30_cropland(t,j,"level") = q30_cropland.l(j); + oq30_avl_cropland(t,j,"level") = q30_avl_cropland.l(j); + oq30_rotation_max(t,j,crp30,w,"level") = q30_rotation_max.l(j,crp30,w); + oq30_rotation_min(t,j,crp30,w,"level") = q30_rotation_min.l(j,crp30,w); + oq30_prod(t,j,kcr,"level") = q30_prod.l(j,kcr); + oq30_carbon(t,j,ag_pools,stockType,"level") = q30_carbon.l(j,ag_pools,stockType); + oq30_bv_ann(t,j,potnatveg,"level") = q30_bv_ann.l(j,potnatveg); + oq30_bv_per(t,j,potnatveg,"level") = q30_bv_per.l(j,potnatveg); + oq30_land_snv(t,j,"level") = q30_land_snv.l(j); + ov_fallow(t,j,"upper") = vm_fallow.up(j); + ov_area(t,j,kcr,w,"upper") = vm_area.up(j,kcr,w); + ov_rotation_penalty(t,i,"upper") = vm_rotation_penalty.up(i); + oq30_cropland(t,j,"upper") = q30_cropland.up(j); + oq30_avl_cropland(t,j,"upper") = q30_avl_cropland.up(j); + oq30_rotation_max(t,j,crp30,w,"upper") = q30_rotation_max.up(j,crp30,w); + oq30_rotation_min(t,j,crp30,w,"upper") = q30_rotation_min.up(j,crp30,w); + oq30_prod(t,j,kcr,"upper") = q30_prod.up(j,kcr); + oq30_carbon(t,j,ag_pools,stockType,"upper") = q30_carbon.up(j,ag_pools,stockType); + oq30_bv_ann(t,j,potnatveg,"upper") = q30_bv_ann.up(j,potnatveg); + oq30_bv_per(t,j,potnatveg,"upper") = q30_bv_per.up(j,potnatveg); + oq30_land_snv(t,j,"upper") = q30_land_snv.up(j); + ov_fallow(t,j,"lower") = vm_fallow.lo(j); + ov_area(t,j,kcr,w,"lower") = vm_area.lo(j,kcr,w); + ov_rotation_penalty(t,i,"lower") = vm_rotation_penalty.lo(i); + oq30_cropland(t,j,"lower") = q30_cropland.lo(j); + oq30_avl_cropland(t,j,"lower") = q30_avl_cropland.lo(j); + oq30_rotation_max(t,j,crp30,w,"lower") = q30_rotation_max.lo(j,crp30,w); + oq30_rotation_min(t,j,crp30,w,"lower") = q30_rotation_min.lo(j,crp30,w); + oq30_prod(t,j,kcr,"lower") = q30_prod.lo(j,kcr); + oq30_carbon(t,j,ag_pools,stockType,"lower") = q30_carbon.lo(j,ag_pools,stockType); + oq30_bv_ann(t,j,potnatveg,"lower") = q30_bv_ann.lo(j,potnatveg); + oq30_bv_per(t,j,potnatveg,"lower") = q30_bv_per.lo(j,potnatveg); + oq30_land_snv(t,j,"lower") = q30_land_snv.lo(j); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/30_crop/endo_apr21/preloop.gms b/modules/30_crop/endo_apr21/preloop.gms new file mode 100644 index 0000000000..695f756062 --- /dev/null +++ b/modules/30_crop/endo_apr21/preloop.gms @@ -0,0 +1,27 @@ +*** | (C) 2008-2023 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 + +** Trajectory for cropland scenarios +* sigmoidal interpolation between start year and target year +m_sigmoid_interpol(p30_snv_scenario_fader,s30_snv_scenario_start,s30_snv_scenario_target,0,1); +m_sigmoid_interpol(p30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1); + +*due to some rounding errors the input data currently may contain in some cases +*very small, negative numbers. These numbers have to be set to 0 as area +*cannot be smaller than 0! +fm_croparea(t_past,j,w,kcr)$(fm_croparea(t_past,j,w,kcr)<0) = 0; + +****** Regional share of semi-natural vegetation (SNV) in cropland areas for selective countries: +* Country switch to determine countries for which a SNV policy shall be applied. +* In the default case, the SNV policy affects all countries when activated. +p30_country_dummy(iso) = 0; +p30_country_dummy(policy_countries30) = 1; +* Because MAgPIE is not run at country-level, but at region level, a region +* share is calculated that translates the countries' influence to regional level. +* Countries are weighted by available cropland area. +i30_avl_cropland_iso(iso) = f30_avl_cropland_iso(iso,"%c30_marginal_land%"); +p30_country_snv_weight(i) = sum(i_to_iso(i,iso), p30_country_dummy(iso) * i30_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), i30_avl_cropland_iso(iso)); diff --git a/modules/30_crop/endo_apr21/presolve.gms b/modules/30_crop/endo_apr21/presolve.gms new file mode 100644 index 0000000000..efcc51f181 --- /dev/null +++ b/modules/30_crop/endo_apr21/presolve.gms @@ -0,0 +1,38 @@ +*** | (C) 2008-2023 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 +*' First, all 2nd generation bioenergy area is fixed to zero, irrespective of type and +*' rainfed/irrigation. +vm_area.fx(j,kbe30,w)=0; +*' Second, the bounds for 2nd generation bioenergy area are released depending on +*' the dynamic sets bioen_type_30 and bioen_water_30. +*' SSP2 default settings are used for the historic period. +if(m_year(t) <= sm_fix_SSP2, + vm_area.up(j,kbe30,"rainfed") = Inf; +else + vm_area.up(j,bioen_type_30,bioen_water_30) = Inf; +); + +*' @stop + +*' No penalties or fallows exist in this realization +vm_rotation_penalty.fx(i)=0; +vm_fallow.fx(j)=0; + +crpmax30(crp30) = yes$(f30_rotation_max_shr(crp30) < 1); +crpmin30(crp30) = yes$(f30_rotation_min_shr(crp30) > 0); + +*' @code +*' Minimum semi-natural vegetation (SNV) share is fading in after 2020 +p30_snv_shr(t,j) = p30_snv_scenario_fader(t) * + (s30_snv_shr * sum(cell(i,j), p30_country_snv_weight(i)) + + s30_snv_shr_noselect * sum(cell(i,j), 1-p30_country_snv_weight(i))); + +*' Area potentially available for cropping +p30_avl_cropland(t,j) = f30_avl_cropland(j,"%c30_marginal_land%") * (1 - p30_snv_shr(t,j)); +*' @stop diff --git a/modules/30_crop/endo_jun13/realization.gms b/modules/30_crop/endo_apr21/realization.gms similarity index 54% rename from modules/30_crop/endo_jun13/realization.gms rename to modules/30_crop/endo_apr21/realization.gms index c1b673ead8..fd9be43c26 100644 --- a/modules/30_crop/endo_jun13/realization.gms +++ b/modules/30_crop/endo_apr21/realization.gms @@ -1,13 +1,13 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 endo_jun13 realization calculates the crop specific +*' @description The endo_apr21 realization calculates the crop specific *' agricultural land use endogenously based on yield data coming from the -*' module [14_yields] and the rotational as well as suitability constrains +*' module [14_yields] and the rotational as well as suitability constraints *' stated in the input data of the module. *' *' Cropland areas are linked to the crop specific production and the carbon @@ -16,14 +16,20 @@ *' [41_area_equipped_for_irrigation], [42_water_demand], [50_nr_soil_budget], *' [53_methane] and [59_som]. +*' This realisation also includes the option to reserve a minimum semi-natural +*' vegetation share within the total available cropland for other land cover +*' classes, including grassland, forest, and other land (by a given target year), +*' in order to provide species habitats and to benefit from ecosystem ervices in +*' agricultural landscapes. + *' @limitations There are currently no known limitations of this realization. *####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/30_crop/endo_jun13/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/30_crop/endo_jun13/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/30_crop/endo_jun13/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/30_crop/endo_jun13/equations.gms" -$Ifi "%phase%" == "preloop" $include "./modules/30_crop/endo_jun13/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/30_crop/endo_jun13/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/30_crop/endo_jun13/postsolve.gms" +$Ifi "%phase%" == "sets" $include "./modules/30_crop/endo_apr21/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/30_crop/endo_apr21/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/30_crop/endo_apr21/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/30_crop/endo_apr21/equations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/30_crop/endo_apr21/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/30_crop/endo_apr21/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/30_crop/endo_apr21/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/30_crop/endo_jun13/sets.gms b/modules/30_crop/endo_apr21/sets.gms similarity index 88% rename from modules/30_crop/endo_jun13/sets.gms rename to modules/30_crop/endo_apr21/sets.gms index 473114e202..e32d366b49 100644 --- a/modules/30_crop/endo_jun13/sets.gms +++ b/modules/30_crop/endo_apr21/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -48,4 +48,9 @@ sets crop_per30(kcr) perennial crops / oilpalm, begr, sugr_cane, betr / + marginal_land30 Marginal land scenarios + / all_marginal, q33_marginal, no_marginal / + + policy_target30 Target year for cropland policy + / none, by2030, by2050 / ; diff --git a/modules/30_crop/endo_jun13/declarations.gms b/modules/30_crop/endo_jun13/declarations.gms deleted file mode 100644 index c9a0a47fa6..0000000000 --- a/modules/30_crop/endo_jun13/declarations.gms +++ /dev/null @@ -1,41 +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 - -parameters - pm_croparea_start(j,kcr) Agricultural land initialization area (mio. ha) -; - -positive variables - vm_area(j,kcr,w) Agricultural production area (mio. ha) -; - -equations - q30_cropland(j) Total cropland calculation (mio. ha) - q30_suitability(j) Suitability constraint (mio. ha) - q30_rotation_max(j,crp30,w) Local maximum rotational constraints (mio. ha) - q30_rotation_min(j,crp30,w) Local minimum rotational constraints (mio. ha) - q30_prod(j,kcr) Production of cropped products (mio. tDM) - q30_carbon(j,ag_pools) Cropland above ground carbon content calculation (mio. tC) - q30_bv_ann(j,potnatveg) Biodiversity value of annual cropland (Mha) - q30_bv_per(j,potnatveg) Biodiversity value of perennial cropland (Mha) -; - -*#################### R SECTION START (OUTPUT DECLARATIONS) #################### -parameters - ov_area(t,j,kcr,w,type) Agricultural production area (mio. ha) - oq30_cropland(t,j,type) Total cropland calculation (mio. ha) - oq30_suitability(t,j,type) Suitability constraint (mio. ha) - oq30_rotation_max(t,j,crp30,w,type) Local maximum rotational constraints (mio. ha) - oq30_rotation_min(t,j,crp30,w,type) Local minimum rotational constraints (mio. ha) - oq30_prod(t,j,kcr,type) Production of cropped products (mio. tDM) - oq30_carbon(t,j,ag_pools,type) Cropland above ground carbon content calculation (mio. tC) - oq30_bv_ann(t,j,potnatveg,type) Biodiversity value of annual cropland (Mha) - oq30_bv_per(t,j,potnatveg,type) Biodiversity value of perennial cropland (Mha) -; -*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### - -*** EOF declarations.gms *** diff --git a/modules/30_crop/endo_jun13/input.gms b/modules/30_crop/endo_jun13/input.gms deleted file mode 100644 index cd12997375..0000000000 --- a/modules/30_crop/endo_jun13/input.gms +++ /dev/null @@ -1,46 +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 - -$setglobal c30_bioen_type all -* options: begr, betr, all - -$setglobal c30_bioen_water rainfed -* options: rainfed, irrigated, all - -********* CROPAREA INITIALISATION ********************************************** - -table f30_croparea(t_past,j,kcr) Different croparea type areas (mio. ha) -$ondelim -$include "./modules/30_crop/endo_jun13/input/f30_croparea_initialisation.cs2" -$offdelim -; - - -********* CROP-ROTATIONAL CONSTRAINT ******************************************* - -parameter f30_rotation_max_shr(crp30) Maximum allowed area shares for each crop type (1) -/ -$ondelim -$include "./modules/30_crop/endo_jun13/input/f30_rotation_max.csv" -$offdelim -/; - -parameter f30_rotation_min_shr(crp30) Minimum allowed area shares for each crop type (1) -/ -$ondelim -$include "./modules/30_crop/endo_jun13/input/f30_rotation_min.csv" -$offdelim -/; - - -********* SUITABILITY CONSTRAINT ******************************************* - -table f30_land_si(j,si) Land area suitable and non-suitable as cropland (mio. ha) -$ondelim -$include "./modules/30_crop/endo_jun13/input/avl_land_si.cs3" -$offdelim -; diff --git a/modules/30_crop/endo_jun13/input/files b/modules/30_crop/endo_jun13/input/files deleted file mode 100644 index 94759def46..0000000000 --- a/modules/30_crop/endo_jun13/input/files +++ /dev/null @@ -1,5 +0,0 @@ -* list of files that are required here -f30_rotation_max.csv -f30_rotation_min.csv -avl_land_si.cs3 -f30_croparea_initialisation.cs2 diff --git a/modules/30_crop/endo_jun13/postsolve.gms b/modules/30_crop/endo_jun13/postsolve.gms deleted file mode 100644 index 9acc19c1b4..0000000000 --- a/modules/30_crop/endo_jun13/postsolve.gms +++ /dev/null @@ -1,46 +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_area(t,j,kcr,w,"marginal") = vm_area.m(j,kcr,w); - oq30_cropland(t,j,"marginal") = q30_cropland.m(j); - oq30_suitability(t,j,"marginal") = q30_suitability.m(j); - oq30_rotation_max(t,j,crp30,w,"marginal") = q30_rotation_max.m(j,crp30,w); - oq30_rotation_min(t,j,crp30,w,"marginal") = q30_rotation_min.m(j,crp30,w); - oq30_prod(t,j,kcr,"marginal") = q30_prod.m(j,kcr); - oq30_carbon(t,j,ag_pools,"marginal") = q30_carbon.m(j,ag_pools); - oq30_bv_ann(t,j,potnatveg,"marginal") = q30_bv_ann.m(j,potnatveg); - oq30_bv_per(t,j,potnatveg,"marginal") = q30_bv_per.m(j,potnatveg); - ov_area(t,j,kcr,w,"level") = vm_area.l(j,kcr,w); - oq30_cropland(t,j,"level") = q30_cropland.l(j); - oq30_suitability(t,j,"level") = q30_suitability.l(j); - oq30_rotation_max(t,j,crp30,w,"level") = q30_rotation_max.l(j,crp30,w); - oq30_rotation_min(t,j,crp30,w,"level") = q30_rotation_min.l(j,crp30,w); - oq30_prod(t,j,kcr,"level") = q30_prod.l(j,kcr); - oq30_carbon(t,j,ag_pools,"level") = q30_carbon.l(j,ag_pools); - oq30_bv_ann(t,j,potnatveg,"level") = q30_bv_ann.l(j,potnatveg); - oq30_bv_per(t,j,potnatveg,"level") = q30_bv_per.l(j,potnatveg); - ov_area(t,j,kcr,w,"upper") = vm_area.up(j,kcr,w); - oq30_cropland(t,j,"upper") = q30_cropland.up(j); - oq30_suitability(t,j,"upper") = q30_suitability.up(j); - oq30_rotation_max(t,j,crp30,w,"upper") = q30_rotation_max.up(j,crp30,w); - oq30_rotation_min(t,j,crp30,w,"upper") = q30_rotation_min.up(j,crp30,w); - oq30_prod(t,j,kcr,"upper") = q30_prod.up(j,kcr); - oq30_carbon(t,j,ag_pools,"upper") = q30_carbon.up(j,ag_pools); - oq30_bv_ann(t,j,potnatveg,"upper") = q30_bv_ann.up(j,potnatveg); - oq30_bv_per(t,j,potnatveg,"upper") = q30_bv_per.up(j,potnatveg); - ov_area(t,j,kcr,w,"lower") = vm_area.lo(j,kcr,w); - oq30_cropland(t,j,"lower") = q30_cropland.lo(j); - oq30_suitability(t,j,"lower") = q30_suitability.lo(j); - oq30_rotation_max(t,j,crp30,w,"lower") = q30_rotation_max.lo(j,crp30,w); - oq30_rotation_min(t,j,crp30,w,"lower") = q30_rotation_min.lo(j,crp30,w); - oq30_prod(t,j,kcr,"lower") = q30_prod.lo(j,kcr); - oq30_carbon(t,j,ag_pools,"lower") = q30_carbon.lo(j,ag_pools); - oq30_bv_ann(t,j,potnatveg,"lower") = q30_bv_ann.lo(j,potnatveg); - oq30_bv_per(t,j,potnatveg,"lower") = q30_bv_per.lo(j,potnatveg); -*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/30_crop/endo_jun13/preloop.gms b/modules/30_crop/endo_jun13/preloop.gms deleted file mode 100644 index 31547674b0..0000000000 --- a/modules/30_crop/endo_jun13/preloop.gms +++ /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 - - -*due to some rounding errors the input data currently may contain in some cases -*very small, negative numbers. These numbers have to be set to 0 as area -*cannot be smaller than 0! -pm_croparea_start(j,kcr) = f30_croparea("y1995",j,kcr); -pm_croparea_start(j,kcr)$(pm_croparea_start(j,kcr)<0) = 0; diff --git a/modules/30_crop/endo_jun13/presolve.gms b/modules/30_crop/endo_jun13/presolve.gms deleted file mode 100644 index bee8482ca9..0000000000 --- a/modules/30_crop/endo_jun13/presolve.gms +++ /dev/null @@ -1,26 +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 - -$ifthen "%c30_bioen_type%" == "all" bioen_type_30(kbe30) = yes; -$else bioen_type_30("%c30_bioen_type%") = yes; -$endif - -$ifthen "%c30_bioen_water%" == "all" bioen_water_30(w) = yes; -$else bioen_water_30("%c30_bioen_water%") = yes; -$endif - -*' @code -*' First, all 2nd generation bioenergy area is fixed to zero, irrespective of type and -*' rainfed/irrigation. -vm_area.fx(j,kbe30,w)=0; -*' Second, the bounds for 2nd generation bioenergy area are released depending on -*' the dynamic sets bioen_type_30 and bioen_water_30. -vm_area.up(j,bioen_type_30,bioen_water_30)=Inf; -*' @stop - -crpmax30(crp30) = yes$(f30_rotation_max_shr(crp30) < 1); -crpmin30(crp30) = yes$(f30_rotation_min_shr(crp30) > 0); diff --git a/modules/30_crop/module.gms b/modules/30_crop/module.gms index ba3af7e18b..73818d856a 100644 --- a/modules/30_crop/module.gms +++ b/modules/30_crop/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -15,5 +15,7 @@ *' @authors Jan Philipp Dietrich, Florian Humpenöder, Benjamin Bodirsky *###################### R SECTION START (MODULETYPES) ########################## -$Ifi "%crop%" == "endo_jun13" $include "./modules/30_crop/endo_jun13/realization.gms" +$Ifi "%crop%" == "endo_apr21" $include "./modules/30_crop/endo_apr21/realization.gms" +$Ifi "%crop%" == "penalty_apr22" $include "./modules/30_crop/penalty_apr22/realization.gms" +$Ifi "%crop%" == "rotation_apr22" $include "./modules/30_crop/rotation_apr22/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/30_crop/penalty_apr22/declarations.gms b/modules/30_crop/penalty_apr22/declarations.gms new file mode 100644 index 0000000000..9f5120b9ca --- /dev/null +++ b/modules/30_crop/penalty_apr22/declarations.gms @@ -0,0 +1,63 @@ +*** | (C) 2008-2023 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 + +parameters + p30_avl_cropland(t,j) Total available land for crop cultivation (mio. ha) + p30_country_snv_weight(i) SNV policy country weight per region (1) + p30_snv_shr(t,j) Share of semi-natural vegetation in cropland areas (1) + p30_country_dummy(iso) Dummy parameter indicating whether country is affected by selected SNV policy (1) + i30_avl_cropland_iso(iso) Available land area for cropland at ISO level (mio. ha) + i30_rotation_incentives(t_all,rota30) Penalty for violating rotational constraints (USD05MER per ha) + p30_snv_scenario_fader(t_all) SNV scenario fader (1) + p30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) +; + +positive variables +* Fallow land is cropland which is temporarily fallow. Croparea+fallow=cropland + vm_fallow(j) Fallow land (mio. ha) + vm_area(j,kcr,w) Agricultural production area (mio. ha) + vm_rotation_penalty(i) Penalty for violating rotational constraints (mio. USD05MER) + v30_penalty_max_irrig(j,rotamax30) Penalty for violating max rotational constraints on irrigated land (mio. USD05MER) + v30_penalty(j,rota30) Penalty for violating rotational constraints (mio. USD05MER) +; + +equations + q30_cropland(j) Total cropland calculation (mio. ha) + q30_avl_cropland(j) Available cropland constraint (mio. ha) + q30_rotation_penalty(i) Total penalty for rotational constraint violations (mio. USD05MER) + q30_rotation_max(j,rotamax30) Local maximum rotational constraints (mio. ha) + q30_rotation_min(j,rotamin30) Local minimum rotational constraints (mio. ha) + q30_rotation_max_irrig(j,rotamax30) Local maximum rotational constraints (mio. ha) + q30_prod(j,kcr) Production of cropped products (mio. tDM) + q30_carbon(j,ag_pools,stockType) Cropland above ground carbon content calculation (mio. tC) + q30_bv_ann(j,potnatveg) Biodiversity value of annual cropland (mio. ha) + q30_bv_per(j,potnatveg) Biodiversity value of perennial cropland (mio. ha) + q30_land_snv(j) Land constraint for the SNV policy in cropland areas (mio. ha) +; + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov_fallow(t,j,type) Fallow land (mio. ha) + ov_area(t,j,kcr,w,type) Agricultural production area (mio. ha) + ov_rotation_penalty(t,i,type) Penalty for violating rotational constraints (mio. USD05MER) + ov30_penalty_max_irrig(t,j,rotamax30,type) Penalty for violating max rotational constraints on irrigated land (mio. USD05MER) + ov30_penalty(t,j,rota30,type) Penalty for violating rotational constraints (mio. USD05MER) + oq30_cropland(t,j,type) Total cropland calculation (mio. ha) + oq30_avl_cropland(t,j,type) Available cropland constraint (mio. ha) + oq30_rotation_penalty(t,i,type) Total penalty for rotational constraint violations (mio. USD05MER) + oq30_rotation_max(t,j,rotamax30,type) Local maximum rotational constraints (mio. ha) + oq30_rotation_min(t,j,rotamin30,type) Local minimum rotational constraints (mio. ha) + oq30_rotation_max_irrig(t,j,rotamax30,type) Local maximum rotational constraints (mio. ha) + oq30_prod(t,j,kcr,type) Production of cropped products (mio. tDM) + oq30_carbon(t,j,ag_pools,stockType,type) Cropland above ground carbon content calculation (mio. tC) + oq30_bv_ann(t,j,potnatveg,type) Biodiversity value of annual cropland (mio. ha) + oq30_bv_per(t,j,potnatveg,type) Biodiversity value of perennial cropland (mio. ha) + oq30_land_snv(t,j,type) Land constraint for the SNV policy in cropland areas (mio. ha) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### + +*** EOF declarations.gms *** diff --git a/modules/30_crop/penalty_apr22/equations.gms b/modules/30_crop/penalty_apr22/equations.gms new file mode 100644 index 0000000000..7937ab12bb --- /dev/null +++ b/modules/30_crop/penalty_apr22/equations.gms @@ -0,0 +1,105 @@ +*** | (C) 2008-2023 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 total land requirements for cropland are calculated as +*' the sum of crop and water supply type specific land requirements. +*' Fallow is no explicit landuse type, but the difference between +*' land and harvested vm_area + + q30_cropland(j2) .. + sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2) =e= vm_land(j2,"crop"); + + +*' We assume that crop production can only take place on suitable cropland area. +*' We use a suitability index (SI) map from @zabel_global_2014 to exclude areas +*' from cropland production that have a low suitability, e.g. due to steep slopes, +*' to estimate the available cropland area. The cultivated area therefore has +*' to be smaller than the available cropland area. Moreover, the available cropland +*' can be reduced by constraining the cropland area in favour of other land types, +*' in order to increase compositional heterogeneity of land types at the cell level. + + q30_avl_cropland(j2) .. + vm_land(j2,"crop") =l= sum(ct, p30_avl_cropland(ct,j2)); + +*' The semi-natural land constraint in cropland areas for sustaining critical regulating NCP +*' for agricultural production is added on top of land conserved for other reasons +*' (e.g. conservation of intact ecosystems or protection of biodiversity hotspots). + q30_land_snv(j2) .. + sum(land_snv, vm_land(j2,land_snv)) + =g= + sum(ct, p30_snv_shr(ct,j2)) * vm_land(j2,"crop") + + sum((ct,land_snv,consv_type), pm_land_conservation(ct,j2,land_snv,consv_type)); + +*' Rotational constraints prevent over-specialization. In this module realization, +*' they are implemented via a penalty payment if the constraints are violated. + +q30_rotation_penalty(i2) .. + vm_rotation_penalty(i2) + =g= + sum(cell(i2,j2), + sum(rota30, v30_penalty(j2,rota30) * sum(ct, i30_rotation_incentives(ct,rota30))) + + sum(rotamax_red30, v30_penalty_max_irrig(j2,rotamax_red30) * sum(ct, i30_rotation_incentives(ct,rotamax_red30))) + ); + +*' The penalty applies to the areas which exceed a certain maximum +*' share of the land. Below this share, negative benefits are +*' avoided by defining the penalty to be positive. + + q30_rotation_max(j2,rotamax_red30) .. + v30_penalty(j2,rotamax_red30) + =g= + sum((rota_kcr30(rotamax_red30,kcr),w),vm_area(j2,kcr,w)) + - vm_land(j2,"crop") * f30_rotation_rules(rotamax_red30); + +*' Minimum constraints apply penalties when a certain mimimum +*' share of a group is not achieved. This is used to guarantee a minimum +*' crop group diversity withing cells. + + q30_rotation_min(j2,rotamin_red30) .. + v30_penalty(j2,rotamin_red30) + =g= + vm_land(j2,"crop") * f30_rotation_rules(rotamin_red30) + - sum((rota_kcr30(rotamin_red30,kcr),w), vm_area(j2,kcr,w)); + +*' The following maximum constraint avoids over-specialization in irrigated systems. +*' No minimum constraint is included for irrigated areas for computational +*' reasons. Minimum constraints just need to be met on total areas. + + q30_rotation_max_irrig(j2,rotamax_red30) .. + v30_penalty_max_irrig(j2,rotamax_red30) + =g= + sum((rota_kcr30(rotamax_red30,kcr)), vm_area(j2,kcr,"irrigated")) + - vm_AEI(j2) * f30_rotation_rules(rotamax_red30); + + +*' Agricultural production is calculated by multiplying the area under +*' production with corresponding yields. Production from rainfed and irrigated +*' areas is summed up: + + q30_prod(j2,kcr) .. + vm_prod(j2,kcr) =e= sum(w, vm_area(j2,kcr,w) * vm_yld(j2,kcr,w)); + +*' The carbon content of the above ground carbon pools are calculated as a total +*' for all cropland : + + q30_carbon(j2,ag_pools,stockType) .. + vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= + m_carbon_stock(vm_land,fm_carbon_density,"crop"); + +*' The biodiversity value for cropland is calculated separately for annual and perennial crops: + q30_bv_ann(j2,potnatveg) .. + vm_bv(j2,"crop_ann",potnatveg) + =e= + sum((crop_ann30,w), vm_area(j2,crop_ann30,w)) * fm_bii_coeff("crop_ann",potnatveg) * fm_luh2_side_layers(j2,potnatveg); + +*' perennial crops are calculated as difference, as they shall also include fallow land + q30_bv_per(j2,potnatveg) .. + vm_bv(j2,"crop_per",potnatveg) + =e= + (vm_land(j2,"crop") - sum((crop_ann30,w), vm_area(j2,crop_ann30,w))) + * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); diff --git a/modules/30_crop/penalty_apr22/input.gms b/modules/30_crop/penalty_apr22/input.gms new file mode 100644 index 0000000000..22bc0de7d0 --- /dev/null +++ b/modules/30_crop/penalty_apr22/input.gms @@ -0,0 +1,117 @@ +*** | (C) 2008-2023 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 c30_bioen_type all +* options: begr, betr, all + +$setglobal c30_bioen_water rainfed +* options: rainfed, irrigated, all + +$setglobal c30_marginal_land q33_marginal +* options: all_marginal, q33_marginal, no_marginal + +$setglobal c30_snv_target none +* options: none, by2030, by2020 + +$setglobal c30_rotation_constraints on +*options: on, off + +$setglobal c30_rotation_scenario default +*options: none, default, fallow, legumes, agroforestry, agroecology + +$setglobal c30_rotation_scenario_speed by2050 +* options: none, by2030, by2020 + +scalars +s30_snv_shr Share of available cropland that is witheld for other land cover types (1) / 0 / +s30_snv_shr_noselect Share of available cropland that is witheld for other land cover types (1) / 0 / +s30_snv_scenario_start SNV scenario start year / 2020 / +s30_snv_scenario_target SNV scenario target year / 2030 / +s30_rotation_scenario_start Rotation scenario start year / 2020 / +s30_rotation_scenario_target Rotation scenario target year / 2050 / +; + +* Set-switch for countries affected by regional SNV policy +* Default: all iso countries selected +sets + policy_countries30(iso) countries to be affected by SNV policy / 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 / + +land_snv(land) land types allowed in the SNV policy / secdforest, forestry, past, other / +; + +$ifthen "%c30_bioen_type%" == "all" bioen_type_30(kbe30) = yes; +$else bioen_type_30("%c30_bioen_type%") = yes; +$endif + +$ifthen "%c30_bioen_water%" == "all" bioen_water_30(w) = yes; +$else bioen_water_30("%c30_bioen_water%") = yes; +$endif + +********* CROPAREA INITIALISATION ********************************************** + +table fm_croparea(t_all,j,w,kcr) Different croparea type areas (mio. ha) +$ondelim +$include "./modules/30_crop/penalty_apr22/input/f30_croparea_w_initialisation.cs3" +$offdelim +; +m_fillmissingyears(fm_croparea,"j,w,kcr"); + +********* CROP-ROTATIONAL CONSTRAINT ******************************************* + +table f30_rotation_incentives(rota30,rotascen30) penalties for violating rotation rules (USD05MER) +$ondelim +$include "./modules/30_crop/penalty_apr22/input/f30_rotation_incentives.csv" +$offdelim +; + +parameter f30_rotation_rules(rota30) Rotation min or max shares (1) +/ +$ondelim +$include "./modules/30_crop/penalty_apr22/input/f30_rotation_rules.csv" +$offdelim +/ +; + + +********* AVAILABLE CROPLAND ******************************************* + +table f30_avl_cropland(j,marginal_land30) Available land area for cropland (mio. ha) +$ondelim +$include "./modules/30_crop/penalty_apr22/input/avl_cropland.cs3" +$offdelim +; + +table f30_avl_cropland_iso(iso,marginal_land30) Available land area for cropland at ISO level (mio. ha) +$ondelim +$include "./modules/30_crop/penalty_apr22/input/avl_cropland_iso.cs3" +$offdelim +; + diff --git a/modules/30_crop/penalty_apr22/input/files b/modules/30_crop/penalty_apr22/input/files new file mode 100644 index 0000000000..af07706adc --- /dev/null +++ b/modules/30_crop/penalty_apr22/input/files @@ -0,0 +1,7 @@ +* list of files that are required here +f30_rotation_incentives.csv +f30_rotation_rules.csv +avl_cropland.cs3 +avl_cropland_0.5.mz +f30_croparea_w_initialisation.cs3 +avl_cropland_iso.cs3 diff --git a/modules/30_crop/penalty_apr22/postsolve.gms b/modules/30_crop/penalty_apr22/postsolve.gms new file mode 100644 index 0000000000..1f3170e857 --- /dev/null +++ b/modules/30_crop/penalty_apr22/postsolve.gms @@ -0,0 +1,74 @@ +*** | (C) 2008-2023 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_fallow(t,j,"marginal") = vm_fallow.m(j); + ov_area(t,j,kcr,w,"marginal") = vm_area.m(j,kcr,w); + ov_rotation_penalty(t,i,"marginal") = vm_rotation_penalty.m(i); + ov30_penalty_max_irrig(t,j,rotamax30,"marginal") = v30_penalty_max_irrig.m(j,rotamax30); + ov30_penalty(t,j,rota30,"marginal") = v30_penalty.m(j,rota30); + oq30_cropland(t,j,"marginal") = q30_cropland.m(j); + oq30_avl_cropland(t,j,"marginal") = q30_avl_cropland.m(j); + oq30_rotation_penalty(t,i,"marginal") = q30_rotation_penalty.m(i); + oq30_rotation_max(t,j,rotamax30,"marginal") = q30_rotation_max.m(j,rotamax30); + oq30_rotation_min(t,j,rotamin30,"marginal") = q30_rotation_min.m(j,rotamin30); + oq30_rotation_max_irrig(t,j,rotamax30,"marginal") = q30_rotation_max_irrig.m(j,rotamax30); + oq30_prod(t,j,kcr,"marginal") = q30_prod.m(j,kcr); + oq30_carbon(t,j,ag_pools,stockType,"marginal") = q30_carbon.m(j,ag_pools,stockType); + oq30_bv_ann(t,j,potnatveg,"marginal") = q30_bv_ann.m(j,potnatveg); + oq30_bv_per(t,j,potnatveg,"marginal") = q30_bv_per.m(j,potnatveg); + oq30_land_snv(t,j,"marginal") = q30_land_snv.m(j); + ov_fallow(t,j,"level") = vm_fallow.l(j); + ov_area(t,j,kcr,w,"level") = vm_area.l(j,kcr,w); + ov_rotation_penalty(t,i,"level") = vm_rotation_penalty.l(i); + ov30_penalty_max_irrig(t,j,rotamax30,"level") = v30_penalty_max_irrig.l(j,rotamax30); + ov30_penalty(t,j,rota30,"level") = v30_penalty.l(j,rota30); + oq30_cropland(t,j,"level") = q30_cropland.l(j); + oq30_avl_cropland(t,j,"level") = q30_avl_cropland.l(j); + oq30_rotation_penalty(t,i,"level") = q30_rotation_penalty.l(i); + oq30_rotation_max(t,j,rotamax30,"level") = q30_rotation_max.l(j,rotamax30); + oq30_rotation_min(t,j,rotamin30,"level") = q30_rotation_min.l(j,rotamin30); + oq30_rotation_max_irrig(t,j,rotamax30,"level") = q30_rotation_max_irrig.l(j,rotamax30); + oq30_prod(t,j,kcr,"level") = q30_prod.l(j,kcr); + oq30_carbon(t,j,ag_pools,stockType,"level") = q30_carbon.l(j,ag_pools,stockType); + oq30_bv_ann(t,j,potnatveg,"level") = q30_bv_ann.l(j,potnatveg); + oq30_bv_per(t,j,potnatveg,"level") = q30_bv_per.l(j,potnatveg); + oq30_land_snv(t,j,"level") = q30_land_snv.l(j); + ov_fallow(t,j,"upper") = vm_fallow.up(j); + ov_area(t,j,kcr,w,"upper") = vm_area.up(j,kcr,w); + ov_rotation_penalty(t,i,"upper") = vm_rotation_penalty.up(i); + ov30_penalty_max_irrig(t,j,rotamax30,"upper") = v30_penalty_max_irrig.up(j,rotamax30); + ov30_penalty(t,j,rota30,"upper") = v30_penalty.up(j,rota30); + oq30_cropland(t,j,"upper") = q30_cropland.up(j); + oq30_avl_cropland(t,j,"upper") = q30_avl_cropland.up(j); + oq30_rotation_penalty(t,i,"upper") = q30_rotation_penalty.up(i); + oq30_rotation_max(t,j,rotamax30,"upper") = q30_rotation_max.up(j,rotamax30); + oq30_rotation_min(t,j,rotamin30,"upper") = q30_rotation_min.up(j,rotamin30); + oq30_rotation_max_irrig(t,j,rotamax30,"upper") = q30_rotation_max_irrig.up(j,rotamax30); + oq30_prod(t,j,kcr,"upper") = q30_prod.up(j,kcr); + oq30_carbon(t,j,ag_pools,stockType,"upper") = q30_carbon.up(j,ag_pools,stockType); + oq30_bv_ann(t,j,potnatveg,"upper") = q30_bv_ann.up(j,potnatveg); + oq30_bv_per(t,j,potnatveg,"upper") = q30_bv_per.up(j,potnatveg); + oq30_land_snv(t,j,"upper") = q30_land_snv.up(j); + ov_fallow(t,j,"lower") = vm_fallow.lo(j); + ov_area(t,j,kcr,w,"lower") = vm_area.lo(j,kcr,w); + ov_rotation_penalty(t,i,"lower") = vm_rotation_penalty.lo(i); + ov30_penalty_max_irrig(t,j,rotamax30,"lower") = v30_penalty_max_irrig.lo(j,rotamax30); + ov30_penalty(t,j,rota30,"lower") = v30_penalty.lo(j,rota30); + oq30_cropland(t,j,"lower") = q30_cropland.lo(j); + oq30_avl_cropland(t,j,"lower") = q30_avl_cropland.lo(j); + oq30_rotation_penalty(t,i,"lower") = q30_rotation_penalty.lo(i); + oq30_rotation_max(t,j,rotamax30,"lower") = q30_rotation_max.lo(j,rotamax30); + oq30_rotation_min(t,j,rotamin30,"lower") = q30_rotation_min.lo(j,rotamin30); + oq30_rotation_max_irrig(t,j,rotamax30,"lower") = q30_rotation_max_irrig.lo(j,rotamax30); + oq30_prod(t,j,kcr,"lower") = q30_prod.lo(j,kcr); + oq30_carbon(t,j,ag_pools,stockType,"lower") = q30_carbon.lo(j,ag_pools,stockType); + oq30_bv_ann(t,j,potnatveg,"lower") = q30_bv_ann.lo(j,potnatveg); + oq30_bv_per(t,j,potnatveg,"lower") = q30_bv_per.lo(j,potnatveg); + oq30_land_snv(t,j,"lower") = q30_land_snv.lo(j); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/30_crop/penalty_apr22/preloop.gms b/modules/30_crop/penalty_apr22/preloop.gms new file mode 100644 index 0000000000..ee7f996e18 --- /dev/null +++ b/modules/30_crop/penalty_apr22/preloop.gms @@ -0,0 +1,34 @@ +*** | (C) 2008-2023 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 + +** Trajectory for cropland scenarios +* sigmoidal interpolation between start year and target year +m_sigmoid_interpol(p30_snv_scenario_fader,s30_snv_scenario_start,s30_snv_scenario_target,0,1); +m_sigmoid_interpol(p30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1); + + +** create crop rotation scenario +i30_rotation_incentives(t_all,rota30)= + f30_rotation_incentives(rota30,"default") * (1-p30_rotation_scenario_fader(t_all)) + + f30_rotation_incentives(rota30,"%c30_rotation_scenario%") * (p30_rotation_scenario_fader(t_all)); + + +*due to some rounding errors the input data currently may contain in some cases +*very small, negative numbers. These numbers have to be set to 0 as area +*cannot be smaller than 0! +fm_croparea(t_past,j,w,kcr)$(fm_croparea(t_past,j,w,kcr)<0) = 0; + +****** Regional share of semi-natural vegetation (SNV) in cropland areas for selective countries: +* Country switch to determine countries for which a SNV policy shall be applied. +* In the default case, the SNV policy affects all countries when activated. +p30_country_dummy(iso) = 0; +p30_country_dummy(policy_countries30) = 1; +* Because MAgPIE is not run at country-level, but at region level, a region +* share is calculated that translates the countries' influence to regional level. +* Countries are weighted by available cropland area. +i30_avl_cropland_iso(iso) = f30_avl_cropland_iso(iso,"%c30_marginal_land%"); +p30_country_snv_weight(i) = sum(i_to_iso(i,iso), p30_country_dummy(iso) * i30_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), i30_avl_cropland_iso(iso)); diff --git a/modules/30_crop/penalty_apr22/presolve.gms b/modules/30_crop/penalty_apr22/presolve.gms new file mode 100644 index 0000000000..35ec026f8a --- /dev/null +++ b/modules/30_crop/penalty_apr22/presolve.gms @@ -0,0 +1,34 @@ +*** | (C) 2008-2023 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 +*' First, all 2nd generation bioenergy area is fixed to zero, irrespective of type and +*' rainfed/irrigation. +vm_area.fx(j,kbe30,w)=0; +*' Second, the bounds for 2nd generation bioenergy area are released depending on +*' the dynamic sets bioen_type_30 and bioen_water_30. +*' SSP2 default settings are used for the historic period. +if(m_year(t) <= sm_fix_SSP2, + vm_area.up(j,kbe30,"rainfed") = Inf; +else + vm_area.up(j,bioen_type_30,bioen_water_30) = Inf; +); +*' @stop + +*' @code +*' Minimum semi-natural vegetation (SNV) share is fading in after 2020 +p30_snv_shr(t,j) = p30_snv_scenario_fader(t) * + (s30_snv_shr * sum(cell(i,j), p30_country_snv_weight(i)) + + s30_snv_shr_noselect * sum(cell(i,j), 1-p30_country_snv_weight(i))); + +*' Area potentially available for cropping +p30_avl_cropland(t,j) = f30_avl_cropland(j,"%c30_marginal_land%") * (1 - p30_snv_shr(t,j)); +*' @stop + +* only activate constraints which are binding +rotamax_red30(rotamax30) = yes$(i30_rotation_incentives(t,rotamax30) > 0); +rotamin_red30(rotamin30) = yes$(i30_rotation_incentives(t,rotamin30) > 0); diff --git a/modules/30_crop/penalty_apr22/realization.gms b/modules/30_crop/penalty_apr22/realization.gms new file mode 100644 index 0000000000..a30f945b3f --- /dev/null +++ b/modules/30_crop/penalty_apr22/realization.gms @@ -0,0 +1,40 @@ +*** | (C) 2008-2023 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 endo_apr21 realization calculates the crop specific +*' agricultural land use endogenously based on yield data coming from the +*' module [14_yields] and the rotational incentives as well as suitability +*' constraints stated in the input data of the module. +*' +*' Cropland areas are linked to the crop specific production and the carbon +*' content of the different land carbon pools. The crop specific land use areas +*' are also used in [18_residues], [38_factor_costs], +*' [41_area_equipped_for_irrigation], [42_water_demand], [50_nr_soil_budget], +*' [53_methane] and [59_som]. + +*' This module realization allows for different scenarios of rotational +*' constraints which are implemented via penalty payments if constraints are +*' exceeded. Rotational constraints are defined for total land as well as +*' for irrigated areas only to avoid overspecialization on irrigated land. + +*' This realisation also includes the option to reserve a minimum semi-natural +*' vegetation share within the total available cropland for other land cover +*' classes, including grassland, forest, and other land (by a given target year), +*' in order to provide species habitats and to benefit from ecosystem ervices in +*' agricultural landscapes. + +*' @limitations There are currently no known limitations of this realization. + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/30_crop/penalty_apr22/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/30_crop/penalty_apr22/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/30_crop/penalty_apr22/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/30_crop/penalty_apr22/equations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/30_crop/penalty_apr22/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/30_crop/penalty_apr22/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/30_crop/penalty_apr22/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/30_crop/penalty_apr22/sets.gms b/modules/30_crop/penalty_apr22/sets.gms new file mode 100644 index 0000000000..5b32d2432b --- /dev/null +++ b/modules/30_crop/penalty_apr22/sets.gms @@ -0,0 +1,92 @@ +*** | (C) 2008-2023 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 + rotascen30 rotation constraint scenarios + /none, default, fallow, legumes, agroforestry, agroecology/ + + rota30 rotational rules + /all1_max, all2_max, + cereals1_max, cereals2_max, + resistant_max, oilcrops_max, + legumes_max, rootsrape_max, + rice_pro_max, tece_max + trce_max, maiz_max, + biomass_min, legumes_min, + minor_min, cereals_min/ + + + rotamax30(rota30) rotational maximum rules + /all1_max, all2_max, + cereals1_max, cereals2_max, + resistant_max, oilcrops_max, + legumes_max, rootsrape_max, + rice_pro_max, tece_max + trce_max, maiz_max + / + + rotamin30(rota30) rotational minimum rules + /biomass_min, legumes_min, minor_min, cereals_min/ + + rotamax_red30(rotamax30) Maximum crop rotation reduced set + rotamin_red30(rotamin30) Minimum crop rotation reduced set + +* crop rotation groups: +* cereals or grasses are very favourable to loosen soils, therefore minimum constraint +* legumes need longer rotations, only soybean can and is cultivated every 2 years +* rapeseed and beets have same nematodes +* root crops have similar diseases + +* Sustainable practices: +* >=5% set-aside, >=5% biomass crops that approximate agroforestry systems +* six fold crop rotation of the remaining 90% +* at least one legume slot in crop rotation +* crop groups with multiple members like tece or foddr are allowed multiple slots +* one percent fruits and vegs in each cell for regional demand + + rota_kcr30(rota30, kcr) Mapping of crop types into crop rotation types + / all1_max . (tece, maiz, trce, rice_pro, soybean, rapeseed, groundnut, sunflower, + oilpalm, puls_pro, potato, cassav_sp, sugr_cane, sugr_beet, others, + foddr, cottn_pro, begr, betr) + all2_max . (tece, maiz, trce, rice_pro, soybean, rapeseed, groundnut, sunflower, + oilpalm, puls_pro, potato, cassav_sp, sugr_cane, sugr_beet, others, + foddr, cottn_pro, begr, betr) + cereals1_max . (tece, maiz, trce, rice_pro) + cereals2_max . (tece, maiz, trce, rice_pro) + resistant_max . (begr,betr,foddr,sugr_cane,cottn_pro,oilpalm,others) + oilcrops_max . (sunflower, rapeseed) + legumes_max . (foddr,puls_pro, soybean, groundnut) + rootsrape_max . (sugr_beet, cassav_sp, potato, rapeseed) + rice_pro_max . (rice_pro) + tece_max . (tece) + trce_max . (trce) + maiz_max . (maiz) + biomass_min . (sugr_cane, oilpalm, begr, betr) + legumes_min . (soybean, groundnut, puls_pro, foddr) + minor_min . (sunflower, rapeseed, sugr_beet, cassav_sp, potato, others) + cereals_min . (tece, maiz, trce, rice_pro) + / + + + kbe30(kcr) bio energy activities + / betr, begr / + + bioen_type_30(kbe30) dynamic set bioen type + bioen_water_30(w) dynamic set bioen water + + crop_ann30(kcr) annual crops + / tece, maiz, trce, rice_pro, rapeseed, sunflower, potato, cassav_sp, sugr_beet, others, cottn_pro, foddr, soybean, groundnut, puls_pro / + + crop_per30(kcr) perennial crops + / oilpalm, begr, sugr_cane, betr / + + marginal_land30 Marginal land scenarios + / all_marginal, q33_marginal, no_marginal / + + policy_target30 Target year for cropland policy + / none, by2030, by2050 / +; diff --git a/modules/30_crop/rotation_apr22/declarations.gms b/modules/30_crop/rotation_apr22/declarations.gms new file mode 100644 index 0000000000..4fd7cb47e2 --- /dev/null +++ b/modules/30_crop/rotation_apr22/declarations.gms @@ -0,0 +1,58 @@ +*** | (C) 2008-2023 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 + +parameters + p30_avl_cropland(t,j) Total available land for crop cultivation (mio. ha) + p30_country_snv_weight(i) SNV policy country weight per region (1) + p30_snv_shr(t,j) Share of semi-natural vegetation in cropland areas (1) + p30_country_dummy(iso) Dummy parameter indicating whether country is affected by selected SNV policy (1) + i30_avl_cropland_iso(iso) Available land area for cropland at ISO level (mio. ha) + i30_rotation_max_shr(t_all,rotamax30) Maximum share of a certain crop group on cropland (ha per ha) + i30_rotation_min_shr(t_all,rotamin30) Minimum share of a certain crop group on cropland (ha per ha) + p30_snv_scenario_fader(t_all) SNV scenario fader (1) + p30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) +; + +positive variables +* Fallow land is cropland which is temporarily fallow. Croparea+fallow=cropland + vm_fallow(j) Fallow land (mio. ha) + vm_area(j,kcr,w) Agricultural production area (mio. ha) + vm_rotation_penalty(i) Penalty for violating rotational constraints (USD05MER) +; + +equations + q30_cropland(j) Total cropland calculation (mio. ha) + q30_avl_cropland(j) Available cropland constraint (mio. ha) + q30_rotation_max(j,rotamax30) Local maximum rotational constraints (mio. ha) + q30_rotation_min(j,rotamin30) Local minimum rotational constraints (mio. ha) + q30_rotation_max_irrig(j,rotamax30) Local maximum rotational constraints (mio. ha) + q30_prod(j,kcr) Production of cropped products (mio. tDM) + q30_carbon(j,ag_pools,stockType) Cropland above ground carbon content calculation (mio. tC) + q30_bv_ann(j,potnatveg) Biodiversity value of annual cropland (mio. ha) + q30_bv_per(j,potnatveg) Biodiversity value of perennial cropland (mio. ha) + q30_land_snv(j) Land constraint for the SNV policy in cropland areas (mio. ha) +; + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov_fallow(t,j,type) Fallow land (mio. ha) + ov_area(t,j,kcr,w,type) Agricultural production area (mio. ha) + ov_rotation_penalty(t,i,type) Penalty for violating rotational constraints (USD05MER) + oq30_cropland(t,j,type) Total cropland calculation (mio. ha) + oq30_avl_cropland(t,j,type) Available cropland constraint (mio. ha) + oq30_rotation_max(t,j,rotamax30,type) Local maximum rotational constraints (mio. ha) + oq30_rotation_min(t,j,rotamin30,type) Local minimum rotational constraints (mio. ha) + oq30_rotation_max_irrig(t,j,rotamax30,type) Local maximum rotational constraints (mio. ha) + oq30_prod(t,j,kcr,type) Production of cropped products (mio. tDM) + oq30_carbon(t,j,ag_pools,stockType,type) Cropland above ground carbon content calculation (mio. tC) + oq30_bv_ann(t,j,potnatveg,type) Biodiversity value of annual cropland (mio. ha) + oq30_bv_per(t,j,potnatveg,type) Biodiversity value of perennial cropland (mio. ha) + oq30_land_snv(t,j,type) Land constraint for the SNV policy in cropland areas (mio. ha) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### + +*** EOF declarations.gms *** diff --git a/modules/30_crop/rotation_apr22/equations.gms b/modules/30_crop/rotation_apr22/equations.gms new file mode 100644 index 0000000000..dd7270bcb4 --- /dev/null +++ b/modules/30_crop/rotation_apr22/equations.gms @@ -0,0 +1,83 @@ +*** | (C) 2008-2023 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 total land requirements for cropland are calculated as +*' the sum of crop and water supply type specific land requirements: + + q30_cropland(j2) .. + sum((kcr,w), vm_area(j2,kcr,w)) =e= vm_land(j2,"crop") + vm_fallow(j2); + +*' We assume that crop production can only take place on suitable cropland area. +*' We use a suitability index (SI) map from @zabel_global_2014 to exclude areas +*' from cropland production that have a low suitability, e.g. due to steep slopes, +*' to estimate the available cropland area. The cultivated area therefore has +*' to be smaller than the available cropland area. Moreover, the available cropland +*' can be reduced by constraining the cropland area in favour of other land types, +*' in order to increase compositional heterogeneity of land types at the cell level. + + q30_avl_cropland(j2) .. + vm_land(j2,"crop") =l= sum(ct, p30_avl_cropland(ct,j2)); + +*' The semi-natural land constraint in cropland areas for sustaining critical regulating NCP +*' for agricultural production is added on top of land conserved for other reasons +*' (e.g. conservation of intact ecosystems or protection of biodiversity hotspots). + q30_land_snv(j2) .. + sum(land_snv, vm_land(j2,land_snv)) + =g= + sum(ct, p30_snv_shr(ct,j2)) * vm_land(j2,"crop") + + sum((ct,land_snv,consv_type), pm_land_conservation(ct,j2,land_snv,consv_type)); + +*' As additional constraints minimum and maximum rotational constraints limit +*' the placing of crops. On the one hand, these rotational constraints reflect +*' crop rotations limiting the share a specific crop can cover of the total area +*' of a cluster: + + q30_rotation_max(j2,rotamax_red30) .. + sum((rotamax_kcr30(rotamax_red30,kcr),w), vm_area(j2,kcr,w)) =l= + vm_land(j2,"crop") * sum(ct,i30_rotation_max_shr(ct,rotamax_red30)); + + + q30_rotation_min(j2,rotamin_red30) .. + sum((rotamin_kcr30(rotamin_red30,kcr),w), vm_area(j2,kcr,w)) =g= + vm_land(j2,"crop") * sum(ct,i30_rotation_min_shr(ct,rotamin_red30)); + +* The following maximum constraint avoids over-specialization in irrigated systems. +* No minimum constraint is included for irrigated areas for computational +* reasons. Minimum constraints just need to be met on total areas. + + q30_rotation_max_irrig(j2,rotamax_red30) .. + sum((rotamax_kcr30(rotamax_red30,kcr)), vm_area(j2,kcr,"irrigated")) =l= + vm_AEI(j2) * sum(ct,i30_rotation_max_shr(ct,rotamax_red30)); + + +*' Agricultural production is calculated by multiplying the area under +*' production with corresponding yields. Production from rainfed and irrigated +*' areas is summed up: + + q30_prod(j2,kcr) .. + vm_prod(j2,kcr) =e= sum(w, vm_area(j2,kcr,w) * vm_yld(j2,kcr,w)); + +*' The carbon content of the above ground carbon pools are calculated as a total +*' for all cropland : + + q30_carbon(j2,ag_pools,stockType) .. + vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= + m_carbon_stock(vm_land,fm_carbon_density,"crop"); + +*' The biodiversity value for cropland is calculated separately for annual and perennial crops: + q30_bv_ann(j2,potnatveg) .. + vm_bv(j2,"crop_ann",potnatveg) + =e= + sum((crop_ann30,w), vm_area(j2,crop_ann30,w)) * fm_bii_coeff("crop_ann",potnatveg) * fm_luh2_side_layers(j2,potnatveg); + +* perennial crops are calculated as difference, as they shall also include fallow land + q30_bv_per(j2,potnatveg) .. + vm_bv(j2,"crop_per",potnatveg) + =e= + (vm_land(j2,"crop") - sum((crop_ann30,w), vm_area(j2,crop_ann30,w))) + * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); diff --git a/modules/30_crop/rotation_apr22/input.gms b/modules/30_crop/rotation_apr22/input.gms new file mode 100644 index 0000000000..38c2288b78 --- /dev/null +++ b/modules/30_crop/rotation_apr22/input.gms @@ -0,0 +1,118 @@ +*** | (C) 2008-2023 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 c30_bioen_type all +* options: begr, betr, all + +$setglobal c30_bioen_water rainfed +* options: rainfed, irrigated, all + +$setglobal c30_marginal_land q33_marginal +* options: all_marginal, q33_marginal, no_marginal + +$setglobal c30_snv_target none +* options: none, by2030, by2020 + +$setglobal c30_rotation_constraints on +*options: on, off + +$setglobal c30_rotation_scenario default +*options: min,default,good,good_20div,setaside,legumes,agroforestry,sixfoldrotation,agroecology + +$setglobal c30_rotation_scenario_speed by2050 +* options: none, by2030, by2020 + +scalars +s30_snv_shr Share of available cropland that is witheld for other land cover types (1) / 0 / +s30_snv_shr_noselect Share of available cropland that is witheld for other land cover types (1) / 0 / +s30_snv_scenario_start SNV scenario start year / 2020 / +s30_snv_scenario_target SNV scenario target year / 2030 / +s30_rotation_scenario_start Rotation scenario start year / 2020 / +s30_rotation_scenario_target Rotation scenario target year / 2050 / +; + +* Set-switch for countries affected by regional SNV policy +* Default: all iso countries selected +sets + policy_countries30(iso) countries to be affected by SNV policy / 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 / + +land_snv(land) land types allowed in the SNV policy / secdforest, forestry, past, other / +; + +$ifthen "%c30_bioen_type%" == "all" bioen_type_30(kbe30) = yes; +$else bioen_type_30("%c30_bioen_type%") = yes; +$endif + +$ifthen "%c30_bioen_water%" == "all" bioen_water_30(w) = yes; +$else bioen_water_30("%c30_bioen_water%") = yes; +$endif + +********* CROPAREA INITIALISATION ********************************************** + +table fm_croparea(t_all,j,w,kcr) Different croparea type areas (mio. ha) +$ondelim +$include "./modules/30_crop/rotation_apr22/input/f30_croparea_w_initialisation.cs3" +$offdelim +; +m_fillmissingyears(fm_croparea,"j,w,kcr"); + +********* CROP-ROTATIONAL CONSTRAINT ******************************************* + +table f30_rotation_max_shr(rotamax30,rotascen30) Maximum allowed area shares for each crop type (1) +$ondelim +$include "./modules/30_crop/rotation_apr22/input/f30_rotation_max_scen.csv" +$offdelim +; +$if "%c30_rotation_constraints%" == "off" f30_rotation_max_shr(crp30) = 1; + + +table f30_rotation_min_shr(rotamin30,rotascen30) Minimum allowed area shares for each crop type (1) +$ondelim +$include "./modules/30_crop/rotation_apr22/input/f30_rotation_min_scen.csv" +$offdelim +; +$if "%c30_rotation_constraints%" == "off" f30_rotation_min_shr(crp30) = 0; + + +********* AVAILABLE CROPLAND ******************************************* + +table f30_avl_cropland(j,marginal_land30) Available land area for cropland (mio. ha) +$ondelim +$include "./modules/30_crop/rotation_apr22/input/avl_cropland.cs3" +$offdelim +; + +table f30_avl_cropland_iso(iso,marginal_land30) Available land area for cropland at ISO level (mio. ha) +$ondelim +$include "./modules/30_crop/rotation_apr22/input/avl_cropland_iso.cs3" +$offdelim +; + diff --git a/modules/30_crop/rotation_apr22/input/files b/modules/30_crop/rotation_apr22/input/files new file mode 100644 index 0000000000..960da6079d --- /dev/null +++ b/modules/30_crop/rotation_apr22/input/files @@ -0,0 +1,7 @@ +* list of files that are required here +f30_rotation_max_scen.csv +f30_rotation_min_scen.csv +avl_cropland.cs3 +avl_cropland_0.5.mz +f30_croparea_w_initialisation.cs3 +avl_cropland_iso.cs3 diff --git a/modules/30_crop/rotation_apr22/postsolve.gms b/modules/30_crop/rotation_apr22/postsolve.gms new file mode 100644 index 0000000000..f0dddfe6f9 --- /dev/null +++ b/modules/30_crop/rotation_apr22/postsolve.gms @@ -0,0 +1,62 @@ +*** | (C) 2008-2023 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_fallow(t,j,"marginal") = vm_fallow.m(j); + ov_area(t,j,kcr,w,"marginal") = vm_area.m(j,kcr,w); + ov_rotation_penalty(t,i,"marginal") = vm_rotation_penalty.m(i); + oq30_cropland(t,j,"marginal") = q30_cropland.m(j); + oq30_avl_cropland(t,j,"marginal") = q30_avl_cropland.m(j); + oq30_rotation_max(t,j,rotamax30,"marginal") = q30_rotation_max.m(j,rotamax30); + oq30_rotation_min(t,j,rotamin30,"marginal") = q30_rotation_min.m(j,rotamin30); + oq30_rotation_max_irrig(t,j,rotamax30,"marginal") = q30_rotation_max_irrig.m(j,rotamax30); + oq30_prod(t,j,kcr,"marginal") = q30_prod.m(j,kcr); + oq30_carbon(t,j,ag_pools,stockType,"marginal") = q30_carbon.m(j,ag_pools,stockType); + oq30_bv_ann(t,j,potnatveg,"marginal") = q30_bv_ann.m(j,potnatveg); + oq30_bv_per(t,j,potnatveg,"marginal") = q30_bv_per.m(j,potnatveg); + oq30_land_snv(t,j,"marginal") = q30_land_snv.m(j); + ov_fallow(t,j,"level") = vm_fallow.l(j); + ov_area(t,j,kcr,w,"level") = vm_area.l(j,kcr,w); + ov_rotation_penalty(t,i,"level") = vm_rotation_penalty.l(i); + oq30_cropland(t,j,"level") = q30_cropland.l(j); + oq30_avl_cropland(t,j,"level") = q30_avl_cropland.l(j); + oq30_rotation_max(t,j,rotamax30,"level") = q30_rotation_max.l(j,rotamax30); + oq30_rotation_min(t,j,rotamin30,"level") = q30_rotation_min.l(j,rotamin30); + oq30_rotation_max_irrig(t,j,rotamax30,"level") = q30_rotation_max_irrig.l(j,rotamax30); + oq30_prod(t,j,kcr,"level") = q30_prod.l(j,kcr); + oq30_carbon(t,j,ag_pools,stockType,"level") = q30_carbon.l(j,ag_pools,stockType); + oq30_bv_ann(t,j,potnatveg,"level") = q30_bv_ann.l(j,potnatveg); + oq30_bv_per(t,j,potnatveg,"level") = q30_bv_per.l(j,potnatveg); + oq30_land_snv(t,j,"level") = q30_land_snv.l(j); + ov_fallow(t,j,"upper") = vm_fallow.up(j); + ov_area(t,j,kcr,w,"upper") = vm_area.up(j,kcr,w); + ov_rotation_penalty(t,i,"upper") = vm_rotation_penalty.up(i); + oq30_cropland(t,j,"upper") = q30_cropland.up(j); + oq30_avl_cropland(t,j,"upper") = q30_avl_cropland.up(j); + oq30_rotation_max(t,j,rotamax30,"upper") = q30_rotation_max.up(j,rotamax30); + oq30_rotation_min(t,j,rotamin30,"upper") = q30_rotation_min.up(j,rotamin30); + oq30_rotation_max_irrig(t,j,rotamax30,"upper") = q30_rotation_max_irrig.up(j,rotamax30); + oq30_prod(t,j,kcr,"upper") = q30_prod.up(j,kcr); + oq30_carbon(t,j,ag_pools,stockType,"upper") = q30_carbon.up(j,ag_pools,stockType); + oq30_bv_ann(t,j,potnatveg,"upper") = q30_bv_ann.up(j,potnatveg); + oq30_bv_per(t,j,potnatveg,"upper") = q30_bv_per.up(j,potnatveg); + oq30_land_snv(t,j,"upper") = q30_land_snv.up(j); + ov_fallow(t,j,"lower") = vm_fallow.lo(j); + ov_area(t,j,kcr,w,"lower") = vm_area.lo(j,kcr,w); + ov_rotation_penalty(t,i,"lower") = vm_rotation_penalty.lo(i); + oq30_cropland(t,j,"lower") = q30_cropland.lo(j); + oq30_avl_cropland(t,j,"lower") = q30_avl_cropland.lo(j); + oq30_rotation_max(t,j,rotamax30,"lower") = q30_rotation_max.lo(j,rotamax30); + oq30_rotation_min(t,j,rotamin30,"lower") = q30_rotation_min.lo(j,rotamin30); + oq30_rotation_max_irrig(t,j,rotamax30,"lower") = q30_rotation_max_irrig.lo(j,rotamax30); + oq30_prod(t,j,kcr,"lower") = q30_prod.lo(j,kcr); + oq30_carbon(t,j,ag_pools,stockType,"lower") = q30_carbon.lo(j,ag_pools,stockType); + oq30_bv_ann(t,j,potnatveg,"lower") = q30_bv_ann.lo(j,potnatveg); + oq30_bv_per(t,j,potnatveg,"lower") = q30_bv_per.lo(j,potnatveg); + oq30_land_snv(t,j,"lower") = q30_land_snv.lo(j); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/30_crop/rotation_apr22/preloop.gms b/modules/30_crop/rotation_apr22/preloop.gms new file mode 100644 index 0000000000..feaa2aeed3 --- /dev/null +++ b/modules/30_crop/rotation_apr22/preloop.gms @@ -0,0 +1,40 @@ +*** | (C) 2008-2023 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 + + +** Trajectory for cropland scenarios +* sigmoidal interpolation between start year and target year +m_sigmoid_interpol(p30_snv_scenario_fader,s30_snv_scenario_start,s30_snv_scenario_target,0,1); +m_sigmoid_interpol(p30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1); + + +** create crop rotation scenario +i30_rotation_max_shr(t_all,rotamax30)= + f30_rotation_max_shr(rotamax30,"default") * (1-p30_rotation_scenario_fader(t_all))+ + f30_rotation_max_shr(rotamax30,"%c30_rotation_scenario%") * (p30_rotation_scenario_fader(t_all)); + +i30_rotation_min_shr(t_all,rotamin30)= + f30_rotation_min_shr(rotamin30,"default") * (1-p30_rotation_scenario_fader(t_all))+ + f30_rotation_min_shr(rotamin30,"%c30_rotation_scenario%") * (p30_rotation_scenario_fader(t_all)); + + +*due to some rounding errors the input data currently may contain in some cases +*very small, negative numbers. These numbers have to be set to 0 as area +*cannot be smaller than 0! +fm_croparea(t_past,j,w,kcr)$(fm_croparea(t_past,j,w,kcr)<0) = 0; + +****** Regional share of semi-natural vegetation (SNV) in cropland areas for selective countries: +* Country switch to determine countries for which a SNV policy shall be applied. +* In the default case, the SNV policy affects all countries when activated. +p30_country_dummy(iso) = 0; +p30_country_dummy(policy_countries30) = 1; +* Because MAgPIE is not run at country-level, but at region level, a region +* share is calculated that translates the countries' influence to regional level. +* Countries are weighted by available cropland area. +i30_avl_cropland_iso(iso) = f30_avl_cropland_iso(iso,"%c30_marginal_land%"); +p30_country_snv_weight(i) = sum(i_to_iso(i,iso), p30_country_dummy(iso) * i30_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), i30_avl_cropland_iso(iso)); + diff --git a/modules/30_crop/rotation_apr22/presolve.gms b/modules/30_crop/rotation_apr22/presolve.gms new file mode 100644 index 0000000000..989bc33c34 --- /dev/null +++ b/modules/30_crop/rotation_apr22/presolve.gms @@ -0,0 +1,36 @@ +*** | (C) 2008-2023 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 +*' First, all 2nd generation bioenergy area is fixed to zero, irrespective of type and +*' rainfed/irrigation. +vm_area.fx(j,kbe30,w)=0; +*' Second, the bounds for 2nd generation bioenergy area are released depending on +*' the dynamic sets bioen_type_30 and bioen_water_30. +*' SSP2 default settings are used for the historic period. +if(m_year(t) <= sm_fix_SSP2, + vm_area.up(j,kbe30,"rainfed") = Inf; +else + vm_area.up(j,bioen_type_30,bioen_water_30) = Inf; +); +*' @stop + +*' @code +*' Minimum semi-natural vegetation (SNV) share is fading in after 2020 +p30_snv_shr(t,j) = p30_snv_scenario_fader(t) * + (s30_snv_shr * sum(cell(i,j), p30_country_snv_weight(i)) + + s30_snv_shr_noselect * sum(cell(i,j), 1-p30_country_snv_weight(i))); + +*' Area potentially available for cropping +p30_avl_cropland(t,j) = f30_avl_cropland(j,"%c30_marginal_land%") * (1 - p30_snv_shr(t,j)); +*' @stop + +* only activate constraints which are binding +rotamax_red30(rotamax30) = yes$(i30_rotation_max_shr(t,rotamax30) < 1); +rotamin_red30(rotamin30) = yes$(i30_rotation_min_shr(t,rotamin30) > 0); + +vm_rotation_penalty.fx(i)=0; diff --git a/modules/30_crop/rotation_apr22/realization.gms b/modules/30_crop/rotation_apr22/realization.gms new file mode 100644 index 0000000000..c44c0f6d12 --- /dev/null +++ b/modules/30_crop/rotation_apr22/realization.gms @@ -0,0 +1,41 @@ +*** | (C) 2008-2023 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 rotation_apr21 realization calculates the crop specific +*' agricultural land use endogenously based on yield data coming from the +*' module [14_yields] and the rotational as well as suitability constraints +*' stated in the input data of the module. +*' +*' Cropland areas are linked to the crop specific production and the carbon +*' content of the different land carbon pools. The crop specific land use areas +*' are also used in [18_residues], [38_factor_costs], +*' [41_area_equipped_for_irrigation], [42_water_demand], [50_nr_soil_budget], +*' [53_methane] and [59_som]. + +*' This module realization allows for different scenarios of rotational +*' constraints. These are implemented as hard constraints. Maximum rotational +*' constraints are defined for total cropland as well as for irrigated areas +*' only to avoid overspecialization on irrigated land. Minimum constraints are +*' just valid for total cropland areas. + +*' This realisation also includes the option to reserve a minimum semi-natural +*' vegetation share within the total available cropland for other land cover +*' classes, including grassland, forest, and other land (by a given target year), +*' in order to provide species habitats and to benefit from ecosystem ervices in +*' agricultural landscapes. + +*' @limitations There are currently no known limitations of this realization. + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/30_crop/rotation_apr22/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/30_crop/rotation_apr22/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/30_crop/rotation_apr22/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/30_crop/rotation_apr22/equations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/30_crop/rotation_apr22/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/30_crop/rotation_apr22/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/30_crop/rotation_apr22/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/30_crop/rotation_apr22/sets.gms b/modules/30_crop/rotation_apr22/sets.gms new file mode 100644 index 0000000000..d519f0f135 --- /dev/null +++ b/modules/30_crop/rotation_apr22/sets.gms @@ -0,0 +1,104 @@ +*** | (C) 2008-2023 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 + rotascen30 rotation constraint scenarios + /min,default,good,good_20div,setaside,legumes,agroforestry,sixfoldrotation,agroecology/ + + rotamax30 Maximum crop rotation categories + / all_max, cereals_excl_rice_max, stalk_max, + biomass_max, roots_max, legume_max, rape_sugr_max, + tece_max, maiz_max, trce_max, rice_max, + rapeseed_max, soybean_max, sunflower_max, groundnut_max, + oilpalm_max, puls_max, potato_max, cassava_max, + sugr_cane_max, sugr_beet_max, others_max, foddr_max, + fiber_max, begr_max, betr_max + / + + rotamin30 Minimum crop rotation categories + / + all_min, stalk_min, biomass_min, + legume_min, others_min + / + + rotamax_red30(rotamax30) Maximum crop rotation reduced set + rotamin_red30(rotamin30) Minimum crop rotation reduced set + +* crop rotation groups: +* cereals or grasses are very favourable to loosen soils, therefore minimum constraint +* legumes need longer rotations, only soybean can and is cultivated every 2 years +* rapeseed and beets have same nematodes +* root crops have similar diseases + +* Sustainable practices: +* >=5% set-aside, >=5% biomass crops that approximate agroforestry systems +* six fold crop rotation of the remaining 90% +* at least one legume slot in crop rotation +* crop groups with multiple members like tece or foddr are allowed multiple slots +* one percent fruits and vegs in each cell for regional demand + + rotamax_kcr30(rotamax30, kcr) Mapping of crop types into crop rotation types + / all_max . (tece, maiz, trce, rice_pro, soybean, rapeseed, groundnut, sunflower, + oilpalm, puls_pro, potato, cassav_sp, sugr_cane, sugr_beet, others, + foddr, cottn_pro, begr, betr) + cereals_excl_rice_max . (tece, maiz, trce) + stalk_max . (tece, maiz, trce, rice_pro, sugr_cane, begr, foddr) + roots_max . (potato, cassav_sp, sugr_beet) + legume_max . (soybean, groundnut, puls_pro, foddr) + biomass_max . (sugr_cane, oilpalm, begr, betr) + rape_sugr_max . (rapeseed, sugr_beet) + + tece_max . (tece) + maiz_max . (maiz) + trce_max . (trce) + rice_max . (rice_pro) + rapeseed_max . (rapeseed) + soybean_max . (soybean) + sunflower_max . (sunflower) + groundnut_max . (groundnut) + oilpalm_max . (oilpalm) + puls_max . (puls_pro) + potato_max . (potato) + cassava_max . (cassav_sp) + sugr_cane_max . (sugr_cane) + sugr_beet_max . (sugr_beet) + others_max . (others) + foddr_max . (foddr) + fiber_max . (cottn_pro) + begr_max . (begr) + betr_max . (betr) / + + rotamin_kcr30(rotamin30,kcr) Mapping of crop types into crop rotation types + / all_min . (tece, maiz, trce, rice_pro, soybean, rapeseed, groundnut, sunflower, + oilpalm, puls_pro, potato, cassav_sp, sugr_cane, sugr_beet, others, + foddr, cottn_pro, begr, betr) + + stalk_min . (tece, maiz, trce, rice_pro, sugr_cane, foddr) + biomass_min . (sugr_cane, oilpalm, begr, betr) + legume_min . (soybean, groundnut, puls_pro, foddr) + others_min . (others) + / + + + kbe30(kcr) bio energy activities + / betr, begr / + + bioen_type_30(kbe30) dynamic set bioen type + bioen_water_30(w) dynamic set bioen water + + crop_ann30(kcr) annual crops + / tece, maiz, trce, rice_pro, rapeseed, sunflower, potato, cassav_sp, sugr_beet, others, cottn_pro, foddr, soybean, groundnut, puls_pro / + + crop_per30(kcr) perennial crops + / oilpalm, begr, sugr_cane, betr / + + marginal_land30 Marginal land scenarios + / all_marginal, q33_marginal, no_marginal / + + policy_target30 Target year for cropland policy + / none, by2030, by2050 / +; diff --git a/modules/31_past/endo_jun13/declarations.gms b/modules/31_past/endo_jun13/declarations.gms index 3fe7713d98..71a71a7e36 100644 --- a/modules/31_past/endo_jun13/declarations.gms +++ b/modules/31_past/endo_jun13/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -8,20 +8,23 @@ equations q31_prod(j) Cellular pasture production constraint (mio. tDM per yr) - q31_carbon(j,ag_pools) Above ground carbon content calculation for pasture (mio tC) + q31_carbon(j,ag_pools,stockType) Above ground carbon content calculation for pasture (mio tC) q31_cost_prod_past(i) Costs for putting animals on pastures (mio. USD05MER per yr) q31_bv_manpast(j,potnatveg) Biodiversity value for managed pastures (Mha) - q31_bv_rangeland(j,potnatveg) Biodiversity value for managed pastures (Mha) + q31_bv_rangeland(j,potnatveg) Biodiversity value for rangeland (Mha) ; - +positive variables + vm_cost_prod_past(i) Costs for putting animals on pastures (mio. USD05MER per yr) +; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - oq31_prod(t,j,type) Cellular pasture production constraint (mio. tDM per yr) - oq31_carbon(t,j,ag_pools,type) Above ground carbon content calculation for pasture (mio tC) - oq31_cost_prod_past(t,i,type) Costs for putting animals on pastures (mio. USD05MER per yr) - oq31_bv_manpast(t,j,potnatveg,type) Biodiversity value for managed pastures (Mha) - oq31_bv_rangeland(t,j,potnatveg,type) Biodiversity value for managed pastures (Mha) + ov_cost_prod_past(t,i,type) Costs for putting animals on pastures (mio. USD05MER per yr) + oq31_prod(t,j,type) Cellular pasture production constraint (mio. tDM per yr) + oq31_carbon(t,j,ag_pools,stockType,type) Above ground carbon content calculation for pasture (mio tC) + oq31_cost_prod_past(t,i,type) Costs for putting animals on pastures (mio. USD05MER per yr) + oq31_bv_manpast(t,j,potnatveg,type) Biodiversity value for managed pastures (Mha) + oq31_bv_rangeland(t,j,potnatveg,type) Biodiversity value for rangeland (Mha) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/31_past/endo_jun13/equations.gms b/modules/31_past/endo_jun13/equations.gms index 3df0b8ba24..d161720f71 100644 --- a/modules/31_past/endo_jun13/equations.gms +++ b/modules/31_past/endo_jun13/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -15,13 +15,13 @@ q31_prod(j2) .. vm_prod(j2,"pasture") =l= vm_land(j2,"past") - * vm_yld(j2,"pasture","rainfed"); + * vm_yld(j2,"pasture","rainfed"); *' On the basis of the required pasture area, cellular above ground carbon stocks are calculated: -q31_carbon(j2,ag_pools) .. - vm_carbon_stock(j2,"past",ag_pools) =e= - sum(ct, vm_land(j2,"past")*fm_carbon_density(ct,j2,"past",ag_pools)); +q31_carbon(j2,ag_pools,stockType) .. + vm_carbon_stock(j2,"past",ag_pools,stockType) =e= + m_carbon_stock(vm_land,fm_carbon_density,"past"); *' In the initial calibration time step, where the pasture calibration factor *' is calculated that brings pasture biomass demand and pasture area in balance, @@ -29,20 +29,19 @@ q31_carbon(j2,ag_pools) .. *' avoid overproduction of pasture in the model: q31_cost_prod_past(i2) .. - vm_cost_prod(i2,"pasture") =e= vm_prod_reg(i2,"pasture") - * s31_fac_req_past; + vm_cost_prod_past(i2) =e= sum(cell(i2,j2), vm_prod(j2,"pasture")) * s31_fac_req_past; *' For all following time steps, factor requriements `s31_fac_req_past` are set *' to zero. *' By estimating the different area of managed pasture and rangeland via the luh2 side layers, the biodiversity value for pastures and rangeland is calculated in following: q31_bv_manpast(j2,potnatveg) .. vm_bv(j2,"manpast",potnatveg) - =e= - vm_land(j2,"past") * fm_luh2_side_layers(j2,"manpast") * fm_bii_coeff("manpast",potnatveg) * fm_luh2_side_layers(j2,potnatveg); + =e= + vm_land(j2,"past") * fm_luh2_side_layers(j2,"manpast") * fm_bii_coeff("manpast",potnatveg) * fm_luh2_side_layers(j2,potnatveg); q31_bv_rangeland(j2,potnatveg) .. vm_bv(j2,"rangeland",potnatveg) - =e= - vm_land(j2,"past") * fm_luh2_side_layers(j2,"rangeland") * fm_bii_coeff("rangeland",potnatveg) * fm_luh2_side_layers(j2,potnatveg); + =e= + vm_land(j2,"past") * fm_luh2_side_layers(j2,"rangeland") * fm_bii_coeff("rangeland",potnatveg) * fm_luh2_side_layers(j2,potnatveg); *** EOF constraints.gms *** diff --git a/modules/31_past/endo_jun13/input.gms b/modules/31_past/endo_jun13/input.gms index 932ee3d1b6..a7389a7f47 100644 --- a/modules/31_past/endo_jun13/input.gms +++ b/modules/31_past/endo_jun13/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/31_past/endo_jun13/not_used.txt b/modules/31_past/endo_jun13/not_used.txt index 8ae4a31613..18bfcce33c 100644 --- a/modules/31_past/endo_jun13/not_used.txt +++ b/modules/31_past/endo_jun13/not_used.txt @@ -1,9 +1,5 @@ -# | (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 pcm_land, input, not needed +vm_tau,input,questionnaire +fm_pastr_tau_hist,input,questionnaire +sm_fix_SSP2, input, not needed diff --git a/modules/31_past/endo_jun13/postsolve.gms b/modules/31_past/endo_jun13/postsolve.gms index 183b244566..0e9e7046ff 100644 --- a/modules/31_past/endo_jun13/postsolve.gms +++ b/modules/31_past/endo_jun13/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -10,26 +10,30 @@ s31_fac_req_past = 0; *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - oq31_prod(t,j,"marginal") = q31_prod.m(j); - oq31_carbon(t,j,ag_pools,"marginal") = q31_carbon.m(j,ag_pools); - oq31_cost_prod_past(t,i,"marginal") = q31_cost_prod_past.m(i); - oq31_bv_manpast(t,j,potnatveg,"marginal") = q31_bv_manpast.m(j,potnatveg); - oq31_bv_rangeland(t,j,potnatveg,"marginal") = q31_bv_rangeland.m(j,potnatveg); - oq31_prod(t,j,"level") = q31_prod.l(j); - oq31_carbon(t,j,ag_pools,"level") = q31_carbon.l(j,ag_pools); - oq31_cost_prod_past(t,i,"level") = q31_cost_prod_past.l(i); - oq31_bv_manpast(t,j,potnatveg,"level") = q31_bv_manpast.l(j,potnatveg); - oq31_bv_rangeland(t,j,potnatveg,"level") = q31_bv_rangeland.l(j,potnatveg); - oq31_prod(t,j,"upper") = q31_prod.up(j); - oq31_carbon(t,j,ag_pools,"upper") = q31_carbon.up(j,ag_pools); - oq31_cost_prod_past(t,i,"upper") = q31_cost_prod_past.up(i); - oq31_bv_manpast(t,j,potnatveg,"upper") = q31_bv_manpast.up(j,potnatveg); - oq31_bv_rangeland(t,j,potnatveg,"upper") = q31_bv_rangeland.up(j,potnatveg); - oq31_prod(t,j,"lower") = q31_prod.lo(j); - oq31_carbon(t,j,ag_pools,"lower") = q31_carbon.lo(j,ag_pools); - oq31_cost_prod_past(t,i,"lower") = q31_cost_prod_past.lo(i); - oq31_bv_manpast(t,j,potnatveg,"lower") = q31_bv_manpast.lo(j,potnatveg); - oq31_bv_rangeland(t,j,potnatveg,"lower") = q31_bv_rangeland.lo(j,potnatveg); + ov_cost_prod_past(t,i,"marginal") = vm_cost_prod_past.m(i); + oq31_prod(t,j,"marginal") = q31_prod.m(j); + oq31_carbon(t,j,ag_pools,stockType,"marginal") = q31_carbon.m(j,ag_pools,stockType); + oq31_cost_prod_past(t,i,"marginal") = q31_cost_prod_past.m(i); + oq31_bv_manpast(t,j,potnatveg,"marginal") = q31_bv_manpast.m(j,potnatveg); + oq31_bv_rangeland(t,j,potnatveg,"marginal") = q31_bv_rangeland.m(j,potnatveg); + ov_cost_prod_past(t,i,"level") = vm_cost_prod_past.l(i); + oq31_prod(t,j,"level") = q31_prod.l(j); + oq31_carbon(t,j,ag_pools,stockType,"level") = q31_carbon.l(j,ag_pools,stockType); + oq31_cost_prod_past(t,i,"level") = q31_cost_prod_past.l(i); + oq31_bv_manpast(t,j,potnatveg,"level") = q31_bv_manpast.l(j,potnatveg); + oq31_bv_rangeland(t,j,potnatveg,"level") = q31_bv_rangeland.l(j,potnatveg); + ov_cost_prod_past(t,i,"upper") = vm_cost_prod_past.up(i); + oq31_prod(t,j,"upper") = q31_prod.up(j); + oq31_carbon(t,j,ag_pools,stockType,"upper") = q31_carbon.up(j,ag_pools,stockType); + oq31_cost_prod_past(t,i,"upper") = q31_cost_prod_past.up(i); + oq31_bv_manpast(t,j,potnatveg,"upper") = q31_bv_manpast.up(j,potnatveg); + oq31_bv_rangeland(t,j,potnatveg,"upper") = q31_bv_rangeland.up(j,potnatveg); + ov_cost_prod_past(t,i,"lower") = vm_cost_prod_past.lo(i); + oq31_prod(t,j,"lower") = q31_prod.lo(j); + oq31_carbon(t,j,ag_pools,stockType,"lower") = q31_carbon.lo(j,ag_pools,stockType); + oq31_cost_prod_past(t,i,"lower") = q31_cost_prod_past.lo(i); + oq31_bv_manpast(t,j,potnatveg,"lower") = q31_bv_manpast.lo(j,potnatveg); + oq31_bv_rangeland(t,j,potnatveg,"lower") = q31_bv_rangeland.lo(j,potnatveg); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### *** EOF postsolve.gms *** diff --git a/modules/20_processing/off/presolve.gms b/modules/31_past/endo_jun13/presolve.gms similarity index 59% rename from modules/20_processing/off/presolve.gms rename to modules/31_past/endo_jun13/presolve.gms index af4ca610c0..ac1ca86a72 100644 --- a/modules/20_processing/off/presolve.gms +++ b/modules/31_past/endo_jun13/presolve.gms @@ -1,12 +1,9 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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_dem_processing.fx(i,kall)=0; -vm_secondary_overproduction.fx(i,ksd,kpr)=0; - -vm_processing_substitution_cost.fx(i)=0; +*' Total grassland area cannot be smaller than legally protected grassland area +vm_land.lo(j,"past") = sum(consv_type, pm_land_conservation(t,j,"past",consv_type)); diff --git a/modules/31_past/endo_jun13/realization.gms b/modules/31_past/endo_jun13/realization.gms index e0e9f2bd92..541cef90a5 100644 --- a/modules/31_past/endo_jun13/realization.gms +++ b/modules/31_past/endo_jun13/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -21,5 +21,6 @@ $Ifi "%phase%" == "declarations" $include "./modules/31_past/endo_jun13/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/31_past/endo_jun13/input.gms" $Ifi "%phase%" == "equations" $include "./modules/31_past/endo_jun13/equations.gms" +$Ifi "%phase%" == "presolve" $include "./modules/31_past/endo_jun13/presolve.gms" $Ifi "%phase%" == "postsolve" $include "./modules/31_past/endo_jun13/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/31_past/grasslands_apr22/declarations.gms b/modules/31_past/grasslands_apr22/declarations.gms new file mode 100644 index 0000000000..9743a84715 --- /dev/null +++ b/modules/31_past/grasslands_apr22/declarations.gms @@ -0,0 +1,52 @@ +*** | (C) 2008-2023 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 +q31_carbon(j,ag_pools,stockType) Above ground carbon content calculation for pasture (mio tC) +q31_cost_prod_past(i) Costs for putting animals on grasslands and shifting between grassland types (mio. USD05MER per yr) +q31_bv_manpast(j,potnatveg) Biodiversity value for managed pastures (Mha) +q31_bv_rangeland(j,potnatveg) Biodiversity value for rangeland (Mha) +q31_pasture_areas(j) Total grassland calculation (mio. ha) +q31_prod_pm(j) Cellular grass production constraint (mio. tDM per yr) +q31_expansion_cost(j, grassland) Grassland expansion cost constraint (mio. USD05MER) +; + +positive variables +v31_grass_area(j,grassland) Grassland areas (mio. ha) +v31_cost_grass_expansion(j, grassland) Costs of grassland expansion (mio. USD05MER) +vm_cost_prod_past(i) Costs for putting animals on grasslands and shifting between grassland types (mio. USD05MER per yr) +; + +parameters +i31_manpast_suit(t_all,j) Areas suitable for managed pastures (mio. ha) +pc31_grass(j,grassland) Grassland areas in previous time step (mio. ha) +i31_grass_calib(t_all,j,grassland) Regional grassland calibration factor correcting for FAO yield levels (1) +i31_grass_modeled_yld(t_all,i,grassland) Biophysical input yields average over region and grassland cover type at the historical reference year (tDM per ha) +i31_grass_yields(t_all,j,grassland) Cellular biophysical input yields (tDM per ha) +i31_grassl_areas(t_all,j) Celullar grassland areas (mio. ha) +i31_lambda_grass(t,i,grassland) Grassland Scaling factor for non-linear management calibration (1) +i31_grassl_yld_hist_reg(t,i,grassland) Grassland FAO yields per region at the historical referende year (tDM per ha) +i31_grass_hist_yld(t_all,i, grassland) FAO gassland yields (tDM per ha) +; + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov31_grass_area(t,j,grassland,type) Grassland areas (mio. ha) + ov31_cost_grass_expansion(t,j,grassland,type) Costs of grassland expansion (mio. USD05MER) + ov_cost_prod_past(t,i,type) Costs for putting animals on grasslands and shifting between grassland types (mio. USD05MER per yr) + oq31_carbon(t,j,ag_pools,stockType,type) Above ground carbon content calculation for pasture (mio tC) + oq31_cost_prod_past(t,i,type) Costs for putting animals on grasslands and shifting between grassland types (mio. USD05MER per yr) + oq31_bv_manpast(t,j,potnatveg,type) Biodiversity value for managed pastures (Mha) + oq31_bv_rangeland(t,j,potnatveg,type) Biodiversity value for rangeland (Mha) + oq31_pasture_areas(t,j,type) Total grassland calculation (mio. ha) + oq31_prod_pm(t,j,type) Cellular grass production constraint (mio. tDM per yr) + oq31_expansion_cost(t,j,grassland,type) Grassland expansion cost constraint (mio. USD05MER) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### + +*** EOF declarations.gms *** diff --git a/modules/31_past/grasslands_apr22/equations.gms b/modules/31_past/grasslands_apr22/equations.gms new file mode 100644 index 0000000000..1c63563ac3 --- /dev/null +++ b/modules/31_past/grasslands_apr22/equations.gms @@ -0,0 +1,56 @@ +*** | (C) 2008-2023 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 + +*' Grassland production is estimated by multiplying grassland areas and yields. +*' Technological change is applied to managed pastures yields through 'vm_tau', +*' whereas rangeland yields are kept unaltered after the preloop calibration of +*' 'i31_grass_yields'. + +q31_prod_pm(j2) .. + vm_prod(j2,"pasture") =l= v31_grass_area(j2,"range") * sum(ct,i31_grass_yields(ct,j2,"range")) + + v31_grass_area(j2,"pastr") * sum(ct,i31_grass_yields(ct,j2,"pastr")) * + sum((cell(i2,j2), supreg(h2,i2)), vm_tau(h2, "pastr") / fm_pastr_tau_hist("y1995",h2)); + +*' The sum of managed pastures and rangelands areas equal the parent +*' land class pastures areas in 'vm_land'. + +q31_pasture_areas(j2).. + vm_land(j2,"past") =e= sum(grassland, v31_grass_area(j2,grassland)); + +*' To avoid unrealistic conversions between rangelands and managed pastures areas, +*' a cost is associated with the expansion of rangelands and managed pastures 'v31_cost_grass_expansion' +*' in comparison with areas in the previous time step 'pc31_grass'. + +q31_expansion_cost(j2,grassland) .. + v31_cost_grass_expansion(j2, grassland) =g= + (v31_grass_area(j2, grassland) - pc31_grass(j2,grassland)) * s31_cost_expansion; + +*' Cost of production account for the cost of moving animals to grassland areas plus the costs of +*' expanding aras of production. + +q31_cost_prod_past(i2) .. + vm_cost_prod_past(i2) =e= sum(cell(i2,j2), vm_prod(j2,"pasture")) * s31_cost_grass_prod + + sum((cell(i2,j2), grassland), v31_cost_grass_expansion(j2,grassland)); + +*' On the basis of the required pasture area, cellular above ground carbon stocks are calculated: + +q31_carbon(j2,ag_pools,stockType) .. + vm_carbon_stock(j2,"past",ag_pools,stockType) =e= + m_carbon_stock(vm_land,fm_carbon_density,"past"); + +*' By estimating the different area of managed pasture and rangeland via the luh2 side layers, the biodiversity value for pastures and rangeland is calculated in following: + q31_bv_manpast(j2,potnatveg) .. vm_bv(j2,"manpast",potnatveg) + =e= + vm_land(j2,"past") * fm_luh2_side_layers(j2,"manpast") * fm_bii_coeff("manpast",potnatveg) * fm_luh2_side_layers(j2,potnatveg); + + q31_bv_rangeland(j2,potnatveg) .. vm_bv(j2,"rangeland",potnatveg) + =e= + vm_land(j2,"past") * fm_luh2_side_layers(j2,"rangeland") * fm_bii_coeff("rangeland",potnatveg) * fm_luh2_side_layers(j2,potnatveg); + +*** EOF constraints.gms *** diff --git a/modules/31_past/grasslands_apr22/input.gms b/modules/31_past/grasslands_apr22/input.gms new file mode 100644 index 0000000000..03a32fcd1c --- /dev/null +++ b/modules/31_past/grasslands_apr22/input.gms @@ -0,0 +1,40 @@ +*** | (C) 2008-2023 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 + + +scalars + s31_cost_expansion Grasslands expansion costs (USD05MER per hectare) / 1 / + s31_cost_grass_prod Grasslands factor costs (USD05MER per tDM) / 1 / +; + +$setglobal c31_past_suit_scen ssp370 + +table f31_pastr_suitability(t_all,j,ssp_past) Areas suitable for pasture management (mio. ha) +$ondelim +$include "./modules/31_past/input/f31_pastr_suitability.cs3" + +$offdelim +; + +table f31_LUH2v2(t_all,j,f31_luh) Different land type areas (mio. ha) +$ondelim +$include "./modules/31_past/input/f31_LUH2v2.cs3" +$offdelim +; + +scalar s31_limit_calib Relative managament calibration switch (1=limited 0=pure relative) / 1 /; + +table f31_grassl_yld(t_all,j,grassland,w) LPJmL potential yields per cell (rainfed only) (tDM per ha) +$ondelim +$include "./modules/31_past/input/f31_grassl_yld.cs3" +$offdelim +; + +table f31_grass_bio(t_all,i, grassland) Estimated regional grass biomass consumption in the past (tDM) +$ondelim +$include "./modules/31_past/input/f31_grass_bio_hist.cs3" +$offdelim; diff --git a/modules/31_past/grasslands_apr22/not_used.txt b/modules/31_past/grasslands_apr22/not_used.txt new file mode 100644 index 0000000000..d1f943c5f1 --- /dev/null +++ b/modules/31_past/grasslands_apr22/not_used.txt @@ -0,0 +1,3 @@ +name,type,reason +pcm_land, input, not needed +vm_yld,variable, not needed diff --git a/modules/31_past/grasslands_apr22/postsolve.gms b/modules/31_past/grasslands_apr22/postsolve.gms new file mode 100644 index 0000000000..1e49507775 --- /dev/null +++ b/modules/31_past/grasslands_apr22/postsolve.gms @@ -0,0 +1,54 @@ +*** | (C) 2008-2023 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 + +*** Land Patterns are transferred to next timestep + pc31_grass(j,grassland) = v31_grass_area.l(j,grassland); + +*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### + ov31_grass_area(t,j,grassland,"marginal") = v31_grass_area.m(j,grassland); + ov31_cost_grass_expansion(t,j,grassland,"marginal") = v31_cost_grass_expansion.m(j,grassland); + ov_cost_prod_past(t,i,"marginal") = vm_cost_prod_past.m(i); + oq31_carbon(t,j,ag_pools,stockType,"marginal") = q31_carbon.m(j,ag_pools,stockType); + oq31_cost_prod_past(t,i,"marginal") = q31_cost_prod_past.m(i); + oq31_bv_manpast(t,j,potnatveg,"marginal") = q31_bv_manpast.m(j,potnatveg); + oq31_bv_rangeland(t,j,potnatveg,"marginal") = q31_bv_rangeland.m(j,potnatveg); + oq31_pasture_areas(t,j,"marginal") = q31_pasture_areas.m(j); + oq31_prod_pm(t,j,"marginal") = q31_prod_pm.m(j); + oq31_expansion_cost(t,j,grassland,"marginal") = q31_expansion_cost.m(j,grassland); + ov31_grass_area(t,j,grassland,"level") = v31_grass_area.l(j,grassland); + ov31_cost_grass_expansion(t,j,grassland,"level") = v31_cost_grass_expansion.l(j,grassland); + ov_cost_prod_past(t,i,"level") = vm_cost_prod_past.l(i); + oq31_carbon(t,j,ag_pools,stockType,"level") = q31_carbon.l(j,ag_pools,stockType); + oq31_cost_prod_past(t,i,"level") = q31_cost_prod_past.l(i); + oq31_bv_manpast(t,j,potnatveg,"level") = q31_bv_manpast.l(j,potnatveg); + oq31_bv_rangeland(t,j,potnatveg,"level") = q31_bv_rangeland.l(j,potnatveg); + oq31_pasture_areas(t,j,"level") = q31_pasture_areas.l(j); + oq31_prod_pm(t,j,"level") = q31_prod_pm.l(j); + oq31_expansion_cost(t,j,grassland,"level") = q31_expansion_cost.l(j,grassland); + ov31_grass_area(t,j,grassland,"upper") = v31_grass_area.up(j,grassland); + ov31_cost_grass_expansion(t,j,grassland,"upper") = v31_cost_grass_expansion.up(j,grassland); + ov_cost_prod_past(t,i,"upper") = vm_cost_prod_past.up(i); + oq31_carbon(t,j,ag_pools,stockType,"upper") = q31_carbon.up(j,ag_pools,stockType); + oq31_cost_prod_past(t,i,"upper") = q31_cost_prod_past.up(i); + oq31_bv_manpast(t,j,potnatveg,"upper") = q31_bv_manpast.up(j,potnatveg); + oq31_bv_rangeland(t,j,potnatveg,"upper") = q31_bv_rangeland.up(j,potnatveg); + oq31_pasture_areas(t,j,"upper") = q31_pasture_areas.up(j); + oq31_prod_pm(t,j,"upper") = q31_prod_pm.up(j); + oq31_expansion_cost(t,j,grassland,"upper") = q31_expansion_cost.up(j,grassland); + ov31_grass_area(t,j,grassland,"lower") = v31_grass_area.lo(j,grassland); + ov31_cost_grass_expansion(t,j,grassland,"lower") = v31_cost_grass_expansion.lo(j,grassland); + ov_cost_prod_past(t,i,"lower") = vm_cost_prod_past.lo(i); + oq31_carbon(t,j,ag_pools,stockType,"lower") = q31_carbon.lo(j,ag_pools,stockType); + oq31_cost_prod_past(t,i,"lower") = q31_cost_prod_past.lo(i); + oq31_bv_manpast(t,j,potnatveg,"lower") = q31_bv_manpast.lo(j,potnatveg); + oq31_bv_rangeland(t,j,potnatveg,"lower") = q31_bv_rangeland.lo(j,potnatveg); + oq31_pasture_areas(t,j,"lower") = q31_pasture_areas.lo(j); + oq31_prod_pm(t,j,"lower") = q31_prod_pm.lo(j); + oq31_expansion_cost(t,j,grassland,"lower") = q31_expansion_cost.lo(j,grassland); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### + +*** EOF postsolve.gms *** diff --git a/modules/31_past/grasslands_apr22/preloop.gms b/modules/31_past/grasslands_apr22/preloop.gms new file mode 100644 index 0000000000..3b480a8f1b --- /dev/null +++ b/modules/31_past/grasslands_apr22/preloop.gms @@ -0,0 +1,96 @@ +*** | (C) 2008-2023 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 + +i31_manpast_suit(t_all,j) = f31_pastr_suitability(t_all,j,"%c31_past_suit_scen%"); +i31_manpast_suit(t_all,j)$(m_year(t_all) <= sm_fix_SSP2) = f31_pastr_suitability(t_all,j,"ssp245"); +pc31_grass(j,grassland) = f31_LUH2v2("y1995",j,grassland); + + +***YIELD CORRECTION ACCOUNTING FOR REGIONAL DIFFERENCES IN MANAGEMENT*** + +*' @code + +*' Grassland yields for rangelands and managed pastures are calibrated to match estimated +*' historical pasture productivity. + +*' The following equations calibrate the grassland cellular yield patterns ('f31_grassl_yld') to match +*' 'estimated historical yields' ('i31_grass_hist_yld') by calculating a calibration term called +*' 'i31_grass_calib'. For most cases, 'i31_grass_calib' is the ratio of the 'i31_grass_hist_yld' +*' and modeled yields ('i31_grass_modeled_yld') given historic grassland area patterns +*' ('i31_grassl_areas') and cellular yields coming from crop models like LPJmL 'f31_grassl_yld'. +*' In these cases, 'i31_grass_calib' represents a purely relative calibration factor that depends +*' only on the initial conditions of the starting year. +*' +*' However, when estimated yields 'i31_grass_hist_yld' are significantly higher than +*' given by the cellular yield inputs 'f31_grassl_yld' we refer to this as an underestimated +*' baseline. In this situation 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, we introduce the factor 'i31_lambda_grass' that determines the degree +*' to which the baseline 'i31_grass_hist_yld' is under- or overestimated by the modeled yields +*' 'i31_grass_modeled_yld'. This factor is used to control whether the calibration factor is +*' applied as an absolute or relative change. For 'i31_grass_hist_yld' smaller than +*' 'i31_grass_modeled_yld' (overestimated baseline) 'i31_lambda_grass' is 1, which is +*' equivalent to an entirely relative calibration. For underestimated yields, 'i31_lambda_grass' +*' is calculated as the squared root of the ratio between modeled yields 'i31_grass_modeled_yld' +*' and the historical estimates 'i31_grass_hist_yld'. For underestimated yields, as 'i31_lambda_grass' +*' 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 +* 's31_limit_calib' can be used to switch limited calibration on (1) and off (0). + +i31_grass_yields(t,j,grassland) = f31_grassl_yld(t,j,grassland,"rainfed"); +i31_grassl_areas(t_all,j) = sum(grassland, f31_LUH2v2(t_all,j,grassland)); +i31_grass_hist_yld(t_past,i,grassland) = (f31_grass_bio(t_past,i, grassland) / + sum(cell(i,j),f31_LUH2v2(t_past,j,grassland)))$(sum(cell(i,j), f31_LUH2v2(t_past,j,grassland))>0); + +i31_grass_modeled_yld(t_past,i,grassland) + = (sum(cell(i,j),i31_grass_yields(t_past,j,grassland) * f31_LUH2v2(t_past,j,grassland)) / + sum(cell(i,j),f31_LUH2v2(t_past,j,grassland)))$(sum(cell(i,j), f31_LUH2v2(t_past,j,grassland))>0) + + (sum(cell(i,j),i31_grassl_areas(t_past,j) * i31_grass_yields(t_past,j,grassland)) / + sum(cell(i,j),i31_grassl_areas(t_past,j)))$(sum(cell(i,j), f31_LUH2v2(t_past,j,grassland))=0); + +loop(t, + if(sum(sameas(t,"y1995"),1)=1, + + if ((s31_limit_calib = 0), + i31_lambda_grass(t,i,grassland) = 1; + + Elseif (s31_limit_calib =1 ), + i31_lambda_grass(t,i,grassland) = + 1$(i31_grass_hist_yld(t,i,grassland) <= i31_grass_modeled_yld(t,i,grassland)) + + sqrt(i31_grass_modeled_yld(t,i,grassland)/i31_grass_hist_yld(t,i,grassland))$ + (i31_grass_hist_yld(t,i,grassland) > i31_grass_modeled_yld(t,i,grassland)); + ); + + i31_grassl_yld_hist_reg(t,i,grassland) = i31_grass_hist_yld(t,i,grassland); + + Else + i31_grass_modeled_yld(t,i,grassland) = i31_grass_modeled_yld(t-1,i,grassland); + i31_grassl_yld_hist_reg(t,i,grassland) = i31_grassl_yld_hist_reg(t-1,i,grassland); + i31_lambda_grass(t,i,grassland) = i31_lambda_grass(t-1,i,grassland); + ); +); + + +*' The calibrated cellular yield 'i31_grass_yields' is calculated for each time step depending +*' on the constant values 'i31_grass_modeled_yld', 'i31_grassl_yld_hist_reg', 'i31_lambda_grass' +*' and the uncalibrated, cellular yield 'f31_grassl_yld' following the idea of eq. (9) in @Heinke.2013: + +i31_grass_calib(t,j,grassland) = + 1 + (sum(cell(i,j), i31_grassl_yld_hist_reg(t,i,grassland) - i31_grass_modeled_yld(t,i,grassland)) / + f31_grassl_yld(t,j,grassland,"rainfed") * + (f31_grassl_yld(t,j,grassland,"rainfed") / (sum(cell(i,j),i31_grass_modeled_yld(t,i,grassland))+10**(-8))) ** + sum(cell(i,j),i31_lambda_grass(t,i,grassland)))$(f31_grassl_yld(t,j,grassland,"rainfed")>0); + +i31_grass_yields(t,j,"range") = i31_grass_yields(t,j,"range") * i31_grass_calib(t,j,"range"); +i31_grass_yields(t,j,"pastr") = i31_grass_yields(t,j,"pastr") * i31_grass_calib(t,j,"pastr"); + +*' Note that the calculation is split into two parts for better readability. +*' @stop diff --git a/modules/31_past/grasslands_apr22/presolve.gms b/modules/31_past/grasslands_apr22/presolve.gms new file mode 100644 index 0000000000..c0fe50de66 --- /dev/null +++ b/modules/31_past/grasslands_apr22/presolve.gms @@ -0,0 +1,20 @@ +*** | (C) 2008-2023 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 + +*' Socioeconomic and environmental conditions determine the potential managed pastures +*' areas ('i31_manpast_suit'). 'i31_manpast_suit' is estimated by determining areas +*' with more than five inhabitants per km2 and with aridity greater than 0.5 following +*' the methodology established by @KleinGoldewijk.2017 + +v31_grass_area.up(j,"pastr") = i31_manpast_suit(t,j); + +*' Total grassland area cannot be smaller than legally protected grassland area +vm_land.lo(j,"past") = sum(consv_type, pm_land_conservation(t,j,"past",consv_type)); + +*' @stop diff --git a/modules/31_past/grasslands_apr22/realization.gms b/modules/31_past/grasslands_apr22/realization.gms new file mode 100644 index 0000000000..595ecb1085 --- /dev/null +++ b/modules/31_past/grasslands_apr22/realization.gms @@ -0,0 +1,40 @@ +*** | (C) 2008-2023 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 In the grasslands_apr22 realization, grassland areas and related +*' carbon stocks are modelled endogenously. The initial spatially explicit patterns +*' of grasslands ("past") are defined in the module [10_land] by the land use input +*' data set. These areas are further divided into rangelands and managed pastures +*' under different management assumptions. For future time steps, grasslands spatial +*' distribution depend on the demand of grass biomass to feed livestock as calculated +*' in the module [70_livestock] and from the intensity of grassland utilization +*' ("grassland yields"). Grassland yields are defined separately for rangelands +*' and managed pasture based on historical estimates or areas and biomass production +*' for these two systems. Managed pastures yields can be increased endogenously +*' by investments in technology as calculated in [13_tc]. Rising yields alter the +*' nitrogen budged on grasslands triggering costs for N inorganic fertilization as +*' calculated in [50_nr_soil_budget] and control the balance between intensive and +*' extensive grass biomass production. + +*' @limitations At the moment this realization only runs with a single climate scenario +*' (SPP1-RCP2p6 from MRI_ESM-0), which is used in all (except constant climate) settings. +*' We currently do not accout for specific differences within intensive +*' pasture management systems and related degradation of grasslands for both +*' rangelands or managed pastures. Grass production costs and conversion costs between +*' grassland types are set 1 USD05MER per unit due to lack of data. + + + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/31_past/grasslands_apr22/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/31_past/grasslands_apr22/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/31_past/grasslands_apr22/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/31_past/grasslands_apr22/equations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/31_past/grasslands_apr22/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/31_past/grasslands_apr22/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/31_past/grasslands_apr22/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/31_past/grasslands_apr22/sets.gms b/modules/31_past/grasslands_apr22/sets.gms new file mode 100644 index 0000000000..a157221583 --- /dev/null +++ b/modules/31_past/grasslands_apr22/sets.gms @@ -0,0 +1,25 @@ +*** | (C) 2008-2023 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 + + f31_luh LHUv2 land cover types + / primf, primn, secdf, secdn, urban, c3ann, c4ann, c3per, c4per, c3nfx, pastr, range / + + grassland(f31_luh) Grassland cover types (pastr = managed pastures and range = rangelands) + / pastr, range / + + grass_to31(grassland) pasture management options + / pastr,range / + + grass_from31(grassland) pasture management options + / pastr,range / + + ssp_past SSP scenarios for pasture suitability areas + / ssp126, ssp245, ssp370, ssp460, ssp585 / + +; diff --git a/modules/31_past/input/files b/modules/31_past/input/files new file mode 100644 index 0000000000..f4f049409d --- /dev/null +++ b/modules/31_past/input/files @@ -0,0 +1,5 @@ +* list of files that are required here +f31_pastr_suitability.cs3 +f31_LUH2v2.cs3 +f31_grassl_yld.cs3 +f31_grass_bio_hist.cs3 diff --git a/modules/31_past/module.gms b/modules/31_past/module.gms index 2b1c9338f1..7d2f5fca6f 100644 --- a/modules/31_past/module.gms +++ b/modules/31_past/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -14,9 +14,10 @@ *' different pasture carbon pools. Furthermore, it delivers regional production *' costs associated with pastures and biodiversity values for pasture and rangeland. *' -*' @authors Isabelle Weindl, Jan Philipp Dietrich +*' @authors Isabelle Weindl, Jan Philipp Dietrich, Marcos Alves *###################### R SECTION START (MODULETYPES) ########################## $Ifi "%past%" == "endo_jun13" $include "./modules/31_past/endo_jun13/realization.gms" +$Ifi "%past%" == "grasslands_apr22" $include "./modules/31_past/grasslands_apr22/realization.gms" $Ifi "%past%" == "static" $include "./modules/31_past/static/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/31_past/static/not_used.txt b/modules/31_past/static/not_used.txt index 212f3cedc0..637a12d740 100644 --- a/modules/31_past/static/not_used.txt +++ b/modules/31_past/static/not_used.txt @@ -1,11 +1,7 @@ -# | (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, input, not needed vm_yld, input, not needed -vm_prod_reg,input,questionnaire +pm_land_conservation,input,questionnaire +vm_tau,input,questionnaire +fm_pastr_tau_hist,input,questionnaire +sm_fix_SSP2, input, not needed diff --git a/modules/31_past/static/presolve.gms b/modules/31_past/static/presolve.gms index fecdfd9d15..c50aa961a0 100644 --- a/modules/31_past/static/presolve.gms +++ b/modules/31_past/static/presolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -18,13 +18,13 @@ vm_carbon_stock.fx(j,"past",ag_pools) = *' Also the biodiversity value (BV) for pasture is fixed vm_bv.fx(j,"manpast",potnatveg) = - pcm_land(j,"past") * fm_luh2_side_layers(j,"manpast") * fm_bii_coeff("manpast",potnatveg) * fm_luh2_side_layers(j,potnatveg); + pcm_land(j,"past") * fm_luh2_side_layers(j,"manpast") * fm_bii_coeff("manpast",potnatveg) * fm_luh2_side_layers(j,potnatveg); vm_bv.fx(j,"rangeland",potnatveg) = - pcm_land(j,"past") * fm_luh2_side_layers(j,"rangeland") * fm_bii_coeff("rangeland",potnatveg) * fm_luh2_side_layers(j,potnatveg); + pcm_land(j,"past") * fm_luh2_side_layers(j,"rangeland") * fm_bii_coeff("rangeland",potnatveg) * fm_luh2_side_layers(j,potnatveg); *' Regional costs associated with pasture management are set to zero. -vm_cost_prod.fx(i,"pasture") = 0; +vm_cost_prod_past.fx(i) = 0; *' @stop diff --git a/modules/31_past/static/realization.gms b/modules/31_past/static/realization.gms index 5abb7fb86b..d68c45ba51 100644 --- a/modules/31_past/static/realization.gms +++ b/modules/31_past/static/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/32_forestry/dynamic_feb21/declarations.gms b/modules/32_forestry/dynamic_feb21/declarations.gms index 4917d80262..112cf412b6 100644 --- a/modules/32_forestry/dynamic_feb21/declarations.gms +++ b/modules/32_forestry/dynamic_feb21/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,20 +6,21 @@ *** | Contact: magpie@pik-potsdam.de scalars s32_shift Number of 5-year age-classes corresponding to current time step length (1) - p32_max_aff_area Maximum global afforestation area that is greater or equal the exogenous policy target (mio. ha) s32_establishment_dynamic If plantations should be dynamic (including establishment and harvest decsions) s32_establishment_static Static plantations with no establishmnet no harvest no regrowth ; parameters + i32_max_aff_area_glo(t) Maximum global endogenous afforestation area (mio. ha) + i32_max_aff_area_reg(t,i) Maximum regional endogenous afforestation area (mio. ha) p32_aff_pol(t,j) NDC forest stock (mio. ha) p32_aff_pol_timestep(t,j) NDC afforestation per time step (mio. ha) p32_aff_pot(t,j) Potential afforestation area (mio. ha) - p32_aff_togo(t) Remaining exogenous afforestation wrt to the maximum exogenous target over time (mio. ha) + p32_aff_togo(t,i) Remaining exogenous afforestation wrt to the maximum exogenous target over time (mio. ha) p32_carbon_density_ac(t,j,type32,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha) p32_carbon_density_ac_forestry(t_all,j,ac) Above ground carbon density for age classes and carbon pools (tC per ha) p32_carbon_density_ac_marg(t_all,j,ac) Marginal above ground carbon density for age classes and carbon pools (tC per ha) - pc32_area_rotation(j) Forestry area at rotation length end used as weight for regional aggregation (mio. ha) + pc32_area_rotation(j) Forestry area at rotation length end used as weight for regional aggregation (mio. ha) p32_land(t,j,type32,ac) Forestry land for each cell wood type and age class before and after optimization (mio. ha) pc32_land(j,type32,ac) Forestry land per forestry land type initialization of the optimization (mio. ha) pc32_yield_forestry_future(j) Cellular timber yield expected in the future (m3 per ha per year) @@ -54,7 +55,11 @@ parameters p32_plantation_contribution(t_ext,i) Share of roundwood production coming from timber plantations (percent) p32_ac_dist_flag(j,ac) Distribution flag with inverse weights according to age-classes (1) p32_ac_dist(j,ac) Actual share of age-class distribution (1) - ; + 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 vm_cost_fore(i) Forestry costs (Mio USD) @@ -78,22 +83,23 @@ equations q32_cost_total(i) Total forestry costs constraint (mio. USD) q32_land(j) Land constraint (mio. ha) q32_cdr_aff(j,ac) Calculation of CDR from afforestation (mio. tC) - q32_carbon(j,ag_pools) Forestry carbon stock calculation (mio. tC) + q32_carbon(j,ag_pools,stockType) Forestry carbon stock calculation (mio. tC) q32_land_diff Aggregated difference in forestry land compared to previous timestep (mio. ha) - q32_max_aff Maximum total global afforestation (mio. ha) + q32_max_aff Maximum total global afforestation (mio. ha) + q32_max_aff_reg(i) Maximum total regional afforestation (mio. ha) q32_aff_pol(j) Afforestation policy constraint (mio. ha) q32_aff_est(j) Afforestation constraint for establishment age classes (mio. ha) q32_hvarea_forestry(j,ac) Plantations area harvest (mio. ha) q32_cost_recur(i) Recurruing costs (mio. USD) q32_establishment_dynamic(i) Establishment in current time step for future demand (mio. ha) - q32_establishment_dynamic_yield(i) Regional timber yield (tDM per ha) - q32_establishment_fixed(j) Establishment in current time step for future demand (mio. ha) + q32_establishment_dynamic_yield(i) Regional timber yield (tDM per ha) + q32_establishment_fixed(j) Establishment in current time step for future demand (mio. ha) q32_land_expansion(j,type32,ac) Land expansion (mio. ha) q32_land_reduction(j,type32,ac) Land contraction (mio. ha) q32_cost_establishment(i) Present value of cost of establishment (mio. USD) q32_bgp_aff(j,ac) Biophysical afforestation calculation (mio. tCeq) q32_forestry_est(j,type32,ac) Distribution of forestry establishment over ac_est (mio. ha) - q32_cost_hvarea(i) Cost of harvesting timber from forests (mio. USD per yr) + q32_cost_hvarea(i) Cost of harvesting timber from forests (mio. USD per yr) q32_prod_forestry(j) Production of woody biomass from commercial plantations (mio. tDM per yr) q32_bv_aff(j,potnatveg) Biodiversity value for aff forestry land (Mha) q32_bv_ndc(j,potnatveg) Biodiversity value for ndc forestry land (Mha) @@ -118,9 +124,10 @@ parameters oq32_cost_total(t,i,type) Total forestry costs constraint (mio. USD) oq32_land(t,j,type) Land constraint (mio. ha) oq32_cdr_aff(t,j,ac,type) Calculation of CDR from afforestation (mio. tC) - oq32_carbon(t,j,ag_pools,type) Forestry carbon stock calculation (mio. tC) + oq32_carbon(t,j,ag_pools,stockType,type) Forestry carbon stock calculation (mio. tC) oq32_land_diff(t,type) Aggregated difference in forestry land compared to previous timestep (mio. ha) oq32_max_aff(t,type) Maximum total global afforestation (mio. ha) + oq32_max_aff_reg(t,i,type) Maximum total regional afforestation (mio. ha) oq32_aff_pol(t,j,type) Afforestation policy constraint (mio. ha) oq32_aff_est(t,j,type) Afforestation constraint for establishment age classes (mio. ha) oq32_hvarea_forestry(t,j,ac,type) Plantations area harvest (mio. ha) diff --git a/modules/32_forestry/dynamic_feb21/equations.gms b/modules/32_forestry/dynamic_feb21/equations.gms index 4e4f639070..d17234cce2 100644 --- a/modules/32_forestry/dynamic_feb21/equations.gms +++ b/modules/32_forestry/dynamic_feb21/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -21,11 +21,11 @@ *' in a parametrized form. q32_cost_total(i2) .. vm_cost_fore(i2) =e= - v32_cost_recur(i2) - + v32_cost_establishment(i2) - + v32_cost_hvarea(i2) - + sum(cell(i2,j2), v32_land_missing(j2)) * s32_free_land_cost - ; + v32_cost_recur(i2) + + v32_cost_establishment(i2) + + v32_cost_hvarea(i2) + + sum(cell(i2,j2), v32_land_missing(j2)) * s32_free_land_cost + ; *----------------------------------------------- ****** Carbon price induced afforestation ****** @@ -61,15 +61,19 @@ sum(ac_est, v32_land(j2,"aff",ac_est)) =l= sum(ac, v32_land(j2,"aff",ac)) - sum( q32_aff_pol(j2) .. sum(ac_est, v32_land(j2,"ndc",ac_est)) =e= sum(ct, p32_aff_pol_timestep(ct,j2)); -*' The constraint `q32_max_aff` accounts for the allowed maximum global -*' afforestation defined in `p32_max_aff_area`. Note that NPI/NDC afforestation -*' policies are counted towards the maximum defined in `p32_max_aff_area`. -*' Therefore, the right-hand side of the constraint is tightened by the value of -*' the exogenously prescribed afforestation that has to be realized in later -*' time steps (`p32_aff_togo`). +*' The constraint `q32_max_aff` accounts for the allowed maximum global endogenous +*' afforestation defined in `i32_max_aff_area_glo`. +*' The constraint `q32_max_aff_reg` accounts for the allowed maximum regional endogenous +*' afforestation defined in `i32_max_aff_area_reg`. +*' Only one of the two constraints is active, depending on `s32_max_aff_area_glo`. - q32_max_aff .. sum((j2,type32,ac)$(not sameas(type32,"plant")), v32_land(j2,type32,ac)) - =l= p32_max_aff_area - sum(ct, p32_aff_togo(ct)); + q32_max_aff$(s32_max_aff_area_glo=1) .. + sum((j2,ac), v32_land(j2,"aff",ac)) + =l= sum(ct, i32_max_aff_area_glo(ct)); + + q32_max_aff_reg(i2)$(s32_max_aff_area_glo=0) .. + sum((cell(i2,j2),ac), v32_land(j2,"aff",ac)) + =l= sum(ct, i32_max_aff_area_reg(ct,i2)); *----------------------------------------------- ************** Carbon stock ******************** @@ -77,39 +81,40 @@ sum(ac_est, v32_land(j2,"aff",ac_est)) =l= sum(ac, v32_land(j2,"aff",ac)) - sum( *' Forestry above ground carbon stocks are calculated as the product of forestry land (`v32_land`) and the area *' weighted mean of carbon density for carbon pools (`p32_carbon_density_ac`). - q32_carbon(j2,ag_pools) .. vm_carbon_stock(j2,"forestry",ag_pools) =e= - sum((type32,ac), v32_land(j2,type32,ac)* - sum(ct, p32_carbon_density_ac(ct,j2,type32,ac,ag_pools))); + q32_carbon(j2,ag_pools,stockType) .. vm_carbon_stock(j2,"forestry",ag_pools,stockType) =e= + m_carbon_stock_ac(v32_land,p32_carbon_density_ac,"type32,ac","type32,ac_sub"); *' Forestry land expansion and reduction is calculated as follows: q32_land_diff .. vm_landdiff_forestry =e= sum((j2,type32,ac), - v32_land_expansion(j2,type32,ac) - + v32_land_reduction(j2,type32,ac)); + v32_land_expansion(j2,type32,ac) + + v32_land_reduction(j2,type32,ac)); q32_land_expansion(j2,type32,ac_est) .. - v32_land_expansion(j2,type32,ac_est) =e= v32_land(j2,type32,ac_est) - pc32_land(j2,type32,ac_est); + v32_land_expansion(j2,type32,ac_est) =e= v32_land(j2,type32,ac_est) - pc32_land(j2,type32,ac_est); q32_land_reduction(j2,type32,ac_sub) .. - v32_land_reduction(j2,type32,ac_sub) =e= pc32_land(j2,type32,ac_sub) - v32_land(j2,type32,ac_sub); + v32_land_reduction(j2,type32,ac_sub) =e= pc32_land(j2,type32,ac_sub) - v32_land(j2,type32,ac_sub); *------------------------------------------ *********** Biodiversity value ************ *------------------------------------------ q32_bv_aff(j2,potnatveg) .. vm_bv(j2,"aff_co2p",potnatveg) - =e= - sum(ac_mature, v32_land(j2,"aff",ac_mature)) * fm_bii_coeff("secd_mature",potnatveg) * fm_luh2_side_layers(j2,potnatveg) - + sum(ac_young, v32_land(j2,"aff",ac_young)) * fm_bii_coeff("secd_young",potnatveg) * fm_luh2_side_layers(j2,potnatveg); + =e= + sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v32_land(j2,"aff",ac)) * + p32_bii_coeff("aff",bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); q32_bv_ndc(j2,potnatveg) .. vm_bv(j2,"aff_ndc",potnatveg) - =e= - sum(ac_mature, v32_land(j2,"ndc",ac_mature)) * fm_bii_coeff("secd_mature",potnatveg) * fm_luh2_side_layers(j2,potnatveg) - + sum(ac_young, v32_land(j2,"ndc",ac_young)) * fm_bii_coeff("secd_young",potnatveg) * fm_luh2_side_layers(j2,potnatveg); + =e= + sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v32_land(j2,"ndc",ac)) * + p32_bii_coeff("ndc",bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); q32_bv_plant(j2,potnatveg) .. vm_bv(j2,"plant",potnatveg) - =e= - sum(ac, v32_land(j2,"plant",ac)) * fm_bii_coeff("timber",potnatveg) * fm_luh2_side_layers(j2,potnatveg); + =e= + sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v32_land(j2,"plant",ac)) * + p32_bii_coeff("plant",bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); + ************************************************************ **** Timber production related equations in plantations **** @@ -126,8 +131,8 @@ q32_bv_plant(j2,potnatveg) .. vm_bv(j2,"plant",potnatveg) *' investment over time. q32_cost_establishment(i2).. - v32_cost_establishment(i2) - =e= + v32_cost_establishment(i2) + =e= (sum((cell(i2,j2),type32,ac_est), v32_land(j2,type32,ac_est) * s32_reESTBcost) ) * sum(ct,pm_interest(ct,i2)/(1+pm_interest(ct,i2))); @@ -160,16 +165,15 @@ q32_cost_recur(i2) .. v32_cost_recur(i2) =e= q32_establishment_dynamic(i2)$s32_establishment_dynamic .. sum(cell(i2,j2), ((sum(ac_est, v32_land(j2,"plant",ac_est)) + v32_land_missing(j2)) / m_timestep_length_forestry) * pc32_yield_forestry_future_reg(i2)) =e= - sum((ct,kforestry), pm_demand_forestry_future(i2,kforestry) * min(s32_max_self_suff, pm_selfsuff_ext(ct,i2,kforestry)) * p32_plantation_contribution(ct,i2) * f32_estb_calib(i2)) + sum((ct,kforestry), pm_demand_forestry_future(i2,kforestry) * min(s32_max_self_suff, sum(supreg(h2,i2),pm_selfsuff_ext(ct,h2,kforestry))) * p32_plantation_contribution(ct,i2) * f32_estb_calib(i2)) ; *' Constraint to maintain the average regional timber yield at rotation age, accounting for the cellular timber yield (`pc32_yield_forestry_future`). q32_establishment_dynamic_yield(i2)$s32_establishment_dynamic .. - sum(cell(i2,j2), (sum(ac_est, v32_land(j2,"plant",ac_est))+v32_land_missing(j2)) * pc32_yield_forestry_future(j2)) - / (sum(cell(i2,j2), sum(ac_est, v32_land(j2,"plant",ac_est))+v32_land_missing(j2))) - =e= - pc32_yield_forestry_future_reg(i2); + sum(cell(i2,j2), (sum(ac_est, v32_land(j2,"plant",ac_est))+v32_land_missing(j2)) * pc32_yield_forestry_future(j2)) + =e= + pc32_yield_forestry_future_reg(i2) * (sum(cell(i2,j2), sum(ac_est, v32_land(j2,"plant",ac_est))+v32_land_missing(j2))); *' If plantations have to be static (defined by `s32_establishment_static`) then *' the model simply establishes the amount of plantations which are harvested. @@ -177,7 +181,7 @@ q32_establishment_dynamic_yield(i2)$s32_establishment_dynamic .. *' regrowth during every time step. q32_establishment_fixed(j2)$s32_establishment_static .. - sum(ac, v32_land(j2,"plant",ac)) =e= sum(ac, pc32_land(j2,"plant",ac)); + sum(ac, v32_land(j2,"plant",ac)) =e= sum(ac, pc32_land(j2,"plant",ac)); *' This constraint distributes additions to forestry land over ac_est, diff --git a/modules/32_forestry/dynamic_feb21/input.gms b/modules/32_forestry/dynamic_feb21/input.gms index 48beb5ed47..7e8362645b 100644 --- a/modules/32_forestry/dynamic_feb21/input.gms +++ b/modules/32_forestry/dynamic_feb21/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -10,7 +10,6 @@ $setglobal c32_aff_mask noboreal * options: unrestricted, noboreal, onlytropical $setglobal c32_aff_policy npi * options: none, npi, ndc - $setglobal c32_aff_bgp nobgp * options: ann,nobgp $setglobal c32_tcre_ctrl ann_TCREmean @@ -21,9 +20,16 @@ $setglobal c32_dev_scen abare * options abare, brown $setglobal c32_incr_rate h5s2l1 * options constant,h5s5l5,h5s2l2,h5s2l1,h5s1l1,h5s1l05,h2s1l05 +$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 / + s32_hvarea Flag for harvested area and establishemt (0=zero 1=exognous 2=endogneous) / 0 / s32_reESTBcost Re establishment cost (USD per ha) / 2000 / s32_recurring_cost Recurring costs (USD per ha) / 500 / s32_harvesting_cost Harvesting cost (USD per ha) / 1000 / @@ -35,10 +41,12 @@ scalars s32_free_land_cost Very high cost for using non existing land for plantation establishment (USD per ha) /1000000/ s32_max_aff_area Maximum total global afforestation (mio. ha) / Inf / s32_aff_plantation Switch for using growth curves for afforestation 0=natveg 1=plantations (1) / 0 / - s32_timber_plantation Switch for using growth curves for timber plantations 0=natveg 1=plantations (1) / 1 / s32_tcre_local Switch for local (1) or global (0) TRCE factors (1) / 1 / s32_forestry_int_rate Global interest rate for plantations (percent) / 0.05 / s32_max_self_suff Upper ceiling for the self sufficiency used in calculation for establishment decision (1) / 0.8 / + s32_aff_bii_coeff BII coefficent to be used for CO2 price driven afforestation 0=natural vegetation 1=plantation (1) / 0 / + s32_max_aff_area_glo Switch for global or regional afforestation constraint (1) / 1 / + s32_aff_prot Switch for protection of afforested areas (0=until end of planning horizon 1=forever) / 0 / ; parameter f32_aff_mask(j) afforestation mask (binary) @@ -50,6 +58,15 @@ $Ifi "%c32_aff_mask%" == "onlytropical" $include "./modules/32_forestry/input/af $offdelim /; +$onEmpty +parameter f32_max_aff_area(i) Maximum regional afforestation area (mio. ha) +/ +$ondelim +$if exist "./modules/32_forestry/input/f32_max_aff_area.cs4" $include "./modules/32_forestry/input/f32_max_aff_area.cs4" +$offdelim +/; +$offEmpty + table f32_aff_pol(t_all,j,pol32) npi+ndc afforestation policy (Mha new forest wrt to 2010) $ondelim $include "./modules/32_forestry/input/npi_ndc_aff_pol.cs3" @@ -109,3 +126,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/not_used.txt b/modules/32_forestry/dynamic_feb21/not_used.txt deleted file mode 100644 index 7d90bb006f..0000000000 --- a/modules/32_forestry/dynamic_feb21/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_supply, var, other module diff --git a/modules/32_forestry/dynamic_feb21/postsolve.gms b/modules/32_forestry/dynamic_feb21/postsolve.gms index 9c7db2fbd4..c8d03d0a2e 100644 --- a/modules/32_forestry/dynamic_feb21/postsolve.gms +++ b/modules/32_forestry/dynamic_feb21/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -25,9 +25,10 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); oq32_cost_total(t,i,"marginal") = q32_cost_total.m(i); oq32_land(t,j,"marginal") = q32_land.m(j); oq32_cdr_aff(t,j,ac,"marginal") = q32_cdr_aff.m(j,ac); - oq32_carbon(t,j,ag_pools,"marginal") = q32_carbon.m(j,ag_pools); + oq32_carbon(t,j,ag_pools,stockType,"marginal") = q32_carbon.m(j,ag_pools,stockType); oq32_land_diff(t,"marginal") = q32_land_diff.m; oq32_max_aff(t,"marginal") = q32_max_aff.m; + oq32_max_aff_reg(t,i,"marginal") = q32_max_aff_reg.m(i); oq32_aff_pol(t,j,"marginal") = q32_aff_pol.m(j); oq32_aff_est(t,j,"marginal") = q32_aff_est.m(j); oq32_hvarea_forestry(t,j,ac,"marginal") = q32_hvarea_forestry.m(j,ac); @@ -60,9 +61,10 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); oq32_cost_total(t,i,"level") = q32_cost_total.l(i); oq32_land(t,j,"level") = q32_land.l(j); oq32_cdr_aff(t,j,ac,"level") = q32_cdr_aff.l(j,ac); - oq32_carbon(t,j,ag_pools,"level") = q32_carbon.l(j,ag_pools); + oq32_carbon(t,j,ag_pools,stockType,"level") = q32_carbon.l(j,ag_pools,stockType); oq32_land_diff(t,"level") = q32_land_diff.l; oq32_max_aff(t,"level") = q32_max_aff.l; + oq32_max_aff_reg(t,i,"level") = q32_max_aff_reg.l(i); oq32_aff_pol(t,j,"level") = q32_aff_pol.l(j); oq32_aff_est(t,j,"level") = q32_aff_est.l(j); oq32_hvarea_forestry(t,j,ac,"level") = q32_hvarea_forestry.l(j,ac); @@ -95,9 +97,10 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); oq32_cost_total(t,i,"upper") = q32_cost_total.up(i); oq32_land(t,j,"upper") = q32_land.up(j); oq32_cdr_aff(t,j,ac,"upper") = q32_cdr_aff.up(j,ac); - oq32_carbon(t,j,ag_pools,"upper") = q32_carbon.up(j,ag_pools); + oq32_carbon(t,j,ag_pools,stockType,"upper") = q32_carbon.up(j,ag_pools,stockType); oq32_land_diff(t,"upper") = q32_land_diff.up; oq32_max_aff(t,"upper") = q32_max_aff.up; + oq32_max_aff_reg(t,i,"upper") = q32_max_aff_reg.up(i); oq32_aff_pol(t,j,"upper") = q32_aff_pol.up(j); oq32_aff_est(t,j,"upper") = q32_aff_est.up(j); oq32_hvarea_forestry(t,j,ac,"upper") = q32_hvarea_forestry.up(j,ac); @@ -130,9 +133,10 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); oq32_cost_total(t,i,"lower") = q32_cost_total.lo(i); oq32_land(t,j,"lower") = q32_land.lo(j); oq32_cdr_aff(t,j,ac,"lower") = q32_cdr_aff.lo(j,ac); - oq32_carbon(t,j,ag_pools,"lower") = q32_carbon.lo(j,ag_pools); + oq32_carbon(t,j,ag_pools,stockType,"lower") = q32_carbon.lo(j,ag_pools,stockType); oq32_land_diff(t,"lower") = q32_land_diff.lo; oq32_max_aff(t,"lower") = q32_max_aff.lo; + oq32_max_aff_reg(t,i,"lower") = q32_max_aff_reg.lo(i); oq32_aff_pol(t,j,"lower") = q32_aff_pol.lo(j); oq32_aff_est(t,j,"lower") = q32_aff_est.lo(j); oq32_hvarea_forestry(t,j,ac,"lower") = q32_hvarea_forestry.lo(j,ac); diff --git a/modules/32_forestry/dynamic_feb21/preloop.gms b/modules/32_forestry/dynamic_feb21/preloop.gms index 93872e5196..4702a2457f 100644 --- a/modules/32_forestry/dynamic_feb21/preloop.gms +++ b/modules/32_forestry/dynamic_feb21/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -30,9 +30,24 @@ p32_IGR(t_all,j,ac) = (p32_carbon_density_ac_marg(t_all,j,ac)/p32_carbon_densi $ifthen "%c32_interest_rate%" == "regional" p32_rot_flg(t_all,j,ac) = 1$(p32_IGR(t_all,j,ac) - sum(cell(i,j),pm_interest("y1995",i)) > 0) + 0$(p32_IGR(t_all,j,ac) - sum(cell(i,j),pm_interest("y1995",i)) <= 0); + display "Rotation lengths are calculated based on equating instantaneous growth rate to regional interest rate."; $elseif "%c32_interest_rate%" == "global" p32_rot_flg(t_all,j,ac) = 1$(p32_IGR(t_all,j,ac) - s32_forestry_int_rate > 0) + 0$(p32_IGR(t_all,j,ac) - s32_forestry_int_rate <= 0); + display "Rotation lengths are calculated based on equating instantaneous growth rate to global interest rate."; +$endif + +$ifthen "%c32_rot_calc_type%" == "current_annual_increment" + p32_rot_flg(t_all,j,ac) = 1$(p32_carbon_density_ac_marg(t_all,j,ac) - p32_carbon_density_ac_marg(t_all,j,ac-1) > 0) + + 0$(p32_carbon_density_ac_marg(t_all,j,ac) - p32_carbon_density_ac_marg(t_all,j,ac-1) <= 0); + display "Rotation lengths are calculated based on maximizing current annual increment in this run."; +$endif + +$ifthen "%c32_rot_calc_type%" == "mean_annual_increment" + p32_avg_increment(t_all,j,ac) = pm_carbon_density_ac_forestry(t_all,j,ac,"vegc") / ((ord(ac)+1)*5); + p32_rot_flg(t_all,j,ac) = 1$(p32_carbon_density_ac_marg(t_all,j,ac) - p32_avg_increment(t_all,j,ac) > 0) + + 0$(p32_carbon_density_ac_marg(t_all,j,ac) - p32_avg_increment(t_all,j,ac) <= 0); + display "Rotation lengths are calculated based on maximizing mean annual increment in this run."; $endif ** From the above calculation, now it is easier to count how many age-classes can be sustained before IGR falls below interest rate. @@ -119,16 +134,6 @@ loop(t_all, p32_rotation_cellular_harvesting(t_all+1,j)$(abs(p32_rotation_cellular_harvesting(t_all+1,j) - p32_rotation_cellular_harvesting(t_all,j))>2 AND ord(t_all)1) = (p32_ac_dist(j,ac) - (sum(ac2, p32_ac_dist(j,ac2))-1)/p32_ac_dist_flag(j,"ac0"))$(ord(ac) <= p32_rotation_cellular_harvesting("y1995",j)); +** In case the sum of distribution is > 1 : Remove the excess from ac0 + p32_ac_dist(j,"ac0")$(sum(ac2, p32_ac_dist(j,ac2))>1) = p32_ac_dist(j,"ac0") - (sum(ac2, p32_ac_dist(j,ac2))-1); +** In case the sum of distribution is < 1 : Add the shortage to ac0 + p32_ac_dist(j,"ac0")$(sum(ac2, p32_ac_dist(j,ac2))<1) = p32_ac_dist(j,"ac0") + (1-sum(ac2, p32_ac_dist(j,ac2))); ); ** Isolate plantations from planted forest (forestry) p32_plant_ini_ac(j) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i)); @@ -200,10 +208,40 @@ elseif s32_initial_distribution = 4, ); ); - +** Redistribute to youngest age class in case the distribution to plantations and +** ndcs does not match fully with LUH initialized data +loop(j, + if(pm_land_start(j,"forestry") > sum((type32,ac),p32_land_start_ac(j,type32,ac)), + p32_land_start_ac(j,"ndc","ac0") = p32_land_start_ac(j,"ndc","ac0") + (pm_land_start(j,"forestry") - sum((type32,ac),p32_land_start_ac(j,type32,ac))); + ); +); ** Initialization of land *p32_land_start_ac(j,type32,ac) = p32_land("y1995",j,type32,ac); +*** NPI/NDC policies BEGIN +** Afforestation policies NPI and NDCs +p32_aff_pol(t,j) = round(f32_aff_pol(t,j,"%c32_aff_policy%"),6); + +* Calculate the remaining exogenous afforestation with respect to the maximum exogenous target over time. +* `p32_aff_togo` is used to adjust `s32_max_aff_area` in the constraint `q32_max_aff`. +p32_aff_togo(t,i) = smax(t2, sum(cell(i,j), p32_aff_pol(t2,j))) - sum(cell(i,j), p32_aff_pol(t,j)); + +* Calculate the limit for endogenous afforestation +* The global (`s32_max_aff_area`) and regional limit (`f32_max_aff_area`) for total afforestation (sum of endogenous and exogenous) is reduced by exogenous NPI/NDC afforestation (`p32_aff_pol`). +if(s32_max_aff_area_glo = 1, + i32_max_aff_area_glo(t) = s32_max_aff_area - smax(t2, sum(j, p32_aff_pol(t2,j))); + i32_max_aff_area_glo(t)$(i32_max_aff_area_glo(t) < 0) = 0; + i32_max_aff_area_glo(t)$(m_year(t) <= sm_fix_SSP2) = Inf; + i32_max_aff_area_reg(t,i) = 0; +elseif s32_max_aff_area_glo = 0, + i32_max_aff_area_reg(t,i) = f32_max_aff_area(i) - smax(t2, sum(cell(i,j), p32_aff_pol(t2,j))); + i32_max_aff_area_reg(t,i)$(i32_max_aff_area_reg(t,i) < 0) = 0; + i32_max_aff_area_reg(t,i)$(m_year(t) <= sm_fix_SSP2) = Inf; + i32_max_aff_area_glo(t) = 0; +); + +*** NPI/NDC policies END + *fix bph effect to zero for all age classes except the ac that is chosen for the bph effect to occur after planting (e.g. canopy closure) *fade-in from ac10 to ac30. First effect in ac10 (ord 3), last effect in ac30 (ord 7). ac_bph(ac) = no; @@ -213,7 +251,7 @@ display ac_bph; p32_aff_bgp(j,ac) = 0; p32_tcre_glo(j) = 0; if(s32_tcre_local = 1, - p32_aff_bgp(j,ac_bph) = f32_aff_bgp(j,"%c32_aff_bgp%")/f32_tcre(j,"%c32_tcre_ctrl%")/card(ac_bph); + p32_aff_bgp(j,ac_bph) = f32_aff_bgp(j,"%c32_aff_bgp%")/f32_tcre(j,"%c32_tcre_ctrl%")/card(ac_bph); else *m_weightedmean returns a global value, which is then used assigned to all j. We use land area as weight. p32_tcre_glo(j2) = m_weightedmean(f32_tcre(j,"%c32_tcre_ctrl%"),sum(land, pcm_land(j,land)),j) @@ -230,18 +268,39 @@ p32_plantation_contribution(t_ext,i)$(f32_gs_relativetarget(i)>0) = f32_plantati ******************************************************************************* ** Calibrate plantations yields ******************************************************************************* -** Initialize with 0 cvalues -p32_observed_gs_reg(i) = 0; +** Initialize with 1 tDM/ha - to avoid dvision by 0 +p32_observed_gs_reg(i) = 1; ** Wherever FAO reports >0 growing stock, we calculate how much growing stock MAGPIE ** sees even before optimization starts -p32_observed_gs_reg(i)$(f32_gs_relativetarget(i)>0) = (sum((cell(i,j),ac),(pm_timber_yield_initial(j,ac,"forestry") / sm_wood_density) * p32_land_start_ac(j,"plant",ac))/ sum((cell(i,j),ac),p32_land_start_ac(j,"plant",ac))); +p32_observed_gs_reg(i)$(f32_gs_relativetarget(i)>0 AND sum((cell(i,j),ac),p32_land_start_ac(j,"plant",ac))>0) = (sum((cell(i,j),ac),(pm_timber_yield_initial(j,ac,"forestry") / sm_wood_density) * p32_land_start_ac(j,"plant",ac))/ sum((cell(i,j),ac),p32_land_start_ac(j,"plant",ac))); + ** Initialze calibration factor for growing stocks as 1 ** we dont set it to 0 as we don't want to modify carbon densities by multiplication with 0 later p32_gs_scaling_reg(i) = 1; ** Calculate the ratio between target growing stock (reported by FAO) and observed growing stock (value at initialization in MAgPIE) -p32_gs_scaling_reg(i)$(f32_gs_relativetarget(i)>0) = f32_gs_relativetarget(i) / p32_observed_gs_reg(i); +p32_gs_scaling_reg(i)$(f32_gs_relativetarget(i)>0 AND f32_plantedforest(i)>0) = f32_gs_relativetarget(i) / p32_observed_gs_reg(i); ** Calibration factors lower than 1 are set to 1 p32_gs_scaling_reg(i)$(p32_gs_scaling_reg(i) < 1) = 1; -** Update c-densitiy based on calibration factor for growing stocks +** Save pm_carbon_density_ac_forestry in a parameter before upscaling to FAO growing stocks. +** This allows to use plantation growth curves for CO2 price driven afforestation. +p32_c_density_ac_fast_forestry(t_all,j,ac) = pm_carbon_density_ac_forestry(t_all,j,ac,"vegc"); + +** Update c-density for timber plantations based on calibration factor to match FAO growing stocks pm_carbon_density_ac_forestry(t_all,j,ac,"vegc") = pm_carbon_density_ac_forestry(t_all,j,ac,"vegc") * sum(cell(i,j),p32_gs_scaling_reg(i)); + +** set bii coefficients +p32_bii_coeff(type32,bii_class_secd,potnatveg) = 0; +if(s32_aff_bii_coeff = 0, + p32_bii_coeff("aff",bii_class_secd,potnatveg) = fm_bii_coeff(bii_class_secd,potnatveg) +elseif s32_aff_bii_coeff = 1, + p32_bii_coeff("aff",bii_class_secd,potnatveg) = fm_bii_coeff("timber",potnatveg) +); +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 5dc2e8fcbf..459ceddd89 100644 --- a/modules/32_forestry/dynamic_feb21/presolve.gms +++ b/modules/32_forestry/dynamic_feb21/presolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -16,42 +16,32 @@ ac_sub(ac) = yes$(ord(ac) > (m_yeardiff_forestry(t)/5)); v32_hvarea_forestry.fx(j,ac_est) = 0; v32_land_reduction.fx(j,type32,ac_est) = 0; -** Start ndc ** -* Limit demand for prescribed NPI/NDC afforestation in `p32_aff_pol` if not enough suitable area (`p32_aff_pot`) for afforestation is available. - p32_aff_pot(t,j) = (vm_land.l(j,"crop") - vm_land.lo(j,"crop")) + (vm_land.l(j,"past") - vm_land.lo(j,"past")); -*correct ndc forest stock based on p32_aff_pot - if((ord(t) > 1), - p32_aff_pol(t,j)$(p32_aff_pol(t,j) - p32_aff_pol(t-1,j) > p32_aff_pot(t,j)) = p32_aff_pol(t-1,j) + p32_aff_pot(t,j); - ); -*calc ndc afforestation per time step based on forest stock changes - p32_aff_pol_timestep("y1995",j) = 0; - p32_aff_pol_timestep(t,j)$(ord(t)>1) = p32_aff_pol(t,j) - p32_aff_pol(t-1,j); - -if(m_year(t) <= sm_fix_SSP2, - p32_max_aff_area = Inf; -else - p32_max_aff_area = s32_max_aff_area; -); +** START ndc ** +* calc NPI/NDC afforestation per time step based on forest stock change + p32_aff_pol_timestep("y1995",j) = 0; + p32_aff_pol_timestep(t,j)$(ord(t)>1) = p32_aff_pol(t,j) - p32_aff_pol(t-1,j); +* Suitable area (`p32_aff_pot`) for NPI/NDC afforestation + p32_aff_pot(t,j) = (vm_land.l(j,"crop") - vm_land.lo(j,"crop")) + (vm_land.l(j,"past") - vm_land.lo(j,"past")) - pm_land_conservation(t,j,"other","restore"); +* suitable area `p32_aff_pot` can be negative, if land restoration is switched on (level smaller than lower bound), therefore set negative values to 0 + p32_aff_pot(t,j)$(p32_aff_pot(t,j) < 0) = 0; +* Limit prescribed NPI/NDC afforestation in `p32_aff_pol_timestep` if not enough suitable area (`p32_aff_pot`) for afforestation is available + p32_aff_pol_timestep(t,j)$(p32_aff_pol_timestep(t,j) > p32_aff_pot(t,j)) = p32_aff_pot(t,j); ** END ndc ** *' @code *' Afforestation switch: -*' 0 = Use natveg carbon densities for afforestation, -*' 1 = Use plantation carbon densities for afforestation. +*' 0 = Use natveg growth curve towards LPJmL natural vegetation +*' 1 = Use plantation growth curve (faster than natveg) towards LPJmL natural vegetation if(s32_aff_plantation = 0, p32_carbon_density_ac(t,j,"aff",ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools); elseif s32_aff_plantation = 1, - p32_carbon_density_ac(t,j,"aff",ac,ag_pools) = pm_carbon_density_ac_forestry(t,j,ac,ag_pools); -); -*' Timber plantations switch: -*' 0 = Use natveg carbon densities for timber plantations, -*' 1 = Use plantation carbon densities for timber plantations. -if(s32_timber_plantation = 0, - p32_carbon_density_ac(t,j,"plant",ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools); -elseif s32_timber_plantation = 1, - p32_carbon_density_ac(t,j,"plant",ac,ag_pools) = pm_carbon_density_ac_forestry(t,j,ac,ag_pools); + p32_carbon_density_ac(t,j,"aff",ac,ag_pools) = p32_c_density_ac_fast_forestry(t,j,ac); ); + +*' Timber plantations carbon densities: +p32_carbon_density_ac(t,j,"plant",ac,ag_pools) = pm_carbon_density_ac_forestry(t,j,ac,ag_pools); + *' NDC carbon densities are natveg carbon densities. p32_carbon_density_ac(t,j,"ndc",ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools); @@ -59,27 +49,43 @@ 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 s32_shift = m_yeardiff_forestry(t)/5; *' @stop -*' Shifting of age-calsses in land. +*' Shifting of age-classes in land. *` @code if((ord(t)=1), p32_land(t,j,type32,ac)$(ord(ac) > s32_shift) = p32_land_start_ac(j,type32,ac-s32_shift); 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); @@ -132,8 +138,12 @@ v32_land.lo(j,"ndc",ac_est) = 0; v32_land.up(j,"ndc",ac_est) = Inf; ** fix c price induced afforestation based on s32_planing_horizon, fixed only until end of s32_planing_horizon, ac_est is free -v32_land.fx(j,"aff",ac)$(ac.off <= s32_planing_horizon/5) = pc32_land(j,"aff",ac); -v32_land.up(j,"aff",ac)$(ac.off > s32_planing_horizon/5) = pc32_land(j,"aff",ac); +if(s32_aff_prot = 0, + v32_land.fx(j,"aff",ac)$(ac.off <= s32_planing_horizon/5) = pc32_land(j,"aff",ac); + v32_land.up(j,"aff",ac)$(ac.off > s32_planing_horizon/5) = pc32_land(j,"aff",ac); +elseif s32_aff_prot = 1, + v32_land.fx(j,"aff",ac) = pc32_land(j,"aff",ac); +); v32_land.lo(j,"aff",ac_est) = 0; v32_land.up(j,"aff",ac_est) = Inf; v32_land.l(j,"aff",ac_est) = 0; @@ -141,10 +151,10 @@ v32_land.l(j,"aff",ac_est) = 0; ** Certain areas (e.g. the boreal zone) are excluded from endogenous afforestation. ** DON'T USE TYPE32 SET HERE if(m_year(t) <= sm_fix_SSP2, - v32_land.fx(j,"aff",ac_est) = 0; + v32_land.fx(j,"aff",ac_est) = 0; else - v32_land.lo(j,"aff",ac_est) = 0; - v32_land.up(j,"aff",ac_est) = f32_aff_mask(j) * sum(land, pcm_land(j,land)); + v32_land.lo(j,"aff",ac_est) = 0; + v32_land.up(j,"aff",ac_est) = f32_aff_mask(j) * sum(land, pcm_land(j,land)); ); *' No afforestation is allowed if carbon density <= 20 tc/ha v32_land.fx(j,"aff",ac_est)$(fm_carbon_density(t,j,"forestry","vegc") <= 20) = 0; @@ -163,4 +173,9 @@ pc32_yield_forestry_future_reg(i)$(pc32_yield_forestry_future_reg(i) = 0) = sma p32_updated_gs_reg(t,i) = 1; p32_updated_gs_reg(t,i)$(sum((cell(i,j),ac_sub),p32_land(t,j,"plant",ac_sub))>0) = (sum((cell(i,j),ac_sub),(pm_timber_yield(t,j,ac_sub,"forestry") / sm_wood_density) * p32_land(t,j,"plant",ac_sub))/ sum((cell(i,j),ac_sub),p32_land(t,j,"plant",ac_sub))); +* Avoid conflict between afforestation for carbon uptake on land and secdforest restoration +pm_land_conservation(t,j,"secdforest","restore")$(pm_land_conservation(t,j,"secdforest","restore") > sum(ac, p32_land(t,j,"ndc",ac) + v32_land.lo(j,"plant",ac) + p32_land(t,j,"aff",ac))+ p32_aff_pol_timestep(t,j)) + = pm_land_conservation(t,j,"secdforest","restore") - (sum(ac, p32_land(t,j,"ndc",ac) + p32_land(t,j,"aff",ac) + v32_land.lo(j,"plant",ac)) + p32_aff_pol_timestep(t,j)); +pm_land_conservation(t,j,"secdforest","restore")$(pm_land_conservation(t,j,"secdforest","restore") <= sum(ac, p32_land(t,j,"ndc",ac) + p32_land(t,j,"aff",ac) + v32_land.lo(j,"plant",ac)) + p32_aff_pol_timestep(t,j)) = 0; + *** EOF presolve.gms *** diff --git a/modules/32_forestry/dynamic_feb21/realization.gms b/modules/32_forestry/dynamic_feb21/realization.gms index fd10070f03..9d61742870 100644 --- a/modules/32_forestry/dynamic_feb21/realization.gms +++ b/modules/32_forestry/dynamic_feb21/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -20,18 +20,16 @@ *' handles the production of two timber products i.e., wood and woodfuel from *' plantation forests while still accounting for afforestation policies. New plantations *' are also established in the simulation step to account for future timber demand. -*' This module also calculates the rotation lengths before the solve loop by equating -*' Instantaneous Growth Rates (IGR) and interest rate `pm_interest` based on -*' @amacher2009economics. We have to make assumptions regarding the rotation lengths -*' to be used for establishment and harvesting decisions. For establishment we just -*' use the calculated rotations either based on a Single Rotation-Period Model or -*' based on Faustamnn rotations according to the switch `s32_faustmann_rotation`. -*' For harvesting we assume that land owners stick to their establishment decision, +*' This module also calculates the rotation lengths before the solve loop by +*' maximizing current annual increment (CAI) based on @amacher2009economics. This rotation +*' length calculation decision can also be changed to maximization of mean annual increment (MAI) +*' or equating instantaneous growth rate (IGR) with interest rate. Rotation lengths +*' calculated by maximization of CAI are empirically closer to economically optimal Faustmann +*' rotation lengths (see @amacher2009economics). +*' For harvesting decisions we assume that land owners stick to their establishment decision, *' e.g. if a plantation has been established with a rotation length of 30 years *' it will be harvested after 30 years, even so the rotation length in the prevailing *' time step, used for establishment, is shorter or longer. -*' -*' ![Calculation of rotation lengths using interest rate and vegetation Carbon growth functions based on single rotation model](rotation_length.png){ width=100% } *' @limitations Rotation lengths for timber plantations are not endogenous. diff --git a/modules/32_forestry/dynamic_feb21/rotation_length.png b/modules/32_forestry/dynamic_feb21/rotation_length.png deleted file mode 100644 index 3738bbffa2..0000000000 Binary files a/modules/32_forestry/dynamic_feb21/rotation_length.png and /dev/null differ diff --git a/modules/32_forestry/dynamic_feb21/scaling.gms b/modules/32_forestry/dynamic_feb21/scaling.gms index ba774e9fb6..ddc68df6ae 100644 --- a/modules/32_forestry/dynamic_feb21/scaling.gms +++ b/modules/32_forestry/dynamic_feb21/scaling.gms @@ -1,12 +1,12 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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_landdiff_forestry.scale = 10e3; v32_cost_establishment.scale(i) = 10e3; v32_cost_recur.scale(i) = 10e4; vm_cost_fore.scale(i) = 10e4; -v32_cost_hvarea.scale(i) = 10e4; +v32_cost_hvarea.scale(i)$(s32_hvarea = 1 OR s32_hvarea = 2) = 10e3; +vm_cdr_aff.scale(j,ac,aff_effect) = 10e-4; diff --git a/modules/32_forestry/dynamic_feb21/sets.gms b/modules/32_forestry/dynamic_feb21/sets.gms index 8d9fd97a70..5b4b725355 100644 --- a/modules/32_forestry/dynamic_feb21/sets.gms +++ b/modules/32_forestry/dynamic_feb21/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -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/32_forestry/module.gms b/modules/32_forestry/module.gms index af6701144a..f929157732 100644 --- a/modules/32_forestry/module.gms +++ b/modules/32_forestry/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -17,5 +17,4 @@ *###################### R SECTION START (MODULETYPES) ########################## $Ifi "%forestry%" == "dynamic_feb21" $include "./modules/32_forestry/dynamic_feb21/realization.gms" -$Ifi "%forestry%" == "static_sep16" $include "./modules/32_forestry/static_sep16/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/32_forestry/static_sep16/declarations.gms b/modules/32_forestry/static_sep16/declarations.gms deleted file mode 100644 index 7b0fdd04e5..0000000000 --- a/modules/32_forestry/static_sep16/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 - -positive variables - vm_cost_fore(i) Forestry costs (Mio USD) - vm_landdiff_forestry Aggregated difference in forestry land compared to previous timestep (mio. ha) - v32_land(j,type32,ac) Forestry land pools (mio. ha) - vm_cdr_aff(j,ac,aff_effect) Expected bgc (CDR) and local bph effects of afforestation depending on planning horizon (mio. tC) - v32_land_reduction(j,type32,ac) Forestry land reduction (mio. ha) - v32_hvarea_forestry(j,ac) Harvested area from timber plantations (mio. ha) -; - -parameters - pc32_carbon_density(j,ag_pools) Above ground carbon density in optimization (tC per ha) - pm_representative_rotation(t_all,i) Representative regional rotation (1) -; - -*#################### R SECTION START (OUTPUT DECLARATIONS) #################### -parameters - ov_cost_fore(t,i,type) Forestry costs (Mio USD) - ov_landdiff_forestry(t,type) Aggregated difference in forestry land compared to previous timestep (mio. ha) - ov32_land(t,j,type32,ac,type) Forestry land pools (mio. ha) - ov_cdr_aff(t,j,ac,aff_effect,type) Expected bgc (CDR) and local bph effects of afforestation depending on planning horizon (mio. tC) - ov32_land_reduction(t,j,type32,ac,type) Forestry land reduction (mio. ha) - ov32_hvarea_forestry(t,j,ac,type) Harvested area from timber plantations (mio. ha) -; -*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/32_forestry/static_sep16/not_used.txt b/modules/32_forestry/static_sep16/not_used.txt deleted file mode 100644 index ba6bb91ab2..0000000000 --- a/modules/32_forestry/static_sep16/not_used.txt +++ /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 - -name,type,reason -pm_land_start, input, not used -pm_interest, input, not used -sm_fix_SSP2, input, not needed -pm_timber_yield, input, not used -pm_carbon_density_ac_forestry, input, not used -pm_selfsuff_ext, par, not used -pm_demand_forestry_future, par, not used -pm_timber_yield_initial, par, not used -im_plantedclass_ac, par, not used -sm_wood_density, scalar, not used -vm_prod_forestry, var, not used -p32_plantation_contribution, par, not used diff --git a/modules/32_forestry/static_sep16/postsolve.gms b/modules/32_forestry/static_sep16/postsolve.gms deleted file mode 100644 index 3ec36b7965..0000000000 --- a/modules/32_forestry/static_sep16/postsolve.gms +++ /dev/null @@ -1,33 +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_fore(t,i,"marginal") = vm_cost_fore.m(i); - ov_landdiff_forestry(t,"marginal") = vm_landdiff_forestry.m; - ov32_land(t,j,type32,ac,"marginal") = v32_land.m(j,type32,ac); - ov_cdr_aff(t,j,ac,aff_effect,"marginal") = vm_cdr_aff.m(j,ac,aff_effect); - ov32_land_reduction(t,j,type32,ac,"marginal") = v32_land_reduction.m(j,type32,ac); - ov32_hvarea_forestry(t,j,ac,"marginal") = v32_hvarea_forestry.m(j,ac); - ov_cost_fore(t,i,"level") = vm_cost_fore.l(i); - ov_landdiff_forestry(t,"level") = vm_landdiff_forestry.l; - ov32_land(t,j,type32,ac,"level") = v32_land.l(j,type32,ac); - ov_cdr_aff(t,j,ac,aff_effect,"level") = vm_cdr_aff.l(j,ac,aff_effect); - ov32_land_reduction(t,j,type32,ac,"level") = v32_land_reduction.l(j,type32,ac); - ov32_hvarea_forestry(t,j,ac,"level") = v32_hvarea_forestry.l(j,ac); - ov_cost_fore(t,i,"upper") = vm_cost_fore.up(i); - ov_landdiff_forestry(t,"upper") = vm_landdiff_forestry.up; - ov32_land(t,j,type32,ac,"upper") = v32_land.up(j,type32,ac); - ov_cdr_aff(t,j,ac,aff_effect,"upper") = vm_cdr_aff.up(j,ac,aff_effect); - ov32_land_reduction(t,j,type32,ac,"upper") = v32_land_reduction.up(j,type32,ac); - ov32_hvarea_forestry(t,j,ac,"upper") = v32_hvarea_forestry.up(j,ac); - ov_cost_fore(t,i,"lower") = vm_cost_fore.lo(i); - ov_landdiff_forestry(t,"lower") = vm_landdiff_forestry.lo; - ov32_land(t,j,type32,ac,"lower") = v32_land.lo(j,type32,ac); - ov_cdr_aff(t,j,ac,aff_effect,"lower") = vm_cdr_aff.lo(j,ac,aff_effect); - ov32_land_reduction(t,j,type32,ac,"lower") = v32_land_reduction.lo(j,type32,ac); - ov32_hvarea_forestry(t,j,ac,"lower") = v32_hvarea_forestry.lo(j,ac); -*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/32_forestry/static_sep16/preloop.gms b/modules/32_forestry/static_sep16/preloop.gms deleted file mode 100644 index 3f067958bb..0000000000 --- a/modules/32_forestry/static_sep16/preloop.gms +++ /dev/null @@ -1,30 +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 - -*' @code -*' Costs and CDR from afforestation are set to zero. -vm_cost_fore.fx(i) = 0; -vm_cdr_aff.fx(j,ac,aff_effect) = 0; - -*' All forestry land pools (aff, ndc, plant) are fixed to zero, -*' except forestry plantations, which are fixed to the level of 1995. -v32_land.fx(j,type32,ac) = 0; -v32_land.fx(j,"plant","acx") = pcm_land(j,"forestry"); -*' @stop - -* Aggregation of forestry land pools (`land32`). -vm_land.fx(j,"forestry") = sum((type32,ac), v32_land.l(j,type32,ac)); - -* The change of forestry land is also set to zero. -vm_landdiff_forestry.fx = 0; -v32_land_reduction.fx(j,type32,ac) = 0; -v32_hvarea_forestry.fx(j,ac) = 0; - -* Assuming 30y rotation in static case. -pm_representative_rotation(t_all,i) = 30; - -*** EOF preloop.gms *** diff --git a/modules/32_forestry/static_sep16/presolve.gms b/modules/32_forestry/static_sep16/presolve.gms deleted file mode 100644 index c192ed4df5..0000000000 --- a/modules/32_forestry/static_sep16/presolve.gms +++ /dev/null @@ -1,40 +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 - -*define ac_est and ac_sub -ac_est(ac) = no; -ac_est(ac) = yes$(ord(ac) <= (m_yeardiff_forestry(t)/5)); - -ac_sub(ac) = no; -ac_sub(ac) = yes$(ord(ac) > (m_yeardiff_forestry(t)/5)); - -*' @code -*' Forestry above ground carbon stocks are calculated by multiplying plantations in 1995 -*' with the forestry above ground carbon density of the current time step (`pc32_carbon_density`). -pc32_carbon_density(j,ag_pools) = fm_carbon_density(t,j,"forestry",ag_pools); -vm_carbon_stock.fx(j,"forestry",ag_pools) = - sum((type32,ac), v32_land.l(j,type32,ac)*pm_carbon_density_ac(t,j,ac,ag_pools)); - -*' Biodiversity value - -vm_bv.fx(j,"aff_co2p",potnatveg) = - v32_land.l(j,"aff",ac_mature) * fm_bii_coeff("secd_mature",potnatveg) * fm_luh2_side_layers(j,potnatveg) - + v32_land.l(j,"aff",ac_young) * fm_bii_coeff("secd_young",potnatveg) * fm_luh2_side_layers(j,potnatveg); - -vm_bv.fx(j,"aff_ndc",potnatveg) = - v32_land.l(j,"ndc",ac_mature) * fm_bii_coeff("secd_mature",potnatveg) * fm_luh2_side_layers(j,potnatveg) - + v32_land.l(j,"ndc",ac_young) * fm_bii_coeff("secd_young",potnatveg) * fm_luh2_side_layers(j,potnatveg); - -vm_bv.fx(j,"plant",potnatveg) = - v32_land.l(j,"plant",ac) * fm_bii_coeff("timber",potnatveg) * fm_luh2_side_layers(j,potnatveg); - - -*' Wood demand is also set to zero because forestry is not modeled in this realization. -vm_supply.fx(i2,kforestry) = 0; -*' @stop - -*** EOF presolve.gms *** diff --git a/modules/32_forestry/static_sep16/realization.gms b/modules/32_forestry/static_sep16/realization.gms deleted file mode 100644 index b387215928..0000000000 --- a/modules/32_forestry/static_sep16/realization.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 - -*' @description The static realisation is very simple and does not include any equation -*' because forestry land is assumed constant at the observed 1995 level throughout time. - -*' @limitations Forestry activities such as establishment or -*' harvest of plantations for wood production are not modeled. -*' Also afforestation for CDR is not included. - -*####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/32_forestry/static_sep16/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/32_forestry/static_sep16/declarations.gms" -$Ifi "%phase%" == "preloop" $include "./modules/32_forestry/static_sep16/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/32_forestry/static_sep16/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/32_forestry/static_sep16/postsolve.gms" -*######################## R SECTION END (PHASES) ############################### diff --git a/modules/34_urban/exo_nov21/declarations.gms b/modules/34_urban/exo_nov21/declarations.gms new file mode 100644 index 0000000000..47c10ec90e --- /dev/null +++ b/modules/34_urban/exo_nov21/declarations.gms @@ -0,0 +1,37 @@ +*** | (C) 2008-2023 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 + +parameters + i34_urban_area(t_all, j) Cellular urban area +; + +positive variables + vm_cost_urban(j) Technical adjustment costs + v34_cost1(j) Technical adjustment costs + v34_cost2(j) Technical adjustment costs +; + +equations + q34_urban_cell(j) Constraint for urban land + q34_urban_land(i) Prescribe total regional urban land + q34_urban_cost1(j) Technical punishment equation + q34_urban_cost2(j) Technical punishment equation + q34_bv_urban(j,potnatveg) Biodiversity value for urban land (Mha) +; + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov_cost_urban(t,j,type) Technical adjustment costs + ov34_cost1(t,j,type) Technical adjustment costs + ov34_cost2(t,j,type) Technical adjustment costs + oq34_urban_cell(t,j,type) Constraint for urban land + oq34_urban_land(t,i,type) Prescribe total regional urban land + oq34_urban_cost1(t,j,type) Technical punishment equation + oq34_urban_cost2(t,j,type) Technical punishment equation + oq34_bv_urban(t,j,potnatveg,type) Biodiversity value for urban land (Mha) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/34_urban/exo_nov21/equations.gms b/modules/34_urban/exo_nov21/equations.gms new file mode 100644 index 0000000000..439b589307 --- /dev/null +++ b/modules/34_urban/exo_nov21/equations.gms @@ -0,0 +1,35 @@ +*** | (C) 2008-2023 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 +*' Cellular level land is prescribed via a very strong incentive not to deviate +*' from cellular input data. v34_cost1 and v34_cost2 are the cost variables that +*' implement this, for when vm_land(j2,"urban") is less than and greater than the input data +*' i.e. when reducing or establishing more urban land than in input. This safeguards against infeasible outcomes, +*' where urban land should expand but can not due to NPI or other protected land constraints. In this case it incurs the cost and shifts the land elsewhere in the region. + + + +q34_urban_cost1(j2) .. + v34_cost1(j2) =g= sum(ct, i34_urban_area(ct, j2)) - vm_land(j2,"urban"); + +q34_urban_cost2(j2) .. + v34_cost2(j2) =g= vm_land(j2,"urban") - sum(ct, i34_urban_area(ct, j2)); + +*' Sum up cost terms with high punishment + +q34_urban_cell(j2) .. + vm_cost_urban(j2) =e= (v34_cost1(j2) + v34_cost2(j2)) * s34_urban_deviation_cost; + +*' Regional level urban land must match + +q34_urban_land(i2) .. + sum(cell(i2,j2), vm_land(j2,"urban")) =e= sum((ct,cell(i2,j2)), i34_urban_area(ct,j2)); + +*' Biodiversity value (BV) + q34_bv_urban(j2,potnatveg) .. + vm_bv(j2,"urban", potnatveg) =e= vm_land(j2,"urban") * fm_bii_coeff("urban",potnatveg) * fm_luh2_side_layers(j2,potnatveg); diff --git a/modules/34_urban/exo_nov21/input.gms b/modules/34_urban/exo_nov21/input.gms new file mode 100644 index 0000000000..f813421563 --- /dev/null +++ b/modules/34_urban/exo_nov21/input.gms @@ -0,0 +1,20 @@ +*** | (C) 2008-2023 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 c34_urban_scenario SSP2 +* options: SSP: "SSP1", "SSP2", "SSP3", "SSP4", "SSP5" + + +scalars + s34_urban_deviation_cost Artificial cost for urban deviation variables (USD05MER per ha) / 1e+06 / +; + +table f34_urbanland(t_all, j, urban_scen34) Urban land +$ondelim +$include "./modules/34_urban/exo_nov21/input/f34_urbanland.cs3" +$offdelim +; diff --git a/modules/38_factor_costs/mixed_feb17/input/files b/modules/34_urban/exo_nov21/input/files similarity index 65% rename from modules/38_factor_costs/mixed_feb17/input/files rename to modules/34_urban/exo_nov21/input/files index 5619b98eb9..62c8780165 100644 --- a/modules/38_factor_costs/mixed_feb17/input/files +++ b/modules/34_urban/exo_nov21/input/files @@ -1,2 +1,2 @@ * list of files that are required here -f38_region_yield.csv +f34_urbanland.cs3 diff --git a/modules/34_urban/exo_nov21/postsolve.gms b/modules/34_urban/exo_nov21/postsolve.gms new file mode 100644 index 0000000000..adcb13eb6d --- /dev/null +++ b/modules/34_urban/exo_nov21/postsolve.gms @@ -0,0 +1,42 @@ +*** | (C) 2008-2023 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_urban(t,j,"marginal") = vm_cost_urban.m(j); + ov34_cost1(t,j,"marginal") = v34_cost1.m(j); + ov34_cost2(t,j,"marginal") = v34_cost2.m(j); + oq34_urban_cell(t,j,"marginal") = q34_urban_cell.m(j); + oq34_urban_land(t,i,"marginal") = q34_urban_land.m(i); + oq34_urban_cost1(t,j,"marginal") = q34_urban_cost1.m(j); + oq34_urban_cost2(t,j,"marginal") = q34_urban_cost2.m(j); + oq34_bv_urban(t,j,potnatveg,"marginal") = q34_bv_urban.m(j,potnatveg); + ov_cost_urban(t,j,"level") = vm_cost_urban.l(j); + ov34_cost1(t,j,"level") = v34_cost1.l(j); + ov34_cost2(t,j,"level") = v34_cost2.l(j); + oq34_urban_cell(t,j,"level") = q34_urban_cell.l(j); + oq34_urban_land(t,i,"level") = q34_urban_land.l(i); + oq34_urban_cost1(t,j,"level") = q34_urban_cost1.l(j); + oq34_urban_cost2(t,j,"level") = q34_urban_cost2.l(j); + oq34_bv_urban(t,j,potnatveg,"level") = q34_bv_urban.l(j,potnatveg); + ov_cost_urban(t,j,"upper") = vm_cost_urban.up(j); + ov34_cost1(t,j,"upper") = v34_cost1.up(j); + ov34_cost2(t,j,"upper") = v34_cost2.up(j); + oq34_urban_cell(t,j,"upper") = q34_urban_cell.up(j); + oq34_urban_land(t,i,"upper") = q34_urban_land.up(i); + oq34_urban_cost1(t,j,"upper") = q34_urban_cost1.up(j); + oq34_urban_cost2(t,j,"upper") = q34_urban_cost2.up(j); + oq34_bv_urban(t,j,potnatveg,"upper") = q34_bv_urban.up(j,potnatveg); + ov_cost_urban(t,j,"lower") = vm_cost_urban.lo(j); + ov34_cost1(t,j,"lower") = v34_cost1.lo(j); + ov34_cost2(t,j,"lower") = v34_cost2.lo(j); + oq34_urban_cell(t,j,"lower") = q34_urban_cell.lo(j); + oq34_urban_land(t,i,"lower") = q34_urban_land.lo(i); + oq34_urban_cost1(t,j,"lower") = q34_urban_cost1.lo(j); + oq34_urban_cost2(t,j,"lower") = q34_urban_cost2.lo(j); + oq34_bv_urban(t,j,potnatveg,"lower") = q34_bv_urban.lo(j,potnatveg); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### + diff --git a/modules/34_urban/exo_nov21/preloop.gms b/modules/34_urban/exo_nov21/preloop.gms new file mode 100644 index 0000000000..2b4d7a33d4 --- /dev/null +++ b/modules/34_urban/exo_nov21/preloop.gms @@ -0,0 +1,17 @@ +*** | (C) 2008-2023 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 + +* get the scenario GDP & Populaiton data for iso countries +loop(t_all, + if(m_year(t_all) <= sm_fix_SSP2, + i34_urban_area(t_all, j) = f34_urbanland(t_all, j,"SSP2"); +else +i34_urban_area(t_all, j) = f34_urbanland(t_all, j,"%c34_urban_scenario%"); + ); +); + +pcm_land(j,"urban") = i34_urban_area("y1995",j); diff --git a/modules/51_nitrogen/off/presolve.gms b/modules/34_urban/exo_nov21/presolve.gms similarity index 53% rename from modules/51_nitrogen/off/presolve.gms rename to modules/34_urban/exo_nov21/presolve.gms index aa5ba0142c..1221171eae 100644 --- a/modules/51_nitrogen/off/presolve.gms +++ b/modules/34_urban/exo_nov21/presolve.gms @@ -1,9 +1,16 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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_carbon_stock.fx(j,"urban",ag_pools,stockType) = 0; +if(ord(t) = 1, + vm_land.fx(j,"urban") = i34_urban_area(t,j); +else + vm_land.lo(j,"urban") = 0; + vm_land.l(j,"urban") = i34_urban_area(t,j); + vm_land.up(j,"urban") = Inf; +); diff --git a/modules/34_urban/exo_nov21/realization.gms b/modules/34_urban/exo_nov21/realization.gms new file mode 100644 index 0000000000..e3ebf563c1 --- /dev/null +++ b/modules/34_urban/exo_nov21/realization.gms @@ -0,0 +1,23 @@ +*** | (C) 2008-2023 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 Urban Land based on LUH2v2 (Hurtt 2020) cellular (0.5 degree) input dataset, varying with SSP. +*' Cellular level is prescribed via a very high punishment term for deviating from original input values. +*' Regional sums of urban land must add be equal for both model and input data. + +*' @limitations Urban land is exogenous and does not interact with other model dynamics, except for reducing available non-urban land pool. +*' Cellular urban land may not exactly match input data due to other land needs in the same cell. + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/34_urban/exo_nov21/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/34_urban/exo_nov21/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/34_urban/exo_nov21/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/34_urban/exo_nov21/equations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/34_urban/exo_nov21/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/34_urban/exo_nov21/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/34_urban/exo_nov21/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/52_carbon/off/sets.gms b/modules/34_urban/exo_nov21/sets.gms similarity index 71% rename from modules/52_carbon/off/sets.gms rename to modules/34_urban/exo_nov21/sets.gms index 30d77b5076..9deca440e6 100644 --- a/modules/52_carbon/off/sets.gms +++ b/modules/34_urban/exo_nov21/sets.gms @@ -1,12 +1,12 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -ag_pools(c_pools) Above ground carbon pools - /vegc,litc/ + urban_scen34 Urban scenario + / SSP1, SSP2, SSP3, SSP4, SSP5 / + ; diff --git a/modules/34_urban/module.gms b/modules/34_urban/module.gms index 13193c4bb8..87717d90ba 100644 --- a/modules/34_urban/module.gms +++ b/modules/34_urban/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,12 +7,13 @@ *' @title Urban Land *' -*' @description The urban land module is one of the land modules in MAgPIE -*' (see also the other land modules: [30_crop], [31_past], [32_forestry], [35_natveg]). -*' It describes urban settlement areas and estimates their corresponding carbon content. +*' @description The urban land module is one of the land modules in MAgPIE +*' (see also the other land modules: [30_crop], [31_past], [32_forestry], [35_natveg]). +*' It describes urban settlement areas and estimates their corresponding carbon content and biodiversity values. *' -*' @authors Jan Philipp Dietrich, Florian Humpenöder +*' @authors Jan Philipp Dietrich, Florian Humpenöder, David Meng-Chuen Chen, Benjamin Leon Bodirsky *###################### R SECTION START (MODULETYPES) ########################## +$Ifi "%urban%" == "exo_nov21" $include "./modules/34_urban/exo_nov21/realization.gms" $Ifi "%urban%" == "static" $include "./modules/34_urban/static/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/57_maccs/off_jul16/declarations.gms b/modules/34_urban/static/declarations.gms similarity index 59% rename from modules/57_maccs/off_jul16/declarations.gms rename to modules/34_urban/static/declarations.gms index 1af48bd20d..8f2fc2ab28 100644 --- a/modules/57_maccs/off_jul16/declarations.gms +++ b/modules/34_urban/static/declarations.gms @@ -1,21 +1,18 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -parameters - im_maccs_mitigation(t,i,emis_source,pollutants) Technical mitigation of GHG emissions (percent) -; positive variables - vm_maccs_costs(i) Costs of technical mitigation of GHG emissions (mio. USD95MER per yr) + vm_cost_urban(j) Technical adjustment cost ; - *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_maccs_costs(t,i,type) Costs of technical mitigation of GHG emissions (mio. USD95MER per yr) + ov_cost_urban(t,j,type) Technical adjustment cost ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### + diff --git a/modules/34_urban/static/not_used.txt b/modules/34_urban/static/not_used.txt new file mode 100644 index 0000000000..34cfdad4f1 --- /dev/null +++ b/modules/34_urban/static/not_used.txt @@ -0,0 +1,2 @@ +name,type,reason +sm_fix_SSP2, input, not needed diff --git a/modules/57_maccs/off_jul16/postsolve.gms b/modules/34_urban/static/postsolve.gms similarity index 63% rename from modules/57_maccs/off_jul16/postsolve.gms rename to modules/34_urban/static/postsolve.gms index 50f870d636..e6e6b4fa09 100644 --- a/modules/57_maccs/off_jul16/postsolve.gms +++ b/modules/34_urban/static/postsolve.gms @@ -1,15 +1,14 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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_maccs_costs(t,i,"marginal") = vm_maccs_costs.m(i); - ov_maccs_costs(t,i,"level") = vm_maccs_costs.l(i); - ov_maccs_costs(t,i,"upper") = vm_maccs_costs.up(i); - ov_maccs_costs(t,i,"lower") = vm_maccs_costs.lo(i); + ov_cost_urban(t,j,"marginal") = vm_cost_urban.m(j); + ov_cost_urban(t,j,"level") = vm_cost_urban.l(j); + ov_cost_urban(t,j,"upper") = vm_cost_urban.up(j); + ov_cost_urban(t,j,"lower") = vm_cost_urban.lo(j); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### + diff --git a/modules/34_urban/static/presolve.gms b/modules/34_urban/static/presolve.gms index 5aefbb095e..5f63a3abff 100644 --- a/modules/34_urban/static/presolve.gms +++ b/modules/34_urban/static/presolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,6 +7,8 @@ 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); + +vm_cost_urban.fx(j) = 0; diff --git a/modules/34_urban/static/realization.gms b/modules/34_urban/static/realization.gms index 36b109be54..a4cb3a288e 100644 --- a/modules/34_urban/static/realization.gms +++ b/modules/34_urban/static/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -14,5 +14,7 @@ *' corresponding carbon stocks are assumed zero *####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "declarations" $include "./modules/34_urban/static/declarations.gms" $Ifi "%phase%" == "presolve" $include "./modules/34_urban/static/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/34_urban/static/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/35_natveg/dynamic_feb21/declarations.gms b/modules/35_natveg/dynamic_feb21/declarations.gms index 71632a4c0e..4dc3d2587f 100644 --- a/modules/35_natveg/dynamic_feb21/declarations.gms +++ b/modules/35_natveg/dynamic_feb21/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -10,62 +10,60 @@ scalars ; parameters - i35_secdforest(j,ac) Inital secdforest (mio. ha) - i35_other(j,ac) Inital other land (mio. ha) - p35_secdforest(t,j,ac) Secdforest per age class (mio. ha) - p35_other(t,j,ac) Other land per age class (mio. ha) - pc35_secdforest(j,ac) Secdforest per age class in current time step (mio. ha) - pc35_other(j,ac) Other land per age class in current time step (mio. ha) - p35_protect_shr(t,j,prot_type) Protection share for primforest secdforest and other land (1) - p35_save_primforest(t,j) Primforest protection (mio. ha) - p35_save_secdforest(t,j) Secdforest protection (mio. ha) - p35_save_other(t,j) Other land protection (mio. ha) - p35_recovered_forest(t,j,ac) Recovered forest (mio. ha) - p35_min_forest(t,j) Minimum forest stock [land protection policies] (Mha) - p35_min_other(t,j) Minimum other land stock [land protection policies] (Mha) - p35_carbon_density_secdforest(t,j,ac,ag_pools) Carbon density secdforest (tC per ha) - p35_carbon_density_other(t,j,ac,ag_pools) Carbon density other land (tC per ha) - p35_disturbance_loss_secdf(t,j,ac) Loss due to disturbances in secondary forest (mio. ha) - p35_disturbance_loss_primf(t,j) Loss due to disturbances in primary forest (mio. ha) - i35_plantedclass_ac(j,ac) Area of age-classes in secondary forest (1) - p35_poulter_dist(j,ac) Share of age-classes in secondary forest (1) - p35_save_dist(j,ac) Distribution of secondary forest saving (1) - p35_land(t,j,land_natveg,ac) Natural vegetation area (mio. ha) - p35_updated_gs_natfor(t,i) Updated growing stock in natural forests after calibration (m3 per ha) - p35_land_start_ac(j,ac,land_natveg) Initial Natural vegetation area (mio. ha) - p35_observed_gs_reg(i) Observed growing stock in natural forests before calibration (m3 per ha) - p35_gs_scaling_reg(i) Regional calibration factors for natural vegetation yields (1) + i35_secdforest(j,ac) Initial secdforest (mio. ha) + i35_other(j,ac) Initial other land (mio. ha) + p35_secdforest(t,j,ac) Secdforest per age class (mio. ha) + p35_other(t,j,ac) Other land per age class (mio. ha) + pc35_secdforest(j,ac) Secdforest per age class in current time step (mio. ha) + pc35_other(j,ac) Other land per age class in current time step (mio. ha) + p35_min_forest(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) + p35_min_other(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) + p35_damage_fader(t_all) Fader for forest damage (1) + p35_recovered_forest(t,j,ac) Recovered forest (mio. ha) + p35_carbon_density_secdforest(t,j,ac,ag_pools) Carbon density secdforest (tC per ha) + p35_carbon_density_other(t,j,ac,ag_pools) Carbon density other land (tC per ha) + p35_disturbance_loss_secdf(t,j,ac) Loss due to disturbances in secondary forest (mio. ha) + p35_disturbance_loss_primf(t,j) Loss due to disturbances in primary forest (mio. ha) + i35_plantedclass_ac(j,ac) Area of age-classes in secondary forest (1) + p35_poulter_dist(j,ac) Share of age-classes in secondary forest (1) + p35_land(t,j,land_natveg,ac) Natural vegetation area (mio. ha) + p35_updated_gs_natfor(t,i) Updated growing stock in natural forests after calibration (m3 per ha) + p35_land_start_ac(j,ac,land_natveg) Initial Natural vegetation area (mio. ha) + p35_observed_gs_reg(i) Observed growing stock in natural forests before calibration (m3 per ha) + p35_gs_scaling_reg(i) Regional calibration factors for natural vegetation yields (1) + p35_protection_dist(j,ac) Distribution of secondary forest protection (1) + p35_land_restoration(j,land_natveg) Actual secondary forest and other land restoration area (mio. ha) ; equations - q35_land_secdforest(j) Secdforest land pool calculation (mio. ha) - q35_land_other(j) Other land pool calculation (mio. ha) - q35_carbon_primforest(j,ag_pools) Primforest carbon stock calculation (mio tC) - q35_carbon_secdforest(j,ag_pools) Secdforest carbon stock calculation (mio tC) - q35_carbon_other(j,ag_pools) Other land carbon stock calculation (mio tC) - q35_landdiff Difference in natveg land (mio. ha) - q35_other_expansion(j,ac) Other land expansion (mio. ha) - q35_other_reduction(j,ac) Other land reduction (mio. ha) - q35_secdforest_expansion(j,ac) Secdforest reduction (mio. ha) - q35_secdforest_reduction(j,ac) Secdforest reduction (mio. ha) - q35_primforest_reduction(j) Primforest reduction (mio. ha) - q35_min_forest(j) Minimum forest land constraint (mio. ha) - q35_min_other(j) Minimum other land constraint (mio. ha) - q35_secdforest_conversion(j) Secondary forest remains secondary forest (mio. ha) - q35_other_conversion(j) Other land remains secondary forest (mio. ha) - q35_other_est(j,ac) Distribution of other land additions over ac_est (mio. ha) - q35_secdforest_est(j,ac) Distribution of secdforest additions over ac_est (mio. ha) - q35_hvarea_other(j,ac) Harvested area other land (mio. ha) - q35_hvarea_secdforest(j,ac) Harvested area secdforest (mio. ha) - q35_hvarea_primforest(j) Harvested area primforest (mio. ha) - q35_prod_secdforest(j) Production of woody biomass from secondary forests (mio. tDM per yr) - q35_prod_primforest(j) Production of woody biomass from primary forests (mio. tDM per yr) - q35_prod_other(j) Production of woody biomass from other land (mio. tDM per yr) - q35_cost_hvarea(i) Cost of harvesting natural vegetation (mio. USD) - q35_bv_primforest(j,potnatveg) Biodiversity value of primary forest (Mha) - q35_bv_secdforest(j,potnatveg) Biodiversity value of secondary forest (Mha) - q35_bv_other(j,potnatveg) Biodiversity value of other land (Mha) - + q35_land_secdforest(j) Secdforest land pool calculation (mio. ha) + q35_land_other(j) Other land pool calculation (mio. ha) + q35_carbon_primforest(j,ag_pools,stockType) Primforest carbon stock calculation (mio tC) + q35_carbon_secdforest(j,ag_pools,stockType) Secdforest carbon stock calculation (mio tC) + q35_carbon_other(j,ag_pools,stockType) Other land carbon stock calculation (mio tC) + q35_min_forest(j) Minimum forest land constraint (mio. ha) + q35_min_other(j) Minimum other land constraint (mio. ha) + q35_landdiff Difference in natveg land (mio. ha) + q35_other_expansion(j,ac) Other land expansion (mio. ha) + q35_other_reduction(j,ac) Other land reduction (mio. ha) + q35_secdforest_expansion(j,ac) Secdforest reduction (mio. ha) + q35_secdforest_reduction(j,ac) Secdforest reduction (mio. ha) + q35_primforest_reduction(j) Primforest reduction (mio. ha) + q35_secdforest_regeneration(j) Secondary forest remains secondary forest (mio. ha) + q35_other_regeneration(j) Other land remains other land (mio. ha) + q35_other_est(j,ac) Distribution of other land additions over ac_est (mio. ha) + q35_secdforest_est(j,ac) Distribution of secdforest additions over ac_est (mio. ha) + q35_hvarea_other(j,ac) Harvested area other land (mio. ha) + q35_hvarea_secdforest(j,ac) Harvested area secdforest (mio. ha) + q35_hvarea_primforest(j) Harvested area primforest (mio. ha) + q35_prod_secdforest(j) Production of woody biomass from secondary forests (mio. tDM per yr) + q35_prod_primforest(j) Production of woody biomass from primary forests (mio. tDM per yr) + q35_prod_other(j) Production of woody biomass from other land (mio. tDM per yr) + q35_cost_hvarea(i) Cost of harvesting natural vegetation (mio. USD) + q35_bv_primforest(j,potnatveg) Biodiversity value of primary forest (mio. ha) + q35_bv_secdforest(j,potnatveg) Biodiversity value of secondary forest (mio. ha) + q35_bv_other(j,potnatveg) Biodiversity value of other land (mio. ha) + q35_natveg_conservation(j) Total natural vegetation conservation constraint (mio. ha) ; positive variables @@ -77,55 +75,56 @@ positive variables v35_secdforest_expansion(j,ac) Secdforest reduction compared to previous timestep (mio. ha) v35_secdforest_reduction(j,ac) Secdforest reduction compared to previous timestep (mio. ha) v35_primforest_reduction(j) Primforest reduction compared to previous timestep (mio. ha) - v35_hvarea_secdforest(j,ac) Harvested area from secondary forest (mio. ha) - v35_hvarea_other(j,ac) Harvested area from other land (mio. ha) - v35_hvarea_primforest(j) Harvested area from primary forest (mio. ha) + v35_hvarea_secdforest(j,ac) Harvested area from secondary forest (mio. ha) + v35_hvarea_other(j,ac) Harvested area from other land (mio. ha) + v35_hvarea_primforest(j) Harvested area from primary forest (mio. ha) vm_prod_natveg(j,land_natveg,kforestry) Production of woody biomass from natural vegetation (mio. tDM per yr) - vm_cost_hvarea_natveg(i) Cost of harvesting natural vegetation (mio. USD) + vm_cost_hvarea_natveg(i) Cost of harvesting natural vegetation (mio. USD) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov35_secdforest(t,j,ac,type) Detailed stock of secdforest (mio. ha) - ov35_other(t,j,ac,type) Detailed stock of other land (mio. ha) - ov_landdiff_natveg(t,type) Aggregated difference in natveg land compared to previous timestep (mio. ha) - ov35_other_expansion(t,j,ac,type) Other land expansion compared to previous timestep (mio. ha) - ov35_other_reduction(t,j,ac,type) Other land reduction compared to previous timestep (mio. ha) - ov35_secdforest_expansion(t,j,ac,type) Secdforest reduction compared to previous timestep (mio. ha) - ov35_secdforest_reduction(t,j,ac,type) Secdforest reduction compared to previous timestep (mio. ha) - ov35_primforest_reduction(t,j,type) Primforest reduction compared to previous timestep (mio. ha) - ov35_hvarea_secdforest(t,j,ac,type) Harvested area from secondary forest (mio. ha) - ov35_hvarea_other(t,j,ac,type) Harvested area from other land (mio. ha) - ov35_hvarea_primforest(t,j,type) Harvested area from primary forest (mio. ha) - ov_prod_natveg(t,j,land_natveg,kforestry,type) Production of woody biomass from natural vegetation (mio. tDM per yr) - ov_cost_hvarea_natveg(t,i,type) Cost of harvesting natural vegetation (mio. USD) - oq35_land_secdforest(t,j,type) Secdforest land pool calculation (mio. ha) - oq35_land_other(t,j,type) Other land pool calculation (mio. ha) - oq35_carbon_primforest(t,j,ag_pools,type) Primforest carbon stock calculation (mio tC) - oq35_carbon_secdforest(t,j,ag_pools,type) Secdforest carbon stock calculation (mio tC) - oq35_carbon_other(t,j,ag_pools,type) Other land carbon stock calculation (mio tC) - oq35_landdiff(t,type) Difference in natveg land (mio. ha) - oq35_other_expansion(t,j,ac,type) Other land expansion (mio. ha) - oq35_other_reduction(t,j,ac,type) Other land reduction (mio. ha) - oq35_secdforest_expansion(t,j,ac,type) Secdforest reduction (mio. ha) - oq35_secdforest_reduction(t,j,ac,type) Secdforest reduction (mio. ha) - oq35_primforest_reduction(t,j,type) Primforest reduction (mio. ha) - oq35_min_forest(t,j,type) Minimum forest land constraint (mio. ha) - oq35_min_other(t,j,type) Minimum other land constraint (mio. ha) - oq35_secdforest_conversion(t,j,type) Secondary forest remains secondary forest (mio. ha) - oq35_other_conversion(t,j,type) Other land remains secondary forest (mio. ha) - oq35_other_est(t,j,ac,type) Distribution of other land additions over ac_est (mio. ha) - oq35_secdforest_est(t,j,ac,type) Distribution of secdforest additions over ac_est (mio. ha) - oq35_hvarea_other(t,j,ac,type) Harvested area other land (mio. ha) - oq35_hvarea_secdforest(t,j,ac,type) Harvested area secdforest (mio. ha) - oq35_hvarea_primforest(t,j,type) Harvested area primforest (mio. ha) - oq35_prod_secdforest(t,j,type) Production of woody biomass from secondary forests (mio. tDM per yr) - oq35_prod_primforest(t,j,type) Production of woody biomass from primary forests (mio. tDM per yr) - oq35_prod_other(t,j,type) Production of woody biomass from other land (mio. tDM per yr) - oq35_cost_hvarea(t,i,type) Cost of harvesting natural vegetation (mio. USD) - oq35_bv_primforest(t,j,potnatveg,type) Biodiversity value of primary forest (Mha) - oq35_bv_secdforest(t,j,potnatveg,type) Biodiversity value of secondary forest (Mha) - oq35_bv_other(t,j,potnatveg,type) Biodiversity value of other land (Mha) + ov35_secdforest(t,j,ac,type) Detailed stock of secdforest (mio. ha) + ov35_other(t,j,ac,type) Detailed stock of other land (mio. ha) + ov_landdiff_natveg(t,type) Aggregated difference in natveg land compared to previous timestep (mio. ha) + ov35_other_expansion(t,j,ac,type) Other land expansion compared to previous timestep (mio. ha) + ov35_other_reduction(t,j,ac,type) Other land reduction compared to previous timestep (mio. ha) + ov35_secdforest_expansion(t,j,ac,type) Secdforest reduction compared to previous timestep (mio. ha) + ov35_secdforest_reduction(t,j,ac,type) Secdforest reduction compared to previous timestep (mio. ha) + ov35_primforest_reduction(t,j,type) Primforest reduction compared to previous timestep (mio. ha) + ov35_hvarea_secdforest(t,j,ac,type) Harvested area from secondary forest (mio. ha) + ov35_hvarea_other(t,j,ac,type) Harvested area from other land (mio. ha) + ov35_hvarea_primforest(t,j,type) Harvested area from primary forest (mio. ha) + ov_prod_natveg(t,j,land_natveg,kforestry,type) Production of woody biomass from natural vegetation (mio. tDM per yr) + ov_cost_hvarea_natveg(t,i,type) Cost of harvesting natural vegetation (mio. USD) + oq35_land_secdforest(t,j,type) Secdforest land pool calculation (mio. ha) + oq35_land_other(t,j,type) Other land pool calculation (mio. ha) + oq35_carbon_primforest(t,j,ag_pools,stockType,type) Primforest carbon stock calculation (mio tC) + oq35_carbon_secdforest(t,j,ag_pools,stockType,type) Secdforest carbon stock calculation (mio tC) + oq35_carbon_other(t,j,ag_pools,stockType,type) Other land carbon stock calculation (mio tC) + oq35_min_forest(t,j,type) Minimum forest land constraint (mio. ha) + oq35_min_other(t,j,type) Minimum other land constraint (mio. ha) + oq35_landdiff(t,type) Difference in natveg land (mio. ha) + oq35_other_expansion(t,j,ac,type) Other land expansion (mio. ha) + oq35_other_reduction(t,j,ac,type) Other land reduction (mio. ha) + oq35_secdforest_expansion(t,j,ac,type) Secdforest reduction (mio. ha) + oq35_secdforest_reduction(t,j,ac,type) Secdforest reduction (mio. ha) + oq35_primforest_reduction(t,j,type) Primforest reduction (mio. ha) + oq35_secdforest_regeneration(t,j,type) Secondary forest remains secondary forest (mio. ha) + oq35_other_regeneration(t,j,type) Other land remains other land (mio. ha) + oq35_other_est(t,j,ac,type) Distribution of other land additions over ac_est (mio. ha) + oq35_secdforest_est(t,j,ac,type) Distribution of secdforest additions over ac_est (mio. ha) + oq35_hvarea_other(t,j,ac,type) Harvested area other land (mio. ha) + oq35_hvarea_secdforest(t,j,ac,type) Harvested area secdforest (mio. ha) + oq35_hvarea_primforest(t,j,type) Harvested area primforest (mio. ha) + oq35_prod_secdforest(t,j,type) Production of woody biomass from secondary forests (mio. tDM per yr) + oq35_prod_primforest(t,j,type) Production of woody biomass from primary forests (mio. tDM per yr) + oq35_prod_other(t,j,type) Production of woody biomass from other land (mio. tDM per yr) + oq35_cost_hvarea(t,i,type) Cost of harvesting natural vegetation (mio. USD) + oq35_bv_primforest(t,j,potnatveg,type) Biodiversity value of primary forest (mio. ha) + oq35_bv_secdforest(t,j,potnatveg,type) Biodiversity value of secondary forest (mio. ha) + oq35_bv_other(t,j,potnatveg,type) Biodiversity value of other land (mio. ha) + oq35_natveg_conservation(t,j,type) Total natural vegetation conservation constraint (mio. ha) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/35_natveg/dynamic_feb21/equations.gms b/modules/35_natveg/dynamic_feb21/equations.gms index 1c6fe5c867..3c66722468 100644 --- a/modules/35_natveg/dynamic_feb21/equations.gms +++ b/modules/35_natveg/dynamic_feb21/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -12,6 +12,15 @@ q35_land_other(j2) .. vm_land(j2,"other") =e= sum(ac, v35_other(j2,ac)); +*' The total natural land area cannot be smaller than the total natural land conservation target. +*' Area requirements for natural land conservation are derived from WDPA and formulated based on +*' conservation priority areas during future time steps. + + q35_natveg_conservation(j2) .. + sum(land_natveg, vm_land(j2,land_natveg)) + =g= + sum((ct,land_natveg,consv_type), pm_land_conservation(ct,j2,land_natveg,consv_type)); + *' Carbon stocks for primary forest, secondary forest or other natural land are calculated *' as the product of respective area and carbon density. *' Carbon stocks decline if the area decreases @@ -19,39 +28,42 @@ *' In case of abandoned agricultural land (increase of other natural land), *' natural succession, represented by age-class growth, results in increasing carbon stocks. - q35_carbon_primforest(j2,ag_pools) .. vm_carbon_stock(j2,"primforest",ag_pools) =e= - vm_land(j2,"primforest") - *sum(ct, fm_carbon_density(ct,j2,"primforest",ag_pools)); + q35_carbon_primforest(j2,ag_pools,stockType) .. + vm_carbon_stock(j2,"primforest",ag_pools,stockType) =e= + m_carbon_stock(vm_land,fm_carbon_density,"primforest"); - q35_carbon_secdforest(j2,ag_pools) .. vm_carbon_stock(j2,"secdforest",ag_pools) =e= - sum(ac, v35_secdforest(j2,ac) - *sum(ct, pm_carbon_density_ac(ct,j2,ac,ag_pools))); + q35_carbon_secdforest(j2,ag_pools,stockType) .. + vm_carbon_stock(j2,"secdforest",ag_pools,stockType) =e= + m_carbon_stock_ac(v35_secdforest,pm_carbon_density_ac,"ac","ac_sub"); - q35_carbon_other(j2,ag_pools) .. vm_carbon_stock(j2,"other",ag_pools) =e= - sum(ac, v35_other(j2,ac) - *sum(ct, pm_carbon_density_ac(ct,j2,ac,ag_pools))); + q35_carbon_other(j2,ag_pools,stockType) .. + vm_carbon_stock(j2,"other",ag_pools,stockType) =e= + m_carbon_stock_ac(v35_other,pm_carbon_density_ac,"ac","ac_sub"); *' The biodiversity value (BV) of primary forest, secondary forest and other land is computed by multiplying their respective land area with bii coefficients, which depend on the age class and whether the potential natural vegetation forest or non-forest (luh2 side layers). q35_bv_primforest(j2,potnatveg) .. vm_bv(j2,"primforest",potnatveg) - =e= - vm_land(j2,"primforest") * fm_bii_coeff("primary",potnatveg) * fm_luh2_side_layers(j2,potnatveg); + =e= + vm_land(j2,"primforest") * fm_bii_coeff("primary",potnatveg) * fm_luh2_side_layers(j2,potnatveg); q35_bv_secdforest(j2,potnatveg) .. vm_bv(j2,"secdforest",potnatveg) - =e= - sum(ac_mature, v35_secdforest(j2,ac_mature)) * fm_bii_coeff("secd_mature",potnatveg) * fm_luh2_side_layers(j2,potnatveg) - + sum(ac_young, v35_secdforest(j2,ac_young)) * fm_bii_coeff("secd_young",potnatveg) * fm_luh2_side_layers(j2,potnatveg); + =e= + sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v35_secdforest(j2,ac)) * + fm_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); q35_bv_other(j2,potnatveg) .. vm_bv(j2,"other",potnatveg) - =e= - sum(ac_mature, v35_other(j2,ac_mature)) * fm_bii_coeff("secd_mature",potnatveg) * fm_luh2_side_layers(j2,potnatveg) - + sum(ac_young, v35_other(j2,ac_young)) * fm_bii_coeff("secd_young",potnatveg) * fm_luh2_side_layers(j2,potnatveg); + =e= + sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v35_other(j2,ac)) * + fm_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); -*' NPI/NDC land protection policies are implemented as minium forest land and other land stock. +*' NPI/NDC land protection policies based on country reports are implemented as +*' minium forest and other land stocks. They are not interchangeable (as compared to +*' the natural land conservation constraint) and specifically formulated for forest and +*' other land stocks. q35_min_forest(j2) .. vm_land(j2,"primforest") + vm_land(j2,"secdforest") =g= - sum(ct, p35_min_forest(ct,j2)); + sum(ct, p35_min_forest(ct,j2)); q35_min_other(j2) .. vm_land(j2,"other") =g= sum(ct, p35_min_other(ct,j2)); @@ -61,32 +73,32 @@ *' This information is then passed to the land module ([10_land]): q35_landdiff .. vm_landdiff_natveg =e= - sum((j2,ac), - v35_other_expansion(j2,ac) - + v35_other_reduction(j2,ac) - + v35_secdforest_expansion(j2,ac) - + v35_secdforest_reduction(j2,ac) - + v35_primforest_reduction(j2)); + sum((j2,ac), + v35_other_expansion(j2,ac) + + v35_other_reduction(j2,ac) + + v35_secdforest_expansion(j2,ac) + + v35_secdforest_reduction(j2,ac) + + v35_primforest_reduction(j2)); q35_other_expansion(j2,ac_est) .. - v35_other_expansion(j2,ac_est) =e= - v35_other(j2,ac_est) - pc35_other(j2,ac_est); + v35_other_expansion(j2,ac_est) =e= + v35_other(j2,ac_est) - pc35_other(j2,ac_est); q35_other_reduction(j2,ac_sub) .. - v35_other_reduction(j2,ac_sub) =e= - pc35_other(j2,ac_sub) - v35_other(j2,ac_sub); + v35_other_reduction(j2,ac_sub) =e= + pc35_other(j2,ac_sub) - v35_other(j2,ac_sub); q35_secdforest_expansion(j2,ac_est) .. - v35_secdforest_expansion(j2,ac_est) =e= - v35_secdforest(j2,ac_est) - pc35_secdforest(j2,ac_est); + v35_secdforest_expansion(j2,ac_est) =e= + v35_secdforest(j2,ac_est) - pc35_secdforest(j2,ac_est); q35_secdforest_reduction(j2,ac_sub) .. - v35_secdforest_reduction(j2,ac_sub) =e= - pc35_secdforest(j2,ac_sub) - v35_secdforest(j2,ac_sub); + v35_secdforest_reduction(j2,ac_sub) =e= + pc35_secdforest(j2,ac_sub) - v35_secdforest(j2,ac_sub); q35_primforest_reduction(j2) .. - v35_primforest_reduction(j2) =e= - pcm_land(j2,"primforest") - vm_land(j2,"primforest"); + v35_primforest_reduction(j2) =e= + pcm_land(j2,"primforest") - vm_land(j2,"primforest"); ******************************************************************* **** Timber production related equations in natural vegetation **** @@ -114,7 +126,7 @@ q35_cost_hvarea(i2).. q35_prod_secdforest(j2).. sum(kforestry, vm_prod_natveg(j2,"secdforest",kforestry)) =e= - sum(ac_sub, v35_hvarea_secdforest(j2,ac_sub) * sum(ct,pm_timber_yield(ct,j2,ac_sub,"secdforest"))) / m_timestep_length_forestry; + sum(ac_sub, v35_hvarea_secdforest(j2,ac_sub) * sum(ct,pm_timber_yield(ct,j2,ac_sub,"secdforest"))) / m_timestep_length_forestry; ** Primary forest *' Woody biomass production from primary forests is calculated by multiplying the @@ -163,16 +175,17 @@ q35_hvarea_other(j2,ac_sub).. *' to be secondary forest i.e., harvested primary forest gets reclassified as *' secondary forest and ends up in the youngest age-class (and follows regrowth) -q35_secdforest_conversion(j2).. +q35_secdforest_regeneration(j2).. sum(ac_est, v35_secdforest(j2,ac_est)) =e= sum(ac_sub,v35_hvarea_secdforest(j2,ac_sub)) + v35_hvarea_primforest(j2) + + p35_land_restoration(j2,"secdforest") ; *' Harvested other land is still considered other land -q35_other_conversion(j2).. +q35_other_regeneration(j2).. sum(ac_est, v35_other(j2,ac_est)) =g= sum(ac_sub,v35_hvarea_other(j2,ac_sub)) @@ -186,3 +199,4 @@ v35_secdforest(j2,ac_est) =e= sum(ac_est2, v35_secdforest(j2,ac_est2))/card(ac_e q35_other_est(j2,ac_est) .. v35_other(j2,ac_est) =e= sum(ac_est2, v35_other(j2,ac_est2))/card(ac_est2); + diff --git a/modules/35_natveg/dynamic_feb21/input.gms b/modules/35_natveg/dynamic_feb21/input.gms index b6e33fd971..9255d02e3e 100644 --- a/modules/35_natveg/dynamic_feb21/input.gms +++ b/modules/35_natveg/dynamic_feb21/input.gms @@ -1,50 +1,43 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 c35_protect_scenario WDPA $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 / -s35_hvarea_secdforest annual secdforest harvest rate for s35_hvarea equals 1 (percent per year) / 0.005 / -s35_hvarea_primforest annual primforest harvest rate for s35_hvarea equals 1 (percent per year) / 0.0001 / +s35_hvarea Flag for harvested area (0=zero 1=exognous 2=endogneous) / 0 / +s35_hvarea_secdforest annual secdforest harvest rate for s35_hvarea equals 1 (percent per year) / 0 / +s35_hvarea_primforest annual primforest harvest rate for s35_hvarea equals 1 (percent per year) / 0 / s35_hvarea_other annual other land harvest rate for s35_hvarea equals 1 (percent per year) / 0 / s35_timber_harvest_cost_secdforest Cost for harvesting from secondary forest (USD per ha) / 2000/ -s35_timber_harvest_cost_other Cost for harvesting from other land (USD per ha) / 2000/ +s35_timber_harvest_cost_other Cost for harvesting from other land (USD per ha) / 1500 / 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=Combination of wildfire and shifting agriculture) / 1 / +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 / ; -parameter f35_protection_fader(t_all) Protection scenario fader (1) -/ -$ondelim -$include "./modules/35_natveg/input/f35_protection_fader.csv" -$offdelim -/ -; - -table f35_protect_area(j,prot_type) Conservation priority areas (mio. ha) +table f35_forest_lost_share(i,driver_source) Share of area damanged by forest fires (1) $ondelim -$include "./modules/35_natveg/input/protect_area.cs3" +$include "./modules/35_natveg/input/f35_forest_lost_share.cs3" $offdelim ; -table f35_min_land_stock(t_all,j,pol35,pol_stock35) Land protection policies [minimum land stock] (Mha) +table f35_min_land_stock(t_all,j,pol35,pol_stock35) Avoided deforestation and land protection policies [minimum land stock] (Mha) $ondelim $include "./modules/35_natveg/input/npi_ndc_ad_aolc_pol.cs3" $offdelim ; -table f35_forest_lost_share(i,driver_source) Share of area damanged by forest fires (1) +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_lost_share.cs3" +$include "./modules/35_natveg/input/f35_forest_shock.csv" $offdelim ; diff --git a/modules/35_natveg/dynamic_feb21/postsolve.gms b/modules/35_natveg/dynamic_feb21/postsolve.gms index f29a6f5cea..085cb4c533 100644 --- a/modules/35_natveg/dynamic_feb21/postsolve.gms +++ b/modules/35_natveg/dynamic_feb21/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -12,164 +12,168 @@ p35_secdforest(t,j,ac) = v35_secdforest.l(j,ac); p35_other(t,j,ac) = v35_other.l(j,ac); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov35_secdforest(t,j,ac,"marginal") = v35_secdforest.m(j,ac); - ov35_other(t,j,ac,"marginal") = v35_other.m(j,ac); - ov_landdiff_natveg(t,"marginal") = vm_landdiff_natveg.m; - ov35_other_expansion(t,j,ac,"marginal") = v35_other_expansion.m(j,ac); - ov35_other_reduction(t,j,ac,"marginal") = v35_other_reduction.m(j,ac); - ov35_secdforest_expansion(t,j,ac,"marginal") = v35_secdforest_expansion.m(j,ac); - ov35_secdforest_reduction(t,j,ac,"marginal") = v35_secdforest_reduction.m(j,ac); - ov35_primforest_reduction(t,j,"marginal") = v35_primforest_reduction.m(j); - ov35_hvarea_secdforest(t,j,ac,"marginal") = v35_hvarea_secdforest.m(j,ac); - ov35_hvarea_other(t,j,ac,"marginal") = v35_hvarea_other.m(j,ac); - ov35_hvarea_primforest(t,j,"marginal") = v35_hvarea_primforest.m(j); - ov_prod_natveg(t,j,land_natveg,kforestry,"marginal") = vm_prod_natveg.m(j,land_natveg,kforestry); - ov_cost_hvarea_natveg(t,i,"marginal") = vm_cost_hvarea_natveg.m(i); - oq35_land_secdforest(t,j,"marginal") = q35_land_secdforest.m(j); - oq35_land_other(t,j,"marginal") = q35_land_other.m(j); - oq35_carbon_primforest(t,j,ag_pools,"marginal") = q35_carbon_primforest.m(j,ag_pools); - oq35_carbon_secdforest(t,j,ag_pools,"marginal") = q35_carbon_secdforest.m(j,ag_pools); - oq35_carbon_other(t,j,ag_pools,"marginal") = q35_carbon_other.m(j,ag_pools); - oq35_landdiff(t,"marginal") = q35_landdiff.m; - oq35_other_expansion(t,j,ac,"marginal") = q35_other_expansion.m(j,ac); - oq35_other_reduction(t,j,ac,"marginal") = q35_other_reduction.m(j,ac); - oq35_secdforest_expansion(t,j,ac,"marginal") = q35_secdforest_expansion.m(j,ac); - oq35_secdforest_reduction(t,j,ac,"marginal") = q35_secdforest_reduction.m(j,ac); - oq35_primforest_reduction(t,j,"marginal") = q35_primforest_reduction.m(j); - oq35_min_forest(t,j,"marginal") = q35_min_forest.m(j); - oq35_min_other(t,j,"marginal") = q35_min_other.m(j); - oq35_secdforest_conversion(t,j,"marginal") = q35_secdforest_conversion.m(j); - oq35_other_conversion(t,j,"marginal") = q35_other_conversion.m(j); - oq35_other_est(t,j,ac,"marginal") = q35_other_est.m(j,ac); - oq35_secdforest_est(t,j,ac,"marginal") = q35_secdforest_est.m(j,ac); - oq35_hvarea_other(t,j,ac,"marginal") = q35_hvarea_other.m(j,ac); - oq35_hvarea_secdforest(t,j,ac,"marginal") = q35_hvarea_secdforest.m(j,ac); - oq35_hvarea_primforest(t,j,"marginal") = q35_hvarea_primforest.m(j); - oq35_prod_secdforest(t,j,"marginal") = q35_prod_secdforest.m(j); - oq35_prod_primforest(t,j,"marginal") = q35_prod_primforest.m(j); - oq35_prod_other(t,j,"marginal") = q35_prod_other.m(j); - oq35_cost_hvarea(t,i,"marginal") = q35_cost_hvarea.m(i); - oq35_bv_primforest(t,j,potnatveg,"marginal") = q35_bv_primforest.m(j,potnatveg); - oq35_bv_secdforest(t,j,potnatveg,"marginal") = q35_bv_secdforest.m(j,potnatveg); - oq35_bv_other(t,j,potnatveg,"marginal") = q35_bv_other.m(j,potnatveg); - ov35_secdforest(t,j,ac,"level") = v35_secdforest.l(j,ac); - ov35_other(t,j,ac,"level") = v35_other.l(j,ac); - ov_landdiff_natveg(t,"level") = vm_landdiff_natveg.l; - ov35_other_expansion(t,j,ac,"level") = v35_other_expansion.l(j,ac); - ov35_other_reduction(t,j,ac,"level") = v35_other_reduction.l(j,ac); - ov35_secdforest_expansion(t,j,ac,"level") = v35_secdforest_expansion.l(j,ac); - ov35_secdforest_reduction(t,j,ac,"level") = v35_secdforest_reduction.l(j,ac); - ov35_primforest_reduction(t,j,"level") = v35_primforest_reduction.l(j); - ov35_hvarea_secdforest(t,j,ac,"level") = v35_hvarea_secdforest.l(j,ac); - ov35_hvarea_other(t,j,ac,"level") = v35_hvarea_other.l(j,ac); - ov35_hvarea_primforest(t,j,"level") = v35_hvarea_primforest.l(j); - ov_prod_natveg(t,j,land_natveg,kforestry,"level") = vm_prod_natveg.l(j,land_natveg,kforestry); - ov_cost_hvarea_natveg(t,i,"level") = vm_cost_hvarea_natveg.l(i); - oq35_land_secdforest(t,j,"level") = q35_land_secdforest.l(j); - oq35_land_other(t,j,"level") = q35_land_other.l(j); - oq35_carbon_primforest(t,j,ag_pools,"level") = q35_carbon_primforest.l(j,ag_pools); - oq35_carbon_secdforest(t,j,ag_pools,"level") = q35_carbon_secdforest.l(j,ag_pools); - oq35_carbon_other(t,j,ag_pools,"level") = q35_carbon_other.l(j,ag_pools); - oq35_landdiff(t,"level") = q35_landdiff.l; - oq35_other_expansion(t,j,ac,"level") = q35_other_expansion.l(j,ac); - oq35_other_reduction(t,j,ac,"level") = q35_other_reduction.l(j,ac); - oq35_secdforest_expansion(t,j,ac,"level") = q35_secdforest_expansion.l(j,ac); - oq35_secdforest_reduction(t,j,ac,"level") = q35_secdforest_reduction.l(j,ac); - oq35_primforest_reduction(t,j,"level") = q35_primforest_reduction.l(j); - oq35_min_forest(t,j,"level") = q35_min_forest.l(j); - oq35_min_other(t,j,"level") = q35_min_other.l(j); - oq35_secdforest_conversion(t,j,"level") = q35_secdforest_conversion.l(j); - oq35_other_conversion(t,j,"level") = q35_other_conversion.l(j); - oq35_other_est(t,j,ac,"level") = q35_other_est.l(j,ac); - oq35_secdforest_est(t,j,ac,"level") = q35_secdforest_est.l(j,ac); - oq35_hvarea_other(t,j,ac,"level") = q35_hvarea_other.l(j,ac); - oq35_hvarea_secdforest(t,j,ac,"level") = q35_hvarea_secdforest.l(j,ac); - oq35_hvarea_primforest(t,j,"level") = q35_hvarea_primforest.l(j); - oq35_prod_secdforest(t,j,"level") = q35_prod_secdforest.l(j); - oq35_prod_primforest(t,j,"level") = q35_prod_primforest.l(j); - oq35_prod_other(t,j,"level") = q35_prod_other.l(j); - oq35_cost_hvarea(t,i,"level") = q35_cost_hvarea.l(i); - oq35_bv_primforest(t,j,potnatveg,"level") = q35_bv_primforest.l(j,potnatveg); - oq35_bv_secdforest(t,j,potnatveg,"level") = q35_bv_secdforest.l(j,potnatveg); - oq35_bv_other(t,j,potnatveg,"level") = q35_bv_other.l(j,potnatveg); - ov35_secdforest(t,j,ac,"upper") = v35_secdforest.up(j,ac); - ov35_other(t,j,ac,"upper") = v35_other.up(j,ac); - ov_landdiff_natveg(t,"upper") = vm_landdiff_natveg.up; - ov35_other_expansion(t,j,ac,"upper") = v35_other_expansion.up(j,ac); - ov35_other_reduction(t,j,ac,"upper") = v35_other_reduction.up(j,ac); - ov35_secdforest_expansion(t,j,ac,"upper") = v35_secdforest_expansion.up(j,ac); - ov35_secdforest_reduction(t,j,ac,"upper") = v35_secdforest_reduction.up(j,ac); - ov35_primforest_reduction(t,j,"upper") = v35_primforest_reduction.up(j); - ov35_hvarea_secdforest(t,j,ac,"upper") = v35_hvarea_secdforest.up(j,ac); - ov35_hvarea_other(t,j,ac,"upper") = v35_hvarea_other.up(j,ac); - ov35_hvarea_primforest(t,j,"upper") = v35_hvarea_primforest.up(j); - ov_prod_natveg(t,j,land_natveg,kforestry,"upper") = vm_prod_natveg.up(j,land_natveg,kforestry); - ov_cost_hvarea_natveg(t,i,"upper") = vm_cost_hvarea_natveg.up(i); - oq35_land_secdforest(t,j,"upper") = q35_land_secdforest.up(j); - oq35_land_other(t,j,"upper") = q35_land_other.up(j); - oq35_carbon_primforest(t,j,ag_pools,"upper") = q35_carbon_primforest.up(j,ag_pools); - oq35_carbon_secdforest(t,j,ag_pools,"upper") = q35_carbon_secdforest.up(j,ag_pools); - oq35_carbon_other(t,j,ag_pools,"upper") = q35_carbon_other.up(j,ag_pools); - oq35_landdiff(t,"upper") = q35_landdiff.up; - oq35_other_expansion(t,j,ac,"upper") = q35_other_expansion.up(j,ac); - oq35_other_reduction(t,j,ac,"upper") = q35_other_reduction.up(j,ac); - oq35_secdforest_expansion(t,j,ac,"upper") = q35_secdforest_expansion.up(j,ac); - oq35_secdforest_reduction(t,j,ac,"upper") = q35_secdforest_reduction.up(j,ac); - oq35_primforest_reduction(t,j,"upper") = q35_primforest_reduction.up(j); - oq35_min_forest(t,j,"upper") = q35_min_forest.up(j); - oq35_min_other(t,j,"upper") = q35_min_other.up(j); - oq35_secdforest_conversion(t,j,"upper") = q35_secdforest_conversion.up(j); - oq35_other_conversion(t,j,"upper") = q35_other_conversion.up(j); - oq35_other_est(t,j,ac,"upper") = q35_other_est.up(j,ac); - oq35_secdforest_est(t,j,ac,"upper") = q35_secdforest_est.up(j,ac); - oq35_hvarea_other(t,j,ac,"upper") = q35_hvarea_other.up(j,ac); - oq35_hvarea_secdforest(t,j,ac,"upper") = q35_hvarea_secdforest.up(j,ac); - oq35_hvarea_primforest(t,j,"upper") = q35_hvarea_primforest.up(j); - oq35_prod_secdforest(t,j,"upper") = q35_prod_secdforest.up(j); - oq35_prod_primforest(t,j,"upper") = q35_prod_primforest.up(j); - oq35_prod_other(t,j,"upper") = q35_prod_other.up(j); - oq35_cost_hvarea(t,i,"upper") = q35_cost_hvarea.up(i); - oq35_bv_primforest(t,j,potnatveg,"upper") = q35_bv_primforest.up(j,potnatveg); - oq35_bv_secdforest(t,j,potnatveg,"upper") = q35_bv_secdforest.up(j,potnatveg); - oq35_bv_other(t,j,potnatveg,"upper") = q35_bv_other.up(j,potnatveg); - ov35_secdforest(t,j,ac,"lower") = v35_secdforest.lo(j,ac); - ov35_other(t,j,ac,"lower") = v35_other.lo(j,ac); - ov_landdiff_natveg(t,"lower") = vm_landdiff_natveg.lo; - ov35_other_expansion(t,j,ac,"lower") = v35_other_expansion.lo(j,ac); - ov35_other_reduction(t,j,ac,"lower") = v35_other_reduction.lo(j,ac); - ov35_secdforest_expansion(t,j,ac,"lower") = v35_secdforest_expansion.lo(j,ac); - ov35_secdforest_reduction(t,j,ac,"lower") = v35_secdforest_reduction.lo(j,ac); - ov35_primforest_reduction(t,j,"lower") = v35_primforest_reduction.lo(j); - ov35_hvarea_secdforest(t,j,ac,"lower") = v35_hvarea_secdforest.lo(j,ac); - ov35_hvarea_other(t,j,ac,"lower") = v35_hvarea_other.lo(j,ac); - ov35_hvarea_primforest(t,j,"lower") = v35_hvarea_primforest.lo(j); - ov_prod_natveg(t,j,land_natveg,kforestry,"lower") = vm_prod_natveg.lo(j,land_natveg,kforestry); - ov_cost_hvarea_natveg(t,i,"lower") = vm_cost_hvarea_natveg.lo(i); - oq35_land_secdforest(t,j,"lower") = q35_land_secdforest.lo(j); - oq35_land_other(t,j,"lower") = q35_land_other.lo(j); - oq35_carbon_primforest(t,j,ag_pools,"lower") = q35_carbon_primforest.lo(j,ag_pools); - oq35_carbon_secdforest(t,j,ag_pools,"lower") = q35_carbon_secdforest.lo(j,ag_pools); - oq35_carbon_other(t,j,ag_pools,"lower") = q35_carbon_other.lo(j,ag_pools); - oq35_landdiff(t,"lower") = q35_landdiff.lo; - oq35_other_expansion(t,j,ac,"lower") = q35_other_expansion.lo(j,ac); - oq35_other_reduction(t,j,ac,"lower") = q35_other_reduction.lo(j,ac); - oq35_secdforest_expansion(t,j,ac,"lower") = q35_secdforest_expansion.lo(j,ac); - oq35_secdforest_reduction(t,j,ac,"lower") = q35_secdforest_reduction.lo(j,ac); - oq35_primforest_reduction(t,j,"lower") = q35_primforest_reduction.lo(j); - oq35_min_forest(t,j,"lower") = q35_min_forest.lo(j); - oq35_min_other(t,j,"lower") = q35_min_other.lo(j); - oq35_secdforest_conversion(t,j,"lower") = q35_secdforest_conversion.lo(j); - oq35_other_conversion(t,j,"lower") = q35_other_conversion.lo(j); - oq35_other_est(t,j,ac,"lower") = q35_other_est.lo(j,ac); - oq35_secdforest_est(t,j,ac,"lower") = q35_secdforest_est.lo(j,ac); - oq35_hvarea_other(t,j,ac,"lower") = q35_hvarea_other.lo(j,ac); - oq35_hvarea_secdforest(t,j,ac,"lower") = q35_hvarea_secdforest.lo(j,ac); - oq35_hvarea_primforest(t,j,"lower") = q35_hvarea_primforest.lo(j); - oq35_prod_secdforest(t,j,"lower") = q35_prod_secdforest.lo(j); - oq35_prod_primforest(t,j,"lower") = q35_prod_primforest.lo(j); - oq35_prod_other(t,j,"lower") = q35_prod_other.lo(j); - oq35_cost_hvarea(t,i,"lower") = q35_cost_hvarea.lo(i); - oq35_bv_primforest(t,j,potnatveg,"lower") = q35_bv_primforest.lo(j,potnatveg); - oq35_bv_secdforest(t,j,potnatveg,"lower") = q35_bv_secdforest.lo(j,potnatveg); - oq35_bv_other(t,j,potnatveg,"lower") = q35_bv_other.lo(j,potnatveg); + ov35_secdforest(t,j,ac,"marginal") = v35_secdforest.m(j,ac); + ov35_other(t,j,ac,"marginal") = v35_other.m(j,ac); + ov_landdiff_natveg(t,"marginal") = vm_landdiff_natveg.m; + ov35_other_expansion(t,j,ac,"marginal") = v35_other_expansion.m(j,ac); + ov35_other_reduction(t,j,ac,"marginal") = v35_other_reduction.m(j,ac); + ov35_secdforest_expansion(t,j,ac,"marginal") = v35_secdforest_expansion.m(j,ac); + ov35_secdforest_reduction(t,j,ac,"marginal") = v35_secdforest_reduction.m(j,ac); + ov35_primforest_reduction(t,j,"marginal") = v35_primforest_reduction.m(j); + ov35_hvarea_secdforest(t,j,ac,"marginal") = v35_hvarea_secdforest.m(j,ac); + ov35_hvarea_other(t,j,ac,"marginal") = v35_hvarea_other.m(j,ac); + ov35_hvarea_primforest(t,j,"marginal") = v35_hvarea_primforest.m(j); + ov_prod_natveg(t,j,land_natveg,kforestry,"marginal") = vm_prod_natveg.m(j,land_natveg,kforestry); + ov_cost_hvarea_natveg(t,i,"marginal") = vm_cost_hvarea_natveg.m(i); + oq35_land_secdforest(t,j,"marginal") = q35_land_secdforest.m(j); + oq35_land_other(t,j,"marginal") = q35_land_other.m(j); + oq35_carbon_primforest(t,j,ag_pools,stockType,"marginal") = q35_carbon_primforest.m(j,ag_pools,stockType); + oq35_carbon_secdforest(t,j,ag_pools,stockType,"marginal") = q35_carbon_secdforest.m(j,ag_pools,stockType); + oq35_carbon_other(t,j,ag_pools,stockType,"marginal") = q35_carbon_other.m(j,ag_pools,stockType); + oq35_min_forest(t,j,"marginal") = q35_min_forest.m(j); + oq35_min_other(t,j,"marginal") = q35_min_other.m(j); + oq35_landdiff(t,"marginal") = q35_landdiff.m; + oq35_other_expansion(t,j,ac,"marginal") = q35_other_expansion.m(j,ac); + oq35_other_reduction(t,j,ac,"marginal") = q35_other_reduction.m(j,ac); + oq35_secdforest_expansion(t,j,ac,"marginal") = q35_secdforest_expansion.m(j,ac); + oq35_secdforest_reduction(t,j,ac,"marginal") = q35_secdforest_reduction.m(j,ac); + oq35_primforest_reduction(t,j,"marginal") = q35_primforest_reduction.m(j); + oq35_secdforest_regeneration(t,j,"marginal") = q35_secdforest_regeneration.m(j); + oq35_other_regeneration(t,j,"marginal") = q35_other_regeneration.m(j); + oq35_other_est(t,j,ac,"marginal") = q35_other_est.m(j,ac); + oq35_secdforest_est(t,j,ac,"marginal") = q35_secdforest_est.m(j,ac); + oq35_hvarea_other(t,j,ac,"marginal") = q35_hvarea_other.m(j,ac); + oq35_hvarea_secdforest(t,j,ac,"marginal") = q35_hvarea_secdforest.m(j,ac); + oq35_hvarea_primforest(t,j,"marginal") = q35_hvarea_primforest.m(j); + oq35_prod_secdforest(t,j,"marginal") = q35_prod_secdforest.m(j); + oq35_prod_primforest(t,j,"marginal") = q35_prod_primforest.m(j); + oq35_prod_other(t,j,"marginal") = q35_prod_other.m(j); + oq35_cost_hvarea(t,i,"marginal") = q35_cost_hvarea.m(i); + oq35_bv_primforest(t,j,potnatveg,"marginal") = q35_bv_primforest.m(j,potnatveg); + oq35_bv_secdforest(t,j,potnatveg,"marginal") = q35_bv_secdforest.m(j,potnatveg); + oq35_bv_other(t,j,potnatveg,"marginal") = q35_bv_other.m(j,potnatveg); + oq35_natveg_conservation(t,j,"marginal") = q35_natveg_conservation.m(j); + ov35_secdforest(t,j,ac,"level") = v35_secdforest.l(j,ac); + ov35_other(t,j,ac,"level") = v35_other.l(j,ac); + ov_landdiff_natveg(t,"level") = vm_landdiff_natveg.l; + ov35_other_expansion(t,j,ac,"level") = v35_other_expansion.l(j,ac); + ov35_other_reduction(t,j,ac,"level") = v35_other_reduction.l(j,ac); + ov35_secdforest_expansion(t,j,ac,"level") = v35_secdforest_expansion.l(j,ac); + ov35_secdforest_reduction(t,j,ac,"level") = v35_secdforest_reduction.l(j,ac); + ov35_primforest_reduction(t,j,"level") = v35_primforest_reduction.l(j); + ov35_hvarea_secdforest(t,j,ac,"level") = v35_hvarea_secdforest.l(j,ac); + ov35_hvarea_other(t,j,ac,"level") = v35_hvarea_other.l(j,ac); + ov35_hvarea_primforest(t,j,"level") = v35_hvarea_primforest.l(j); + ov_prod_natveg(t,j,land_natveg,kforestry,"level") = vm_prod_natveg.l(j,land_natveg,kforestry); + ov_cost_hvarea_natveg(t,i,"level") = vm_cost_hvarea_natveg.l(i); + oq35_land_secdforest(t,j,"level") = q35_land_secdforest.l(j); + oq35_land_other(t,j,"level") = q35_land_other.l(j); + oq35_carbon_primforest(t,j,ag_pools,stockType,"level") = q35_carbon_primforest.l(j,ag_pools,stockType); + oq35_carbon_secdforest(t,j,ag_pools,stockType,"level") = q35_carbon_secdforest.l(j,ag_pools,stockType); + oq35_carbon_other(t,j,ag_pools,stockType,"level") = q35_carbon_other.l(j,ag_pools,stockType); + oq35_min_forest(t,j,"level") = q35_min_forest.l(j); + oq35_min_other(t,j,"level") = q35_min_other.l(j); + oq35_landdiff(t,"level") = q35_landdiff.l; + oq35_other_expansion(t,j,ac,"level") = q35_other_expansion.l(j,ac); + oq35_other_reduction(t,j,ac,"level") = q35_other_reduction.l(j,ac); + oq35_secdforest_expansion(t,j,ac,"level") = q35_secdforest_expansion.l(j,ac); + oq35_secdforest_reduction(t,j,ac,"level") = q35_secdforest_reduction.l(j,ac); + oq35_primforest_reduction(t,j,"level") = q35_primforest_reduction.l(j); + oq35_secdforest_regeneration(t,j,"level") = q35_secdforest_regeneration.l(j); + oq35_other_regeneration(t,j,"level") = q35_other_regeneration.l(j); + oq35_other_est(t,j,ac,"level") = q35_other_est.l(j,ac); + oq35_secdforest_est(t,j,ac,"level") = q35_secdforest_est.l(j,ac); + oq35_hvarea_other(t,j,ac,"level") = q35_hvarea_other.l(j,ac); + oq35_hvarea_secdforest(t,j,ac,"level") = q35_hvarea_secdforest.l(j,ac); + oq35_hvarea_primforest(t,j,"level") = q35_hvarea_primforest.l(j); + oq35_prod_secdforest(t,j,"level") = q35_prod_secdforest.l(j); + oq35_prod_primforest(t,j,"level") = q35_prod_primforest.l(j); + oq35_prod_other(t,j,"level") = q35_prod_other.l(j); + oq35_cost_hvarea(t,i,"level") = q35_cost_hvarea.l(i); + oq35_bv_primforest(t,j,potnatveg,"level") = q35_bv_primforest.l(j,potnatveg); + oq35_bv_secdforest(t,j,potnatveg,"level") = q35_bv_secdforest.l(j,potnatveg); + oq35_bv_other(t,j,potnatveg,"level") = q35_bv_other.l(j,potnatveg); + oq35_natveg_conservation(t,j,"level") = q35_natveg_conservation.l(j); + ov35_secdforest(t,j,ac,"upper") = v35_secdforest.up(j,ac); + ov35_other(t,j,ac,"upper") = v35_other.up(j,ac); + ov_landdiff_natveg(t,"upper") = vm_landdiff_natveg.up; + ov35_other_expansion(t,j,ac,"upper") = v35_other_expansion.up(j,ac); + ov35_other_reduction(t,j,ac,"upper") = v35_other_reduction.up(j,ac); + ov35_secdforest_expansion(t,j,ac,"upper") = v35_secdforest_expansion.up(j,ac); + ov35_secdforest_reduction(t,j,ac,"upper") = v35_secdforest_reduction.up(j,ac); + ov35_primforest_reduction(t,j,"upper") = v35_primforest_reduction.up(j); + ov35_hvarea_secdforest(t,j,ac,"upper") = v35_hvarea_secdforest.up(j,ac); + ov35_hvarea_other(t,j,ac,"upper") = v35_hvarea_other.up(j,ac); + ov35_hvarea_primforest(t,j,"upper") = v35_hvarea_primforest.up(j); + ov_prod_natveg(t,j,land_natveg,kforestry,"upper") = vm_prod_natveg.up(j,land_natveg,kforestry); + ov_cost_hvarea_natveg(t,i,"upper") = vm_cost_hvarea_natveg.up(i); + oq35_land_secdforest(t,j,"upper") = q35_land_secdforest.up(j); + oq35_land_other(t,j,"upper") = q35_land_other.up(j); + oq35_carbon_primforest(t,j,ag_pools,stockType,"upper") = q35_carbon_primforest.up(j,ag_pools,stockType); + oq35_carbon_secdforest(t,j,ag_pools,stockType,"upper") = q35_carbon_secdforest.up(j,ag_pools,stockType); + oq35_carbon_other(t,j,ag_pools,stockType,"upper") = q35_carbon_other.up(j,ag_pools,stockType); + oq35_min_forest(t,j,"upper") = q35_min_forest.up(j); + oq35_min_other(t,j,"upper") = q35_min_other.up(j); + oq35_landdiff(t,"upper") = q35_landdiff.up; + oq35_other_expansion(t,j,ac,"upper") = q35_other_expansion.up(j,ac); + oq35_other_reduction(t,j,ac,"upper") = q35_other_reduction.up(j,ac); + oq35_secdforest_expansion(t,j,ac,"upper") = q35_secdforest_expansion.up(j,ac); + oq35_secdforest_reduction(t,j,ac,"upper") = q35_secdforest_reduction.up(j,ac); + oq35_primforest_reduction(t,j,"upper") = q35_primforest_reduction.up(j); + oq35_secdforest_regeneration(t,j,"upper") = q35_secdforest_regeneration.up(j); + oq35_other_regeneration(t,j,"upper") = q35_other_regeneration.up(j); + oq35_other_est(t,j,ac,"upper") = q35_other_est.up(j,ac); + oq35_secdforest_est(t,j,ac,"upper") = q35_secdforest_est.up(j,ac); + oq35_hvarea_other(t,j,ac,"upper") = q35_hvarea_other.up(j,ac); + oq35_hvarea_secdforest(t,j,ac,"upper") = q35_hvarea_secdforest.up(j,ac); + oq35_hvarea_primforest(t,j,"upper") = q35_hvarea_primforest.up(j); + oq35_prod_secdforest(t,j,"upper") = q35_prod_secdforest.up(j); + oq35_prod_primforest(t,j,"upper") = q35_prod_primforest.up(j); + oq35_prod_other(t,j,"upper") = q35_prod_other.up(j); + oq35_cost_hvarea(t,i,"upper") = q35_cost_hvarea.up(i); + oq35_bv_primforest(t,j,potnatveg,"upper") = q35_bv_primforest.up(j,potnatveg); + oq35_bv_secdforest(t,j,potnatveg,"upper") = q35_bv_secdforest.up(j,potnatveg); + oq35_bv_other(t,j,potnatveg,"upper") = q35_bv_other.up(j,potnatveg); + oq35_natveg_conservation(t,j,"upper") = q35_natveg_conservation.up(j); + ov35_secdforest(t,j,ac,"lower") = v35_secdforest.lo(j,ac); + ov35_other(t,j,ac,"lower") = v35_other.lo(j,ac); + ov_landdiff_natveg(t,"lower") = vm_landdiff_natveg.lo; + ov35_other_expansion(t,j,ac,"lower") = v35_other_expansion.lo(j,ac); + ov35_other_reduction(t,j,ac,"lower") = v35_other_reduction.lo(j,ac); + ov35_secdforest_expansion(t,j,ac,"lower") = v35_secdforest_expansion.lo(j,ac); + ov35_secdforest_reduction(t,j,ac,"lower") = v35_secdforest_reduction.lo(j,ac); + ov35_primforest_reduction(t,j,"lower") = v35_primforest_reduction.lo(j); + ov35_hvarea_secdforest(t,j,ac,"lower") = v35_hvarea_secdforest.lo(j,ac); + ov35_hvarea_other(t,j,ac,"lower") = v35_hvarea_other.lo(j,ac); + ov35_hvarea_primforest(t,j,"lower") = v35_hvarea_primforest.lo(j); + ov_prod_natveg(t,j,land_natveg,kforestry,"lower") = vm_prod_natveg.lo(j,land_natveg,kforestry); + ov_cost_hvarea_natveg(t,i,"lower") = vm_cost_hvarea_natveg.lo(i); + oq35_land_secdforest(t,j,"lower") = q35_land_secdforest.lo(j); + oq35_land_other(t,j,"lower") = q35_land_other.lo(j); + oq35_carbon_primforest(t,j,ag_pools,stockType,"lower") = q35_carbon_primforest.lo(j,ag_pools,stockType); + oq35_carbon_secdforest(t,j,ag_pools,stockType,"lower") = q35_carbon_secdforest.lo(j,ag_pools,stockType); + oq35_carbon_other(t,j,ag_pools,stockType,"lower") = q35_carbon_other.lo(j,ag_pools,stockType); + oq35_min_forest(t,j,"lower") = q35_min_forest.lo(j); + oq35_min_other(t,j,"lower") = q35_min_other.lo(j); + oq35_landdiff(t,"lower") = q35_landdiff.lo; + oq35_other_expansion(t,j,ac,"lower") = q35_other_expansion.lo(j,ac); + oq35_other_reduction(t,j,ac,"lower") = q35_other_reduction.lo(j,ac); + oq35_secdforest_expansion(t,j,ac,"lower") = q35_secdforest_expansion.lo(j,ac); + oq35_secdforest_reduction(t,j,ac,"lower") = q35_secdforest_reduction.lo(j,ac); + oq35_primforest_reduction(t,j,"lower") = q35_primforest_reduction.lo(j); + oq35_secdforest_regeneration(t,j,"lower") = q35_secdforest_regeneration.lo(j); + oq35_other_regeneration(t,j,"lower") = q35_other_regeneration.lo(j); + oq35_other_est(t,j,ac,"lower") = q35_other_est.lo(j,ac); + oq35_secdforest_est(t,j,ac,"lower") = q35_secdforest_est.lo(j,ac); + oq35_hvarea_other(t,j,ac,"lower") = q35_hvarea_other.lo(j,ac); + oq35_hvarea_secdforest(t,j,ac,"lower") = q35_hvarea_secdforest.lo(j,ac); + oq35_hvarea_primforest(t,j,"lower") = q35_hvarea_primforest.lo(j); + oq35_prod_secdforest(t,j,"lower") = q35_prod_secdforest.lo(j); + oq35_prod_primforest(t,j,"lower") = q35_prod_primforest.lo(j); + oq35_prod_other(t,j,"lower") = q35_prod_other.lo(j); + oq35_cost_hvarea(t,i,"lower") = q35_cost_hvarea.lo(i); + oq35_bv_primforest(t,j,potnatveg,"lower") = q35_bv_primforest.lo(j,potnatveg); + oq35_bv_secdforest(t,j,potnatveg,"lower") = q35_bv_secdforest.lo(j,potnatveg); + oq35_bv_other(t,j,potnatveg,"lower") = q35_bv_other.lo(j,potnatveg); + oq35_natveg_conservation(t,j,"lower") = q35_natveg_conservation.lo(j); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/35_natveg/dynamic_feb21/preloop.gms b/modules/35_natveg/dynamic_feb21/preloop.gms index c77a0d5edf..cfb1d236a2 100644 --- a/modules/35_natveg/dynamic_feb21/preloop.gms +++ b/modules/35_natveg/dynamic_feb21/preloop.gms @@ -1,14 +1,15 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 +** initialize other land i35_other(j,ac) = 0; i35_other(j,"acx") = pcm_land(j,"other"); -* initialize secdforest area depending on switch. +** initialize secdforest area depending on switch. if(s35_secdf_distribution = 0, i35_secdforest(j,"acx") = pcm_land(j,"secdforest"); elseif s35_secdf_distribution = 1, @@ -32,13 +33,8 @@ elseif s35_secdf_distribution = 2, i35_secdforest(j,"acx") = i35_secdforest(j,"acx") + (pcm_land(j,"secdforest") - sum(ac, i35_secdforest(j,ac))); ** Initialize values to be used in presolve -p35_protect_shr(t,j,prot_type) = 0; p35_recovered_forest(t,j,ac) = 0; -** Initialize forest protection -p35_min_forest(t,j) = f35_min_land_stock(t,j,"%c35_ad_policy%","forest"); -p35_min_other(t,j) = f35_min_land_stock(t,j,"%c35_ad_policy%","other"); - *initialize parameter p35_other(t,j,ac) = 0; p35_secdforest(t,j,ac) = 0; @@ -47,10 +43,18 @@ p35_secdforest(t,j,ac) = 0; p35_disturbance_loss_secdf(t,j,ac) = 0; p35_disturbance_loss_primf(t,j) = 0; -************************************************************************** -******************************************************************************* -** Calibrate Natural vegetation yields -******************************************************************************* +* ----------------------------------------- +* Land conservation for climate mitigation +* ----------------------------------------- + +p35_min_forest(t,j) = f35_min_land_stock(t,j,"%c35_ad_policy%","forest"); +p35_min_other(t,j) = f35_min_land_stock(t,j,"%c35_ad_policy%","other"); + + +* ---------------------------------------- +* Calibrate Natural vegetation yields +* ---------------------------------------- + ** Initialize with 0 cvalues p35_land_start_ac(j,ac,land_natveg) = 0; ** Capture natural forest values (primary forest + secondary forest) @@ -60,13 +64,19 @@ p35_land_start_ac(j,ac,"secdforest") = i35_secdforest(j,ac); ** Wherever FAO reports >0 growing stock, we calculate how much growing stock MAGPIE ** sees even before optimization starts p35_observed_gs_reg(i) = 0; -p35_observed_gs_reg(i)$(f35_gs_relativetarget(i)>0) = (sum((cell(i,j),ac,land_natveg),(pm_timber_yield_initial(j,ac,land_natveg)$(not sameas(ac,"ac0")) / sm_wood_density) * p35_land_start_ac(j,ac,land_natveg)$(not sameas(ac,"ac0")))/ sum((cell(i,j),ac,land_natveg),p35_land_start_ac(j,ac,land_natveg)$(not sameas(ac,"ac0")))); +p35_observed_gs_reg(i)$(f35_gs_relativetarget(i)>0 AND sum((cell(i,j),ac,land_natveg),p35_land_start_ac(j,ac,land_natveg)$(not sameas(ac,"ac0")))>0) = + (sum((cell(i,j),ac,land_natveg),(pm_timber_yield_initial(j,ac,land_natveg)$(not sameas(ac,"ac0")) / sm_wood_density) * p35_land_start_ac(j,ac,land_natveg)$(not sameas(ac,"ac0")))/ sum((cell(i,j),ac,land_natveg),p35_land_start_ac(j,ac,land_natveg)$(not sameas(ac,"ac0")))); ** Initialze calibration factor for growing stocks as 1 ** we dont set it to 0 as we don't want to modify carbon densities by multiplication with 0 later p35_gs_scaling_reg(i) = 1; ** Calculate the ratio between target growing stock (reported by FAO) and observed growing stock (value at initialization in MAgPIE) -p35_gs_scaling_reg(i)$(f35_gs_relativetarget(i)>0) = f35_gs_relativetarget(i) / p35_observed_gs_reg(i); +p35_gs_scaling_reg(i)$(f35_gs_relativetarget(i)>0 AND p35_observed_gs_reg(i)>0) = f35_gs_relativetarget(i) / p35_observed_gs_reg(i); ** Update c-densitiy based on calibration factor for growing stocks pm_carbon_density_ac(t_all,j,ac,"vegc") = pm_carbon_density_ac(t_all,j,ac,"vegc") * sum(cell(i,j),p35_gs_scaling_reg(i)); + +* ----------------------------- +* Set forest damage trajectory +* ----------------------------- +m_sigmoid_interpol(p35_damage_fader,sm_fix_SSP2,s35_forest_damage_end,0,1); diff --git a/modules/35_natveg/dynamic_feb21/presolve.gms b/modules/35_natveg/dynamic_feb21/presolve.gms index 9038fe3b41..b2a9ca33af 100644 --- a/modules/35_natveg/dynamic_feb21/presolve.gms +++ b/modules/35_natveg/dynamic_feb21/presolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,28 +6,46 @@ *** | Contact: magpie@pik-potsdam.de if((ord(t) = 1), - pc35_secdforest(j,ac) = i35_secdforest(j,ac); - pc35_other(j,ac) = i35_other(j,ac); + pc35_secdforest(j,ac) = i35_secdforest(j,ac); + pc35_other(j,ac) = i35_other(j,ac); else - pc35_secdforest(j,ac) = p35_secdforest(t-1,j,ac); - pc35_other(j,ac) = p35_other(t-1,j,ac); + pc35_secdforest(j,ac) = p35_secdforest(t-1,j,ac); + pc35_other(j,ac) = p35_other(t-1,j,ac); ); -* Shift ageclasses due to shifting agriculture fires, first calculate damages +* ---------------------------------------------------- +* Shift ageclasses due to shifting agriculture fires +* ---------------------------------------------------- + +* first calculate damages if(s35_forest_damage=1, - p35_disturbance_loss_secdf(t,j,ac_sub) = pc35_secdforest(j,ac_sub) * sum(cell(i,j),f35_forest_lost_share(i,"shifting_agriculture"))*m_timestep_length_forestry; - p35_disturbance_loss_primf(t,j) = pcm_land(j,"primforest") * sum(cell(i,j),f35_forest_lost_share(i,"shifting_agriculture"))*m_timestep_length_forestry; - ); + p35_disturbance_loss_secdf(t,j,ac_sub) = pc35_secdforest(j,ac_sub) * sum(cell(i,j),f35_forest_lost_share(i,"shifting_agriculture"))*m_timestep_length_forestry; + p35_disturbance_loss_primf(t,j) = pcm_land(j,"primforest") * sum(cell(i,j),f35_forest_lost_share(i,"shifting_agriculture"))*m_timestep_length_forestry; + ); +* shifting cultivation is faded out if(s35_forest_damage=2, - p35_disturbance_loss_secdf(t,j,ac_sub) = pc35_secdforest(j,ac_sub) * sum((cell(i,j),combined_loss),f35_forest_lost_share(i,combined_loss))*m_timestep_length_forestry; - 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; - ); + p35_disturbance_loss_secdf(t,j,ac_sub) = pc35_secdforest(j,ac_sub) * sum(cell(i,j),f35_forest_lost_share(i,"shifting_agriculture"))*m_timestep_length_forestry*(1 - p35_damage_fader(t)); + p35_disturbance_loss_primf(t,j) = pcm_land(j,"primforest") * sum(cell(i,j),f35_forest_lost_share(i,"shifting_agriculture"))*m_timestep_length_forestry*(1 - p35_damage_fader(t)); + ); + +if(s35_forest_damage=3, + p35_disturbance_loss_secdf(t,j,ac_sub) = pc35_secdforest(j,ac_sub) * sum((cell(i,j),combined_loss),f35_forest_lost_share(i,combined_loss))*m_timestep_length_forestry; + 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); - pc35_secdforest(j,ac_sub) = pc35_secdforest(j,ac_sub) - p35_disturbance_loss_secdf(t,j,ac_sub); - pcm_land(j,"primforest") = pcm_land(j,"primforest") - p35_disturbance_loss_primf(t,j); - vm_land.l(j,"primforest") = pcm_land(j,"primforest"); +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); + +pc35_secdforest(j,ac_sub) = pc35_secdforest(j,ac_sub) - p35_disturbance_loss_secdf(t,j,ac_sub); +pcm_land(j,"primforest") = pcm_land(j,"primforest") - p35_disturbance_loss_primf(t,j); +vm_land.l(j,"primforest") = pcm_land(j,"primforest"); * Regrowth of natural vegetation (natural succession) is modelled by shifting age-classes according to time step length. s35_shift = m_timestep_length_forestry/5; @@ -44,14 +62,17 @@ s35_shift = m_timestep_length_forestry/5; p35_secdforest(t,j,"acx") = p35_secdforest(t,j,"acx") + sum(ac$(ord(ac) > card(ac)-s35_shift), pc35_secdforest(j,ac)); +* -------------------------------------- +* Carbon threshold for secondary forest +* -------------------------------------- + *' @code *' If the vegetation carbon density in a simulation unit due to regrowth *' exceeds a threshold of 20 tC/ha the respective area is shifted from other natural land to secondary forest. p35_recovered_forest(t,j,ac)$(not sameas(ac,"acx")) = - p35_other(t,j,ac)$(pm_carbon_density_ac(t,j,ac,"vegc") > 20); + p35_other(t,j,ac)$(pm_carbon_density_ac(t,j,ac,"vegc") > 20); p35_other(t,j,ac) = p35_other(t,j,ac) - p35_recovered_forest(t,j,ac); -p35_secdforest(t,j,ac) = - p35_secdforest(t,j,ac) + p35_recovered_forest(t,j,ac); +p35_secdforest(t,j,ac) = p35_secdforest(t,j,ac) + p35_recovered_forest(t,j,ac); *' @stop pc35_secdforest(j,ac) = p35_secdforest(t,j,ac); @@ -64,104 +85,91 @@ v35_other.l(j,ac) = pc35_other(j,ac); vm_land.l(j,"other") = sum(ac, pc35_other(j,ac)); pcm_land(j,"other") = sum(ac, pc35_other(j,ac)); -*** Forest protection (WDPA areas and different conservation priority areas) -* calc protection share for primforest, secdforest and other land -p35_protect_shr(t,j,prot_type)$(sum(land_natveg, pm_land_start(j,land_natveg)) > 0) = f35_protect_area(j,prot_type)/sum(land_natveg, pm_land_start(j,land_natveg)); -p35_protect_shr(t,j,prot_type)$(p35_protect_shr(t,j,prot_type) > 1) = 1; -p35_protect_shr(t,j,prot_type)$(p35_protect_shr(t,j,prot_type) < 0) = 0; - -* protection scenarios -$ifthen "%c35_protect_scenario%" == "none" - p35_save_primforest(t,j) = 0; - p35_save_secdforest(t,j) = 0; - p35_save_other(t,j) = 0; -$elseif "%c35_protect_scenario%" == "full" - p35_save_primforest(t,j) = pcm_land(j,"primforest"); - p35_save_secdforest(t,j) = pcm_land(j,"secdforest"); - p35_save_other(t,j) = pcm_land(j,"other"); -$elseif "%c35_protect_scenario%" == "forest" - p35_save_primforest(t,j) = pcm_land(j,"primforest"); - p35_save_secdforest(t,j) = pcm_land(j,"secdforest"); - p35_save_other(t,j) = 0; -$elseif "%c35_protect_scenario%" == "WDPA" - p35_save_primforest(t,j) = p35_protect_shr(t,j,"WDPA")*pm_land_start(j,"primforest"); - p35_save_secdforest(t,j) = p35_protect_shr(t,j,"WDPA")*pm_land_start(j,"secdforest"); - p35_save_other(t,j) = p35_protect_shr(t,j,"WDPA")*pm_land_start(j,"other"); -$elseif "%c35_protect_scenario%" == "HalfEarth" -* Correction of Half Earth protection share -* Note: Half Earth already contains WDPA protection -p35_protect_shr(t,j,"HalfEarth")$(p35_protect_shr(t,j,"HalfEarth") < p35_protect_shr(t,j,"WDPA")) = p35_protect_shr(t,j,"WDPA"); - -* half earth scenario begins fading in after 2020: -p35_save_primforest(t,j) = (p35_protect_shr(t,j,"WDPA")+f35_protection_fader(t)*(p35_protect_shr(t,j,"HalfEarth")-p35_protect_shr(t,j,"WDPA")))*pm_land_start(j,"primforest"); -p35_save_secdforest(t,j) = (p35_protect_shr(t,j,"WDPA")+f35_protection_fader(t)*(p35_protect_shr(t,j,"HalfEarth")-p35_protect_shr(t,j,"WDPA")))*pm_land_start(j,"secdforest"); -p35_save_other(t,j) = (p35_protect_shr(t,j,"WDPA")+f35_protection_fader(t)*(p35_protect_shr(t,j,"HalfEarth")-p35_protect_shr(t,j,"WDPA")))*pm_land_start(j,"other"); -$else -* conservation priority scenarios start in 2020, in addition to WDPA protection - if (m_year(t) <= sm_fix_SSP2, - p35_save_primforest(t,j) = p35_protect_shr(t,j,"WDPA")*pm_land_start(j,"primforest"); - p35_save_secdforest(t,j) = p35_protect_shr(t,j,"WDPA")*pm_land_start(j,"secdforest"); - p35_save_other(t,j) = p35_protect_shr(t,j,"WDPA")*pm_land_start(j,"other"); - else - p35_save_primforest(t,j) = (p35_protect_shr(t,j,"WDPA")+p35_protect_shr(t,j,"%c35_protect_scenario%"))*pm_land_start(j,"primforest"); - p35_save_secdforest(t,j) = (p35_protect_shr(t,j,"WDPA")+p35_protect_shr(t,j,"%c35_protect_scenario%"))*pm_land_start(j,"secdforest"); - p35_save_other(t,j) = (p35_protect_shr(t,j,"WDPA")+p35_protect_shr(t,j,"%c35_protect_scenario%"))*pm_land_start(j,"other"); - p35_save_primforest(t,j)$(p35_save_primforest(t,j) > pcm_land(j,"primforest")) = pcm_land(j,"primforest"); - p35_save_secdforest(t,j)$(p35_save_secdforest(t,j) > pcm_land(j,"secdforest")) = pcm_land(j,"secdforest"); - p35_save_other(t,j)$(p35_save_other(t,j) > pcm_land(j,"other")) = pcm_land(j,"other"); - ); -$endif +* Correct land conservation for damage +pm_land_conservation(t,j,land_natveg,"protect")$(pm_land_conservation(t,j,land_natveg,"protect") > pcm_land(j,land_natveg)) = pcm_land(j,land_natveg); + +* ------------------------------------- +* Set bounds based on land conservation +* ------------------------------------- * Within the optimization, primary and secondary forests can only decrease * (e.g. for cropland expansion). * In contrast, other natural land can decrease and increase within the optimization. * For instance, other natural land increases if agricultural land is abandoned. -** Setting bounds for only allowing s35_natveg_harvest_shr percentage of available primf to be harvested (highest age class) +** Setting bounds for only allowing s35_natveg_harvest_shr percentage of available forest to be harvested (highest age class) + +* Primary forest + ** Allowing selective logging only after historical period if (sum(sameas(t_past,t),1) = 1, -vm_land.lo(j,"primforest") = p35_save_primforest(t,j); +vm_land.lo(j,"primforest") = 0; else -vm_land.lo(j,"primforest") = max((1-s35_natveg_harvest_shr) * pcm_land(j,"primforest"), p35_save_primforest(t,j)); +vm_land.lo(j,"primforest") = (1-s35_natveg_harvest_shr) * pcm_land(j,"primforest"); ); +* Primary forest conservation +vm_land.lo(j,"primforest")$(vm_land.lo(j,"primforest") < pm_land_conservation(t,j,"primforest","protect")) = pm_land_conservation(t,j,"primforest","protect"); vm_land.up(j,"primforest") = pcm_land(j,"primforest"); -m_boundfix(vm_land,(j,"primforest"),l,10e-5); -*reset bounds +* Secondary forest + +*reset bound v35_secdforest.lo(j,ac) = 0; v35_secdforest.up(j,ac) = Inf; -** Setting bounds for only allowing s35_natveg_harvest_shr percentage of available primf to be harvested (highest age class) - -p35_save_dist(j,ac_sub) = (pc35_secdforest(j,ac_sub)/sum(ac_sub2,pc35_secdforest(j,ac_sub2)))$(sum(ac_sub2,pc35_secdforest(j,ac_sub2))>0); +p35_protection_dist(j,ac_sub) = (pc35_secdforest(j,ac_sub)/sum(ac_sub2,pc35_secdforest(j,ac_sub2)))$(sum(ac_sub2,pc35_secdforest(j,ac_sub2))>0); if (sum(sameas(t_past,t),1) = 1, -v35_secdforest.lo(j,"acx")$(s35_secdf_distribution=0) = p35_save_secdforest(t,j); -v35_secdforest.lo(j,ac_sub)$(s35_secdf_distribution=1) = p35_save_secdforest(t,j)/card(ac_sub); -v35_secdforest.lo(j,ac_sub)$(s35_secdf_distribution=2) = p35_save_secdforest(t,j)*p35_save_dist(j,ac_sub); -*v35_secdforest.lo(j,"acx")$(s35_secdf_distribution=2) = p35_save_secdforest(t,j); +v35_secdforest.lo(j,ac_sub) = pm_land_conservation(t,j,"secdforest","protect") * p35_protection_dist(j,ac_sub); else -v35_secdforest.lo(j,"acx")$(s35_secdf_distribution=0) = max((1-s35_natveg_harvest_shr) * pc35_secdforest(j,"acx") , p35_save_secdforest(t,j)); -v35_secdforest.lo(j,ac_sub)$(s35_secdf_distribution=1) = max((1-s35_natveg_harvest_shr) * pc35_secdforest(j,ac_sub), p35_save_secdforest(t,j) / card(ac_sub)); -v35_secdforest.lo(j,ac_sub)$(s35_secdf_distribution=2) = max((1-s35_natveg_harvest_shr) * pc35_secdforest(j,ac_sub), p35_save_secdforest(t,j) * p35_save_dist(j,ac_sub)); -*v35_secdforest.lo(j,"acx")$(s35_secdf_distribution=2) = max((1-s35_natveg_harvest_shr) * pc35_secdforest(j,"acx"), p35_save_secdforest(t,j)); +v35_secdforest.lo(j,ac_sub) = max((1-s35_natveg_harvest_shr) * pc35_secdforest(j,ac_sub), pm_land_conservation(t,j,"secdforest","protect") * p35_protection_dist(j,ac_sub)); ); +* upper bound v35_secdforest.up(j,ac_sub) = pc35_secdforest(j,ac_sub); m_boundfix(v35_secdforest,(j,ac_sub),l,10e-5); +* Secondary forest conservation +* protection bound fix +pm_land_conservation(t,j,"secdforest","protect")$(abs(pm_land_conservation(t,j,"secdforest","protect") - sum(ac_sub, pc35_secdforest(j,ac_sub))) < 10e-5) = sum(ac_sub, pc35_secdforest(j,ac_sub)); +* set restoration target +p35_land_restoration(j,"secdforest") = pm_land_conservation(t,j,"secdforest","restore"); +* Do not restore secdforest in areas where total natural +* land area meets the total natural land conservation target +p35_land_restoration(j,"secdforest")$(sum(land_natveg, pcm_land(j,land_natveg)) >= sum((land_natveg, consv_type), pm_land_conservation(t,j,land_natveg,consv_type))) = 0; +* set conservation bound +vm_land.lo(j,"secdforest") = pm_land_conservation(t,j,"secdforest","protect") + p35_land_restoration(j,"secdforest"); + +** Other land + *reset bounds v35_other.lo(j,ac) = 0; v35_other.up(j,ac) = Inf; -*set bounds -v35_other.lo(j,"acx") = p35_save_other(t,j); +*set upper bound v35_other.up(j,ac_sub) = pc35_other(j,ac_sub); m_boundfix(v35_other,(j,ac_sub),l,10e-5); -* calculate carbon density -* highest carbon density 1st time step to account for reshuffling +* Other land conservation +* protection bound fix +pm_land_conservation(t,j,"other","protect")$(abs(pm_land_conservation(t,j,"other","protect") - sum(ac_sub, pc35_other(j,ac_sub))) < 10e-5) = sum(ac_sub, pc35_other(j,ac_sub)); +* set restoration target +p35_land_restoration(j,"other") = pm_land_conservation(t,j,"other","restore"); +* Do not restore other land in areas where total natural +* land area meets the total natural land conservation target +p35_land_restoration(j,"other")$(sum(land_natveg, pcm_land(j,land_natveg)) >= sum((land_natveg, consv_type), pm_land_conservation(t,j,land_natveg,consv_type))) = 0; +* set conservation bound +vm_land.lo(j,"other") = pm_land_conservation(t,j,"other","protect") + p35_land_restoration(j,"other"); + +* ------------------------------ +* Calculate carbon density +* ------------------------------ +* highest carbon density 1st time step to account for reshuffling p35_carbon_density_secdforest(t,j,ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools); p35_carbon_density_other(t,j,ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools); +* ------------------ +* NPI/NDC policy +* ------------------ + p35_min_forest(t,j)$(p35_min_forest(t,j) > pcm_land(j,"primforest") + pcm_land(j,"secdforest")) = pcm_land(j,"primforest") + pcm_land(j,"secdforest"); p35_min_other(t,j)$(p35_min_other(t,j) > pcm_land(j,"other")) = pcm_land(j,"other"); @@ -170,7 +178,8 @@ p35_land(t,j,land_natveg,ac) = 0; p35_land(t,j,"primforest","acx") = pcm_land(j,"primforest"); p35_land(t,j,"secdforest",ac) = p35_secdforest(t,j,ac); *p35_land(t,j,"other",ac) = p35_other(t,j,ac): -p35_updated_gs_natfor(t,i) = (sum((cell(i,j),ac,land_natveg),(pm_timber_yield(t,j,ac,land_natveg) / sm_wood_density) * p35_land(t,j,land_natveg,ac))/ sum((cell(i,j),ac,land_natveg), p35_land(t,j,land_natveg,ac))); +p35_updated_gs_natfor(t,i) = 0; +p35_updated_gs_natfor(t,i)$(sum((cell(i,j),ac,land_natveg), p35_land(t,j,land_natveg,ac))>0) = (sum((cell(i,j),ac,land_natveg),(pm_timber_yield(t,j,ac,land_natveg) / sm_wood_density) * p35_land(t,j,land_natveg,ac))/ sum((cell(i,j),ac,land_natveg), p35_land(t,j,land_natveg,ac))); ** Youngest age classes are not allowed to be harvested v35_hvarea_secdforest.fx(j,ac_est) = 0; @@ -178,7 +187,6 @@ v35_hvarea_other.fx(j,ac_est) = 0; v35_secdforest_reduction.fx(j,ac_est) = 0; v35_other_reduction.fx(j,ac_est) = 0; - vm_prod_natveg.fx(j,"other","wood") = 0; if(s35_hvarea = 0, diff --git a/modules/35_natveg/dynamic_feb21/realization.gms b/modules/35_natveg/dynamic_feb21/realization.gms index 08e58429ff..df9c626401 100644 --- a/modules/35_natveg/dynamic_feb21/realization.gms +++ b/modules/35_natveg/dynamic_feb21/realization.gms @@ -1,30 +1,23 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 In the dynamic_may18 realization, land and carbon stock dynamics +*' @description In the dynamic_feb21 realization, land and carbon stock dynamics *' of natural vegetation are modeled endogenously. *' The initial spatial distribution of the sub-land-types primary forest, *' secondary forest and other natural land is based on the *' LUH2 data set [@hurtt2018luh2]. -*' The realization includes 2 different kinds of land protection. -*' a) Land protection based on the World Database on Protected Areas (WDPA) -*' maintained by the International Union for Conservation of Nature (IUCN) and -*' b) land protection based on national policies implemented (NPI) and nationally -*' determined contributions to the Paris agreement (NDC) taken from individual country reports. -*' Land protection based on WDPA is static over time, while the NPI/NDC polices -*' ramp up until 2030 and are assumed constant thereafter. For WDPA the level of -*' land protection is based on IUCN catI+II, which reflect areas currently under -*' protection (e.g. strict nature reserves and national parks), and distributed -*' equally across all sub-land-types (primary forest, secondary forest and other natural land). -*' On top of the IUCN catI+II land protection, there are options to protect different -*' conservation priority areas such as biodiversity hotspots (BH), centers of plant -*' diversity (CBD), frontier forests (FF) and last of the wild (LW). -*' NPI/NDC land protection polices are be applied on forest and other land, depending -*' on individual country reports. Additionally, this module provides the ability to +*' This realization also includes national policies implemented (NPI) and nationally +*' determined contributions to the Paris agreement (NDC) with regard to forest and other +*' land protection. The NPI/NDC polices ramp up until 2030 and are assumed constant +*' thereafter. NPI/NDC land conservation polices are applied on forest and other land, +*' depending on individual country reports. The NPI/NDC policies are treated as minimum +*' constraints and therefore are non-additive, if the land protection targets as provided by +*' the module `22_land_conservation` and the interface `pm_land_conservation` are larger. +*' Additionally, this module includes forest damage and provides the ability to *' harvest natural vegetation for timber. Both wood and woodfuel can be produceed *' from primary and secondary forest but other land is only allowed to be harvested *' for woodfuel. @@ -36,7 +29,7 @@ *' on a more emperically obtained distribution in different age classes based *' on satellite data but this results is highly negative land-use change emissions. *' Inclusion of this data in MAgPIE remains work in progess and is not available for release yet. -*' Additionally, in this module realizatuion, harvested secondary forest stays +*' Additionally, in this module realization, harvested secondary forest stays *' secondary forest and harvested primary forest is reclassified as secondary forest. *####################### R SECTION START (PHASES) ############################## diff --git a/modules/35_natveg/dynamic_feb21/scaling.gms b/modules/35_natveg/dynamic_feb21/scaling.gms index 4e819d0439..449a174513 100644 --- a/modules/35_natveg/dynamic_feb21/scaling.gms +++ b/modules/35_natveg/dynamic_feb21/scaling.gms @@ -1,12 +1,13 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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_landdiff_natveg.scale = 10e4; v35_other_expansion.scale(j,ac) = 10e-3; v35_other_reduction.scale(j,ac) = 10e-3; +v35_secdforest_expansion.scale(j,ac) = 10e-3; +v35_secdforest_reduction.scale(j,ac) = 10e-3; v35_hvarea_other.scale(j,ac) = 10e-3; -vm_cost_hvarea_natveg.scale(i) = 10e4; +vm_cost_hvarea_natveg.scale(i)$(s35_hvarea = 1 OR s35_hvarea = 2) = 10e4; diff --git a/modules/35_natveg/dynamic_feb21/sets.gms b/modules/35_natveg/dynamic_feb21/sets.gms index c825206e94..16fe071951 100644 --- a/modules/35_natveg/dynamic_feb21/sets.gms +++ b/modules/35_natveg/dynamic_feb21/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,14 +6,6 @@ *** | Contact: magpie@pik-potsdam.de sets - pol35 Land protection policy - / none, npi, ndc / - - prot_type Conservation priority areas - / BH, CPD, FF, LW, WDPA, HalfEarth / - - pol_stock35 Land types for land protection policies - / forest, other / driver_source Source of deforestation drivers / overall, deforestation, shifting_agriculture, @@ -22,4 +14,15 @@ sets combined_loss(driver_source) Combined loss from fire plus agriculture / shifting_agriculture,wildfire / + pol35 Land protection policy + / none, npi, ndc / + + pol_stock35 Land types for land protection policies + / 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 e7f27d5460..f1603f4a64 100644 --- a/modules/35_natveg/input/files +++ b/modules/35_natveg/input/files @@ -1,7 +1,6 @@ * list of files that are required here -protect_area.cs3 npi_ndc_ad_aolc_pol.cs3 f35_forest_disturbance_share.cs4 f35_forest_lost_share.cs3 -f35_protection_fader.csv f35_gs_relativetarget.cs4 +f35_forest_shock.csv diff --git a/modules/35_natveg/module.gms b/modules/35_natveg/module.gms index 7287fffcd9..84d794878d 100644 --- a/modules/35_natveg/module.gms +++ b/modules/35_natveg/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -11,11 +11,11 @@ *' (see also the other land modules: [30_crop], [31_past], [32_forestry], [34_urban]). *' It calculates land and carbon stocks, as well as the biodiversity value, of natural vegetation, *' which consists of primary forest, secondary forest and other natural land. -*' The module determines the availability of natural vegetation for land conversion. +*' The module considers land conservation and determines the availability of natural vegetation +*' for land conversion. *' -*' @authors Florian Humpenöder, Abhijeet Mishra +*' @authors Florian Humpenöder, Abhijeet Mishra, Patrick v. Jeetze *###################### R SECTION START (MODULETYPES) ########################## $Ifi "%natveg%" == "dynamic_feb21" $include "./modules/35_natveg/dynamic_feb21/realization.gms" -$Ifi "%natveg%" == "static" $include "./modules/35_natveg/static/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/35_natveg/static/declarations.gms b/modules/35_natveg/static/declarations.gms deleted file mode 100644 index 77dbf501b1..0000000000 --- a/modules/35_natveg/static/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 - -positive variables - v35_secdforest(j,ac) Detailed stock of secdforest (mio. ha) - v35_other(j,ac) Detailed stock of other land (mio. ha) - vm_landdiff_natveg Aggregated difference in other land compared to previous timestep (mio. ha) - v35_hvarea_secdforest(j,ac) Harvested area from secondary forest (mio. ha) - v35_hvarea_other(j,ac) Harvested area from other land (mio. ha) - v35_hvarea_primforest(j) Harvested area from primary forest (mio. ha) - vm_cost_hvarea_natveg(i) Cost of harvesting natural vegetation (mio. USD) -; - - -*#################### R SECTION START (OUTPUT DECLARATIONS) #################### -parameters - ov35_secdforest(t,j,ac,type) Detailed stock of secdforest (mio. ha) - ov35_other(t,j,ac,type) Detailed stock of other land (mio. ha) - ov_landdiff_natveg(t,type) Aggregated difference in other land compared to previous timestep (mio. ha) - ov35_hvarea_secdforest(t,j,ac,type) Harvested area from secondary forest (mio. ha) - ov35_hvarea_other(t,j,ac,type) Harvested area from other land (mio. ha) - ov35_hvarea_primforest(t,j,type) Harvested area from primary forest (mio. ha) - ov_cost_hvarea_natveg(t,i,type) Cost of harvesting natural vegetation (mio. USD) -; -*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/35_natveg/static/not_used.txt b/modules/35_natveg/static/not_used.txt deleted file mode 100644 index 4216119791..0000000000 --- a/modules/35_natveg/static/not_used.txt +++ /dev/null @@ -1,18 +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 -pm_carbon_density_ac, input,not used -pm_land_start, input,not used -v35_secdforest_reduction, variable, not used -v35_primforest_reduction, variable, not used -v35_other_reduction, variable, not used -sm_fix_SSP2, input, not used -im_plantedclass_ac, par, not used -pm_timber_yield, par, not used -pm_timber_yield_initial, par, not used -sm_wood_density, scalar, not used -vm_prod_natveg, var, not used diff --git a/modules/35_natveg/static/postsolve.gms b/modules/35_natveg/static/postsolve.gms deleted file mode 100644 index 4ef2c0ba20..0000000000 --- a/modules/35_natveg/static/postsolve.gms +++ /dev/null @@ -1,38 +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) ##################### - ov35_secdforest(t,j,ac,"marginal") = v35_secdforest.m(j,ac); - ov35_other(t,j,ac,"marginal") = v35_other.m(j,ac); - ov_landdiff_natveg(t,"marginal") = vm_landdiff_natveg.m; - ov35_hvarea_secdforest(t,j,ac,"marginal") = v35_hvarea_secdforest.m(j,ac); - ov35_hvarea_other(t,j,ac,"marginal") = v35_hvarea_other.m(j,ac); - ov35_hvarea_primforest(t,j,"marginal") = v35_hvarea_primforest.m(j); - ov_cost_hvarea_natveg(t,i,"marginal") = vm_cost_hvarea_natveg.m(i); - ov35_secdforest(t,j,ac,"level") = v35_secdforest.l(j,ac); - ov35_other(t,j,ac,"level") = v35_other.l(j,ac); - ov_landdiff_natveg(t,"level") = vm_landdiff_natveg.l; - ov35_hvarea_secdforest(t,j,ac,"level") = v35_hvarea_secdforest.l(j,ac); - ov35_hvarea_other(t,j,ac,"level") = v35_hvarea_other.l(j,ac); - ov35_hvarea_primforest(t,j,"level") = v35_hvarea_primforest.l(j); - ov_cost_hvarea_natveg(t,i,"level") = vm_cost_hvarea_natveg.l(i); - ov35_secdforest(t,j,ac,"upper") = v35_secdforest.up(j,ac); - ov35_other(t,j,ac,"upper") = v35_other.up(j,ac); - ov_landdiff_natveg(t,"upper") = vm_landdiff_natveg.up; - ov35_hvarea_secdforest(t,j,ac,"upper") = v35_hvarea_secdforest.up(j,ac); - ov35_hvarea_other(t,j,ac,"upper") = v35_hvarea_other.up(j,ac); - ov35_hvarea_primforest(t,j,"upper") = v35_hvarea_primforest.up(j); - ov_cost_hvarea_natveg(t,i,"upper") = vm_cost_hvarea_natveg.up(i); - ov35_secdforest(t,j,ac,"lower") = v35_secdforest.lo(j,ac); - ov35_other(t,j,ac,"lower") = v35_other.lo(j,ac); - ov_landdiff_natveg(t,"lower") = vm_landdiff_natveg.lo; - ov35_hvarea_secdforest(t,j,ac,"lower") = v35_hvarea_secdforest.lo(j,ac); - ov35_hvarea_other(t,j,ac,"lower") = v35_hvarea_other.lo(j,ac); - ov35_hvarea_primforest(t,j,"lower") = v35_hvarea_primforest.lo(j); - ov_cost_hvarea_natveg(t,i,"lower") = vm_cost_hvarea_natveg.lo(i); -*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### - diff --git a/modules/35_natveg/static/preloop.gms b/modules/35_natveg/static/preloop.gms deleted file mode 100644 index e660e0840b..0000000000 --- a/modules/35_natveg/static/preloop.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 - -*fix primforest -vm_land.fx(j,"primforest") = pcm_land(j,"primforest"); - -*fix secdforest -v35_secdforest.fx(j,ac) = 0; -v35_secdforest.fx(j,"acx") = pcm_land(j,"secdforest"); -vm_land.fx(j,"secdforest") = sum(ac, v35_secdforest.l(j,ac)); - -*fix other land -v35_other.fx(j,ac) = 0; -v35_other.fx(j,"acx") = pcm_land(j,"other"); -vm_land.fx(j,"other") = sum(ac, v35_other.l(j,ac)); - -vm_landdiff_natveg.fx = 0; - -*Fix natveg harvest -v35_hvarea_secdforest.fx(j,ac) = 0; -v35_hvarea_other.fx(j,ac) = 0; -v35_hvarea_primforest.fx(j) = 0; - -vm_cost_hvarea_natveg.fx(i) = 0; diff --git a/modules/35_natveg/static/presolve.gms b/modules/35_natveg/static/presolve.gms deleted file mode 100644 index c741b9d917..0000000000 --- a/modules/35_natveg/static/presolve.gms +++ /dev/null @@ -1,33 +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 - -*' @code -*' Above ground carbon stocks for primary forest, secondary forest or other natural land are calculated -*' as the product of respective area and carbon density. -*' -vm_carbon_stock.fx(j,"primforest",ag_pools) = - vm_land.l(j,"primforest")*fm_carbon_density(t,j,"primforest",ag_pools); -*' -vm_carbon_stock.fx(j,"secdforest",ag_pools) = - vm_land.l(j,"secdforest")*fm_carbon_density(t,j,"secdforest",ag_pools); -*' -vm_carbon_stock.fx(j,"other",ag_pools) = - vm_land.l(j,"other")*fm_carbon_density(t,j,"other",ag_pools); - - -*' The following equations calculate the biodiversity value for primary and secondary vegetation -vm_bv.fx(j,"primforest",potnatveg) = - pcm_land(j,"primforest") * fm_bii_coeff("primary",potnatveg) * fm_luh2_side_layers(j,potnatveg); - -vm_bv.fx(j,"secdforest",potnatveg) = - sum(ac_mature, v35_secdforest.l(j,ac_mature)) * fm_bii_coeff("secd_mature",potnatveg) * fm_luh2_side_layers(j,potnatveg) - + sum(ac_young, v35_secdforest.l(j,ac_mature)) * fm_bii_coeff("secd_young",potnatveg) * fm_luh2_side_layers(j,potnatveg); - -vm_bv.fx(j,"other",potnatveg) = - sum(ac_mature, v35_other.l(j,ac_mature)) * fm_bii_coeff("secd_mature",potnatveg) * fm_luh2_side_layers(j,potnatveg) - + sum(ac_young, v35_other.l(j,ac_mature)) * fm_bii_coeff("secd_young",potnatveg) * fm_luh2_side_layers(j,potnatveg); -*' @stop diff --git a/modules/35_natveg/static/realization.gms b/modules/35_natveg/static/realization.gms deleted file mode 100644 index 9eba1c6580..0000000000 --- a/modules/35_natveg/static/realization.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 - -*' @description In the static realization natural vegetation is constant over time -*' with the spatial distribution of 1995 from the LUH2 data set [@hurtt2018luh2]. -*' Due to static land patterns also carbon stocks are static over time. - -*' @limitations Land and carbon stocks of natural vegetation are static over time. - -*####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/35_natveg/static/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/35_natveg/static/declarations.gms" -$Ifi "%phase%" == "preloop" $include "./modules/35_natveg/static/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/35_natveg/static/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/35_natveg/static/postsolve.gms" -*######################## R SECTION END (PHASES) ############################### diff --git a/modules/35_natveg/static/sets.gms b/modules/35_natveg/static/sets.gms deleted file mode 100644 index acb274792f..0000000000 --- a/modules/35_natveg/static/sets.gms +++ /dev/null @@ -1,7 +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/36_employment/exo_may22/declarations.gms b/modules/36_employment/exo_may22/declarations.gms new file mode 100644 index 0000000000..044705a828 --- /dev/null +++ b/modules/36_employment/exo_may22/declarations.gms @@ -0,0 +1,39 @@ +*** | (C) 2008-2023 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 + q36_employment(i) Regional employment in agricultural production (mio. people) + q36_employment_maccs(i) Additional regional employment for GHG mitigation in agriculture (mio. people) +; + +positive variables + v36_employment(i) Number of people employed in agricultural production (mio. people) + v36_employment_maccs(i) Number of people employed in GHG mitigation in agriculture (mio. people) +; + +parameters + 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) #################### +parameters + ov36_employment(t,i,type) Number of people employed in agricultural production (mio. people) + ov36_employment_maccs(t,i,type) Number of people employed in GHG mitigation in agriculture (mio. people) + oq36_employment(t,i,type) Regional employment in agricultural production (mio. people) + oq36_employment_maccs(t,i,type) Additional regional employment for GHG mitigation in agriculture (mio. people) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### + diff --git a/modules/36_employment/exo_may22/equations.gms b/modules/36_employment/exo_may22/equations.gms new file mode 100644 index 0000000000..b1f0ac5db4 --- /dev/null +++ b/modules/36_employment/exo_may22/equations.gms @@ -0,0 +1,28 @@ +*** | (C) 2008-2023 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 + +*' Employment is calculated as total labor costs divided by hourly labor costs and average +*' hours worked per employed person per year. Employment for crop and livestock production +*' and employment for mitigation of GHG emissions are calclated in separate equaations. +*' For the former, total labor costs include labor costs from crop production +*' (see [38_factor_costs]), livestock production (see [70_livestock]), and some labor costs +*' for crop and livestock production which are not covered by MAgPIE. For employment from +*' mitigation of GHG emissions labor costs come from the marginal abatement cost curves (MACCs) +*' (see [57_maccs]). + +* 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*pm_hourly_costs(ct,i2,"scenario"))); + +q36_employment_maccs(i2) .. v36_employment_maccs(i2) + =e= (vm_maccs_costs(i2,"labor")) * (1 / sum(ct,f36_weekly_hours(ct,i2)*s36_weeks_in_year*pm_hourly_costs(ct,i2,"scenario"))); diff --git a/modules/36_employment/exo_may22/input.gms b/modules/36_employment/exo_may22/input.gms new file mode 100644 index 0000000000..1aa948f8bc --- /dev/null +++ b/modules/36_employment/exo_may22/input.gms @@ -0,0 +1,72 @@ +*** | (C) 2008-2023 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 + +scalars +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) +$ondelim +$include "./modules/36_employment/exo_may22/input/f36_weekly_hours.csv" +$offdelim +; + +table f36_weekly_hours_iso(t_all,iso) Historical values of average weekly hours worked per person in agriculture on iso level (h per week) +$ondelim +$include "./modules/36_employment/exo_may22/input/f36_weekly_hours_iso.csv" +$offdelim +; + +table f36_hist_hourly_costs(t_all,iso) Historical values of hourly labor costs in agriculture (USD05MER per h) +$ondelim +$include "./modules/36_employment/exo_may22/input/f36_historic_hourly_labor_costs.csv" +$offdelim +; + +parameter f36_regr_hourly_costs(reg36) Parameters for regression of hourly labor costs with GDPpcMER +/ +$ondelim +$include "./modules/36_employment/exo_may22/input/f36_regression_hourly_labor_costs.csv" +$offdelim +/ +; + +table f36_historic_ag_empl(t_all,iso) Historical values of people employed in agruculture (mio. people) +$ondelim +$include "./modules/36_employment/exo_may22/input/f36_historic_ag_employment.csv" +$offdelim +; + +table f36_unspecified_subsidies(t_all,i) Factor cost share of unspecified subsidies not included in MAgPIE labor costs (mio. USD05MER) +$ondelim +$include "./modules/36_employment/exo_may22/input/f36_unspecified_subsidies.csv" +$offdelim +; + +table f36_nonmagpie_factor_costs(t_all,i) Factor cost share of VoP from ag commodities not mapped to MAgPIE (mio. USD05MER) +$ondelim +$include "./modules/36_employment/exo_may22/input/f36_nonmagpie_factor_costs.csv" +$offdelim +; + +parameter f36_regr_cap_share(reg36) Parameters for dynamic regression +/ +$ondelim +$include "./modules/36_employment/exo_may22/input/f36_regression_cap_share.csv" +$offdelim +/ +; + +table f36_hist_cap_share(t_all,i) Historical capital share +$ondelim +$include "./modules/36_employment/exo_may22/input/f36_historical_share.csv" +$offdelim +; + + diff --git a/modules/36_employment/exo_may22/input/files b/modules/36_employment/exo_may22/input/files new file mode 100644 index 0000000000..d7ddcb6ef8 --- /dev/null +++ b/modules/36_employment/exo_may22/input/files @@ -0,0 +1,10 @@ +* list of files that are required here +f36_weekly_hours.csv +f36_weekly_hours_iso.csv +f36_historic_hourly_labor_costs.csv +f36_regression_hourly_labor_costs.csv +f36_historic_ag_employment.csv +f36_unspecified_subsidies.csv +f36_nonmagpie_factor_costs.csv +f36_regression_cap_share.csv +f36_historical_share.csv diff --git a/modules/36_employment/exo_may22/postsolve.gms b/modules/36_employment/exo_may22/postsolve.gms new file mode 100644 index 0000000000..c577467cd0 --- /dev/null +++ b/modules/36_employment/exo_may22/postsolve.gms @@ -0,0 +1,28 @@ +*** | (C) 2008-2023 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) ##################### + ov36_employment(t,i,"marginal") = v36_employment.m(i); + ov36_employment_maccs(t,i,"marginal") = v36_employment_maccs.m(i); + oq36_employment(t,i,"marginal") = q36_employment.m(i); + oq36_employment_maccs(t,i,"marginal") = q36_employment_maccs.m(i); + ov36_employment(t,i,"level") = v36_employment.l(i); + ov36_employment_maccs(t,i,"level") = v36_employment_maccs.l(i); + oq36_employment(t,i,"level") = q36_employment.l(i); + oq36_employment_maccs(t,i,"level") = q36_employment_maccs.l(i); + ov36_employment(t,i,"upper") = v36_employment.up(i); + ov36_employment_maccs(t,i,"upper") = v36_employment_maccs.up(i); + oq36_employment(t,i,"upper") = q36_employment.up(i); + oq36_employment_maccs(t,i,"upper") = q36_employment_maccs.up(i); + ov36_employment(t,i,"lower") = v36_employment.lo(i); + ov36_employment_maccs(t,i,"lower") = v36_employment_maccs.lo(i); + oq36_employment(t,i,"lower") = q36_employment.lo(i); + oq36_employment_maccs(t,i,"lower") = q36_employment_maccs.lo(i); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### + diff --git a/modules/36_employment/exo_may22/preloop.gms b/modules/36_employment/exo_may22/preloop.gms new file mode 100644 index 0000000000..f2fba081bc --- /dev/null +++ b/modules/36_employment/exo_may22/preloop.gms @@ -0,0 +1,67 @@ +*** | (C) 2008-2023 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 + +* 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); + +*' @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]), mitigation costs +*' ([57_maccs]) 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 new file mode 100644 index 0000000000..310c2b8b49 --- /dev/null +++ b/modules/36_employment/exo_may22/presolve.gms @@ -0,0 +1,27 @@ +*** | (C) 2008-2023 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 + +* capital cost share to split non-magpie factor costs into labor and capital +p36_share_calibration(i) = f36_hist_cap_share("y2010",i)-(f36_regr_cap_share("slope")*log10(sum(i_to_iso(i,iso),im_gdp_pc_ppp_iso("y2010",iso)))+f36_regr_cap_share("intercept")); + +if (m_year(t)<2010, + p36_cost_share(t,i) = f36_hist_cap_share(t,i); +elseif (m_year(t)>=2010), + p36_cost_share(t,i) = f36_regr_cap_share("slope")*log10(sum(i_to_iso(i,iso),im_gdp_pc_ppp_iso(t,iso)))+f36_regr_cap_share("intercept")+p36_share_calibration(i); +); + +*' @code + +*' Non-MAgPIE labor costs consist of the labor cost share of subsidies and from livestock +*' 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)) * (1/pm_productivity_gain_from_wages(t,i)) * + (pm_hourly_costs(t,i,"scenario") / pm_hourly_costs(t,i,"baseline")); + +*' @stop diff --git a/modules/36_employment/exo_may22/realization.gms b/modules/36_employment/exo_may22/realization.gms new file mode 100644 index 0000000000..a2928b7558 --- /dev/null +++ b/modules/36_employment/exo_may22/realization.gms @@ -0,0 +1,36 @@ +*** | (C) 2008-2023 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 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], [57_maccs] and +*' [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], and +*' for mitigation in [57_maccs]. + +*' @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 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) ############################## +$Ifi "%phase%" == "sets" $include "./modules/36_employment/exo_may22/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/36_employment/exo_may22/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/36_employment/exo_may22/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/36_employment/exo_may22/equations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/36_employment/exo_may22/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/36_employment/exo_may22/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/36_employment/exo_may22/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/36_employment/exo_may22/sets.gms b/modules/36_employment/exo_may22/sets.gms new file mode 100644 index 0000000000..8e165f7fc9 --- /dev/null +++ b/modules/36_employment/exo_may22/sets.gms @@ -0,0 +1,13 @@ +*** | (C) 2008-2023 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 + 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 new file mode 100644 index 0000000000..c89453c476 --- /dev/null +++ b/modules/36_employment/module.gms @@ -0,0 +1,24 @@ +*** | (C) 2008-2023 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 + + +*' @title Employment + +*' @description This module is used to calculate hourly labor costs in agriculutre +*' and the number of people employed in crop and livestock production. +*' 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], [70_livestock], +*' and [57_maccs] to scale total labor costs accordingly. +*' The calculation of employment then uses labor costs for crop and livestock production +*' and mitigation coming from [38_factor_costs], [70_livestock], and [57_maccs]. + +*' @authors Debbora Leip + +*###################### R SECTION START (MODULETYPES) ########################## +$Ifi "%employment%" == "exo_may22" $include "./modules/36_employment/exo_may22/realization.gms" +*###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/14_yields/biocorrect/sets.gms b/modules/37_labor_prod/exo/declarations.gms similarity index 72% rename from modules/14_yields/biocorrect/sets.gms rename to modules/37_labor_prod/exo/declarations.gms index d2e2afbb08..4a0f559c26 100644 --- a/modules/14_yields/biocorrect/sets.gms +++ b/modules/37_labor_prod/exo/declarations.gms @@ -1,11 +1,10 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 - ltype14 calibration land types - / crop, past / +parameters + pm_labor_prod(t,j) labor productivity factor (1) ; diff --git a/modules/37_labor_prod/exo/input.gms b/modules/37_labor_prod/exo/input.gms new file mode 100644 index 0000000000..a48acce9da --- /dev/null +++ b/modules/37_labor_prod/exo/input.gms @@ -0,0 +1,26 @@ +*** | (C) 2008-2023 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 c37_labor_prod_scenario cc +* options: cc (climate change) +* nocc (no climate change) +* nocc_hist (no climate change after year defined by sm_fix_cc) + +$setglobal c37_labor_rcp rcp119 +$setglobal c37_labor_metric ISO +$setglobal c37_labor_intensity 400W +$setglobal c37_labor_uncertainty ensmean + +table f37_labor_prod(t_all,j,rcp37,metric37,intensity37,uncertainty37) labor productivity factor (1) +$ondelim +$include "./modules/37_labor_prod/exo/input/f37_labourprodimpact.cs3" +$offdelim +; +m_fillmissingyears(f37_labor_prod,"j,rcp37,metric37,intensity37,uncertainty37"); +* set values in different data sets between 1995 and the year set by sm_fix_cc to values from the default setting. +f37_labor_prod(t_all,j,rcp37,metric37,intensity37,uncertainty37)$(m_year(t_all) <= sm_fix_cc) = +f37_labor_prod(t_all,j,"rcp119","ISO","400W","ensmean")$(m_year(t_all) <= sm_fix_cc); diff --git a/modules/37_labor_prod/exo/input/files b/modules/37_labor_prod/exo/input/files new file mode 100644 index 0000000000..941fcdc747 --- /dev/null +++ b/modules/37_labor_prod/exo/input/files @@ -0,0 +1,2 @@ +* list of files that are required here +f37_labourprodimpact.cs3 diff --git a/modules/37_labor_prod/exo/preloop.gms b/modules/37_labor_prod/exo/preloop.gms new file mode 100644 index 0000000000..031926df7d --- /dev/null +++ b/modules/37_labor_prod/exo/preloop.gms @@ -0,0 +1,11 @@ +*** | (C) 2008-2023 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 + +pm_labor_prod(t,j) = f37_labor_prod(t,j,"%c37_labor_rcp%","%c37_labor_metric%","%c37_labor_intensity%","%c37_labor_uncertainty%"); +* set values to 1995 if nocc scenario is used, or to sm_fix_cc after sm_fix_cc if nocc_hist is used +$if "%c37_labor_prod_scenario%" == "nocc" pm_labor_prod(t,j) = pm_labor_prod("y1995",j); +$if "%c37_labor_prod_scenario%" == "nocc_hist" pm_labor_prod(t,j)$(m_year(t_all) > sm_fix_cc) = pm_labor_prod(t,j)$(m_year(t_all) = sm_fix_cc); diff --git a/modules/37_labor_prod/exo/realization.gms b/modules/37_labor_prod/exo/realization.gms new file mode 100644 index 0000000000..c330cfab62 --- /dev/null +++ b/modules/37_labor_prod/exo/realization.gms @@ -0,0 +1,37 @@ +*** | (C) 2008-2023 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 accounts for climate change impacts on +*' labor productivity, based on ESM experiments from the LAMACLIMA project +*' . +*' Heat‐induced impacts on labor productivity have been calculated using the +*' methodology described in @orlov_labor_2021. +*' Heat-induced impacts on labor productivity are available for two different metrics +*' (HOTHAPS and ISO) and work intensity levels (300W and 400W). +*' The Hothaps function describes the relationship between workability and the +*' wet bulb globe temperature (WBGT). +*' WBGT is a heat index that measures heat stress impacts of +*' temperature, humidity, wind speed, and solar radiation. +*' The ISO standards describe the frequency and duration of rest breaks at work +*' under different levels of heat stress. +*' Work intensity: 300W and 400W stand for the level of work intensity measured in +*' Watts (W), at which the impacts are estimated. The higher work intensity, +*' the stronger is the heat exposure. For instance, the impacts of heatstress +*' on labor productivity under 300W are less than under 400W. +*' In previous studies, the level of work intensity in agriculture is assumed to be 400W. +*' However, work intensity differs by region due to different levels of mechanization. +*' While 400W is plausible for manual work, mechanized work is less labor intensity. +*' +*' @limitations Climate change impacts on labor productivity are currently only +*' available for RCP1.9 and RCP8.5. + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/37_labor_prod/exo/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/37_labor_prod/exo/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/37_labor_prod/exo/input.gms" +$Ifi "%phase%" == "preloop" $include "./modules/37_labor_prod/exo/preloop.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/37_labor_prod/exo/sets.gms b/modules/37_labor_prod/exo/sets.gms new file mode 100644 index 0000000000..9e2b7a004b --- /dev/null +++ b/modules/37_labor_prod/exo/sets.gms @@ -0,0 +1,20 @@ +*** | (C) 2008-2023 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 + rcp37 climate change impact sceanrios + / rcp119, rcp585 / + + metric37 labor productivity impact metric + / ISO, HOTHAPS / + + intensity37 work intensity level + / 300W, 400W / + + uncertainty37 ESM uncertainty + / enslower,ensmean,ensupper / +; diff --git a/modules/37_labor_prod/module.gms b/modules/37_labor_prod/module.gms new file mode 100644 index 0000000000..2786ac1d91 --- /dev/null +++ b/modules/37_labor_prod/module.gms @@ -0,0 +1,20 @@ +*** | (C) 2008-2023 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 + + +*' @title Labor Productivity + +*' @description This module provides a labor productivity factor, +*' which reflects the efficiency of labor under changing environmental conditions (1 = no change). + +*' @authors Florian Humpenöder, Michael Windisch + + +*###################### R SECTION START (MODULETYPES) ########################## +$Ifi "%labor_prod%" == "exo" $include "./modules/37_labor_prod/exo/realization.gms" +$Ifi "%labor_prod%" == "off" $include "./modules/37_labor_prod/off/realization.gms" +*###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/14_yields/dynamic_aug18/sets.gms b/modules/37_labor_prod/off/declarations.gms similarity index 72% rename from modules/14_yields/dynamic_aug18/sets.gms rename to modules/37_labor_prod/off/declarations.gms index d2e2afbb08..4a0f559c26 100644 --- a/modules/14_yields/dynamic_aug18/sets.gms +++ b/modules/37_labor_prod/off/declarations.gms @@ -1,11 +1,10 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 - ltype14 calibration land types - / crop, past / +parameters + pm_labor_prod(t,j) labor productivity factor (1) ; diff --git a/modules/37_labor_prod/off/not_used.txt b/modules/37_labor_prod/off/not_used.txt new file mode 100644 index 0000000000..4e00cebf8c --- /dev/null +++ b/modules/37_labor_prod/off/not_used.txt @@ -0,0 +1,2 @@ +name,type,reason +sm_fix_cc,input,questionnaire diff --git a/modules/38_factor_costs/fixed_per_ton_mar18/preloop.gms b/modules/37_labor_prod/off/preloop.gms similarity index 79% rename from modules/38_factor_costs/fixed_per_ton_mar18/preloop.gms rename to modules/37_labor_prod/off/preloop.gms index d23d957206..b214fe4fc9 100644 --- a/modules/38_factor_costs/fixed_per_ton_mar18/preloop.gms +++ b/modules/37_labor_prod/off/preloop.gms @@ -1,8 +1,8 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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_inv.fx(i)=0; +pm_labor_prod(t,j) = 1; diff --git a/modules/50_nr_soil_budget/off/realization.gms b/modules/37_labor_prod/off/realization.gms similarity index 51% rename from modules/50_nr_soil_budget/off/realization.gms rename to modules/37_labor_prod/off/realization.gms index ff1842ecb0..0fc96fbd74 100644 --- a/modules/50_nr_soil_budget/off/realization.gms +++ b/modules/37_labor_prod/off/realization.gms @@ -1,14 +1,18 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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. +*' @description In this realization labor productivity is fixed to a value of 1, +*' which implies no change over time. +*' +*' @limitations The impacts of changing environmental conditions on labor productivity +*' are not accounted for. + *####################### 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" +$Ifi "%phase%" == "declarations" $include "./modules/37_labor_prod/off/declarations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/37_labor_prod/off/preloop.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/38_factor_costs/fixed_per_ton_mar18/declarations.gms b/modules/38_factor_costs/fixed_per_ton_mar18/declarations.gms deleted file mode 100644 index 50848948c6..0000000000 --- a/modules/38_factor_costs/fixed_per_ton_mar18/declarations.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 - -equations - q38_cost_prod_crop(i,kcr) Regional factor input costs for plant production (mio. USD05MER per yr) -; - -positive variables - vm_cost_prod(i,kall) Factor costs (mio. USD05MER per yr) - vm_cost_inv(i) Capital investment costs (mio USD05MER per yr) -; - -*#################### R SECTION START (OUTPUT DECLARATIONS) #################### -parameters - ov_cost_prod(t,i,kall,type) Factor costs (mio. USD05MER per yr) - ov_cost_inv(t,i,type) Capital investment costs (mio USD05MER per yr) - oq38_cost_prod_crop(t,i,kcr,type) Regional factor input costs for plant production (mio. USD05MER per yr) -; -*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/38_factor_costs/fixed_per_ton_mar18/equations.gms b/modules/38_factor_costs/fixed_per_ton_mar18/equations.gms deleted file mode 100644 index fde65a1344..0000000000 --- a/modules/38_factor_costs/fixed_per_ton_mar18/equations.gms +++ /dev/null @@ -1,25 +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,kcr) .. - vm_cost_prod(i2,kcr) =e= vm_prod_reg(i2,kcr) * f38_fac_req_per_ton(kcr); - - -*' The factor requirement costs `vm_cost_prod` are calculated as product of -*' production quantity `vm_prod_reg` and crop-specific world average -*' factor costs of production per volume `f38_fac_req_per_ton`. -*' The volume depending factor costs, which remains fixed overtime, are obtained -*' from value-added costs which correspond to the factor of production included -*' in this module from GTAP7 (@narayanan_gtap7_2008). -*' It 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] -*' module), and costs of agricultural intermediate inputs such as seeds -*' (to avoid double counting in the model). diff --git a/modules/38_factor_costs/fixed_per_ton_mar18/not_used.txt b/modules/38_factor_costs/fixed_per_ton_mar18/not_used.txt deleted file mode 100644 index e664a55e31..0000000000 --- a/modules/38_factor_costs/fixed_per_ton_mar18/not_used.txt +++ /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 - -name,type,reason -vm_tau,input,questionnaire -fm_tau1995,input,questionnaire -vm_area,input,questionnaire -pm_interest,input,questionnaire -vm_prod,input,questionnaire -pm_croparea_start,input,questionnaire -im_gdp_pc_mer,input,questionnaire -im_pop,input,questionnaire diff --git a/modules/38_factor_costs/fixed_per_ton_mar18/postsolve.gms b/modules/38_factor_costs/fixed_per_ton_mar18/postsolve.gms deleted file mode 100644 index 0d692908b2..0000000000 --- a/modules/38_factor_costs/fixed_per_ton_mar18/postsolve.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 - - - -*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_cost_prod(t,i,kall,"marginal") = vm_cost_prod.m(i,kall); - ov_cost_inv(t,i,"marginal") = vm_cost_inv.m(i); - oq38_cost_prod_crop(t,i,kcr,"marginal") = q38_cost_prod_crop.m(i,kcr); - ov_cost_prod(t,i,kall,"level") = vm_cost_prod.l(i,kall); - ov_cost_inv(t,i,"level") = vm_cost_inv.l(i); - oq38_cost_prod_crop(t,i,kcr,"level") = q38_cost_prod_crop.l(i,kcr); - ov_cost_prod(t,i,kall,"upper") = vm_cost_prod.up(i,kall); - ov_cost_inv(t,i,"upper") = vm_cost_inv.up(i); - oq38_cost_prod_crop(t,i,kcr,"upper") = q38_cost_prod_crop.up(i,kcr); - ov_cost_prod(t,i,kall,"lower") = vm_cost_prod.lo(i,kall); - ov_cost_inv(t,i,"lower") = vm_cost_inv.lo(i); - oq38_cost_prod_crop(t,i,kcr,"lower") = q38_cost_prod_crop.lo(i,kcr); -*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/38_factor_costs/input/files b/modules/38_factor_costs/input/files index 4524fe4de5..cc31093237 100644 --- a/modules/38_factor_costs/input/files +++ b/modules/38_factor_costs/input/files @@ -1,3 +1,5 @@ * list of files that are required here -f38_fac_req.csv -f38_fac_req_per_ton.csv +f38_historical_share.csv +f38_regression_cap_share.csv +f38_fac_req_fao.csv +f38_fac_req_fao_regional.cs4 \ No newline at end of file diff --git a/modules/38_factor_costs/mixed_feb17/declarations.gms b/modules/38_factor_costs/mixed_feb17/declarations.gms deleted file mode 100644 index 9a9c4db3fe..0000000000 --- a/modules/38_factor_costs/mixed_feb17/declarations.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 - -equations - q38_cost_prod_crop(i,kcr) Regional factor input costs for plant production (mio. USD05MER per yr) -; - -positive variables -vm_cost_prod(i,kall) Factor costs (mio. USD05MER per yr) -vm_cost_inv(i) Capital investment costs (mio USD05MER per yr) -; - -*#################### R SECTION START (OUTPUT DECLARATIONS) #################### -parameters - ov_cost_prod(t,i,kall,type) Factor costs (mio. USD05MER per yr) - ov_cost_inv(t,i,type) Capital investment costs (mio USD05MER per yr) - oq38_cost_prod_crop(t,i,kcr,type) Regional factor input costs for plant production (mio. USD05MER per yr) -; -*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/38_factor_costs/mixed_feb17/equations.gms b/modules/38_factor_costs/mixed_feb17/equations.gms deleted file mode 100644 index 62b52bf515..0000000000 --- a/modules/38_factor_costs/mixed_feb17/equations.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 - - - q38_cost_prod_crop(i2,kcr) .. - vm_cost_prod(i2,kcr) =e= sum((cell(i2,j2), w), vm_area(j2,kcr,w)*f38_region_yield(i2,kcr) - *vm_tau(i2)/fm_tau1995(i2)*f38_fac_req(kcr,w)); - - -*' The equation above shows that factor requirement costs `vm_cost_prod` 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 `f38_fac_req` returns the -*' total factor costs. -*' -*' 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_feb17/not_used.txt b/modules/38_factor_costs/mixed_feb17/not_used.txt deleted file mode 100644 index d13049c545..0000000000 --- a/modules/38_factor_costs/mixed_feb17/not_used.txt +++ /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 - -name,type,reason -vm_prod_reg,input,questionnaire -pm_interest,input,questionnaire -vm_prod,input,questionnaire -pm_croparea_start,input,questionnaire -im_gdp_pc_mer,input,questionnaire -im_pop,input,questionnaire diff --git a/modules/38_factor_costs/mixed_feb17/postsolve.gms b/modules/38_factor_costs/mixed_feb17/postsolve.gms deleted file mode 100644 index 2309b6da05..0000000000 --- a/modules/38_factor_costs/mixed_feb17/postsolve.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 - -*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_cost_prod(t,i,kall,"marginal") = vm_cost_prod.m(i,kall); - ov_cost_inv(t,i,"marginal") = vm_cost_inv.m(i); - oq38_cost_prod_crop(t,i,kcr,"marginal") = q38_cost_prod_crop.m(i,kcr); - ov_cost_prod(t,i,kall,"level") = vm_cost_prod.l(i,kall); - ov_cost_inv(t,i,"level") = vm_cost_inv.l(i); - oq38_cost_prod_crop(t,i,kcr,"level") = q38_cost_prod_crop.l(i,kcr); - ov_cost_prod(t,i,kall,"upper") = vm_cost_prod.up(i,kall); - ov_cost_inv(t,i,"upper") = vm_cost_inv.up(i); - oq38_cost_prod_crop(t,i,kcr,"upper") = q38_cost_prod_crop.up(i,kcr); - ov_cost_prod(t,i,kall,"lower") = vm_cost_prod.lo(i,kall); - ov_cost_inv(t,i,"lower") = vm_cost_inv.lo(i); - oq38_cost_prod_crop(t,i,kcr,"lower") = q38_cost_prod_crop.lo(i,kcr); -*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/38_factor_costs/mixed_feb17/realization.gms b/modules/38_factor_costs/mixed_feb17/realization.gms deleted file mode 100644 index 5f765f88de..0000000000 --- a/modules/38_factor_costs/mixed_feb17/realization.gms +++ /dev/null @@ -1,30 +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%" == "declarations" $include "./modules/38_factor_costs/mixed_feb17/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/38_factor_costs/mixed_feb17/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/38_factor_costs/mixed_feb17/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/38_factor_costs/mixed_feb17/scaling.gms" -$Ifi "%phase%" == "preloop" $include "./modules/38_factor_costs/mixed_feb17/preloop.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/38_factor_costs/mixed_feb17/postsolve.gms" -*######################## R SECTION END (PHASES) ############################### diff --git a/modules/38_factor_costs/module.gms b/modules/38_factor_costs/module.gms index cdfa7fbc7a..5cd8dde675 100644 --- a/modules/38_factor_costs/module.gms +++ b/modules/38_factor_costs/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -15,11 +15,11 @@ *' 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%" == "fixed_per_ton_mar18" $include "./modules/38_factor_costs/fixed_per_ton_mar18/realization.gms" -$Ifi "%factor_costs%" == "mixed_feb17" $include "./modules/38_factor_costs/mixed_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" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/38_factor_costs/per_ton_fao_may22/declarations.gms b/modules/38_factor_costs/per_ton_fao_may22/declarations.gms new file mode 100644 index 0000000000..2591939de5 --- /dev/null +++ b/modules/38_factor_costs/per_ton_fao_may22/declarations.gms @@ -0,0 +1,29 @@ +*** | (C) 2008-2023 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_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,factors) Regional factor costs of capital and labor for crop production (mio. USD05MER per yr) +; + +parameter +pm_cost_share_crops(t,i,factors) 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,factors,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 new file mode 100644 index 0000000000..b4f7976e08 --- /dev/null +++ b/modules/38_factor_costs/per_ton_fao_may22/equations.gms @@ -0,0 +1,34 @@ +*** | (C) 2008-2023 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_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,pm_cost_share_crops(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_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,pm_cost_share_crops(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 +*' (either global or regional averages) per volume of production `i38_fac_req`. +*' The volume depending factor requirements, which remain fixed overtime, are obtained +*' 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] +*' module), and costs of agricultural intermediate inputs such as seeds +*' (to avoid double counting in the model). diff --git a/modules/38_factor_costs/per_ton_fao_may22/input.gms b/modules/38_factor_costs/per_ton_fao_may22/input.gms new file mode 100644 index 0000000000..1543ddf463 --- /dev/null +++ b/modules/38_factor_costs/per_ton_fao_may22/input.gms @@ -0,0 +1,40 @@ +*** | (C) 2008-2023 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 c38_fac_req glo +* spatial disaggregation of factor requirements (options: glo, reg) + +parameter f38_fac_req(kcr) Factor requirement costs in 2005 (USD05MER per tDM) +/ +$ondelim +$include "./modules/38_factor_costs/input/f38_fac_req_fao.csv" +$offdelim +/ +; + +parameter f38_fac_req_fao_reg(t_all,i,kcr) Factor requirement costs (USD05MER per tDM) +/ +$ondelim +$include "./modules/38_factor_costs/input/f38_fac_req_fao_regional.cs4" +$offdelim +/ +; + + +parameter f38_reg_parameters(reg) Parameters for 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/per_ton_fao_may22/not_used.txt b/modules/38_factor_costs/per_ton_fao_may22/not_used.txt new file mode 100644 index 0000000000..dcab778dc9 --- /dev/null +++ b/modules/38_factor_costs/per_ton_fao_may22/not_used.txt @@ -0,0 +1,4 @@ +name,type,reason +pm_interest,input,questionnaire +vm_prod,input,questionnaire +pm_prod_init,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 new file mode 100644 index 0000000000..ae1e1f023d --- /dev/null +++ b/modules/38_factor_costs/per_ton_fao_may22/postsolve.gms @@ -0,0 +1,23 @@ +*** | (C) 2008-2023 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,factors,"marginal") = vm_cost_prod_crop.m(i,factors); + 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,factors,"level") = vm_cost_prod_crop.l(i,factors); + 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,factors,"upper") = vm_cost_prod_crop.up(i,factors); + 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,factors,"lower") = vm_cost_prod_crop.lo(i,factors); + 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/per_ton_fao_may22/presolve.gms b/modules/38_factor_costs/per_ton_fao_may22/presolve.gms new file mode 100644 index 0000000000..d81edbbed7 --- /dev/null +++ b/modules/38_factor_costs/per_ton_fao_may22/presolve.gms @@ -0,0 +1,33 @@ +*** | (C) 2008-2023 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 (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" +); + +* choosing between regional (+time dependent) or global (from 2005) factor requirements +$if "%c38_fac_req%" == "glo" i38_fac_req(t,i,kcr) = f38_fac_req(kcr); +$if "%c38_fac_req%" == "reg" i38_fac_req(t,i,kcr) = f38_fac_req_fao_reg(t,i,kcr); + +if (m_year(t)<=1995, + i38_fac_req(t,i,kcr) = i38_fac_req("y1995",i,kcr); +elseif m_year(t)>=2010, + i38_fac_req(t,i,kcr) = i38_fac_req("y2010",i,kcr); +else + i38_fac_req(t,i,kcr) = i38_fac_req(t,i,kcr); +); + +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, + pm_cost_share_crops(t,i,"capital") = f38_historical_share(t,i); + pm_cost_share_crops(t,i,"labor") = 1 - f38_historical_share(t,i); + +elseif (m_year(t)>=2010), + pm_cost_share_crops(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); + pm_cost_share_crops(t,i,"labor") = 1 - pm_cost_share_crops(t,i,"capital"); +); diff --git a/modules/38_factor_costs/fixed_per_ton_mar18/realization.gms b/modules/38_factor_costs/per_ton_fao_may22/realization.gms similarity index 71% rename from modules/38_factor_costs/fixed_per_ton_mar18/realization.gms rename to modules/38_factor_costs/per_ton_fao_may22/realization.gms index 0daa083942..49308b5391 100644 --- a/modules/38_factor_costs/fixed_per_ton_mar18/realization.gms +++ b/modules/38_factor_costs/per_ton_fao_may22/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -19,9 +19,11 @@ *####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "declarations" $include "./modules/38_factor_costs/fixed_per_ton_mar18/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/38_factor_costs/fixed_per_ton_mar18/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/38_factor_costs/fixed_per_ton_mar18/equations.gms" -$Ifi "%phase%" == "preloop" $include "./modules/38_factor_costs/fixed_per_ton_mar18/preloop.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/38_factor_costs/fixed_per_ton_mar18/postsolve.gms" +$Ifi "%phase%" == "sets" $include "./modules/38_factor_costs/per_ton_fao_may22/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/38_factor_costs/per_ton_fao_may22/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/38_factor_costs/per_ton_fao_may22/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/38_factor_costs/per_ton_fao_may22/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/38_factor_costs/per_ton_fao_may22/scaling.gms" +$Ifi "%phase%" == "presolve" $include "./modules/38_factor_costs/per_ton_fao_may22/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/38_factor_costs/per_ton_fao_may22/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/53_methane/ipcc2006_flexreg_apr16/preloop.gms b/modules/38_factor_costs/per_ton_fao_may22/scaling.gms similarity index 75% rename from modules/53_methane/ipcc2006_flexreg_apr16/preloop.gms rename to modules/38_factor_costs/per_ton_fao_may22/scaling.gms index 5e4788d1a9..816b1bc91c 100644 --- a/modules/53_methane/ipcc2006_flexreg_apr16/preloop.gms +++ b/modules/38_factor_costs/per_ton_fao_may22/scaling.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,4 +6,4 @@ *** | Contact: magpie@pik-potsdam.de - +vm_cost_prod_crop.scale(i,factors) = 10e5; diff --git a/modules/32_forestry/static_sep16/sets.gms b/modules/38_factor_costs/per_ton_fao_may22/sets.gms similarity index 62% rename from modules/32_forestry/static_sep16/sets.gms rename to modules/38_factor_costs/per_ton_fao_may22/sets.gms index 0972836361..731434e76e 100644 --- a/modules/32_forestry/static_sep16/sets.gms +++ b/modules/38_factor_costs/per_ton_fao_may22/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,10 +6,11 @@ *** | Contact: magpie@pik-potsdam.de sets - type32 plantation type - / aff, ndc, plant / - - aff_effect biochemical and local biophysical effect of afforestation on climate - / bgc, bph / -; +factors factors included in factor requirements +/ labor, capital / + + reg regression parameters for capital calculation + /slope, intercept/ + ; + *** EOF sets.gms *** diff --git a/modules/38_factor_costs/sticky_feb18/declarations.gms b/modules/38_factor_costs/sticky_feb18/declarations.gms index 1e864c9cc7..8abe30a913 100644 --- a/modules/38_factor_costs/sticky_feb18/declarations.gms +++ b/modules/38_factor_costs/sticky_feb18/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,37 +6,41 @@ *** | Contact: magpie@pik-potsdam.de equations - q38_cost_prod_crop(i,kcr) Regional factor input costs for plant production (mio USD05MER) - q38_cost_prod_inv(i) Regional investment costs in capital (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_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(i,kall) Factor costs (mio USD05MER per yr) - vm_cost_inv(i) Investment capital costs (mio USD05MER per yr) + vm_cost_prod_crop(i,factors) 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 - i38_variable_costs(i,kcr) Variable input costs (mio USD05MER per input unit) - i38_capital_need(i,kcr,mobil38) Capital requirements for farming with tau equal 1 (mio USD05MER) - 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_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) + pm_cost_share_crops(t,i,factors) 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_fac_req(t_all,i,kcr) Factor requirements (USD05MER per tDM) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_cost_prod(t,i,kall,type) Factor costs (mio USD05MER per yr) - ov_cost_inv(t,i,type) Investment capital costs (mio USD05MER per yr) + ov_cost_prod_crop(t,i,factors,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_crop(t,i,kcr,type) Regional factor input costs for plant production (mio USD05MER) - oq38_cost_prod_inv(t,i,type) Regional investment costs in capital (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_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) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/38_factor_costs/sticky_feb18/equations.gms b/modules/38_factor_costs/sticky_feb18/equations.gms index 72dab40100..984853c91b 100644 --- a/modules/38_factor_costs/sticky_feb18/equations.gms +++ b/modules/38_factor_costs/sticky_feb18/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,16 +7,18 @@ *' @equations -*' Variable costs (without capital): The factor costs are calculated based on the requirements of the regional aggregated production without -* considering capital costs. +*' 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_crop(i2,kcr).. vm_cost_prod(i2,kcr) - =e= vm_prod_reg(i2,kcr) * i38_variable_costs(i2,kcr) / (1-s38_mi_start) +q38_cost_prod_labor(i2).. vm_cost_prod_crop(i2,"labor") + =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, *' and corrected to make sure that the annual depreciation of the current time-step is accounted for. -q38_cost_prod_inv(i2).. vm_cost_inv(i2)=e=(sum((cell(i2,j2),kcr),v38_investment_immobile(j2,kcr)) +q38_cost_prod_capital(i2).. vm_cost_prod_crop(i2,"capital")=e=(sum((cell(i2,j2),kcr),v38_investment_immobile(j2,kcr)) +sum((cell(i2,j2)),v38_investment_mobile(j2))) *((1-s38_depreciation_rate)* sum(ct,pm_interest(ct,i2)/(1+pm_interest(ct,i2))) @@ -32,12 +34,14 @@ q38_cost_prod_inv(i2).. vm_cost_inv(i2)=e=(sum((cell(i2,j2),kcr),v38_investment_ q38_investment_immobile(j2,kcr).. v38_investment_immobile(j2,kcr) =g= - sum(cell(i2,j2),vm_prod(j2,kcr)*i38_capital_need(i2,kcr,"immobile")) - - sum(ct,p38_capital_immobile(ct,j2,kcr)); + vm_prod(j2,kcr)*sum(cell(i2,j2),sum(ct,p38_capital_need(ct,i2,kcr,"immobile")))- + sum(ct,p38_capital_immobile(ct,j2,kcr)); +* -*'On the other hand, the mobile capital is needed by all crop activities in each location, so it is defined over each j2 cell. +*' On the other hand, the mobile capital is needed by all crop activities in each location, so it is defined over each j2 cell. q38_investment_mobile(j2).. v38_investment_mobile(j2) =g= - sum((cell(i2,j2),kcr),vm_prod(j2,kcr)*i38_capital_need(i2,kcr,"mobile")) - -sum(ct,p38_capital_mobile(ct,j2)); + sum((cell(i2,j2),kcr),vm_prod(j2,kcr)*sum(ct,p38_capital_need(ct,i2,kcr,"mobile")))- + sum(ct,p38_capital_mobile(ct,j2)); +* diff --git a/modules/38_factor_costs/sticky_feb18/input.gms b/modules/38_factor_costs/sticky_feb18/input.gms index 6c8f9d705a..c41bf4c432 100644 --- a/modules/38_factor_costs/sticky_feb18/input.gms +++ b/modules/38_factor_costs/sticky_feb18/input.gms @@ -1,40 +1,46 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -scalars - +$setglobal c38_fac_req glo +* spatial disaggregation of factor requirements (options: glo, reg) -*' share of capital in the factor costs are based on the AgTFP Agricultural total factor productivity document by the USDA -*' http://www.ers.usda.gov/data-products/international-agricultural-productivity.aspx -s38_capital_cost_share capital cost share (share of costs) / 0.46 / -*' depreciation rate assuming roughly 20 years linear depreciation for invesment goods +scalars +* 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. -s38_immobile immobile capital in perennial crops (share) / 0.7 / -*' Initial management intensity -s38_mi_start global management intensity in 1995 /0.47/ -*' Maximum fraction of the total gdp invested in capital in agriculture -s38_fraction_gdp maximum percentage of the overall GDP /0.15/ +* Share of immobile capital. +s38_immobile immobile capital (share) / 1 / ; -parameter f38_fac_req_per_ton(kcr) Factor requirements (USD05 per ton DM) +parameter f38_fac_req(kcr) Factor requirement costs in 2005 (USD05MER per tDM) / $ondelim -$include "./modules/38_factor_costs/input/f38_fac_req_per_ton.csv" +$include "./modules/38_factor_costs/input/f38_fac_req_fao.csv" $offdelim / ; -table f38_region_yield(i,kcr) Regional crop yields (tDM per ha) +parameter f38_fac_req_fao_reg(t_all,i,kcr) Factor requirement costs (USD05MER per tDM) +/ $ondelim -$include "./modules/38_factor_costs/sticky_feb18/input/f38_region_yield.csv" -$offdelim; +$include "./modules/38_factor_costs/input/f38_fac_req_fao_regional.cs4" +$offdelim +/ +; -table f38_fac_req(kcr,w) Factor requirement costs (USD05MER per tDM) +parameter f38_reg_parameters(reg) Parameters for dynamic regression +/ $ondelim -$include "./modules/38_factor_costs/input/f38_fac_req.csv" -$offdelim; +$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/sticky_feb18/input/files b/modules/38_factor_costs/sticky_feb18/input/files index 5619b98eb9..f427961d4b 100644 --- a/modules/38_factor_costs/sticky_feb18/input/files +++ b/modules/38_factor_costs/sticky_feb18/input/files @@ -1,2 +1,5 @@ * list of files that are required here f38_region_yield.csv +f38_historical_share.csv +f38_regression_cap_share.csv +f38_fac_req_fao.csv diff --git a/modules/38_factor_costs/sticky_feb18/not_used.txt b/modules/38_factor_costs/sticky_feb18/not_used.txt deleted file mode 100644 index 64fbd6e715..0000000000 --- a/modules/38_factor_costs/sticky_feb18/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_tau,input,questionnaire -vm_area,input,questionnaire diff --git a/modules/38_factor_costs/sticky_feb18/postsolve.gms b/modules/38_factor_costs/sticky_feb18/postsolve.gms index f37578124f..ba04135135 100644 --- a/modules/38_factor_costs/sticky_feb18/postsolve.gms +++ b/modules/38_factor_costs/sticky_feb18/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,45 +6,37 @@ *** | Contact: magpie@pik-potsdam.de *' Capital update from the last investment -p38_capital_immobile(t+1,j,kcr)$(p38_capital_immobile(t,j,kcr) OR v38_investment_immobile.l(j,kcr)) = - (p38_capital_immobile(t,j,kcr) + v38_investment_immobile.l(j,kcr))* - (1-s38_depreciation_rate)**(m_year(t+1)-m_year(t)); +p38_capital_immobile(t+1,j,kcr) = p38_capital_immobile(t,j,kcr) + v38_investment_immobile.l(j,kcr); +p38_capital_mobile(t+1,j) = p38_capital_mobile(t,j) + v38_investment_mobile.l(j); -p38_capital_mobile(t+1,j)$(p38_capital_mobile(t,j) OR v38_investment_mobile.l(j)) = - (p38_capital_mobile(t,j) + v38_investment_mobile.l(j))* - (1-s38_depreciation_rate)**(m_year(t+1)-m_year(t)); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_cost_prod(t,i,kall,"marginal") = vm_cost_prod.m(i,kall); - ov_cost_inv(t,i,"marginal") = vm_cost_inv.m(i); + ov_cost_prod_crop(t,i,factors,"marginal") = vm_cost_prod_crop.m(i,factors); ov38_investment_immobile(t,j,kcr,"marginal") = v38_investment_immobile.m(j,kcr); ov38_investment_mobile(t,j,"marginal") = v38_investment_mobile.m(j); - oq38_cost_prod_crop(t,i,kcr,"marginal") = q38_cost_prod_crop.m(i,kcr); - oq38_cost_prod_inv(t,i,"marginal") = q38_cost_prod_inv.m(i); + 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); oq38_investment_immobile(t,j,kcr,"marginal") = q38_investment_immobile.m(j,kcr); oq38_investment_mobile(t,j,"marginal") = q38_investment_mobile.m(j); - ov_cost_prod(t,i,kall,"level") = vm_cost_prod.l(i,kall); - ov_cost_inv(t,i,"level") = vm_cost_inv.l(i); + ov_cost_prod_crop(t,i,factors,"level") = vm_cost_prod_crop.l(i,factors); ov38_investment_immobile(t,j,kcr,"level") = v38_investment_immobile.l(j,kcr); ov38_investment_mobile(t,j,"level") = v38_investment_mobile.l(j); - oq38_cost_prod_crop(t,i,kcr,"level") = q38_cost_prod_crop.l(i,kcr); - oq38_cost_prod_inv(t,i,"level") = q38_cost_prod_inv.l(i); + 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); oq38_investment_immobile(t,j,kcr,"level") = q38_investment_immobile.l(j,kcr); oq38_investment_mobile(t,j,"level") = q38_investment_mobile.l(j); - ov_cost_prod(t,i,kall,"upper") = vm_cost_prod.up(i,kall); - ov_cost_inv(t,i,"upper") = vm_cost_inv.up(i); + ov_cost_prod_crop(t,i,factors,"upper") = vm_cost_prod_crop.up(i,factors); ov38_investment_immobile(t,j,kcr,"upper") = v38_investment_immobile.up(j,kcr); ov38_investment_mobile(t,j,"upper") = v38_investment_mobile.up(j); - oq38_cost_prod_crop(t,i,kcr,"upper") = q38_cost_prod_crop.up(i,kcr); - oq38_cost_prod_inv(t,i,"upper") = q38_cost_prod_inv.up(i); + 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); oq38_investment_immobile(t,j,kcr,"upper") = q38_investment_immobile.up(j,kcr); oq38_investment_mobile(t,j,"upper") = q38_investment_mobile.up(j); - ov_cost_prod(t,i,kall,"lower") = vm_cost_prod.lo(i,kall); - ov_cost_inv(t,i,"lower") = vm_cost_inv.lo(i); + ov_cost_prod_crop(t,i,factors,"lower") = vm_cost_prod_crop.lo(i,factors); ov38_investment_immobile(t,j,kcr,"lower") = v38_investment_immobile.lo(j,kcr); ov38_investment_mobile(t,j,"lower") = v38_investment_mobile.lo(j); - oq38_cost_prod_crop(t,i,kcr,"lower") = q38_cost_prod_crop.lo(i,kcr); - oq38_cost_prod_inv(t,i,"lower") = q38_cost_prod_inv.lo(i); + 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); oq38_investment_immobile(t,j,kcr,"lower") = q38_investment_immobile.lo(j,kcr); oq38_investment_mobile(t,j,"lower") = q38_investment_mobile.lo(j); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/38_factor_costs/sticky_feb18/presolve.gms b/modules/38_factor_costs/sticky_feb18/presolve.gms index 15724a873f..1117c7b2f1 100644 --- a/modules/38_factor_costs/sticky_feb18/presolve.gms +++ b/modules/38_factor_costs/sticky_feb18/presolve.gms @@ -1,25 +1,52 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 (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" +); -*' calculation of capital needed per unit produced -i38_capital_need(i,kcr,"mobile") = f38_fac_req_per_ton(kcr) * s38_capital_cost_share / pm_interest(t,i) * (1-s38_immobile); -i38_capital_need(i,kcr,"immobile") = f38_fac_req_per_ton(kcr)*s38_capital_cost_share / pm_interest(t,i) * s38_immobile; +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, + pm_cost_share_crops(t,i,"capital") = f38_historical_share(t,i); + pm_cost_share_crops(t,i,"labor") = 1 - f38_historical_share(t,i); + +elseif (m_year(t)>=2010), + pm_cost_share_crops(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); + pm_cost_share_crops(t,i,"labor") = 1 - pm_cost_share_crops(t,i,"capital"); +); + +* choosing between regional (+time dependent) or global (from 2005) factor requirements +$if "%c38_fac_req%" == "glo" i38_fac_req(t,i,kcr) = f38_fac_req(kcr); +$if "%c38_fac_req%" == "reg" i38_fac_req(t,i,kcr) = f38_fac_req_fao_reg(t,i,kcr); + +if (m_year(t)<=1995, + i38_fac_req(t,i,kcr) = i38_fac_req("y1995",i,kcr); +elseif m_year(t)>=2010, + i38_fac_req(t,i,kcr) = i38_fac_req("y2010",i,kcr); +else + i38_fac_req(t,i,kcr) = i38_fac_req(t,i,kcr); +); + +p38_labor_need(t,i,kcr) = i38_fac_req(t,i,kcr) * pm_cost_share_crops(t,i,"labor"); +p38_capital_need(t,i,kcr,"mobile") = i38_fac_req(t,i,kcr) * pm_cost_share_crops(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) * pm_cost_share_crops(t,i,"capital") / (pm_interest(t,i)+s38_depreciation_rate) * s38_immobile; if (ord(t) = 1, -i38_variable_costs(i2,kcr) = f38_fac_req_per_ton(kcr) * (1-s38_capital_cost_share) * (1-s38_mi_start); +*' Estimate capital stock based on capital remuneration. We assume that in 1994 and 1995 production is the same and the stocks gets depreciated from 1994. + p38_capital_immobile(t,j,kcr) = sum(cell(i,j), p38_capital_need(t,i,kcr,"immobile")*pm_prod_init(j,kcr))*(1-s38_depreciation_rate); + p38_capital_mobile(t,j) = sum((cell(i,j),kcr), p38_capital_need(t,i,kcr,"mobile")*pm_prod_init(j,kcr))*(1-s38_depreciation_rate); + +else -*' Estimate capital stock based on capital remuneration -p38_capital_immobile(t,j,kcr) = sum(cell(i,j), i38_capital_need(i,kcr,"immobile")*pm_croparea_start(j,kcr)*f38_region_yield(i,kcr)* fm_tau1995(i)); -p38_capital_mobile(t,j) = sum((cell(i,j),kcr), i38_capital_need(i,kcr,"mobile")*pm_croparea_start(j,kcr)*f38_region_yield(i,kcr)* fm_tau1995(i)); +*' Update of existing stocks -vm_prod.l(j,kcr)=sum(cell(i,j),pm_croparea_start(j,kcr)*f38_region_yield(i,kcr)* fm_tau1995(i)); - ); + p38_capital_immobile(t,j,kcr)=p38_capital_immobile(t,j,kcr)*(1-s38_depreciation_rate)**(m_timestep_length); + p38_capital_mobile(t,j)=p38_capital_mobile(t,j)*(1-s38_depreciation_rate)**(m_timestep_length); -*' The maximum allocation of mobile and immobile capital is equal to the existing capital -vm_cost_inv.up(i)=im_gdp_pc_mer(t,i)*im_pop(t,i)*s38_fraction_gdp; +); diff --git a/modules/38_factor_costs/sticky_feb18/realization.gms b/modules/38_factor_costs/sticky_feb18/realization.gms index a6b58f61e9..8fea9e6875 100644 --- a/modules/38_factor_costs/sticky_feb18/realization.gms +++ b/modules/38_factor_costs/sticky_feb18/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -23,6 +23,7 @@ $Ifi "%phase%" == "sets" $include "./modules/38_factor_costs/sticky_feb18/sets.g $Ifi "%phase%" == "declarations" $include "./modules/38_factor_costs/sticky_feb18/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/38_factor_costs/sticky_feb18/input.gms" $Ifi "%phase%" == "equations" $include "./modules/38_factor_costs/sticky_feb18/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/38_factor_costs/sticky_feb18/scaling.gms" $Ifi "%phase%" == "presolve" $include "./modules/38_factor_costs/sticky_feb18/presolve.gms" $Ifi "%phase%" == "postsolve" $include "./modules/38_factor_costs/sticky_feb18/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/38_factor_costs/sticky_feb18/scaling.gms b/modules/38_factor_costs/sticky_feb18/scaling.gms new file mode 100644 index 0000000000..6fd3d67bca --- /dev/null +++ b/modules/38_factor_costs/sticky_feb18/scaling.gms @@ -0,0 +1,9 @@ +*** | (C) 2008-2023 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_prod_crop.scale(i,factors) = 10e5; +v38_investment_immobile.scale(j,kcr) = 10e3; diff --git a/modules/38_factor_costs/sticky_feb18/sets.gms b/modules/38_factor_costs/sticky_feb18/sets.gms index 422c88d35a..d274450fc2 100644 --- a/modules/38_factor_costs/sticky_feb18/sets.gms +++ b/modules/38_factor_costs/sticky_feb18/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -8,6 +8,12 @@ sets mobil38 types of capital / mobile, immobile / -; + + reg regression parameters for dynamic sticky + /slope, intercept/ + +factors factors included in factor requirements + / labor, capital / + ; *** EOF sets.gms *** diff --git a/modules/38_factor_costs/sticky_labor/declarations.gms b/modules/38_factor_costs/sticky_labor/declarations.gms new file mode 100644 index 0000000000..7b9dfe3f02 --- /dev/null +++ b/modules/38_factor_costs/sticky_labor/declarations.gms @@ -0,0 +1,65 @@ +*** | (C) 2008-2023 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_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_labor_share_target(j) Enforces minimum labor cost share out of factor costs (1) +; + +positive variables + vm_cost_prod_crop(i,factors) 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_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) + v38_relax_CES_lp(j,kcr) Variable to make CES function feasible in linearized model (1) +; + +parameters + 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) + + pm_cost_share_crops(t,i,factors) 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_min_labor_share(t,j) Minimum labor share out of labor plus capital needed (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) + + 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) +; + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov_cost_prod_crop(t,i,factors,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_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) + ov38_relax_CES_lp(t,j,kcr,type) Variable to make CES function feasible in linearized model (1) + 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) + oq38_labor_share_target(t,j,type) Enforces minimum labor cost share out of factor costs (1) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/38_factor_costs/sticky_labor/equations.gms b/modules/38_factor_costs/sticky_labor/equations.gms new file mode 100644 index 0000000000..174c0ab2cd --- /dev/null +++ b/modules/38_factor_costs/sticky_labor/equations.gms @@ -0,0 +1,72 @@ +*** | (C) 2008-2023 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 + +*' Constant elasticity of substitution (CES) production function for one unit of output. +*' 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) * 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 + v38_relax_CES_lp(j2,kcr); + +*' As low labor shares can lead to low agricultural employment, which is not necessarily a desired output, a +*' minimum share of labor need can be set. + +q38_labor_share_target(j2) .. + sum(kcr, vm_prod(j2,kcr) * v38_laborhours_need(j2,kcr) * sum((ct, cell(i2,j2)), pm_hourly_costs(ct,i2,"scenario"))) =g= + sum(ct, p38_min_labor_share(ct,j2)) * + (sum(kcr, vm_prod(j2,kcr) * v38_laborhours_need(j2,kcr) * + sum((ct, cell(i2,j2)), pm_hourly_costs(ct,i2,"scenario"))) + + sum((mobil38, kcr), vm_prod(j2,kcr) * v38_capital_need(j2,kcr,mobil38)) * + sum((ct, cell(i2,j2)), pm_interest(ct,i2) + s38_depreciation_rate)); + +*' 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_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, +*' and corrected to make sure that the annual depreciation of the current time-step is accounted for. + +q38_cost_prod_capital(i2).. vm_cost_prod_crop(i2,"capital")=e=(sum((cell(i2,j2),kcr),v38_investment_immobile(j2,kcr)) + +sum((cell(i2,j2)),v38_investment_mobile(j2))) + *((1-s38_depreciation_rate)* + sum(ct,pm_interest(ct,i2)/(1+pm_interest(ct,i2))) + + s38_depreciation_rate) + ; + + +*' Each cropping activity requires a certain capital stock that depends on the +*' production. The following equations make sure that new land expansion is equipped +*' with capital stock, and that depreciation of pre-existing capital is replaced. +*' Since the mobility of capital is defined over crop-type, immobile capital is set +*' over specific crop types and locations. + +q38_investment_immobile(j2,kcr).. v38_investment_immobile(j2,kcr) + =g= + vm_prod(j2,kcr) * v38_capital_need(j2,kcr,"immobile") - + sum(ct, p38_capital_immobile(ct,j2,kcr)); +* + +*' On the other hand, the mobile capital is needed by all crop activities in each location, so it is defined over each j2 cell. + +q38_investment_mobile(j2).. v38_investment_mobile(j2) + =g= + sum(kcr, vm_prod(j2,kcr) * v38_capital_need(j2,kcr,"mobile")) - + sum(ct, p38_capital_mobile(ct,j2)); +* diff --git a/modules/38_factor_costs/sticky_labor/input.gms b/modules/38_factor_costs/sticky_labor/input.gms new file mode 100644 index 0000000000..54fd04582a --- /dev/null +++ b/modules/38_factor_costs/sticky_labor/input.gms @@ -0,0 +1,51 @@ +*** | (C) 2008-2023 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 c38_fac_req glo +* spatial disaggregation of factor requirements (options: glo, reg) + +scalars +* 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. +s38_immobile immobile capital (share) / 1 / +s38_ces_elast_subst Elasticity of substitution in CES function (1) / 0.3 / +s38_startyear_labor_substitution Year until which labor and capital requirements are fixed to historic values (year) / 2020 / +s38_target_labor_share Target labor share out of labor plus capital needed (1) / 0 / +s38_targetyear_labor_share Year for which the target labor share should be set (year) / 2050 / +s38_target_fulfillment Share by which a region moves from its baseline labor share towards the target value (1) / 0.5 / +; + +parameter f38_fac_req(kcr) Factor requirement costs in 2005 (USD05MER per tDM) +/ +$ondelim +$include "./modules/38_factor_costs/input/f38_fac_req_fao.csv" +$offdelim +/ +; + +parameter f38_fac_req_fao_reg(t_all,i,kcr) Factor requirement costs (USD05MER per tDM) +/ +$ondelim +$include "./modules/38_factor_costs/input/f38_fac_req_fao_regional.cs4" +$offdelim +/ +; + +parameter f38_reg_parameters(reg) Parameters for dynamic 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/sticky_labor/input/files b/modules/38_factor_costs/sticky_labor/input/files new file mode 100644 index 0000000000..f427961d4b --- /dev/null +++ b/modules/38_factor_costs/sticky_labor/input/files @@ -0,0 +1,5 @@ +* list of files that are required here +f38_region_yield.csv +f38_historical_share.csv +f38_regression_cap_share.csv +f38_fac_req_fao.csv diff --git a/modules/38_factor_costs/sticky_labor/nl_fix.gms b/modules/38_factor_costs/sticky_labor/nl_fix.gms new file mode 100644 index 0000000000..9c44529b2d --- /dev/null +++ b/modules/38_factor_costs/sticky_labor/nl_fix.gms @@ -0,0 +1,16 @@ +*** | (C) 2008-2023 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 + +* ### nl_fix ### + +v38_laborhours_need.fx(j,kcr) = v38_laborhours_need.l(j,kcr); +v38_capital_need.fx(j,kcr,mobil38) = v38_capital_need.l(j,kcr,mobil38); + +* release v38_relax_CES_lp for linear version of MAgPIE +v38_relax_CES_lp.l(j,kcr) = 0; +v38_relax_CES_lp.lo(j,kcr) = -Inf; +v38_relax_CES_lp.up(j,kcr) = Inf; diff --git a/modules/38_factor_costs/sticky_labor/nl_relax.gms b/modules/38_factor_costs/sticky_labor/nl_relax.gms new file mode 100644 index 0000000000..3c8f3a206e --- /dev/null +++ b/modules/38_factor_costs/sticky_labor/nl_relax.gms @@ -0,0 +1,12 @@ +*** | (C) 2008-2023 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 + +* ### nl_relax ### + +v38_laborhours_need.l(j,kcr) = v38_laborhours_need.l(j,kcr) * 1.1; +v38_capital_need.l(j,kcr,"immobile") = sum(cell(i,j), (i38_ces_shr(j,kcr) / (i38_ces_scale(j,kcr)**s38_ces_elast_par - (1-i38_ces_shr(j,kcr))*(pm_labor_prod(t,j) * pm_productivity_gain_from_wages(t,i)*v38_laborhours_need.l(j,kcr)**(-s38_ces_elast_par))))**(1/s38_ces_elast_par)) * s38_immobile; +v38_capital_need.l(j,kcr,"mobile") = v38_capital_need.l(j,kcr,"immobile") * (1-s38_immobile) / s38_immobile; diff --git a/modules/38_factor_costs/sticky_labor/nl_release.gms b/modules/38_factor_costs/sticky_labor/nl_release.gms new file mode 100644 index 0000000000..b490defd35 --- /dev/null +++ b/modules/38_factor_costs/sticky_labor/nl_release.gms @@ -0,0 +1,16 @@ +*** | (C) 2008-2023 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 + +* ### nl_release ### + +v38_laborhours_need.lo(j,kcr) = 0.1 * v38_laborhours_need.l(j,kcr); +v38_laborhours_need.up(j,kcr) = 10 * v38_laborhours_need.l(j,kcr); +v38_capital_need.lo(j,kcr,mobil38) = 0.1 * v38_capital_need.l(j,kcr,mobil38); +v38_capital_need.up(j,kcr,mobil38) = 10 * v38_capital_need.l(j,kcr,mobil38); + +* fix v38_relax_CES_lp to zero for non-linear version of MAgPIE +v38_relax_CES_lp.fx(j,kcr) = 0; diff --git a/modules/38_factor_costs/sticky_labor/not_used.txt b/modules/38_factor_costs/sticky_labor/not_used.txt new file mode 100644 index 0000000000..f9b97b10a0 --- /dev/null +++ b/modules/38_factor_costs/sticky_labor/not_used.txt @@ -0,0 +1,2 @@ +name,type,reason +vm_prod_reg,input,not used diff --git a/modules/38_factor_costs/sticky_labor/postsolve.gms b/modules/38_factor_costs/sticky_labor/postsolve.gms new file mode 100644 index 0000000000..56af009e4a --- /dev/null +++ b/modules/38_factor_costs/sticky_labor/postsolve.gms @@ -0,0 +1,62 @@ +*** | (C) 2008-2023 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 + +*' Capital update from the last investment +p38_capital_immobile(t+1,j,kcr) = p38_capital_immobile(t,j,kcr) + v38_investment_immobile.l(j,kcr); +p38_capital_mobile(t+1,j) = p38_capital_mobile(t,j) + v38_investment_mobile.l(j); + + +*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### + ov_cost_prod_crop(t,i,factors,"marginal") = vm_cost_prod_crop.m(i,factors); + 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_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); + ov38_relax_CES_lp(t,j,kcr,"marginal") = v38_relax_CES_lp.m(j,kcr); + 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); + oq38_investment_immobile(t,j,kcr,"marginal") = q38_investment_immobile.m(j,kcr); + oq38_investment_mobile(t,j,"marginal") = q38_investment_mobile.m(j); + oq38_ces_prodfun(t,j,kcr,"marginal") = q38_ces_prodfun.m(j,kcr); + oq38_labor_share_target(t,j,"marginal") = q38_labor_share_target.m(j); + ov_cost_prod_crop(t,i,factors,"level") = vm_cost_prod_crop.l(i,factors); + 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_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); + ov38_relax_CES_lp(t,j,kcr,"level") = v38_relax_CES_lp.l(j,kcr); + 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); + oq38_investment_immobile(t,j,kcr,"level") = q38_investment_immobile.l(j,kcr); + oq38_investment_mobile(t,j,"level") = q38_investment_mobile.l(j); + oq38_ces_prodfun(t,j,kcr,"level") = q38_ces_prodfun.l(j,kcr); + oq38_labor_share_target(t,j,"level") = q38_labor_share_target.l(j); + ov_cost_prod_crop(t,i,factors,"upper") = vm_cost_prod_crop.up(i,factors); + 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_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); + ov38_relax_CES_lp(t,j,kcr,"upper") = v38_relax_CES_lp.up(j,kcr); + 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); + oq38_investment_immobile(t,j,kcr,"upper") = q38_investment_immobile.up(j,kcr); + oq38_investment_mobile(t,j,"upper") = q38_investment_mobile.up(j); + oq38_ces_prodfun(t,j,kcr,"upper") = q38_ces_prodfun.up(j,kcr); + oq38_labor_share_target(t,j,"upper") = q38_labor_share_target.up(j); + ov_cost_prod_crop(t,i,factors,"lower") = vm_cost_prod_crop.lo(i,factors); + 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_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); + ov38_relax_CES_lp(t,j,kcr,"lower") = v38_relax_CES_lp.lo(j,kcr); + 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); + oq38_investment_immobile(t,j,kcr,"lower") = q38_investment_immobile.lo(j,kcr); + oq38_investment_mobile(t,j,"lower") = q38_investment_mobile.lo(j); + oq38_ces_prodfun(t,j,kcr,"lower") = q38_ces_prodfun.lo(j,kcr); + oq38_labor_share_target(t,j,"lower") = q38_labor_share_target.lo(j); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/38_factor_costs/sticky_labor/preloop.gms b/modules/38_factor_costs/sticky_labor/preloop.gms new file mode 100644 index 0000000000..c141177b3b --- /dev/null +++ b/modules/38_factor_costs/sticky_labor/preloop.gms @@ -0,0 +1,19 @@ +*** | (C) 2008-2023 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 + +* 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; + +* calculate labor/capital cost shares from regression +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")); + +pm_cost_share_crops(t,i,"capital")$(m_year(t)<2010) = f38_historical_share(t,i); +pm_cost_share_crops(t,i,"capital")$(m_year(t)>=2010) = 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); + +pm_cost_share_crops(t,i,"labor") = 1 - pm_cost_share_crops(t,i,"capital"); diff --git a/modules/38_factor_costs/sticky_labor/presolve.gms b/modules/38_factor_costs/sticky_labor/presolve.gms new file mode 100644 index 0000000000..b866a32ef5 --- /dev/null +++ b/modules/38_factor_costs/sticky_labor/presolve.gms @@ -0,0 +1,97 @@ +*** | (C) 2008-2023 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 + +* choosing between regional (+time dependent) or global (from 2005) factor requirements +$if "%c38_fac_req%" == "glo" i38_fac_req(t,i,kcr) = f38_fac_req(kcr); +$if "%c38_fac_req%" == "reg" i38_fac_req(t,i,kcr) = f38_fac_req_fao_reg(t,i,kcr); + +if (m_year(t)<=1995, + i38_fac_req(t,i,kcr) = i38_fac_req("y1995",i,kcr); +elseif m_year(t)>=2010, + i38_fac_req(t,i,kcr) = i38_fac_req("y2010",i,kcr); +else + i38_fac_req(t,i,kcr) = i38_fac_req(t,i,kcr); +); + +p38_labor_need(t,i,kcr) = i38_fac_req(t,i,kcr) * pm_cost_share_crops(t,i,"labor"); +p38_capital_need(t,i,kcr,"mobile") = i38_fac_req(t,i,kcr) * pm_cost_share_crops(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) * pm_cost_share_crops(t,i,"capital") / (pm_interest(t,i)+s38_depreciation_rate) * s38_immobile; + +* minimum labor share based on target and adjustment factor +if (m_year(t) <= s38_startyear_labor_substitution, + p38_min_labor_share(t,j) = 0; +elseif m_year(t) <= s38_targetyear_labor_share, + p38_min_labor_share(t,j) = sum(cell(i,j), + max(pm_cost_share_crops(t,i,"labor"), pm_cost_share_crops(t,i,"labor") + + ((m_year(t)-s38_startyear_labor_substitution)/(s38_targetyear_labor_share-s38_startyear_labor_substitution) * + (s38_target_fulfillment * (s38_target_labor_share - sum(t2$(m_year(t2) = s38_targetyear_labor_share), + pm_cost_share_crops(t2,i,"labor"))))))); +else + p38_min_labor_share(t,j)$(sum(t2$(m_year(t2) = s38_targetyear_labor_share), + sum(cell(i,j), pm_cost_share_crops(t2,i,"labor"))) <= s38_target_labor_share) + = sum(t2$(m_year(t2) = s38_targetyear_labor_share), p38_min_labor_share(t2,j)); + p38_min_labor_share(t,j)$(sum(t2$(m_year(t2) = s38_targetyear_labor_share), + sum(cell(i,j), pm_cost_share_crops(t2,i,"labor"))) > s38_target_labor_share) + = max(sum(cell(i,j), pm_cost_share_crops(t,i,"labor")), s38_target_labor_share); +); + +* overwrite with 0 in case target labor share is 0 (i.e. off) +if (s38_target_labor_share = 0, + p38_min_labor_share(t,j) = 0; +); + + +*** Variable labor costs BEGIN + +* baseline laborhours need and capital need +v38_laborhours_need.l(j,kcr) = sum(cell(i,j), p38_labor_need(t,i,kcr) / pm_hourly_costs(t,i,"baseline")); +v38_capital_need.l(j,kcr,mobil38) = sum(cell(i,j), p38_capital_need(t,i,kcr,mobil38)); + +* update CES parameters (calibrating to baseline labor and capital needs) +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))); + +* in case of labor share target: initialize level by assuming that the regional target shares would be enforced in each cell +if ((m_year(t) > s38_startyear_labor_substitution) and (s38_target_labor_share <> 0), + v38_laborhours_need.l(j,kcr) = sum(cell(i,j), (1/i38_ces_scale(j,kcr)) * (i38_ces_shr(j,kcr) * (((1-p38_min_labor_share(t,j))*pm_hourly_costs(t,i,"scenario"))/(p38_min_labor_share(t,j)*(pm_interest(t,i)+s38_depreciation_rate)))**(-s38_ces_elast_par) + + (1-i38_ces_shr(j,kcr)) * (pm_labor_prod(t,j) * pm_productivity_gain_from_wages(t,i))**(-s38_ces_elast_par))**(1/s38_ces_elast_par)); +); +v38_laborhours_need.lo(j,kcr) = 0.1 * v38_laborhours_need.l(j,kcr); +v38_laborhours_need.up(j,kcr) = 10 * v38_laborhours_need.l(j,kcr); + +* fix capital need until startyear of labor substitution +if (m_year(t) <= s38_startyear_labor_substitution, + v38_capital_need.fx(j,kcr,mobil38) = sum(cell(i,j), p38_capital_need(t,i,kcr,mobil38)); +else +* in case of labor share target: initialize level by assuming that the regional target shares would be enforced in each cell + if (s38_target_labor_share <> 0, + v38_capital_need.l(j,kcr,"immobile") = sum(cell(i,j), ((1-p38_min_labor_share(t,j))*v38_laborhours_need.l(j,kcr)*pm_hourly_costs(t,i,"scenario")) / (p38_min_labor_share(t,j)*(pm_interest(t,i)+s38_depreciation_rate))) * s38_immobile; + v38_capital_need.l(j,kcr,"mobile") = v38_capital_need.l(j,kcr,"immobile") * (1-s38_immobile) / s38_immobile; + ); + v38_capital_need.lo(j,kcr,mobil38) = 0.1 * v38_capital_need.l(j,kcr,mobil38); + v38_capital_need.up(j,kcr,mobil38) = 10 * v38_capital_need.l(j,kcr,mobil38); +); + +*** Variable labor costs END + +if (ord(t) = 1, + +*' Estimate capital stock based on capital remuneration. We assume that in 1994 and 1995 production is the same and the stocks gets depreciated from 1994. + p38_capital_immobile(t,j,kcr) = sum(cell(i,j), p38_capital_need(t,i,kcr,"immobile")*pm_prod_init(j,kcr))*(1-s38_depreciation_rate); + p38_capital_mobile(t,j) = sum((cell(i,j),kcr), p38_capital_need(t,i,kcr,"mobile")*pm_prod_init(j,kcr))*(1-s38_depreciation_rate); + +else + +*' Update of existing stocks + + p38_capital_immobile(t,j,kcr)=p38_capital_immobile(t,j,kcr)*(1-s38_depreciation_rate)**(m_timestep_length); + p38_capital_mobile(t,j)=p38_capital_mobile(t,j)*(1-s38_depreciation_rate)**(m_timestep_length); + + ); + +* fix v38_relax_CES_lp to zero for non-linear version of MAgPIE +v38_relax_CES_lp.fx(j,kcr) = 0; diff --git a/modules/38_factor_costs/sticky_labor/realization.gms b/modules/38_factor_costs/sticky_labor/realization.gms new file mode 100644 index 0000000000..f4ce752505 --- /dev/null +++ b/modules/38_factor_costs/sticky_labor/realization.gms @@ -0,0 +1,37 @@ +*** | (C) 2008-2023 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 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], 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 +*' capital investment cost. Then, capital is further divided into immobile and mobile, where +*' mobility is defined between crops. In this way, changes in cropland are favored in locations +*' with existing capital stocks. + +*' @limitations This realization assumes that factor costs, within a region, +*' purely depend on the production and are independent of the area under cultivation. +*' By implication, cases in which the harvested area could significantly influence +*' factors costs are hardly accounted in this realization. + + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/38_factor_costs/sticky_labor/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/38_factor_costs/sticky_labor/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/38_factor_costs/sticky_labor/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/38_factor_costs/sticky_labor/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/38_factor_costs/sticky_labor/scaling.gms" +$Ifi "%phase%" == "preloop" $include "./modules/38_factor_costs/sticky_labor/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/38_factor_costs/sticky_labor/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/38_factor_costs/sticky_labor/postsolve.gms" +$Ifi "%phase%" == "nl_fix" $include "./modules/38_factor_costs/sticky_labor/nl_fix.gms" +$Ifi "%phase%" == "nl_release" $include "./modules/38_factor_costs/sticky_labor/nl_release.gms" +$Ifi "%phase%" == "nl_relax" $include "./modules/38_factor_costs/sticky_labor/nl_relax.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/38_factor_costs/sticky_labor/scaling.gms b/modules/38_factor_costs/sticky_labor/scaling.gms new file mode 100644 index 0000000000..b34a21e49c --- /dev/null +++ b/modules/38_factor_costs/sticky_labor/scaling.gms @@ -0,0 +1,8 @@ +*** | (C) 2008-2023 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_prod_crop.scale(i,factors) = 10e4; diff --git a/modules/39_landconversion/global_static_aug18/sets.gms b/modules/38_factor_costs/sticky_labor/sets.gms similarity index 55% rename from modules/39_landconversion/global_static_aug18/sets.gms rename to modules/38_factor_costs/sticky_labor/sets.gms index 7e6f803167..d274450fc2 100644 --- a/modules/39_landconversion/global_static_aug18/sets.gms +++ b/modules/38_factor_costs/sticky_labor/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,9 +6,14 @@ *** | Contact: magpie@pik-potsdam.de sets - land_establish39(land) Managed land pools - / crop, past, forestry / + mobil38 types of capital + / mobile, immobile / - land_clearing39(land) Natural vegetation land pools - / primforest, secdforest, other / -; + reg regression parameters for dynamic sticky + /slope, intercept/ + +factors factors included in factor requirements + / labor, capital / + ; + +*** EOF sets.gms *** diff --git a/modules/39_landconversion/global_static_aug18/declarations.gms b/modules/39_landconversion/calib/declarations.gms similarity index 53% rename from modules/39_landconversion/global_static_aug18/declarations.gms rename to modules/39_landconversion/calib/declarations.gms index 0c07718ad9..b5cefbca96 100644 --- a/modules/39_landconversion/global_static_aug18/declarations.gms +++ b/modules/39_landconversion/calib/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,21 +6,22 @@ *** | Contact: magpie@pik-potsdam.de equations - q39_cost_landcon(j,land) Calculation of cellular landconversion costs (mio. USD05MER per yr) + q39_cost_landcon(j,land) Calculation of cellular landconversion costs (mio. USD05MER per yr) ; variables - vm_cost_landcon(j,land) Land conversion costs (mio. USD05MER per yr) + vm_cost_landcon(j,land) Costs for land expansion and reduction (mio. USD05MER per yr) ; parameters - i39_cost_establish(land) Global land establishment costs (USD05MER per hectare) - i39_cost_clearing(land) Global land clearing costs (USD05MER per ton C) + i39_cost_establish(t,i,land) Land expansion costs (USD05MER per hectare) + i39_reward_reduction(t,i,land) Reward for land reduction (USD05MER per hectare) + i39_calib(t,i,type39) Calibration factor for costs of cropland expansion and rewards for cropland reduction (1) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_cost_landcon(t,j,land,type) Land conversion costs (mio. USD05MER per yr) + ov_cost_landcon(t,j,land,type) Costs for land expansion and reduction (mio. USD05MER per yr) oq39_cost_landcon(t,j,land,type) Calculation of cellular landconversion costs (mio. USD05MER per yr) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/39_landconversion/calib/equations.gms b/modules/39_landconversion/calib/equations.gms new file mode 100644 index 0000000000..a01b377871 --- /dev/null +++ b/modules/39_landconversion/calib/equations.gms @@ -0,0 +1,15 @@ +*** | (C) 2008-2023 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 sum of costs for land expansion and land reduction +*' is multiplied with an annuity factor to distribute these costs over time. + +q39_cost_landcon(j2,land) .. vm_cost_landcon(j2,land) =e= + (vm_landexpansion(j2,land)*sum((ct,cell(i2,j2)), i39_cost_establish(ct,i2,land)) + - vm_landreduction(j2,land)*sum((ct,cell(i2,j2)), i39_reward_reduction(ct,i2,land))) + * sum((cell(i2,j2),ct),pm_interest(ct,i2)/(1+pm_interest(ct,i2))); diff --git a/modules/39_landconversion/calib/input.gms b/modules/39_landconversion/calib/input.gms new file mode 100644 index 0000000000..44b84610a5 --- /dev/null +++ b/modules/39_landconversion/calib/input.gms @@ -0,0 +1,23 @@ +*** | (C) 2008-2023 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 + +scalars + s39_cost_establish_crop Cost for cropland expansion before calibration (USD05MER per hectare) / 10000 / + s39_reward_crop_reduction Reward for cropland reduction before calibration (USD05MER per hectare) / 6000 / + s39_cost_establish_past Cost for pasture land expansion (USD05MER per hectare) / 8000 / + s39_cost_establish_forestry Cost for foresty land expansion (USD05MER per hectare) / 1000 / + s39_cost_establish_urban Cost for urban land expansion (USD05MER per hectare) / 10000 / + s39_ignore_calib Switch for ignoring calibration factors (1) / 0 / +; + +$onEmpty +table f39_calib(t_all,i,type39) Calibration factor for costs of cropland expansion (1) +$ondelim +$if exist "./modules/39_landconversion/input/f39_calib.csv" $include "./modules/39_landconversion/input/f39_calib.csv" +$offdelim +; +$offEmpty diff --git a/modules/39_landconversion/global_static_aug18/postsolve.gms b/modules/39_landconversion/calib/postsolve.gms similarity index 94% rename from modules/39_landconversion/global_static_aug18/postsolve.gms rename to modules/39_landconversion/calib/postsolve.gms index 2e8efa7363..47206b80d8 100644 --- a/modules/39_landconversion/global_static_aug18/postsolve.gms +++ b/modules/39_landconversion/calib/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/39_landconversion/calib/preloop.gms b/modules/39_landconversion/calib/preloop.gms new file mode 100644 index 0000000000..0148cb2b35 --- /dev/null +++ b/modules/39_landconversion/calib/preloop.gms @@ -0,0 +1,16 @@ +*** | (C) 2008-2023 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 + +i39_cost_establish(t,i,land) = 0; +i39_reward_reduction(t,i,land) = 0; + +i39_calib(t,i,type39) = f39_calib(t,i,type39); +* set default values in case of missing input file or s39_ignore_calib = 1 +if(sum((t,i,type39),i39_calib(t,i,type39)) = 0 OR s39_ignore_calib = 1, + i39_calib(t,i,"cost") = 1; + i39_calib(t,i,"reward") = 0; +); diff --git a/modules/39_landconversion/calib/presolve.gms b/modules/39_landconversion/calib/presolve.gms new file mode 100644 index 0000000000..16548299ba --- /dev/null +++ b/modules/39_landconversion/calib/presolve.gms @@ -0,0 +1,16 @@ +*** | (C) 2008-2023 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 + +* Global cost for cropland expansion are scaled with a calibration factor (i39_calib). +* The calibration factor has been derived with the goal of matching regional cropland in 2015 with historic data. +* In addition, regions with a calibration factor > 1 and with a decline of cropland between 1995 and 2015 in historic data see a reward for cropland reduction. + +i39_cost_establish(t,i,"crop") = s39_cost_establish_crop * i39_calib(t,i,"cost"); +i39_reward_reduction(t,i,"crop") = s39_reward_crop_reduction * i39_calib(t,i,"reward"); +i39_cost_establish(t,i,"past") = s39_cost_establish_past; +i39_cost_establish(t,i,"forestry") = s39_cost_establish_forestry; +i39_cost_establish(t,i,"urban") = s39_cost_establish_urban; diff --git a/modules/39_landconversion/global_static_aug18/realization.gms b/modules/39_landconversion/calib/realization.gms similarity index 52% rename from modules/39_landconversion/global_static_aug18/realization.gms rename to modules/39_landconversion/calib/realization.gms index d5d6203ee2..0737ed88b5 100644 --- a/modules/39_landconversion/global_static_aug18/realization.gms +++ b/modules/39_landconversion/calib/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,21 +6,22 @@ *** | Contact: magpie@pik-potsdam.de *' @description -*' In the global_static_aug18 realization, per hectare land conversion costs are separated into -*' costs for expansion of cropland, pasture and forestry (establishment costs) and -*' costs for clearing of primary forest, secondary forest and other natural land (clearing costs). -*' We assume a global cost factor of 8000 USD/ha (static over time) for establishment of managed land. -*' For clearing of natural vegetation we assume a global static cost factor of 5 USD/tC (based on @kreidenweis_pasture_2018). +*' This realization accounts for land conversion costs of cropland, pasture, forestry and urban land. +*' Costs for expansion of pasture, forestry and urban land are global and static over time. +*' For cropland, a regional and time-dependent calibration factor is applied on +*' global costs for land expansion, complemented by a reward for cropland reduction in selected regions, +*' for a better match of regional cropland in 2015 with historic data. +*' The calibration factor for costs of cropland expansion is lifted to a minium of 1 in all regions by 2050. *' *' @limitations Data availability for land conversion costs is very limited. *####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/39_landconversion/global_static_aug18/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/39_landconversion/global_static_aug18/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/39_landconversion/global_static_aug18/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/39_landconversion/global_static_aug18/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/39_landconversion/global_static_aug18/scaling.gms" -$Ifi "%phase%" == "preloop" $include "./modules/39_landconversion/global_static_aug18/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/39_landconversion/global_static_aug18/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/39_landconversion/global_static_aug18/postsolve.gms" +$Ifi "%phase%" == "sets" $include "./modules/39_landconversion/calib/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/39_landconversion/calib/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/39_landconversion/calib/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/39_landconversion/calib/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/39_landconversion/calib/scaling.gms" +$Ifi "%phase%" == "preloop" $include "./modules/39_landconversion/calib/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/39_landconversion/calib/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/39_landconversion/calib/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/39_landconversion/global_static_aug18/scaling.gms b/modules/39_landconversion/calib/scaling.gms similarity index 85% rename from modules/39_landconversion/global_static_aug18/scaling.gms rename to modules/39_landconversion/calib/scaling.gms index 30fe8d8b3f..a254c35219 100644 --- a/modules/39_landconversion/global_static_aug18/scaling.gms +++ b/modules/39_landconversion/calib/scaling.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/57_maccs/off_jul16/sets.gms b/modules/39_landconversion/calib/sets.gms similarity index 75% rename from modules/57_maccs/off_jul16/sets.gms rename to modules/39_landconversion/calib/sets.gms index e06a29124a..248fe880e0 100644 --- a/modules/57_maccs/off_jul16/sets.gms +++ b/modules/39_landconversion/calib/sets.gms @@ -1,8 +1,11 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 + type39 Cost type + / cost, reward / +; diff --git a/modules/39_landconversion/global_static_aug18/equations.gms b/modules/39_landconversion/global_static_aug18/equations.gms deleted file mode 100644 index 8a4389bbf5..0000000000 --- a/modules/39_landconversion/global_static_aug18/equations.gms +++ /dev/null @@ -1,18 +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 -*' Land establishment costs apply on expansion of cropland, pasture and forestry. -*' Land clearing costs apply on reduction of carbon stock in primary forest, secondary forest -*' and other natural land. -*' The sum of land establishment and land clearing costs in the current time step -*' is multiplied with an annuity factor to distribute these costs over time. - -q39_cost_landcon(j2,land) .. vm_cost_landcon(j2,land) =e= - (vm_landexpansion(j2,land)*i39_cost_establish(land) - + vm_carbon_stock_change(j2,land,"vegc")*i39_cost_clearing(land)) - * sum((cell(i2,j2),ct),pm_interest(ct,i2)/(1+pm_interest(ct,i2))); diff --git a/modules/39_landconversion/global_static_aug18/input.gms b/modules/39_landconversion/global_static_aug18/input.gms deleted file mode 100644 index a0f64226e7..0000000000 --- a/modules/39_landconversion/global_static_aug18/input.gms +++ /dev/null @@ -1,11 +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 - -scalars -s39_cost_establish Cost for establishing new land use (USD05MER per hectare) /8000/ -s39_cost_clearing Clearing costs linked to removed biomass (USD05MER per ton C) /0/ -; diff --git a/modules/39_landconversion/global_static_aug18/presolve.gms b/modules/39_landconversion/global_static_aug18/presolve.gms deleted file mode 100644 index f57a11cfac..0000000000 --- a/modules/39_landconversion/global_static_aug18/presolve.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/51_nitrogen/input/files b/modules/39_landconversion/input/files similarity index 70% rename from modules/51_nitrogen/input/files rename to modules/39_landconversion/input/files index 6ec7623e0c..79b754f587 100644 --- a/modules/51_nitrogen/input/files +++ b/modules/39_landconversion/input/files @@ -1,2 +1,2 @@ * list of files that are required here -f51_ipcc_ef.csv +f39_calib.csv diff --git a/modules/39_landconversion/module.gms b/modules/39_landconversion/module.gms index dd7319f356..6b65df4e3c 100644 --- a/modules/39_landconversion/module.gms +++ b/modules/39_landconversion/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -18,5 +18,5 @@ *' @authors Florian Humpenöder, Jan Philipp Dietrich, Ulrich Kreidenweis *###################### R SECTION START (MODULETYPES) ########################## -$Ifi "%landconversion%" == "global_static_aug18" $include "./modules/39_landconversion/global_static_aug18/realization.gms" +$Ifi "%landconversion%" == "calib" $include "./modules/39_landconversion/calib/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/40_transport/gtap_nov12/declarations.gms b/modules/40_transport/gtap_nov12/declarations.gms index 7a02ed6ac9..20b597fb2e 100644 --- a/modules/40_transport/gtap_nov12/declarations.gms +++ b/modules/40_transport/gtap_nov12/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/40_transport/gtap_nov12/equations.gms b/modules/40_transport/gtap_nov12/equations.gms index aa1cea9167..89e9ef78d5 100644 --- a/modules/40_transport/gtap_nov12/equations.gms +++ b/modules/40_transport/gtap_nov12/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/40_transport/gtap_nov12/input.gms b/modules/40_transport/gtap_nov12/input.gms index 7966ada195..cc65a9766f 100644 --- a/modules/40_transport/gtap_nov12/input.gms +++ b/modules/40_transport/gtap_nov12/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/40_transport/gtap_nov12/postsolve.gms b/modules/40_transport/gtap_nov12/postsolve.gms index 6d17da2ecb..2d47c2b005 100644 --- a/modules/40_transport/gtap_nov12/postsolve.gms +++ b/modules/40_transport/gtap_nov12/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/40_transport/gtap_nov12/realization.gms b/modules/40_transport/gtap_nov12/realization.gms index 693828b303..2e40c801df 100644 --- a/modules/40_transport/gtap_nov12/realization.gms +++ b/modules/40_transport/gtap_nov12/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/40_transport/module.gms b/modules/40_transport/module.gms index 3e6d0c57e6..bb19feeea6 100644 --- a/modules/40_transport/module.gms +++ b/modules/40_transport/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/40_transport/off/declarations.gms b/modules/40_transport/off/declarations.gms index 953f0fe0cb..6e8c1bcfe7 100644 --- a/modules/40_transport/off/declarations.gms +++ b/modules/40_transport/off/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/40_transport/off/not_used.txt b/modules/40_transport/off/not_used.txt index fde9a91e1a..850fb5a2ef 100644 --- a/modules/40_transport/off/not_used.txt +++ b/modules/40_transport/off/not_used.txt @@ -1,9 +1,2 @@ -# | (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, input, not needed diff --git a/modules/40_transport/off/postsolve.gms b/modules/40_transport/off/postsolve.gms index edf6b6557d..64dd886560 100644 --- a/modules/40_transport/off/postsolve.gms +++ b/modules/40_transport/off/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/40_transport/off/presolve.gms b/modules/40_transport/off/presolve.gms index 5457325784..d3f0887f7f 100644 --- a/modules/40_transport/off/presolve.gms +++ b/modules/40_transport/off/presolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/40_transport/off/realization.gms b/modules/40_transport/off/realization.gms index 1e5cb5ff0d..2cfdc62d49 100644 --- a/modules/40_transport/off/realization.gms +++ b/modules/40_transport/off/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/41_area_equipped_for_irrigation/endo_apr13/declarations.gms b/modules/41_area_equipped_for_irrigation/endo_apr13/declarations.gms index 057ed75c6f..42d1d51c11 100644 --- a/modules/41_area_equipped_for_irrigation/endo_apr13/declarations.gms +++ b/modules/41_area_equipped_for_irrigation/endo_apr13/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -9,14 +9,14 @@ parameters p41_AEI_start(t,j) Area equipped for irrigation at the beginning of each time step (mio. ha) pc41_AEI_start(j) Area equipped for irrigation at the beginning of current time step (mio. ha) pc41_unitcost_AEI(i) Unit cost of AEI expansion (USD04MER per ha) -; + ; variables vm_cost_AEI(i) Annuitized irrigation expansion costs (mio. USD04MER per yr) ; positive variables - v41_AEI(j) Area equipped for irrigation in each grid cell (mio. ha) + vm_AEI(j) Area equipped for irrigation in each grid cell (mio. ha) ; equations @@ -27,7 +27,7 @@ equations *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters ov_cost_AEI(t,i,type) Annuitized irrigation expansion costs (mio. USD04MER per yr) - ov41_AEI(t,j,type) Area equipped for irrigation in each grid cell (mio. ha) + ov_AEI(t,j,type) Area equipped for irrigation in each grid cell (mio. ha) oq41_area_irrig(t,j,type) Irrigation area constraint (mio. ha) oq41_cost_AEI(t,i,type) Calculation of costs of irrigation area expansion (mio. USD04MER) ; diff --git a/modules/41_area_equipped_for_irrigation/endo_apr13/equations.gms b/modules/41_area_equipped_for_irrigation/endo_apr13/equations.gms index b6a3298f88..7dd61eae2c 100644 --- a/modules/41_area_equipped_for_irrigation/endo_apr13/equations.gms +++ b/modules/41_area_equipped_for_irrigation/endo_apr13/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -8,15 +8,19 @@ *' @equations q41_area_irrig(j2) .. - sum(kcr, vm_area(j2,kcr,"irrigated")) =l= v41_AEI(j2); + sum(kcr, vm_area(j2,kcr,"irrigated")) =l= vm_AEI(j2); *' Investment costs in the current time step for each region are calculated by multiplying the AEI expansion in each -*' cluster of the region by the regional unit cost per hectare. +*' cluster of the region by the regional unit cost per hectare and a depreciation rate. *' MAgPIE has a common planning horizon to which all one time investments are distributed using an annuity *' approach. q41_cost_AEI(i2).. - vm_cost_AEI(i2) =e= - sum(cell(i2,j2),(v41_AEI(j2)-pc41_AEI_start(j2))) - * pc41_unitcost_AEI(i2)*sum(ct,pm_interest(ct,i2)/(1+pm_interest(ct,i2))); + vm_cost_AEI(i2) =e= + sum(cell(i2,j2),(vm_AEI(j2)-pc41_AEI_start(j2))) + * pc41_unitcost_AEI(i2) + *((1-s41_AEI_depreciation)* + sum(ct,pm_interest(ct,i2)/(1+pm_interest(ct,i2))) + + s41_AEI_depreciation) + ; diff --git a/modules/41_area_equipped_for_irrigation/endo_apr13/input.gms b/modules/41_area_equipped_for_irrigation/endo_apr13/input.gms index c5e12354dd..24beccec4b 100644 --- a/modules/41_area_equipped_for_irrigation/endo_apr13/input.gms +++ b/modules/41_area_equipped_for_irrigation/endo_apr13/input.gms @@ -1,10 +1,17 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 c41_initial_irrigation_area LUH2v2 + +scalars +s41_AEI_depreciation Depreciation rate in capital value of irrigation infrastructure (USD05PPP per USD05PPP) / 0 / +; + + table f41_c_irrig(t_all,i) Irrigation investment costs (USD04MER per ha) $ondelim $include "./modules/41_area_equipped_for_irrigation/endo_apr13/input/f41_c_irrig.csv" @@ -12,10 +19,19 @@ $offdelim ; parameters -f41_irrig(j) Available area equipped for irrigation [AVL] (mio. ha) +f41_irrig(j) Available area equipped for irrigation according to Siebert [AVL] (mio. ha) / $ondelim $include "./modules/41_area_equipped_for_irrigation/input/avl_irrig.cs2" $offdelim / ; + +parameters +f41_irrig_luh(t_ini41,j) Available area equipped for irrigation according to LUH [AVL] (mio. ha) +/ +$ondelim +$include "./modules/41_area_equipped_for_irrigation/input/avl_irrig_luh_t.cs2" +$offdelim +/ +; diff --git a/modules/41_area_equipped_for_irrigation/endo_apr13/postsolve.gms b/modules/41_area_equipped_for_irrigation/endo_apr13/postsolve.gms index 40c3a767d7..7bf8c056d4 100644 --- a/modules/41_area_equipped_for_irrigation/endo_apr13/postsolve.gms +++ b/modules/41_area_equipped_for_irrigation/endo_apr13/postsolve.gms @@ -1,28 +1,30 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -pc41_AEI_start(j)=v41_AEI.l(j); + + +pc41_AEI_start(j)=vm_AEI.l(j) ; *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov_cost_AEI(t,i,"marginal") = vm_cost_AEI.m(i); - ov41_AEI(t,j,"marginal") = v41_AEI.m(j); + ov_AEI(t,j,"marginal") = vm_AEI.m(j); oq41_area_irrig(t,j,"marginal") = q41_area_irrig.m(j); oq41_cost_AEI(t,i,"marginal") = q41_cost_AEI.m(i); ov_cost_AEI(t,i,"level") = vm_cost_AEI.l(i); - ov41_AEI(t,j,"level") = v41_AEI.l(j); + ov_AEI(t,j,"level") = vm_AEI.l(j); oq41_area_irrig(t,j,"level") = q41_area_irrig.l(j); oq41_cost_AEI(t,i,"level") = q41_cost_AEI.l(i); ov_cost_AEI(t,i,"upper") = vm_cost_AEI.up(i); - ov41_AEI(t,j,"upper") = v41_AEI.up(j); + ov_AEI(t,j,"upper") = vm_AEI.up(j); oq41_area_irrig(t,j,"upper") = q41_area_irrig.up(j); oq41_cost_AEI(t,i,"upper") = q41_cost_AEI.up(i); ov_cost_AEI(t,i,"lower") = vm_cost_AEI.lo(i); - ov41_AEI(t,j,"lower") = v41_AEI.lo(j); + ov_AEI(t,j,"lower") = vm_AEI.lo(j); oq41_area_irrig(t,j,"lower") = q41_area_irrig.lo(j); oq41_cost_AEI(t,i,"lower") = q41_cost_AEI.lo(i); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/41_area_equipped_for_irrigation/endo_apr13/preloop.gms b/modules/41_area_equipped_for_irrigation/endo_apr13/preloop.gms index c4346c6540..5ffaf199fa 100644 --- a/modules/41_area_equipped_for_irrigation/endo_apr13/preloop.gms +++ b/modules/41_area_equipped_for_irrigation/endo_apr13/preloop.gms @@ -1,8 +1,10 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -pc41_AEI_start(j)=f41_irrig(j); +$ifthen "%c41_initial_irrigation_area%" == "Siebert" pc41_AEI_start(j) = f41_irrig(j); +$elseif "%c41_initial_irrigation_area%" == "LUH2v2" pc41_AEI_start(j) = f41_irrig_luh("y1995",j); +$endif diff --git a/modules/41_area_equipped_for_irrigation/endo_apr13/presolve.gms b/modules/41_area_equipped_for_irrigation/endo_apr13/presolve.gms index 35c2475f73..c2f630a0da 100644 --- a/modules/41_area_equipped_for_irrigation/endo_apr13/presolve.gms +++ b/modules/41_area_equipped_for_irrigation/endo_apr13/presolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,6 +6,9 @@ *** | Contact: magpie@pik-potsdam.de p41_AEI_start(t,j) = pc41_AEI_start(j); -v41_AEI.lo(j) = pc41_AEI_start(j); + +*' Updating existing capital stocks to account for depreciation +vm_AEI.lo(j) = pc41_AEI_start(j)/((1- s41_AEI_depreciation)**(m_timestep_length)); + pc41_unitcost_AEI(i) = f41_c_irrig(t,i); diff --git a/modules/41_area_equipped_for_irrigation/endo_apr13/realization.gms b/modules/41_area_equipped_for_irrigation/endo_apr13/realization.gms index 9ad2ea7ab8..407a80fb45 100644 --- a/modules/41_area_equipped_for_irrigation/endo_apr13/realization.gms +++ b/modules/41_area_equipped_for_irrigation/endo_apr13/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -27,6 +27,7 @@ *####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/41_area_equipped_for_irrigation/endo_apr13/sets.gms" $Ifi "%phase%" == "declarations" $include "./modules/41_area_equipped_for_irrigation/endo_apr13/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/41_area_equipped_for_irrigation/endo_apr13/input.gms" $Ifi "%phase%" == "equations" $include "./modules/41_area_equipped_for_irrigation/endo_apr13/equations.gms" diff --git a/modules/41_area_equipped_for_irrigation/endo_apr13/scaling.gms b/modules/41_area_equipped_for_irrigation/endo_apr13/scaling.gms index 0a663a5047..f5cc0886de 100644 --- a/modules/41_area_equipped_for_irrigation/endo_apr13/scaling.gms +++ b/modules/41_area_equipped_for_irrigation/endo_apr13/scaling.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/41_area_equipped_for_irrigation/endo_apr13/sets.gms b/modules/41_area_equipped_for_irrigation/endo_apr13/sets.gms new file mode 100644 index 0000000000..92dee76fbe --- /dev/null +++ b/modules/41_area_equipped_for_irrigation/endo_apr13/sets.gms @@ -0,0 +1,11 @@ +*** | (C) 2008-2023 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 + t_ini41 Time periods with area equipped for irrigation initialization data + / y1995, y2000, y2005, y2010, y2015 / +; diff --git a/modules/41_area_equipped_for_irrigation/input/files b/modules/41_area_equipped_for_irrigation/input/files index 91b604379e..17d076cde1 100644 --- a/modules/41_area_equipped_for_irrigation/input/files +++ b/modules/41_area_equipped_for_irrigation/input/files @@ -1,2 +1,3 @@ * list of files that are required here avl_irrig.cs2 +avl_irrig_luh_t.cs2 diff --git a/modules/41_area_equipped_for_irrigation/module.gms b/modules/41_area_equipped_for_irrigation/module.gms index 1b81e46cf2..4502d6d89d 100644 --- a/modules/41_area_equipped_for_irrigation/module.gms +++ b/modules/41_area_equipped_for_irrigation/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/41_area_equipped_for_irrigation/static/declarations.gms b/modules/41_area_equipped_for_irrigation/static/declarations.gms index c757988cae..dd88de4a3d 100644 --- a/modules/41_area_equipped_for_irrigation/static/declarations.gms +++ b/modules/41_area_equipped_for_irrigation/static/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -10,7 +10,7 @@ variables ; positive variables - v41_AEI(j) Area equipped for irrigation in each grid cell (mio. ha) + vm_AEI(j) Area equipped for irrigation in each grid cell (mio. ha) ; equations @@ -20,7 +20,7 @@ equations *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters ov_cost_AEI(t,i,type) Irrigation expansion costs (mio. USD04MER) - ov41_AEI(t,j,type) Area equipped for irrigation in each grid cell (mio. ha) + ov_AEI(t,j,type) Area equipped for irrigation in each grid cell (mio. ha) oq41_area_irrig(t,j,type) Irrigation area constraint (mio. ha) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/41_area_equipped_for_irrigation/static/equations.gms b/modules/41_area_equipped_for_irrigation/static/equations.gms index d3a083279d..3bc9aed860 100644 --- a/modules/41_area_equipped_for_irrigation/static/equations.gms +++ b/modules/41_area_equipped_for_irrigation/static/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,11 +6,11 @@ *** | Contact: magpie@pik-potsdam.de *' @equations - - q41_area_irrig(j2) .. - sum(kcr, vm_area(j2,kcr,"irrigated")) =l= v41_AEI(j2); + + q41_area_irrig(j2) .. + sum(kcr, vm_area(j2,kcr,"irrigated")) =l= vm_AEI(j2); *' This realization assures that irrigated crop production can only take place where *' irrigation infrastructure is present, i.e. the sum of irrigated cropland `vm_area(j,kcr,"irrigated")` *' over all crops in each grid cell has to be less than or equal to the area in this grid cell that is -*' equipped with irrigation infrastructure (`v41_AEI(j)`). +*' equipped with irrigation infrastructure (`vm_AEI(j)`). diff --git a/modules/41_area_equipped_for_irrigation/static/input.gms b/modules/41_area_equipped_for_irrigation/static/input.gms index 6feb680182..d5519ef955 100644 --- a/modules/41_area_equipped_for_irrigation/static/input.gms +++ b/modules/41_area_equipped_for_irrigation/static/input.gms @@ -1,15 +1,26 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 c41_initial_irrigation_area LUH2v2 + parameters -f41_irrig(j) Available area equipped for irrigation [AVL] (mio. ha) +f41_irrig(j) Available area equipped for irrigation according to Siebert [AVL] (mio. ha) / $ondelim $include "./modules/41_area_equipped_for_irrigation/input/avl_irrig.cs2" $offdelim / ; + +parameters +f41_irrig_luh(t_ini41,j) Available area equipped for irrigation according to LUH [AVL] (mio. ha) +/ +$ondelim +$include "./modules/41_area_equipped_for_irrigation/input/avl_irrig_luh_t.cs2" +$offdelim +/ +; diff --git a/modules/41_area_equipped_for_irrigation/static/not_used.txt b/modules/41_area_equipped_for_irrigation/static/not_used.txt index 7fb72245a5..2411592d7e 100644 --- a/modules/41_area_equipped_for_irrigation/static/not_used.txt +++ b/modules/41_area_equipped_for_irrigation/static/not_used.txt @@ -1,8 +1,2 @@ -# | (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 pm_interest, input, not needed diff --git a/modules/41_area_equipped_for_irrigation/static/postsolve.gms b/modules/41_area_equipped_for_irrigation/static/postsolve.gms index ef60703961..58f0f97ed1 100644 --- a/modules/41_area_equipped_for_irrigation/static/postsolve.gms +++ b/modules/41_area_equipped_for_irrigation/static/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -8,16 +8,15 @@ *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov_cost_AEI(t,i,"marginal") = vm_cost_AEI.m(i); - ov41_AEI(t,j,"marginal") = v41_AEI.m(j); + ov_AEI(t,j,"marginal") = vm_AEI.m(j); oq41_area_irrig(t,j,"marginal") = q41_area_irrig.m(j); ov_cost_AEI(t,i,"level") = vm_cost_AEI.l(i); - ov41_AEI(t,j,"level") = v41_AEI.l(j); + ov_AEI(t,j,"level") = vm_AEI.l(j); oq41_area_irrig(t,j,"level") = q41_area_irrig.l(j); ov_cost_AEI(t,i,"upper") = vm_cost_AEI.up(i); - ov41_AEI(t,j,"upper") = v41_AEI.up(j); + ov_AEI(t,j,"upper") = vm_AEI.up(j); oq41_area_irrig(t,j,"upper") = q41_area_irrig.up(j); ov_cost_AEI(t,i,"lower") = vm_cost_AEI.lo(i); - ov41_AEI(t,j,"lower") = v41_AEI.lo(j); + ov_AEI(t,j,"lower") = vm_AEI.lo(j); oq41_area_irrig(t,j,"lower") = q41_area_irrig.lo(j); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### - diff --git a/modules/41_area_equipped_for_irrigation/static/presolve.gms b/modules/41_area_equipped_for_irrigation/static/presolve.gms index c318f07d3d..708110003e 100644 --- a/modules/41_area_equipped_for_irrigation/static/presolve.gms +++ b/modules/41_area_equipped_for_irrigation/static/presolve.gms @@ -1,9 +1,12 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -v41_AEI.fx(j) = f41_irrig(j); +$ifthen "%c41_initial_irrigation_area%" == "Siebert" vm_AEI.fx(j) = f41_irrig(j); +$elseif "%c41_initial_irrigation_area%" == "LUH2v2" vm_AEI.fx(j) = f41_irrig_luh("y1995",j); +$endif + vm_cost_AEI.fx(i) = 0; diff --git a/modules/41_area_equipped_for_irrigation/static/realization.gms b/modules/41_area_equipped_for_irrigation/static/realization.gms index 5eece958fd..be0da557fa 100644 --- a/modules/41_area_equipped_for_irrigation/static/realization.gms +++ b/modules/41_area_equipped_for_irrigation/static/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -13,6 +13,7 @@ *' *####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/41_area_equipped_for_irrigation/static/sets.gms" $Ifi "%phase%" == "declarations" $include "./modules/41_area_equipped_for_irrigation/static/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/41_area_equipped_for_irrigation/static/input.gms" $Ifi "%phase%" == "equations" $include "./modules/41_area_equipped_for_irrigation/static/equations.gms" diff --git a/modules/41_area_equipped_for_irrigation/static/sets.gms b/modules/41_area_equipped_for_irrigation/static/sets.gms new file mode 100644 index 0000000000..92dee76fbe --- /dev/null +++ b/modules/41_area_equipped_for_irrigation/static/sets.gms @@ -0,0 +1,11 @@ +*** | (C) 2008-2023 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 + t_ini41 Time periods with area equipped for irrigation initialization data + / y1995, y2000, y2005, y2010, y2015 / +; diff --git a/modules/42_water_demand/agr_sector_aug13/declarations.gms b/modules/42_water_demand/agr_sector_aug13/declarations.gms index 00796c7b2c..a9d08acfe9 100644 --- a/modules/42_water_demand/agr_sector_aug13/declarations.gms +++ b/modules/42_water_demand/agr_sector_aug13/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,30 +6,36 @@ *** | Contact: magpie@pik-potsdam.de parameters - i42_wat_req_k(t,j,k) LPJmL annual water demand for irrigation per ha per year (m^3) + Livestock demand per ton (m^3) - ic42_wat_req_k(j,k) LPJmL annual water demand for irrigation per ha per year (m^3) + Livestock demand per ton (m^3) + i42_wat_req_k(t,j,k) LPJmL annual water demand for irrigation per ha per year (m^3) + Livestock demand per ton (m^3) + ic42_wat_req_k(j,k) LPJmL annual water demand for irrigation per ha per year (m^3) + Livestock demand per ton (m^3) i42_env_flows(t,j) Environmental flow requirements if a protection policy is in place (mio. m^3) - i42_env_flows_base(t,j) Environmental flow requirements if no protection policy is in place (mio. m^3) + i42_env_flows_base(t,j) Environmental flow requirements if no protection policy is in place (mio. m^3) ic42_env_flow_policy(i) Determines whether environmental flow protection is enforced in the current time step (1) i42_env_flow_policy(t,i) Determines whether environmental flow protection is enforced (1) -* country-specific scenario switch + p42_efp(t_all,scen42) Determines whether environmental flow protection is enforced and its fading in of environmental flow policy (1) + p42_efp_fader(t_all) Determines the fading in of environmental flow policy (1) p42_country_dummy(iso) Dummy parameter indicating whether country is affected by EFP (1) p42_EFP_region_shr(t_all,i) Weighted share of region with regards to EFP (1) + ic42_pumping_cost(i) Parameter to capture values for pumping costs in a particular time step (USD05MER per m^3) ; equations - q42_water_demand(wat_dem,j) Water consumption in different sectors (mio. m^3 per yr) + q42_water_demand(wat_dem,j) Water withdrawals of different sectors (mio. m^3 per yr) + q42_water_cost(i) Total cost of pumping irrigation water (USD05MER per yr) ; positive variables vm_watdem(wat_dem,j) Water demand from different sectors (mio. m^3 per yr) v42_irrig_eff(j) Irrigation efficiency (1) + vm_water_cost(i) Cost of irrigation water (USD05MER per m^3) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### 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) - oq42_water_demand(t,wat_dem,j,type) Water consumption in different sectors (mio. 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 (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 3e0799ecc0..7c6712d588 100644 --- a/modules/42_water_demand/agr_sector_aug13/equations.gms +++ b/modules/42_water_demand/agr_sector_aug13/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,13 +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") * + 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); *' `vm_watdem` is composed by irrigation and livestock demand uses. *' The factor `v42_irrig_eff` corresponds to the amount of water that is used -*' inefficiently in the irrigation process. - +*' inefficiently in the irrigation process. diff --git a/modules/42_water_demand/agr_sector_aug13/input.gms b/modules/42_water_demand/agr_sector_aug13/input.gms index 4e01b4a920..444ad6d1fe 100644 --- a/modules/42_water_demand/agr_sector_aug13/input.gms +++ b/modules/42_water_demand/agr_sector_aug13/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,18 +6,17 @@ *** | Contact: magpie@pik-potsdam.de scalars +s42_reserved_fraction Fraction of available water that is reserved for manufacturing electricity and domestic use (1) / 0.5 / -s42_reserved_fraction Fraction of available water that is reserved for industry electricity and domestic use (1) / 0.5 / - -s42_irrig_eff_scenario Scenario for irrigation efficiency (1) / 2 / +s42_irrig_eff_scenario Scenario for irrigation efficiency (1) / 2 / * 1: global static value * 2: regional static values from CS * 3: gdp driven increase -s42_irrigation_efficiency Value of irrigation efficiency (1) / 0.66 / +s42_irrigation_efficiency Value of irrigation efficiency (1) / 0.66 / * Only if global static value is requested -s42_env_flow_scenario EFP scenario. (1) / 2 / +s42_env_flow_scenario EFP scenario. (1) / 2 / * 0: don't consider environmental flows. * s42_env_flow_base_fraction and * s42_env_flow_fraction have no effect. @@ -29,45 +28,21 @@ s42_env_flow_scenario EFP scenario. (1) / 2 / * results and a calculation algorithm by Smakhtin 2004. * s42_env_flow_fraction has no effect. +* Linear fading in of environmental flow policy between startyear and targetyear +s42_efp_startyear Environmental flow policy start year / 2020 / +s42_efp_targetyear Environmental flow policy target year / 2040 / + s42_env_flow_base_fraction Fraction of available water that is reserved for the environment where no EFP policy is implemented (1) / 0.05 / -* (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 multiplier to change pumping costs for sensitivity analysis takes numeric values (1) / 0 / ; -$setglobal c42_watdem_scenario nocc -* options: cc (climate change) -* nocc (no climate change) - -* Set-switch for countries affected by EFP -* Default: all iso countries selected -sets - EFP_countries(iso) countries to be affected by EFP / 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 / -; - +$setglobal c42_watdem_scenario cc +* options: cc (climate change) +* nocc (no climate change) +* nocc_hist (no climate change after year defined by sm_fix_cc) table f42_wat_req_kve(t_all,j,kve) LPJmL annual water demand for irrigation per ha (m^3 per yr) $ondelim @@ -75,6 +50,8 @@ $include "./modules/42_water_demand/input/lpj_airrig.cs2" $offdelim ; $if "%c42_watdem_scenario%" == "nocc" f42_wat_req_kve(t_all,j,kve) = f42_wat_req_kve("y1995",j,kve); +$if "%c42_watdem_scenario%" == "nocc_hist" f42_wat_req_kve(t_all,j,kve)$(m_year(t_all) > sm_fix_cc) = f42_wat_req_kve(t_all,j,kve)$(m_year(t_all) = sm_fix_cc); + m_fillmissingyears(f42_wat_req_kve,"j,kve"); @@ -86,6 +63,9 @@ $offdelim /; +* Environmental flow policy +$setglobal c42_env_flow_policy off + parameter f42_env_flows(t_all,j) Environmental flow requirements from LPJ and Smakhtin algorithm (mio. m^3) / $ondelim @@ -93,12 +73,46 @@ $include "./modules/42_water_demand/input/lpj_envflow_grper.cs2" $offdelim /; $if "%c42_watdem_scenario%" == "nocc" f42_env_flows(t_all,j) = f42_env_flows("y1995",j); +$if "%c42_watdem_scenario%" == "nocc_hist" f42_env_flows(t_all,j)$(m_year(t_all) > sm_fix_cc) = f42_env_flows(t_all,j)$(m_year(t_all) = sm_fix_cc); m_fillmissingyears(f42_env_flows,"j"); -$setglobal c42_env_flow_policy off +* Set-switch for countries affected by EFP +* Default: all iso countries selected +sets + EFP_countries(iso) countries to be affected by EFP / 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 / +; + -table f42_env_flow_policy(t_all,scen42) EFP policies (1) +* Costs of pumping are calculated for India as per methodology in forthcoming paper by Singh et.al. +parameter +f42_pumping_cost(t_all,i) Cost of pumping irrigation water (USD05MER per m^3) +/ $ondelim -$include "./modules/42_water_demand/input/f42_env_flow_policy.cs3" +$include "./modules/42_water_demand/input/f42_pumping_cost.cs4" $offdelim +/ ; diff --git a/modules/42_water_demand/agr_sector_aug13/postsolve.gms b/modules/42_water_demand/agr_sector_aug13/postsolve.gms index f1cedc5fc0..42c6bfda3c 100644 --- a/modules/42_water_demand/agr_sector_aug13/postsolve.gms +++ b/modules/42_water_demand/agr_sector_aug13/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -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/agr_sector_aug13/preloop.gms b/modules/42_water_demand/agr_sector_aug13/preloop.gms index 76cfc57ae7..351a33dac8 100644 --- a/modules/42_water_demand/agr_sector_aug13/preloop.gms +++ b/modules/42_water_demand/agr_sector_aug13/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -9,3 +9,9 @@ i42_wat_req_k(t,j,kve) = f42_wat_req_kve(t,j,kve); i42_env_flows(t,j) = f42_env_flows(t,j); i42_wat_req_k(t,j,kli) = f42_wat_req_kli(kli); + +* Trajectory for environmental flow policy +* (linear interpolation from start year to target year) +p42_efp(t_all,"off") = 0; +m_linear_interpol(p42_efp_fader, s42_efp_startyear, s42_efp_targetyear, 0, 1); +p42_efp(t_all, "on") = p42_efp_fader(t_all); diff --git a/modules/42_water_demand/agr_sector_aug13/presolve.gms b/modules/42_water_demand/agr_sector_aug13/presolve.gms index 6665d8fa83..274c5ac083 100644 --- a/modules/42_water_demand/agr_sector_aug13/presolve.gms +++ b/modules/42_water_demand/agr_sector_aug13/presolve.gms @@ -1,10 +1,44 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 +* Agricultural water demand +ic42_wat_req_k(j,k) = i42_wat_req_k(t,j,k); + +* Irrigation efficiency +if (m_year(t) <= sm_fix_SSP2, + v42_irrig_eff.fx(j) = 1 / (1+2.718282**((-22160-sum(cell(i,j), im_gdp_pc_mer("y1995",i))) / 37767)); +else + if ((s42_irrig_eff_scenario = 1), + v42_irrig_eff.fx(j) = s42_irrigation_efficiency; + Elseif (s42_irrig_eff_scenario = 2), + v42_irrig_eff.fx(j) = 1 / (1+2.718282**((-22160-sum(cell(i,j), im_gdp_pc_mer("y1995",i))) / 37767)); + Elseif (s42_irrig_eff_scenario=3), + v42_irrig_eff.fx(j) = 1 / (1+2.718282**((-22160-sum(cell(i,j), im_gdp_pc_mer(t,i))) / 37767)); + ); +); + +* Pumping cost in the current time step +ic42_pumping_cost(i) = 0; + +* Pumping cost settings will be only executed when s42_pumping is set to 1 +if ((s42_pumping = 1), + ic42_pumping_cost(i) = f42_pumping_cost(t,i); +* Pumping cost sensitivity test implmentation + if (m_year(t) > s42_multiplier_startyear, + ic42_pumping_cost(i) = f42_pumping_cost(t,i) * s42_multiplier; + ); +); + +* Water withdrawals in other sectors (manufacturing, electricity, domestic, ecosystem) +* (assign s42_reserved_fraction to manufacturing for simplicity) +vm_watdem.fx("manufacturing",j) = sum(wat_src, im_wat_avail(t,wat_src,j)) * s42_reserved_fraction; +vm_watdem.fx("electricity",j) = 0; +vm_watdem.fx("domestic",j) = 0; + * Country switch to determine countries for which EFP holds. * In the default case, the EFP affects all countries when activated. p42_country_dummy(iso) = 0; @@ -16,48 +50,24 @@ p42_EFP_region_shr(t_all,i) = sum(i_to_iso(i,iso), p42_country_dummy(iso) * im_p * Environmental policy switch: $ifthen "%c42_env_flow_policy%" == "mixed" - i42_env_flow_policy(t,i) = (im_development_state(t,i) * f42_env_flow_policy(t,"on")) * p42_EFP_region_shr(t,i) - + f42_env_flow_policy(t,"off") * (1-p42_EFP_region_shr(t,i)); + i42_env_flow_policy(t,i) = (im_development_state(t,i) * p42_efp(t,"on")) * p42_EFP_region_shr(t,i) + + p42_efp(t,"off") * (1-p42_EFP_region_shr(t,i)); $else - i42_env_flow_policy(t,i) = f42_env_flow_policy(t,"%c42_env_flow_policy%") * p42_EFP_region_shr(t,i) - + f42_env_flow_policy(t,"off") * (1-p42_EFP_region_shr(t,i)); + i42_env_flow_policy(t,i) = p42_efp(t,"%c42_env_flow_policy%") * p42_EFP_region_shr(t,i) + + p42_efp(t,"off") * (1-p42_EFP_region_shr(t,i)); $endif - - -* Agricultural water demand -ic42_wat_req_k(j,k) = i42_wat_req_k(t,j,k); ic42_env_flow_policy(i) = i42_env_flow_policy(t,i); -* water consumption in industry, sanitation, ecosystem -* (assign s42_reserved_fraction to industry for simplicity) -vm_watdem.fx("industry",j) = sum(wat_src, im_wat_avail(t,wat_src,j)) * s42_reserved_fraction; -vm_watdem.fx("electricity",j) = 0; -vm_watdem.fx("domestic",j) = 0; - -*Environmental flow scenarios depending on the switch s42_env_flow_scenario +* Environmental flow scenarios depending on the switch s42_env_flow_scenario i42_env_flows_base(t,j) = s42_env_flow_base_fraction * sum(wat_src, im_wat_avail(t,wat_src,j)); -if((s42_env_flow_scenario=0), +if ((s42_env_flow_scenario = 0), i42_env_flows_base(t,j) = 0; i42_env_flows(t,j) = 0; -Elseif(s42_env_flow_scenario=1), +Elseif (s42_env_flow_scenario = 1), i42_env_flows(t,j) = s42_env_flow_fraction * sum(wat_src, im_wat_avail(t,wat_src,j)); ); -vm_watdem.fx("ecosystem",j) = sum(cell(i,j), i42_env_flows_base(t,j) * (1-ic42_env_flow_policy(i)) + - i42_env_flows(t,j) * ic42_env_flow_policy(i)); - - -* irrigation efficiency -if(m_year(t) <= sm_fix_SSP2, - v42_irrig_eff.fx(j) = 1/(1+2.718282**((-22160-sum(cell(i,j),im_gdp_pc_mer("y1995",i)))/37767)); -else - if((s42_irrig_eff_scenario = 1), - v42_irrig_eff.fx(j) = s42_irrigation_efficiency; - Elseif (s42_irrig_eff_scenario=2), - v42_irrig_eff.fx(j) = 1/(1+2.718282**((-22160-sum(cell(i,j),im_gdp_pc_mer("y1995",i)))/37767)); - Elseif (s42_irrig_eff_scenario=3), - v42_irrig_eff.fx(j) = 1/(1+2.718282**((-22160-sum(cell(i,j),im_gdp_pc_mer(t,i)))/37767)); - ); -); +vm_watdem.fx("ecosystem",j) = sum(cell(i,j), i42_env_flows_base(t,j) * (1 - ic42_env_flow_policy(i)) + + i42_env_flows(t,j) * ic42_env_flow_policy(i)); diff --git a/modules/42_water_demand/agr_sector_aug13/realization.gms b/modules/42_water_demand/agr_sector_aug13/realization.gms index dd2c64ac51..1d5738592d 100644 --- a/modules/42_water_demand/agr_sector_aug13/realization.gms +++ b/modules/42_water_demand/agr_sector_aug13/realization.gms @@ -1,11 +1,11 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 +*' @description *' *' This realization models agricultural sector water demand endogenously, while other sectors are kept exogenous; *' Various settings for environmental water demand described below. @@ -68,6 +68,8 @@ *' *' Whether a potential EFP policy takes effect is determined by the parameter *' `f42_env_flow_policy`. +*' The speed of transitioning to full environmental flow protection is determined +*' by specifying the start (`s42_efp_startyear`) and target (`s42_efp_targetyear`) year. *' *' @limitations The module uses the "conveyance efficiency times management *' factor" for irrigation efficiency. Therefore, the management factor is diff --git a/modules/42_water_demand/agr_sector_aug13/scaling.gms b/modules/42_water_demand/agr_sector_aug13/scaling.gms index f37c4e19aa..f5c65a720f 100644 --- a/modules/42_water_demand/agr_sector_aug13/scaling.gms +++ b/modules/42_water_demand/agr_sector_aug13/scaling.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/42_water_demand/agr_sector_aug13/sets.gms b/modules/42_water_demand/agr_sector_aug13/sets.gms index 8a5fd5556f..355e3b6d96 100644 --- a/modules/42_water_demand/agr_sector_aug13/sets.gms +++ b/modules/42_water_demand/agr_sector_aug13/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,13 +6,13 @@ *** | Contact: magpie@pik-potsdam.de sets - watdem_exo(wat_dem) Exogenous water demands - / industry, electricity, domestic, ecosystem / + watdem_exo(wat_dem) Exogenous water demands + / manufacturing, electricity, domestic, ecosystem / scen42 Environmental Flow Policy (EFP) / off, on / scen42_to_dev(scen42,dev) Mapping between EFP and economic development status / off . (lic, mic) - on . (hic) / + on . (hic) / ; diff --git a/modules/42_water_demand/all_sectors_aug13/declarations.gms b/modules/42_water_demand/all_sectors_aug13/declarations.gms index 1a9d234afc..b216341e7a 100644 --- a/modules/42_water_demand/all_sectors_aug13/declarations.gms +++ b/modules/42_water_demand/all_sectors_aug13/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,30 +6,36 @@ *** | Contact: magpie@pik-potsdam.de parameters - i42_wat_req_k(t,j,k) LPJmL annual water demand for irrigation per ha per yr and livestock demand per ton per yr (m^3) + i42_wat_req_k(t_all,j,k) LPJmL annual water demand for irrigation per ha per yr and livestock demand per ton per yr (m^3) ic42_wat_req_k(j,k) LPJmL annual water demand for irrigation per ha per yr and livestock demand per ton per yr (m^3) i42_env_flows(t,j) Environmental flow requirements in case of policy (mio m^3) i42_env_flows_base(t,j) Environmental flow requirements in case of no policy (mio m^3) ic42_env_flow_policy(i) Determines whether environmental flow protection is enforced in the current time step (1) i42_env_flow_policy(t,i) Determines whether environmental flow protection is enforced (1) -* country-specific scenario switch + p42_efp(t_all,scen42) Determines whether environmental flow protection is enforced and its fading in of environmental flow policy (1) + p42_efp_fader(t_all) Determines the fading in of environmental flow policy (1) p42_country_dummy(iso) Dummy parameter indicating whether country is affected by EFP (1) p42_EFP_region_shr(t_all,i) Weighted share of region with regards to EFP (1) + ic42_pumping_cost(i) Parameter to capture values for pumping costs in a particular time step (USD05MER per m^3) ; equations - q42_water_demand(wat_dem,j) Water consumption in different sectors (mio. m^3 per yr) + q42_water_demand(wat_dem,j) Water withdrawals of different sectors (mio. m^3 per yr) + q42_water_cost(i) Total cost of pumping irrigation water (USD05MER per yr) ; positive variables vm_watdem(wat_dem,j) Amount of water needed in different sectors (mio. m^3 per yr) v42_irrig_eff(j) Irrigation efficiency (1) + vm_water_cost(i) Cost of irrigation water (USD05MER per m^3) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### 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) - oq42_water_demand(t,wat_dem,j,type) Water consumption in different sectors (mio. 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 (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 ee188782d6..3a20cc9f44 100644 --- a/modules/42_water_demand/all_sectors_aug13/equations.gms +++ b/modules/42_water_demand/all_sectors_aug13/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,13 +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") * + 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); - -*' `vm_watdem` is composed by irrigation and livestock demand uses. -*' The factor `v42_irrig_eff` corresponds to the amount of water that is used -*' inefficiently in the irrigation process. +*' Agricultural water demand is composed by livestock water demand and +*' demand for irrigation water withdrawals. +*' The factor `v42_irrig_eff` accounts for irrigation efficiency. diff --git a/modules/42_water_demand/all_sectors_aug13/input.gms b/modules/42_water_demand/all_sectors_aug13/input.gms index d21f79080e..8700ec7d11 100644 --- a/modules/42_water_demand/all_sectors_aug13/input.gms +++ b/modules/42_water_demand/all_sectors_aug13/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,21 +6,20 @@ *** | Contact: magpie@pik-potsdam.de scalars +s42_watdem_nonagr_scenario Scenario for non agricultural water demand from WATERGAP (1) / 2 / +* 1: SSP1 +* 2: SSP2 +* 3: SSP3 -s42_watdem_nonagr_scenario Scenario for non agricultural water demand from WATERGAP (1) / 1 / -* 1: SSP 2 -* 2: A2 -* 3: B1 - -s42_irrig_eff_scenario Scenario for irrigation efficiency (1) / 2 / +s42_irrig_eff_scenario Scenario for irrigation efficiency (1) / 2 / * 1: global static value * 2: regional static values from CS * 3: gdp driven increase -s42_irrigation_efficiency Value of irrigation efficiency. (1) / 0.66 / +s42_irrigation_efficiency Value of irrigation efficiency (1) / 0.66 / * Only if global static value is requested -s42_env_flow_scenario Environmental flow protection scenario. (1) / 2 / +s42_env_flow_scenario Environmental flow protection scenario (1) / 2 / * 0: don't consider environmental flows. * s42_env_flow_base_fraction and * s42_env_flow_fraction have no effect. @@ -32,44 +31,49 @@ s42_env_flow_scenario Environmental flow protection scenario. * results and a calculation algorithm by Smakhtin 2004. * s42_env_flow_fraction has no effect. +* Linear fading in of environmental flow policy between startyear and targetyear +s42_efp_startyear Environmental flow policy start year / 2020 / +s42_efp_targetyear Environmental flow policy target year / 2040 / s42_env_flow_base_fraction Fraction of available water that is reserved for the environment if no EFR protection policy is implemented (1) / 0.05 / -* (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_env_flow_fraction Fraction of available water that is reserved 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 multiplier to change pumping costs for sensitivity analysis takes numeric values (1) / 0 / ; -$setglobal c42_watdem_scenario nocc -* options: cc (climate change) -* nocc (no climate change) +$setglobal c42_watdem_scenario cc +* options: cc (climate change) +* nocc (no climate change) +* nocc_hist (no climate change after year defined by sm_fix_cc) * Set-switch for countries affected by EFP * Default: all iso countries selected sets EFP_countries(iso) countries to be affected by EFP / 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 / + 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 / ; table f42_wat_req_kve(t_all,j,kve) LPJ annual water demand for irrigation per ha (m^3 per yr) @@ -78,6 +82,7 @@ $include "./modules/42_water_demand/input/lpj_airrig.cs2" $offdelim ; $if "%c42_watdem_scenario%" == "nocc" f42_wat_req_kve(t_all,j,kve) = f42_wat_req_kve("y1995",j,kve); +$if "%c42_watdem_scenario%" == "nocc_hist" f42_wat_req_kve(t_all,j,kve)$(m_year(t_all) > sm_fix_cc) = f42_wat_req_kve(t_all,j,kve)$(m_year(t_all) = sm_fix_cc); m_fillmissingyears(f42_wat_req_kve,"j,kve"); parameter f42_wat_req_kli(kli) Average water requirements of livestock commodities per region per tDM per year (m^3 per yr) @@ -87,7 +92,7 @@ $include "./modules/42_water_demand/input/f42_wat_req_fao.csv" $offdelim /; -table f42_watdem_ineldo(t_all,j,scen_watdem_nonagr,watdem_ineldo) Industry electricity and domestic water demand under our socioeconomic scenarios (mio. m^3) +table f42_watdem_ineldo(t_all,j,scen_watdem_nonagr,watdem_ineldo) Manufacturing electricity and domestic water demand under different socioeconomic scenarios (mio. m^3) $ondelim $include "./modules/42_water_demand/input/watdem_nonagr_grper.cs3" $offdelim @@ -103,12 +108,17 @@ $offdelim / ; $if "%c42_watdem_scenario%" == "nocc" f42_env_flows(t_all,j) = f42_env_flows("y1995",j); +$if "%c42_watdem_scenario%" == "nocc_hist" f42_env_flows(t_all,j)$(m_year(t_all) > sm_fix_cc) = f42_env_flows(t_all,j)$(m_year(t_all) = sm_fix_cc); m_fillmissingyears(f42_env_flows,"j"); $setglobal c42_env_flow_policy off -table f42_env_flow_policy(t_all,scen42) EFP policies (1) +* Costs of pumping are calculated for India as per methodology in forthcoming paper by Singh et.al. +parameter +f42_pumping_cost(t_all,i) Cost of pumping irrigation water (USD05MER per m^3) +/ $ondelim -$include "./modules/42_water_demand/input/f42_env_flow_policy.cs3" +$include "./modules/42_water_demand/input/f42_pumping_cost.cs4" $offdelim +/ ; diff --git a/modules/42_water_demand/all_sectors_aug13/postsolve.gms b/modules/42_water_demand/all_sectors_aug13/postsolve.gms index f1cedc5fc0..42c6bfda3c 100644 --- a/modules/42_water_demand/all_sectors_aug13/postsolve.gms +++ b/modules/42_water_demand/all_sectors_aug13/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -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/preloop.gms b/modules/42_water_demand/all_sectors_aug13/preloop.gms index 76cfc57ae7..351a33dac8 100644 --- a/modules/42_water_demand/all_sectors_aug13/preloop.gms +++ b/modules/42_water_demand/all_sectors_aug13/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -9,3 +9,9 @@ i42_wat_req_k(t,j,kve) = f42_wat_req_kve(t,j,kve); i42_env_flows(t,j) = f42_env_flows(t,j); i42_wat_req_k(t,j,kli) = f42_wat_req_kli(kli); + +* Trajectory for environmental flow policy +* (linear interpolation from start year to target year) +p42_efp(t_all,"off") = 0; +m_linear_interpol(p42_efp_fader, s42_efp_startyear, s42_efp_targetyear, 0, 1); +p42_efp(t_all, "on") = p42_efp_fader(t_all); diff --git a/modules/42_water_demand/all_sectors_aug13/presolve.gms b/modules/42_water_demand/all_sectors_aug13/presolve.gms index 12493f2006..ab7b4d60d2 100644 --- a/modules/42_water_demand/all_sectors_aug13/presolve.gms +++ b/modules/42_water_demand/all_sectors_aug13/presolve.gms @@ -1,67 +1,80 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -* Country switch to determine countries for which EFP holds. -* In the default case, the EFP affects all countries when activated. -p42_country_dummy(iso) = 0; -p42_country_dummy(EFP_countries) = 1; -* Because MAgPIE is not run at country-level, but at region level, a region -* share is calculated that translates the countries' influence to regional level. -* Countries are weighted by their population size. -p42_EFP_region_shr(t_all,i) = sum(i_to_iso(i,iso), p42_country_dummy(iso) * im_pop_iso(t_all,iso)) / sum(i_to_iso(i,iso), im_pop_iso(t_all,iso)); +* Agricultural water demand +ic42_wat_req_k(j,k) = i42_wat_req_k(t,j,k); -* Environmental policy switch: -$ifthen "%c42_env_flow_policy%" == "mixed" - i42_env_flow_policy(t,i) = (im_development_state(t,i) * f42_env_flow_policy(t,"on")) * p42_EFP_region_shr(t,i) - + f42_env_flow_policy(t,"off") * (1-p42_EFP_region_shr(t,i)); -$else - i42_env_flow_policy(t,i) = f42_env_flow_policy(t,"%c42_env_flow_policy%") * p42_EFP_region_shr(t,i) - + f42_env_flow_policy(t,"off") * (1-p42_EFP_region_shr(t,i)); -$endif +* Irrigation efficiency +if (m_year(t) <= sm_fix_SSP2, + v42_irrig_eff.fx(j) = 1 / (1 + 2.718282**((-22160-sum(cell(i,j),im_gdp_pc_mer("y1995",i)))/37767)); +else + if ((s42_irrig_eff_scenario = 1), + v42_irrig_eff.fx(j) = s42_irrigation_efficiency; + Elseif (s42_irrig_eff_scenario = 2), + v42_irrig_eff.fx(j) = 1 / (1 + 2.718282**((-22160-sum(cell(i,j),im_gdp_pc_mer("y1995",i)))/37767)); + Elseif (s42_irrig_eff_scenario = 3), + v42_irrig_eff.fx(j) = 1 / (1 + 2.718282**((-22160-sum(cell(i,j),im_gdp_pc_mer(t,i)))/37767)); + ); +); +* Pumping cost in the current time step +ic42_pumping_cost(i) = 0; + +* Pumping cost settings will be only executed when s42_pumping is set to 1 +if ((s42_pumping = 1), + ic42_pumping_cost(i) = f42_pumping_cost(t,i); +* Pumping cost sensitivity test implmentation + if(m_year(t) > s42_multiplier_startyear, + ic42_pumping_cost(i) = f42_pumping_cost(t,i) * s42_multiplier; + ); +); -* Agricultural water demand -ic42_wat_req_k(j,k) = i42_wat_req_k(t,j,k); -ic42_env_flow_policy(i) = i42_env_flow_policy(t,i); -* water consumption in industry, sanitation, ecosystem +* Water withdrawals in manufacturing, electricity, domestic, ecosystem * depends on the socioeconomic scenario -if((s42_watdem_nonagr_scenario = 1), - vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"SSP2",watdem_ineldo); +if ((s42_watdem_nonagr_scenario = 1), + vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"ssp1",watdem_ineldo); Elseif(s42_watdem_nonagr_scenario = 2), - vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"A2",watdem_ineldo); + vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"ssp2",watdem_ineldo); Elseif(s42_watdem_nonagr_scenario = 3), - vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"B1",watdem_ineldo); + vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"ssp3",watdem_ineldo); ); -*Environmental flow scenarios depending on the switch s42_env_flow_scenario + +* Environmental flow scenarios depending on the switch s42_env_flow_scenario i42_env_flows_base(t,j) = s42_env_flow_base_fraction * sum(wat_src, im_wat_avail(t,wat_src,j)); -if((s42_env_flow_scenario=0), - i42_env_flows_base(t,j) = 0; - i42_env_flows(t,j) = 0; -Elseif(s42_env_flow_scenario=1), +if ((s42_env_flow_scenario = 0), + i42_env_flows_base(t,j) = 0; + i42_env_flows(t,j) = 0; +Elseif (s42_env_flow_scenario = 1), i42_env_flows(t,j) = s42_env_flow_fraction * sum(wat_src, im_wat_avail(t,wat_src,j)); ); -vm_watdem.fx("ecosystem",j) = sum(cell(i,j), i42_env_flows_base(t,j) * (1-ic42_env_flow_policy(i)) + - i42_env_flows(t,j) * ic42_env_flow_policy(i)); +* Country switch to determine countries for which EFP holds. +* In the default case, the EFP affects all countries when activated. +p42_country_dummy(iso) = 0; +p42_country_dummy(EFP_countries) = 1; +* Because MAgPIE is not run at country-level, but at region level, a region +* share is calculated that translates the countries' influence to regional level. +* Countries are weighted by their population size. +p42_EFP_region_shr(t_all,i) = sum(i_to_iso(i,iso), p42_country_dummy(iso) * im_pop_iso(t_all,iso)) / sum(i_to_iso(i,iso), im_pop_iso(t_all,iso)); +* Environmental policy switch: +$ifthen "%c42_env_flow_policy%" == "mixed" + i42_env_flow_policy(t,i) = (im_development_state(t,i) * p42_efp(t,"on")) * p42_EFP_region_shr(t,i) + + p42_efp(t,"off") * (1-p42_EFP_region_shr(t,i)); +$else + i42_env_flow_policy(t,i) = p42_efp(t,"%c42_env_flow_policy%") * p42_EFP_region_shr(t,i) + + p42_efp(t,"off") * (1-p42_EFP_region_shr(t,i)); +$endif -* irrigation efficiency -if(m_year(t) <= sm_fix_SSP2, - v42_irrig_eff.fx(j) = 1/(1+2.718282**((-22160-sum(cell(i,j),im_gdp_pc_mer("y1995",i)))/37767)); -else - if((s42_irrig_eff_scenario = 1), - v42_irrig_eff.fx(j) = s42_irrigation_efficiency; - Elseif (s42_irrig_eff_scenario=2), - v42_irrig_eff.fx(j) = 1/(1+2.718282**((-22160-sum(cell(i,j),im_gdp_pc_mer("y1995",i)))/37767)); - Elseif (s42_irrig_eff_scenario=3), - v42_irrig_eff.fx(j) = 1/(1+2.718282**((-22160-sum(cell(i,j),im_gdp_pc_mer(t,i)))/37767)); - ); -); +ic42_env_flow_policy(i) = i42_env_flow_policy(t,i); + +vm_watdem.fx("ecosystem",j) = sum(cell(i,j), i42_env_flows_base(t,j) * (1 - ic42_env_flow_policy(i)) + + i42_env_flows(t,j) * ic42_env_flow_policy(i)); diff --git a/modules/42_water_demand/all_sectors_aug13/realization.gms b/modules/42_water_demand/all_sectors_aug13/realization.gms index 98522fb2d6..fd9e9718f6 100644 --- a/modules/42_water_demand/all_sectors_aug13/realization.gms +++ b/modules/42_water_demand/all_sectors_aug13/realization.gms @@ -1,15 +1,16 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 +*' @description *' -*' This realization models agricultural sector water demand endogenously, as described in the first realization, -*' Industry, electricity and domestic demand are also modelled endogenously with various scenarios; -*' Various settings (same ias in previous realization) for environmental water demand described below. +*' This realization models agricultural sector water withdrawals endogenously, +*' as described in the first realization. +*' Manufacturing, electricity and domestic demand are explicitly accounted for in various scenarios; +*' Various settings (same as in previous realization) for environmental water demand described below. *' *' *Agricultural water demand*: *' @@ -17,14 +18,14 @@ *' cropland `vm_area(j,kcr,"irrigated")` and livestock production *' `vm_prod(j,kli)`. *' -*' *Non agricultural human water demand*: +*' *Non agricultural human water withdrawals*: *' -*' For industry, electricity and domestic demand, three scenarios are available -*' on cluster level from the model by @watergap_water_2003: +*' For manufacturing, electricity and domestic withdrawals, three scenarios of the +*' WATERGAP model provided by @wada_modeling_2016 are used: *' -*' * SRES A2 (WATCH Project) -*' * SRES B1 (WATCH Project) -*' * SSP2 (ISI-MIP Project) +*' * SSP1 +*' * SSP2 +*' * SSP3 *' *' Due to the fact that MAgPIE only considers available blue water during the *' growing period of the plants ([43_water_availability]), the fraction of this @@ -43,7 +44,7 @@ *' for environmental purposes and consequently not available for agricultural *' activities (in addition to `s42_reserved_fraction`). *' * Environmental flow requirements (EFR) are calculated from LPJmL inputs -*' according to an algorithm by @smakhtin_water_2004 on cluster level. Due to +*' according to an algorithm by @smakhtin_water_2004 on cluster level. Due to *' the fact that MAgPIE only considers available blue water during the growing *' period of the plants [43_water_availability], EFR are also only calculated *' during this growing period. These are reserved in addition to @@ -51,6 +52,9 @@ *' flow protection policy, a base protection can be specified: *' `s42_env_flow_base_fraction`. It defaults to 5 % of available water. *' +*' The speed of transitioning to full environmental flow protection is determined +*' by specifying the start (`s42_efp_startyear`) and target (`s42_efp_targetyear`) year. +*' *' @limitations The module uses the "conveyance efficiency times management *' factor" for irrigation efficiency. Therefore, the management factor is *' accounted twice, since it is already considered in LPJmL water quantity used diff --git a/modules/42_water_demand/all_sectors_aug13/scaling.gms b/modules/42_water_demand/all_sectors_aug13/scaling.gms index f37c4e19aa..f5c65a720f 100644 --- a/modules/42_water_demand/all_sectors_aug13/scaling.gms +++ b/modules/42_water_demand/all_sectors_aug13/scaling.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/42_water_demand/all_sectors_aug13/sets.gms b/modules/42_water_demand/all_sectors_aug13/sets.gms index b90e7e0a7e..af1737515e 100644 --- a/modules/42_water_demand/all_sectors_aug13/sets.gms +++ b/modules/42_water_demand/all_sectors_aug13/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,19 +7,18 @@ sets watdem_exo(wat_dem) Exogenous water demand - / industry, electricity, domestic, ecosystem / + / domestic, manufacturing, electricity, ecosystem / watdem_ineldo(wat_dem) Exogenous water demand subset covering humanly induced demands - / industry, electricity, domestic / + / domestic, manufacturing, electricity / scen_watdem_nonagr Scenarios for non agricultural water demand - / A2 , B1 , SSP2 / + / ISIMIP, ssp1, ssp2, ssp3 / - scen42 Environmental Flow Policy (EFP) - / off, on / - - scen42_to_dev(scen42,dev) Mapping between EFP and economic development status - / off . (lic, mic) - on . (hic) / + scen42 Environmental Flow Policy (EFP) + / off, on / + scen42_to_dev(scen42,dev) Mapping between EFP and economic development status + / off . (lic, mic) + on . (hic) / ; diff --git a/modules/42_water_demand/input/files b/modules/42_water_demand/input/files index fa59c9be3a..f9df64edc4 100644 --- a/modules/42_water_demand/input/files +++ b/modules/42_water_demand/input/files @@ -2,5 +2,5 @@ lpj_airrig.cs2 lpj_envflow_grper.cs2 watdem_nonagr_grper.cs3 -f42_env_flow_policy.cs3 f42_wat_req_fao.csv +f42_pumping_cost.cs4 diff --git a/modules/42_water_demand/module.gms b/modules/42_water_demand/module.gms index cab863fcfd..238092d5a0 100644 --- a/modules/42_water_demand/module.gms +++ b/modules/42_water_demand/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -8,14 +8,14 @@ *' @title Water demand *' *' @description The water demand module determines the water demand in the following -*' sectors: agriculture, industry, electricity, domestic and ecosystem. +*' sectors: agriculture, manufacturing, electricity, domestic and ecosystem. *' Different scenarios for different water demand and environmental flow protection are *' possible. The module receives information from the [17_production], [30_crop], [09_drivers] *' and [43_water_availability] modules. It passes information to the module [43_water_availability] *' and [11_costs]. *' -*' -*' +*' +*' *' @authors Anne Biewald, Markus Bonsch *###################### R SECTION START (MODULETYPES) ########################## diff --git a/modules/43_water_availability/module.gms b/modules/43_water_availability/module.gms index 14d1efe6b6..f33bba60bb 100644 --- a/modules/43_water_availability/module.gms +++ b/modules/43_water_availability/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/43_water_availability/total_water_aug13/declarations.gms b/modules/43_water_availability/total_water_aug13/declarations.gms index 7f0223ce9a..c140d072c4 100644 --- a/modules/43_water_availability/total_water_aug13/declarations.gms +++ b/modules/43_water_availability/total_water_aug13/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -9,7 +9,7 @@ parameters im_wat_avail(t,wat_src,j) Water availability (mio. m^3 per yr) ; -variables +variables v43_watavail(wat_src,j) Water available from different sources (mio. m^3 per yr) ; @@ -23,4 +23,3 @@ parameters oq43_water(t,j,type) Local seasonal water constraints (mio. m^3 per yr) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### - diff --git a/modules/43_water_availability/total_water_aug13/equations.gms b/modules/43_water_availability/total_water_aug13/equations.gms index f4b79b584e..dc56b624fc 100644 --- a/modules/43_water_availability/total_water_aug13/equations.gms +++ b/modules/43_water_availability/total_water_aug13/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -14,7 +14,7 @@ *' cluster, the sum of water withdrawals in all sectors `vm_watdem` *' does not exceed available water from all sources `v43_watavail`. *' The local seasonal water constraints is the sum of the amount of water needed -*' in the sectors defined by `wat_dem` (agriculture, industry, electricity, +*' in the sectors defined by `wat_dem` (agriculture, manufacturing, electricity, *' domestic and ecosystem). This value must be lower than the sum of the Amount of *' water available from different sources in the sectors defined by `wat_src` (surface, *' ground, technical and renewable groundwater). diff --git a/modules/43_water_availability/total_water_aug13/input.gms b/modules/43_water_availability/total_water_aug13/input.gms index b4ddfa61a1..16b50adc7a 100644 --- a/modules/43_water_availability/total_water_aug13/input.gms +++ b/modules/43_water_availability/total_water_aug13/input.gms @@ -1,13 +1,16 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 c43_watavail_scenario nocc -* options: cc (climate change) -* nocc (no climate change) + +$setglobal c43_watavail_scenario cc +* options: cc (climate change) +* nocc (no climate change) +* nocc_hist (no climate change after year defined by sm_fix_cc) + parameters f43_wat_avail(t_all,j) Surface water available for irrigation per cell from LPJmL (mio. m^3 per yr) @@ -17,5 +20,8 @@ $include "./modules/43_water_availability/input/lpj_watavail_grper.cs2" $offdelim / ; -$if "%c43_watavail_scenario%" == "nocc" f43_wat_avail(t_all,j) = f43_wat_avail("y1995",j); +* 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/postsolve.gms b/modules/43_water_availability/total_water_aug13/postsolve.gms index e227f3e241..3927b10ee6 100644 --- a/modules/43_water_availability/total_water_aug13/postsolve.gms +++ b/modules/43_water_availability/total_water_aug13/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/43_water_availability/total_water_aug13/preloop.gms b/modules/43_water_availability/total_water_aug13/preloop.gms index a5e18c8abe..7c1ba7c13a 100644 --- a/modules/43_water_availability/total_water_aug13/preloop.gms +++ b/modules/43_water_availability/total_water_aug13/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/43_water_availability/total_water_aug13/presolve.gms b/modules/43_water_availability/total_water_aug13/presolve.gms index 297ee6677b..1846615b43 100644 --- a/modules/43_water_availability/total_water_aug13/presolve.gms +++ b/modules/43_water_availability/total_water_aug13/presolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/43_water_availability/total_water_aug13/realization.gms b/modules/43_water_availability/total_water_aug13/realization.gms index 5d63802680..061015af19 100644 --- a/modules/43_water_availability/total_water_aug13/realization.gms +++ b/modules/43_water_availability/total_water_aug13/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/43_water_availability/total_water_aug13/scaling.gms b/modules/43_water_availability/total_water_aug13/scaling.gms index 3f68bc4eb4..f960d34b8b 100644 --- a/modules/43_water_availability/total_water_aug13/scaling.gms +++ b/modules/43_water_availability/total_water_aug13/scaling.gms @@ -1,8 +1,8 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -v43_watavail.scale(wat_src,j) = 10e5; +v43_watavail.scale(wat_src,j) = 10e4; diff --git a/modules/44_biodiversity/bii_target/declarations.gms b/modules/44_biodiversity/bii_target/declarations.gms new file mode 100644 index 0000000000..419d24471c --- /dev/null +++ b/modules/44_biodiversity/bii_target/declarations.gms @@ -0,0 +1,40 @@ +*** | (C) 2008-2023 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_cost_bv_loss(j) Biodiversity cost (mio USD) + vm_bv(j,landcover44,potnatveg) Biodiversity stock for all land cover classes (Mha) + v44_bii(i,biome44) Biodiversity Intactness Index BII (1) + v44_bii_missing(i,biome44) Missing BII increase for compliance with BII target (1) +; + +parameters + p44_bii_lower_bound(t,i,biome44) Interpolated lower bound for BII over time (1) + p44_start_value(i,biome44) Start value for BII lower bound (1) + p44_target_value(i,biome44) Target value for BII lower bound (1) +; + +equations + q44_bii(i,biome44) Biodiversity Intactness Index BII (1) + q44_bii_target(i,biome44) Missing BII increase for compliance with BII target (1) + q44_cost(i) Biodiversity cost (mio USD) +; + + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov_cost_bv_loss(t,j,type) Biodiversity cost (mio USD) + ov_bv(t,j,landcover44,potnatveg,type) Biodiversity stock for all land cover classes (Mha) + ov44_bii(t,i,biome44,type) Biodiversity Intactness Index BII (1) + ov44_bii_missing(t,i,biome44,type) Missing BII increase for compliance with BII target (1) + oq44_bii(t,i,biome44,type) Biodiversity Intactness Index BII (1) + oq44_bii_target(t,i,biome44,type) Missing BII increase for compliance with BII target (1) + oq44_cost(t,i,type) Biodiversity cost (mio USD) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### + diff --git a/modules/44_biodiversity/bii_target/equations.gms b/modules/44_biodiversity/bii_target/equations.gms new file mode 100644 index 0000000000..c1aec812a0 --- /dev/null +++ b/modules/44_biodiversity/bii_target/equations.gms @@ -0,0 +1,28 @@ +*** | (C) 2008-2023 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 Biodiversity Intactness Index (BII) is calculated at the level of 71 biomes. +*' The regional layer is needed for compatibility with the high resolution parallel optimization output script (scripts/output/extra/highres.R) + + q44_bii(i2,biome44)$(sum(cell(i2,j2), f44_biome(j2,biome44)) > 0) .. v44_bii(i2,biome44) + =e= + (sum((cell(i2,j2),potnatveg,landcover44), vm_bv(j2,landcover44,potnatveg) * f44_biome(j2,biome44)) / sum((cell(i2,j2),land), pcm_land(j2,land) * f44_biome(j2,biome44))); + +*' For each of the 71 biomes, the BII has to meet a minium level based on `s44_bii_lower_bound`. +*' `v44_bii_missing` is a technical variable to maintain feasibility in case `v44_bii` cannot be increased. + + q44_bii_target(i2,biome44)$(sum(cell(i2,j2), f44_biome(j2,biome44)) > 0) .. + v44_bii(i2,biome44) + v44_bii_missing(i2,biome44) =g= sum(ct, p44_bii_lower_bound(ct,i2,biome44)); + +*' Costs accrue only for `v44_bii_missing`. In the best case costs should be zero or close to zero. +*' Costs strongly depend on the choice of `s44_bii_lower_bound`. + + q44_cost(i2) .. sum(cell(i2,j2), vm_cost_bv_loss(j2)) =e= + sum(biome44, v44_bii_missing(i2,biome44)) * s44_cost_bii_missing; + diff --git a/modules/44_biodiversity/bii_target/input.gms b/modules/44_biodiversity/bii_target/input.gms new file mode 100644 index 0000000000..ac0f08148d --- /dev/null +++ b/modules/44_biodiversity/bii_target/input.gms @@ -0,0 +1,27 @@ +*** | (C) 2008-2023 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 + +scalars + s44_bii_lower_bound Lower bound for BII (1) / 0 / + c44_bii_decrease Implementation of lower bound for BII (binary) / 1 / + s44_target_year Year in which the BII lower bound is reached (1) / 2100 / + s44_start_year Start year for interpolation towards BII lower bound (1) / 2025 / + s44_cost_bii_missing Technical costs for missing BII increase (USD per unit of BII) / 1000000 / +; + + +table fm_bii_coeff(bii_class44,potnatveg) Biodiversity Intactness Index coefficients (unitless) +$ondelim +$include "./modules/44_biodiversity/bii_target/input/f44_bii_coeff.cs3" +$offdelim +; + +table f44_biome(j,biome44) Share of biome type in each spatial unit (1) +$ondelim +$include "./modules/44_biodiversity/bii_target/input/biorealm_biome.cs3" +$offdelim +; diff --git a/modules/44_biodiversity/bii_target/input/files b/modules/44_biodiversity/bii_target/input/files new file mode 100644 index 0000000000..0ad61cf22c --- /dev/null +++ b/modules/44_biodiversity/bii_target/input/files @@ -0,0 +1,3 @@ +* list of files that are required here +f44_bii_coeff.cs3 +biorealm_biome.cs3 diff --git a/modules/44_biodiversity/bii_target/postsolve.gms b/modules/44_biodiversity/bii_target/postsolve.gms new file mode 100644 index 0000000000..1974fa3da6 --- /dev/null +++ b/modules/44_biodiversity/bii_target/postsolve.gms @@ -0,0 +1,38 @@ +*** | (C) 2008-2023 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_bv_loss(t,j,"marginal") = vm_cost_bv_loss.m(j); + ov_bv(t,j,landcover44,potnatveg,"marginal") = vm_bv.m(j,landcover44,potnatveg); + ov44_bii(t,i,biome44,"marginal") = v44_bii.m(i,biome44); + ov44_bii_missing(t,i,biome44,"marginal") = v44_bii_missing.m(i,biome44); + oq44_bii(t,i,biome44,"marginal") = q44_bii.m(i,biome44); + oq44_bii_target(t,i,biome44,"marginal") = q44_bii_target.m(i,biome44); + oq44_cost(t,i,"marginal") = q44_cost.m(i); + ov_cost_bv_loss(t,j,"level") = vm_cost_bv_loss.l(j); + ov_bv(t,j,landcover44,potnatveg,"level") = vm_bv.l(j,landcover44,potnatveg); + ov44_bii(t,i,biome44,"level") = v44_bii.l(i,biome44); + ov44_bii_missing(t,i,biome44,"level") = v44_bii_missing.l(i,biome44); + oq44_bii(t,i,biome44,"level") = q44_bii.l(i,biome44); + oq44_bii_target(t,i,biome44,"level") = q44_bii_target.l(i,biome44); + oq44_cost(t,i,"level") = q44_cost.l(i); + ov_cost_bv_loss(t,j,"upper") = vm_cost_bv_loss.up(j); + ov_bv(t,j,landcover44,potnatveg,"upper") = vm_bv.up(j,landcover44,potnatveg); + ov44_bii(t,i,biome44,"upper") = v44_bii.up(i,biome44); + ov44_bii_missing(t,i,biome44,"upper") = v44_bii_missing.up(i,biome44); + oq44_bii(t,i,biome44,"upper") = q44_bii.up(i,biome44); + oq44_bii_target(t,i,biome44,"upper") = q44_bii_target.up(i,biome44); + oq44_cost(t,i,"upper") = q44_cost.up(i); + ov_cost_bv_loss(t,j,"lower") = vm_cost_bv_loss.lo(j); + ov_bv(t,j,landcover44,potnatveg,"lower") = vm_bv.lo(j,landcover44,potnatveg); + ov44_bii(t,i,biome44,"lower") = v44_bii.lo(i,biome44); + ov44_bii_missing(t,i,biome44,"lower") = v44_bii_missing.lo(i,biome44); + oq44_bii(t,i,biome44,"lower") = q44_bii.lo(i,biome44); + oq44_bii_target(t,i,biome44,"lower") = q44_bii_target.lo(i,biome44); + oq44_cost(t,i,"lower") = q44_cost.lo(i); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### + diff --git a/modules/14_yields/dynamic_aug18/nl_fix.gms b/modules/44_biodiversity/bii_target/preloop.gms similarity index 51% rename from modules/14_yields/dynamic_aug18/nl_fix.gms rename to modules/44_biodiversity/bii_target/preloop.gms index 3da0470896..2c6494fe74 100644 --- a/modules/14_yields/dynamic_aug18/nl_fix.gms +++ b/modules/44_biodiversity/bii_target/preloop.gms @@ -1,19 +1,14 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -* ### nl_fix ### - -vm_yld.fx(j,kcr,w) = sum(ct,i14_yields(ct,j,kcr,w))*sum(cell(i,j),vm_tau.l(i)/fm_tau1995(i)); - -vm_yld.fx(j,"pasture",w) = sum(ct,i14_yields(ct,j,"pasture",w)*sum(cell(i,j),pm_past_mngmnt_factor(ct,i))); - - - - - +v44_bii.l(i,biome44) = 0.75; +v44_bii.fx(i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)) = 0) = 0; +v44_bii_missing.fx(i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)) = 0) = 0; +p44_bii_lower_bound(t,i,biome44) = 0; +vm_bv.l(j,landcover44,potnatveg) = 0; diff --git a/modules/44_biodiversity/bii_target/presolve.gms b/modules/44_biodiversity/bii_target/presolve.gms new file mode 100644 index 0000000000..7f9ba294f7 --- /dev/null +++ b/modules/44_biodiversity/bii_target/presolve.gms @@ -0,0 +1,29 @@ +*** | (C) 2008-2023 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) = s44_start_year, +* The start value for the linear interpolation is the BII at biome level in the start year. + p44_start_value(i,biome44) = v44_bii.l(i,biome44); +* The target value for the linear interpolation is the lower bound defined in `s44_bii_lower_bound`. + p44_target_value(i,biome44) = s44_bii_lower_bound; + +* Linear increase of BII target values at biome level from start year to target year, and constant values thereafter. + p44_bii_lower_bound(t2,i,biome44) = p44_start_value(i,biome44) + ((m_year(t2) - s44_start_year) / (s44_target_year - s44_start_year)) * (p44_target_value(i,biome44) - p44_start_value(i,biome44)); + p44_bii_lower_bound(t2,i,biome44)$(m_year(t2) > s44_target_year) = p44_target_value(i,biome44); + if(c44_bii_decrease = 0, + p44_bii_lower_bound(t2,i,biome44)$(v44_bii.l(i,biome44) >= p44_target_value(i,biome44)) = v44_bii.l(i,biome44); + elseif c44_bii_decrease = 1, + p44_bii_lower_bound(t2,i,biome44)$(v44_bii.l(i,biome44) >= p44_target_value(i,biome44)) = p44_target_value(i,biome44); + ); + p44_bii_lower_bound(t2,i,biome44)$(p44_bii_lower_bound(t2,i,biome44) >= 1) = 1; + p44_bii_lower_bound(t2,i,biome44)$(m_year(t2) < s44_start_year) = 0; + p44_bii_lower_bound(t2,i,biome44)$(sum(cell(i,j), f44_biome(j,biome44)) = 0) = 0; +* The lower bound of `v44_bii` is set to `p44_bii_lower_bound` to avoid a reduction of BII in combination with `v44_bii_missing`. + v44_bii.lo(i,biome44) = p44_bii_lower_bound(t,i,biome44); + display p44_bii_lower_bound; +); + diff --git a/modules/44_biodiversity/bii_target/realization.gms b/modules/44_biodiversity/bii_target/realization.gms new file mode 100644 index 0000000000..f8fdc2a6b9 --- /dev/null +++ b/modules/44_biodiversity/bii_target/realization.gms @@ -0,0 +1,25 @@ +*** | (C) 2008-2023 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 In this realisation, the Biodiversity Intactness Index (BII) is +*' calculated separately for each biome type of each biogeographic realm, which results in 71 different spatial units (@olson_biome_2001). +*' The BII is a relative indicator, wich measures the intactness of local species assemblages (species richness) +*' compared to a reference state (space-for-time approach) (@purvis_chapter_2018). +*' The implementation uses the BII coefficients described in @leclere_biodiv_2018 and @leclere_bending_2020. +*' The realisation allows to set a lower bound for the BII in the future, based on an annual growth rate. + +*' @limitations + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/44_biodiversity/bii_target/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/44_biodiversity/bii_target/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/44_biodiversity/bii_target/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/44_biodiversity/bii_target/equations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/44_biodiversity/bii_target/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/44_biodiversity/bii_target/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/44_biodiversity/bii_target/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/44_biodiversity/bii_target/sets.gms b/modules/44_biodiversity/bii_target/sets.gms new file mode 100644 index 0000000000..0a826f7791 --- /dev/null +++ b/modules/44_biodiversity/bii_target/sets.gms @@ -0,0 +1,32 @@ +*** | (C) 2008-2023 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 + + landcover44 land cover classes used in bii calculation + / crop_ann, crop_per, manpast, rangeland, urban, aff_ndc, aff_co2p, primforest, secdforest, other, plant / + + bii_class44 bii coefficent land cover classes + / crop_ann, crop_per, manpast, rangeland, urban, primary, secd_mature, secd_young, timber / + + bii_class_secd(bii_class44) bii coefficent land cover classes secondary vegetation + / secd_mature, secd_young / + + ac_to_bii_class_secd(ac,bii_class_secd) Mapping between forest ageclasses and bii coefficent land cover classes + / (ac0,ac5,ac10,ac15,ac20,ac25,ac30) . (secd_young) + (ac35,ac40,ac45,ac50,ac55,ac60, + ac65,ac70,ac75,ac80,ac85,ac90, + ac95,ac100,ac105,ac110,ac115, + ac120,ac125,ac130,ac135,ac140, + ac145,ac150,ac155,acx) . (secd_mature) / + + biome44 biomes + / AA1,AA2,AA4,AA7,AA8,AA10,AA11,AA14,AN11,AT1,AT2,AT7,AT8,AT9,AT10,AT12,AT13,AT14,IM1, + IM2,NA4,IM3,IM13,IM14,NA3,NA8,NA11,IM4,IM5,IM7,IM9,IM10,NT2,NA13,NT1,NT9,NT98,NT99, + OC1,OC2,OC7,NT3,NT4,NT7,NT8,NT10,NT12,NT13,NT14,PA11,PA12,PA13,NA5,PA1,PA4,PA5,PA6, + PA8,PA9,PA10,AN99,AT98,NA2,NA6,NA7,NA12,NA99,PA98,PA99,AA12,AA13 / +; diff --git a/modules/44_biodiversity/bv_btc_mar21/declarations.gms b/modules/44_biodiversity/bv_btc_mar21/declarations.gms index 9eadc4c775..d73940a893 100644 --- a/modules/44_biodiversity/bv_btc_mar21/declarations.gms +++ b/modules/44_biodiversity/bv_btc_mar21/declarations.gms @@ -1,45 +1,40 @@ -*** (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK), -*** authors, and contributors see AUTHORS file -*** This file is part of MAgPIE and licensed under GNU AGPL Version 3 -*** or later. See LICENSE file or go to http://www.gnu.org/licenses/ -*** Contact: magpie@pik-potsdam.de +*** | (C) 2008-2023 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 parameters - pc44_bv_weighted(j,landcover44) Current range rarity weighted bii (Mha) - p44_price_bv_loss(t) biodiversity value loss price factor (USD per ha of bv loss) - pc44_price_bv_loss biodiversity value loss price factor (USD per ha of bv loss) + p44_price_bv_loss(t_all) Price (subsidy) for biodiversity stock loss (gain) (USD per ha) ; variables - v44_bv_loss(j) total biodiversity value loss (Mha per time step) - v44_diff_bv_landcover(j,landcover44) difference of biodiversity value per land class (Mha per time step) - vm_cost_bv_loss(j) biodiversity value loss cost (mio USD) + v44_bv_loss(j) Change in biodiversity stock (Mha per year) + vm_cost_bv_loss(j) Biodiversity cost (mio USD) ; positive variables - vm_bv(j,landcover44,potnatveg) biodiversity value for all land cover classes (unweighted) (Mha) - v44_bv_weighted(j,landcover44) range rarity weighted biodiversity value (Mha) + vm_bv(j,landcover44,potnatveg) Biodiversity stock for all land cover classes (Mha) + v44_bv_weighted(j) Range-rarity weighted biodiversity stock (Mha) ; equations - q44_bv_loss(j) total biodiversity value loss constraint (Mha) - q44_diff_bv_landcover(j,landcover44) biodiversity value loss constraint per land class (Mha) - q44_bv_weighted(j,landcover44) biodiversity value stock constraint (Mha) - q44_cost_bv_loss(j) biodiversity value loss cost constraint (mio USD) + q44_bv_loss(j) Change in biodiversity stock (Mha per year) + q44_bv_weighted(j) Range-rarity weighted biodiversity stock (Mha) + q44_cost_bv_loss(j) Cost of biodiversity loss (mio USD) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov44_bv_loss(t,j,type) total biodiversity value loss (Mha per time step) - ov44_diff_bv_landcover(t,j,landcover44,type) difference of biodiversity value per land class (Mha per time step) - ov_cost_bv_loss(t,j,type) biodiversity value loss cost (mio USD) - ov_bv(t,j,landcover44,potnatveg,type) biodiversity value for all land cover classes (unweighted) (Mha) - ov44_bv_weighted(t,j,landcover44,type) range rarity weighted biodiversity value (Mha) - oq44_bv_loss(t,j,type) total biodiversity value loss constraint (Mha) - oq44_diff_bv_landcover(t,j,landcover44,type) biodiversity value loss constraint per land class (Mha) - oq44_bv_weighted(t,j,landcover44,type) biodiversity value stock constraint (Mha) - oq44_cost_bv_loss(t,j,type) biodiversity value loss cost constraint (mio USD) + ov44_bv_loss(t,j,type) Change in biodiversity stock (Mha per year) + ov_cost_bv_loss(t,j,type) Biodiversity cost (mio USD) + ov_bv(t,j,landcover44,potnatveg,type) Biodiversity stock for all land cover classes (Mha) + ov44_bv_weighted(t,j,type) Range-rarity weighted biodiversity stock (Mha) + oq44_bv_loss(t,j,type) Change in biodiversity stock (Mha per year) + oq44_bv_weighted(t,j,type) Range-rarity weighted biodiversity stock (Mha) + oq44_cost_bv_loss(t,j,type) Cost of biodiversity loss (mio USD) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/44_biodiversity/bv_btc_mar21/equations.gms b/modules/44_biodiversity/bv_btc_mar21/equations.gms index 9194da5bdd..8a924c1a6e 100644 --- a/modules/44_biodiversity/bv_btc_mar21/equations.gms +++ b/modules/44_biodiversity/bv_btc_mar21/equations.gms @@ -1,29 +1,25 @@ -*** (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK), -*** authors, and contributors see AUTHORS file -*** This file is part of MAgPIE and licensed under GNU AGPL Version 3 -*** or later. See LICENSE file or go to http://www.gnu.org/licenses/ -*** Contact: magpie@pik-potsdam.de +*** | (C) 2008-2023 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 constraint `q44_cost_bv_loss(j2)` allows to introduce a price on biodiversity value loss. The total biodiversity value difference in each cluster is multiplied with a cost factor. +*' The net biodiversity stock change is priced. q44_cost_bv_loss(j2) .. vm_cost_bv_loss(j2) - =e= - v44_bv_loss(j2) * sum(ct, p44_price_bv_loss(ct)); + =e= + v44_bv_loss(j2) * sum(ct, p44_price_bv_loss(ct)); -*' The sum of biodiversity value loss in each cluster. +*' Change in biodiversity stock compared to previous time step, divided by time step length. q44_bv_loss(j2) .. v44_bv_loss(j2) - =e= - sum(landcover44, v44_diff_bv_landcover(j2,landcover44)); + =e= + (v44_bv_weighted.l(j2) - v44_bv_weighted(j2))/m_timestep_length; -*' The difference of the biodiversity value for each land cover type. - q44_diff_bv_landcover(j2,landcover44) .. v44_diff_bv_landcover(j2,landcover44) - =e= - pc44_bv_weighted(j2,landcover44) - v44_bv_weighted(j2,landcover44); - -*' Biodiversity values of each land cover type are weighted by range-rarity (`f44_rr_layer`) - q44_bv_weighted(j2,landcover44) .. v44_bv_weighted(j2,landcover44) - =e= - f44_rr_layer(j2) * sum(potnatveg, vm_bv(j2,landcover44,potnatveg)); +*' Biodiversity stock weighted by range-rarity restoration prioritization layer (`f44_rr_layer`) + q44_bv_weighted(j2) .. v44_bv_weighted(j2) + =e= + f44_rr_layer(j2) * sum((potnatveg,landcover44), vm_bv(j2,landcover44,potnatveg)); *** EOF constraints.gms *** diff --git a/modules/44_biodiversity/bv_btc_mar21/input.gms b/modules/44_biodiversity/bv_btc_mar21/input.gms index 84b205c3cd..5469039d40 100644 --- a/modules/44_biodiversity/bv_btc_mar21/input.gms +++ b/modules/44_biodiversity/bv_btc_mar21/input.gms @@ -1,26 +1,25 @@ -*** (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK), -*** authors, and contributors see AUTHORS file -*** This file is part of MAgPIE and licensed under GNU AGPL Version 3 -*** or later. See LICENSE file or go to http://www.gnu.org/licenses/ -*** Contact: magpie@pik-potsdam.de +*** | (C) 2008-2023 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 c44_price_bv_loss p0 - - -table fm_bii_coeff(bii_class44,potnatveg) bii coeff (unitless) -$ondelim -$include "./modules/44_biodiversity/bv_btc_mar21/input/f44_bii_coeff.cs3" -$offdelim +scalars + 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 / ; -table f44_price_bv_loss(t_all,price_biodiv44) price biodiv loss (USD per ha of biodiversity value loss) +table fm_bii_coeff(bii_class44,potnatveg) Biodiversity Intactness Index coefficients (unitless) $ondelim -$include "./modules/44_biodiversity/bv_btc_mar21/input/f44_price_biodiv_loss.csv" +$include "./modules/44_biodiversity/bv_btc_mar21/input/f44_bii_coeff.cs3" $offdelim ; parameters -f44_rr_layer(j) range rarity layer (unitless) +f44_rr_layer(j) Range-rarity restoration prioritization layer (unitless) / $ondelim $include "./modules/44_biodiversity/bv_btc_mar21/input/rr_layer.cs2" diff --git a/modules/44_biodiversity/bv_btc_mar21/input/files b/modules/44_biodiversity/bv_btc_mar21/input/files index f91019c352..a68d4ecebf 100644 --- a/modules/44_biodiversity/bv_btc_mar21/input/files +++ b/modules/44_biodiversity/bv_btc_mar21/input/files @@ -1,5 +1,3 @@ * list of files that are required here rr_layer.cs2 f44_bii_coeff.cs3 -f44_price_biodiv_loss.csv - diff --git a/modules/44_biodiversity/bv_btc_mar21/not_used.txt b/modules/44_biodiversity/bv_btc_mar21/not_used.txt new file mode 100644 index 0000000000..bf287154ed --- /dev/null +++ b/modules/44_biodiversity/bv_btc_mar21/not_used.txt @@ -0,0 +1,2 @@ +name,type,reason +pcm_land, input, not used diff --git a/modules/44_biodiversity/bv_btc_mar21/postsolve.gms b/modules/44_biodiversity/bv_btc_mar21/postsolve.gms index 019493aff0..14998a7d29 100644 --- a/modules/44_biodiversity/bv_btc_mar21/postsolve.gms +++ b/modules/44_biodiversity/bv_btc_mar21/postsolve.gms @@ -1,48 +1,38 @@ -*** (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK), -*** authors, and contributors see AUTHORS file -*** This file is part of MAgPIE and licensed under GNU AGPL Version 3 -*** or later. See LICENSE file or go to http://www.gnu.org/licenses/ -*** Contact: magpie@pik-potsdam.de - -pc44_bv_weighted(j,landcover44) = v44_bv_weighted.l(j,landcover44); - +*** | (C) 2008-2023 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) ##################### - ov44_bv_loss(t,j,"marginal") = v44_bv_loss.m(j); - ov44_diff_bv_landcover(t,j,landcover44,"marginal") = v44_diff_bv_landcover.m(j,landcover44); - ov_cost_bv_loss(t,j,"marginal") = vm_cost_bv_loss.m(j); - ov_bv(t,j,landcover44,potnatveg,"marginal") = vm_bv.m(j,landcover44,potnatveg); - ov44_bv_weighted(t,j,landcover44,"marginal") = v44_bv_weighted.m(j,landcover44); - oq44_bv_loss(t,j,"marginal") = q44_bv_loss.m(j); - oq44_diff_bv_landcover(t,j,landcover44,"marginal") = q44_diff_bv_landcover.m(j,landcover44); - oq44_bv_weighted(t,j,landcover44,"marginal") = q44_bv_weighted.m(j,landcover44); - oq44_cost_bv_loss(t,j,"marginal") = q44_cost_bv_loss.m(j); - ov44_bv_loss(t,j,"level") = v44_bv_loss.l(j); - ov44_diff_bv_landcover(t,j,landcover44,"level") = v44_diff_bv_landcover.l(j,landcover44); - ov_cost_bv_loss(t,j,"level") = vm_cost_bv_loss.l(j); - ov_bv(t,j,landcover44,potnatveg,"level") = vm_bv.l(j,landcover44,potnatveg); - ov44_bv_weighted(t,j,landcover44,"level") = v44_bv_weighted.l(j,landcover44); - oq44_bv_loss(t,j,"level") = q44_bv_loss.l(j); - oq44_diff_bv_landcover(t,j,landcover44,"level") = q44_diff_bv_landcover.l(j,landcover44); - oq44_bv_weighted(t,j,landcover44,"level") = q44_bv_weighted.l(j,landcover44); - oq44_cost_bv_loss(t,j,"level") = q44_cost_bv_loss.l(j); - ov44_bv_loss(t,j,"upper") = v44_bv_loss.up(j); - ov44_diff_bv_landcover(t,j,landcover44,"upper") = v44_diff_bv_landcover.up(j,landcover44); - ov_cost_bv_loss(t,j,"upper") = vm_cost_bv_loss.up(j); - ov_bv(t,j,landcover44,potnatveg,"upper") = vm_bv.up(j,landcover44,potnatveg); - ov44_bv_weighted(t,j,landcover44,"upper") = v44_bv_weighted.up(j,landcover44); - oq44_bv_loss(t,j,"upper") = q44_bv_loss.up(j); - oq44_diff_bv_landcover(t,j,landcover44,"upper") = q44_diff_bv_landcover.up(j,landcover44); - oq44_bv_weighted(t,j,landcover44,"upper") = q44_bv_weighted.up(j,landcover44); - oq44_cost_bv_loss(t,j,"upper") = q44_cost_bv_loss.up(j); - ov44_bv_loss(t,j,"lower") = v44_bv_loss.lo(j); - ov44_diff_bv_landcover(t,j,landcover44,"lower") = v44_diff_bv_landcover.lo(j,landcover44); - ov_cost_bv_loss(t,j,"lower") = vm_cost_bv_loss.lo(j); - ov_bv(t,j,landcover44,potnatveg,"lower") = vm_bv.lo(j,landcover44,potnatveg); - ov44_bv_weighted(t,j,landcover44,"lower") = v44_bv_weighted.lo(j,landcover44); - oq44_bv_loss(t,j,"lower") = q44_bv_loss.lo(j); - oq44_diff_bv_landcover(t,j,landcover44,"lower") = q44_diff_bv_landcover.lo(j,landcover44); - oq44_bv_weighted(t,j,landcover44,"lower") = q44_bv_weighted.lo(j,landcover44); - oq44_cost_bv_loss(t,j,"lower") = q44_cost_bv_loss.lo(j); + ov44_bv_loss(t,j,"marginal") = v44_bv_loss.m(j); + ov_cost_bv_loss(t,j,"marginal") = vm_cost_bv_loss.m(j); + ov_bv(t,j,landcover44,potnatveg,"marginal") = vm_bv.m(j,landcover44,potnatveg); + ov44_bv_weighted(t,j,"marginal") = v44_bv_weighted.m(j); + oq44_bv_loss(t,j,"marginal") = q44_bv_loss.m(j); + oq44_bv_weighted(t,j,"marginal") = q44_bv_weighted.m(j); + oq44_cost_bv_loss(t,j,"marginal") = q44_cost_bv_loss.m(j); + ov44_bv_loss(t,j,"level") = v44_bv_loss.l(j); + ov_cost_bv_loss(t,j,"level") = vm_cost_bv_loss.l(j); + ov_bv(t,j,landcover44,potnatveg,"level") = vm_bv.l(j,landcover44,potnatveg); + ov44_bv_weighted(t,j,"level") = v44_bv_weighted.l(j); + oq44_bv_loss(t,j,"level") = q44_bv_loss.l(j); + oq44_bv_weighted(t,j,"level") = q44_bv_weighted.l(j); + oq44_cost_bv_loss(t,j,"level") = q44_cost_bv_loss.l(j); + ov44_bv_loss(t,j,"upper") = v44_bv_loss.up(j); + ov_cost_bv_loss(t,j,"upper") = vm_cost_bv_loss.up(j); + ov_bv(t,j,landcover44,potnatveg,"upper") = vm_bv.up(j,landcover44,potnatveg); + ov44_bv_weighted(t,j,"upper") = v44_bv_weighted.up(j); + oq44_bv_loss(t,j,"upper") = q44_bv_loss.up(j); + oq44_bv_weighted(t,j,"upper") = q44_bv_weighted.up(j); + oq44_cost_bv_loss(t,j,"upper") = q44_cost_bv_loss.up(j); + ov44_bv_loss(t,j,"lower") = v44_bv_loss.lo(j); + ov_cost_bv_loss(t,j,"lower") = vm_cost_bv_loss.lo(j); + ov_bv(t,j,landcover44,potnatveg,"lower") = vm_bv.lo(j,landcover44,potnatveg); + ov44_bv_weighted(t,j,"lower") = v44_bv_weighted.lo(j); + oq44_bv_loss(t,j,"lower") = q44_bv_loss.lo(j); + oq44_bv_weighted(t,j,"lower") = q44_bv_weighted.lo(j); + oq44_cost_bv_loss(t,j,"lower") = q44_cost_bv_loss.lo(j); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/44_biodiversity/bv_btc_mar21/preloop.gms b/modules/44_biodiversity/bv_btc_mar21/preloop.gms index 6782031089..e8fdf5e457 100644 --- a/modules/44_biodiversity/bv_btc_mar21/preloop.gms +++ b/modules/44_biodiversity/bv_btc_mar21/preloop.gms @@ -1,9 +1,11 @@ -*** (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK), -*** authors, and contributors see AUTHORS file -*** This file is part of MAgPIE and licensed under GNU AGPL Version 3 -*** or later. See LICENSE file or go to http://www.gnu.org/licenses/ -*** Contact: magpie@pik-potsdam.de +*** | (C) 2008-2023 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 -pc44_bv_weighted(j,landcover44) = 0; -p44_price_bv_loss(t) = f44_price_bv_loss(t,"%c44_price_bv_loss%"); -*** EOF pre.gms *** +v44_bv_weighted.l(j) = 0.3; +m_linear_interpol(p44_price_bv_loss,s44_start_year,s44_target_year,s44_start_price,s44_target_price); +p44_price_bv_loss(t_all)$(m_year(t_all) < s44_start_year) = 0; +display p44_price_bv_loss; diff --git a/modules/44_biodiversity/bv_btc_mar21/realization.gms b/modules/44_biodiversity/bv_btc_mar21/realization.gms index b546f28eab..248d406d22 100644 --- a/modules/44_biodiversity/bv_btc_mar21/realization.gms +++ b/modules/44_biodiversity/bv_btc_mar21/realization.gms @@ -1,14 +1,34 @@ -*** (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK), -*** authors, and contributors see AUTHORS file -*** This file is part of MAgPIE and licensed under GNU AGPL Version 3 -*** or later. See LICENSE file or go to http://www.gnu.org/licenses/ -*** Contact: magpie@pik-potsdam.de +*** | (C) 2008-2023 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 In this realisation biodiversity values are computed for each -*' land cover type. The calculations are based on the Biodiversity Intactness Index (BII). -*' BII values for each land cover type are multiplied by the respective land area and -*' are weighted by cluster-specific range-rarity. This realisation also allows to introduce costs -*' on the loss of the total biodiversity value. +*' @description In this realisation, biodiversity stocks are computed for each land cover type by +*' multiplication with Biodiversity Intactness Index (BII) coefficients from the PREDICTS database. +*' The BII is a relative indicator, wich measures the intactness of local species assemblages (species richness) +*' compared to a reference state (space-for-time approach) (@purvis_chapter_2018). +*' In addition, a range-rarity restoration prioritization layer is used in the optimization. +*' This layer is a spatially explicit indicator of the regional relative range-rarity weighted species richness. +*' derived from the IUCN Red List of Threatened Species (@iucn_iucn_2020). +*' It indicates the global importance of a given cell for species conservation, typically of smaller range, +*' as compared to other cells. +*' Conceptually, the range-rarity weighted biodiversity stock is the product of +*' land cover area (Mha), corresponding BII coefficient [0-1] (unitless) and range-rarity layer [0-1] (unitless). +*' The net biodiversity stock loss (resp. gain) of any land-use change decision, weighted by the range-rarity layer, +*' is taxed (resp. subsidized) within the optimization. +*' The implementation uses the methodology described in @leclere_biodiv_2018 and @leclere_bending_2020. + +*' @limitations The BII indicator has been proposed as a proxy for functional diversity, but here is weighted +*' by an aggegrated conservation priority (range-rarity) layer with no clear linkage to ecosystem functioning +*' outside the priority areas (including areas that stabilise the earth system such as the Amazonas basin or the +*' boreal forest). 'Biodiversity stocks' in this realisation are estimated at cluster level, but optimised at the +*' global scale without spatial reference (besides the range-rarity weight). They are therefore theoretically +*' interchangeable across biomes or other spatial units with different biophysical conditions. +*' Scenario design and results based on this realisation should be handled with special caution, in particular +*' when applied in policy contexts. It is strongly advised to complement a positive price on biodiversity loss +*' (resp. gain) in this realization with targeted protection measures ([35_natveg]). *####################### R SECTION START (PHASES) ############################## $Ifi "%phase%" == "sets" $include "./modules/44_biodiversity/bv_btc_mar21/sets.gms" diff --git a/modules/44_biodiversity/bv_btc_mar21/sets.gms b/modules/44_biodiversity/bv_btc_mar21/sets.gms index 1366ed8ddc..14323240b8 100644 --- a/modules/44_biodiversity/bv_btc_mar21/sets.gms +++ b/modules/44_biodiversity/bv_btc_mar21/sets.gms @@ -1,18 +1,27 @@ -*** (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK), -*** authors, and contributors see AUTHORS file -*** This file is part of MAgPIE and licensed under GNU AGPL Version 3 -*** or later. See LICENSE file or go to http://www.gnu.org/licenses/ -*** Contact: magpie@pik-potsdam.de +*** | (C) 2008-2023 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 - landcover44 land cover classes used in bii calculation - / crop_ann, crop_per, manpast, rangeland, urban, aff_ndc, aff_co2p, primforest, secdforest, other, plant / + landcover44 land cover classes used in bii calculation + / crop_ann, crop_per, manpast, rangeland, urban, aff_ndc, aff_co2p, primforest, secdforest, other, plant / - bii_class44 bii land cover classes - / crop_ann, crop_per, manpast, rangeland, urban, primary, secd_mature, secd_young, timber / + bii_class44 bii coefficent land cover classes + / crop_ann, crop_per, manpast, rangeland, urban, primary, secd_mature, secd_young, timber / - price_biodiv44 price paths biodiv loss - / p0,p1,p1_p10,p10,p10_p100,p1_p1000,p10_p10000 / + bii_class_secd(bii_class44) bii coefficent land cover classes secondary vegetation + / secd_mature, secd_young / + ac_to_bii_class_secd(ac,bii_class_secd) Mapping between forest ageclasses and bii coefficent land cover classes + / (ac0,ac5,ac10,ac15,ac20,ac25,ac30) . (secd_young) + (ac35,ac40,ac45,ac50,ac55,ac60, + ac65,ac70,ac75,ac80,ac85,ac90, + ac95,ac100,ac105,ac110,ac115, + ac120,ac125,ac130,ac135,ac140, + ac145,ac150,ac155,acx) . (secd_mature) / + ; diff --git a/modules/44_biodiversity/module.gms b/modules/44_biodiversity/module.gms index ca5f8e0d12..6157302f8f 100644 --- a/modules/44_biodiversity/module.gms +++ b/modules/44_biodiversity/module.gms @@ -1,19 +1,19 @@ -*** (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK), -*** authors, and contributors see AUTHORS file -*** This file is part of MAgPIE and licensed under GNU AGPL Version 3 -*** or later. See LICENSE file or go to http://www.gnu.org/licenses/ -*** Contact: magpie@pik-potsdam.de +*** | (C) 2008-2023 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 *' @title Biodiversity *' -*' @description The biodiversity module estimates how the changes in land pools -*' affect terrestrial biodiversity. It requires information about the land -*' area of the different land pools provided by all land modules ([30_crop], [31_past], [32_forestry], -*' [34_urban] and [35_natveg]), as well as module [10_land] about the potential natural vegetation. +*' @description The biodiversity module estimates terrestrial biodiversity stocks for +*' all land types in MAgPIE, based on Biodiversity Intactness Index (BII) coefficients. *' *' *' @authors Patrick v. Jeetze, Florian Humpenöder *###################### R SECTION START (MODULETYPES) ########################## +$Ifi "%biodiversity%" == "bii_target" $include "./modules/44_biodiversity/bii_target/realization.gms" $Ifi "%biodiversity%" == "bv_btc_mar21" $include "./modules/44_biodiversity/bv_btc_mar21/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/45_climate/module.gms b/modules/45_climate/module.gms index 5341e19ce7..0d0bb9c05b 100644 --- a/modules/45_climate/module.gms +++ b/modules/45_climate/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/45_climate/static/input.gms b/modules/45_climate/static/input.gms index 97f49aabba..a1a85118c7 100644 --- a/modules/45_climate/static/input.gms +++ b/modules/45_climate/static/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/45_climate/static/realization.gms b/modules/45_climate/static/realization.gms index c08dfa4144..1c907ad5a4 100644 --- a/modules/45_climate/static/realization.gms +++ b/modules/45_climate/static/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/45_climate/static/sets.gms b/modules/45_climate/static/sets.gms index 7295606a42..ee4d675190 100644 --- a/modules/45_climate/static/sets.gms +++ b/modules/45_climate/static/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/50_nr_soil_budget/exoeff_aug16/input.gms b/modules/50_nr_soil_budget/exoeff_aug16/input.gms deleted file mode 100644 index ef7c992e36..0000000000 --- a/modules/50_nr_soil_budget/exoeff_aug16/input.gms +++ /dev/null @@ -1,144 +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 - -* 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_dep_scen history -* options: history - -scalar - s50_fertilizer_costs Costs of fertilizer (USD05MER per tN) / 600 / -; - -* Set-switch for countries affected by country-specific neff scenarios -* Default: all iso countries selected -sets - cropneff_countries(iso) countries to be affected by chosen crop neff scenario / 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 / - pastneff_countries(iso) countries to be affected by chosen pasture neff scenario / 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 / -; - -parameter f50_snupe(t_all,i,scen_neff50) selected scenario values for soil nitrogen uptake efficiency (1) -/ -$ondelim -$include "./modules/50_nr_soil_budget/input/f50_snupe.cs4" -$offdelim -/; - -parameter f50_nue_pasture(t_all,i,scen_neff50) selected scenario values for soil nitrogen uptake efficiency (1) -/ -$ondelim -$include "./modules/50_nr_soil_budget/input/f50_nue_pasture.cs4" -$offdelim -/; - - -parameter f50_nr_fix_ndfa(t_all,i,kcr) Nr fixation rates per Nr in plant biomass (tNr per tNr) -/ -$ondelim -$include "./modules/50_nr_soil_budget/input/f50_ndfa.cs4" -$offdelim -/; - -parameter f50_nitrogen_balanceflow(t_all,i) Balancelfow to account for unrealistically high SNUpEs on croplands (mio. tNr per yr) -/ -$ondelim -$include "./modules/50_nr_soil_budget/input/f50_nitrogen_balanceflow.cs4" -$offdelim -/; - -parameter f50_nitrogen_balanceflow_pasture(t_all,i) Balancelfow to account for unrealistically high NUE on pastures (mio. tNr per yr) -/ -$ondelim -$include "./modules/50_nr_soil_budget/input/f50_nitrogen_balanceflow_pasture.cs4" -$offdelim -/; - - -parameter f50_nr_fix_area(kcr) Nr fixation rates per area (tNr per ha) -/ -$ondelim -$include "./modules/50_nr_soil_budget/input/f50_fixation_freeliving.cs4" -$offdelim -/; - -parameter f50_nr_fixation_rates_pasture(t_all,i) Nr fixation rates per pasture area (tNr per ha) -/ -$ondelim -$include "./modules/50_nr_soil_budget/input/f50_nitrogen_fixation_rates_pasture.cs4" -$offdelim -/; - -table f50_atmospheric_deposition_rates(t_all,j,land,dep_scen50) Nr deposition rates per area (tNr per ha) -$ondelim -$include "./modules/50_nr_soil_budget/input/f50_AtmosphericDepositionRates.cs3" -$offdelim -; diff --git a/modules/50_nr_soil_budget/exoeff_aug16/sets.gms b/modules/50_nr_soil_budget/exoeff_aug16/sets.gms deleted file mode 100644 index f905769f13..0000000000 --- a/modules/50_nr_soil_budget/exoeff_aug16/sets.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 - -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 / - -dep_scen50 Scenario for atmospheric deposition -/history/ - -; 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 79% rename from modules/50_nr_soil_budget/exoeff_aug16/declarations.gms rename to modules/50_nr_soil_budget/macceff_aug22/declarations.gms index b7bcca2ed0..5c286459b3 100644 --- a/modules/50_nr_soil_budget/exoeff_aug16/declarations.gms +++ b/modules/50_nr_soil_budget/macceff_aug22/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -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 97% rename from modules/50_nr_soil_budget/exoeff_aug16/equations.gms rename to modules/50_nr_soil_budget/macceff_aug22/equations.gms index 9f6be49994..6d1d9b8390 100644 --- a/modules/50_nr_soil_budget/exoeff_aug16/equations.gms +++ b/modules/50_nr_soil_budget/macceff_aug22/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -23,6 +23,7 @@ q50_nr_inputs(i2) .. v50_nr_inputs(i2) =e= vm_res_recycling(i2,"nr") + sum((cell(i2,j2),kcr,w), vm_area(j2,kcr,w) * f50_nr_fix_area(kcr)) + + sum(cell(i2,j2),vm_fallow(j2) * f50_nr_fix_area("tece")) + vm_manure_recycling(i2,"nr") + sum(kli, vm_manure(i2, kli, "stubble_grazing","nr")) + vm_nr_inorg_fert_reg(i2,"crop") diff --git a/modules/50_nr_soil_budget/macceff_aug22/input.gms b/modules/50_nr_soil_budget/macceff_aug22/input.gms new file mode 100644 index 0000000000..549ab3b19b --- /dev/null +++ b/modules/50_nr_soil_budget/macceff_aug22/input.gms @@ -0,0 +1,144 @@ +*** | (C) 2008-2023 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 + +* 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 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 +* Default: all iso countries selected +sets + cropneff_countries(iso) countries to be affected by chosen crop neff scenario / 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 / + pastneff_countries(iso) countries to be affected by chosen pasture neff scenario / 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 / +; + +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_base.cs4" +$offdelim +/; + +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_base_pasture.cs4" +$offdelim +/; + + +parameter f50_nr_fix_ndfa(t_all,i,kcr) Nr fixation rates per Nr in plant biomass (tNr per tNr) +/ +$ondelim +$include "./modules/50_nr_soil_budget/input/f50_ndfa.cs4" +$offdelim +/; + +parameter f50_nitrogen_balanceflow(t_all,i) Balancelfow to account for unrealistically high SNUpEs on croplands (mio. tNr per yr) +/ +$ondelim +$include "./modules/50_nr_soil_budget/input/f50_nitrogen_balanceflow.cs4" +$offdelim +/; + +parameter f50_nitrogen_balanceflow_pasture(t_all,i) Balancelfow to account for unrealistically high NUE on pastures (mio. tNr per yr) +/ +$ondelim +$include "./modules/50_nr_soil_budget/input/f50_nitrogen_balanceflow_pasture.cs4" +$offdelim +/; + + +parameter f50_nr_fix_area(kcr) Nr fixation rates per area (tNr per ha) +/ +$ondelim +$include "./modules/50_nr_soil_budget/input/f50_fixation_freeliving.cs4" +$offdelim +/; + +parameter f50_nr_fixation_rates_pasture(t_all,i) Nr fixation rates per pasture area (tNr per ha) +/ +$ondelim +$include "./modules/50_nr_soil_budget/input/f50_nitrogen_fixation_rates_pasture.cs4" +$offdelim +/; + +table f50_atmospheric_deposition_rates(t_all,j,land,dep_scen50) Nr deposition rates per area (tNr per ha) +$ondelim +$include "./modules/50_nr_soil_budget/input/f50_AtmosphericDepositionRates.cs3" +$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 99% rename from modules/50_nr_soil_budget/exoeff_aug16/postsolve.gms rename to modules/50_nr_soil_budget/macceff_aug22/postsolve.gms index 0de48fec48..f11eb63d29 100644 --- a/modules/50_nr_soil_budget/exoeff_aug16/postsolve.gms +++ b/modules/50_nr_soil_budget/macceff_aug22/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/50_nr_soil_budget/exoeff_aug16/presolve.gms b/modules/50_nr_soil_budget/macceff_aug22/preloop.gms similarity index 50% rename from modules/50_nr_soil_budget/exoeff_aug16/presolve.gms rename to modules/50_nr_soil_budget/macceff_aug22/preloop.gms index 69fba9c016..9c3d803f3a 100644 --- a/modules/50_nr_soil_budget/exoeff_aug16/presolve.gms +++ b/modules/50_nr_soil_budget/macceff_aug22/preloop.gms @@ -1,10 +1,12 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 + + * 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..a1ad161ade --- /dev/null +++ b/modules/50_nr_soil_budget/macceff_aug22/presolve.gms @@ -0,0 +1,79 @@ +*** | (C) 2008-2023 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 68% rename from modules/50_nr_soil_budget/exoeff_aug16/realization.gms rename to modules/50_nr_soil_budget/macceff_aug22/realization.gms index 7fce4175b5..7b1c3b437c 100644 --- a/modules/50_nr_soil_budget/exoeff_aug16/realization.gms +++ b/modules/50_nr_soil_budget/macceff_aug22/realization.gms @@ -1,19 +1,20 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 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 85% rename from modules/50_nr_soil_budget/exoeff_aug16/scaling.gms rename to modules/50_nr_soil_budget/macceff_aug22/scaling.gms index bf3e6b7ab8..129f94b5ca 100644 --- a/modules/50_nr_soil_budget/exoeff_aug16/scaling.gms +++ b/modules/50_nr_soil_budget/macceff_aug22/scaling.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/50_nr_soil_budget/macceff_aug22/sets.gms b/modules/50_nr_soil_budget/macceff_aug22/sets.gms new file mode 100644 index 0000000000..bb7b657950 --- /dev/null +++ b/modules/50_nr_soil_budget/macceff_aug22/sets.gms @@ -0,0 +1,28 @@ +*** | (C) 2008-2023 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 + +deposition_source51 Source of atmospheric deposition +/ agricultural_magpie, other_exogenous / + +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..ef0244db1e 100644 --- a/modules/50_nr_soil_budget/module.gms +++ b/modules/50_nr_soil_budget/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -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 5a40cedf4f..0000000000 --- a/modules/50_nr_soil_budget/off/declarations.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 - -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) - -; - -*#################### 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) -; -*##################### 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 cd2ba2a88d..0000000000 --- a/modules/50_nr_soil_budget/off/not_used.txt +++ /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 - -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 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 217eb1bc66..0000000000 --- a/modules/50_nr_soil_budget/off/postsolve.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 - - - -*#################### 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_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_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_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); -*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### - diff --git a/modules/51_nitrogen/ipcc2006_sep16/declarations.gms b/modules/51_nitrogen/ipcc2006_sep16/declarations.gms deleted file mode 100644 index e9c88dc5ea..0000000000 --- a/modules/51_nitrogen/ipcc2006_sep16/declarations.gms +++ /dev/null @@ -1,30 +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) -; - -*#################### 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 217060779d..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") - * f51_ef_n_soil(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)) - * f51_ef_n_soil(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") * f51_ef_n_soil(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)) * f51_ef_n_soil(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 8bbfa16850..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(n_pollutants_direct,emis_source_n_cropsoils51) ipcc emission factors for various emission types X (tX-N per tN) -$ondelim -$include "./modules/51_nitrogen/ipcc2006_sep16/input/f51_ef_n_soil.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 aa8294a325..0000000000 --- a/modules/51_nitrogen/ipcc2006_sep16/input/files +++ /dev/null @@ -1,5 +0,0 @@ -* list of files that are required here -f51_ef_n_soil.cs3 -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/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 88afb08d3c..0000000000 --- a/modules/51_nitrogen/ipcc2006_sep16/sets.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 - -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, man_past, som, rice / - - emis_source_nonitrogen51(emis_source) Emission sources - / rice, ent_ferm, - crop_vegc, crop_litc, crop_soilc, - past_vegc, past_litc, past_soilc, - forestry_vegc, forestry_litc, forestry_soilc, - primforest_vegc, primforest_litc, primforest_soilc, -secdforest_vegc, secdforest_litc, secdforest_soilc, urban_vegc, urban_litc, urban_soilc, - other_vegc, other_litc, other_soilc, - beccs/ -; diff --git a/modules/51_nitrogen/module.gms b/modules/51_nitrogen/module.gms index 8ab09d1211..4b530725d6 100644 --- a/modules/51_nitrogen/module.gms +++ b/modules/51_nitrogen/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/51_nitrogen/off/declarations.gms b/modules/51_nitrogen/off/declarations.gms index bd71e8d992..e94c667137 100644 --- a/modules/51_nitrogen/off/declarations.gms +++ b/modules/51_nitrogen/off/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/51_nitrogen/off/not_used.txt b/modules/51_nitrogen/off/not_used.txt index c80d9923d6..9b2518c015 100644 --- a/modules/51_nitrogen/off/not_used.txt +++ b/modules/51_nitrogen/off/not_used.txt @@ -1,11 +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 -# | 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_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 +8,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/postsolve.gms b/modules/51_nitrogen/off/postsolve.gms index ea979bed48..e2007c1fae 100644 --- a/modules/51_nitrogen/off/postsolve.gms +++ b/modules/51_nitrogen/off/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/38_factor_costs/mixed_feb17/preloop.gms b/modules/51_nitrogen/off/preloop.gms similarity index 74% rename from modules/38_factor_costs/mixed_feb17/preloop.gms rename to modules/51_nitrogen/off/preloop.gms index d23d957206..389dbe3dc7 100644 --- a/modules/38_factor_costs/mixed_feb17/preloop.gms +++ b/modules/51_nitrogen/off/preloop.gms @@ -1,8 +1,8 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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_inv.fx(i)=0; +vm_emissions_reg.fx(i,emis_source,n_pollutants) = 0; diff --git a/modules/51_nitrogen/off/realization.gms b/modules/51_nitrogen/off/realization.gms index 5d6fbbcde5..bbaf6813e7 100644 --- a/modules/51_nitrogen/off/realization.gms +++ b/modules/51_nitrogen/off/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -12,6 +12,6 @@ *####################### R SECTION START (PHASES) ############################## $Ifi "%phase%" == "declarations" $include "./modules/51_nitrogen/off/declarations.gms" -$Ifi "%phase%" == "presolve" $include "./modules/51_nitrogen/off/presolve.gms" +$Ifi "%phase%" == "preloop" $include "./modules/51_nitrogen/off/preloop.gms" $Ifi "%phase%" == "postsolve" $include "./modules/51_nitrogen/off/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/51_nitrogen/rescaled_jan21/declarations.gms b/modules/51_nitrogen/rescaled_jan21/declarations.gms index e9c88dc5ea..1d5d84ad5b 100644 --- a/modules/51_nitrogen/rescaled_jan21/declarations.gms +++ b/modules/51_nitrogen/rescaled_jan21/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -16,6 +16,10 @@ equations 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 (tX-N per tN) +; + *#################### 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) diff --git a/modules/51_nitrogen/rescaled_jan21/equations.gms b/modules/51_nitrogen/rescaled_jan21/equations.gms index 1e22bb42cb..b41734f2a8 100644 --- a/modules/51_nitrogen/rescaled_jan21/equations.gms +++ b/modules/51_nitrogen/rescaled_jan21/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -9,64 +9,70 @@ *' Nitrogeneous emissions stem from manure applied to croplands, inorganic fertilizers, *' crop residues decaying on fields, the burning of agricultural residues, -*' soil organic matter loss, animal waste management, and manure excreted on pasture land. +*' 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. *' *' 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)) - * f51_ef_n_soil(n_pollutants_direct,"man_crop"); + * 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) + 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)) - * f51_ef_n_soil(n_pollutants_direct,"inorg_fert") + * sum(ct, i51_ef_n_soil(ct,i2,n_pollutants_direct,"inorg_fert")) + vm_nr_inorg_fert_reg(i2,"past") / (1-s51_nue_pasture_base) * (1-vm_nr_eff_pasture(i2)) - * f51_ef_n_soil(n_pollutants_direct,"inorg_fert") + * 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) + vm_emissions_reg(i2,"resid",n_pollutants_direct) =e= - vm_res_recycling(i2,"nr") * f51_ef_n_soil(n_pollutants_direct,"resid") + 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)) * f51_ef_n_soil(n_pollutants_direct,"som") + 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 60feaa1b99..58b8db2948 100644 --- a/modules/51_nitrogen/rescaled_jan21/input.gms +++ b/modules/51_nitrogen/rescaled_jan21/input.gms @@ -1,22 +1,22 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 s51_snupe_base assumption on implicit SNuPE in ipcc guidelines (1) / 0.6 /; -Scalar s51_nue_pasture_base assumption on implicit SNuPE in ipcc guidelines (1) / 0.66 /; +Scalar s51_snupe_base assumption on implicit SNuPE in ipcc guidelines (1) / 0.5 /; +Scalar s51_nue_pasture_base assumption on implicit SNuPE in ipcc guidelines (1) / 0.5 /; 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(n_pollutants_direct,emis_source_n_cropsoils51) ipcc emission factors for various emission types X (tX-N per tN) +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/rescaled_jan21/input/f51_ef_n_soil.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 aa8294a325..e4798643b3 100644 --- a/modules/51_nitrogen/rescaled_jan21/input/files +++ b/modules/51_nitrogen/rescaled_jan21/input/files @@ -1,5 +1,6 @@ * list of files that are required here -f51_ef_n_soil.cs3 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/postsolve.gms b/modules/51_nitrogen/rescaled_jan21/postsolve.gms index ac28136098..2e5d8580cd 100644 --- a/modules/51_nitrogen/rescaled_jan21/postsolve.gms +++ b/modules/51_nitrogen/rescaled_jan21/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/50_nr_soil_budget/off/preloop.gms b/modules/51_nitrogen/rescaled_jan21/preloop.gms similarity index 58% rename from modules/50_nr_soil_budget/off/preloop.gms rename to modules/51_nitrogen/rescaled_jan21/preloop.gms index ad3d5d1a28..dea9187223 100644 --- a/modules/50_nr_soil_budget/off/preloop.gms +++ b/modules/51_nitrogen/rescaled_jan21/preloop.gms @@ -1,11 +1,10 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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_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,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/51_nitrogen/rescaled_jan21/presolve.gms b/modules/51_nitrogen/rescaled_jan21/presolve.gms index 1d691591ba..32ae7f50de 100644 --- a/modules/51_nitrogen/rescaled_jan21/presolve.gms +++ b/modules/51_nitrogen/rescaled_jan21/presolve.gms @@ -1,11 +1,16 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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_nonitrogen51,n_pollutants) = 0; - -*** EOF solve.gms *** +* 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/rescaled_jan21/realization.gms b/modules/51_nitrogen/rescaled_jan21/realization.gms index 8c1e2bf896..a743c59f8a 100644 --- a/modules/51_nitrogen/rescaled_jan21/realization.gms +++ b/modules/51_nitrogen/rescaled_jan21/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -22,6 +22,7 @@ $Ifi "%phase%" == "sets" $include "./modules/51_nitrogen/rescaled_jan21/sets.gms $Ifi "%phase%" == "declarations" $include "./modules/51_nitrogen/rescaled_jan21/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/51_nitrogen/rescaled_jan21/input.gms" $Ifi "%phase%" == "equations" $include "./modules/51_nitrogen/rescaled_jan21/equations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/51_nitrogen/rescaled_jan21/preloop.gms" $Ifi "%phase%" == "presolve" $include "./modules/51_nitrogen/rescaled_jan21/presolve.gms" $Ifi "%phase%" == "postsolve" $include "./modules/51_nitrogen/rescaled_jan21/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/51_nitrogen/rescaled_jan21/sets.gms b/modules/51_nitrogen/rescaled_jan21/sets.gms index 88afb08d3c..e955856969 100644 --- a/modules/51_nitrogen/rescaled_jan21/sets.gms +++ b/modules/51_nitrogen/rescaled_jan21/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -13,15 +13,9 @@ sets /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, man_past, som, rice / + / 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 / - emis_source_nonitrogen51(emis_source) Emission sources - / rice, ent_ferm, - crop_vegc, crop_litc, crop_soilc, - past_vegc, past_litc, past_soilc, - forestry_vegc, forestry_litc, forestry_soilc, - primforest_vegc, primforest_litc, primforest_soilc, -secdforest_vegc, secdforest_litc, secdforest_soilc, urban_vegc, urban_litc, urban_soilc, - other_vegc, other_litc, other_soilc, - beccs/ ; diff --git a/modules/52_carbon/input/files b/modules/52_carbon/input/files index 397add8ec0..0a553eff92 100644 --- a/modules/52_carbon/input/files +++ b/modules/52_carbon/input/files @@ -2,3 +2,4 @@ lpj_carbon_stocks.cs3 lpj_carbon_stocks_0.5.mz f52_growth_par.csv +f52_land_carbon_sink_adjust_grassi.cs3 diff --git a/modules/52_carbon/module.gms b/modules/52_carbon/module.gms index a775dee726..d71c31381e 100644 --- a/modules/52_carbon/module.gms +++ b/modules/52_carbon/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,17 +7,11 @@ *' @title Carbon *' -*' @description The carbon module provides annual land-related CO2 emissions for the -*' [56_ghg_policy] module. The carbon module provides carbon density information -*' on cellular level to all land modules ([30_crop], [31_past], [32_forestry], -*' [34_urban] and [35_natveg]), and in return it gets the current carbon stock -*' levels from respective land pools. The module also accounts for changes in -*' terrestrial carbon stocks cause by climate change effects on biosphere [45_climate]. +*' @description The carbon module provides carbon density information for different land types. *' *' *' @authors Benjamin Leon Bodirsky, Florian Humpenoeder, Abhijeet Mishra *###################### R SECTION START (MODULETYPES) ########################## $Ifi "%carbon%" == "normal_dec17" $include "./modules/52_carbon/normal_dec17/realization.gms" -$Ifi "%carbon%" == "off" $include "./modules/52_carbon/off/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/52_carbon/normal_dec17/declarations.gms b/modules/52_carbon/normal_dec17/declarations.gms index 089ee5f1b5..fbe39a46da 100644 --- a/modules/52_carbon/normal_dec17/declarations.gms +++ b/modules/52_carbon/normal_dec17/declarations.gms @@ -1,35 +1,23 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -variables - vm_carbon_stock_change(j,land,c_pools) Change in carbon stocks compared to previous time step (mio. tC per time step) -; - -positive variables - vm_carbon_stock(j,land,c_pools) Carbon stock in vegetation soil and litter for different land types (mio. tC) -; - parameters - pm_carbon_density_ac(t_all,j,ac,ag_pools) Above ground natveg carbon density for age classes and carbon pools (tC per ha) + pm_carbon_density_ac(t_all,j,ac,ag_pools) Above ground natveg carbon density for age classes and carbon pools (tC per ha) pm_carbon_density_ac_forestry(t_all,j,ac,ag_pools) Above ground plantation carbon density for age classes and carbon pools (tC per ha) pc52_carbon_density_start(t_all,j,ag_pools) Above ground carbon density for new land in other land pool (tC per ha) - pcm_carbon_stock(j,land,c_pools) Current carbon in vegetation soil and litter for different land types (mio. tC) + i52_land_carbon_sink(t_all,i) Land carbon sink adjustment factors from Grassi et al 2021 (GtCO2 per year) ; equations - q52_carbon_stock_change(j,land,c_pools) Calculation carbon stock reduction (mio. tC per time step) - q52_co2c_emis(j,emis_co2) Calculation of annual CO2 emissions (mio. tC per yr) + q52_emis_co2_actual(i,emis_oneoff) Calculation of annual CO2 emissions (Tg per yr) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_carbon_stock_change(t,j,land,c_pools,type) Change in carbon stocks compared to previous time step (mio. tC per time step) - ov_carbon_stock(t,j,land,c_pools,type) Carbon stock in vegetation soil and litter for different land types (mio. tC) - oq52_carbon_stock_change(t,j,land,c_pools,type) Calculation carbon stock reduction (mio. tC per time step) - oq52_co2c_emis(t,j,emis_co2,type) Calculation of annual CO2 emissions (mio. tC per yr) + 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 index ed346e60db..9b65d6f7c2 100644 --- a/modules/52_carbon/normal_dec17/equations.gms +++ b/modules/52_carbon/normal_dec17/equations.gms @@ -1,25 +1,19 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -*' Change of carbon stocks is calculated as a difference between the current and -*' the previous time step. - - q52_carbon_stock_change(j2,land,c_pools) .. - vm_carbon_stock_change(j2,land,c_pools) =e= - pcm_carbon_stock(j2,land,c_pools) - vm_carbon_stock(j2,land,c_pools); -*' Annual CO2 emissions are obtained by dividing `vm_carbon_stock_change` by -*' time step length (e.g. 5 or 10 years). +*' @equations + +*** Emissions - q52_co2c_emis(j2,emis_co2) .. - vm_btm_cell(j2,emis_co2,"co2_c") =e= - sum(emis_land(emis_co2,land,c_pools), - vm_carbon_stock_change(j2,land,c_pools)/m_timestep_length); +*' Actual CO2 emissions are calculated based on changes in carbon stocks between timesteps in the interface `vm_carbon_stock`. -*** EOF constraints.gms *** + 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 4a36c13634..93016aeee8 100644 --- a/modules/52_carbon/normal_dec17/input.gms +++ b/modules/52_carbon/normal_dec17/input.gms @@ -1,13 +1,17 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 c52_carbon_scenario nocc -* options: cc (climate change) -* nocc (no climate change) +$setglobal c52_carbon_scenario cc +* options: cc (climate change) +* nocc (no climate change) +* nocc_hist (no climate change after year defined by sm_fix_cc) + +$setglobal c52_land_carbon_sink_rcp RCPBU +* options: RCP19, RCP26, RCP34, RCP45, RCP60, RCPBU table fm_carbon_density(t_all,j,land,c_pools) LPJmL carbon density for land and carbon pools (tC per ha) $ondelim @@ -16,8 +20,13 @@ $offdelim ; $if "%c52_carbon_scenario%" == "nocc" fm_carbon_density(t_all,j,land,c_pools) = fm_carbon_density("y1995",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 @@ -25,3 +34,18 @@ $include "./modules/52_carbon/input/f52_growth_par.csv" $offdelim / ; + +* Note: Land carbon sink adjustment factors from Grassie et al 2021 (DOI 10.1038/s41558-021-01033-6) +* are needed in the post-processing in https://github.com/pik-piam/magpie4/blob/master/R/reportEmissions.R +* To facilitate the choice of the corresponding RCP, the adjustment factors are read-in here and +* stored in i52_land_carbon_sink for use in the R post-processing. +* Land carbon sink adjustment factors are NOT used within MAgPIE. +$onEmpty +table f52_land_carbon_sink(t_all,i,rcp52) Land carbon sink adjustment factors from Grassi et al 2021 (GtCO2 per year) +$ondelim +$if exist "./modules/52_carbon/input/f52_land_carbon_sink_adjust_grassi.cs3" $include "./modules/52_carbon/input/f52_land_carbon_sink_adjust_grassi.cs3" +$offdelim +; +$offEmpty + +i52_land_carbon_sink(t_all,i) = f52_land_carbon_sink(t_all,i,"%c52_land_carbon_sink_rcp%"); diff --git a/modules/52_carbon/normal_dec17/postsolve.gms b/modules/52_carbon/normal_dec17/postsolve.gms index bbb6016658..9b07173132 100644 --- a/modules/52_carbon/normal_dec17/postsolve.gms +++ b/modules/52_carbon/normal_dec17/postsolve.gms @@ -1,27 +1,14 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -pcm_carbon_stock(j,land,c_pools) = vm_carbon_stock.l(j,land,c_pools); - *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_carbon_stock_change(t,j,land,c_pools,"marginal") = vm_carbon_stock_change.m(j,land,c_pools); - ov_carbon_stock(t,j,land,c_pools,"marginal") = vm_carbon_stock.m(j,land,c_pools); - oq52_carbon_stock_change(t,j,land,c_pools,"marginal") = q52_carbon_stock_change.m(j,land,c_pools); - oq52_co2c_emis(t,j,emis_co2,"marginal") = q52_co2c_emis.m(j,emis_co2); - ov_carbon_stock_change(t,j,land,c_pools,"level") = vm_carbon_stock_change.l(j,land,c_pools); - ov_carbon_stock(t,j,land,c_pools,"level") = vm_carbon_stock.l(j,land,c_pools); - oq52_carbon_stock_change(t,j,land,c_pools,"level") = q52_carbon_stock_change.l(j,land,c_pools); - oq52_co2c_emis(t,j,emis_co2,"level") = q52_co2c_emis.l(j,emis_co2); - ov_carbon_stock_change(t,j,land,c_pools,"upper") = vm_carbon_stock_change.up(j,land,c_pools); - ov_carbon_stock(t,j,land,c_pools,"upper") = vm_carbon_stock.up(j,land,c_pools); - oq52_carbon_stock_change(t,j,land,c_pools,"upper") = q52_carbon_stock_change.up(j,land,c_pools); - oq52_co2c_emis(t,j,emis_co2,"upper") = q52_co2c_emis.up(j,emis_co2); - ov_carbon_stock_change(t,j,land,c_pools,"lower") = vm_carbon_stock_change.lo(j,land,c_pools); - ov_carbon_stock(t,j,land,c_pools,"lower") = vm_carbon_stock.lo(j,land,c_pools); - oq52_carbon_stock_change(t,j,land,c_pools,"lower") = q52_carbon_stock_change.lo(j,land,c_pools); - oq52_co2c_emis(t,j,emis_co2,"lower") = q52_co2c_emis.lo(j,emis_co2); + 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/presolve.gms b/modules/52_carbon/normal_dec17/presolve.gms deleted file mode 100644 index 0a98cd1620..0000000000 --- a/modules/52_carbon/normal_dec17/presolve.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 - -vm_carbon_stock.l(j,land,ag_pools) = pcm_carbon_stock(j,land,ag_pools); diff --git a/modules/52_carbon/normal_dec17/realization.gms b/modules/52_carbon/normal_dec17/realization.gms index 6d417bc2be..4b487eab98 100644 --- a/modules/52_carbon/normal_dec17/realization.gms +++ b/modules/52_carbon/normal_dec17/realization.gms @@ -1,33 +1,25 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -*' calculates annual land-related CO2 emissions as -*' difference of carbon stocks between the current and the previous time step. -*' Land-related CO2 emissions include CO2 emissions from land-use change as well as -*' changes in carbon stocks in the terrestrial biosphere due to climate change -*' (the later is only included if `c52_carbon_scenario = "cc"`). -*' The realization provides carbon density information on cellular level to all -*' land modules ([30_crop], [31_past], [32_forestry], [34_urban] and [35_natveg]), -*' which return land type specific carbon stocks to the carbon module. The realization +*' @description +*' This realization provides carbon density information on cellular level to all +*' land modules ([30_crop], [31_past], [32_forestry], [34_urban] and [35_natveg]). +*' The realization *' also provides carbon density for different age-classes, based on a *' chapman-richards volume growth model, to the land modules [32_forestry] and [35_natveg] *' [@humpenoder_investigating_2014 and @braakhekke_modelling_2019]. -*' @limitations CO2 emissions in the 1st time step (1995) are not meaningful because -*' carbon stock information prior to 1995 is not available +*' @limitations *####################### R SECTION START (PHASES) ############################## $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%" == "scaling" $include "./modules/52_carbon/normal_dec17/scaling.gms" $Ifi "%phase%" == "start" $include "./modules/52_carbon/normal_dec17/start.gms" -$Ifi "%phase%" == "presolve" $include "./modules/52_carbon/normal_dec17/presolve.gms" $Ifi "%phase%" == "postsolve" $include "./modules/52_carbon/normal_dec17/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/52_carbon/normal_dec17/scaling.gms b/modules/52_carbon/normal_dec17/scaling.gms deleted file mode 100644 index c147ef721f..0000000000 --- a/modules/52_carbon/normal_dec17/scaling.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 - -vm_carbon_stock.scale(j,land,c_pools) = 10e3; diff --git a/modules/52_carbon/normal_dec17/sets.gms b/modules/52_carbon/normal_dec17/sets.gms index 9af035b23b..90b787e306 100644 --- a/modules/52_carbon/normal_dec17/sets.gms +++ b/modules/52_carbon/normal_dec17/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,8 +6,6 @@ *** | Contact: magpie@pik-potsdam.de sets - -ag_pools(c_pools) Above ground carbon pools - /vegc,litc/ - + rcp52 climate change impact sceanrios + / RCP19, RCP26, RCP34, RCP45, RCP60, RCPBU / ; diff --git a/modules/52_carbon/normal_dec17/start.gms b/modules/52_carbon/normal_dec17/start.gms index ae4533864b..fc7e67e3ff 100644 --- a/modules/52_carbon/normal_dec17/start.gms +++ b/modules/52_carbon/normal_dec17/start.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -9,24 +9,19 @@ pc52_carbon_density_start(t_all,j,"vegc") = 0; pc52_carbon_density_start(t_all,j,"litc") = fm_carbon_density(t_all,j,"past","litc"); +*** Forestry + *calculate vegetation age-class carbon density in current time step with chapman richards equation pm_carbon_density_ac_forestry(t_all,j,ac,"vegc") = m_growth_vegc(pc52_carbon_density_start(t_all,j,"vegc"),fm_carbon_density(t_all,j,"other","vegc"),sum(clcl,pm_climate_class(j,clcl)*f52_growth_par(clcl,"k","plantations")),sum(clcl,pm_climate_class(j,clcl)*f52_growth_par(clcl,"m","plantations")),(ord(ac)-1)); -*calculate litter and soil carbon density based on linear growth funktion: carbon_density(ac) = intercept + slope*ac (20 year time horizon taken from IPCC) +*calculate litter carbon density based on linear growth funktion: carbon_density(ac) = intercept + slope*ac (20 year time horizon taken from IPCC) pm_carbon_density_ac_forestry(t_all,j,ac,"litc") = m_growth_litc_soilc(pc52_carbon_density_start(t_all,j,"litc"),fm_carbon_density(t_all,j,"other","litc"),(ord(ac)-1)); - -**** Natveg -* starting value of above ground carbon stocks 1995 is only an estimate. -* ATTENTION: emissions in 1995 are not meaningful -vm_carbon_stock.l(j,land,ag_pools) = fm_carbon_density("y1995",j,land,ag_pools)*pcm_land(j,land); -pcm_carbon_stock(j,land,ag_pools) = vm_carbon_stock.l(j,land,ag_pools); +*** Natveg *calculate vegetation age-class carbon density in current time step with chapman richards equation pm_carbon_density_ac(t,j,ac,"vegc") = m_growth_vegc(pc52_carbon_density_start(t,j,"vegc"),fm_carbon_density(t,j,"other","vegc"),sum(clcl,pm_climate_class(j,clcl)*f52_growth_par(clcl,"k","natveg")),sum(clcl,pm_climate_class(j,clcl)*f52_growth_par(clcl,"m","natveg")),(ord(ac)-1)); -*calculate litter and soil carbon density based on linear growth funktion: carbon_density(ac) = intercept + slope*ac (20 year time horizon taken from IPCC) +*calculate litter carbon density based on linear growth funktion: carbon_density(ac) = intercept + slope*ac (20 year time horizon taken from IPCC) pm_carbon_density_ac(t,j,ac,"litc") = m_growth_litc_soilc(pc52_carbon_density_start(t,j,"litc"),fm_carbon_density(t,j,"other","litc"),(ord(ac)-1)); - -*** EOF pre.gms *** diff --git a/modules/52_carbon/off/declarations.gms b/modules/52_carbon/off/declarations.gms deleted file mode 100644 index ce1b3999bb..0000000000 --- a/modules/52_carbon/off/declarations.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 - -* Here you can put your additional declarations -parameters - pm_carbon_density_ac(t,j,ac,ag_pools) Above ground natveg carbon density for age classes and carbon pools (tC per ha) - pm_carbon_density_ac_forestry(t,j,ac,ag_pools) Above ground plantation carbon density for age classes and carbon pools (tC per ha) - pcm_carbon_stock(j,land,c_pools) Current carbon in vegetation soil and litter for different land types (mio tC) -; - -variable - vm_carbon_stock_change(j,land,c_pools) Change in carbon stocks compared to previous time step (mio. tC per time step) -; - -positive variables - vm_carbon_stock(j,land,c_pools) Carbon in vegetation soil and litter for different land types (mio tC) -; - -*#################### R SECTION START (OUTPUT DECLARATIONS) #################### -parameters - ov_carbon_stock_change(t,j,land,c_pools,type) Change in carbon stocks compared to previous time step (mio. tC per time step) - ov_carbon_stock(t,j,land,c_pools,type) Carbon in vegetation soil and litter for different land types (mio tC) -; -*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/52_carbon/off/input.gms b/modules/52_carbon/off/input.gms deleted file mode 100644 index d6e04274e9..0000000000 --- a/modules/52_carbon/off/input.gms +++ /dev/null @@ -1,18 +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 - -$setglobal c52_carbon_scenario nocc -* options: cc (climate change) -* nocc (no climate change) - -table fm_carbon_density(t_all,j,land,c_pools) LPJmL carbon density for land and carbon pools (tC per ha) -$ondelim -$include "./modules/52_carbon/input/lpj_carbon_stocks.cs3" -$offdelim -; -$if "%c52_carbon_scenario%" == "nocc" fm_carbon_density(t_all,j,land,c_pools) = fm_carbon_density("y1995",j,land,c_pools); -m_fillmissingyears(fm_carbon_density,"j,land,c_pools"); diff --git a/modules/52_carbon/off/not_used.txt b/modules/52_carbon/off/not_used.txt deleted file mode 100644 index be76fe2b23..0000000000 --- a/modules/52_carbon/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 -pm_climate_class,input,not needed -pcm_land,input,not needed -f52_growth_par, input, not used diff --git a/modules/52_carbon/off/postsolve.gms b/modules/52_carbon/off/postsolve.gms deleted file mode 100644 index c9b04e6a64..0000000000 --- a/modules/52_carbon/off/postsolve.gms +++ /dev/null @@ -1,19 +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_carbon_stock_change(t,j,land,c_pools,"marginal") = vm_carbon_stock_change.m(j,land,c_pools); - ov_carbon_stock(t,j,land,c_pools,"marginal") = vm_carbon_stock.m(j,land,c_pools); - ov_carbon_stock_change(t,j,land,c_pools,"level") = vm_carbon_stock_change.l(j,land,c_pools); - ov_carbon_stock(t,j,land,c_pools,"level") = vm_carbon_stock.l(j,land,c_pools); - ov_carbon_stock_change(t,j,land,c_pools,"upper") = vm_carbon_stock_change.up(j,land,c_pools); - ov_carbon_stock(t,j,land,c_pools,"upper") = vm_carbon_stock.up(j,land,c_pools); - ov_carbon_stock_change(t,j,land,c_pools,"lower") = vm_carbon_stock_change.lo(j,land,c_pools); - ov_carbon_stock(t,j,land,c_pools,"lower") = vm_carbon_stock.lo(j,land,c_pools); -*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### - diff --git a/modules/52_carbon/off/preloop.gms b/modules/52_carbon/off/preloop.gms deleted file mode 100644 index b257fba15b..0000000000 --- a/modules/52_carbon/off/preloop.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 - -pm_carbon_density_ac(t,j,ac,c_pools) = 0; -pm_carbon_density_ac_forestry(t,j,ac,c_pools) = 0; diff --git a/modules/52_carbon/off/presolve.gms b/modules/52_carbon/off/presolve.gms deleted file mode 100644 index 3f63376fdb..0000000000 --- a/modules/52_carbon/off/presolve.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_carbon_stock.fx(j,land,c_pools) = 0; -vm_carbon_stock_change.fx(j,land,c_pools) = 0; -vm_btm_cell.fx(j,emis_co2,"co2_c") = 0; diff --git a/modules/52_carbon/off/realization.gms b/modules/52_carbon/off/realization.gms deleted file mode 100644 index 8cfab1af3c..0000000000 --- a/modules/52_carbon/off/realization.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 - -*' @description In this realization -*' annual land-related CO2 emissions are assumed zero. - -*' @limitations CO2 emissions are assumed zero - -*####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/52_carbon/off/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/52_carbon/off/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/52_carbon/off/input.gms" -$Ifi "%phase%" == "preloop" $include "./modules/52_carbon/off/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/52_carbon/off/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/52_carbon/off/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 80% rename from modules/53_methane/ipcc2006_flexreg_apr16/declarations.gms rename to modules/53_methane/ipcc2006_aug22/declarations.gms index 859c36076f..aa665a4d45 100644 --- a/modules/53_methane/ipcc2006_flexreg_apr16/declarations.gms +++ b/modules/53_methane/ipcc2006_aug22/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -10,6 +10,7 @@ equations q53_emissionbal_ch4_ent_ferm(i) Detailed ch4 constraint for enteric fermentation before technical mitigation (tCH4) q53_emissionbal_ch4_awms(i) Detailed ch4 constraint for animal waste management systems before technical mitigation (tCH4) q53_emissionbal_ch4_rice(i) Detailed ch4 constraint for rice before technical mitigation (tCH4) + q53_emissions_resid_burn(i) Estimates ch4 emissions from the burning of agricultural residues (Mt X-N) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### @@ -17,5 +18,6 @@ parameters oq53_emissionbal_ch4_ent_ferm(t,i,type) Detailed ch4 constraint for enteric fermentation before technical mitigation (tCH4) oq53_emissionbal_ch4_awms(t,i,type) Detailed ch4 constraint for animal waste management systems before technical mitigation (tCH4) oq53_emissionbal_ch4_rice(t,i,type) Detailed ch4 constraint for rice before technical mitigation (tCH4) + oq53_emissions_resid_burn(t,i,type) Estimates ch4 emissions from the burning of agricultural residues (Mt X-N) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/53_methane/ipcc2006_flexreg_apr16/equations.gms b/modules/53_methane/ipcc2006_aug22/equations.gms similarity index 62% rename from modules/53_methane/ipcc2006_flexreg_apr16/equations.gms rename to modules/53_methane/ipcc2006_aug22/equations.gms index 7d06234afa..703fd8d953 100644 --- a/modules/53_methane/ipcc2006_flexreg_apr16/equations.gms +++ b/modules/53_methane/ipcc2006_aug22/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,8 +7,8 @@ *' @equations *' -*' We calculate methane emissions before technical mitigation(btm) in each regions (reg) (`vm_btm_reg`) -*' from the aforementioned three sources of emissions step-by-step in the following three equations. +*' 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. *' The equation shows that total methane from enteric fermentation depends on @@ -19,35 +19,37 @@ *' 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` -*' ( with high energy contents, for example, temperate and tropical cereals, maize,pulses) or `k_noconc53` +*' (with high energy contents, for example, temperate and tropical cereals, maize,pulses) or `k_noconc53` *' (for example, pasture, fodder,crop residues). The purpose of livestock raising `k_ruminants53` *' can be either for meat (`livst_rum`) or for milk (`livst_milk`). The parameter `fm_attributes` *' in MAgPIE captures a content of some thing (e.g. gross energy-ge, dry matter-dm, reactive nitrogen-nr) *' in a given commodity. -*' These attributes or coefficients are then used in content conversions in may modules of the model. +*' These attributes or coefficients are then used in content conversions in many modules of the model. *' *' The second equation of this realization is meant to calculate CH4 emission from *' animal waste management (AWM). In general, AWM depends on the amount of manure -*' excreted in confinements (such as stables or barns) (see [55_awms])and its +*' excreted in confinements (such as stables or barns) (see [55_awms]) and its *' subsequent storage. *' We calculate the CH4 emission per unit of nitrogen in manure based on @ipcc_2006_2006 -*' and Manure Management Emissions from @FAOSTAT . -*' See the module for more on calculation of methane from animal waste(or manure) . +*' and Manure Management Emissions from @FAOSTAT. +*' 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,6 +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 +*' National Greenhouse Gas Inventories, Eq. 2.27. + + q53_emissions_resid_burn(i2) .. + 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 77% rename from modules/53_methane/ipcc2006_flexreg_apr16/input.gms rename to modules/53_methane/ipcc2006_aug22/input.gms index a37e01e80b..a2f9fcd702 100644 --- a/modules/53_methane/ipcc2006_flexreg_apr16/input.gms +++ b/modules/53_methane/ipcc2006_aug22/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -14,9 +14,14 @@ $offdelim ; parameter f53_ef_ch4_rice(t_all,i) CH4 emission per ha rice (CH4 per ha) - / +/ $ondelim $include "./modules/53_methane/input/f53_EFch4Rice.cs4" $offdelim - / +/ ; + +scalar + s53_ef_ch4_res_ag_burn CH4 emissions from the burning of agricultural residues (tCH4 per tDM) / 0.0027 / +; + diff --git a/modules/53_methane/ipcc2006_flexreg_apr16/postsolve.gms b/modules/53_methane/ipcc2006_aug22/postsolve.gms similarity index 79% rename from modules/53_methane/ipcc2006_flexreg_apr16/postsolve.gms rename to modules/53_methane/ipcc2006_aug22/postsolve.gms index d651bdba4c..7264e40320 100644 --- a/modules/53_methane/ipcc2006_flexreg_apr16/postsolve.gms +++ b/modules/53_methane/ipcc2006_aug22/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -11,14 +11,18 @@ oq53_emissionbal_ch4_ent_ferm(t,i,"marginal") = q53_emissionbal_ch4_ent_ferm.m(i); oq53_emissionbal_ch4_awms(t,i,"marginal") = q53_emissionbal_ch4_awms.m(i); oq53_emissionbal_ch4_rice(t,i,"marginal") = q53_emissionbal_ch4_rice.m(i); + oq53_emissions_resid_burn(t,i,"marginal") = q53_emissions_resid_burn.m(i); oq53_emissionbal_ch4_ent_ferm(t,i,"level") = q53_emissionbal_ch4_ent_ferm.l(i); oq53_emissionbal_ch4_awms(t,i,"level") = q53_emissionbal_ch4_awms.l(i); oq53_emissionbal_ch4_rice(t,i,"level") = q53_emissionbal_ch4_rice.l(i); + oq53_emissions_resid_burn(t,i,"level") = q53_emissions_resid_burn.l(i); oq53_emissionbal_ch4_ent_ferm(t,i,"upper") = q53_emissionbal_ch4_ent_ferm.up(i); oq53_emissionbal_ch4_awms(t,i,"upper") = q53_emissionbal_ch4_awms.up(i); oq53_emissionbal_ch4_rice(t,i,"upper") = q53_emissionbal_ch4_rice.up(i); + oq53_emissions_resid_burn(t,i,"upper") = q53_emissions_resid_burn.up(i); oq53_emissionbal_ch4_ent_ferm(t,i,"lower") = q53_emissionbal_ch4_ent_ferm.lo(i); oq53_emissionbal_ch4_awms(t,i,"lower") = q53_emissionbal_ch4_awms.lo(i); oq53_emissionbal_ch4_rice(t,i,"lower") = q53_emissionbal_ch4_rice.lo(i); + oq53_emissions_resid_burn(t,i,"lower") = q53_emissions_resid_burn.lo(i); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/10_land/feb15/preloop.gms b/modules/53_methane/ipcc2006_aug22/preloop.gms similarity index 59% rename from modules/10_land/feb15/preloop.gms rename to modules/53_methane/ipcc2006_aug22/preloop.gms index 891d4c069a..63ccb84eab 100644 --- a/modules/10_land/feb15/preloop.gms +++ b/modules/53_methane/ipcc2006_aug22/preloop.gms @@ -1,12 +1,10 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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_land_transition.fx(j) = 0; - -vm_croplandexpansion.fx(j,land) = 0; -vm_croplandreduction.fx(j,land) = 0; +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 75% rename from modules/53_methane/ipcc2006_flexreg_apr16/realization.gms rename to modules/53_methane/ipcc2006_aug22/realization.gms index 96cf0dfac6..c22f060cd3 100644 --- a/modules/53_methane/ipcc2006_flexreg_apr16/realization.gms +++ b/modules/53_methane/ipcc2006_aug22/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -8,17 +8,18 @@ *' @description This module realization calculates methane from different *' agricultural sources based on the @ipcc_2006_2006. *' Methane emission sources considered in the module are enteric fermentation, -*' animal waste management, and rice. +*' animal waste management, and rice. Further, methane emissions from the burning +*' of agricultural residues is incorporated, with emissions factors taken +*' from the IPCC 2019 revision. *' @limitations CH4 emissions from animal waste management may be *' 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%" == "presolve" $include "./modules/53_methane/ipcc2006_flexreg_apr16/presolve.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 60% rename from modules/53_methane/ipcc2006_flexreg_apr16/sets.gms rename to modules/53_methane/ipcc2006_aug22/sets.gms index 443592d2a0..fe9c2c498e 100644 --- a/modules/53_methane/ipcc2006_flexreg_apr16/sets.gms +++ b/modules/53_methane/ipcc2006_aug22/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -19,16 +19,7 @@ k_noconc53(kall) non-concentrates k_ruminants53(kli) ruminant subset / livst_rum, livst_milk / -emis_source_nomethane53(emis_source) emission sources - / inorg_fert, man_crop, resid, man_past, som, - resid_burn, - crop_vegc, crop_litc, crop_soilc, - past_vegc, past_litc, past_soilc, - forestry_vegc, forestry_litc, forestry_soilc, - primforest_vegc, primforest_litc, primforest_soilc, - secdforest_vegc, secdforest_litc, secdforest_soilc, - urban_vegc, urban_litc, urban_soilc, - other_vegc, other_litc, other_soilc, - beccs / +emis_source_methane53(emis_source) emission sources + / awms, rice, ent_ferm, resid_burn / ; diff --git a/modules/53_methane/ipcc2006_flexreg_apr16/presolve.gms b/modules/53_methane/ipcc2006_flexreg_apr16/presolve.gms deleted file mode 100644 index d19282574d..0000000000 --- a/modules/53_methane/ipcc2006_flexreg_apr16/presolve.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 - - vm_btm_reg.fx(i,emis_source_nomethane53,"ch4") = 0; diff --git a/modules/53_methane/module.gms b/modules/53_methane/module.gms index 28226b83f4..0585be099f 100644 --- a/modules/53_methane/module.gms +++ b/modules/53_methane/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -9,11 +9,12 @@ *' @description This module calculates methane emissions according *' to 2006 IPCC Guidelines of National Greenhouse Gas Inventories. -*' See also @ipcc_2006_2006. - +*' See also @ipcc_2006_2006. Further, using the IPCC 2019 revision, +*' this module calculations CH4 emissions from the burning of +*' agricultural residues. *' @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 8c085cb53d..2c44ab6c1a 100644 --- a/modules/53_methane/off/not_used.txt +++ b/modules/53_methane/off/not_used.txt @@ -1,12 +1,7 @@ -# | (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_area,input,not needed vm_dem_feed,input,not needed -fm_attributes,input, not needed +fm_attributes,input,not needed vm_manure,input,questionnaire +vm_res_ag_burn,input,not needed +im_maccs_mitigation,input,questionnaire diff --git a/modules/53_methane/off/presolve.gms b/modules/53_methane/off/preloop.gms similarity index 78% rename from modules/53_methane/off/presolve.gms rename to modules/53_methane/off/preloop.gms index e86016120d..db700d40c7 100644 --- a/modules/53_methane/off/presolve.gms +++ b/modules/53_methane/off/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -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/53_methane/off/realization.gms b/modules/53_methane/off/realization.gms index 612ed43527..1ef8234cc1 100644 --- a/modules/53_methane/off/realization.gms +++ b/modules/53_methane/off/realization.gms @@ -1,17 +1,19 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 is simple and accounts no methane emissions. -*' We acknowledge this is unrealistic. It is presented here for mere comparison and completeness. -*' +*' @description No representation of methane emissions within the model. While unrealistic, this +*' realization may be useful for comparisons and completeness. When used, this realization +*' sets all emissions from enteric fermentation, animal waste management, rice cultivation, and +*' agricultural residue burning to 0. + *' @limitations It is unrealistic to consider zero methane emissions and to ignore it from a model *' such as MAgPIE which is meant to assess impacts of agricultural production on environment. *####################### R SECTION START (PHASES) ############################## $Ifi "%phase%" == "sets" $include "./modules/53_methane/off/sets.gms" -$Ifi "%phase%" == "presolve" $include "./modules/53_methane/off/presolve.gms" +$Ifi "%phase%" == "preloop" $include "./modules/53_methane/off/preloop.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/53_methane/off/sets.gms b/modules/53_methane/off/sets.gms index b35da9a953..552b65bfe3 100644 --- a/modules/53_methane/off/sets.gms +++ b/modules/53_methane/off/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/54_phosphorus/module.gms b/modules/54_phosphorus/module.gms index c0d60cad22..e5beef2fe6 100644 --- a/modules/54_phosphorus/module.gms +++ b/modules/54_phosphorus/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/54_phosphorus/off/declarations.gms b/modules/54_phosphorus/off/declarations.gms index b9f968eddd..7ade854edf 100644 --- a/modules/54_phosphorus/off/declarations.gms +++ b/modules/54_phosphorus/off/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/54_phosphorus/off/not_used.txt b/modules/54_phosphorus/off/not_used.txt deleted file mode 100644 index da77c77f60..0000000000 --- a/modules/54_phosphorus/off/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/54_phosphorus/off/postsolve.gms b/modules/54_phosphorus/off/postsolve.gms index bd836c8e2b..d64ac8bae2 100644 --- a/modules/54_phosphorus/off/postsolve.gms +++ b/modules/54_phosphorus/off/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/54_phosphorus/off/preloop.gms b/modules/54_phosphorus/off/preloop.gms index 61a4252d85..6111470c5f 100644 --- a/modules/54_phosphorus/off/preloop.gms +++ b/modules/54_phosphorus/off/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/54_phosphorus/off/realization.gms b/modules/54_phosphorus/off/realization.gms index a3297de220..7a736bf2fe 100644 --- a/modules/54_phosphorus/off/realization.gms +++ b/modules/54_phosphorus/off/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/55_awms/ipcc2006_aug16/declarations.gms b/modules/55_awms/ipcc2006_aug16/declarations.gms index 5ed6103ed8..2f12f77b0d 100644 --- a/modules/55_awms/ipcc2006_aug16/declarations.gms +++ b/modules/55_awms/ipcc2006_aug16/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -10,8 +10,8 @@ parameters i55_manure_recycling_share(i,kli,awms_conf,npk) Share of manure recycled (tNr per tNr) ic55_manure_fuel_shr(i,kli) Share of manure excreted on pastures used for fuel (tNr per tNr) ic55_awms_shr(i,kli,awms_conf) Share of manure Nr managed in each animal waste management systems (tNr per tNr) - p55_region_shr(t_all,i) AWM scenario share of the region (1) - p55_country_dummy(iso) Dummy parameter indicating whether country is affected by selected awm scenario (1) + p55_region_shr(t_all,i) AWM scenario share of the region (1) + p55_country_dummy(iso) Dummy parameter indicating whether country is affected by selected awm scenario (1) ; diff --git a/modules/55_awms/ipcc2006_aug16/equations.gms b/modules/55_awms/ipcc2006_aug16/equations.gms index 89f6e5397e..02d63f3754 100644 --- a/modules/55_awms/ipcc2006_aug16/equations.gms +++ b/modules/55_awms/ipcc2006_aug16/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -29,7 +29,7 @@ + sum(kap,vm_dem_feed(i2,kli,kap) * fm_attributes(npk,kap)) + sum(ksd,vm_dem_feed(i2,kli,ksd) * fm_attributes(npk,ksd)) + sum(kres,vm_dem_feed(i2,kli,kres) * fm_attributes(npk,kres) - *(1-(1-sum(ct,im_development_state(ct,i2)))*0.25)) + *(1-(1-sum(ct,im_development_state(ct,i2)))*0.25)) ; *' b) grazing animals on pastures where the manure stays on pastures @@ -59,7 +59,7 @@ *' on the development state and has to be subtracted from the residues fed to confined animals. *' We assume that in developing regions 25% of residues are grazed by animals on stubble fields, *' whereas stubble grazing is assumed to not occur in developed regions. - + *' The manure is estimated by subtracting from feed a certain share which is *' incorporated into animal biomass. This share depends on the productivity of *' the animal and is calculated in the preprocessing, also for computational diff --git a/modules/55_awms/ipcc2006_aug16/input.gms b/modules/55_awms/ipcc2006_aug16/input.gms index c6188b7409..a251bc56aa 100644 --- a/modules/55_awms/ipcc2006_aug16/input.gms +++ b/modules/55_awms/ipcc2006_aug16/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -16,30 +16,30 @@ $setglobal c55_scen_conf_noselect ssp2 * Default: all iso countries selected sets scen_countries55(iso) countries to be affected by awm scenario / 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 / + 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 / ; parameter f55_awms_recycling_share(i,kli,awms_conf) share of Nr in confinement recycled (tNr per tNr) @@ -58,7 +58,7 @@ $offdelim / ; -parameter f55_manure_fuel_shr(t_all,i,kli,gdp_scen09) share of Nr in confinement recycled (tNr per tNr) +parameter f55_manure_fuel_shr(t_all,i,kli,pop_gdp_scen09) share of Nr in confinement recycled (tNr per tNr) / $ondelim $include "./modules/55_awms/ipcc2006_aug16/input/f55_manure_fuel_shr.cs4" diff --git a/modules/55_awms/ipcc2006_aug16/nl_fix.gms b/modules/55_awms/ipcc2006_aug16/nl_fix.gms index e06a29124a..e9dfdad391 100644 --- a/modules/55_awms/ipcc2006_aug16/nl_fix.gms +++ b/modules/55_awms/ipcc2006_aug16/nl_fix.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/55_awms/ipcc2006_aug16/nl_relax.gms b/modules/55_awms/ipcc2006_aug16/nl_relax.gms index e06a29124a..e9dfdad391 100644 --- a/modules/55_awms/ipcc2006_aug16/nl_relax.gms +++ b/modules/55_awms/ipcc2006_aug16/nl_relax.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/55_awms/ipcc2006_aug16/nl_release.gms b/modules/55_awms/ipcc2006_aug16/nl_release.gms index e06a29124a..e9dfdad391 100644 --- a/modules/55_awms/ipcc2006_aug16/nl_release.gms +++ b/modules/55_awms/ipcc2006_aug16/nl_release.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/55_awms/ipcc2006_aug16/postsolve.gms b/modules/55_awms/ipcc2006_aug16/postsolve.gms index 099bab4aa6..5342c7c7f0 100644 --- a/modules/55_awms/ipcc2006_aug16/postsolve.gms +++ b/modules/55_awms/ipcc2006_aug16/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/55_awms/ipcc2006_aug16/preloop.gms b/modules/55_awms/ipcc2006_aug16/preloop.gms index dcdf0269c9..f27c059366 100644 --- a/modules/55_awms/ipcc2006_aug16/preloop.gms +++ b/modules/55_awms/ipcc2006_aug16/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/55_awms/ipcc2006_aug16/presolve.gms b/modules/55_awms/ipcc2006_aug16/presolve.gms index c6e8e143f7..15ad3db493 100644 --- a/modules/55_awms/ipcc2006_aug16/presolve.gms +++ b/modules/55_awms/ipcc2006_aug16/presolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/55_awms/ipcc2006_aug16/realization.gms b/modules/55_awms/ipcc2006_aug16/realization.gms index 01479af633..522f9ec9c0 100644 --- a/modules/55_awms/ipcc2006_aug16/realization.gms +++ b/modules/55_awms/ipcc2006_aug16/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/55_awms/ipcc2006_aug16/sets.gms b/modules/55_awms/ipcc2006_aug16/sets.gms index 925d887434..8c0b893185 100644 --- a/modules/55_awms/ipcc2006_aug16/sets.gms +++ b/modules/55_awms/ipcc2006_aug16/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/55_awms/module.gms b/modules/55_awms/module.gms index 389692d08a..80c6e557d8 100644 --- a/modules/55_awms/module.gms +++ b/modules/55_awms/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/55_awms/off/declarations.gms b/modules/55_awms/off/declarations.gms index f37c1718f2..a947d4c989 100644 --- a/modules/55_awms/off/declarations.gms +++ b/modules/55_awms/off/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/55_awms/off/not_used.txt b/modules/55_awms/off/not_used.txt index 1f7429bbfb..080419a5db 100644 --- a/modules/55_awms/off/not_used.txt +++ b/modules/55_awms/off/not_used.txt @@ -1,10 +1,3 @@ -# | (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_feed,input,not needed fm_attributes, input, not needed diff --git a/modules/55_awms/off/postsolve.gms b/modules/55_awms/off/postsolve.gms index 873ceb14c3..454626e090 100644 --- a/modules/55_awms/off/postsolve.gms +++ b/modules/55_awms/off/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/55_awms/off/preloop.gms b/modules/55_awms/off/preloop.gms index 328869876a..80c1b17ea1 100644 --- a/modules/55_awms/off/preloop.gms +++ b/modules/55_awms/off/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/55_awms/off/realization.gms b/modules/55_awms/off/realization.gms index 315690f2f8..79c5b3df07 100644 --- a/modules/55_awms/off/realization.gms +++ b/modules/55_awms/off/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/55_awms/off/sets.gms b/modules/55_awms/off/sets.gms index 947672a48e..34d501b376 100644 --- a/modules/55_awms/off/sets.gms +++ b/modules/55_awms/off/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/56_ghg_policy/module.gms b/modules/56_ghg_policy/module.gms index d429e52a36..e10c49e771 100644 --- a/modules/56_ghg_policy/module.gms +++ b/modules/56_ghg_policy/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -15,7 +15,8 @@ *' Technically, every ton of emission is multiplied with an emission price to *' determine emission costs. Emission sources can be excluded from pricing by switches *' defined in config/default.cfg. -*' +*' The module collects carbon stock information in the interface `vm_carbon_stock` +*' from all land modules ([30_crop], [31_past], [32_forestry], [34_urban] and [35_natveg]). *' Please note that emissions that occur only once (e.g. CO2 emissions from deforestation) *' are handled differently than emissions that occur in every timestep *' (e.g. CH4 and N2O emissions from agricultural production). @@ -23,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_aug22/declarations.gms b/modules/56_ghg_policy/price_aug22/declarations.gms new file mode 100644 index 0000000000..4da3658957 --- /dev/null +++ b/modules/56_ghg_policy/price_aug22/declarations.gms @@ -0,0 +1,58 @@ +*** | (C) 2008-2023 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 + +parameters + im_pollutant_prices(t_all,i,pollutants,emis_source) Certificate prices for N2O-N CH4 CO2-C used in the model (USD05MER per Mg) + p56_pollutant_prices_input(t_all,i,pollutants,emis_source) Certificate prices for N2O-N CH4 CO2-C from input files (USD05MER per Mg) + p56_c_price_aff(t_all,i,ac) C price used for afforestation decision-making (USD05MER per tC) + pc56_c_price_induced_aff Helper for fixing C price driven afforestation to zero for historic time steps (binary) + p56_region_price_shr(t_all,i) GHG price share of the region (1) + p56_country_dummy(iso) Dummy parameter indicating whether country is affected by selected GHG policy (1) +; + +equations + 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) + q56_reward_cdr_aff_reg(i) Regional revenues for carbon captured by afforestation (mio. USD05MER per yr) + q56_reward_cdr_aff(j) Cellular revenues for carbon captured by afforestation (mio. USD05MER per yr) + q56_emis_pricing(i,pollutants,emis_source) Calculation of annual CO2 emissions for pricing (Tg per yr) + q56_emis_pricing_co2(i,emis_oneoff) Calculation of annual CO2 emissions for pricing (Tg per yr) +; + +positive variables + vm_carbon_stock(j,land,c_pools,stockType) Carbon stock in vegetation soil and litter for different land types (mio. tC) +; + + +variables + 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) + v56_emission_cost(i,emis_source) GHG emissions cost (mio. USD05MER per yr) + vm_reward_cdr_aff(i) Regional average annual expected revenue from afforestation (mio. USD05MER per yr) + v56_reward_cdr_aff(j) Cellular average annual expected revenue from afforestation (mio. USD05MER per yr) +; + +*#################### 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_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_aug22/equations.gms b/modules/56_ghg_policy/price_aug22/equations.gms new file mode 100644 index 0000000000..ca728bbe0b --- /dev/null +++ b/modules/56_ghg_policy/price_aug22/equations.gms @@ -0,0 +1,79 @@ +*** | (C) 2008-2023 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 + + +*' 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`. + + q56_emis_pricing(i2,pollutants,emis_annual) .. + v56_emis_pricing(i2,emis_annual,pollutants) =e= + vm_emissions_reg(i2,emis_annual,pollutants); + + q56_emis_pricing_co2(i2,emis_oneoff) .. + v56_emis_pricing(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,"%c56_carbon_stock_pricing%"))/m_timestep_length); + +*** Emission costs + +*' **Emission costs** are calculated by multiplying regional emissions with the emission price `im_pollutant_prices`, +*' taking into account the price policy that was defined above in `c56_emis_policy`. + + q56_emission_cost_annual(i2,emis_annual) .. + v56_emission_cost(i2,emis_annual) =e= + sum(pollutants, + v56_emis_pricing(i2,emis_annual,pollutants) * + sum(ct, im_pollutant_prices(ct,i2,pollutants,emis_annual))); + +*' As MAgPIE is a recursive dynamic model, within the optimization of the current time step it does not account for benefits or costs in future time steps. +*' This can be problematic for the treatment of emissions that occur only once under continuous management (such as deforestation, +*' where the forest has been cut down the cropland can be continuously cultivated without further deforestation emissions) versus +*' emissions that occur continously (such as fertilization emissions, that will re-occur every year for continuously management). +*' We therefore distinguish one-off and yearly emissions, and discount one-off emissions assuming an infinite time-horizon to +*' level them with yearly emissions. Since one-off emissions in `vm_emissions_reg` and `v56_emis_cell_pricing` are expressed as annual emissions +*' they are converted back into emissions of the entire timestep by multiplication with `m_timestep_length`, and are then +*' transformed into annual costs by multiplication with the emission price (`im_pollutant_prices`) +*' and an annuity (annuity due with infinite time horizon) factor that depends on `pm_interest`. + + q56_emission_cost_oneoff(i2,emis_oneoff) .. + v56_emission_cost(i2,emis_oneoff) =e= + sum(pollutants, + v56_emis_pricing(i2,emis_oneoff,pollutants) + * m_timestep_length + * sum(ct, + im_pollutant_prices(ct,i2,pollutants,emis_oneoff) + * pm_interest(ct,i2)/(1+pm_interest(ct,i2)))); + +*' **Total regional emission costs** consist of costs from yearly and one-off emissions. + + q56_emission_costs(i2) .. + vm_emission_costs(i2) =e= + sum(emis_source, v56_emission_cost(i2,emis_source)); + +*' The value of CDR from C-price induced afforestation enters the objective function as negative costs. +*' The reward, which serves as incentive for afforestation, is calculated in 3 steps: +*' First, the sum of the expected CDR for each 5-year age-class and the carbon equivalent of local biophysical effects (`vm_cdr_aff`) +*' are multiplied by the corresponding future C price (`p56_c_price_aff`). +*' Second, these future cash flows are discounted to present value, depending on `pm_interest`. +*' Third, an annuity factor (annuity due with infinite time horizon) is used to obtain average annual rewards + + q56_reward_cdr_aff_reg(i2) .. + vm_reward_cdr_aff(i2) =e= + sum(cell(i2,j2), + v56_reward_cdr_aff(j2) + ); + + q56_reward_cdr_aff(j2) .. + v56_reward_cdr_aff(j2) =e= + s56_c_price_induced_aff* + sum(ac, + (sum(aff_effect,(1-s56_buffer_aff)*vm_cdr_aff(j2,ac,aff_effect)) * sum((cell(i2,j2),ct), p56_c_price_aff(ct,i2,ac))) + / ((1+sum((cell(i2,j2),ct),pm_interest(ct,i2)))**(ac.off*5))) + *sum((cell(i2,j2),ct),pm_interest(ct,i2)/(1+pm_interest(ct,i2))); diff --git a/modules/56_ghg_policy/price_jan20/input.gms b/modules/56_ghg_policy/price_aug22/input.gms similarity index 53% rename from modules/56_ghg_policy/price_jan20/input.gms rename to modules/56_ghg_policy/price_aug22/input.gms index 774d5329dd..fdb5290128 100644 --- a/modules/56_ghg_policy/price_jan20/input.gms +++ b/modules/56_ghg_policy/price_aug22/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -9,38 +9,36 @@ * Default: all iso countries selected sets policy_countries56(iso) countries to be affected by ghg policy / 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 / + 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 / ; scalars - s56_reward_neg_emis reward CDR from all sources (-Inf) or only from afforestation (0) (1) / 0 / - s56_limit_ch4_n2o_price upper limit for CH4 and N2O GHG prices (USD05MER per tC) / 1000 / + s56_limit_ch4_n2o_price upper limit for CH4 and N2O GHG prices (USD05MER per tC) / 4000 / s56_cprice_red_factor reduction factor for CO2 price (-) / 1 / - s56_ghgprice_start start year for ghg price phase-in (year) / 2025 / - s56_ghgprice_phase_in Switch for phasing-in GHG price over a 20 year period (1=on 0=off) / 0 / + s56_minimum_cprice Minium C price for future time steps (USD per tC) / 0 / s56_ghgprice_devstate_scaling Switch for scaling GHG price with development state (1=on 0=off) / 0 / s56_c_price_induced_aff Switch for C price driven afforestation (1=on 0=off) / 1 / s56_c_price_exp_aff c price expectation for afforestation (years) / 50 / @@ -48,12 +46,16 @@ scalars s56_counter counter for C price interpolation (1) / 0 / s56_timesteps number of time steps for C price interpolation (1) / 0 / s56_offset helper for C price interpolation (1) / 0 / - s56_peatland_policy 1=on 0=off (binary) / 0 / ; -$setglobal c56_pollutant_prices R2M41-SSP2-NPi -$setglobal c56_pollutant_prices_noselect R2M41-SSP2-NPi +$setglobal c56_pollutant_prices R21M42-SSP2-NPi +$setglobal c56_pollutant_prices_noselect R21M42-SSP2-NPi $setglobal c56_emis_policy redd+natveg_nosoil +$setglobal c56_cprice_aff forestry_vegc +$setglobal c56_mute_ghgprices_until y2030 + +$setglobal c56_carbon_stock_pricing actualNoAcEst +* options: actual, actualNoAcEst table f56_pollutant_prices(t_all,i,pollutants,ghgscen56) GHG certificate prices for N2O-N CH4 CO2-C (USD05MER per t) $ondelim @@ -73,7 +75,7 @@ $if "%c56_pollutant_prices%" == "emulator" $include "./modules/56_ghg_policy/inp $if "%c56_pollutant_prices%" == "emulator" $offdelim $if "%c56_pollutant_prices%" == "emulator" ; -*' `f56_emis_policy` contains scenarios determining for each gas and source whether it is priced or not. +* f56_emis_policy contains scenarios determining for each gas and source whether it is priced or not table f56_emis_policy(scen56,pollutants_all,emis_source) GHG emission policy scenarios (1) $ondelim 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..767a3d4d9f --- /dev/null +++ b/modules/56_ghg_policy/price_aug22/postsolve.gms @@ -0,0 +1,65 @@ +*** | (C) 2008-2023 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_aug22/preloop.gms b/modules/56_ghg_policy/price_aug22/preloop.gms new file mode 100644 index 0000000000..ec4d512a9a --- /dev/null +++ b/modules/56_ghg_policy/price_aug22/preloop.gms @@ -0,0 +1,92 @@ +*** | (C) 2008-2023 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 + +* starting value of above ground carbon stocks 1995 is only an estimate. +* ATTENTION: emissions in 1995 are not meaningful +vm_carbon_stock.l(j,land,ag_pools,stockType) = fm_carbon_density("y1995",j,land,ag_pools)*pcm_land(j,land); + +v56_emis_pricing.fx(i,emis_oneoff,pollutants)$(not sameas(pollutants,"co2_c")) = 0; + +****** Region price share for ghg policy of selective countries: +* Country switch to determine countries for which ghg policy shall be applied. +* In the default case, the ghg policy affects all countries when activated. +p56_country_dummy(iso) = 0; +p56_country_dummy(policy_countries56) = 1; +* Because MAgPIE is not run at country-level, but at region level, a region +* share is calculated that translates the countries' influence to regional level. +* Countries are weighted by their population size. +p56_region_price_shr(t_all,i) = sum(i_to_iso(i,iso), p56_country_dummy(iso) * im_pop_iso(t_all,iso)) / sum(i_to_iso(i,iso), im_pop_iso(t_all,iso)); + +****select ghg prices +$ifthen "%c56_pollutant_prices%" == "coupling" + im_pollutant_prices(t_all,i,pollutants,emis_source) = f56_pollutant_prices_coupling(t_all,i,pollutants); +$elseif "%c56_pollutant_prices%" == "emulator" + im_pollutant_prices(t_all,i,pollutants,emis_source) = f56_pollutant_prices_emulator(t_all,i,pollutants); +$else + im_pollutant_prices(t_all,i,pollutants,emis_source) = f56_pollutant_prices(t_all,i,pollutants,"%c56_pollutant_prices%") * p56_region_price_shr(t_all,i) + + f56_pollutant_prices(t_all,i,pollutants,"%c56_pollutant_prices_noselect%") * (1-p56_region_price_shr(t_all,i)); +$endif + +***save im_pollutant_prices to parameter +p56_pollutant_prices_input(t_all,i,pollutants,emis_source) = im_pollutant_prices(t_all,i,pollutants,emis_source); + +** set GHG prices to zero for historic period +im_pollutant_prices(t_all,i,pollutants,emis_source)$(m_year(t_all) <= sm_fix_SSP2) = 0; +** set GHG prices to zero for all future time steps until the year defined by `c56_mute_ghgprices_until` +im_pollutant_prices(t_all,i,pollutants,emis_source)$(m_year(t_all) > sm_fix_SSP2 AND m_year(t_all) <= m_year("%c56_mute_ghgprices_until%")) = 0; +** Exception for C price, which can be set to a minium price for all future time steps until the year defined by `c56_mute_ghgprices_until` +im_pollutant_prices(t_all,i,"co2_c",emis_source)$(m_year(t_all) > sm_fix_SSP2 AND m_year(t_all) <= m_year("%c56_mute_ghgprices_until%")) = s56_minimum_cprice; + +***limit CH4 and N2O GHG prices based on s56_limit_ch4_n2o_price +*12/44 conversion from USD per tC to USD per tCO2 +*28 and 265 Global Warming Potentials from AR5 WG1 CH08 Table 8.7, conversion from USD per tCO2 to USD per tCH4 and USD per tN2O +*44/28 conversion from USD per tN2O to USD per tN +im_pollutant_prices(t_all,i,"ch4",emis_source)$(im_pollutant_prices(t_all,i,"ch4",emis_source) > s56_limit_ch4_n2o_price*12/44*28) = s56_limit_ch4_n2o_price*12/44*28; +im_pollutant_prices(t_all,i,"n2o_n_direct",emis_source)$(im_pollutant_prices(t_all,i,"n2o_n_direct",emis_source) > s56_limit_ch4_n2o_price*12/44*265*44/28) = s56_limit_ch4_n2o_price*12/44*265*44/28; +im_pollutant_prices(t_all,i,"n2o_n_indirect",emis_source)$(im_pollutant_prices(t_all,i,"n2o_n_indirect",emis_source) > s56_limit_ch4_n2o_price*12/44*265*44/28) = s56_limit_ch4_n2o_price*12/44*265*44/28; + +***apply reduction factor on CO2 price to account for potential negative side effects +***lowers the economic incentive for CO2 emission reduction (avoided deforestation) and afforestation +im_pollutant_prices(t_all,i,"co2_c",emis_source) = im_pollutant_prices(t_all,i,"co2_c",emis_source)*s56_cprice_red_factor; + +***multiply GHG prices with development state to account for institutional requirements needed for implementing a GHG pricing scheme +im_pollutant_prices(t_all,i,pollutants,emis_source)$(s56_ghgprice_devstate_scaling = 1) = im_pollutant_prices(t_all,i,pollutants,emis_source)*im_development_state(t_all,i); + +***GHG emission policy +im_pollutant_prices(t_all,i,pollutants,emis_source) = im_pollutant_prices(t_all,i,pollutants,emis_source) * f56_emis_policy("%c56_emis_policy%",pollutants,emis_source); + +***construct age-class dependent C price for afforestation incentive +***this is needed because time steps (t) and age-classes (ac) can differ. ac and t_all are always in 5-year time steps. +*For missing years in t_all use C price of previous time step. This step makes sure that C prices for every 5-year time step are available. +loop(t_all$(m_year(t_all) > m_year("%c56_mute_ghgprices_until%")), + im_pollutant_prices(t_all,i,"co2_c",emis_source)$(im_pollutant_prices(t_all,i,"co2_c",emis_source) = 0) = im_pollutant_prices(t_all-1,i,"co2_c",emis_source); +); +*Linear interpolation of C price for missing time steps +loop(t, + s56_timesteps = m_yeardiff(t)/5; + if (s56_timesteps > 1, + s56_counter = 0; + repeat( + s56_counter = s56_counter + 1; + s56_offset = s56_timesteps-s56_counter; + im_pollutant_prices(t_all-s56_offset,i,"co2_c",emis_source)$(m_year(t_all) = m_year(t)) = + im_pollutant_prices(t-1,i,"co2_c",emis_source) + + (im_pollutant_prices(t,i,"co2_c",emis_source) - im_pollutant_prices(t-1,i,"co2_c",emis_source))*s56_counter/(s56_timesteps); + until s56_counter = s56_timesteps-1); + ); +); + +*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","%c56_cprice_aff%"); +*Shift C prices in age-classes for reflecting foresight. +*e.g. ac5 in 2020 should have the C price of ac0 in 2025, and ac20 in 2020 equals to ac0 in 2040 +p56_c_price_aff(t_all,i,ac)$(ord(t_all)+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) <= m_year("%c56_mute_ghgprices_until%")) = 0; diff --git a/modules/56_ghg_policy/price_jan20/realization.gms b/modules/56_ghg_policy/price_aug22/realization.gms similarity index 71% rename from modules/56_ghg_policy/price_jan20/realization.gms rename to modules/56_ghg_policy/price_aug22/realization.gms index 9950073501..2be5b23630 100644 --- a/modules/56_ghg_policy/price_jan20/realization.gms +++ b/modules/56_ghg_policy/price_aug22/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,7 +6,12 @@ *** | Contact: magpie@pik-potsdam.de *' @description This realization applies pollutant prices to different -*' emission types depending on the emission pricing policy defined in `f56_emis_policy`. +*' emission types in Agriculture, Forestry and Other Land Use (AFOLU), +*' depending on the GHG emission pricing policy defined in `c56_emis_policy`. +*' CO2 emissions from Land Use, Land-Use Change and Forestry (LULUCF) are calculated +*' based on carbon stock changes between timesteps in the interface `vm_carbon_stock`. +*' Note that the CO2 emissions subject to pricing can differ from the actual CO2 emissions, +*' depending on the choice of `c56_carbon_stock_pricing`. *' In addition, the average annual reward for carbon dioxide removal (CDR) *' and the reward or penalty of local biophysical effects *' from afforestation [32_forestry] is calculated as the present value (PV) of all @@ -19,11 +24,11 @@ *' mitigation, total emission costs entering the objective function are zero. *####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/56_ghg_policy/price_jan20/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/56_ghg_policy/price_jan20/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/56_ghg_policy/price_jan20/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/56_ghg_policy/price_jan20/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/56_ghg_policy/price_jan20/scaling.gms" -$Ifi "%phase%" == "preloop" $include "./modules/56_ghg_policy/price_jan20/preloop.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/56_ghg_policy/price_jan20/postsolve.gms" +$Ifi "%phase%" == "sets" $include "./modules/56_ghg_policy/price_aug22/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/56_ghg_policy/price_aug22/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/56_ghg_policy/price_aug22/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/56_ghg_policy/price_aug22/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/56_ghg_policy/price_aug22/scaling.gms" +$Ifi "%phase%" == "preloop" $include "./modules/56_ghg_policy/price_aug22/preloop.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/56_ghg_policy/price_aug22/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/56_ghg_policy/price_aug22/scaling.gms b/modules/56_ghg_policy/price_aug22/scaling.gms new file mode 100644 index 0000000000..5fa1e8603c --- /dev/null +++ b/modules/56_ghg_policy/price_aug22/scaling.gms @@ -0,0 +1,10 @@ +*** | (C) 2008-2023 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_emission_costs.scale(i) = 10e5; +v56_emission_cost.scale(i,emis_source) = 10e4; +vm_carbon_stock.scale(j,land,c_pools,stockType) = 10e3; diff --git a/modules/56_ghg_policy/price_aug22/sets.gms b/modules/56_ghg_policy/price_aug22/sets.gms new file mode 100644 index 0000000000..93118855d6 --- /dev/null +++ b/modules/56_ghg_policy/price_aug22/sets.gms @@ -0,0 +1,165 @@ +*** | (C) 2008-2023 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 (SETS) ############################### +* THIS CODE IS CREATED AUTOMATICALLY, DO NOT MODIFY THESE LINES DIRECTLY +* ANY DIRECT MODIFICATION WILL BE LOST AFTER NEXT AUTOMATIC UPDATE! + +sets + + ghgscen56 ghg price scenarios + / PIK_GDP, + PIK_H2C, + PIK_HBL, + PIK_HOS, + PIK_LIN, + PIK_NPI, + PIK_OPT, + R21M42-SDP-NPi, + R21M42-SDP-PkBudg1000, + R21M42-SDP-PkBudg1100, + R21M42-SDP-PkBudg900, + R21M42-SSP1-NPi, + R21M42-SSP1-PkBudg1100, + R21M42-SSP1-PkBudg1300, + R21M42-SSP1-PkBudg900, + R21M42-SSP2-NPi, + R21M42-SSP2-PkBudg1100, + R21M42-SSP2-PkBudg1300, + R21M42-SSP2-PkBudg900, + R21M42-SSP5-NPi, + R21M42-SSP5-PkBudg1100, + R21M42-SSP5-PkBudg1300, + R21M42-SSP5-PkBudg900, + R2M41-SSP2-Budg1300, + R2M41-SSP2-Budg600, + R2M41-SSP2-Budg950, + R2M41-SSP2-NDC, + R2M41-SSP2-NPi, + SSPDB-SSP1-19-IMAGE, + SSPDB-SSP1-19-REMIND-MAGPIE, + SSPDB-SSP1-26-IMAGE, + SSPDB-SSP1-26-REMIND-MAGPIE, + SSPDB-SSP1-34-IMAGE, + SSPDB-SSP1-34-REMIND-MAGPIE, + SSPDB-SSP1-45-IMAGE, + SSPDB-SSP1-45-REMIND-MAGPIE, + SSPDB-SSP1-Ref-IMAGE, + SSPDB-SSP1-Ref-REMIND-MAGPIE, + SSPDB-SSP2-19-MESSAGE-GLOBIOM, + SSPDB-SSP2-19-REMIND-MAGPIE, + SSPDB-SSP2-26-MESSAGE-GLOBIOM, + SSPDB-SSP2-26-REMIND-MAGPIE, + SSPDB-SSP2-34-MESSAGE-GLOBIOM, + SSPDB-SSP2-34-REMIND-MAGPIE, + SSPDB-SSP2-45-MESSAGE-GLOBIOM, + SSPDB-SSP2-45-REMIND-MAGPIE, + SSPDB-SSP2-60-MESSAGE-GLOBIOM, + SSPDB-SSP2-60-REMIND-MAGPIE, + SSPDB-SSP2-Ref-MESSAGE-GLOBIOM, + SSPDB-SSP2-Ref-REMIND-MAGPIE, + SSPDB-SSP3-34-AIM-CGE, + SSPDB-SSP3-45-AIM-CGE, + SSPDB-SSP3-60-AIM-CGE, + SSPDB-SSP4-26-GCAM4, + SSPDB-SSP4-34-GCAM4, + SSPDB-SSP4-45-GCAM4, + SSPDB-SSP4-60-GCAM4, + SSPDB-SSP4-Ref-GCAM4, + SSPDB-SSP5-19-REMIND-MAGPIE, + SSPDB-SSP5-26-REMIND-MAGPIE, + SSPDB-SSP5-34-REMIND-MAGPIE, + SSPDB-SSP5-45-REMIND-MAGPIE, + SSPDB-SSP5-60-REMIND-MAGPIE, + SSPDB-SSP5-Ref-REMIND-MAGPIE / + + scen56 emission policy scenarios + / none, + all, + all_nosoil, + redd_nosoil, + redd_nosoil_nopeat, + reddnatveg_nosoil, + reddnatveg_nosoil_nopeat, + redd+_nosoil, + redd+_nosoil_nopeat, + redd+natveg_nosoil, + redd+natveg_nosoil_nopeat, + all_vegc, + redd_vegc, + reddnatveg_vegc, + redd+_vegc, + redd+natveg_vegc, + sdp_cropeff, + sdp_livestock, + sdp_redd, + sdp_soil, + sdp_peatland, + sdp_redd_soil, + sdp_redd_soil_peat, + sdp_all, + gcs_lbs, + gcs_res, + ecoSysProtAll, + ecoSysProtForest, + ecoSysProtPrimForest, + ecoSysProtOff, + ecoSysProtAll_agMgmtExclN2O, + ecoSysProtAll_agMgmtExclCH4, + ecoSysProtAll_agMgmtOff / + +; +*######################### R SECTION END (SETS) ################################ +*############################################################################### + +sets + + pollutants_all all pollutants + / co2_c, + ch4, + n2o_n_direct, nh3_n, no2_n, + no3_n, + n2o_n_indirect, + co, + nmhc, + h2, + pm2_5, + tpm, + tc, + oc, + bc, + so2 / + + pollutants(pollutants_all) subset of pollutants_all that can be taxed + / co2_c, + ch4, + n2o_n_direct, n2o_n_indirect, + nh3_n, no2_n, + no3_n / + + n_pollutants(pollutants) subset of n pollutants + / n2o_n_direct,n2o_n_indirect, + nh3_n, no2_n, + no3_n / + + n_pollutants_direct(n_pollutants) subset of n pollutants + / n2o_n_direct, + nh3_n, no2_n, + no3_n / + + pollutant_nh3no2_51(n_pollutants_direct) nitrogen emissions relevant for deposition + / nh3_n, no2_n / + + ac_exp(ac) age-class corresponding to planning horizon + + ag_pools(c_pools) Above ground carbon pools + / vegc, litc / + + stockType Carbon stock types + / actual, actualNoAcEst / +; diff --git a/modules/56_ghg_policy/price_jan20/declarations.gms b/modules/56_ghg_policy/price_jan20/declarations.gms deleted file mode 100644 index e2cefec48d..0000000000 --- a/modules/56_ghg_policy/price_jan20/declarations.gms +++ /dev/null @@ -1,82 +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 - -parameters - im_pollutant_prices(t_all,i,pollutants) Certificate prices for N2O-N CH4 CO2-C used in the model (USD05MER per Mg) - p56_pollutant_prices_input(t_all,i,pollutants) Certificate prices for N2O-N CH4 CO2-C from input files (USD05MER per Mg) - p56_emis_policy(t,i,pollutants,emis_source) GHG emission policy scenarios (binary) - p56_c_price_aff(t_all,i,ac) C price used for afforestation decision-making (USD05MER per tC) - pc56_c_price_induced_aff Helper for fixing C price driven afforestation to zero for historic time steps (binary) - p56_region_price_shr(t_all,i) GHG price share of the region (1) - p56_country_dummy(iso) Dummy parameter indicating whether country is affected by selected GHG policy (1) -; - -equations - q56_technical_mitigation_reg(i,pollutants,emis_source) Application of maccs on emissions (Tg per yr) - q56_technical_mitigation_cell(j,pollutants,emis_source) Application of maccs on emissions (Tg per yr) - q56_cell_to_reg(i,pollutants,emis_source) Aggregation to regional emissions (Tg per yr) - q56_emission_costs(i) Calculation of total emission costs (mio. USD05MER per yr) - q56_emission_costs_reg_yearly(i,emis_reg_yr56) Calculation of regional costs for annual emissions (mio. USD05MER per yr) - q56_emission_costs_reg_oneoff(i,emis_reg_one56) Calculation of regional costs for emissions occuring only once in time (mio. USD05MER per yr) - q56_emission_costs_cell_yearly(j,emis_cell_yr56) Calculation of cellular costs for annual emissions (mio. USD05MER per yr) - q56_emission_costs_cell_oneoff(j,emis_cell_one56) Calculation of cellular costs for emissions occuring only once in time (mio. USD05MER per yr) - q56_reward_cdr_aff_reg(i) Regional revenues for carbon captured by afforestation (mio. USD05MER per yr) - q56_reward_cdr_aff(j) Cellular revenues for carbon captured by afforestation (mio. USD05MER per yr) - q56_peatland_emis_cost_reg(i) Regional peatland GHG emissions costs (mio. USD05MER per yr) - q56_peatland_emis_cost(j) Cellular peatland GHG emissions costs (mio. USD05MER per yr) -; - - -positive variables - vm_peatland_emis_cost(i) Regional peatland GHG emissions costs (mio. USD05MER per yr) - v56_peatland_emis_cost(j) Cellular peatland GHG emissions costs (mio. USD05MER per yr) -; - - -variables - vm_btm_reg(i,emis_source,pollutants) Regional emissions before technical mitigation (Tg per yr) - vm_btm_cell(j,emis_source,pollutants) Cellular 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_cell(j,emis_source,pollutants) Cellular emissions by source and gas after technical mitigation N CH4 C (Tg per yr) - v56_emission_costs_reg_yearly(i,emis_reg_yr56) Costs for emissions occuring yearly (mio. USD05MER per yr) - v56_emission_costs_reg_oneoff(i,emis_reg_one56) Costs for emissions occuring only once in time (mio. USD05MER per yr) - v56_emission_costs_cell_yearly(j,emis_cell_yr56) Costs for emissions occuring yearly (mio. USD05MER per yr) - v56_emission_costs_cell_oneoff(j,emis_cell_one56) Costs for emissions occuring only once in time (mio. USD05MER per yr) - vm_reward_cdr_aff(i) Regional average annual expected revenue from afforestation (mio. USD05MER per yr) - v56_reward_cdr_aff(j) Cellular average annual expected revenue from afforestation (mio. USD05MER per yr) -; - -*#################### R SECTION START (OUTPUT DECLARATIONS) #################### -parameters - ov_peatland_emis_cost(t,i,type) Regional peatland GHG emissions costs (mio. USD05MER per yr) - ov56_peatland_emis_cost(t,j,type) Cellular peatland GHG emissions costs (mio. USD05MER per yr) - ov_btm_reg(t,i,emis_source,pollutants,type) Regional emissions before technical mitigation (Tg per yr) - ov_btm_cell(t,j,emis_source,pollutants,type) Cellular 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_cell(t,j,emis_source,pollutants,type) Cellular emissions by source and gas after technical mitigation N CH4 C (Tg per yr) - ov56_emission_costs_reg_yearly(t,i,emis_reg_yr56,type) Costs for emissions occuring yearly (mio. USD05MER per yr) - ov56_emission_costs_reg_oneoff(t,i,emis_reg_one56,type) Costs for emissions occuring only once in time (mio. USD05MER per yr) - ov56_emission_costs_cell_yearly(t,j,emis_cell_yr56,type) Costs for emissions occuring yearly (mio. USD05MER per yr) - ov56_emission_costs_cell_oneoff(t,j,emis_cell_one56,type) Costs for emissions occuring only once in time (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_technical_mitigation_reg(t,i,pollutants,emis_source,type) Application of maccs on emissions (Tg per yr) - oq56_technical_mitigation_cell(t,j,pollutants,emis_source,type) Application of maccs on emissions (Tg per yr) - oq56_cell_to_reg(t,i,pollutants,emis_source,type) Aggregation to regional emissions (Tg per yr) - oq56_emission_costs(t,i,type) Calculation of total emission costs (mio. USD05MER per yr) - oq56_emission_costs_reg_yearly(t,i,emis_reg_yr56,type) Calculation of regional costs for annual emissions (mio. USD05MER per yr) - oq56_emission_costs_reg_oneoff(t,i,emis_reg_one56,type) Calculation of regional costs for emissions occuring only once in time (mio. USD05MER per yr) - oq56_emission_costs_cell_yearly(t,j,emis_cell_yr56,type) Calculation of cellular costs for annual emissions (mio. USD05MER per yr) - oq56_emission_costs_cell_oneoff(t,j,emis_cell_one56,type) Calculation of cellular 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_peatland_emis_cost_reg(t,i,type) Regional peatland GHG emissions costs (mio. USD05MER per yr) - oq56_peatland_emis_cost(t,j,type) Cellular peatland GHG emissions costs (mio. USD05MER per yr) -; -*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/56_ghg_policy/price_jan20/equations.gms b/modules/56_ghg_policy/price_jan20/equations.gms deleted file mode 100644 index 4a215bf0f7..0000000000 --- a/modules/56_ghg_policy/price_jan20/equations.gms +++ /dev/null @@ -1,134 +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 - -*** Calculate emissions for the core - -*** Emissions - -*' Total **regional GHG emissions** `vm_emissions_reg` are the sum of emissions from different regional and cellular sources less -*' the fraction `im_maccs_mitigation` that can be abated by technicial mitigation measures (see module [57_maccs]). The emisssions before technical mitigation -*' are calculated in the respective modules ([51_nitrogen], [52_carbon], [53_methane]) and delivered to this module through the -*' interface variables `vm_btm_reg` and `vm_btm_cell`. - -q56_technical_mitigation_reg(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))) - ; - -q56_technical_mitigation_cell(j2,pollutants,emis_source) .. - v56_emis_cell(j2,emis_source,pollutants) =e= - sum(cell(i2,j2), - vm_btm_cell(j2,emis_source,pollutants) - * (1 - sum(ct, im_maccs_mitigation(ct,i2,emis_source,pollutants)))); - -q56_cell_to_reg(i2,pollutants,emis_source) .. - vm_emissions_reg(i2,emis_source,pollutants) =e= - sum(cell(i2,j2),v56_emis_cell(j2,emis_source,pollutants)); - - -*** Emission costs - -*' **Emission costs** are calculated by multiplying regional and cellular emissions by the emission price `im_pollutant_prices` -*' taking into account the price policy that was defined above in `f56_emis_policy`. - - q56_emission_costs_reg_yearly(i2,emis_reg_yr56) .. - v56_emission_costs_reg_yearly(i2,emis_reg_yr56) =e= - sum(pollutants, - vm_emissions_reg(i2,emis_reg_yr56,pollutants) * - sum(ct, p56_emis_policy(ct,i2,pollutants,emis_reg_yr56) * - im_pollutant_prices(ct,i2,pollutants))); - - - q56_emission_costs_cell_yearly(j2,emis_cell_yr56) .. - v56_emission_costs_cell_yearly(j2,emis_cell_yr56) =e= - sum(pollutants, - v56_emis_cell(j2,emis_cell_yr56,pollutants) * - sum((ct,cell(i2,j2)), p56_emis_policy(ct,i2,pollutants,emis_cell_yr56) * - im_pollutant_prices(ct,i2,pollutants))); - -*' As MAgPIE is a recursive dynamic model, within the optimization of the current time step it does not account for benefits or costs in future time steps. -*' This can be problematic for the treatment of emissions that occur only once under continuous management (such as deforestation, -*' where the forest has been cut down the cropland can be continuously cultivated without further deforestation emissions) versus -*' emissions that occur continously (such as fertilization emissions, that will re-occur every year for continuously management). -*' We therefore distinguish one-off and yearly emissions, and discount one-off emissions assuming an infinite time-horizon to -*' level them with yearly emissions. Since one-off emissions are delivered by the [52_carbon] module as annual emissions they are -*' multiplied here by the timestep length `m_timestep_length` to obtain emissions for the entire timestep and are then -*' transformed back into annual costs by multiplying by the emission price and a discount factor `p56_ghg_price_growth_rate` -*' that is equal to the growth rate of the emissions price. - - q56_emission_costs_reg_oneoff(i2,emis_reg_one56) .. - v56_emission_costs_reg_oneoff(i2,emis_reg_one56) =g= - sum(pollutants, - vm_emissions_reg(i2,emis_reg_one56,pollutants) - * m_timestep_length - * sum(ct, - p56_emis_policy(ct,i2,pollutants,emis_reg_one56) - * im_pollutant_prices(ct,i2,pollutants) - * pm_interest(ct,i2)/(1+pm_interest(ct,i2))) - ); - - q56_emission_costs_cell_oneoff(j2,emis_cell_one56) .. - v56_emission_costs_cell_oneoff(j2,emis_cell_one56) =g= - sum(pollutants, - v56_emis_cell(j2,emis_cell_one56,pollutants) - * m_timestep_length - * sum((ct,cell(i2,j2)), - p56_emis_policy(ct,i2,pollutants,emis_cell_one56) - * im_pollutant_prices(ct,i2,pollutants) - * pm_interest(ct,i2)/(1+pm_interest(ct,i2))) - ); - -*' **Total regional emission costs** consist of costs from yearly and one-off emissions occuring in this region and its cells. - q56_emission_costs(i2) .. - vm_emission_costs(i2) =e= - sum(emis_reg_yr56, v56_emission_costs_reg_yearly(i2,emis_reg_yr56)) - + sum(emis_reg_one56, v56_emission_costs_reg_oneoff(i2,emis_reg_one56)) - + sum((emis_cell_yr56, cell(i2,j2)), v56_emission_costs_cell_yearly(j2,emis_cell_yr56)) - + sum((emis_cell_one56, cell(i2,j2)), v56_emission_costs_cell_oneoff(j2,emis_cell_one56)) - ; - -*' The value of CDR from C-price induced afforestation enters the objective function as negative costs. -*' The reward, which serves as incentive for afforestation, is calculated in 3 steps: -*' First, the sum of the expected CDR for each 5-year age-class and the carbon equivalent of local biophysical effects -*' are multiplied by the corresponding future C price. -*' Second, these future cash flows are discounted to present value. -*' Third, an annuity factor (annuity due with infinite time horizon) is used to obtain average annual rewards - - q56_reward_cdr_aff_reg(i2) .. - vm_reward_cdr_aff(i2) =e= - sum(cell(i2,j2), - v56_reward_cdr_aff(j2) - ); - - q56_reward_cdr_aff(j2) .. - v56_reward_cdr_aff(j2) =e= - s56_c_price_induced_aff* - sum(ac, - (sum(aff_effect,(1-s56_buffer_aff)*vm_cdr_aff(j2,ac,aff_effect)) * sum((cell(i2,j2),ct), p56_c_price_aff(ct,i2,ac))) - / ((1+sum((cell(i2,j2),ct),pm_interest(ct,i2)))**(ac.off*5))) - *sum((cell(i2,j2),ct),pm_interest(ct,i2)/(1+pm_interest(ct,i2))); - - -*' Peatland emission costs depending on s56_peatland_policy - - q56_peatland_emis_cost_reg(i2) .. - vm_peatland_emis_cost(i2) =e= - sum(cell(i2,j2), - v56_peatland_emis_cost(j2) - ); - - q56_peatland_emis_cost(j2) .. - v56_peatland_emis_cost(j2) =e= - vm_peatland_emis(j2) * - s56_peatland_policy * - sum((ct,cell(i2,j2)), - im_pollutant_prices(ct,i2,"co2_c")*12/44 - ); diff --git a/modules/56_ghg_policy/price_jan20/postsolve.gms b/modules/56_ghg_policy/price_jan20/postsolve.gms deleted file mode 100644 index 482c02f91d..0000000000 --- a/modules/56_ghg_policy/price_jan20/postsolve.gms +++ /dev/null @@ -1,111 +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_peatland_emis_cost(t,i,"marginal") = vm_peatland_emis_cost.m(i); - ov56_peatland_emis_cost(t,j,"marginal") = v56_peatland_emis_cost.m(j); - ov_btm_reg(t,i,emis_source,pollutants,"marginal") = vm_btm_reg.m(i,emis_source,pollutants); - ov_btm_cell(t,j,emis_source,pollutants,"marginal") = vm_btm_cell.m(j,emis_source,pollutants); - 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_cell(t,j,emis_source,pollutants,"marginal") = v56_emis_cell.m(j,emis_source,pollutants); - ov56_emission_costs_reg_yearly(t,i,emis_reg_yr56,"marginal") = v56_emission_costs_reg_yearly.m(i,emis_reg_yr56); - ov56_emission_costs_reg_oneoff(t,i,emis_reg_one56,"marginal") = v56_emission_costs_reg_oneoff.m(i,emis_reg_one56); - ov56_emission_costs_cell_yearly(t,j,emis_cell_yr56,"marginal") = v56_emission_costs_cell_yearly.m(j,emis_cell_yr56); - ov56_emission_costs_cell_oneoff(t,j,emis_cell_one56,"marginal") = v56_emission_costs_cell_oneoff.m(j,emis_cell_one56); - 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_technical_mitigation_reg(t,i,pollutants,emis_source,"marginal") = q56_technical_mitigation_reg.m(i,pollutants,emis_source); - oq56_technical_mitigation_cell(t,j,pollutants,emis_source,"marginal") = q56_technical_mitigation_cell.m(j,pollutants,emis_source); - oq56_cell_to_reg(t,i,pollutants,emis_source,"marginal") = q56_cell_to_reg.m(i,pollutants,emis_source); - oq56_emission_costs(t,i,"marginal") = q56_emission_costs.m(i); - oq56_emission_costs_reg_yearly(t,i,emis_reg_yr56,"marginal") = q56_emission_costs_reg_yearly.m(i,emis_reg_yr56); - oq56_emission_costs_reg_oneoff(t,i,emis_reg_one56,"marginal") = q56_emission_costs_reg_oneoff.m(i,emis_reg_one56); - oq56_emission_costs_cell_yearly(t,j,emis_cell_yr56,"marginal") = q56_emission_costs_cell_yearly.m(j,emis_cell_yr56); - oq56_emission_costs_cell_oneoff(t,j,emis_cell_one56,"marginal") = q56_emission_costs_cell_oneoff.m(j,emis_cell_one56); - 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_peatland_emis_cost_reg(t,i,"marginal") = q56_peatland_emis_cost_reg.m(i); - oq56_peatland_emis_cost(t,j,"marginal") = q56_peatland_emis_cost.m(j); - ov_peatland_emis_cost(t,i,"level") = vm_peatland_emis_cost.l(i); - ov56_peatland_emis_cost(t,j,"level") = v56_peatland_emis_cost.l(j); - ov_btm_reg(t,i,emis_source,pollutants,"level") = vm_btm_reg.l(i,emis_source,pollutants); - ov_btm_cell(t,j,emis_source,pollutants,"level") = vm_btm_cell.l(j,emis_source,pollutants); - 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_cell(t,j,emis_source,pollutants,"level") = v56_emis_cell.l(j,emis_source,pollutants); - ov56_emission_costs_reg_yearly(t,i,emis_reg_yr56,"level") = v56_emission_costs_reg_yearly.l(i,emis_reg_yr56); - ov56_emission_costs_reg_oneoff(t,i,emis_reg_one56,"level") = v56_emission_costs_reg_oneoff.l(i,emis_reg_one56); - ov56_emission_costs_cell_yearly(t,j,emis_cell_yr56,"level") = v56_emission_costs_cell_yearly.l(j,emis_cell_yr56); - ov56_emission_costs_cell_oneoff(t,j,emis_cell_one56,"level") = v56_emission_costs_cell_oneoff.l(j,emis_cell_one56); - 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_technical_mitigation_reg(t,i,pollutants,emis_source,"level") = q56_technical_mitigation_reg.l(i,pollutants,emis_source); - oq56_technical_mitigation_cell(t,j,pollutants,emis_source,"level") = q56_technical_mitigation_cell.l(j,pollutants,emis_source); - oq56_cell_to_reg(t,i,pollutants,emis_source,"level") = q56_cell_to_reg.l(i,pollutants,emis_source); - oq56_emission_costs(t,i,"level") = q56_emission_costs.l(i); - oq56_emission_costs_reg_yearly(t,i,emis_reg_yr56,"level") = q56_emission_costs_reg_yearly.l(i,emis_reg_yr56); - oq56_emission_costs_reg_oneoff(t,i,emis_reg_one56,"level") = q56_emission_costs_reg_oneoff.l(i,emis_reg_one56); - oq56_emission_costs_cell_yearly(t,j,emis_cell_yr56,"level") = q56_emission_costs_cell_yearly.l(j,emis_cell_yr56); - oq56_emission_costs_cell_oneoff(t,j,emis_cell_one56,"level") = q56_emission_costs_cell_oneoff.l(j,emis_cell_one56); - 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_peatland_emis_cost_reg(t,i,"level") = q56_peatland_emis_cost_reg.l(i); - oq56_peatland_emis_cost(t,j,"level") = q56_peatland_emis_cost.l(j); - ov_peatland_emis_cost(t,i,"upper") = vm_peatland_emis_cost.up(i); - ov56_peatland_emis_cost(t,j,"upper") = v56_peatland_emis_cost.up(j); - ov_btm_reg(t,i,emis_source,pollutants,"upper") = vm_btm_reg.up(i,emis_source,pollutants); - ov_btm_cell(t,j,emis_source,pollutants,"upper") = vm_btm_cell.up(j,emis_source,pollutants); - 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_cell(t,j,emis_source,pollutants,"upper") = v56_emis_cell.up(j,emis_source,pollutants); - ov56_emission_costs_reg_yearly(t,i,emis_reg_yr56,"upper") = v56_emission_costs_reg_yearly.up(i,emis_reg_yr56); - ov56_emission_costs_reg_oneoff(t,i,emis_reg_one56,"upper") = v56_emission_costs_reg_oneoff.up(i,emis_reg_one56); - ov56_emission_costs_cell_yearly(t,j,emis_cell_yr56,"upper") = v56_emission_costs_cell_yearly.up(j,emis_cell_yr56); - ov56_emission_costs_cell_oneoff(t,j,emis_cell_one56,"upper") = v56_emission_costs_cell_oneoff.up(j,emis_cell_one56); - 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_technical_mitigation_reg(t,i,pollutants,emis_source,"upper") = q56_technical_mitigation_reg.up(i,pollutants,emis_source); - oq56_technical_mitigation_cell(t,j,pollutants,emis_source,"upper") = q56_technical_mitigation_cell.up(j,pollutants,emis_source); - oq56_cell_to_reg(t,i,pollutants,emis_source,"upper") = q56_cell_to_reg.up(i,pollutants,emis_source); - oq56_emission_costs(t,i,"upper") = q56_emission_costs.up(i); - oq56_emission_costs_reg_yearly(t,i,emis_reg_yr56,"upper") = q56_emission_costs_reg_yearly.up(i,emis_reg_yr56); - oq56_emission_costs_reg_oneoff(t,i,emis_reg_one56,"upper") = q56_emission_costs_reg_oneoff.up(i,emis_reg_one56); - oq56_emission_costs_cell_yearly(t,j,emis_cell_yr56,"upper") = q56_emission_costs_cell_yearly.up(j,emis_cell_yr56); - oq56_emission_costs_cell_oneoff(t,j,emis_cell_one56,"upper") = q56_emission_costs_cell_oneoff.up(j,emis_cell_one56); - 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_peatland_emis_cost_reg(t,i,"upper") = q56_peatland_emis_cost_reg.up(i); - oq56_peatland_emis_cost(t,j,"upper") = q56_peatland_emis_cost.up(j); - ov_peatland_emis_cost(t,i,"lower") = vm_peatland_emis_cost.lo(i); - ov56_peatland_emis_cost(t,j,"lower") = v56_peatland_emis_cost.lo(j); - ov_btm_reg(t,i,emis_source,pollutants,"lower") = vm_btm_reg.lo(i,emis_source,pollutants); - ov_btm_cell(t,j,emis_source,pollutants,"lower") = vm_btm_cell.lo(j,emis_source,pollutants); - 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_cell(t,j,emis_source,pollutants,"lower") = v56_emis_cell.lo(j,emis_source,pollutants); - ov56_emission_costs_reg_yearly(t,i,emis_reg_yr56,"lower") = v56_emission_costs_reg_yearly.lo(i,emis_reg_yr56); - ov56_emission_costs_reg_oneoff(t,i,emis_reg_one56,"lower") = v56_emission_costs_reg_oneoff.lo(i,emis_reg_one56); - ov56_emission_costs_cell_yearly(t,j,emis_cell_yr56,"lower") = v56_emission_costs_cell_yearly.lo(j,emis_cell_yr56); - ov56_emission_costs_cell_oneoff(t,j,emis_cell_one56,"lower") = v56_emission_costs_cell_oneoff.lo(j,emis_cell_one56); - 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_technical_mitigation_reg(t,i,pollutants,emis_source,"lower") = q56_technical_mitigation_reg.lo(i,pollutants,emis_source); - oq56_technical_mitigation_cell(t,j,pollutants,emis_source,"lower") = q56_technical_mitigation_cell.lo(j,pollutants,emis_source); - oq56_cell_to_reg(t,i,pollutants,emis_source,"lower") = q56_cell_to_reg.lo(i,pollutants,emis_source); - oq56_emission_costs(t,i,"lower") = q56_emission_costs.lo(i); - oq56_emission_costs_reg_yearly(t,i,emis_reg_yr56,"lower") = q56_emission_costs_reg_yearly.lo(i,emis_reg_yr56); - oq56_emission_costs_reg_oneoff(t,i,emis_reg_one56,"lower") = q56_emission_costs_reg_oneoff.lo(i,emis_reg_one56); - oq56_emission_costs_cell_yearly(t,j,emis_cell_yr56,"lower") = q56_emission_costs_cell_yearly.lo(j,emis_cell_yr56); - oq56_emission_costs_cell_oneoff(t,j,emis_cell_one56,"lower") = q56_emission_costs_cell_oneoff.lo(j,emis_cell_one56); - 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_peatland_emis_cost_reg(t,i,"lower") = q56_peatland_emis_cost_reg.lo(i); - oq56_peatland_emis_cost(t,j,"lower") = q56_peatland_emis_cost.lo(j); -*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/56_ghg_policy/price_jan20/preloop.gms b/modules/56_ghg_policy/price_jan20/preloop.gms deleted file mode 100644 index f6ff693c6d..0000000000 --- a/modules/56_ghg_policy/price_jan20/preloop.gms +++ /dev/null @@ -1,108 +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 - -***fix vm_btm_cell to zero for non-CO2 emissions from land-use change -vm_btm_cell.fx(j,emis_source_cell,pollutants)$(not sameas(pollutants,"co2_c")) = 0; -***fix vm_btm_cell to zero for CO2 emissions from ag. production (non land-use change) -vm_btm_cell.fx(j,emis_source_reg,"co2_c") = 0; -***fix vm_btm_cell to zero for CO2 emissions from beccs (not used) -vm_btm_cell.fx(j,"beccs",pollutants) = 0; - -****** Region price share for ghg policy of selective countries: -* Country switch to determine countries for which ghg policy shall be applied. -* In the default case, the ghg policy affects all countries when activated. -p56_country_dummy(iso) = 0; -p56_country_dummy(policy_countries56) = 1; -* Because MAgPIE is not run at country-level, but at region level, a region -* share is calculated that translates the countries' influence to regional level. -* Countries are weighted by their population size. -p56_region_price_shr(t_all,i) = sum(i_to_iso(i,iso), p56_country_dummy(iso) * im_pop_iso(t_all,iso)) / sum(i_to_iso(i,iso), im_pop_iso(t_all,iso)); - -****select ghg prices -$ifthen "%c56_pollutant_prices%" == "coupling" - im_pollutant_prices(t_all,i,pollutants) = f56_pollutant_prices_coupling(t_all,i,pollutants); -$elseif "%c56_pollutant_prices%" == "emulator" - im_pollutant_prices(t_all,i,pollutants) = f56_pollutant_prices_emulator(t_all,i,pollutants); -$else - im_pollutant_prices(t_all,i,pollutants) = f56_pollutant_prices(t_all,i,pollutants,"%c56_pollutant_prices%") * p56_region_price_shr(t_all,i) - + f56_pollutant_prices(t_all,i,pollutants,"%c56_pollutant_prices_noselect%") * (1-p56_region_price_shr(t_all,i)); -$endif - -** Harmonize till 2020 -loop(t_all$(m_year(t_all) <= sm_fix_SSP2), -im_pollutant_prices(t_all,i,pollutants) = f56_pollutant_prices(t_all,i,pollutants,"R2M41-SSP2-NPi") * p56_region_price_shr(t_all,i) - + f56_pollutant_prices(t_all,i,pollutants,"R2M41-SSP2-NPi") * (1-p56_region_price_shr(t_all,i)); -); - -***save im_pollutant_prices to parameter -p56_pollutant_prices_input(t_all,i,pollutants) = im_pollutant_prices(t_all,i,pollutants); - - -***limit CH4 and N2O GHG prices based on s56_limit_ch4_n2o_price -*12/44 conversion from USD per tC to USD per tCO2 -*28 and 265 Global Warming Potentials from AR5 WG1 CH08 Table 8.7, conversion from USD per tCO2 to USD per tCH4 and USD per tN2O -*44/28 conversion from USD per tN2O to USD per tN -im_pollutant_prices(t_all,i,"ch4")$(im_pollutant_prices(t_all,i,"ch4") > s56_limit_ch4_n2o_price*12/44*28) = s56_limit_ch4_n2o_price*12/44*28; -im_pollutant_prices(t_all,i,"n2o_n_direct")$(im_pollutant_prices(t_all,i,"n2o_n_direct") > s56_limit_ch4_n2o_price*12/44*265*44/28) = s56_limit_ch4_n2o_price*12/44*265*44/28; -im_pollutant_prices(t_all,i,"n2o_n_indirect")$(im_pollutant_prices(t_all,i,"n2o_n_indirect") > s56_limit_ch4_n2o_price*12/44*265*44/28) = s56_limit_ch4_n2o_price*12/44*265*44/28; - -***apply reduction factor on CO2 price to account for potential negative side effects -***lowers the economic incentive for CO2 emission reduction (avoided deforestation) and afforestation -im_pollutant_prices(t_all,i,"co2_c") = im_pollutant_prices(t_all,i,"co2_c")*s56_cprice_red_factor; - -***phase-in of GHG price over 20 year period; start depends on s56_ghgprice_start -if (s56_ghgprice_phase_in = 1, -im_pollutant_prices(t_all,i,pollutants)$(m_year(t_all) < s56_ghgprice_start) = 0; -im_pollutant_prices(t_all,i,pollutants)$(m_year(t_all) = s56_ghgprice_start) = 0.1*im_pollutant_prices(t_all,i,pollutants); -im_pollutant_prices(t_all,i,pollutants)$(m_year(t_all) = s56_ghgprice_start+5) = 0.2*im_pollutant_prices(t_all,i,pollutants); -im_pollutant_prices(t_all,i,pollutants)$(m_year(t_all) = s56_ghgprice_start+10) = 0.4*im_pollutant_prices(t_all,i,pollutants); -im_pollutant_prices(t_all,i,pollutants)$(m_year(t_all) = s56_ghgprice_start+15) = 0.8*im_pollutant_prices(t_all,i,pollutants); -im_pollutant_prices(t_all,i,pollutants)$(m_year(t_all) >= s56_ghgprice_start+20) = im_pollutant_prices(t_all,i,pollutants); -); -***multiply GHG prices with development state to account for institutional requirements needed for implementing a GHG pricing scheme -im_pollutant_prices(t_all,i,pollutants)$(s56_ghgprice_devstate_scaling = 1) = im_pollutant_prices(t_all,i,pollutants)*im_development_state(t_all,i); - -***GHG emission policy -p56_emis_policy(t,i,pollutants,emis_source) = f56_emis_policy("%c56_emis_policy%",pollutants,emis_source); - -*reward neg emissions depending on s56_reward_neg_emis -v56_emission_costs_cell_oneoff.lo(j2,emis_cell_one56) = s56_reward_neg_emis; - -***construct age-class dependent C price for afforestation incentive -***this is needed because time steps (t) and age-classes (ac) can differ. ac and t_all are always in 5-year time steps. -*For missing years in t_all use C price of previous time step. This step makes sure that C prices for every 5-year time step are available. -loop(t_all$(m_year(t_all)>=s56_ghgprice_start), - im_pollutant_prices(t_all,i,"co2_c")$(im_pollutant_prices(t_all,i,"co2_c") = 0) = im_pollutant_prices(t_all-1,i,"co2_c"); -); -*Linear interpolation of C price for missing time steps -loop(t, - s56_timesteps = m_yeardiff(t)/5; - if (s56_timesteps > 1, - s56_counter = 0; - repeat( - s56_counter = s56_counter + 1; - s56_offset = s56_timesteps-s56_counter; - im_pollutant_prices(t_all-s56_offset,i,"co2_c")$(m_year(t_all) = m_year(t)) = - im_pollutant_prices(t-1,i,"co2_c") + - (im_pollutant_prices(t,i,"co2_c") - im_pollutant_prices(t-1,i,"co2_c"))*s56_counter/(s56_timesteps); - 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"); -*Shift C prices in age-classes for reflecting foresight. -*e.g. ac5 in 2020 should have the C price of ac0 in 2025, and ac20 in 2020 equals to ac0 in 2040 -p56_c_price_aff(t_all,i,ac)$(ord(t_all)+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. @@ -28,61 +43,61 @@ i57_mac_step_ch4(t,i) = min(201, ceil(im_pollutant_prices(t,i,"ch4")/25*44/12 / im_maccs_mitigation(t,i,emis_source,pollutants) = 0; 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) AND ord(maccs_steps) > 1), + 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) 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") = - sum(maccs_steps$(ord(maccs_steps) eq i57_mac_step_ch4(t,i) AND ord(maccs_steps) > 1), + sum(maccs_steps$(ord(maccs_steps) eq i57_mac_step_ch4(t,i,emis_source_rice_ch4) AND ord(maccs_steps) > 1), f57_maccs_ch4(t,i,"rice_ch4",maccs_steps)); im_maccs_mitigation(t,i,emis_source_ent_ferm_ch4,"ch4") = - sum(maccs_steps$(ord(maccs_steps) eq i57_mac_step_ch4(t,i) AND ord(maccs_steps) > 1), + sum(maccs_steps$(ord(maccs_steps) eq i57_mac_step_ch4(t,i,emis_source_ent_ferm_ch4) AND ord(maccs_steps) > 1), f57_maccs_ch4(t,i,"ent_ferm_ch4",maccs_steps)); im_maccs_mitigation(t,i,emis_source_awms_ch4,"ch4") = - sum(maccs_steps$(ord(maccs_steps) eq i57_mac_step_ch4(t,i) AND ord(maccs_steps) > 1), + sum(maccs_steps$(ord(maccs_steps) eq i57_mac_step_ch4(t,i,emis_source_awms_ch4) AND ord(maccs_steps) > 1), f57_maccs_ch4(t,i,"awms_ch4",maccs_steps)); $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 $ -step 2 (0.15-0.14) * 1 tCH4 * 5$/tC*12/44*28 0.38 mio $ 0.38 mio $ -step 3 (0.15-0.15) * 1 tCH4 * 10$/tC*12/44*28 0 mio $ 0.38 mio $ -step 4 (0.16-0.15) * 1 tCH4 * 15$/tC*12/44*28 1.15 mio $ 1.53 mio $ +step 1 0 mio $ 0 mio $ +step 2 (0.15-0.14) * 1 tCH4 * 5$/tC*12/44*28 0.38 mio $ 0.38 mio $ +step 3 (0.15-0.15) * 1 tCH4 * 10$/tC*12/44*28 0 mio $ 0.38 mio $ +step 4 (0.16-0.15) * 1 tCH4 * 15$/tC*12/44*28 1.15 mio $ 1.53 mio $ $offtext p57_maccs_costs_integral(t,i,emis_source,pollutants) = 0; loop(maccs_steps$(ord(maccs_steps) > 1), - p57_maccs_costs_integral(t,i,emis_source_inorg_fert_n2o,"n2o_n_direct")$(ord(maccs_steps) <= i57_mac_step_n2o(t,i)) = + p57_maccs_costs_integral(t,i,emis_source_inorg_fert_n2o,"n2o_n_direct")$(ord(maccs_steps) <= i57_mac_step_n2o(t,i,emis_source_inorg_fert_n2o)) = 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)) = - 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)) = + p57_maccs_costs_integral(t,i,emis_source_rice_ch4,"ch4")$(ord(maccs_steps) <= i57_mac_step_ch4(t,i,emis_source_rice_ch4)) = p57_maccs_costs_integral(t,i,emis_source_rice_ch4,"ch4") + (f57_maccs_ch4(t,i,"rice_ch4",maccs_steps) - f57_maccs_ch4(t,i,"rice_ch4",maccs_steps-1))*(ord(maccs_steps)-1)*s57_step_length; - p57_maccs_costs_integral(t,i,emis_source_ent_ferm_ch4,"ch4")$(ord(maccs_steps) <= i57_mac_step_ch4(t,i)) = + p57_maccs_costs_integral(t,i,emis_source_ent_ferm_ch4,"ch4")$(ord(maccs_steps) <= i57_mac_step_ch4(t,i,emis_source_ent_ferm_ch4)) = p57_maccs_costs_integral(t,i,emis_source_ent_ferm_ch4,"ch4") + (f57_maccs_ch4(t,i,"ent_ferm_ch4",maccs_steps) - f57_maccs_ch4(t,i,"ent_ferm_ch4",maccs_steps-1))*(ord(maccs_steps)-1)*s57_step_length; - p57_maccs_costs_integral(t,i,emis_source_awms_ch4,"ch4")$(ord(maccs_steps) <= i57_mac_step_ch4(t,i)) = + p57_maccs_costs_integral(t,i,emis_source_awms_ch4,"ch4")$(ord(maccs_steps) <= i57_mac_step_ch4(t,i,emis_source_awms_ch4)) = p57_maccs_costs_integral(t,i,emis_source_awms_ch4,"ch4") + (f57_maccs_ch4(t,i,"awms_ch4",maccs_steps) - f57_maccs_ch4(t,i,"awms_ch4",maccs_steps-1))*(ord(maccs_steps)-1)*s57_step_length; ); @@ -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 64% rename from modules/57_maccs/on_sep16/realization.gms rename to modules/57_maccs/on_aug22/realization.gms index 14c2ed1c20..a361edf7d4 100644 --- a/modules/57_maccs/on_sep16/realization.gms +++ b/modules/57_maccs/on_aug22/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -13,10 +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%" == "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_aug22/scaling.gms b/modules/57_maccs/on_aug22/scaling.gms new file mode 100644 index 0000000000..c9e888b5fa --- /dev/null +++ b/modules/57_maccs/on_aug22/scaling.gms @@ -0,0 +1,8 @@ +*** | (C) 2008-2023 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_maccs_costs.scale(i,factors) = 10e4; diff --git a/modules/57_maccs/on_sep16/sets.gms b/modules/57_maccs/on_aug22/sets.gms similarity index 70% rename from modules/57_maccs/on_sep16/sets.gms rename to modules/57_maccs/on_aug22/sets.gms index cbaa2b97ce..cc6abdef66 100644 --- a/modules/57_maccs/on_sep16/sets.gms +++ b/modules/57_maccs/on_aug22/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -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/declarations.gms b/modules/57_maccs/on_sep16/declarations.gms deleted file mode 100644 index 51f2af8c82..0000000000 --- a/modules/57_maccs/on_sep16/declarations.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 - -scalars - s57_step_length Step length in MACC data (yr) -; - -parameters - im_maccs_mitigation(t,i,emis_source,pollutants) Technical mitigation of GHG emissions (percent) - i57_mac_step_n2o(t,i) Helper to map N2O prices and maccs_steps (1) - i57_mac_step_ch4(t,i) Helper to map CH4 prices and maccs_steps (1) - p57_maccs_costs_integral(t,i,emis_source,pollutants) Costs of technical mitigation (USD95MER per Tg N CH4 C) -; - -equations - q57_total_costs(i) Calculation of total costs of technical mitigation (mio. USD95MER per yr) -; - -positive variables - vm_maccs_costs(i) Costs of technical mitigation of GHG emissions (mio. USD95MER per yr) -; - -*#################### R SECTION START (OUTPUT DECLARATIONS) #################### -parameters - ov_maccs_costs(t,i,type) Costs of technical mitigation of GHG emissions (mio. USD95MER per yr) - oq57_total_costs(t,i,type) Calculation of total costs of technical mitigation (mio. USD95MER per yr) -; -*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/57_maccs/on_sep16/equations.gms b/modules/57_maccs/on_sep16/equations.gms deleted file mode 100644 index eb83637072..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) =g= - 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/57_maccs/on_sep16/postsolve.gms b/modules/57_maccs/on_sep16/postsolve.gms deleted file mode 100644 index 7627249228..0000000000 --- a/modules/57_maccs/on_sep16/postsolve.gms +++ /dev/null @@ -1,19 +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_maccs_costs(t,i,"marginal") = vm_maccs_costs.m(i); - oq57_total_costs(t,i,"marginal") = q57_total_costs.m(i); - ov_maccs_costs(t,i,"level") = vm_maccs_costs.l(i); - oq57_total_costs(t,i,"level") = q57_total_costs.l(i); - ov_maccs_costs(t,i,"upper") = vm_maccs_costs.up(i); - oq57_total_costs(t,i,"upper") = q57_total_costs.up(i); - ov_maccs_costs(t,i,"lower") = vm_maccs_costs.lo(i); - oq57_total_costs(t,i,"lower") = q57_total_costs.lo(i); -*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/58_peatland/module.gms b/modules/58_peatland/module.gms index d29bbd5871..66a828b7bf 100644 --- a/modules/58_peatland/module.gms +++ b/modules/58_peatland/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/58_peatland/off/declarations.gms b/modules/58_peatland/off/declarations.gms index 5a675c152a..7119a0916d 100644 --- a/modules/58_peatland/off/declarations.gms +++ b/modules/58_peatland/off/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,14 +6,12 @@ *** | Contact: magpie@pik-potsdam.de positive variables - vm_peatland_emis(j) GHG emissions from managed peatland (t CO2eq per year) - vm_peatland_cost(j) One-time and recurring cost of managed peatland (mio. USD05MER per yr) + vm_peatland_cost(j) One-time and recurring cost of managed peatland (mio. USD05MER per yr) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_peatland_emis(t,j,type) GHG emissions from managed peatland (t CO2eq per year) ov_peatland_cost(t,j,type) One-time and recurring cost of managed peatland (mio. USD05MER per yr) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/58_peatland/off/not_used.txt b/modules/58_peatland/off/not_used.txt index 79733353c7..33f27da3b8 100644 --- a/modules/58_peatland/off/not_used.txt +++ b/modules/58_peatland/off/not_used.txt @@ -1,10 +1,3 @@ -# | (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_land, input, not used pcm_land, input, not used diff --git a/modules/58_peatland/off/postsolve.gms b/modules/58_peatland/off/postsolve.gms index 3aa1e7f40a..c2a26ae51b 100644 --- a/modules/58_peatland/off/postsolve.gms +++ b/modules/58_peatland/off/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,13 +6,9 @@ *** | Contact: magpie@pik-potsdam.de *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_peatland_emis(t,j,"marginal") = vm_peatland_emis.m(j); ov_peatland_cost(t,j,"marginal") = vm_peatland_cost.m(j); - ov_peatland_emis(t,j,"level") = vm_peatland_emis.l(j); ov_peatland_cost(t,j,"level") = vm_peatland_cost.l(j); - ov_peatland_emis(t,j,"upper") = vm_peatland_emis.up(j); ov_peatland_cost(t,j,"upper") = vm_peatland_cost.up(j); - ov_peatland_emis(t,j,"lower") = vm_peatland_emis.lo(j); ov_peatland_cost(t,j,"lower") = vm_peatland_cost.lo(j); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/58_peatland/off/preloop.gms b/modules/58_peatland/off/preloop.gms index 841d3c9654..fe21ad4a22 100644 --- a/modules/58_peatland/off/preloop.gms +++ b/modules/58_peatland/off/preloop.gms @@ -1,9 +1,9 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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_peatland_emis.fx(j) = 0; +vm_emissions_reg.fx(i,"peatland",pollutants) = 0; vm_peatland_cost.fx(j) = 0; diff --git a/modules/58_peatland/off/realization.gms b/modules/58_peatland/off/realization.gms index 2885df39bd..699b51bb76 100644 --- a/modules/58_peatland/off/realization.gms +++ b/modules/58_peatland/off/realization.gms @@ -1,13 +1,14 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 In this realization GHG emissions from degrading peatlands are assumed zero. +*' @description In this realization, peatlands do not exist. Therefore, +*' GHG emissions from degrading peatlands are assumed zero. -*' @limitations GHG emissions from degrading peatlands are assumed zero +*' @limitations Peatland area and associated GHG emissions are fixed to zero. *####################### R SECTION START (PHASES) ############################## $Ifi "%phase%" == "declarations" $include "./modules/58_peatland/off/declarations.gms" diff --git a/modules/58_peatland/on/declarations.gms b/modules/58_peatland/on/declarations.gms index 1254599921..0effd7a210 100644 --- a/modules/58_peatland/on/declarations.gms +++ b/modules/58_peatland/on/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,71 +6,78 @@ *** | Contact: magpie@pik-potsdam.de parameters - p58_scaling_factor(j) Scaling factor for managed peatland (1) - p58_intact_ratio(t,j) Ratio of intact and total peatland (1) - p58_peatland_degrad_used(j) Intermediate calculation in peatland initialization (mio. ha) - p58_peatland_degrad_unused(j) Intermediate calculation in peatland initialization (mio. ha) - p58_peatland_degrad_unused_weight(j,land58) Weight for intermediate calculation in peatland initialization (1) - p58_land_area(j) Total land area (mio. ha) - p58_peatland_area(j) Total peatland area (mio. ha) + p58_scaling_factor(j) Scaling factor for managed peatland (1) + p58_calib_factor(j,land58) Calibration factor for managed peatland (1) + p58_peatland_degrad(j) Intermediate calculation in peatland initialization (mio. ha) p58_ipcc_wetland_ef(clcl58,land58,emis58,man58) Wetland GWP100 emission factors (t CO2eq per ha) - pc58_man_land(j) Total managed land (mio. ha) - pc58_man_land_shr(j,land58) Share of total managed land (1) - pc58_peatland_man(j,man58,land58) Managed peatland (mio. ha) - pc58_peatland_intact(j) Intact peatland (mio. ha) - p58_mapping_cell_climate(j,clcl58) Mapping between cells and climate regions (binary) + p58_man_land_area(j) Total managed land (mio. ha) + pc58_peatland_man(j,man58,land58) Managed peatland (mio. ha) + pc58_peatland_intact(j) Intact peatland (mio. ha) + p58_mapping_cell_climate(j,clcl58) Mapping between cells and climate regions (binary) + p58_peatland_degrad_weight(j,land58) Weight for peatland distribution to land58 (1) + i58_cost_rewet_recur(t) Recurring costs for rewetted peatland (USD05MER per ha) + i58_cost_rewet_onetime(t) One-time costs for peatland restoration (USD05MER per ha) + i58_cost_degrad_recur(t) Recurring costs for degraded peatland (USD05MER per ha) + i58_cost_degrad_onetime(t) One-time costs for peatland degradation (USD05MER per ha) + p58_conversion_factor(emisSub58) Conversion factor from GWP100 GHG emissions to element (1) ; equations - q58_transition_matrix(j) Peatland transitions (mio. ha) - q58_transition_to(j,to58) Peatland transitions to (mio. ha) - q58_transition_from(j,from58) Peatland transitions from (mio. ha) - q58_expansion(j,to58) Peatland expansion (mio. ha) - q58_reduction(j,from58) Peatland reduction (mio. ha) - q58_peatland_degrad(j,land58) Degraded peatland area constraint (mio. ha) - q58_peatland_intact(j) Intact to degrad peatland constraint (mio. ha) - q58_peatland_cost(j) One-time and recurring cost of managed peatland (mio. USD05MER per yr) - q58_peatland_cost_annuity(j) Annuity costs of managed peatland expansion in the current timestep (mio. USD05MER per yr) - q58_peatland_emis_detail(j,emis58) Detailed GHG emissions from managed peatland (t CO2eq per year) - q58_peatland_emis(j) GHG emissions from managed peatland (t CO2eq per year) + q58_transition_matrix(j) Peatland transitions (mio. ha) + q58_transition_to(j,to58) Peatland transitions to (mio. ha) + q58_transition_from(j,from58) Peatland transitions from (mio. ha) + q58_expansion(j,to58) Peatland expansion (mio. ha) + q58_reduction(j,from58) Peatland reduction (mio. ha) + q58_peatland_degrad(j,land58) Constraint for peatland degradation (mio. ha) + q58_peatland_rewet(j) Constraint for peatland rewetting (mio. ha) + q58_peatland_cost_full(j) One-time and recurring cost of peatland conversion and management including artifical balance cost (mio. USD05MER per yr) + q58_peatland_cost(j) One-time and recurring cost of peatland conversion and management (mio. USD05MER per yr) + q58_peatland_cost_annuity(j) Annuity costs of peatland conversion in the current timestep (mio. USD05MER per yr) + q58_peatland_emis_detail(j,emis58) Detailed GHG emissions from managed peatland (t CO2eq per year) + q58_peatland_emis(i,poll58) GHG emissions from managed peatland (Tg per yr) ; variables - v58_peatland_emis(j,emis58) Detailed GHG emissions from managed peatland (t CO2eq per year) + vm_peatland_cost(j) One-time and recurring cost of managed peatland including artifical balance cost (mio. USD05MER per yr) + v58_peatland_cost(j) One-time and recurring cost of managed peatland (mio. USD05MER per yr) + v58_peatland_cost_annuity(j) Annuity costs of managed peatland expansion in the current timestep (mio. USD05MER per yr) + v58_peatland_emis(j,emis58) Detailed GHG emissions from managed peatland (t CO2eq per year) ; positive variables - v58_lu_transitions(j,from58,to58) Peatland transitions (mio. ha) - v58_expansion(j,stat58) Peatland expansion (mio. ha) - v58_reduction(j,stat58) Peatland reduction (mio. ha) - vm_peatland_emis(j) GHG emissions from managed peatland (t CO2eq per year) - vm_peatland_cost(j) One-time and recurring cost of managed peatland (mio. USD05MER per yr) - v58_peatland_man(j,man58,land58) Managed peatland (mio. ha) - v58_peatland_intact(j) Intact peatland (mio. ha) - v58_peatland_cost_annuity(j) Annuity costs of managed peatland expansion in the current timestep (mio. USD05MER per yr) + v58_lu_transitions(j,from58,to58) Peatland transitions (mio. ha) + v58_expansion(j,stat58) Peatland expansion (mio. ha) + v58_reduction(j,stat58) Peatland reduction (mio. ha) + v58_peatland_man(j,man58,land58) Managed peatland (mio. ha) + v58_peatland_intact(j) Intact peatland (mio. ha) + v58_balance_positive(j) Balance variable for peatland transitions (mio. ha) + v58_balance_negative(j) Balance variable for peatland transitions (mio. ha) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters + ov_peatland_cost(t,j,type) One-time and recurring cost of managed peatland including artifical balance cost (mio. USD05MER per yr) + ov58_peatland_cost(t,j,type) One-time and recurring cost of managed peatland (mio. USD05MER per yr) + ov58_peatland_cost_annuity(t,j,type) Annuity costs of managed peatland expansion in the current timestep (mio. USD05MER per yr) ov58_peatland_emis(t,j,emis58,type) Detailed GHG emissions from managed peatland (t CO2eq per year) ov58_lu_transitions(t,j,from58,to58,type) Peatland transitions (mio. ha) ov58_expansion(t,j,stat58,type) Peatland expansion (mio. ha) ov58_reduction(t,j,stat58,type) Peatland reduction (mio. ha) - ov_peatland_emis(t,j,type) GHG emissions from managed peatland (t CO2eq per year) - ov_peatland_cost(t,j,type) One-time and recurring cost of managed peatland (mio. USD05MER per yr) ov58_peatland_man(t,j,man58,land58,type) Managed peatland (mio. ha) ov58_peatland_intact(t,j,type) Intact peatland (mio. ha) - ov58_peatland_cost_annuity(t,j,type) Annuity costs of managed peatland expansion in the current timestep (mio. USD05MER per yr) + ov58_balance_positive(t,j,type) Balance variable for peatland transitions (mio. ha) + ov58_balance_negative(t,j,type) Balance variable for peatland transitions (mio. ha) oq58_transition_matrix(t,j,type) Peatland transitions (mio. ha) oq58_transition_to(t,j,to58,type) Peatland transitions to (mio. ha) oq58_transition_from(t,j,from58,type) Peatland transitions from (mio. ha) oq58_expansion(t,j,to58,type) Peatland expansion (mio. ha) oq58_reduction(t,j,from58,type) Peatland reduction (mio. ha) - oq58_peatland_degrad(t,j,land58,type) Degraded peatland area constraint (mio. ha) - oq58_peatland_intact(t,j,type) Intact to degrad peatland constraint (mio. ha) - oq58_peatland_cost(t,j,type) One-time and recurring cost of managed peatland (mio. USD05MER per yr) - oq58_peatland_cost_annuity(t,j,type) Annuity costs of managed peatland expansion in the current timestep (mio. USD05MER per yr) + oq58_peatland_degrad(t,j,land58,type) Constraint for peatland degradation (mio. ha) + oq58_peatland_rewet(t,j,type) Constraint for peatland rewetting (mio. ha) + oq58_peatland_cost_full(t,j,type) One-time and recurring cost of peatland conversion and management including artifical balance cost (mio. USD05MER per yr) + oq58_peatland_cost(t,j,type) One-time and recurring cost of peatland conversion and management (mio. USD05MER per yr) + oq58_peatland_cost_annuity(t,j,type) Annuity costs of peatland conversion in the current timestep (mio. USD05MER per yr) oq58_peatland_emis_detail(t,j,emis58,type) Detailed GHG emissions from managed peatland (t CO2eq per year) - oq58_peatland_emis(t,j,type) GHG emissions from managed peatland (t CO2eq per year) + oq58_peatland_emis(t,i,poll58,type) GHG emissions from managed peatland (Tg per yr) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/58_peatland/on/equations.gms b/modules/58_peatland/on/equations.gms index 73884c7073..b2214146eb 100644 --- a/modules/58_peatland/on/equations.gms +++ b/modules/58_peatland/on/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,35 +7,46 @@ *' @equations +*' 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. + q58_transition_matrix(j2) .. - sum((from58,to58), v58_lu_transitions(j2,from58,to58)) =e= - p58_peatland_area(j2); + 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); q58_transition_to(j2,to58) .. - sum(from58, v58_lu_transitions(j2,from58,to58)) =e= - v58_peatland_man(j2,"degrad","crop")$(sameas(to58,"degrad_crop")) - + v58_peatland_man(j2,"degrad","past")$(sameas(to58,"degrad_past")) - + v58_peatland_man(j2,"degrad","forestry")$(sameas(to58,"degrad_forestry")) - + v58_peatland_man(j2,"unused","crop")$(sameas(to58,"unused_crop")) - + v58_peatland_man(j2,"unused","past")$(sameas(to58,"unused_past")) - + v58_peatland_man(j2,"unused","forestry")$(sameas(to58,"unused_forestry")) - + v58_peatland_man(j2,"rewet","crop")$(sameas(to58,"rewet_crop")) - + v58_peatland_man(j2,"rewet","past")$(sameas(to58,"rewet_past")) - + v58_peatland_man(j2,"rewet","forestry")$(sameas(to58,"rewet_forestry")) - + v58_peatland_intact(j2)$(sameas(to58,"intact")); + sum(from58, v58_lu_transitions(j2,from58,to58)) =e= + v58_peatland_man(j2,"degrad","crop")$(sameas(to58,"degrad_crop")) + + v58_peatland_man(j2,"degrad","past")$(sameas(to58,"degrad_past")) + + v58_peatland_man(j2,"degrad","forestry")$(sameas(to58,"degrad_forestry")) + + v58_peatland_man(j2,"unused","crop")$(sameas(to58,"unused_crop")) + + v58_peatland_man(j2,"unused","past")$(sameas(to58,"unused_past")) + + v58_peatland_man(j2,"unused","forestry")$(sameas(to58,"unused_forestry")) + + v58_peatland_man(j2,"rewet","crop")$(sameas(to58,"rewet_crop")) + + v58_peatland_man(j2,"rewet","past")$(sameas(to58,"rewet_past")) + + v58_peatland_man(j2,"rewet","forestry")$(sameas(to58,"rewet_forestry")) + + v58_peatland_intact(j2)$(sameas(to58,"intact")); q58_transition_from(j2,from58) .. - sum(to58, v58_lu_transitions(j2,from58,to58)) =e= - pc58_peatland_man(j2,"degrad","crop")$(sameas(from58,"degrad_crop")) - + pc58_peatland_man(j2,"degrad","past")$(sameas(from58,"degrad_past")) - + pc58_peatland_man(j2,"degrad","forestry")$(sameas(from58,"degrad_forestry")) - + pc58_peatland_man(j2,"unused","crop")$(sameas(from58,"unused_crop")) - + pc58_peatland_man(j2,"unused","past")$(sameas(from58,"unused_past")) - + pc58_peatland_man(j2,"unused","forestry")$(sameas(from58,"unused_forestry")) - + pc58_peatland_man(j2,"rewet","crop")$(sameas(from58,"rewet_crop")) - + pc58_peatland_man(j2,"rewet","past")$(sameas(from58,"rewet_past")) - + pc58_peatland_man(j2,"rewet","forestry")$(sameas(from58,"rewet_forestry")) - + pc58_peatland_intact(j2)$(sameas(from58,"intact")); + sum(to58, v58_lu_transitions(j2,from58,to58)) =e= + pc58_peatland_man(j2,"degrad","crop")$(sameas(from58,"degrad_crop")) + + pc58_peatland_man(j2,"degrad","past")$(sameas(from58,"degrad_past")) + + pc58_peatland_man(j2,"degrad","forestry")$(sameas(from58,"degrad_forestry")) + + pc58_peatland_man(j2,"unused","crop")$(sameas(from58,"unused_crop")) + + pc58_peatland_man(j2,"unused","past")$(sameas(from58,"unused_past")) + + pc58_peatland_man(j2,"unused","forestry")$(sameas(from58,"unused_forestry")) + + pc58_peatland_man(j2,"rewet","crop")$(sameas(from58,"rewet_crop")) + + pc58_peatland_man(j2,"rewet","past")$(sameas(from58,"rewet_past")) + + pc58_peatland_man(j2,"rewet","forestry")$(sameas(from58,"rewet_forestry")) + + pc58_peatland_intact(j2)$(sameas(from58,"intact")); *' The following two equations calculate land expansion and land contraction based *' on the above land transition matrix. @@ -50,9 +61,10 @@ sum(to58$(not sameas(from58,to58)), v58_lu_transitions(j2,from58,to58)); -*' Future peatland degradation (v58_peatland_man) depends on changes of managed land, -*' scaled with the ratio of total peatland area and total land area (p58_scaling_factor). -*' By multiplying changes in managed land with this scaling factor we implicitly assume +*' 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`) +*' 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. *' The following example illustrates the mechanism used for projecting peatland dynamics: *' In a given grid cell, the total land area is 50 Mha and the total peatland area is 10 Mha. @@ -60,34 +72,43 @@ *' If cropland expands by 5 Mha, 1 Mha of intact peatland is converted to degraded peatland (5 Mha*0.2). *' If the total cell would become cropland, degraded peatland would equal to the total peatland area (50 Mha * 0.2 = 10 Mha). - q58_peatland_degrad(j2,land58) .. - v58_peatland_man(j2,"degrad",land58) =e= - pc58_peatland_man(j2,"degrad",land58) - + ((vm_land(j2,land58)-pcm_land(j2,land58))*p58_scaling_factor(j2))$(sum(ct, m_year(ct))>2015); + q58_peatland_degrad(j2,land58)$(sum(ct, m_year(ct)) > s58_fix_peatland) .. + v58_peatland_man(j2,"degrad",land58) =e= + vm_land(j2,land58)*p58_scaling_factor(j2)*p58_calib_factor(j2,land58); + +*' 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_degrad58, v58_reduction(j2,stat_degrad58) + v58_expansion(j2,stat_degrad58)) - v58_reduction(j2,"intact"); -*' Either conversion of intact to degraded peatland OR conversion of degraded to rewetted peatland. -*' This constraint avoid the conversion of intact peatland into rewetted peatland. +*' Costs for peatland degradation and rewetting - q58_peatland_intact(j2) .. - sum(stat_degrad58, v58_lu_transitions(j2,"intact",stat_degrad58)) * - sum((stat_degrad58,stat_rewet58), v58_lu_transitions(j2,stat_degrad58,stat_rewet58)) - =e= - 0; + q58_peatland_cost_full(j2) .. + vm_peatland_cost(j2) =e= v58_peatland_cost(j2) + (v58_balance_positive(j2) + v58_balance_negative(j2)) * s58_cost_balance; q58_peatland_cost(j2) .. - vm_peatland_cost(j2) =e= v58_peatland_cost_annuity(j2) - + sum(land58, v58_peatland_man(j2,"rewet",land58) * s58_rewet_cost_recur); + 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((from58,stat_rewet58), v58_lu_transitions(j2,from58,stat_rewet58) * s58_rewet_cost_onetime) - * sum((cell(i2,j2),ct),pm_interest(ct,i2)/(1+pm_interest(ct,i2))); + v58_peatland_cost_annuity(j2) =e= + (sum(stat_rewet58, v58_expansion(j2,stat_rewet58)) * sum(ct, i58_cost_rewet_onetime(ct)) + + (v58_reduction(j2,"intact") + sum(stat_rewet58, v58_reduction(j2,stat_rewet58))) * sum(ct, i58_cost_degrad_onetime(ct))) + * sum((cell(i2,j2),ct),pm_interest(ct,i2)/(1+pm_interest(ct,i2))); + +*' GHG emissions from managed peatlands (degraded and rewetted) q58_peatland_emis_detail(j2,emis58) .. - v58_peatland_emis(j2,emis58) =e= - sum((man58,land58,clcl58), v58_peatland_man(j2,man58,land58) * - p58_mapping_cell_climate(j2,clcl58) * p58_ipcc_wetland_ef(clcl58,land58,emis58,man58)); + v58_peatland_emis(j2,emis58) =e= + 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_emissions_reg` +*' using GWP100 conversion factors from AR5 (same as in @wilson_2016). - q58_peatland_emis(j2) .. - vm_peatland_emis(j2) =e= - sum(emis58, v58_peatland_emis(j2,emis58)); + q58_peatland_emis(i2,poll58) .. + 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)); diff --git a/modules/58_peatland/on/input.gms b/modules/58_peatland/on/input.gms index 7b9d64bd89..2a9a73cc03 100644 --- a/modules/58_peatland/on/input.gms +++ b/modules/58_peatland/on/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,9 +6,13 @@ *** | Contact: magpie@pik-potsdam.de scalars - s58_rewetting_switch Peatland rewetting on (Inf) or off (0) / 0 / - s58_rewet_cost_onetime One-time costs for peatland rewetting (USD05MER per ha) / 7000 / - s58_rewet_cost_recur Recurring costs for peatland rewetting (USD05MER per ha) / 200 / + s58_cost_rewet_recur Recurring costs for rewetted peatland (USD05MER per ha) / 200 / + s58_cost_rewet_onetime One-time costs for peatland restoration (USD05MER per ha) / 7000 / + s58_cost_degrad_recur Recurring costs for degraded peatland (USD05MER per ha) / 0 / + s58_cost_degrad_onetime One-time costs for peatland degradation (USD05MER per ha) / 0 / + s58_rewetting_switch Peatland rewetting on (Inf) or off (0) / Inf / + s58_fix_peatland Year indicating until when peatland area should be fixed to 2015 levels (year) / 2015 / + s58_cost_balance Artificial cost for balance variable (USD05MER per ha) / 1e+06 / ; parameters diff --git a/modules/58_peatland/on/postsolve.gms b/modules/58_peatland/on/postsolve.gms index 319cd093ab..0c9b5643f0 100644 --- a/modules/58_peatland/on/postsolve.gms +++ b/modules/58_peatland/on/postsolve.gms @@ -1,92 +1,115 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -pc58_peatland_man(j,man58,land58) = v58_peatland_man.l(j,man58,land58); +* Update of degraded peatland based on current managed land in the last time steps of fixed peatland area. +if (m_year(t) = s58_fix_peatland, + p58_scaling_factor(j)$(sum(land, vm_land.l(j,land)) > 1e-20) = (sum((man58,land58), v58_peatland_man.l(j,man58,land58)) + v58_peatland_intact.l(j)) / sum(land, vm_land.l(j,land)); + p58_calib_factor(j,land58) = 1; + p58_calib_factor(j,land58)$(vm_land.l(j,land58) * p58_scaling_factor(j) > 1e-20) = (p58_peatland_degrad(j) * p58_peatland_degrad_weight(j,land58)) / (vm_land.l(j,land58) * p58_scaling_factor(j)); + p58_calib_factor(j,land58)$(p58_calib_factor(j,land58) > 1) = 1; + pc58_peatland_man(j,"degrad",land58) = vm_land.l(j,land58) * p58_scaling_factor(j) * p58_calib_factor(j,land58); + pc58_peatland_man(j,"unused",land58) = p58_peatland_degrad(j) * p58_peatland_degrad_weight(j,land58) - pc58_peatland_man(j,"degrad",land58); +else + pc58_peatland_man(j,man58,land58) = v58_peatland_man.l(j,man58,land58); +); + pc58_peatland_intact(j) = v58_peatland_intact.l(j); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### + ov_peatland_cost(t,j,"marginal") = vm_peatland_cost.m(j); + ov58_peatland_cost(t,j,"marginal") = v58_peatland_cost.m(j); + ov58_peatland_cost_annuity(t,j,"marginal") = v58_peatland_cost_annuity.m(j); ov58_peatland_emis(t,j,emis58,"marginal") = v58_peatland_emis.m(j,emis58); ov58_lu_transitions(t,j,from58,to58,"marginal") = v58_lu_transitions.m(j,from58,to58); ov58_expansion(t,j,stat58,"marginal") = v58_expansion.m(j,stat58); ov58_reduction(t,j,stat58,"marginal") = v58_reduction.m(j,stat58); - ov_peatland_emis(t,j,"marginal") = vm_peatland_emis.m(j); - ov_peatland_cost(t,j,"marginal") = vm_peatland_cost.m(j); ov58_peatland_man(t,j,man58,land58,"marginal") = v58_peatland_man.m(j,man58,land58); ov58_peatland_intact(t,j,"marginal") = v58_peatland_intact.m(j); - ov58_peatland_cost_annuity(t,j,"marginal") = v58_peatland_cost_annuity.m(j); + ov58_balance_positive(t,j,"marginal") = v58_balance_positive.m(j); + ov58_balance_negative(t,j,"marginal") = v58_balance_negative.m(j); oq58_transition_matrix(t,j,"marginal") = q58_transition_matrix.m(j); oq58_transition_to(t,j,to58,"marginal") = q58_transition_to.m(j,to58); oq58_transition_from(t,j,from58,"marginal") = q58_transition_from.m(j,from58); oq58_expansion(t,j,to58,"marginal") = q58_expansion.m(j,to58); oq58_reduction(t,j,from58,"marginal") = q58_reduction.m(j,from58); oq58_peatland_degrad(t,j,land58,"marginal") = q58_peatland_degrad.m(j,land58); - oq58_peatland_intact(t,j,"marginal") = q58_peatland_intact.m(j); + oq58_peatland_rewet(t,j,"marginal") = q58_peatland_rewet.m(j); + oq58_peatland_cost_full(t,j,"marginal") = q58_peatland_cost_full.m(j); oq58_peatland_cost(t,j,"marginal") = q58_peatland_cost.m(j); oq58_peatland_cost_annuity(t,j,"marginal") = q58_peatland_cost_annuity.m(j); oq58_peatland_emis_detail(t,j,emis58,"marginal") = q58_peatland_emis_detail.m(j,emis58); - oq58_peatland_emis(t,j,"marginal") = q58_peatland_emis.m(j); + oq58_peatland_emis(t,i,poll58,"marginal") = q58_peatland_emis.m(i,poll58); + ov_peatland_cost(t,j,"level") = vm_peatland_cost.l(j); + ov58_peatland_cost(t,j,"level") = v58_peatland_cost.l(j); + ov58_peatland_cost_annuity(t,j,"level") = v58_peatland_cost_annuity.l(j); ov58_peatland_emis(t,j,emis58,"level") = v58_peatland_emis.l(j,emis58); ov58_lu_transitions(t,j,from58,to58,"level") = v58_lu_transitions.l(j,from58,to58); ov58_expansion(t,j,stat58,"level") = v58_expansion.l(j,stat58); ov58_reduction(t,j,stat58,"level") = v58_reduction.l(j,stat58); - ov_peatland_emis(t,j,"level") = vm_peatland_emis.l(j); - ov_peatland_cost(t,j,"level") = vm_peatland_cost.l(j); ov58_peatland_man(t,j,man58,land58,"level") = v58_peatland_man.l(j,man58,land58); ov58_peatland_intact(t,j,"level") = v58_peatland_intact.l(j); - ov58_peatland_cost_annuity(t,j,"level") = v58_peatland_cost_annuity.l(j); + ov58_balance_positive(t,j,"level") = v58_balance_positive.l(j); + ov58_balance_negative(t,j,"level") = v58_balance_negative.l(j); oq58_transition_matrix(t,j,"level") = q58_transition_matrix.l(j); oq58_transition_to(t,j,to58,"level") = q58_transition_to.l(j,to58); oq58_transition_from(t,j,from58,"level") = q58_transition_from.l(j,from58); oq58_expansion(t,j,to58,"level") = q58_expansion.l(j,to58); oq58_reduction(t,j,from58,"level") = q58_reduction.l(j,from58); oq58_peatland_degrad(t,j,land58,"level") = q58_peatland_degrad.l(j,land58); - oq58_peatland_intact(t,j,"level") = q58_peatland_intact.l(j); + oq58_peatland_rewet(t,j,"level") = q58_peatland_rewet.l(j); + oq58_peatland_cost_full(t,j,"level") = q58_peatland_cost_full.l(j); oq58_peatland_cost(t,j,"level") = q58_peatland_cost.l(j); oq58_peatland_cost_annuity(t,j,"level") = q58_peatland_cost_annuity.l(j); oq58_peatland_emis_detail(t,j,emis58,"level") = q58_peatland_emis_detail.l(j,emis58); - oq58_peatland_emis(t,j,"level") = q58_peatland_emis.l(j); + oq58_peatland_emis(t,i,poll58,"level") = q58_peatland_emis.l(i,poll58); + ov_peatland_cost(t,j,"upper") = vm_peatland_cost.up(j); + ov58_peatland_cost(t,j,"upper") = v58_peatland_cost.up(j); + ov58_peatland_cost_annuity(t,j,"upper") = v58_peatland_cost_annuity.up(j); ov58_peatland_emis(t,j,emis58,"upper") = v58_peatland_emis.up(j,emis58); ov58_lu_transitions(t,j,from58,to58,"upper") = v58_lu_transitions.up(j,from58,to58); ov58_expansion(t,j,stat58,"upper") = v58_expansion.up(j,stat58); ov58_reduction(t,j,stat58,"upper") = v58_reduction.up(j,stat58); - ov_peatland_emis(t,j,"upper") = vm_peatland_emis.up(j); - ov_peatland_cost(t,j,"upper") = vm_peatland_cost.up(j); ov58_peatland_man(t,j,man58,land58,"upper") = v58_peatland_man.up(j,man58,land58); ov58_peatland_intact(t,j,"upper") = v58_peatland_intact.up(j); - ov58_peatland_cost_annuity(t,j,"upper") = v58_peatland_cost_annuity.up(j); + ov58_balance_positive(t,j,"upper") = v58_balance_positive.up(j); + ov58_balance_negative(t,j,"upper") = v58_balance_negative.up(j); oq58_transition_matrix(t,j,"upper") = q58_transition_matrix.up(j); oq58_transition_to(t,j,to58,"upper") = q58_transition_to.up(j,to58); oq58_transition_from(t,j,from58,"upper") = q58_transition_from.up(j,from58); oq58_expansion(t,j,to58,"upper") = q58_expansion.up(j,to58); oq58_reduction(t,j,from58,"upper") = q58_reduction.up(j,from58); oq58_peatland_degrad(t,j,land58,"upper") = q58_peatland_degrad.up(j,land58); - oq58_peatland_intact(t,j,"upper") = q58_peatland_intact.up(j); + oq58_peatland_rewet(t,j,"upper") = q58_peatland_rewet.up(j); + oq58_peatland_cost_full(t,j,"upper") = q58_peatland_cost_full.up(j); oq58_peatland_cost(t,j,"upper") = q58_peatland_cost.up(j); oq58_peatland_cost_annuity(t,j,"upper") = q58_peatland_cost_annuity.up(j); oq58_peatland_emis_detail(t,j,emis58,"upper") = q58_peatland_emis_detail.up(j,emis58); - oq58_peatland_emis(t,j,"upper") = q58_peatland_emis.up(j); + oq58_peatland_emis(t,i,poll58,"upper") = q58_peatland_emis.up(i,poll58); + ov_peatland_cost(t,j,"lower") = vm_peatland_cost.lo(j); + ov58_peatland_cost(t,j,"lower") = v58_peatland_cost.lo(j); + ov58_peatland_cost_annuity(t,j,"lower") = v58_peatland_cost_annuity.lo(j); ov58_peatland_emis(t,j,emis58,"lower") = v58_peatland_emis.lo(j,emis58); ov58_lu_transitions(t,j,from58,to58,"lower") = v58_lu_transitions.lo(j,from58,to58); ov58_expansion(t,j,stat58,"lower") = v58_expansion.lo(j,stat58); ov58_reduction(t,j,stat58,"lower") = v58_reduction.lo(j,stat58); - ov_peatland_emis(t,j,"lower") = vm_peatland_emis.lo(j); - ov_peatland_cost(t,j,"lower") = vm_peatland_cost.lo(j); ov58_peatland_man(t,j,man58,land58,"lower") = v58_peatland_man.lo(j,man58,land58); ov58_peatland_intact(t,j,"lower") = v58_peatland_intact.lo(j); - ov58_peatland_cost_annuity(t,j,"lower") = v58_peatland_cost_annuity.lo(j); + ov58_balance_positive(t,j,"lower") = v58_balance_positive.lo(j); + ov58_balance_negative(t,j,"lower") = v58_balance_negative.lo(j); oq58_transition_matrix(t,j,"lower") = q58_transition_matrix.lo(j); oq58_transition_to(t,j,to58,"lower") = q58_transition_to.lo(j,to58); oq58_transition_from(t,j,from58,"lower") = q58_transition_from.lo(j,from58); oq58_expansion(t,j,to58,"lower") = q58_expansion.lo(j,to58); oq58_reduction(t,j,from58,"lower") = q58_reduction.lo(j,from58); oq58_peatland_degrad(t,j,land58,"lower") = q58_peatland_degrad.lo(j,land58); - oq58_peatland_intact(t,j,"lower") = q58_peatland_intact.lo(j); + oq58_peatland_rewet(t,j,"lower") = q58_peatland_rewet.lo(j); + oq58_peatland_cost_full(t,j,"lower") = q58_peatland_cost_full.lo(j); oq58_peatland_cost(t,j,"lower") = q58_peatland_cost.lo(j); oq58_peatland_cost_annuity(t,j,"lower") = q58_peatland_cost_annuity.lo(j); oq58_peatland_emis_detail(t,j,emis58,"lower") = q58_peatland_emis_detail.lo(j,emis58); - oq58_peatland_emis(t,j,"lower") = q58_peatland_emis.lo(j); + oq58_peatland_emis(t,i,poll58,"lower") = q58_peatland_emis.lo(i,poll58); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/58_peatland/on/preloop.gms b/modules/58_peatland/on/preloop.gms index a9104a80ff..c679acaa1d 100644 --- a/modules/58_peatland/on/preloop.gms +++ b/modules/58_peatland/on/preloop.gms @@ -1,16 +1,43 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -pc58_peatland_intact(j) = 0; -pc58_peatland_man(j,man58,land58) = 0; +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; +p58_conversion_factor("ch4") = 1/34; +p58_conversion_factor("n2o") = 1/298*28/44; p58_mapping_cell_climate(j,clcl58) = sum(clcl_mapping(clcl,clcl58),pm_climate_class(j,clcl)); 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"); -p58_peatland_cost_past(t,j) = 0; +* 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); +* Share of cropland, pasture and forestry in total managed land, used for distribution of degraded peatland (f58_peatland_degrad) to managed land. +p58_man_land_area(j) = sum(land58, pcm_land(j,land58)); +p58_peatland_degrad_weight(j,land58) = 1/card(land58); +p58_peatland_degrad_weight(j,land58)$(p58_man_land_area(j) > 0) = pcm_land(j,land58) / p58_man_land_area(j); +* Calibration factor for alignment with historic levels of degraded peatland +p58_calib_factor(j,land58) = 1; +p58_calib_factor(j,land58)$(pcm_land(j,land58) * p58_scaling_factor(j) > 1e-20) = (f58_peatland_degrad(j) * p58_peatland_degrad_weight(j,land58)) / (pcm_land(j,land58)*p58_scaling_factor(j)); +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. +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); +pc58_peatland_man(j,"unused",land58)$(pc58_peatland_man(j,"unused",land58) < 0) = 0; +p58_peatland_degrad(j) = sum((man58,land58), pc58_peatland_man(j,man58,land58)); diff --git a/modules/58_peatland/on/presolve.gms b/modules/58_peatland/on/presolve.gms index 10cd9f9f9a..ce77e7f904 100644 --- a/modules/58_peatland/on/presolve.gms +++ b/modules/58_peatland/on/presolve.gms @@ -1,95 +1,57 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -p58_peatland_area(j) = sum((man58,land58), pc58_peatland_man(j,man58,land58)) + pc58_peatland_intact(j); -p58_land_area(j) = sum(land, pcm_land(j,land)); +*define bound for peatland area + v58_peatland_man.lo(j,man58,land58) = 0; + v58_peatland_man.up(j,"degrad",land58) = Inf; + v58_peatland_man.up(j,"unused",land58) = Inf; + v58_peatland_man.l(j,man58,land58) = pc58_peatland_man(j,man58,land58); -if(m_year(t) < 2015, - v58_peatland_man.fx(j,man58,land58) = 0; - v58_peatland_intact.fx(j) = 0; - v58_lu_transitions.fx(j,from58,to58)$(not sameas(from58,to58)) = 0; -else - if(sum(j, p58_peatland_area(j)) = 0, -*' @code -*' Initialization of peatland -*' First, all degraded peatland is assigned to cropland. However, if the degraded peatland -*' is larger than the actual cropland multiplied by a scaling factor (see below), -*' degraded peatland used as cropland is reduced accordingly. In each cell, -*' we scale the actual cropland with the ratio of total peatland area and total land area -*' (factor between 0 and 1) because we use this scaling factor for modeling future -*' peatland dynamics based on agricultural land use (see equations). Accounting for -*' this scaling factor in the initial distribution of degraded peatland to cropland -*' makes sure that a full reduction of cropland would also reduce degraded peatland -*' used as cropland to zero in a given cell, which is of particular importance -*' for the peatland restoration scenarios. After this first step, the remaining degraded -*' peatland (if any exists) is assigned to pasture with the same rules, i.e. -*' assignment to pasture is constrained by the scaled actual pasture area. In a third -*' step, all remaining degraded peatland is assigned to forestry with these rules. -*' Finally, any remaining degraded peatland in a cell after these 3 steps is -*' added to the degraded peatland category with equal distribution among -*' cropland, pasture and forestry (land-use categories are important for the -*' application of the wetland GHG emission factors). In total, we therefore have -*' 3 peatland categories: intact, degraded and unused. And for degraded and unused -*' we know the current/previous land use: cropland, pasture and forestry. -*' @stop - pc58_peatland_intact(j) = f58_peatland_intact(j); - p58_peatland_area(j) = f58_peatland_degrad(j) + f58_peatland_intact(j); - p58_scaling_factor(j) = p58_peatland_area(j)/p58_land_area(j); - p58_peatland_degrad_unused(j) = f58_peatland_degrad(j); -*First step: cropland - pc58_peatland_man(j,"degrad","crop") = min(p58_peatland_degrad_unused(j),pcm_land(j,"crop")*p58_scaling_factor(j)); - p58_peatland_degrad_unused(j) = p58_peatland_degrad_unused(j)-pc58_peatland_man(j,"degrad","crop"); -*Second step: pasture - pc58_peatland_man(j,"degrad","past") = min(p58_peatland_degrad_unused(j),pcm_land(j,"past")*p58_scaling_factor(j)); - p58_peatland_degrad_unused(j) = p58_peatland_degrad_unused(j)-pc58_peatland_man(j,"degrad","past"); -*Third step: forestry - pc58_peatland_man(j,"degrad","forestry") = min(p58_peatland_degrad_unused(j),pcm_land(j,"forestry")*p58_scaling_factor(j)); - p58_peatland_degrad_unused(j) = p58_peatland_degrad_unused(j)-pc58_peatland_man(j,"degrad","forestry"); -*Finally, the remaining undistributed degraded peatland is distributed among crop, past and forestry. - p58_peatland_degrad_used(j) = sum(land58, pc58_peatland_man(j,"degrad",land58)); - p58_peatland_degrad_unused_weight(j,land58) = 1/card(land58); - p58_peatland_degrad_unused_weight(j,land58)$(p58_peatland_degrad_used(j) > 0) = pc58_peatland_man(j,"degrad",land58)/p58_peatland_degrad_used(j); - pc58_peatland_man(j,"unused",land58) = p58_peatland_degrad_unused(j)*p58_peatland_degrad_unused_weight(j,land58); - p58_peatland_degrad_unused(j) = p58_peatland_degrad_unused(j)-sum(land58, pc58_peatland_man(j,"unused",land58)); - - v58_peatland_man.fx(j,man58,land58) = pc58_peatland_man(j,man58,land58); - v58_peatland_intact.fx(j) = pc58_peatland_intact(j); - v58_lu_transitions.fx(j,from58,to58)$(not sameas(from58,to58)) = 0; - - else - p58_scaling_factor(j) = p58_peatland_area(j)/p58_land_area(j); -*define bound for peatland area after 2015 - v58_peatland_man.lo(j,man58,land58) = 0; - v58_peatland_man.up(j,"degrad",land58) = Inf; - v58_peatland_man.up(j,"unused",land58) = Inf; - v58_peatland_man.up(j,"rewet",land58) = s58_rewetting_switch; - v58_peatland_man.l(j,man58,land58) = pc58_peatland_man(j,man58,land58); - v58_peatland_intact.lo(j) = 0; - v58_peatland_intact.up(j) = pc58_peatland_intact(j); - v58_peatland_intact.l(j) = pc58_peatland_intact(j); +*define allowed transitions within peatland area + v58_lu_transitions.fx(j,from58,to58)$(not sameas(from58,to58)) = 0; + v58_lu_transitions.up(j,"intact","degrad_crop") = Inf; + v58_lu_transitions.up(j,"intact","degrad_past") = Inf; + v58_lu_transitions.up(j,"intact","degrad_forestry") = Inf; + v58_lu_transitions.up(j,"degrad_crop","unused_crop") = Inf; + v58_lu_transitions.up(j,"degrad_past","unused_past") = Inf; + v58_lu_transitions.up(j,"degrad_forestry","unused_forestry") = Inf; + v58_lu_transitions.up(j,"degrad_crop","rewet_crop") = Inf; + v58_lu_transitions.up(j,"degrad_past","rewet_past") = Inf; + v58_lu_transitions.up(j,"degrad_forestry","rewet_forestry") = Inf; + v58_lu_transitions.up(j,"unused_crop","degrad_crop") = Inf; + v58_lu_transitions.up(j,"unused_crop","degrad_past") = Inf; + v58_lu_transitions.up(j,"unused_crop","degrad_forestry") = Inf; + v58_lu_transitions.up(j,"unused_past","degrad_crop") = Inf; + v58_lu_transitions.up(j,"unused_past","degrad_past") = Inf; + v58_lu_transitions.up(j,"unused_past","degrad_forestry") = Inf; + v58_lu_transitions.up(j,"unused_forestry","degrad_crop") = Inf; + v58_lu_transitions.up(j,"unused_forestry","degrad_past") = Inf; + v58_lu_transitions.up(j,"unused_forestry","degrad_forestry") = Inf; + v58_lu_transitions.up(j,"unused_crop","rewet_crop") = Inf; + v58_lu_transitions.up(j,"unused_past","rewet_past") = Inf; + v58_lu_transitions.up(j,"unused_forestry","rewet_forestry") = Inf; + v58_lu_transitions.up(j,"rewet_crop","degrad_crop") = Inf; + v58_lu_transitions.up(j,"rewet_past","degrad_past") = Inf; + v58_lu_transitions.up(j,"rewet_forestry","degrad_forestry") = Inf; -*define allowed transitions within peatland area - v58_lu_transitions.fx(j,from58,to58)$(not sameas(from58,to58)) = 0; - v58_lu_transitions.up(j,"intact","degrad_crop") = Inf; - v58_lu_transitions.up(j,"intact","degrad_past") = Inf; - v58_lu_transitions.up(j,"intact","degrad_forestry") = Inf; - v58_lu_transitions.up(j,"degrad_crop","unused_crop") = Inf; - v58_lu_transitions.up(j,"degrad_past","unused_past") = Inf; - v58_lu_transitions.up(j,"degrad_forestry","unused_forestry") = Inf; - v58_lu_transitions.up(j,"degrad_crop","rewet_crop") = Inf; - v58_lu_transitions.up(j,"degrad_past","rewet_past") = Inf; - v58_lu_transitions.up(j,"degrad_forestry","rewet_forestry") = Inf; - v58_lu_transitions.up(j,"unused_crop","degrad_crop") = Inf; - v58_lu_transitions.up(j,"unused_past","degrad_past") = Inf; - v58_lu_transitions.up(j,"unused_forestry","degrad_forestry") = Inf; - v58_lu_transitions.up(j,"unused_crop","rewet_crop") = Inf; - v58_lu_transitions.up(j,"unused_past","rewet_past") = Inf; - v58_lu_transitions.up(j,"unused_forestry","rewet_forestry") = Inf; - ); +if (m_year(t) <= s58_fix_peatland, + v58_peatland_man.fx(j,man58,land58) = pc58_peatland_man(j,man58,land58); + v58_peatland_intact.fx(j) = pc58_peatland_intact(j); + i58_cost_rewet_recur(t) = 0; + i58_cost_rewet_onetime(t) = 0; + i58_cost_degrad_recur(t) = 0; + i58_cost_degrad_onetime(t) = 0; +else + v58_peatland_man.up(j,"rewet",land58) = s58_rewetting_switch; + v58_peatland_intact.lo(j) = 0; + v58_peatland_intact.up(j) = pc58_peatland_intact(j); + v58_peatland_intact.l(j) = pc58_peatland_intact(j); + i58_cost_rewet_recur(t) = s58_cost_rewet_recur; + i58_cost_rewet_onetime(t) = s58_cost_rewet_onetime; + i58_cost_degrad_recur(t) = s58_cost_degrad_recur; + i58_cost_degrad_onetime(t) = s58_cost_degrad_onetime; ); - -pc58_peatland_cost_past(j) = p58_peatland_cost_past(t,j); diff --git a/modules/58_peatland/on/realization.gms b/modules/58_peatland/on/realization.gms index ded1b2ab51..41418aa77b 100644 --- a/modules/58_peatland/on/realization.gms +++ b/modules/58_peatland/on/realization.gms @@ -1,19 +1,21 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 In this realization GHG emissions from degrading/drained peatlands -*' are calculated based on GHG emission factors from the -*' "2013 Supplement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories: Wetlands". -*' Also rewetting of drained peatlands as mitigation option is available. +*' @description In this realization, the state of peatlands is modelled as described in @humpenoder_peatland_2020. +*' The initial map of peatland area consists of intact and degraded peatland area for the year 2015. +*' Future peatland dynamics depend on the ratio of total peatland area and total land area. +*' GHG emissions from degraded and rewetted peatlands as are calculated based on GHG emission factors from the +*' "2013 Supplement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories: Wetlands". *' @stop *' -*' @limitations Organic carbon stocks in peatlands are not accounted for. +*' @limitations Peatland area and GHG emissions are fixed to 2015 levels for the historic period, +*' depending on `s58_fix_peatland`. Organic carbon stocks in peatlands are not accounted for. *####################### R SECTION START (PHASES) ############################## $Ifi "%phase%" == "sets" $include "./modules/58_peatland/on/sets.gms" diff --git a/modules/58_peatland/on/scaling.gms b/modules/58_peatland/on/scaling.gms index 27f35f7ff0..0d3b287285 100644 --- a/modules/58_peatland/on/scaling.gms +++ b/modules/58_peatland/on/scaling.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/58_peatland/on/sets.gms b/modules/58_peatland/on/sets.gms index 8748234e15..a9bfd548b5 100644 --- a/modules/58_peatland/on/sets.gms +++ b/modules/58_peatland/on/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,10 +7,13 @@ sets - man58 Peatland status managed + man58 State of managed peatland / degrad, unused, rewet / + + degrad58(man58) State of degraded peatland + / degrad, unused / - ef58(man58) Peatland ef categories + ef58(man58) Peatland emissions factors / degrad, rewet / land58(land) Managed land types @@ -28,16 +31,28 @@ sets rewet_crop, rewet_past, rewet_forestry / stat_degrad58(stat58) Peatland status degrad - / degrad_crop, degrad_past, degrad_forestry / + / degrad_crop, degrad_past, degrad_forestry, + unused_crop, unused_past, unused_forestry / stat_rewet58(stat58) Peatland status rewet / rewet_crop, rewet_past, rewet_forestry / emis58 Wetland emission types - / co2, doc, ch4, n2o / + / co2, doc, ch4, n2o / + + emisSub58(emis58) Wetland emission types + / co2, ch4, n2o / + + poll58(pollutants) Wetland emissions that can be taxed + / co2_c, ch4, n2o_n_direct / + + emisSub58_to_poll58(emisSub58,poll58) Mapping + / co2 .(co2_c) + ch4 .(ch4) + n2o .(n2o_n_direct) / clcl58 simple climate classes - / tropical, temperate, boreal / + / tropical, temperate, boreal / clcl_mapping(clcl,clcl58) Mapping between detailed and simple climate classes / diff --git a/modules/59_som/cellpool_aug16/declarations.gms b/modules/59_som/cellpool_aug16/declarations.gms index 4c73f09ce6..c180cc9531 100644 --- a/modules/59_som/cellpool_aug16/declarations.gms +++ b/modules/59_som/cellpool_aug16/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,52 +7,48 @@ parameters i59_lossrate(t) Rate of loss or recovery of SOM pool per timestep (1) - p59_carbon_density(t_all,j,pools59) Carbon density of a hectare of land (tC per ha) + p59_carbon_density(t_all,j,land) Carbon density of a hectare of land (tC per ha) 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) - p59_som_pool(j,pools59) Actual C pool (mio. tC) + i59_cratio_fallow(j) Ratio of carbon density of fallow land relative to natural vegetation (1) + p59_som_pool(j,land) 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 q59_som_target_cropland(j) Estimates the long-term target state of cropland (mio. tC) q59_som_target_noncropland(j,noncropland59) Estimates the long-term target state of noncropland (mio. tC) - q59_som_transfer_to_cropland(j,noncropland59) Estimates the transfer of carbon pools due to land conversion (mio. tC) - q59_som_pool_cropland(j) Actual C pool in croplands (mio. tC) - q59_som_pool_noncropland(j,noncropland59) Actual C pool in non-croplands (mio. tC) + q59_som_pool(j,land) Actual C pool (mio. tC) q59_nr_som(j) Soil organic matter loss (Mt N per yr) q59_nr_som_fertilizer(j) Bound of nitrogen fertilizer of soil organic matter loss (Mt N per yr) q59_nr_som_fertilizer2(j) Fraction of soil organic matter loss take is taken up by plants (Mt N per yr) - q59_carbon_soil(j,pools59) Soil carbon content calculation (mio. tC) + q59_carbon_soil(j,land,stockType) Soil carbon content calculation (mio. tC) ; positive variables - v59_som_target(j,pools59) Long-term target state of C pool (mio. tC) - v59_som_pool(j,pools59) Soil organic matter pool (mio. tC) + v59_som_target(j,land) Long-term target state of C pool (mio. tC) + v59_som_pool(j,land) Soil organic matter pool (mio. tC) ; variables - v59_som_transfer_to_cropland(j, noncropland59) Transfer of SOM from other land to cropland (mio. tC) vm_nr_som(j) Release of soil organic matter (Mt N per yr) vm_nr_som_fertilizer(j) Uptake of soil organic matter from plants (Mt N per yr) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov59_som_target(t,j,pools59,type) Long-term target state of C pool (mio. tC) - ov59_som_pool(t,j,pools59,type) Soil organic matter pool (mio. tC) - ov59_som_transfer_to_cropland(t,j,noncropland59,type) Transfer of SOM from other land to cropland (mio. tC) - ov_nr_som(t,j,type) Release of soil organic matter (Mt N per yr) - ov_nr_som_fertilizer(t,j,type) Uptake of soil organic matter from plants (Mt N per yr) - oq59_som_target_cropland(t,j,type) Estimates the long-term target state of cropland (mio. tC) - oq59_som_target_noncropland(t,j,noncropland59,type) Estimates the long-term target state of noncropland (mio. tC) - oq59_som_transfer_to_cropland(t,j,noncropland59,type) Estimates the transfer of carbon pools due to land conversion (mio. tC) - oq59_som_pool_cropland(t,j,type) Actual C pool in croplands (mio. tC) - oq59_som_pool_noncropland(t,j,noncropland59,type) Actual C pool in non-croplands (mio. tC) - oq59_nr_som(t,j,type) Soil organic matter loss (Mt N per yr) - oq59_nr_som_fertilizer(t,j,type) Bound of nitrogen fertilizer of soil organic matter loss (Mt N per yr) - oq59_nr_som_fertilizer2(t,j,type) Fraction of soil organic matter loss take is taken up by plants (Mt N per yr) - oq59_carbon_soil(t,j,pools59,type) Soil carbon content calculation (mio. tC) + ov59_som_target(t,j,land,type) Long-term target state of C pool (mio. tC) + ov59_som_pool(t,j,land,type) Soil organic matter pool (mio. tC) + ov_nr_som(t,j,type) Release of soil organic matter (Mt N per yr) + ov_nr_som_fertilizer(t,j,type) Uptake of soil organic matter from plants (Mt N per yr) + oq59_som_target_cropland(t,j,type) Estimates the long-term target state of cropland (mio. tC) + oq59_som_target_noncropland(t,j,noncropland59,type) Estimates the long-term target state of noncropland (mio. tC) + oq59_som_pool(t,j,land,type) Actual C pool (mio. tC) + oq59_nr_som(t,j,type) Soil organic matter loss (Mt N per yr) + oq59_nr_som_fertilizer(t,j,type) Bound of nitrogen fertilizer of soil organic matter loss (Mt N per yr) + oq59_nr_som_fertilizer2(t,j,type) Fraction of soil organic matter loss take is taken up by plants (Mt N per yr) + oq59_carbon_soil(t,j,land,stockType,type) Soil carbon content calculation (mio. tC) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/59_som/cellpool_aug16/equations.gms b/modules/59_som/cellpool_aug16/equations.gms index 7e5942ab00..bd1d19ce92 100644 --- a/modules/59_som/cellpool_aug16/equations.gms +++ b/modules/59_som/cellpool_aug16/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,73 +7,66 @@ *' @equations -*' For every cell a new equilibrium value for the soil organic carbon -*' pool on cropland as the sum over all crop types and irrigation regimes is calculated +*' For every cell a new equilibrium value for the soil organic carbon pool +*' on cropland as the sum over all crop types and irrigation regimes is calculated 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)) + =e= (sum((kcr,w), vm_area(j2,kcr,w) * i59_cratio(j2,kcr,w)) + + vm_fallow(j2) * i59_cratio_fallow(j2)) * + sum(ct,f59_topsoilc_density(ct,j2)) ; *' as well as for all non cropland given by q59_som_target_noncropland(j2,noncropland59) .. v59_som_target(j2,noncropland59) =e= vm_land(j2,noncropland59) * sum(ct,f59_topsoilc_density(ct,j2)) - ; - -*' Depending on the setting of `c59_som_scenario `climate impacts (`cc`) are taken into account or not (`nocc`). -*' For a static climate `f59_topsoilc_density` is set to the value of 1995 within the input of the module realization. - -*' The actual carbon transfer from cropland as well as to cropland soils is then given by - -q59_som_transfer_to_cropland(j2, noncropland59) .. - v59_som_transfer_to_cropland(j2, noncropland59) - =e= sum(ct, - vm_croplandexpansion(j2,noncropland59) * p59_carbon_density(ct,j2,noncropland59) - - vm_croplandreduction(j2,noncropland59) * p59_carbon_density(ct,j2,"crop")) - ; - -*' To get the current size of the soil organic carbon pool, the pool of the previous timestep corrected by the carbon transfer -*' is developing into the direction of the above calculated target values taken the timestep depending lossrate into account by - -q59_som_pool_cropland(j2) .. - v59_som_pool(j2,"crop") - =e= sum(ct, i59_lossrate(ct)) - * (v59_som_target(j2,"crop") - - (p59_som_pool(j2,"crop") + sum(noncropland59, v59_som_transfer_to_cropland(j2,noncropland59)))) - + (p59_som_pool(j2,"crop") + sum(noncropland59, v59_som_transfer_to_cropland(j2,noncropland59))) - ; - -*' and - -q59_som_pool_noncropland(j2, noncropland59) .. - v59_som_pool(j2, noncropland59) - =e= sum(ct,i59_lossrate(ct)) - * (v59_som_target(j2,noncropland59) - - (p59_som_pool(j2,noncropland59) - v59_som_transfer_to_cropland(j2,noncropland59))) - + (p59_som_pool(j2,noncropland59) - v59_som_transfer_to_cropland(j2,noncropland59)) + ; + +*' Depending on the setting of `c59_som_scenario `climate impacts (`cc`) +*' are taken into account or not (`nocc` and `nocc_hist`). +*' For a static climate `f59_topsoilc_density` is set to the value of 1995 +*' within the input of the module realization. + +*' To get the current size of the soil organic carbon pool, the carbon +*' pool of the previous timestep is developing into the direction of the +*' above calculated target values taken the timestep depending lossrate +*' into account by + +q59_som_pool(j2,land) .. + v59_som_pool(j2,land) + =e= sum(ct,i59_lossrate(ct)) * v59_som_target(j2,land) + + (1 - sum(ct,i59_lossrate(ct))) * + sum((ct,land_from), p59_carbon_density(ct,j2,land_from) * + vm_lu_transitions(j2,land_from,land)) ; +*' Note that to account correctly for land-use transitions, carbon densities +*' multiplied by the land-use transition matrix of the current timestep +*' is used. + *' The soil carbon content is calculated as sum of actual topsoil pool *' and the reference soil carbon pool of the subsoil -q59_carbon_soil(j2,pools59) .. - vm_carbon_stock(j2, pools59, "soilc") =e= - v59_som_pool(j2, pools59) + vm_land(j2, pools59) * sum(ct,i59_subsoilc_density(ct,j2)) - ; +q59_carbon_soil(j2,land,stockType) .. + vm_carbon_stock(j2, land,"soilc",stockType) + =e= v59_som_pool(j2, land) + vm_land(j2, land) * + sum(ct,i59_subsoilc_density(ct,j2)); -*' The annual nitrogen release (or sink) for cropland soils is than calculated by the loss of soil organic carbon given by +*' The annual nitrogen release (or sink) for cropland soils is than +*' calculated by the loss of soil organic carbon given by q59_nr_som(j2) .. vm_nr_som(j2) =e= sum(ct,i59_lossrate(ct))/m_timestep_length*1/15 - * (p59_som_pool(j2,"crop") - + sum(noncropland59, v59_som_transfer_to_cropland(j2,noncropland59)) - - v59_som_target(j2,"crop")) + * (sum((ct,land_from), p59_carbon_density(ct,j2,land_from) * + vm_lu_transitions(j2,land_from,"crop")) + - v59_som_target(j2,"crop")) ; *' with the carbon to nitrogen ratio of soils assumed to be 15:1. -*' The amount of nitrogen that becomes available to cropland farming is limited by loss of soil organic matter by +*' The amount of nitrogen that becomes available to cropland farming is +*' limited by loss of soil organic matter by q59_nr_som_fertilizer(j2) .. vm_nr_som_fertilizer(j2) diff --git a/modules/59_som/cellpool_aug16/input.gms b/modules/59_som/cellpool_aug16/input.gms index c2c74a212b..ea13862d3a 100644 --- a/modules/59_som/cellpool_aug16/input.gms +++ b/modules/59_som/cellpool_aug16/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -45,19 +45,18 @@ $if "%c59_irrigation_scenario%" == "off" f59_cratio_irrigation(climate59,w,kcr) * $offdelim * ; -$setglobal c59_som_scenario nocc -* options: cc (climate change) -* nocc (no climate change) +$setglobal c59_som_scenario cc +* options: cc (climate change) +* nocc (no climate change) +* nocc_hist (no climate change after year defined by sm_fix_cc) parameters f59_topsoilc_density(t_all,j) LPJ topsoil carbon density for natural vegetation (tC per ha) / $ondelim -$include "./modules/59_som/input/lpj_carbon_topsoil.cs2" +$include "./modules/59_som/input/lpj_carbon_topsoil.cs2b" $offdelim / ; $if "%c59_som_scenario%" == "nocc" f59_topsoilc_density(t_all,j) = f59_topsoilc_density("y1995",j); +$if "%c59_som_scenario%" == "nocc_hist" f59_topsoilc_density(t_all,j)$(m_year(t_all) > sm_fix_cc) = f59_topsoilc_density(t_all,j)$(m_year(t_all) = sm_fix_cc); m_fillmissingyears(f59_topsoilc_density,"j"); - - - diff --git a/modules/59_som/cellpool_aug16/postsolve.gms b/modules/59_som/cellpool_aug16/postsolve.gms index ab525c0a1f..a42deca6c5 100644 --- a/modules/59_som/cellpool_aug16/postsolve.gms +++ b/modules/59_som/cellpool_aug16/postsolve.gms @@ -1,69 +1,57 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -p59_som_pool(j,pools59) = v59_som_pool.l(j,pools59); - +p59_som_pool(j,land) = v59_som_pool.l(j,land); +p59_land_before(j,land) = vm_land.l(j,land); +p59_carbon_density(t,j,land)$(pcm_land(j,land) > 1e-20) = p59_som_pool(j,land) / pcm_land(j,land); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov59_som_target(t,j,pools59,"marginal") = v59_som_target.m(j,pools59); - ov59_som_pool(t,j,pools59,"marginal") = v59_som_pool.m(j,pools59); - ov59_som_transfer_to_cropland(t,j,noncropland59,"marginal") = v59_som_transfer_to_cropland.m(j,noncropland59); - ov_nr_som(t,j,"marginal") = vm_nr_som.m(j); - ov_nr_som_fertilizer(t,j,"marginal") = vm_nr_som_fertilizer.m(j); - oq59_som_target_cropland(t,j,"marginal") = q59_som_target_cropland.m(j); - oq59_som_target_noncropland(t,j,noncropland59,"marginal") = q59_som_target_noncropland.m(j,noncropland59); - oq59_som_transfer_to_cropland(t,j,noncropland59,"marginal") = q59_som_transfer_to_cropland.m(j,noncropland59); - oq59_som_pool_cropland(t,j,"marginal") = q59_som_pool_cropland.m(j); - oq59_som_pool_noncropland(t,j,noncropland59,"marginal") = q59_som_pool_noncropland.m(j,noncropland59); - oq59_nr_som(t,j,"marginal") = q59_nr_som.m(j); - oq59_nr_som_fertilizer(t,j,"marginal") = q59_nr_som_fertilizer.m(j); - oq59_nr_som_fertilizer2(t,j,"marginal") = q59_nr_som_fertilizer2.m(j); - oq59_carbon_soil(t,j,pools59,"marginal") = q59_carbon_soil.m(j,pools59); - ov59_som_target(t,j,pools59,"level") = v59_som_target.l(j,pools59); - ov59_som_pool(t,j,pools59,"level") = v59_som_pool.l(j,pools59); - ov59_som_transfer_to_cropland(t,j,noncropland59,"level") = v59_som_transfer_to_cropland.l(j,noncropland59); - ov_nr_som(t,j,"level") = vm_nr_som.l(j); - ov_nr_som_fertilizer(t,j,"level") = vm_nr_som_fertilizer.l(j); - oq59_som_target_cropland(t,j,"level") = q59_som_target_cropland.l(j); - oq59_som_target_noncropland(t,j,noncropland59,"level") = q59_som_target_noncropland.l(j,noncropland59); - oq59_som_transfer_to_cropland(t,j,noncropland59,"level") = q59_som_transfer_to_cropland.l(j,noncropland59); - oq59_som_pool_cropland(t,j,"level") = q59_som_pool_cropland.l(j); - oq59_som_pool_noncropland(t,j,noncropland59,"level") = q59_som_pool_noncropland.l(j,noncropland59); - oq59_nr_som(t,j,"level") = q59_nr_som.l(j); - oq59_nr_som_fertilizer(t,j,"level") = q59_nr_som_fertilizer.l(j); - oq59_nr_som_fertilizer2(t,j,"level") = q59_nr_som_fertilizer2.l(j); - oq59_carbon_soil(t,j,pools59,"level") = q59_carbon_soil.l(j,pools59); - ov59_som_target(t,j,pools59,"upper") = v59_som_target.up(j,pools59); - ov59_som_pool(t,j,pools59,"upper") = v59_som_pool.up(j,pools59); - ov59_som_transfer_to_cropland(t,j,noncropland59,"upper") = v59_som_transfer_to_cropland.up(j,noncropland59); - ov_nr_som(t,j,"upper") = vm_nr_som.up(j); - ov_nr_som_fertilizer(t,j,"upper") = vm_nr_som_fertilizer.up(j); - oq59_som_target_cropland(t,j,"upper") = q59_som_target_cropland.up(j); - oq59_som_target_noncropland(t,j,noncropland59,"upper") = q59_som_target_noncropland.up(j,noncropland59); - oq59_som_transfer_to_cropland(t,j,noncropland59,"upper") = q59_som_transfer_to_cropland.up(j,noncropland59); - oq59_som_pool_cropland(t,j,"upper") = q59_som_pool_cropland.up(j); - oq59_som_pool_noncropland(t,j,noncropland59,"upper") = q59_som_pool_noncropland.up(j,noncropland59); - oq59_nr_som(t,j,"upper") = q59_nr_som.up(j); - oq59_nr_som_fertilizer(t,j,"upper") = q59_nr_som_fertilizer.up(j); - oq59_nr_som_fertilizer2(t,j,"upper") = q59_nr_som_fertilizer2.up(j); - oq59_carbon_soil(t,j,pools59,"upper") = q59_carbon_soil.up(j,pools59); - ov59_som_target(t,j,pools59,"lower") = v59_som_target.lo(j,pools59); - ov59_som_pool(t,j,pools59,"lower") = v59_som_pool.lo(j,pools59); - ov59_som_transfer_to_cropland(t,j,noncropland59,"lower") = v59_som_transfer_to_cropland.lo(j,noncropland59); - ov_nr_som(t,j,"lower") = vm_nr_som.lo(j); - ov_nr_som_fertilizer(t,j,"lower") = vm_nr_som_fertilizer.lo(j); - oq59_som_target_cropland(t,j,"lower") = q59_som_target_cropland.lo(j); - oq59_som_target_noncropland(t,j,noncropland59,"lower") = q59_som_target_noncropland.lo(j,noncropland59); - oq59_som_transfer_to_cropland(t,j,noncropland59,"lower") = q59_som_transfer_to_cropland.lo(j,noncropland59); - oq59_som_pool_cropland(t,j,"lower") = q59_som_pool_cropland.lo(j); - oq59_som_pool_noncropland(t,j,noncropland59,"lower") = q59_som_pool_noncropland.lo(j,noncropland59); - oq59_nr_som(t,j,"lower") = q59_nr_som.lo(j); - oq59_nr_som_fertilizer(t,j,"lower") = q59_nr_som_fertilizer.lo(j); - oq59_nr_som_fertilizer2(t,j,"lower") = q59_nr_som_fertilizer2.lo(j); - oq59_carbon_soil(t,j,pools59,"lower") = q59_carbon_soil.lo(j,pools59); + ov59_som_target(t,j,land,"marginal") = v59_som_target.m(j,land); + ov59_som_pool(t,j,land,"marginal") = v59_som_pool.m(j,land); + ov_nr_som(t,j,"marginal") = vm_nr_som.m(j); + ov_nr_som_fertilizer(t,j,"marginal") = vm_nr_som_fertilizer.m(j); + oq59_som_target_cropland(t,j,"marginal") = q59_som_target_cropland.m(j); + oq59_som_target_noncropland(t,j,noncropland59,"marginal") = q59_som_target_noncropland.m(j,noncropland59); + oq59_som_pool(t,j,land,"marginal") = q59_som_pool.m(j,land); + oq59_nr_som(t,j,"marginal") = q59_nr_som.m(j); + oq59_nr_som_fertilizer(t,j,"marginal") = q59_nr_som_fertilizer.m(j); + oq59_nr_som_fertilizer2(t,j,"marginal") = q59_nr_som_fertilizer2.m(j); + oq59_carbon_soil(t,j,land,stockType,"marginal") = q59_carbon_soil.m(j,land,stockType); + ov59_som_target(t,j,land,"level") = v59_som_target.l(j,land); + ov59_som_pool(t,j,land,"level") = v59_som_pool.l(j,land); + ov_nr_som(t,j,"level") = vm_nr_som.l(j); + ov_nr_som_fertilizer(t,j,"level") = vm_nr_som_fertilizer.l(j); + oq59_som_target_cropland(t,j,"level") = q59_som_target_cropland.l(j); + oq59_som_target_noncropland(t,j,noncropland59,"level") = q59_som_target_noncropland.l(j,noncropland59); + oq59_som_pool(t,j,land,"level") = q59_som_pool.l(j,land); + oq59_nr_som(t,j,"level") = q59_nr_som.l(j); + oq59_nr_som_fertilizer(t,j,"level") = q59_nr_som_fertilizer.l(j); + oq59_nr_som_fertilizer2(t,j,"level") = q59_nr_som_fertilizer2.l(j); + oq59_carbon_soil(t,j,land,stockType,"level") = q59_carbon_soil.l(j,land,stockType); + ov59_som_target(t,j,land,"upper") = v59_som_target.up(j,land); + ov59_som_pool(t,j,land,"upper") = v59_som_pool.up(j,land); + ov_nr_som(t,j,"upper") = vm_nr_som.up(j); + ov_nr_som_fertilizer(t,j,"upper") = vm_nr_som_fertilizer.up(j); + oq59_som_target_cropland(t,j,"upper") = q59_som_target_cropland.up(j); + oq59_som_target_noncropland(t,j,noncropland59,"upper") = q59_som_target_noncropland.up(j,noncropland59); + oq59_som_pool(t,j,land,"upper") = q59_som_pool.up(j,land); + oq59_nr_som(t,j,"upper") = q59_nr_som.up(j); + oq59_nr_som_fertilizer(t,j,"upper") = q59_nr_som_fertilizer.up(j); + oq59_nr_som_fertilizer2(t,j,"upper") = q59_nr_som_fertilizer2.up(j); + oq59_carbon_soil(t,j,land,stockType,"upper") = q59_carbon_soil.up(j,land,stockType); + ov59_som_target(t,j,land,"lower") = v59_som_target.lo(j,land); + ov59_som_pool(t,j,land,"lower") = v59_som_pool.lo(j,land); + ov_nr_som(t,j,"lower") = vm_nr_som.lo(j); + ov_nr_som_fertilizer(t,j,"lower") = vm_nr_som_fertilizer.lo(j); + oq59_som_target_cropland(t,j,"lower") = q59_som_target_cropland.lo(j); + oq59_som_target_noncropland(t,j,noncropland59,"lower") = q59_som_target_noncropland.lo(j,noncropland59); + oq59_som_pool(t,j,land,"lower") = q59_som_pool.lo(j,land); + oq59_nr_som(t,j,"lower") = q59_nr_som.lo(j); + oq59_nr_som_fertilizer(t,j,"lower") = q59_nr_som_fertilizer.lo(j); + oq59_nr_som_fertilizer2(t,j,"lower") = q59_nr_som_fertilizer2.lo(j); + oq59_carbon_soil(t,j,land,stockType,"lower") = q59_carbon_soil.lo(j,land,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 d3fec2c845..e6f826141e 100644 --- a/modules/59_som/cellpool_aug16/preloop.gms +++ b/modules/59_som/cellpool_aug16/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -14,7 +14,7 @@ i59_subsoilc_density(t_all,j) = fm_carbon_density(t_all,j,"secdforest","soilc") p59_som_pool(j,"crop") = sum((climate59,kcr),sum(clcl_climate59(clcl,climate59), pm_climate_class(j,clcl)) * f59_cratio_landuse(climate59,kcr) - * f59_topsoilc_density("y1995",j) * pm_croparea_start(j,kcr)); + * f59_topsoilc_density("y1995",j) * sum(w, fm_croparea("y1995",j,w,kcr))); p59_som_pool(j,noncropland59) = f59_topsoilc_density("y1995",j) * pm_land_start(j,noncropland59); @@ -27,15 +27,10 @@ p59_som_pool(j,noncropland59) = * starting value of carbon stocks 1995 is only an estimate. * ATTENTION: emissions in 1995 are not meaningful -vm_carbon_stock.l(j,"crop","soilc") = +vm_carbon_stock.l(j,"crop","soilc",stockType) = p59_som_pool(j,"crop") + i59_subsoilc_density("y1995",j) * pm_land_start(j,"crop"); -vm_carbon_stock.l(j,noncropland59,"soilc") = +vm_carbon_stock.l(j,noncropland59,"soilc",stockType) = fm_carbon_density("y1995",j,noncropland59,"soilc") * pm_land_start(j,noncropland59); -vm_carbon_stock.l(j,"urban","soilc") = - fm_carbon_density("y1995",j,"urban","soilc") * pm_land_start(j,"urban"); - -pcm_carbon_stock(j,land,"soilc") = vm_carbon_stock.l(j,land,"soilc"); - ***************************** *** cshare calculation *** @@ -68,6 +63,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,land) = 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..b07f421a73 100644 --- a/modules/59_som/cellpool_aug16/presolve.gms +++ b/modules/59_som/cellpool_aug16/presolve.gms @@ -1,9 +1,29 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -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,land)$(pcm_land(j,land)>1e-20) = p59_som_pool(j,land) / pcm_land(j,land); diff --git a/modules/59_som/cellpool_aug16/realization.gms b/modules/59_som/cellpool_aug16/realization.gms index e1e12ccf7e..c038b2360a 100644 --- a/modules/59_som/cellpool_aug16/realization.gms +++ b/modules/59_som/cellpool_aug16/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -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/scaling.gms b/modules/59_som/cellpool_aug16/scaling.gms index 913a391180..ac412019a1 100644 --- a/modules/59_som/cellpool_aug16/scaling.gms +++ b/modules/59_som/cellpool_aug16/scaling.gms @@ -1,9 +1,9 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -v59_som_target.scale(j,pools59) = 10e3; -v59_som_pool.scale(j,pools59) = 10e3; +v59_som_target.scale(j,land) = 10e3; +v59_som_pool.scale(j,land) = 10e3; diff --git a/modules/59_som/cellpool_aug16/sets.gms b/modules/59_som/cellpool_aug16/sets.gms index d9ac1cdbc3..c93b0f755d 100644 --- a/modules/59_som/cellpool_aug16/sets.gms +++ b/modules/59_som/cellpool_aug16/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,11 +7,8 @@ sets -pools59(land) Carbon differentiating landuse types -/crop, past, forestry, primforest, secdforest, other/ - -noncropland59(pools59) Soil carbon conserving landuse types -/past, forestry, primforest, secdforest, other/ +noncropland59(land) Soil carbon conserving landuse types +/past, forestry, primforest, secdforest, other, urban/ tillage59 Tillage categories of IPCC /full_tillage,reduced_tillage,no_tillage/ diff --git a/modules/59_som/cellpool_jan23/declarations.gms b/modules/59_som/cellpool_jan23/declarations.gms new file mode 100644 index 0000000000..c180cc9531 --- /dev/null +++ b/modules/59_som/cellpool_jan23/declarations.gms @@ -0,0 +1,54 @@ +*** | (C) 2008-2023 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 + +parameters + i59_lossrate(t) Rate of loss or recovery of SOM pool per timestep (1) + p59_carbon_density(t_all,j,land) Carbon density of a hectare of land (tC per ha) + 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,land) 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 + q59_som_target_cropland(j) Estimates the long-term target state of cropland (mio. tC) + q59_som_target_noncropland(j,noncropland59) Estimates the long-term target state of noncropland (mio. tC) + q59_som_pool(j,land) Actual C pool (mio. tC) + q59_nr_som(j) Soil organic matter loss (Mt N per yr) + q59_nr_som_fertilizer(j) Bound of nitrogen fertilizer of soil organic matter loss (Mt N per yr) + q59_nr_som_fertilizer2(j) Fraction of soil organic matter loss take is taken up by plants (Mt N per yr) + q59_carbon_soil(j,land,stockType) Soil carbon content calculation (mio. tC) +; + +positive variables + v59_som_target(j,land) Long-term target state of C pool (mio. tC) + v59_som_pool(j,land) Soil organic matter pool (mio. tC) +; + +variables + vm_nr_som(j) Release of soil organic matter (Mt N per yr) + vm_nr_som_fertilizer(j) Uptake of soil organic matter from plants (Mt N per yr) +; + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov59_som_target(t,j,land,type) Long-term target state of C pool (mio. tC) + ov59_som_pool(t,j,land,type) Soil organic matter pool (mio. tC) + ov_nr_som(t,j,type) Release of soil organic matter (Mt N per yr) + ov_nr_som_fertilizer(t,j,type) Uptake of soil organic matter from plants (Mt N per yr) + oq59_som_target_cropland(t,j,type) Estimates the long-term target state of cropland (mio. tC) + oq59_som_target_noncropland(t,j,noncropland59,type) Estimates the long-term target state of noncropland (mio. tC) + oq59_som_pool(t,j,land,type) Actual C pool (mio. tC) + oq59_nr_som(t,j,type) Soil organic matter loss (Mt N per yr) + oq59_nr_som_fertilizer(t,j,type) Bound of nitrogen fertilizer of soil organic matter loss (Mt N per yr) + oq59_nr_som_fertilizer2(t,j,type) Fraction of soil organic matter loss take is taken up by plants (Mt N per yr) + oq59_carbon_soil(t,j,land,stockType,type) Soil carbon content calculation (mio. tC) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/59_som/cellpool_jan23/equations.gms b/modules/59_som/cellpool_jan23/equations.gms new file mode 100644 index 0000000000..bd1d19ce92 --- /dev/null +++ b/modules/59_som/cellpool_jan23/equations.gms @@ -0,0 +1,83 @@ +*** | (C) 2008-2023 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 +*' For every cell a new equilibrium value for the soil organic carbon pool +*' on cropland as the sum over all crop types and irrigation regimes is calculated + +q59_som_target_cropland(j2) .. + v59_som_target(j2,"crop") + =e= (sum((kcr,w), vm_area(j2,kcr,w) * i59_cratio(j2,kcr,w)) + + vm_fallow(j2) * i59_cratio_fallow(j2)) * + sum(ct,f59_topsoilc_density(ct,j2)) + ; +*' as well as for all non cropland given by + +q59_som_target_noncropland(j2,noncropland59) .. + v59_som_target(j2,noncropland59) + =e= vm_land(j2,noncropland59) * sum(ct,f59_topsoilc_density(ct,j2)) + ; + +*' Depending on the setting of `c59_som_scenario `climate impacts (`cc`) +*' are taken into account or not (`nocc` and `nocc_hist`). +*' For a static climate `f59_topsoilc_density` is set to the value of 1995 +*' within the input of the module realization. + +*' To get the current size of the soil organic carbon pool, the carbon +*' pool of the previous timestep is developing into the direction of the +*' above calculated target values taken the timestep depending lossrate +*' into account by + +q59_som_pool(j2,land) .. + v59_som_pool(j2,land) + =e= sum(ct,i59_lossrate(ct)) * v59_som_target(j2,land) + + (1 - sum(ct,i59_lossrate(ct))) * + sum((ct,land_from), p59_carbon_density(ct,j2,land_from) * + vm_lu_transitions(j2,land_from,land)) + ; + +*' Note that to account correctly for land-use transitions, carbon densities +*' multiplied by the land-use transition matrix of the current timestep +*' is used. + +*' The soil carbon content is calculated as sum of actual topsoil pool +*' and the reference soil carbon pool of the subsoil + +q59_carbon_soil(j2,land,stockType) .. + vm_carbon_stock(j2, land,"soilc",stockType) + =e= v59_som_pool(j2, land) + vm_land(j2, land) * + sum(ct,i59_subsoilc_density(ct,j2)); + +*' The annual nitrogen release (or sink) for cropland soils is than +*' calculated by the loss of soil organic carbon given by + +q59_nr_som(j2) .. + vm_nr_som(j2) + =e= sum(ct,i59_lossrate(ct))/m_timestep_length*1/15 + * (sum((ct,land_from), p59_carbon_density(ct,j2,land_from) * + vm_lu_transitions(j2,land_from,"crop")) + - v59_som_target(j2,"crop")) + ; +*' with the carbon to nitrogen ratio of soils assumed to be 15:1. + +*' The amount of nitrogen that becomes available to cropland farming is +*' limited by loss of soil organic matter by + +q59_nr_som_fertilizer(j2) .. + vm_nr_som_fertilizer(j2) + =l= + vm_nr_som(j2); + +*' as well as by the amount that crops can take up + +q59_nr_som_fertilizer2(j2) .. + vm_nr_som_fertilizer(j2) + =l= + vm_landexpansion(j2,"crop") * s59_nitrogen_uptake; + +*' Here we assume a maximum of 200 kg on the expanded area. diff --git a/modules/59_som/cellpool_jan23/input.gms b/modules/59_som/cellpool_jan23/input.gms new file mode 100644 index 0000000000..cb8e7509ba --- /dev/null +++ b/modules/59_som/cellpool_jan23/input.gms @@ -0,0 +1,55 @@ +*** | (C) 2008-2023 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 + +scalars + s59_nitrogen_uptake Maximum plant available nitrogen from soil organic matter loss (tN per ha) / 0.2 / +; + +table f59_cratio_landuse(i,climate59_2019,kcr) Ratio of soil carbon relative to potential natural vegetation soil carbon for different landuse (1) +$ondelim +$include "./modules/59_som/cellpool_jan23/input/f59_ch5_F_LU_2019reg.cs3" +$offdelim +; + +table f59_cratio_tillage(climate59,tillage59) Ratio of soil carbon relative to potential natural vegetation soil carbon for different soil management (1) +$ondelim +$include "./modules/59_som/cellpool_jan23/input/f59_ch5_F_MG.csv" +$offdelim +; + +table f59_cratio_inputs(climate59,inputs59) Ratio of soil carbon relative to potential natural vegetation soil carbon for different input intensity (1) +$ondelim +$include "./modules/59_som/cellpool_jan23/input/f59_ch5_F_I.csv" +$offdelim +; + +$setglobal c59_irrigation_scenario on +* options: on (higher carbon sequestration under irrigation) +* off (no carbon sequestration under irrigation) + +table f59_cratio_irrigation(climate59,w,kcr) Ratio of soil carbon relative to potential natural vegetation soil carbon for different irrigation schemes (1) +$ondelim +$include "./modules/59_som/cellpool_jan23/input/f59_ch5_F_IRR.cs3" +$offdelim +; +$if "%c59_irrigation_scenario%" == "off" f59_cratio_irrigation(climate59,w,kcr) = 1; + +$setglobal c59_som_scenario cc +* options: cc (climate change) +* nocc (no climate change) +* nocc_hist (no climate change after year defined by sm_fix_cc) + +parameters f59_topsoilc_density(t_all,j) LPJ topsoil carbon density for natural vegetation (tC per ha) +/ +$ondelim +$include "./modules/59_som/input/lpj_carbon_topsoil.cs2b" +$offdelim +/ +; +$if "%c59_som_scenario%" == "nocc" f59_topsoilc_density(t_all,j) = f59_topsoilc_density("y1995",j); +$if "%c59_som_scenario%" == "nocc_hist" f59_topsoilc_density(t_all,j)$(m_year(t_all) > sm_fix_cc) = f59_topsoilc_density(t_all,j)$(m_year(t_all) = sm_fix_cc); +m_fillmissingyears(f59_topsoilc_density,"j"); diff --git a/modules/59_som/cellpool_jan23/input/files b/modules/59_som/cellpool_jan23/input/files new file mode 100644 index 0000000000..76fd6cae23 --- /dev/null +++ b/modules/59_som/cellpool_jan23/input/files @@ -0,0 +1,5 @@ +* list of files that are required here +f59_ch5_F_I.csv +f59_ch5_F_MG.csv +f59_ch5_F_LU_2019reg.cs3 +f59_ch5_F_IRR.cs3 diff --git a/modules/59_som/cellpool_jan23/postsolve.gms b/modules/59_som/cellpool_jan23/postsolve.gms new file mode 100644 index 0000000000..a42deca6c5 --- /dev/null +++ b/modules/59_som/cellpool_jan23/postsolve.gms @@ -0,0 +1,57 @@ +*** | (C) 2008-2023 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 + +p59_som_pool(j,land) = v59_som_pool.l(j,land); +p59_land_before(j,land) = vm_land.l(j,land); +p59_carbon_density(t,j,land)$(pcm_land(j,land) > 1e-20) = p59_som_pool(j,land) / pcm_land(j,land); + +*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### + ov59_som_target(t,j,land,"marginal") = v59_som_target.m(j,land); + ov59_som_pool(t,j,land,"marginal") = v59_som_pool.m(j,land); + ov_nr_som(t,j,"marginal") = vm_nr_som.m(j); + ov_nr_som_fertilizer(t,j,"marginal") = vm_nr_som_fertilizer.m(j); + oq59_som_target_cropland(t,j,"marginal") = q59_som_target_cropland.m(j); + oq59_som_target_noncropland(t,j,noncropland59,"marginal") = q59_som_target_noncropland.m(j,noncropland59); + oq59_som_pool(t,j,land,"marginal") = q59_som_pool.m(j,land); + oq59_nr_som(t,j,"marginal") = q59_nr_som.m(j); + oq59_nr_som_fertilizer(t,j,"marginal") = q59_nr_som_fertilizer.m(j); + oq59_nr_som_fertilizer2(t,j,"marginal") = q59_nr_som_fertilizer2.m(j); + oq59_carbon_soil(t,j,land,stockType,"marginal") = q59_carbon_soil.m(j,land,stockType); + ov59_som_target(t,j,land,"level") = v59_som_target.l(j,land); + ov59_som_pool(t,j,land,"level") = v59_som_pool.l(j,land); + ov_nr_som(t,j,"level") = vm_nr_som.l(j); + ov_nr_som_fertilizer(t,j,"level") = vm_nr_som_fertilizer.l(j); + oq59_som_target_cropland(t,j,"level") = q59_som_target_cropland.l(j); + oq59_som_target_noncropland(t,j,noncropland59,"level") = q59_som_target_noncropland.l(j,noncropland59); + oq59_som_pool(t,j,land,"level") = q59_som_pool.l(j,land); + oq59_nr_som(t,j,"level") = q59_nr_som.l(j); + oq59_nr_som_fertilizer(t,j,"level") = q59_nr_som_fertilizer.l(j); + oq59_nr_som_fertilizer2(t,j,"level") = q59_nr_som_fertilizer2.l(j); + oq59_carbon_soil(t,j,land,stockType,"level") = q59_carbon_soil.l(j,land,stockType); + ov59_som_target(t,j,land,"upper") = v59_som_target.up(j,land); + ov59_som_pool(t,j,land,"upper") = v59_som_pool.up(j,land); + ov_nr_som(t,j,"upper") = vm_nr_som.up(j); + ov_nr_som_fertilizer(t,j,"upper") = vm_nr_som_fertilizer.up(j); + oq59_som_target_cropland(t,j,"upper") = q59_som_target_cropland.up(j); + oq59_som_target_noncropland(t,j,noncropland59,"upper") = q59_som_target_noncropland.up(j,noncropland59); + oq59_som_pool(t,j,land,"upper") = q59_som_pool.up(j,land); + oq59_nr_som(t,j,"upper") = q59_nr_som.up(j); + oq59_nr_som_fertilizer(t,j,"upper") = q59_nr_som_fertilizer.up(j); + oq59_nr_som_fertilizer2(t,j,"upper") = q59_nr_som_fertilizer2.up(j); + oq59_carbon_soil(t,j,land,stockType,"upper") = q59_carbon_soil.up(j,land,stockType); + ov59_som_target(t,j,land,"lower") = v59_som_target.lo(j,land); + ov59_som_pool(t,j,land,"lower") = v59_som_pool.lo(j,land); + ov_nr_som(t,j,"lower") = vm_nr_som.lo(j); + ov_nr_som_fertilizer(t,j,"lower") = vm_nr_som_fertilizer.lo(j); + oq59_som_target_cropland(t,j,"lower") = q59_som_target_cropland.lo(j); + oq59_som_target_noncropland(t,j,noncropland59,"lower") = q59_som_target_noncropland.lo(j,noncropland59); + oq59_som_pool(t,j,land,"lower") = q59_som_pool.lo(j,land); + oq59_nr_som(t,j,"lower") = q59_nr_som.lo(j); + oq59_nr_som_fertilizer(t,j,"lower") = q59_nr_som_fertilizer.lo(j); + oq59_nr_som_fertilizer2(t,j,"lower") = q59_nr_som_fertilizer2.lo(j); + oq59_carbon_soil(t,j,land,stockType,"lower") = q59_carbon_soil.lo(j,land,stockType); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/59_som/cellpool_jan23/preloop.gms b/modules/59_som/cellpool_jan23/preloop.gms new file mode 100644 index 0000000000..0440e1940e --- /dev/null +++ b/modules/59_som/cellpool_jan23/preloop.gms @@ -0,0 +1,80 @@ +*** | (C) 2008-2023 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 + +***************************** +*** SOM initialisation *** +***************************** + +i59_subsoilc_density(t_all,j) = fm_carbon_density(t_all,j,"secdforest","soilc") - f59_topsoilc_density(t_all,j); + +p59_som_pool(j,"crop") = + sum((climate59,kcr),sum(clcl_climate59(clcl,climate59), + pm_climate_class(j,clcl)) * sum(cell(i,j), f59_cratio_landuse(i,climate59,kcr)) + * f59_topsoilc_density("y1995",j) * sum(w, fm_croparea("y1995",j,w,kcr))); + +p59_som_pool(j,noncropland59) = + f59_topsoilc_density("y1995",j) * pm_land_start(j,noncropland59); + + +***************************** +*** carbon initialisation *** +**************************** + +* starting value of carbon stocks 1995 is only an estimate. +* ATTENTION: emissions in 1995 are not meaningful + +vm_carbon_stock.l(j,"crop","soilc",stockType) = + p59_som_pool(j,"crop") + i59_subsoilc_density("y1995",j) * pm_land_start(j,"crop"); +vm_carbon_stock.l(j,noncropland59,"soilc",stockType) = + fm_carbon_density("y1995",j,noncropland59,"soilc") * pm_land_start(j,noncropland59); + +***************************** +*** cshare calculation *** +***************************** + +*' @code The cellpool_aug16 calculates the carbon loss with the assumption +*' of a lossrate of 15% per year resulting in 44% in 5 years, 80% in 10 years +*' and 96% in 20 years. The lossrate for a given timestep is than calculate by + +i59_lossrate(t)=1-0.85**m_yeardiff(t); + +*' The stock change factors are implemented for cropland subsystems divided by +*' MAgPIE crop types as well as potentially for tillage and input management. +*' So far it just tracks the subsystem component due to missing data for the +*' other categories. They are set to the following default values: + +i59_tillage_share(i,tillage59)=0; +i59_tillage_share(i,"full_tillage")=1; +i59_input_share(i,inputs59)=0; +i59_input_share(i,"medium_input")=1; + +*' The stock change factor in each cell for every crop type also takes into account +*' the climate variability of these factors and is therefor given by: + +i59_cratio(j,kcr,w) = sum((cell(i,j),tillage59,inputs59,climate59), + sum(clcl_climate59(clcl,climate59),pm_climate_class(j,clcl)) + * f59_cratio_landuse(i,climate59,kcr) + * i59_tillage_share(i,tillage59) + * f59_cratio_tillage(climate59,tillage59) + * 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((cell(i,j),climate59), + sum(clcl_climate59(clcl,climate59),pm_climate_class(j,clcl)) + * f59_cratio_landuse(i,climate59,"maiz") + * f59_cratio_tillage(climate59,"reduced_tillage") + * f59_cratio_inputs(climate59,"low_input")); +*' @stop + +p59_carbon_density(t,j,land) = 0; + +p59_land_before(j,land) = pm_land_start(j,land); diff --git a/modules/59_som/cellpool_jan23/presolve.gms b/modules/59_som/cellpool_jan23/presolve.gms new file mode 100644 index 0000000000..b07f421a73 --- /dev/null +++ b/modules/59_som/cellpool_jan23/presolve.gms @@ -0,0 +1,29 @@ +*** | (C) 2008-2023 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 + + +* 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,land)$(pcm_land(j,land)>1e-20) = p59_som_pool(j,land) / pcm_land(j,land); diff --git a/modules/59_som/cellpool_jan23/realization.gms b/modules/59_som/cellpool_jan23/realization.gms new file mode 100644 index 0000000000..d3cc9b2078 --- /dev/null +++ b/modules/59_som/cellpool_jan23/realization.gms @@ -0,0 +1,37 @@ +*** | (C) 2008-2023 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 cellpool_aug23 realization is built on revised IPCC 2019 Guidelines for +*' National Greenhouse Gas Inventories (@calvo_buendia_ipcc_2019). It calculates the loss of +*' soil carbon due to cropping activities and management based on stock change factors, +*' compared to potential natural vegetation. +*' 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. + +*' @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. 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 Kristine Karstens, Benjamin Leon Bodirsky + + + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/59_som/cellpool_jan23/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/59_som/cellpool_jan23/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/59_som/cellpool_jan23/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/59_som/cellpool_jan23/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/59_som/cellpool_jan23/scaling.gms" +$Ifi "%phase%" == "preloop" $include "./modules/59_som/cellpool_jan23/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/59_som/cellpool_jan23/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/59_som/cellpool_jan23/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/59_som/cellpool_jan23/scaling.gms b/modules/59_som/cellpool_jan23/scaling.gms new file mode 100644 index 0000000000..ac412019a1 --- /dev/null +++ b/modules/59_som/cellpool_jan23/scaling.gms @@ -0,0 +1,9 @@ +*** | (C) 2008-2023 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 + +v59_som_target.scale(j,land) = 10e3; +v59_som_pool.scale(j,land) = 10e3; diff --git a/modules/59_som/cellpool_jan23/sets.gms b/modules/59_som/cellpool_jan23/sets.gms new file mode 100644 index 0000000000..51d31fb065 --- /dev/null +++ b/modules/59_som/cellpool_jan23/sets.gms @@ -0,0 +1,63 @@ +*** | (C) 2008-2023 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 + +noncropland59(land) Soil carbon conserving landuse types +/past, forestry, primforest, secdforest, other, urban/ + +tillage59 Tillage categories of IPCC +/full_tillage,reduced_tillage,no_tillage/ + +inputs59 Input management categories of IPCC +/low_input,medium_input,high_input_nomanure,high_input_manure/ + +climate59_2019 Climate classes of IPCC 2019 +/temperate_dry,temperate_moist,tropical_dry,tropical_moist,boreal_dry,boreal_moist/ + +climate59(climate59_2019) Climate classes of IPCC 2006 +/temperate_dry,temperate_moist,tropical_dry,tropical_moist/ + +*** Csa, Dwa should be dry (maybe others as well) + +clcl_climate59(clcl,climate59) Climate classification types + / + Af .(tropical_moist) "equatorial fully humid" + Am .(tropical_moist) "equatorial monsoonal" + As .(tropical_moist) "equatorial summer dry" + Aw .(tropical_moist) "equatorial winter dry" + BSh .(tropical_dry) "arid steppe hot arid" + BSk .(temperate_dry) "arid steppe cold arid" + BWh .(tropical_dry) "arid desert hot arid" + BWk .(temperate_dry) "arid desert cold arid" + Cfa .(temperate_moist) "warm temperate fully humid hot summer" + Cfb .(temperate_moist) "warm temperate fully humid warm summer" + Cfc .(temperate_moist) "warm temperate fully humid cool summer" + Csa .(temperate_moist) "warm temperate winter dry hot summer" + Csb .(temperate_moist) "warm temperate winter dry warm summer" + Csc .(temperate_moist) "warm temperate winter dry cool summer" + Cwa .(temperate_moist) "warm temperate winter dry hot summer" + Cwb .(temperate_moist) "warm temperate winter dry warm summer" + Cwc .(temperate_moist) "warm temperate winter dry cool summer" + Dfa .(temperate_moist) "snow fully humid hot summer" + Dfb .(temperate_moist) "snow fully humid warm summer" + Dfc .(temperate_moist) "snow fully humid cool summer" + Dfd .(temperate_moist) "snow fully humid extremely continental" + Dsa .(temperate_moist) "snow winter dry hot summer" + Dsb .(temperate_moist) "snow winter dry warm summer" + Dsc .(temperate_moist) "snow winter dry cool summer" + Dsd .(temperate_dry) "snow winder dry extremely continental" + Dwa .(temperate_moist) "snow winter dry hot summer" + Dwb .(temperate_moist) "snow winter dry warm summer" + Dwc .(temperate_moist) "snow winter dry cool summer" + Dwd .(temperate_dry) "snow winter dry extremely continental" + EF .(temperate_dry) "polar polar frost" + ET .(temperate_moist) "polar polar tundra" + / +; + +alias(noncropland59,noncropland59_2); diff --git a/modules/59_som/input/files b/modules/59_som/input/files index deeed259ef..4f4ac2c34e 100644 --- a/modules/59_som/input/files +++ b/modules/59_som/input/files @@ -1,3 +1,3 @@ * list of files that are required here -lpj_carbon_topsoil.cs2 +lpj_carbon_topsoil.cs2b lpj_carbon_topsoil_0.5.mz diff --git a/modules/59_som/module.gms b/modules/59_som/module.gms index 1baa1bfead..b6536003f0 100644 --- a/modules/59_som/module.gms +++ b/modules/59_som/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -18,5 +18,6 @@ *###################### R SECTION START (MODULETYPES) ########################## $Ifi "%som%" == "cellpool_aug16" $include "./modules/59_som/cellpool_aug16/realization.gms" +$Ifi "%som%" == "cellpool_jan23" $include "./modules/59_som/cellpool_jan23/realization.gms" $Ifi "%som%" == "static_jan19" $include "./modules/59_som/static_jan19/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/59_som/static_jan19/declarations.gms b/modules/59_som/static_jan19/declarations.gms index a398073078..4354bc1f50 100644 --- a/modules/59_som/static_jan19/declarations.gms +++ b/modules/59_som/static_jan19/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -8,6 +8,7 @@ parameters i59_topsoilc_density(t_all,j) Topsoil carbon density of a hectare of cropland (tC per ha) i59_subsoilc_density(t_all,j) Subsoil carbon density of a hectare of land (tC per ha) + i59_nr_som_exogenous_per_ha(t_all,i) Exogenous nr release due to som release per ha (tN per ha) ; variables @@ -16,15 +17,15 @@ variables ; equations - q59_soilcarbon_cropland(j) Cropland soil carbon content calculation (mio. tC) - q59_soilcarbon_noncropland(j,noncropland59) Non-cropland soil carbon content calculation (mio. tC) + q59_soilcarbon_cropland(j,stockType) Cropland soil carbon content calculation (mio. tC) + q59_soilcarbon_noncropland(j,noncropland59,stockType) Non-cropland soil carbon content calculation (mio. tC) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_nr_som(t,j,type) Release of soil organic matter (Mt N per yr) - ov_nr_som_fertilizer(t,j,type) Uptake of soil organic matter from plants (Mt N per yr) - oq59_soilcarbon_cropland(t,j,type) Cropland soil carbon content calculation (mio. tC) - oq59_soilcarbon_noncropland(t,j,noncropland59,type) Non-cropland soil carbon content calculation (mio. tC) + ov_nr_som(t,j,type) Release of soil organic matter (Mt N per yr) + ov_nr_som_fertilizer(t,j,type) Uptake of soil organic matter from plants (Mt N per yr) + oq59_soilcarbon_cropland(t,j,stockType,type) Cropland soil carbon content calculation (mio. tC) + oq59_soilcarbon_noncropland(t,j,noncropland59,stockType,type) Non-cropland soil carbon content calculation (mio. tC) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/59_som/static_jan19/equations.gms b/modules/59_som/static_jan19/equations.gms index 94446d4db8..444849f403 100644 --- a/modules/59_som/static_jan19/equations.gms +++ b/modules/59_som/static_jan19/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -8,11 +8,11 @@ *' @equations *' The soil carbon content for cropland is calculated as sum of reduced topsoil density *' and the reference soil carbon densities of the subsoil. - q59_soilcarbon_cropland(j2) .. - vm_carbon_stock(j2,"crop","soilc") =e= + q59_soilcarbon_cropland(j2,stockType) .. + vm_carbon_stock(j2,"crop","soilc",stockType) =e= vm_land(j2,"crop") * sum(ct, i59_topsoilc_density(ct,j2) + i59_subsoilc_density(ct,j2)); *' The soil carbon content for all other land use types is calculated based on the full profile soil carbon density: - q59_soilcarbon_noncropland(j2,noncropland59) .. - vm_carbon_stock(j2,noncropland59,"soilc") =e= + q59_soilcarbon_noncropland(j2,noncropland59,stockType) .. + vm_carbon_stock(j2,noncropland59,"soilc",stockType) =e= sum(ct, vm_land(j2,noncropland59) * fm_carbon_density(ct,j2,noncropland59,"soilc")); diff --git a/modules/59_som/static_jan19/input.gms b/modules/59_som/static_jan19/input.gms index 11e5cebb74..72e5432048 100644 --- a/modules/59_som/static_jan19/input.gms +++ b/modules/59_som/static_jan19/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -9,24 +9,37 @@ $setglobal c59_static_spatial_level cellular * options: cellular (use preprocessed cellular stock change factors) * cluster (use cshare_released on cluster within gams) -$setglobal c59_som_scenario nocc -* options: cc (climate change) -* nocc (no climate change) +$setglobal c59_som_scenario cc +* options: cc (climate change) +* nocc (no climate change) +* nocc_hist (no climate change after year defined by sm_fix_cc) + +* Exogenous nr release through som loss (only in static realization) +$setglobal c59_exo_scen constant +* options: constant (constant from 2020) +* fadeout_2050 (fading out till 2050) parameters f59_topsoilc_density(t_all,j) LPJ topsoil carbon density for natural vegetation (tC per ha) / $ondelim -$include "./modules/59_som/input/lpj_carbon_topsoil.cs2" +$include "./modules/59_som/input/lpj_carbon_topsoil.cs2b" $offdelim / ; $if "%c59_som_scenario%" == "nocc" f59_topsoilc_density(t_all,j) = f59_topsoilc_density("y1995",j); +$if "%c59_som_scenario%" == "nocc_hist" f59_topsoilc_density(t_all,j)$(m_year(t_all) > sm_fix_cc) = f59_topsoilc_density(t_all,j)$(m_year(t_all) = sm_fix_cc); m_fillmissingyears(f59_topsoilc_density,"j"); parameters f59_cshare_released(j) Share of soil carbon that is released on cropland compared to natural vegetation after 20 years (1) / $ondelim -$include "./modules/59_som/static_jan19/input/cshare_released.cs2" +$include "./modules/59_som/static_jan19/input/cshare_released.cs2b" $offdelim / ; + +table f59_som_exogenous(t_all,i,exo_scen59) Nr released through changing soil organic matter +$ondelim +$include "./modules/59_som/static_jan19/input/f59_som_exogenous.cs3" +$offdelim +; diff --git a/modules/59_som/static_jan19/input/files b/modules/59_som/static_jan19/input/files index de0b8f4535..7ce5a95ad7 100644 --- a/modules/59_som/static_jan19/input/files +++ b/modules/59_som/static_jan19/input/files @@ -1,2 +1,3 @@ * list of files that are required here -cshare_released.cs2 +cshare_released.cs2b +f59_som_exogenous.cs3 \ No newline at end of file diff --git a/modules/59_som/static_jan19/not_used.txt b/modules/59_som/static_jan19/not_used.txt index 6cca4b5b07..9bd4f91711 100644 --- a/modules/59_som/static_jan19/not_used.txt +++ b/modules/59_som/static_jan19/not_used.txt @@ -1,14 +1,8 @@ -# | (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 pm_land_start,input,questionnaire -pm_croparea_start,input,questionnaire +fm_croparea,input,questionnaire vm_area,input,questionnaire vm_landexpansion,input,questionnaire -vm_croplandexpansion,input,questionnaire -vm_croplandreduction,input,questionnaire +vm_lu_transitions,input,questionnaire pm_climate_class,input,questionnaire +vm_fallow,input,questionnaire diff --git a/modules/59_som/static_jan19/postsolve.gms b/modules/59_som/static_jan19/postsolve.gms index 4a54afb413..76ed279b36 100644 --- a/modules/59_som/static_jan19/postsolve.gms +++ b/modules/59_som/static_jan19/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -8,21 +8,21 @@ *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_nr_som(t,j,"marginal") = vm_nr_som.m(j); - ov_nr_som_fertilizer(t,j,"marginal") = vm_nr_som_fertilizer.m(j); - oq59_soilcarbon_cropland(t,j,"marginal") = q59_soilcarbon_cropland.m(j); - oq59_soilcarbon_noncropland(t,j,noncropland59,"marginal") = q59_soilcarbon_noncropland.m(j,noncropland59); - ov_nr_som(t,j,"level") = vm_nr_som.l(j); - ov_nr_som_fertilizer(t,j,"level") = vm_nr_som_fertilizer.l(j); - oq59_soilcarbon_cropland(t,j,"level") = q59_soilcarbon_cropland.l(j); - oq59_soilcarbon_noncropland(t,j,noncropland59,"level") = q59_soilcarbon_noncropland.l(j,noncropland59); - ov_nr_som(t,j,"upper") = vm_nr_som.up(j); - ov_nr_som_fertilizer(t,j,"upper") = vm_nr_som_fertilizer.up(j); - oq59_soilcarbon_cropland(t,j,"upper") = q59_soilcarbon_cropland.up(j); - oq59_soilcarbon_noncropland(t,j,noncropland59,"upper") = q59_soilcarbon_noncropland.up(j,noncropland59); - ov_nr_som(t,j,"lower") = vm_nr_som.lo(j); - ov_nr_som_fertilizer(t,j,"lower") = vm_nr_som_fertilizer.lo(j); - oq59_soilcarbon_cropland(t,j,"lower") = q59_soilcarbon_cropland.lo(j); - oq59_soilcarbon_noncropland(t,j,noncropland59,"lower") = q59_soilcarbon_noncropland.lo(j,noncropland59); + ov_nr_som(t,j,"marginal") = vm_nr_som.m(j); + ov_nr_som_fertilizer(t,j,"marginal") = vm_nr_som_fertilizer.m(j); + oq59_soilcarbon_cropland(t,j,stockType,"marginal") = q59_soilcarbon_cropland.m(j,stockType); + oq59_soilcarbon_noncropland(t,j,noncropland59,stockType,"marginal") = q59_soilcarbon_noncropland.m(j,noncropland59,stockType); + ov_nr_som(t,j,"level") = vm_nr_som.l(j); + ov_nr_som_fertilizer(t,j,"level") = vm_nr_som_fertilizer.l(j); + oq59_soilcarbon_cropland(t,j,stockType,"level") = q59_soilcarbon_cropland.l(j,stockType); + oq59_soilcarbon_noncropland(t,j,noncropland59,stockType,"level") = q59_soilcarbon_noncropland.l(j,noncropland59,stockType); + ov_nr_som(t,j,"upper") = vm_nr_som.up(j); + ov_nr_som_fertilizer(t,j,"upper") = vm_nr_som_fertilizer.up(j); + oq59_soilcarbon_cropland(t,j,stockType,"upper") = q59_soilcarbon_cropland.up(j,stockType); + oq59_soilcarbon_noncropland(t,j,noncropland59,stockType,"upper") = q59_soilcarbon_noncropland.up(j,noncropland59,stockType); + ov_nr_som(t,j,"lower") = vm_nr_som.lo(j); + ov_nr_som_fertilizer(t,j,"lower") = vm_nr_som_fertilizer.lo(j); + oq59_soilcarbon_cropland(t,j,stockType,"lower") = q59_soilcarbon_cropland.lo(j,stockType); + oq59_soilcarbon_noncropland(t,j,noncropland59,stockType,"lower") = q59_soilcarbon_noncropland.lo(j,noncropland59,stockType); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/59_som/static_jan19/preloop.gms b/modules/59_som/static_jan19/preloop.gms index b01b4af1f0..ef41e2547a 100644 --- a/modules/59_som/static_jan19/preloop.gms +++ b/modules/59_som/static_jan19/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -8,8 +8,8 @@ * starting value of carbon stocks 1995 is only an estimate. * ATTENTION: emissions in 1995 are not meaningful -vm_carbon_stock.l(j,land,"soilc") = fm_carbon_density("y1995",j,land,"soilc") * pcm_land(j,land); -pcm_carbon_stock(j,land,"soilc") = vm_carbon_stock.l(j,land,"soilc"); +vm_carbon_stock.l(j,land,"soilc","actual") = fm_carbon_density("y1995",j,land,"soilc") * pcm_land(j,land); +*pcm_carbon_stock(j,land,"soilc") = vm_carbon_stock.l(j,land,"soilc"); * Soilc is not different for all non cropland vegetated land types * No age-class soil carbon density distribution is nessessary diff --git a/modules/59_som/static_jan19/presolve.gms b/modules/59_som/static_jan19/presolve.gms index 42854a3aa4..a66215a217 100644 --- a/modules/59_som/static_jan19/presolve.gms +++ b/modules/59_som/static_jan19/presolve.gms @@ -1,9 +1,16 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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_nr_som.fx(j)=0; -vm_nr_som_fertilizer.fx(j)=0; +vm_nr_som.fx(j) = 0; +vm_nr_som_fertilizer.fx(j) = 0; + +i59_nr_som_exogenous_per_ha(t,i) = 0; +$if "%c59_exo_scen%" == "constant" i59_nr_som_exogenous_per_ha(t,i)$(sum(cell(i,j),pcm_land(j,"crop")) > 0) = f59_som_exogenous(t,i,"constant")/sum(cell(i,j),pcm_land(j,"crop")); +$if "%c59_exo_scen%" == "fadeout_2050" i59_nr_som_exogenous_per_ha(t,i)$(sum(cell(i,j),pcm_land(j,"crop")) > 0) = f59_som_exogenous(t,i,"fadeout_2050")/sum(cell(i,j),pcm_land(j,"crop")); + +vm_nr_som.fx(j) = sum(cell(i,j),i59_nr_som_exogenous_per_ha(t,i)*pcm_land(j,"crop")); +vm_nr_som_fertilizer.fx(j) = sum(cell(i,j),i59_nr_som_exogenous_per_ha(t,i)*pcm_land(j,"crop")); diff --git a/modules/59_som/static_jan19/realization.gms b/modules/59_som/static_jan19/realization.gms index 373d0df367..0bbc00e730 100644 --- a/modules/59_som/static_jan19/realization.gms +++ b/modules/59_som/static_jan19/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/59_som/static_jan19/sets.gms b/modules/59_som/static_jan19/sets.gms index 37b00406ce..53e267cc15 100644 --- a/modules/59_som/static_jan19/sets.gms +++ b/modules/59_som/static_jan19/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,6 +7,8 @@ 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/60_bioenergy/1stgen_priced_dec18/declarations.gms b/modules/60_bioenergy/1stgen_priced_dec18/declarations.gms index 8eae4bd6fa..061a1b79f4 100644 --- a/modules/60_bioenergy/1stgen_priced_dec18/declarations.gms +++ b/modules/60_bioenergy/1stgen_priced_dec18/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -10,8 +10,8 @@ parameters i60_bioenergy_dem(t,i) Regional bioenergy demand per year (mio. GJ per yr) i60_res_2ndgenBE_dem(t,i) Regional residue demand for 2nd generation bioenergy per year (mio. GJ per yr) i60_1stgen_bioenergy_dem(t,i,kall) Regional 1st generation bioenergy demand (mio. GJ per yr) - p60_region_BE_shr(t_all,i) Bioenergy demand share of the region (1) - p60_country_dummy(iso) Dummy parameter indicating whether country is selected for selected bioenergy demand scenario (1) + p60_region_BE_shr(t_all,i) Bioenergy demand share of the region (1) + p60_country_dummy(iso) Dummy parameter indicating whether country is selected for selected bioenergy demand scenario (1) ; positive variables diff --git a/modules/60_bioenergy/1stgen_priced_dec18/equations.gms b/modules/60_bioenergy/1stgen_priced_dec18/equations.gms index 58b3f300f3..6d2b697dd0 100644 --- a/modules/60_bioenergy/1stgen_priced_dec18/equations.gms +++ b/modules/60_bioenergy/1stgen_priced_dec18/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/60_bioenergy/1stgen_priced_dec18/input.gms b/modules/60_bioenergy/1stgen_priced_dec18/input.gms index 82ac23f6a1..a27aa6b4ca 100644 --- a/modules/60_bioenergy/1stgen_priced_dec18/input.gms +++ b/modules/60_bioenergy/1stgen_priced_dec18/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,39 +7,40 @@ sets scen_countries60(iso) countries to be affected by 2nd generation bionergy demand scenario / 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 / + 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 / ; scalars c60_biodem_level bioenergy demand level indicator 1 for regional and 0 for global demand (1) / 1 / c60_bioenergy_subsidy first generation bioenergy subsidy (USD05MER per ton) / 300 / + s60_2ndgen_bioenergy_dem_min Minimum dedicated 2nd generation bioenergy demand assumed in each region (mio. GJ per yr) / 1 / ; -$setglobal c60_2ndgen_biodem R2M41-SSP2-NPi -$setglobal c60_2ndgen_biodem_noselect R2M41-SSP2-NPi +$setglobal c60_2ndgen_biodem R21M42-SSP2-NPi +$setglobal c60_2ndgen_biodem_noselect R21M42-SSP2-NPi $if "%c60_2ndgen_biodem%" == "coupling" table f60_bioenergy_dem_coupling(t_all,i) Bioenergy demand (regional) (mio. GJ per yr) diff --git a/modules/60_bioenergy/1stgen_priced_dec18/not_used.txt b/modules/60_bioenergy/1stgen_priced_dec18/not_used.txt deleted file mode 100644 index da77c77f60..0000000000 --- a/modules/60_bioenergy/1stgen_priced_dec18/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/60_bioenergy/1stgen_priced_dec18/postsolve.gms b/modules/60_bioenergy/1stgen_priced_dec18/postsolve.gms index dd3382afc4..168269211e 100644 --- a/modules/60_bioenergy/1stgen_priced_dec18/postsolve.gms +++ b/modules/60_bioenergy/1stgen_priced_dec18/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/60_bioenergy/1stgen_priced_dec18/preloop.gms b/modules/60_bioenergy/1stgen_priced_dec18/preloop.gms index c325769779..edd93ec225 100644 --- a/modules/60_bioenergy/1stgen_priced_dec18/preloop.gms +++ b/modules/60_bioenergy/1stgen_priced_dec18/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -23,4 +23,8 @@ $elseif "%c60_2ndgen_biodem%" == "emulator" $else i60_bioenergy_dem(t,i) = f60_bioenergy_dem(t,i,"%c60_2ndgen_biodem%") * p60_region_BE_shr(t,i) + f60_bioenergy_dem(t,i,"%c60_2ndgen_biodem_noselect%") * (1-p60_region_BE_shr(t,i)); +** Harmonize till 2020 if not coupled or emulator +loop(t$(m_year(t) <= sm_fix_SSP2), + i60_bioenergy_dem(t,i) = f60_bioenergy_dem(t,i,"R21M42-SSP2-NPi"); +); $endif diff --git a/modules/60_bioenergy/1stgen_priced_dec18/presolve.gms b/modules/60_bioenergy/1stgen_priced_dec18/presolve.gms index 8cd1023efb..abf8f02708 100644 --- a/modules/60_bioenergy/1stgen_priced_dec18/presolve.gms +++ b/modules/60_bioenergy/1stgen_priced_dec18/presolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -23,9 +23,5 @@ else f60_res_2ndgenBE_dem(t,i,"%c60_res_2ndgenBE_dem%"); ); -if(m_year(t) <= sm_fix_SSP2, -i60_bioenergy_dem(t,i) = f60_bioenergy_dem(t,i,"R2M41-SSP2-NPi"); -); - * Add minimal bioenergy demand in case of zero demand or very small demand to avoid zero prices -i60_bioenergy_dem(t,i)$(i60_bioenergy_dem(t,i) < 0.01) = 0.01; +i60_bioenergy_dem(t,i)$(i60_bioenergy_dem(t,i) < s60_2ndgen_bioenergy_dem_min) = s60_2ndgen_bioenergy_dem_min; diff --git a/modules/60_bioenergy/1stgen_priced_dec18/realization.gms b/modules/60_bioenergy/1stgen_priced_dec18/realization.gms index fa21de9983..e5472ca3f9 100644 --- a/modules/60_bioenergy/1stgen_priced_dec18/realization.gms +++ b/modules/60_bioenergy/1stgen_priced_dec18/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/60_bioenergy/1stgen_priced_dec18/scaling.gms b/modules/60_bioenergy/1stgen_priced_dec18/scaling.gms index 54a3eba536..f6d1c67185 100644 --- a/modules/60_bioenergy/1stgen_priced_dec18/scaling.gms +++ b/modules/60_bioenergy/1stgen_priced_dec18/scaling.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/60_bioenergy/1stgen_priced_dec18/sets.gms b/modules/60_bioenergy/1stgen_priced_dec18/sets.gms index 8b6b00ee1b..e314b1648a 100644 --- a/modules/60_bioenergy/1stgen_priced_dec18/sets.gms +++ b/modules/60_bioenergy/1stgen_priced_dec18/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,41 +7,62 @@ *############################################################################### *######################## R SECTION START (SETS) ############################### -*THIS CODE IS CREATED AUTOMATICALLY, DO NOT MODIFY THESE LINES DIRECTLY -*ANY DIRECT MODIFICATION WILL BE LOST AFTER NEXT INPUT DOWNLOAD -*CHANGES CAN BE DONE USING THE INPUT DOWNLOADER UNDER SCRIPTS/DOWNLOAD -*THERE YOU CAN ALSO FIND ADDITIONAL INFORMATION +* THIS CODE IS CREATED AUTOMATICALLY, DO NOT MODIFY THESE LINES DIRECTLY +* ANY DIRECT MODIFICATION WILL BE LOST AFTER NEXT AUTOMATIC UPDATE! sets - scen2nd60 second generation bioenergy scenarios / - R2M41-SSP2-Budg1300, - R2M41-SSP2-Budg600, - R2M41-SSP2-Budg950, - R2M41-SSP2-NDC, - R2M41-SSP2-NPi, - SSPDB-SSP1-19-IMAGE, - SSPDB-SSP1-19-REMIND-MAGPIE, - SSPDB-SSP1-26-IMAGE, - SSPDB-SSP1-26-REMIND-MAGPIE, - SSPDB-SSP1-34-IMAGE, - SSPDB-SSP1-34-REMIND-MAGPIE, - SSPDB-SSP1-45-IMAGE, - SSPDB-SSP1-45-REMIND-MAGPIE, - SSPDB-SSP1-Ref-IMAGE, - SSPDB-SSP1-Ref-REMIND-MAGPIE, - SSPDB-SSP2-19-REMIND-MAGPIE, - SSPDB-SSP2-26-REMIND-MAGPIE, - SSPDB-SSP2-34-REMIND-MAGPIE, - SSPDB-SSP2-45-REMIND-MAGPIE, - SSPDB-SSP2-60-REMIND-MAGPIE, - SSPDB-SSP2-Ref-REMIND-MAGPIE, - SSPDB-SSP5-19-REMIND-MAGPIE, - SSPDB-SSP5-26-REMIND-MAGPIE, - SSPDB-SSP5-34-REMIND-MAGPIE, - SSPDB-SSP5-45-REMIND-MAGPIE, - SSPDB-SSP5-60-REMIND-MAGPIE, - SSPDB-SSP5-Ref-REMIND-MAGPIE / + scen2nd60 second generation bioenergy scenarios + / PIK_GDP, + PIK_H2C, + PIK_HBL, + PIK_HOS, + PIK_LIN, + PIK_NPI, + PIK_OPT, + R21M42-SDP-NPi, + R21M42-SDP-PkBudg1000, + R21M42-SDP-PkBudg1100, + R21M42-SDP-PkBudg900, + R21M42-SSP1-NPi, + R21M42-SSP1-PkBudg1100, + R21M42-SSP1-PkBudg1300, + R21M42-SSP1-PkBudg900, + R21M42-SSP2-NPi, + R21M42-SSP2-PkBudg1100, + R21M42-SSP2-PkBudg1300, + R21M42-SSP2-PkBudg900, + R21M42-SSP5-NPi, + R21M42-SSP5-PkBudg1100, + R21M42-SSP5-PkBudg1300, + R21M42-SSP5-PkBudg900, + R2M41-SSP2-Budg1300, + R2M41-SSP2-Budg600, + R2M41-SSP2-Budg950, + R2M41-SSP2-NDC, + R2M41-SSP2-NPi, + SSPDB-SSP1-19-IMAGE, + SSPDB-SSP1-19-REMIND-MAGPIE, + SSPDB-SSP1-26-IMAGE, + SSPDB-SSP1-26-REMIND-MAGPIE, + SSPDB-SSP1-34-IMAGE, + SSPDB-SSP1-34-REMIND-MAGPIE, + SSPDB-SSP1-45-IMAGE, + SSPDB-SSP1-45-REMIND-MAGPIE, + SSPDB-SSP1-Ref-IMAGE, + SSPDB-SSP1-Ref-REMIND-MAGPIE, + SSPDB-SSP2-19-REMIND-MAGPIE, + SSPDB-SSP2-26-REMIND-MAGPIE, + SSPDB-SSP2-34-REMIND-MAGPIE, + SSPDB-SSP2-45-REMIND-MAGPIE, + SSPDB-SSP2-60-REMIND-MAGPIE, + SSPDB-SSP2-Ref-REMIND-MAGPIE, + SSPDB-SSP5-19-REMIND-MAGPIE, + SSPDB-SSP5-26-REMIND-MAGPIE, + SSPDB-SSP5-34-REMIND-MAGPIE, + SSPDB-SSP5-45-REMIND-MAGPIE, + SSPDB-SSP5-60-REMIND-MAGPIE, + SSPDB-SSP5-Ref-REMIND-MAGPIE / ; *######################### R SECTION END (SETS) ################################ diff --git a/modules/60_bioenergy/module.gms b/modules/60_bioenergy/module.gms index 258bfe9f44..fc56e8aca3 100644 --- a/modules/60_bioenergy/module.gms +++ b/modules/60_bioenergy/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/62_material/exo_flexreg_apr16/declarations.gms b/modules/62_material/exo_flexreg_apr16/declarations.gms index aa8dd71240..6816c238d5 100644 --- a/modules/62_material/exo_flexreg_apr16/declarations.gms +++ b/modules/62_material/exo_flexreg_apr16/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -8,11 +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_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 c2f7f83882..fd8eedbc0c 100644 --- a/modules/62_material/exo_flexreg_apr16/equations.gms +++ b/modules/62_material/exo_flexreg_apr16/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -14,19 +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, increasing 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)* - sum(kfo, vm_dem_food.l(i2,kfo)) - /(p62_dem_food_lh(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..20601829a0 100644 --- a/modules/62_material/exo_flexreg_apr16/input.gms +++ b/modules/62_material/exo_flexreg_apr16/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -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) / 0 /; +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..03e82e08a6 100644 --- a/modules/62_material/exo_flexreg_apr16/postsolve.gms +++ b/modules/62_material/exo_flexreg_apr16/postsolve.gms @@ -1,18 +1,18 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -*' 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..ff401144e4 100644 --- a/modules/62_material/exo_flexreg_apr16/preloop.gms +++ b/modules/62_material/exo_flexreg_apr16/preloop.gms @@ -1,9 +1,26 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 - 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 either kept constant for +* future years, or following a logistic function with given midpoint and maximum if a +* bioplastic production target is exogenously set. +* Global bioplastic demand is distributed to regions proportional to population due to lack of better data. + +p62_dem_bioplastic(t,i) = f62_hist_dem_bioplastic(t) * (im_pop(t,i) / sum(i2, im_pop(t,i2))); +p62_dem_bioplastic(t,i)$(m_year(t)>2020) = f62_hist_dem_bioplastic("y2020") * (im_pop("y2020",i) / sum(i2, im_pop("y2020",i2))); + +if (s62_max_dem_bioplastic <> 0, + 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); diff --git a/modules/62_material/exo_flexreg_apr16/presolve.gms b/modules/62_material/exo_flexreg_apr16/presolve.gms index fbd1dee66d..c2650488de 100644 --- a/modules/62_material/exo_flexreg_apr16/presolve.gms +++ b/modules/62_material/exo_flexreg_apr16/presolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -18,4 +18,17 @@ else s62_historical=0; ); +p62_scaling_factor(i) = 1; +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..d0da0888e6 100644 --- a/modules/62_material/exo_flexreg_apr16/realization.gms +++ b/modules/62_material/exo_flexreg_apr16/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -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 is included, with +*' future bioplastic production kept constant or following a logistic curve +*' if a bioplastic production target is exogenously set. *####################### R SECTION START (PHASES) ############################## $Ifi "%phase%" == "sets" $include "./modules/62_material/exo_flexreg_apr16/sets.gms" diff --git a/modules/62_material/exo_flexreg_apr16/sets.gms b/modules/62_material/exo_flexreg_apr16/sets.gms index 0f91956469..5d42bc9a09 100644 --- a/modules/62_material/exo_flexreg_apr16/sets.gms +++ b/modules/62_material/exo_flexreg_apr16/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 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..25436f5400 100644 --- a/modules/62_material/module.gms +++ b/modules/62_material/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -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, increasing 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 1d76594635..71dc155495 100644 --- a/modules/70_livestock/fbask_jan16/declarations.gms +++ b/modules/70_livestock/fbask_jan16/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -8,11 +8,14 @@ positive variables vm_dem_feed(i,kap,kall) Regional feed demand including byproducts (mio. tDM per yr) + vm_cost_prod_livst(i,factors) Livestock factor costs (mio. USD05MER per yr) + vm_cost_prod_fish(i) Fish factor costs (mio. USD05MER per yr) ; equations q70_feed(i,kap,kall) Regional feed demand - q70_cost_prod_liv(i,kall) 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 ; @@ -24,17 +27,23 @@ 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,factors) Capital and labor shares of the regional factor costs for plant production for livestock (1) + p70_cost_share_calibration(i) Summation factor used to calibrate calculated capital shares with historical values (1) + i70_cost_regr(i,kap,cost_regr) Regression coefficients for livestock factor requirements (1) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_dem_feed(t,i,kap,kall,type) Regional feed demand including byproducts (mio. tDM per yr) - oq70_feed(t,i,kap,kall,type) Regional feed demand - oq70_cost_prod_liv(t,i,kall,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,factors,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 2dc0a5735f..db8959984d 100644 --- a/modules/70_livestock/fbask_jan16/equations.gms +++ b/modules/70_livestock/fbask_jan16/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -26,14 +26,26 @@ q70_feed(i2,kap,kall) .. *' productivity. Here, factor costs rise with intensification. The per-unit *' costs for non-ruminants and fish are assumed to be independent from *' productivity trajectories for simplification. Therefore, -*' `f70_cost_regr(kli,"cost_regr_b")` is set to zero in the case of livestock +*' `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,kli) .. - vm_cost_prod(i2,kli) =e= vm_prod_reg(i2,kli) - *(f70_cost_regr(kli,"cost_regr_a") + f70_cost_regr(kli,"cost_regr_b") - *sum((ct, sys_to_kli(sys,kli)),i70_livestock_productivity(ct,i2,sys))); +*' 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,"capital")); q70_cost_prod_fish(i2) .. - vm_cost_prod(i2,"fish") =e= - vm_prod_reg(i2,"fish")*f70_cost_regr("fish","cost_regr_a"); + vm_cost_prod_fish(i2) =e= + vm_prod_reg(i2,"fish")*i70_cost_regr(i2,"fish","cost_regr_a"); diff --git a/modules/70_livestock/fbask_jan16/input.gms b/modules/70_livestock/fbask_jan16/input.gms index 1ee0b94495..4e2207d344 100644 --- a/modules/70_livestock/fbask_jan16/input.gms +++ b/modules/70_livestock/fbask_jan16/input.gms @@ -1,13 +1,14 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 c70_feed_scen ssp2 -* options: ssp1,ssp2,ssp3,ssp4,ssp5,constant +* options: SSP: ssp1, ssp2, ssp3, ssp4, ssp5 +* SDP: SDP, SDP_EI, SDP_MC, SDP_RC +* other: constant * Feed substitution scenarios including functional forms, targets and transition periods * options: constant, @@ -17,8 +18,12 @@ $setglobal c70_feed_scen ssp2 $setglobal c70_cereal_scp_scen constant $setglobal c70_foddr_scp_scen constant +$setglobal c70_fac_req_regr glo +* options: glo, reg + scalars s70_pyld_intercept Intercept of linear relationship determining pasture intensification (1) / 0.24 / + s70_past_mngmnt_factor_fix Year until the pasture management factor is fixed to 1 / 2005 / ; table f70_feed_baskets(t_all,i,kap,kall,feed_scen70) Feed baskets in tDM per tDM livestock product (1) @@ -57,11 +62,37 @@ $include "./modules/70_livestock/fbask_jan16/input/f70_pyld_slope_reg.cs4" $offdelim /; +parameter f70_cap_share_reg(share_regr) Parameters for regression +/ +$ondelim +$include "./modules/70_livestock/fbask_jan16/input/f70_cap_share_reg.csv" +$offdelim +/ +; + +table f70_hist_cap_share(t_all,i) Historical capital share +$ondelim +$include "./modules/70_livestock/fbask_jan16/input/f70_hist_cap_share.csv" +$offdelim +; + +table f70_hist_factor_costs_livst(i,kli) Historical factor costs in livestock production (mio. USD05MER) +$ondelim +$include "./modules/70_livestock/fbask_jan16/input/f70_hist_factor_costs_livst.csv" +$offdelim +; + +table f70_hist_prod_livst(i,kli,attributes) Historical production quantity of livestock products (mio. t) +$ondelim +$include "./modules/70_livestock/fbask_jan16/input/f70_hist_prod_livst.cs3" +$offdelim +; + * Set-switch for countries affected by country-specific exogenous diet scenario * Default: all iso countries selected sets scen_countries70(iso) countries to be affected by selected feed sceanrio / - ABW,AFG,AGO,AIA,ALA,ALB,AND,ARE,ARG,ARM, + 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, diff --git a/modules/70_livestock/fbask_jan16/input/files b/modules/70_livestock/fbask_jan16/input/files index 4473cdc26d..87dc840c55 100644 --- a/modules/70_livestock/fbask_jan16/input/files +++ b/modules/70_livestock/fbask_jan16/input/files @@ -3,6 +3,11 @@ f70_feed_baskets.cs3 f70_feed_balanceflow.cs3 f70_livestock_productivity.cs3 f70_capit_liv_regr.csv +f70_capit_liv_regr_regional.cs3 f70_slaughter_feed_share.cs4 f70_pyld_slope_reg.cs4 f70_feed_substitution_fader.csv +f70_cap_share_reg.csv +f70_hist_cap_share.csv +f70_hist_factor_costs_livst.csv +f70_hist_prod_livst.cs3 \ No newline at end of file diff --git a/modules/70_livestock/fbask_jan16/not_used.txt b/modules/70_livestock/fbask_jan16/not_used.txt deleted file mode 100644 index da77c77f60..0000000000 --- a/modules/70_livestock/fbask_jan16/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/70_livestock/fbask_jan16/postsolve.gms b/modules/70_livestock/fbask_jan16/postsolve.gms index 6627c727cf..02d77327eb 100644 --- a/modules/70_livestock/fbask_jan16/postsolve.gms +++ b/modules/70_livestock/fbask_jan16/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -8,20 +8,32 @@ *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_dem_feed(t,i,kap,kall,"marginal") = vm_dem_feed.m(i,kap,kall); - oq70_feed(t,i,kap,kall,"marginal") = q70_feed.m(i,kap,kall); - oq70_cost_prod_liv(t,i,kall,"marginal") = q70_cost_prod_liv.m(i,kall); - oq70_cost_prod_fish(t,i,"marginal") = q70_cost_prod_fish.m(i); - ov_dem_feed(t,i,kap,kall,"level") = vm_dem_feed.l(i,kap,kall); - oq70_feed(t,i,kap,kall,"level") = q70_feed.l(i,kap,kall); - oq70_cost_prod_liv(t,i,kall,"level") = q70_cost_prod_liv.l(i,kall); - oq70_cost_prod_fish(t,i,"level") = q70_cost_prod_fish.l(i); - ov_dem_feed(t,i,kap,kall,"upper") = vm_dem_feed.up(i,kap,kall); - oq70_feed(t,i,kap,kall,"upper") = q70_feed.up(i,kap,kall); - oq70_cost_prod_liv(t,i,kall,"upper") = q70_cost_prod_liv.up(i,kall); - oq70_cost_prod_fish(t,i,"upper") = q70_cost_prod_fish.up(i); - ov_dem_feed(t,i,kap,kall,"lower") = vm_dem_feed.lo(i,kap,kall); - oq70_feed(t,i,kap,kall,"lower") = q70_feed.lo(i,kap,kall); - oq70_cost_prod_liv(t,i,kall,"lower") = q70_cost_prod_liv.lo(i,kall); - oq70_cost_prod_fish(t,i,"lower") = q70_cost_prod_fish.lo(i); + ov_dem_feed(t,i,kap,kall,"marginal") = vm_dem_feed.m(i,kap,kall); + ov_cost_prod_livst(t,i,factors,"marginal") = vm_cost_prod_livst.m(i,factors); + ov_cost_prod_fish(t,i,"marginal") = vm_cost_prod_fish.m(i); + oq70_feed(t,i,kap,kall,"marginal") = q70_feed.m(i,kap,kall); + oq70_cost_prod_liv_labor(t,i,"marginal") = q70_cost_prod_liv_labor.m(i); + oq70_cost_prod_liv_capital(t,i,"marginal") = q70_cost_prod_liv_capital.m(i); + oq70_cost_prod_fish(t,i,"marginal") = q70_cost_prod_fish.m(i); + ov_dem_feed(t,i,kap,kall,"level") = vm_dem_feed.l(i,kap,kall); + ov_cost_prod_livst(t,i,factors,"level") = vm_cost_prod_livst.l(i,factors); + ov_cost_prod_fish(t,i,"level") = vm_cost_prod_fish.l(i); + oq70_feed(t,i,kap,kall,"level") = q70_feed.l(i,kap,kall); + oq70_cost_prod_liv_labor(t,i,"level") = q70_cost_prod_liv_labor.l(i); + oq70_cost_prod_liv_capital(t,i,"level") = q70_cost_prod_liv_capital.l(i); + oq70_cost_prod_fish(t,i,"level") = q70_cost_prod_fish.l(i); + ov_dem_feed(t,i,kap,kall,"upper") = vm_dem_feed.up(i,kap,kall); + ov_cost_prod_livst(t,i,factors,"upper") = vm_cost_prod_livst.up(i,factors); + ov_cost_prod_fish(t,i,"upper") = vm_cost_prod_fish.up(i); + oq70_feed(t,i,kap,kall,"upper") = q70_feed.up(i,kap,kall); + oq70_cost_prod_liv_labor(t,i,"upper") = q70_cost_prod_liv_labor.up(i); + oq70_cost_prod_liv_capital(t,i,"upper") = q70_cost_prod_liv_capital.up(i); + oq70_cost_prod_fish(t,i,"upper") = q70_cost_prod_fish.up(i); + ov_dem_feed(t,i,kap,kall,"lower") = vm_dem_feed.lo(i,kap,kall); + ov_cost_prod_livst(t,i,factors,"lower") = vm_cost_prod_livst.lo(i,factors); + ov_cost_prod_fish(t,i,"lower") = vm_cost_prod_fish.lo(i); + oq70_feed(t,i,kap,kall,"lower") = q70_feed.lo(i,kap,kall); + oq70_cost_prod_liv_labor(t,i,"lower") = q70_cost_prod_liv_labor.lo(i); + oq70_cost_prod_liv_capital(t,i,"lower") = q70_cost_prod_liv_capital.lo(i); + oq70_cost_prod_fish(t,i,"lower") = q70_cost_prod_fish.lo(i); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/70_livestock/fbask_jan16/preloop.gms b/modules/70_livestock/fbask_jan16/preloop.gms index 8961946dc5..e19fbd99f2 100644 --- a/modules/70_livestock/fbask_jan16/preloop.gms +++ b/modules/70_livestock/fbask_jan16/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -16,6 +16,8 @@ loop(t_all, ); ); +* set default livestock productivity to avoid division of zero in presolve.gms +i70_livestock_productivity(t_all,i,sys)$(i70_livestock_productivity(t_all,i,sys)=0) = 0.02; * Switch to determine countries for which feed substitution scenarios shall be applied. * In the default case, the food scenario affects all countries when activated. @@ -51,7 +53,15 @@ 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); + + +*** choosing between reginal and global factor requirements +$if "%c70_fac_req_regr%" == "glo" i70_cost_regr(i,kli,"cost_regr_a") = f70_cost_regr(kli,"cost_regr_a"); +$if "%c70_fac_req_regr%" == "reg" i70_cost_regr(i,kli,"cost_regr_a") = (f70_hist_factor_costs_livst(i,kli)/f70_hist_prod_livst(i,kli,"dm"))-f70_cost_regr(kli,"cost_regr_b")*sum(sys_to_kli(sys,kli),i70_livestock_productivity("y2005",i,sys)); + +i70_cost_regr(i,"fish",cost_regr) = f70_cost_regr("fish",cost_regr); +i70_cost_regr(i,kap,"cost_regr_b") = f70_cost_regr(kap,"cost_regr_b"); diff --git a/modules/70_livestock/fbask_jan16/presolve.gms b/modules/70_livestock/fbask_jan16/presolve.gms index 0bf5aa4e68..0e14beeb88 100644 --- a/modules/70_livestock/fbask_jan16/presolve.gms +++ b/modules/70_livestock/fbask_jan16/presolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -16,7 +16,7 @@ *' livestock products: p70_cattle_stock_proxy(t,i) = im_pop(t,i)*pm_kcal_pc_initial(t,i,"livst_rum") - /i70_livestock_productivity(t,i,"sys_beef"); + /i70_livestock_productivity(t,i,"sys_beef"); *' The lower bound for `p70_cattle_stock_proxy` is set to 20% of initial cattle *' stocks in 1995: @@ -27,20 +27,30 @@ p70_cattle_stock_proxy(t,i)$(p70_cattle_stock_proxy(t,i) < 0.2*p70_cattle_stock_ *' relative to the previous time step: p70_incr_cattle(t,i) = 1$(ord(t)=1) - + (p70_cattle_stock_proxy(t,i)/p70_cattle_stock_proxy(t-1,i))$(ord(t)>1); + + (p70_cattle_stock_proxy(t,i)/p70_cattle_stock_proxy(t-1,i))$(ord(t)>1); *' The pasture management factor is calculated by applying a linear relationship *' that links changes in pasture management with changes in cattle stocks: -if (sum(sameas(t_past,t),1) = 1, +if (m_year(t) <= s70_past_mngmnt_factor_fix, pm_past_mngmnt_factor(t,i) = 1; else pm_past_mngmnt_factor(t,i) = ( (s70_pyld_intercept + f70_pyld_slope_reg(i)*p70_incr_cattle(t,i)**(5/(m_year(t)-m_year(t-1))) - )**((m_year(t)-m_year(t-1))/5) )*pm_past_mngmnt_factor(t-1,i); + )**((m_year(t)-m_year(t-1))/5) )*pm_past_mngmnt_factor(t-1,i); ); *' @stop +p70_cost_share_calibration(i) = f70_hist_cap_share("y2010",i)-(f70_cap_share_reg("slope")*log10(sum(i_to_iso(i,iso),im_gdp_pc_ppp_iso("y2010",iso)))+f70_cap_share_reg("intercept")); + +if (m_year(t)<2010, + p70_cost_share_livst(t,i,"capital") = f70_hist_cap_share(t,i); + p70_cost_share_livst(t,i,"labor") = 1 - f70_hist_cap_share(t,i); + +elseif (m_year(t)>=2010), + p70_cost_share_livst(t,i,"capital") = f70_cap_share_reg("slope")*log10(sum(i_to_iso(i,iso),im_gdp_pc_ppp_iso(t,iso)))+f70_cap_share_reg("intercept")+p70_cost_share_calibration(i); + p70_cost_share_livst(t,i,"labor") = 1 - p70_cost_share_livst(t,i,"capital"); +); diff --git a/modules/70_livestock/fbask_jan16/realization.gms b/modules/70_livestock/fbask_jan16/realization.gms index 3eabdff5c1..d95254b5b8 100644 --- a/modules/70_livestock/fbask_jan16/realization.gms +++ b/modules/70_livestock/fbask_jan16/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/70_livestock/fbask_jan16/sets.gms b/modules/70_livestock/fbask_jan16/sets.gms index cc9ab86835..a3212650d1 100644 --- a/modules/70_livestock/fbask_jan16/sets.gms +++ b/modules/70_livestock/fbask_jan16/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,11 +6,16 @@ *** | Contact: magpie@pik-potsdam.de sets + cost_regr Cost regression parameters /cost_regr_a,cost_regr_b/ + share_regr regression parameters for capital share calculation + /slope, intercept/ + feed_scen70 scenarios - / ssp1,ssp2,ssp3,ssp4,ssp5,constant / + / ssp1, ssp2, ssp3, ssp4, ssp5, constant, + SDP, SDP_EI, SDP_MC, SDP_RC / sys Livestock production systems /sys_pig, sys_beef, sys_chicken, sys_hen, sys_dairy/ @@ -37,6 +42,5 @@ sets / 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 / - + lin_99-98-90pc_20_50-60-100, sigmoid_20pc_20_50, sigmoid_50pc_20_50, sigmoid_80pc_20_50 / ; diff --git a/modules/70_livestock/module.gms b/modules/70_livestock/module.gms index c7d9dc29cd..284e0450b1 100644 --- a/modules/70_livestock/module.gms +++ b/modules/70_livestock/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/14_yields/dynamic_aug18/nl_release.gms b/modules/70_livestock/scaling.gms similarity index 70% rename from modules/14_yields/dynamic_aug18/nl_release.gms rename to modules/70_livestock/scaling.gms index d4f67de511..76a926f2e7 100644 --- a/modules/14_yields/dynamic_aug18/nl_release.gms +++ b/modules/70_livestock/scaling.gms @@ -1,11 +1,10 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 -* ### nl_release ### -vm_yld.lo(j,kve,w) = 0; -vm_yld.up(j,kve,w) = Inf; +vm_cost_prod_livst.scale(i,factors) = 10e5; +vm_cost_prod_fish.scale(i) = 10e5; diff --git a/modules/71_disagg_lvst/foragebased_aug18/declarations.gms b/modules/71_disagg_lvst/foragebased_aug18/declarations.gms index 6d6496bd8f..d68611a046 100644 --- a/modules/71_disagg_lvst/foragebased_aug18/declarations.gms +++ b/modules/71_disagg_lvst/foragebased_aug18/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/71_disagg_lvst/foragebased_aug18/equations.gms b/modules/71_disagg_lvst/foragebased_aug18/equations.gms index 0a18c32c5b..575ba6c47b 100644 --- a/modules/71_disagg_lvst/foragebased_aug18/equations.gms +++ b/modules/71_disagg_lvst/foragebased_aug18/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -15,9 +15,9 @@ q71_feed_rum_liv(j2,kforage) .. vm_prod(j2,kforage) =g= sum(kli_rum, v71_prod_rum(j2,kli_rum,kforage) * sum((ct,cell(i2,j2),kforage2),im_feed_baskets(ct,i2,kli_rum,kforage2)) - * (1 + v71_feed_balanceflow(j2,kli_rum,kforage)$(s71_lp_fix=0)) - + v71_feed_balanceflow(j2,kli_rum,kforage)$(s71_lp_fix=1)) - ; + * (1 + v71_feed_balanceflow(j2,kli_rum,kforage)$(s71_lp_fix=0)) + + v71_feed_balanceflow(j2,kli_rum,kforage)$(s71_lp_fix=1)) + ; *' The above equation contains a split of pasture and fodder fed ruminants, since we assume that depending @@ -46,9 +46,9 @@ q71_balanceflow_constraint_lp(i2,kli_rum,kforage)$(s71_lp_fix=1) .. *' In each cluster the balance flow is constrained by its share of livestock production regarding the regional level by q71_balanceflow_constraint_nlp(j2,kli_rum,kforage)$(s71_lp_fix=0) .. - v71_feed_balanceflow(j2,kli_rum,kforage) =e= - sum((ct,cell(i2,j2)),fm_feed_balanceflow(ct,i2,kli_rum,kforage) - /(im_feed_baskets(ct,i2,kli_rum,kforage)*vm_prod_reg(i2,kli_rum) + 10**(-6))) + v71_feed_balanceflow(j2,kli_rum,kforage) =e= + sum((ct,cell(i2,j2)),fm_feed_balanceflow(ct,i2,kli_rum,kforage) + /(im_feed_baskets(ct,i2,kli_rum,kforage)*vm_prod_reg(i2,kli_rum) + 10**(-6))) ; *' Note that $10^{-6}$ is required to avoid division by zero. diff --git a/modules/71_disagg_lvst/foragebased_aug18/nl_fix.gms b/modules/71_disagg_lvst/foragebased_aug18/nl_fix.gms index d0f05d5b7c..3e88e2581d 100644 --- a/modules/71_disagg_lvst/foragebased_aug18/nl_fix.gms +++ b/modules/71_disagg_lvst/foragebased_aug18/nl_fix.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/71_disagg_lvst/foragebased_aug18/nl_release.gms b/modules/71_disagg_lvst/foragebased_aug18/nl_release.gms index 993efd071a..cbad58b03d 100644 --- a/modules/71_disagg_lvst/foragebased_aug18/nl_release.gms +++ b/modules/71_disagg_lvst/foragebased_aug18/nl_release.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/71_disagg_lvst/foragebased_aug18/postsolve.gms b/modules/71_disagg_lvst/foragebased_aug18/postsolve.gms index 22a176c320..9c2b6507f3 100644 --- a/modules/71_disagg_lvst/foragebased_aug18/postsolve.gms +++ b/modules/71_disagg_lvst/foragebased_aug18/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/71_disagg_lvst/foragebased_aug18/preloop.gms b/modules/71_disagg_lvst/foragebased_aug18/preloop.gms index b047238c07..e7235b9da5 100644 --- a/modules/71_disagg_lvst/foragebased_aug18/preloop.gms +++ b/modules/71_disagg_lvst/foragebased_aug18/preloop.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,7 +7,7 @@ i71_urban_area_share(j) = pm_land_start(j,"urban")/sum(cell(i,j),sum(cell2(i,j3),pm_land_start(j3,"urban"))) - ; + ; s71_lp_fix = 0; s71_scale_mon = 1.10; diff --git a/modules/71_disagg_lvst/foragebased_aug18/realization.gms b/modules/71_disagg_lvst/foragebased_aug18/realization.gms index a209fba9b1..dfea6fd299 100644 --- a/modules/71_disagg_lvst/foragebased_aug18/realization.gms +++ b/modules/71_disagg_lvst/foragebased_aug18/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/71_disagg_lvst/foragebased_aug18/scaling.gms b/modules/71_disagg_lvst/foragebased_aug18/scaling.gms index 6ba29189f6..b4939dbc37 100644 --- a/modules/71_disagg_lvst/foragebased_aug18/scaling.gms +++ b/modules/71_disagg_lvst/foragebased_aug18/scaling.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,3 +6,5 @@ *** | Contact: magpie@pik-potsdam.de vm_costs_additional_mon.scale(i) = 10e4; +*Don't scale this variable. Model is very sensitive to scaling this variable and might become infeasible or very slow. +*v71_feed_balanceflow.scale(j,kli_rum,kforage) = 10e3; diff --git a/modules/71_disagg_lvst/foragebased_aug18/sets.gms b/modules/71_disagg_lvst/foragebased_aug18/sets.gms index 3aafa13aac..60573b6015 100644 --- a/modules/71_disagg_lvst/foragebased_aug18/sets.gms +++ b/modules/71_disagg_lvst/foragebased_aug18/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -18,7 +18,7 @@ sets kforage(k) Forage feed categories / - pasture, foddr + pasture, foddr / ; diff --git a/modules/71_disagg_lvst/module.gms b/modules/71_disagg_lvst/module.gms index b30e09ca5b..388e97797d 100644 --- a/modules/71_disagg_lvst/module.gms +++ b/modules/71_disagg_lvst/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/71_disagg_lvst/off/declarations.gms b/modules/71_disagg_lvst/off/declarations.gms index 42b3d214b5..36a9ac4131 100644 --- a/modules/71_disagg_lvst/off/declarations.gms +++ b/modules/71_disagg_lvst/off/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/71_disagg_lvst/off/not_used.txt b/modules/71_disagg_lvst/off/not_used.txt index 47389c1abd..79577f6d78 100644 --- a/modules/71_disagg_lvst/off/not_used.txt +++ b/modules/71_disagg_lvst/off/not_used.txt @@ -1,10 +1,3 @@ -# | (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 im_feed_baskets,input,questionnaire fm_feed_balanceflow,input,questionnaire diff --git a/modules/71_disagg_lvst/off/postsolve.gms b/modules/71_disagg_lvst/off/postsolve.gms index 08d55db6e9..55b88c347d 100644 --- a/modules/71_disagg_lvst/off/postsolve.gms +++ b/modules/71_disagg_lvst/off/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/71_disagg_lvst/off/presolve.gms b/modules/71_disagg_lvst/off/presolve.gms index 29409103ea..1724f1af5f 100644 --- a/modules/71_disagg_lvst/off/presolve.gms +++ b/modules/71_disagg_lvst/off/presolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/71_disagg_lvst/off/realization.gms b/modules/71_disagg_lvst/off/realization.gms index 9f1ecd1ffc..4494ad794a 100644 --- a/modules/71_disagg_lvst/off/realization.gms +++ b/modules/71_disagg_lvst/off/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/73_timber/default/declarations.gms b/modules/73_timber/default/declarations.gms index 2ff8b70315..ae6352f39f 100644 --- a/modules/73_timber/default/declarations.gms +++ b/modules/73_timber/default/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -10,20 +10,25 @@ p73_timber_demand_gdp_pop(t_all,i,kforestry) Timb p73_forestry_demand_prod_specific(t_all,iso,total_wood_products) End product specific timber demand (mio. m3 per yr) pm_demand_forestry_future(i,kforestry) Future forestry demand in current time step (tDM per yr) pm_demand_ext(t_ext,i,kforestry) Extended demand for timber beyound simulation (mio. tDM per yr) -p73_demand_calib(t_all,i,kforestry) Additive calibration factor for timber demand +p73_demand_calib(t_all,i,kforestry) Additive calibration for timber demand (mio. m3 per yr) +p73_glo_wood(t_all,kforestry) Global wood demand (mio. tDM per yr) +p73_demand_modifier(t_all) Simple demand modifier for construction wood (mio. tDM per yr) +p73_fraction(t_all) Fraction over which construction wood demand is spread out (1) +p73_demand_constr_wood(t_all,i) Demand for construction wood (mio. tDM per yr) +p73_fraction_sm_fix Modifier fraction at sm_fix_SSP2 time step (1) ; positive variables -vm_cost_timber(i) Actual cost of harvesting timber from forests (mio. USD per yr) +vm_cost_timber(i) Actual cost of harvesting timber from forests (mio. USD per yr) v73_prod_heaven_timber(j,kforestry) Production of woody biomass from heaven (mio. tDM per yr) -v73_prod_residues(j) Production of residues from industrial roundwood harvest(mio. tDM per yr) +v73_prod_residues(j) Production of residues from industrial roundwood harvest (mio. tDM per yr) ; equations -q73_cost_timber(i) Actual cost of harvesting timber from forests (mio. USD per yr) +q73_cost_timber(i) Actual cost of harvesting timber from forests (mio. USD per yr) q73_prod_wood(j) Production of industrial roundwood (mio. tDM per yr) q73_prod_woodfuel(j) Production of wood fuel (mio. tDM per yr) -q73_prod_residues(j) Production of residues from industrial roundwood harvest(mio. tDM per yr) +q73_prod_residues(j) Production of residues from industrial roundwood harvest (mio. tDM per yr) ; @@ -31,10 +36,10 @@ q73_prod_residues(j) Prod parameters ov_cost_timber(t,i,type) Actual cost of harvesting timber from forests (mio. USD per yr) ov73_prod_heaven_timber(t,j,kforestry,type) Production of woody biomass from heaven (mio. tDM per yr) - ov73_prod_residues(t,j,type) Production of residues from industrial roundwood harvest(mio. tDM per yr) + ov73_prod_residues(t,j,type) Production of residues from industrial roundwood harvest (mio. tDM per yr) oq73_cost_timber(t,i,type) Actual cost of harvesting timber from forests (mio. USD per yr) oq73_prod_wood(t,j,type) Production of industrial roundwood (mio. tDM per yr) oq73_prod_woodfuel(t,j,type) Production of wood fuel (mio. tDM per yr) - oq73_prod_residues(t,j,type) Production of residues from industrial roundwood harvest(mio. tDM per yr) + oq73_prod_residues(t,j,type) Production of residues from industrial roundwood harvest (mio. tDM per yr) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/73_timber/default/equations.gms b/modules/73_timber/default/equations.gms index f2e3f3a857..06a0a86b36 100644 --- a/modules/73_timber/default/equations.gms +++ b/modules/73_timber/default/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/73_timber/default/input.gms b/modules/73_timber/default/input.gms index c71ac51109..254d4a3aa2 100644 --- a/modules/73_timber/default/input.gms +++ b/modules/73_timber/default/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -8,6 +8,8 @@ $setglobal c73_wood_scen default * options default, construction +$setglobal c73_build_demand BAU +* options BAU, 10pc, 50pc, 90pc scalars * 60 EUR/m3 = 72 USD/m3 @@ -16,12 +18,13 @@ scalars s73_timber_prod_cost_wood Cost for producing one unit of wood (USD per tDM) / 120 / s73_timber_prod_cost_woodfuel Cost for prodcing one unit of woodfuel (USD per tDM) / 60 / s73_free_prod_cost Very high cost for using non existing land for plantation establishment (USD per tDM) /1000000/ - s73_timber_demand_switch Logical switch to turn on or off timber demand 1=on 0=off (1) / 0 / + s73_timber_demand_switch Logical switch to turn on or off timber demand 1=on 0=off (1) / 0 / s73_foresight Boolean switch for establishment demand assumption 1=forward looking 0=myopic (1) / 0 / s73_increase_ceiling Limiter for not allowing a demand jump between time steps beyond a certain limit (1) /1.025/ s73_residue_ratio Proportion of overall industrial roundwood production which ends up as residue during harvest (1) / 0.15/ - sm_wood_density Representative wood density based on IPCC in (tDM per m3) /0.6/ + sm_wood_density Representative wood density based on IPCC (tDM per m3) /0.6/ s73_reisdue_removal_cost Cost of removing residues left after industrial roundwood harvest (USD per tDM) / 2 / + s73_expansion Construction wood demand expansion factor by end of century based on industrial roundwood demand as base (1=100 percent increase) / 0 / ; ** Residue numbers from @@ -61,3 +64,9 @@ $ondelim $include "./modules/73_timber/input/f73_regional_timber_demand.csv" $offdelim ; + +table f73_construction_wood_demand(t_all,i,pop_gdp_scen09,build_scen) Construction wood demand (mio. tDM) +$ondelim +$include "./modules/73_timber/input/f73_construction_wood_demand.cs3" +$offdelim +; diff --git a/modules/73_timber/default/not_used.txt b/modules/73_timber/default/not_used.txt deleted file mode 100644 index da77c77f60..0000000000 --- a/modules/73_timber/default/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/73_timber/default/postsolve.gms b/modules/73_timber/default/postsolve.gms index ca0b0324ea..460db7e6d7 100644 --- a/modules/73_timber/default/postsolve.gms +++ b/modules/73_timber/default/postsolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/73_timber/default/preloop.gms b/modules/73_timber/default/preloop.gms index 614b99723a..4437e845c6 100644 --- a/modules/73_timber/default/preloop.gms +++ b/modules/73_timber/default/preloop.gms @@ -1,10 +1,13 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 +** Plausible cost for balance variable in case of s73_timber_demand_switch = 0 to avoid distortion of cost +s73_free_prod_cost$(s73_timber_demand_switch = 0) = s73_timber_prod_cost_wood; + ** Set historical values to FAO values p73_forestry_demand_prod_specific(t_past_forestry,iso,total_wood_products) = f73_prod_specific_timber(t_past_forestry,iso,total_wood_products); @@ -37,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%"); @@ -47,6 +50,43 @@ $endif ** p73_timber_demand_gdp_pop is in mio m^3 ** pm_demand_ext in mio ton DM ** Hold constraint beyond 2150 - First every time step gets 2150 values +**** Extend for Churkina et al 2020 demand scenarios pm_demand_ext(t_ext,i,kforestry) = round(p73_timber_demand_gdp_pop("y2150",i,kforestry) * f73_volumetric_conversion(kforestry),3); ** overwrite timesteps below 2150 with actual values pm_demand_ext(t_all,i,kforestry) = round(p73_timber_demand_gdp_pop(t_all,i,kforestry) * f73_volumetric_conversion(kforestry),3); + +** Initialize fraction +p73_fraction(t_all) = s73_expansion/(m_year("y2100") - sm_fix_SSP2); + +** Populate the fraction for each time step +loop(t_all$(m_year(t_all)>=sm_fix_SSP2), + p73_fraction(t_all) = s73_expansion/(m_year("y2100") - sm_fix_SSP2) * m_yeardiff(t_all) + p73_fraction(t_all-1); + ); + +** Remove equally the values from sm_fix_SSP2 (we want the construction wood demand to only start after sm_fix_SSP2) +loop(t_all$(m_year(t_all)=sm_fix_SSP2), + p73_fraction_sm_fix = p73_fraction(t_all); + ); +p73_fraction(t_all) = p73_fraction(t_all) - p73_fraction_sm_fix; +** Set negative values to 0 +p73_fraction(t_all)$(p73_fraction(t_all)<0) = 0; +** Set values after 2100 to values from 2100 +p73_fraction(t_all)$(m_year(t_all)>2100) = p73_fraction("y2100"); + +** In case using demand from Churkina et al. 2020 +if(s73_expansion = 0, + p73_demand_constr_wood(t_all,i) = f73_construction_wood_demand(t_all,i,"%c09_pop_scenario%","%c73_build_demand%"); + p73_demand_constr_wood(t_all,i)$(m_year(t_all)<=sm_fix_SSP2) = f73_construction_wood_demand("y2025",i,"%c09_pop_scenario%","BAU"); + ); + +** In case using simple assumption for construction wood demand (based on industrial_roundwood demand) +if(s73_expansion > 0, + p73_demand_constr_wood(t_all,i) = pm_demand_ext(t_all,i,"wood") * p73_fraction(t_all); + ); + +** Adjust industrial roundwood demand (construction wood demand is added on top) +pm_demand_ext(t_all,i,"wood") = pm_demand_ext(t_all,i,"wood") + p73_demand_constr_wood(t_all,i); +** Keep demand after 2100 constant +pm_demand_ext(t_all,i,kforestry)$(m_year(t_all)>2100) = pm_demand_ext("y2100",i,kforestry); +** Calculate global demand +p73_glo_wood(t_all,kforestry) = sum(i,pm_demand_ext(t_all,i,kforestry)); diff --git a/modules/73_timber/default/presolve.gms b/modules/73_timber/default/presolve.gms index ade25b0ae9..0d48f6f028 100644 --- a/modules/73_timber/default/presolve.gms +++ b/modules/73_timber/default/presolve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -16,6 +16,6 @@ else if(s73_foresight=1, pm_demand_forestry_future(i,kforestry) = sum(t_ext$(t_ext.pos = t.pos + pm_representative_rotation(t,i)),pm_demand_ext(t_ext,i,kforestry)); else - pm_demand_forestry_future(i,kforestry) = pm_demand_ext(t,i,kforestry); + pm_demand_forestry_future(i,kforestry) = pm_demand_ext(t,i,kforestry); ); ); diff --git a/modules/73_timber/default/realization.gms b/modules/73_timber/default/realization.gms index 05ff89b0da..15fa94b41d 100644 --- a/modules/73_timber/default/realization.gms +++ b/modules/73_timber/default/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -11,10 +11,9 @@ *' available plantations to meet a portion of overall timber demand. Rest of the timber *' production comes by harvesting natural vegetation. Aggregated timber demand for *' wood and woodfuel is calculated based on demand equation from @lauri_timber_demand -*' and income elasticities from @morland2018supply. The timber demand calculated is further -*' adjusted between the solve steps where if the model sees no way of producing timber -*' from existing resources, the demand is lowered down to an extent that an adjusted level -*' of demand can be met with resources at hand. +*' and income elasticities from @morland2018supply. This realization can also account for +*' construction wood demand based on @churkina2020buildings which is added on top of +*' industrial roundwood demand. *' @limitations Timber demand cannot be determined endogenously diff --git a/modules/73_timber/default/scaling.gms b/modules/73_timber/default/scaling.gms index 33c17d4c72..ec3e8d2cac 100644 --- a/modules/73_timber/default/scaling.gms +++ b/modules/73_timber/default/scaling.gms @@ -1,9 +1,9 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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_timber.scale(i) = 10e5; +vm_cost_timber.scale(i)$(s73_timber_demand_switch = 1) = 10e4; v73_prod_heaven_timber.scale(j,kforestry) = 10e-3; diff --git a/modules/73_timber/default/sets.gms b/modules/73_timber/default/sets.gms index e51cf771dd..bf07c22198 100644 --- a/modules/73_timber/default/sets.gms +++ b/modules/73_timber/default/sets.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -45,5 +45,10 @@ scen_73 Forestry future scenario nopaper, construction / +build_scen Building wood scenario +/ +BAU, 10pc, 50pc, 90pc +/ + ; *** EOF sets.gms *** diff --git a/modules/73_timber/input/files b/modules/73_timber/input/files index e5ad6177af..5be5323d64 100644 --- a/modules/73_timber/input/files +++ b/modules/73_timber/input/files @@ -4,3 +4,4 @@ f73_income_elasticity.csv f73_volumetric_conversion.csv f73_demand_modifier.csv f73_regional_timber_demand.csv +f73_construction_wood_demand.cs3 diff --git a/modules/73_timber/module.gms b/modules/73_timber/module.gms index f4780e0419..87fe568c32 100644 --- a/modules/73_timber/module.gms +++ b/modules/73_timber/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/80_optimization/lp_nlp_apr17/declarations.gms b/modules/80_optimization/lp_nlp_apr17/declarations.gms index f799984956..eca6e5ec3c 100644 --- a/modules/80_optimization/lp_nlp_apr17/declarations.gms +++ b/modules/80_optimization/lp_nlp_apr17/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,8 +6,8 @@ *** | Contact: magpie@pik-potsdam.de parameters - p80_modelstat(t) modelstat indicator (1) - p80_num_nonopt(t) numNOpt indicator (1) + p80_modelstat(t) modelstat indicator (1) + p80_num_nonopt(t) numNOpt indicator (1) ; scalars diff --git a/modules/80_optimization/lp_nlp_apr17/input.gms b/modules/80_optimization/lp_nlp_apr17/input.gms index 85650820f7..cd8b1abe23 100644 --- a/modules/80_optimization/lp_nlp_apr17/input.gms +++ b/modules/80_optimization/lp_nlp_apr17/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -7,10 +7,10 @@ scalars s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 30 / - s80_optfile switch to use specfied solver settings (1) / 0 / - s80_add_cplex add cplex optimization after conopt4 (1) / 0 / + s80_optfile switch to use specfied solver settings (1) / 1 / + s80_add_cplex add cplex optimization after conopt4 (1) / 0 / s80_add_conopt3 add conopt3 optimization after conopt4 (1) / 0 / - s80_num_nonopt_allowed number of allowed non-optimal variables (1) / Inf / + s80_num_nonopt_allowed number of allowed non-optimal variables (1) / Inf / ; diff --git a/modules/80_optimization/lp_nlp_apr17/realization.gms b/modules/80_optimization/lp_nlp_apr17/realization.gms index 5226e2fd12..0b0008e1c4 100644 --- a/modules/80_optimization/lp_nlp_apr17/realization.gms +++ b/modules/80_optimization/lp_nlp_apr17/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/80_optimization/lp_nlp_apr17/solve.gms b/modules/80_optimization/lp_nlp_apr17/solve.gms index 1fdeac0b6d..e01c6323d2 100644 --- a/modules/80_optimization/lp_nlp_apr17/solve.gms +++ b/modules/80_optimization/lp_nlp_apr17/solve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -37,7 +37,7 @@ $endif $onecho > conopt4.opt Tol_Obj_Change = 3.0e-6 -Tol_Feas_Min = 4.0e-7 +Tol_Feas_Min = 4.0e-10 Tol_Feas_Max = 4.0e-6 Tol_Feas_Tria = 4.0e-6 $offecho @@ -142,7 +142,7 @@ $batinclude "./modules/include.gms" nl_relax * if solve stopped with an error, try it again without pre-processing if((magpie.modelstat = 13), display "WARNING: Modelstat 13 | retry without Conopt4 pre-processing"; - magpie.optfile = 2 + magpie.optfile = 2 solve magpie USING nlp MINIMIZING vm_cost_glo; magpie.optfile = s80_optfile ; ); diff --git a/modules/80_optimization/module.gms b/modules/80_optimization/module.gms index a1ba9375e4..cff00726b0 100644 --- a/modules/80_optimization/module.gms +++ b/modules/80_optimization/module.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/80_optimization/nlp_apr17/declarations.gms b/modules/80_optimization/nlp_apr17/declarations.gms index 0c49c4d578..6ee52314f8 100644 --- a/modules/80_optimization/nlp_apr17/declarations.gms +++ b/modules/80_optimization/nlp_apr17/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,10 +6,12 @@ *** | Contact: magpie@pik-potsdam.de parameters - p80_modelstat(t) modelstat indicator (1) - p80_num_nonopt(t) numNOpt indicator (1) + p80_modelstat(t) modelstat indicator (1) + p80_num_nonopt(t) numNOpt indicator (1) ; scalars - s80_counter counter (1) + s80_counter counter (1) + s80_modelstat_previter modelstat of previous iteration (1) + s80_optfile_previter optfile used in previous iteration (1) ; diff --git a/modules/80_optimization/nlp_apr17/input.gms b/modules/80_optimization/nlp_apr17/input.gms index 1a05140cf0..491db45626 100644 --- a/modules/80_optimization/nlp_apr17/input.gms +++ b/modules/80_optimization/nlp_apr17/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,9 +6,9 @@ *** | Contact: magpie@pik-potsdam.de scalars - s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 30 / - s80_optfile switch to use specfied solver settings (1) / 0 / - s80_num_nonopt_allowed number of allowed non-optimal variables (1) / Inf / + s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 30 / + s80_optfile switch to use specfied solver settings (1) / 1 / + s80_num_nonopt_allowed number of allowed non-optimal variables (1) / Inf / ; $setglobal c80_nlp_solver conopt4 diff --git a/modules/80_optimization/nlp_apr17/not_used.txt b/modules/80_optimization/nlp_apr17/not_used.txt index 1b0a635e7b..ea605f3b35 100644 --- a/modules/80_optimization/nlp_apr17/not_used.txt +++ b/modules/80_optimization/nlp_apr17/not_used.txt @@ -1,8 +1,2 @@ -# | (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_landdiff,input,questionnaire diff --git a/modules/80_optimization/nlp_apr17/realization.gms b/modules/80_optimization/nlp_apr17/realization.gms index a3bc416cc0..e45364d549 100644 --- a/modules/80_optimization/nlp_apr17/realization.gms +++ b/modules/80_optimization/nlp_apr17/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/80_optimization/nlp_apr17/solve.gms b/modules/80_optimization/nlp_apr17/solve.gms index 9acfe807dc..6e28d017f8 100644 --- a/modules/80_optimization/nlp_apr17/solve.gms +++ b/modules/80_optimization/nlp_apr17/solve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -15,18 +15,19 @@ $else $endif s80_counter = 0; -p80_modelstat(t) = 1; +p80_modelstat(t) = 14; +s80_modelstat_previter = 14; +s80_optfile_previter = s80_optfile; *** solver settings - -magpie.optfile = s80_optfile ; +magpie.optfile = s80_optfile; magpie.scaleopt = 1 ; magpie.solprint = 0 ; magpie.holdfixed = 1 ; $onecho > conopt4.opt Tol_Obj_Change = 3.0e-6 -Tol_Feas_Min = 4.0e-7 +Tol_Feas_Min = 4.0e-10 Tol_Feas_Max = 4.0e-6 Tol_Feas_Tria = 4.0e-6 $offecho @@ -35,48 +36,58 @@ $onecho > conopt4.op2 Flg_Prep = FALSE $offecho -repeat( - s80_counter = s80_counter + 1 ; - *' @code - solve magpie USING nlp MINIMIZING vm_cost_glo; +solve magpie USING nlp MINIMIZING vm_cost_glo; *' @stop -* if solve stopped with an error, try it again without pre-processing - if((magpie.modelstat = 13), - display "WARNING: Modelstat 13 | retry without Conopt4 pre-processing"; - magpie.optfile = 2 - solve magpie USING nlp MINIMIZING vm_cost_glo; - magpie.optfile = s80_optfile ; - ); - -* if solve stopped again with an error, try it again with conopt3 - if((magpie.modelstat = 13), - display "WARNING: Modelstat 13 | retry with CONOPT3!"; +display "vm_cost_glo.l"; +display vm_cost_glo.l; +display magpie.modelstat; + +* in case of problems try different solvers and optfile settings +if(magpie.modelstat > 2 OR magpie.numNOpt > s80_num_nonopt_allowed, + repeat( + s80_counter = s80_counter + 1 ; + + if(magpie.modelstat ne s80_modelstat_previter, + display "Modelstat > 2 | Retry solve with CONOPT4 default setting"; + solve magpie USING nlp MINIMIZING vm_cost_glo ; + elseif magpie.modelstat = s80_modelstat_previter, + if(magpie.optfile = s80_optfile_previter, + display "Modelstat > 2 | Retry solve without CONOPT4 pre-processing"; + magpie.optfile = 2; + solve magpie USING nlp MINIMIZING vm_cost_glo; + magpie.optfile = s80_optfile; + else + display "Modelstat > 2 | Retry solve with CONOPT3"; option nlp = conopt; solve magpie USING nlp MINIMIZING vm_cost_glo; option nlp = conopt4; + ); ); - p80_modelstat(t) = magpie.modelstat; - p80_num_nonopt(t) = magpie.numNOpt; + s80_modelstat_previter = magpie.modelstat; + s80_optfile_previter = magpie.optfile; display "vm_cost_glo.l"; display vm_cost_glo.l; * write extended run information in list file in the case that the final solution is infeasible - if((s80_counter >= (s80_maxiter-1) and p80_modelstat(t) > 2 and p80_modelstat(t) ne 7), + if((s80_counter >= (s80_maxiter-1) and magpie.modelstat > 2 and magpie.modelstat ne 7), magpie.solprint = 1 ); display s80_counter; + display magpie.modelstat; - until ((p80_modelstat(t) <= 2 and p80_num_nonopt(t) <= s80_num_nonopt_allowed) or s80_counter >= s80_maxiter) + until ((magpie.modelstat <= 2 and magpie.numNOpt <= s80_num_nonopt_allowed) or s80_counter >= s80_maxiter) + ); ); -*' @stop +p80_modelstat(t) = magpie.modelstat; +p80_num_nonopt(t) = magpie.numNOpt; -if ((p80_modelstat(t) < 3), +if ((p80_modelstat(t) <= 2), put_utility 'shell' / 'mv -f magpie_p.gdx magpie_' t.tl:0'.gdx'; ); diff --git a/modules/80_optimization/nlp_par/declarations.gms b/modules/80_optimization/nlp_par/declarations.gms index 60872b14f6..fbf5ded274 100644 --- a/modules/80_optimization/nlp_par/declarations.gms +++ b/modules/80_optimization/nlp_par/declarations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,8 +6,14 @@ *** | Contact: magpie@pik-potsdam.de parameters - p80_num_nonopt(t) numNOpt indicator (1) - p80_modelstat(t,i) modelstat indicator (1) - p80_counter(i) counter (1) - p80_handle(i) parallel mode handle parameter (1) + p80_modelstat(t,h) modelstat indicator (1) + p80_counter(h) counter (1) + p80_handle(h) parallel mode handle parameter (1) +; + +scalars + s80_counter counter (1) + s80_modelstat_previter modelstat of previous iteration (1) + s80_optfile_previter optfile used in previous iteration (1) + s80_resolve indicator for restarting solve (1) ; diff --git a/modules/80_optimization/nlp_par/input.gms b/modules/80_optimization/nlp_par/input.gms index 1a05140cf0..d51ef89aa7 100644 --- a/modules/80_optimization/nlp_par/input.gms +++ b/modules/80_optimization/nlp_par/input.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,11 +6,7 @@ *** | Contact: magpie@pik-potsdam.de scalars - s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 30 / - s80_optfile switch to use specfied solver settings (1) / 0 / - s80_num_nonopt_allowed number of allowed non-optimal variables (1) / Inf / + s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 30 / + s80_optfile switch to use specfied solver settings (1) / 1 / + s80_num_nonopt_allowed number of allowed non-optimal variables (1) / Inf / ; - -$setglobal c80_nlp_solver conopt4 -* options: (conopt3): conopt3 -* (conopt4): conopt4 diff --git a/modules/80_optimization/nlp_par/not_used.txt b/modules/80_optimization/nlp_par/not_used.txt index 1b0a635e7b..ea605f3b35 100644 --- a/modules/80_optimization/nlp_par/not_used.txt +++ b/modules/80_optimization/nlp_par/not_used.txt @@ -1,8 +1,2 @@ -# | (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_landdiff,input,questionnaire diff --git a/modules/80_optimization/nlp_par/realization.gms b/modules/80_optimization/nlp_par/realization.gms index 0e92ecfd2d..251d6d87d3 100644 --- a/modules/80_optimization/nlp_par/realization.gms +++ b/modules/80_optimization/nlp_par/realization.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 2fa741419f..3f1facbac1 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -6,19 +6,13 @@ *** | Contact: magpie@pik-potsdam.de **************start solve loop************** -$ifthen "%c80_nlp_solver%" == "conopt3" - option nlp = conopt ; -$elseif "%c80_nlp_solver%" == "conopt4" - option nlp = conopt4; -$else - abort "c80_nlp_solver setting not supported in nlp_apr17 realization!"; -$endif - -p80_counter(i) = 0; -p80_modelstat(t,i) = 1; +p80_counter(h) = 0; +p80_modelstat(t,h) = 14; *** solver settings +option nlp = conopt4; +magpie.solvelink = 3; magpie.optfile = s80_optfile ; magpie.scaleopt = 1 ; magpie.solprint = 0 ; @@ -26,7 +20,7 @@ magpie.holdfixed = 1 ; $onecho > conopt4.opt Tol_Obj_Change = 3.0e-6 -Tol_Feas_Min = 4.0e-7 +Tol_Feas_Min = 4.0e-10 Tol_Feas_Max = 4.0e-6 Tol_Feas_Tria = 4.0e-6 $offecho @@ -35,71 +29,101 @@ $onecho > conopt4.op2 Flg_Prep = FALSE $offecho -magpie.solvelink = 6; +h2(h) = no; i2(i) = no; j2(j) = no; *submission loop -loop(i, - i2(i) = yes; - j2(j) = yes$cell(i,j); - solve magpie USING nlp MINIMIZING vm_cost_glo ; -* display j2; -* display i2; - i2(i) = no; - j2(j) = no; - p80_handle(i) = magpie.handle; +loop(h, + h2(h) = yes; + i2(i)$supreg(h,i) = yes; + loop(i2, j2(j)$cell(i2,j) = yes); + solve magpie USING nlp MINIMIZING vm_cost_glo ; + h2(h) = no; + i2(i) = no; + j2(j) = no; + p80_handle(h) = magpie.handle; ); *collection loop repeat - loop(i$p80_handle(i), - if(handleStatus(p80_handle(i)) = 2, - magpie.handle = p80_handle(i); - execute_loadhandle magpie; - magpie.modelstat$(magpie.modelstat=NA) = 13; - p80_modelstat(t,i) = magpie.modelstat; - i2(i) = yes; - j2(j) = yes$cell(i,j); - display i2; - display magpie.modelstat; - display$handledelete(p80_handle(i)) 'trouble deleting handles' ; - if (magpie.modelstat <= 2, - p80_handle(i) = 0; - else - if(magpie.modelstat = 13, - display "WARNING: Modelstat 13 | retry without Conopt4 pre-processing"; - magpie.optfile = 2 - solve magpie USING nlp MINIMIZING vm_cost_glo; - magpie.optfile = s80_optfile ; - p80_handle(i) = magpie.handle; - p80_counter(i) = p80_counter(i) + 1; - else - solve magpie USING nlp MINIMIZING vm_cost_glo ; - p80_handle(i) = magpie.handle; - p80_counter(i) = p80_counter(i) + 1; - ); - ); - execerror = 0; - i2(i) = no; - j2(j) = no; -* write extended run information in list file in the case that the final solution is infeasible - if((p80_counter(i) >= (s80_maxiter-1) and p80_modelstat(t,i) > 2 and p80_modelstat(t,i) ne 7), - magpie.solprint = 1 - ); + loop(h$p80_handle(h), + if(handleStatus(p80_handle(h)) = 2, + p80_counter(h) = p80_counter(h) + 1; + s80_resolve = 1; + + magpie.handle = p80_handle(h); + execute_loadhandle magpie; + magpie.modelStat$(magpie.modelStat=NA) = 13; + + s80_modelstat_previter = p80_modelstat(t,h); + p80_modelstat(t,h) = magpie.modelStat; + s80_optfile_previter = magpie.optfile; + magpie.optfile = s80_optfile; + + h2(h) = yes; + i2(i)$supreg(h,i) = yes; + loop(i2, j2(j)$cell(i2,j) = yes); + display h2; + s80_counter = sum(h2,p80_counter(h2)); + display s80_counter; + display magpie.modelStat; + + if((p80_counter(h) >= s80_maxiter AND p80_modelstat(t,h) > 2 AND p80_modelstat(t,h) ne 7), + display "No feasible solution found. Writing LST file."; + option AsyncSolLst=1; + display$handlecollect(p80_handle(h)) 're-collect'; + option AsyncSolLst=0; + s80_resolve = 0; ); - ); - display$readyCollect(p80_handle) 'Problem waiting for next instance to complete'; -until card(p80_handle) = 0 OR smax(i, p80_counter(i)) >= s80_maxiter; -execerror = 0; - -if (smax(i,p80_modelstat(t,i)) > 2 and smax(i,p80_modelstat(t,i)) ne 7, - Execute_Unload "fulldata.gdx"; - abort "no feasible solution found!"; + + display$handledelete(p80_handle(h)) 'trouble deleting handles' ; + + if(p80_modelstat(t,h) <= 2 AND magpie.numNOpt <= s80_num_nonopt_allowed, + display "Model status <= 2. Handle cleared."; + s80_resolve = 0; + p80_handle(h) = 0; + ); + + if(s80_resolve = 1, + display "Resolve" + if(p80_modelstat(t,h) ne s80_modelstat_previter, + display "Modelstat > 2 | Retry solve with CONOPT4 default setting"; + solve magpie USING nlp MINIMIZING vm_cost_glo ; + elseif p80_modelstat(t,h) = s80_modelstat_previter, + if(magpie.optfile = s80_optfile_previter, + display "Modelstat > 2 | Retry solve without CONOPT4 pre-processing"; + magpie.optfile = 2; + solve magpie USING nlp MINIMIZING vm_cost_glo; + else + display "Modelstat > 2 | Retry solve with CONOPT3"; + option nlp = conopt; + solve magpie USING nlp MINIMIZING vm_cost_glo; + option nlp = conopt4; + ); + ); + execerror = 0; + if(magpie.handle = 0, + display "Problem. Handle is zero despite resolve. Setting handle to 1 for continuation."; + magpie.handle = 1; + ); + p80_handle(h) = magpie.handle; + ); + h2(h) = no; + i2(i) = no; + j2(j) = no; + ); + ); + display$readyCollect(p80_handle,INF) 'Problem waiting for next instance to complete'; +until card(p80_handle) = 0 OR smax(h, p80_counter(h)) >= s80_maxiter; + +if (smax(h,p80_modelstat(t,h)) > 2 and smax(h,p80_modelstat(t,h)) ne 7, + Execute_Unload "fulldata.gdx"; + abort "No feasible solution found!"; ); * handleSubmit does not work as expected. Does not restart from saved state. * Therefore, solve statements are used. -* display$handleSubmit(p80_handle(i)) 'trouble resubmitting handles' ; +* display$handleSubmit(p80_handle(h)) 'trouble resubmitting handles' ; ***************end solve loop*************** diff --git a/modules/include.gms b/modules/include.gms index 9696774112..0729ba1b54 100644 --- a/modules/include.gms +++ b/modules/include.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 @@ -21,12 +21,15 @@ $include "./modules/17_production/module.gms" $include "./modules/18_residues/module.gms" $include "./modules/20_processing/module.gms" $include "./modules/21_trade/module.gms" +$include "./modules/22_land_conservation/module.gms" $include "./modules/29_ageclass/module.gms" $include "./modules/30_crop/module.gms" $include "./modules/31_past/module.gms" $include "./modules/32_forestry/module.gms" $include "./modules/34_urban/module.gms" $include "./modules/35_natveg/module.gms" +$include "./modules/36_employment/module.gms" +$include "./modules/37_labor_prod/module.gms" $include "./modules/38_factor_costs/module.gms" $include "./modules/39_landconversion/module.gms" $include "./modules/40_transport/module.gms" diff --git a/output.R b/output.R index 0b74980625..32c737b2db 100644 --- a/output.R +++ b/output.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -9,32 +9,38 @@ #### MAgPIE output generation #### ########################################################## +if (!is.null(renv::project()) && !exists("source_include") && Sys.getenv("SLURM_JOB_ID") == "") { + ask <- function(question) { + message(question, appendLF = FALSE) + return(tolower(gms::getLine()) %in% c("", "y", "yes")) + } + + message("Checking for updates... ", appendLF = FALSE) + if (getOption("autoRenvUpdates", FALSE) || + (!is.null(piamenv::showUpdates()) && ask("Update now? (Y/n): "))) { + updates <- piamenv::updateRenv() + piamenv::stopIfLoaded(names(updates)) + } + message("Update check done.") + + message("Checking package version requirements... ", appendLF = FALSE) + updates <- piamenv::fixDeps(ask = TRUE) + piamenv::stopIfLoaded(names(updates)) + message("Requirements check done.") +} + library(lucode2) library(gms) runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { - - get_line <- function(){ - # gets characters (line) from the terminal or from a connection - # and returns it - if(interactive()){ - s <- readline() - } else { - con <- file("stdin") - s <- readLines(con, 1, warn=FALSE) - on.exit(close(con)) - } - return(s); - } - choose_folder <- function(title="Please choose a folder") { # try to use find because it is significantly quicker than list.dirs tmp <- try(system("find ./output -name 'full.gms'", intern=TRUE, ignore.stderr = TRUE), silent=TRUE) - if("try-error" %in% class(tmp) | length(tmp)==0) { + if("try-error" %in% class(tmp) || length(tmp)==0) { tmp <- base::list.dirs("./output/",recursive=TRUE) dirs <- NULL - for (i in 1:length(tmp)) { - if (file.exists(path(tmp[i],"full.gms"))) dirs <- c(dirs,sub("./output/","",tmp[i])) + for (i in seq_along(tmp)) { + if (file.exists(file.path(tmp[i],"full.gms"))) dirs <- c(dirs,sub("./output/","",tmp[i])) } } else { dirs <- sub("full.gms","",sub("./output/","",tmp, fixed=TRUE), fixed=TRUE) @@ -42,27 +48,29 @@ runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { dirs <- sort(dirs) dirs <- c("all",dirs) cat("\n",title,":\n", sep="") - cat(paste(1:length(dirs), dirs, sep=": " ),sep="\n") + cat(paste(seq_along(dirs), dirs, sep=": " ),sep="\n") cat(paste(length(dirs)+1, "Search by the pattern.\n", sep=": ")) cat("Number: ") - identifier <- get_line() + identifier <- gms::getLine() identifier <- strsplit(identifier,",")[[1]] tmp <- NULL - for (i in 1:length(identifier)) { - if (length(strsplit(identifier,":")[[i]]) > 1) tmp <- c(tmp,as.numeric(strsplit(identifier,":")[[i]])[1]:as.numeric(strsplit(identifier,":")[[i]])[2]) + for (i in seq_along(identifier)) { + if (length(strsplit(identifier,":")[[i]]) > 1) { + tmp <- c(tmp,as.numeric(strsplit(identifier,":")[[i]])[1]:as.numeric(strsplit(identifier,":")[[i]])[2]) + } else tmp <- c(tmp,as.numeric(identifier[i])) } identifier <- tmp # PATTERN if(length(identifier==1) && identifier==(length(dirs)+1)){ cat("\nInsert the search pattern or the regular expression: ") - pattern <- get_line() + pattern <- gms::getLine() id <- grep(pattern=pattern, dirs[-1], perl=TRUE) # lists all directories matching the pattern and ask for confirmation cat("\n\nYou have chosen the following directories:\n") - cat(paste(1:length(id), dirs[id+1], sep=": "), sep="\n") + cat(paste(seq_along(id), dirs[id+1], sep=": "), sep="\n") cat("\nAre you sure these are the right directories?(y/n): ") - answer <- get_line() + answer <- gms::getLine() if(answer=="y"){ return(paste0("./output/",dirs[id+1])) } else { @@ -78,27 +86,29 @@ runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { choose_submit <- function(title="Please choose run submission type") { slurm <- suppressWarnings(ifelse(system2("srun",stdout=FALSE,stderr=FALSE) != 127, TRUE, FALSE)) - modes <- c("SLURM (default)", "SLURM priority","Direct execution", "Background execution", "Debug mode") + modes <- c("SLURM standby", "SLURM standby maxMem", "SLURM priority", "SLURM priority maxMem","Direct execution", "Background execution", "Debug mode") if(slurm) { cat("\nCurrent cluster utilization:\n") 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") + cat(paste(seq_along(modes), modes, sep=": " ),sep="\n") cat("Number: ") - identifier <- get_line() + identifier <- gms::getLine() identifier <- as.numeric(strsplit(identifier,",")[[1]]) if(slurm) { system("sclass") comp <- switch(identifier, - "1" = "slurm default", - "2" = "slurm priority", - "3" = "direct", - "4" = "background", - "5" = "debug") + "1" = "slurm standby", + "2" = "slurm standby maxMem", + "3" = "slurm priority", + "4" = "slurm priority maxMem", + "5" = "direct", + "6" = "background", + "7" = "debug") } else { comp <- switch(identifier, @@ -111,9 +121,10 @@ 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 + source_include <- TRUE # nolint # run output scripts over all choosen folders for(rout in output){ name <- ifelse(file.exists(paste0(script_path,rout)), rout, paste0(rout,".R")) @@ -125,30 +136,38 @@ runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { header <- read_yaml_header(script) comp <- (!is.null(header[["comparison script"]]) && isTRUE(header[["comparison script"]])) if(comp) { - print("script executed as comparison script") loop <- list(alloutputdirs) } else { - if(length(alloutputdirs)>1) {print("script executed multiple times in parallel")} else {print("script executed as single output script")} - loop <- alloutputdirs - print(loop) - print(str(loop)) + loop <- alloutputdirs } + rout_name <- sub("\\.R$","",sub("/","_",rout)) for(outputdir in loop) { - message(" -> ",name) - print(paste0("starting script for outputdir",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,"\"") + message("\n# ",name, " -> ", outputdir) + 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")," &")) - } else if(submit=="slurm default") { - system(paste(sbatch_command, "--qos=standby")) + 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 --time=24:00:00")) + } else if(submit=="slurm standby maxMem") { + system(paste(sbatch_command, "--qos=standby --time=24:00:00 --mem-per-cpu=0 --cpus-per-task=16")) } else if(submit=="slurm priority") { system(paste(sbatch_command, "--qos=priority")) + } else if(submit=="slurm priority maxMem") { + system(paste(sbatch_command, "--qos=priority --mem-per-cpu=0 --cpus-per-task=16")) } else if(submit=="debug") { tmp.env <- new.env() sys.source(script,envir=tmp.env) @@ -160,10 +179,10 @@ runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { } } - if(is.null(outputdir)) outputdir <- choose_folder("Choose runs") - if(is.null(output)) output <- gms::selectScript("./scripts/output") - if(is.null(submit)) submit <- choose_submit("Choose submission type") - if(is.null(output)) { + if (is.null(outputdir)) outputdir <- choose_folder("Choose runs") + if (is.null(output)) output <- gms::selectScript("./scripts/output") + if (is.null(submit)) submit <- choose_submit("Choose submission type") + if (is.null(output)) { message("No output script selected! Stop here.") return(invisible(NULL)) } @@ -171,7 +190,47 @@ runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { message("No output folder selected! Stop here.") return(invisible(NULL)) } + + # Write a separate lockfile called {datetime}_{outputscript}_renv.lock into outputdir + # unless the renv from outputdir itself was used to run output.R + if (!is.null(renv::project())) { + freshLockfile <- withr::local_tempfile() + + message("Generating lockfile... ", appendLF = FALSE) + utils::capture.output({ + errorMessage <- utils::capture.output({ + snapshotSuccess <- tryCatch({ + renv::snapshot(lockfile = freshLockfile, prompt = FALSE) + TRUE + }, error = function(error) FALSE) + }, type = "message") + }) + if (!snapshotSuccess) { + stop(paste(errorMessage, collapse = "\n")) + } + message("done.") + + datetime <- format(Sys.time(), "%Y-%m-%dT%H%M%S") + scriptName <- gsub("/", "-", paste(sub("\\.R$", "", output), collapse = "--")) + + for (runFolder in setdiff(normalizePath(outputdir), normalizePath(renv::project()))) { + newLockfile <- file.path(runFolder, paste0(datetime, "__", scriptName, "__renv.lock")) + + file.copy(freshLockfile, newLockfile) + + if (!file.exists(file.path(runFolder, "renv.lock"))) { + warning(normalizePath(runFolder), "/renv.lock does not exist.") + message("Lockfile written to ", newLockfile) + } else if (identical(readLines(file.path(runFolder, "renv.lock")), readLines(newLockfile))) { + file.remove(newLockfile) + } else { + message("Lockfile written to ", newLockfile) + } + } + } + runsubmit(output, alloutputdirs = outputdir, submit, "scripts/output/") + message("") } if(!exists("source_include")) { diff --git a/renv/.gitignore b/renv/.gitignore new file mode 100644 index 0000000000..7b56d7001f --- /dev/null +++ b/renv/.gitignore @@ -0,0 +1,8 @@ +library/ +local/ +cellar/ +lock/ +python/ +sandbox/ +staging/ +archive/ diff --git a/renv/activate.R b/renv/activate.R new file mode 100644 index 0000000000..019b5a6693 --- /dev/null +++ b/renv/activate.R @@ -0,0 +1,994 @@ + +local({ + + # the requested version of renv + version <- "0.16.0" + + # the project directory + project <- getwd() + + # figure out whether the autoloader is enabled + enabled <- local({ + + # first, check config option + override <- getOption("renv.config.autoloader.enabled") + if (!is.null(override)) + return(override) + + # next, check environment variables + # TODO: prefer using the configuration one in the future + envvars <- c( + "RENV_CONFIG_AUTOLOADER_ENABLED", + "RENV_AUTOLOADER_ENABLED", + "RENV_ACTIVATE_PROJECT" + ) + + for (envvar in envvars) { + envval <- Sys.getenv(envvar, unset = NA) + if (!is.na(envval)) + return(tolower(envval) %in% c("true", "t", "1")) + } + + # enable by default + TRUE + + }) + + if (!enabled) + return(FALSE) + + # avoid recursion + if (identical(getOption("renv.autoloader.running"), TRUE)) { + warning("ignoring recursive attempt to run renv autoloader") + return(invisible(TRUE)) + } + + # signal that we're loading renv during R startup + options(renv.autoloader.running = TRUE) + on.exit(options(renv.autoloader.running = NULL), add = TRUE) + + # signal that we've consented to use renv + options(renv.consent = TRUE) + + # load the 'utils' package eagerly -- this ensures that renv shims, which + # mask 'utils' packages, will come first on the search path + library(utils, lib.loc = .Library) + + # unload renv if it's already been loaded + if ("renv" %in% loadedNamespaces()) + unloadNamespace("renv") + + # load bootstrap tools + `%||%` <- function(x, y) { + if (is.environment(x) || length(x)) x else y + } + + bootstrap <- function(version, library) { + + # attempt to download renv + tarball <- tryCatch(renv_bootstrap_download(version), error = identity) + if (inherits(tarball, "error")) + stop("failed to download renv ", version) + + # now attempt to install + status <- tryCatch(renv_bootstrap_install(version, tarball, library), error = identity) + if (inherits(status, "error")) + stop("failed to install renv ", version) + + } + + renv_bootstrap_tests_running <- function() { + getOption("renv.tests.running", default = FALSE) + } + + renv_bootstrap_repos <- function() { + + # check for repos override + repos <- Sys.getenv("RENV_CONFIG_REPOS_OVERRIDE", unset = NA) + if (!is.na(repos)) + return(repos) + + # check for lockfile repositories + repos <- tryCatch(renv_bootstrap_repos_lockfile(), error = identity) + if (!inherits(repos, "error") && length(repos)) + return(repos) + + # if we're testing, re-use the test repositories + if (renv_bootstrap_tests_running()) + return(getOption("renv.tests.repos")) + + # retrieve current repos + repos <- getOption("repos") + + # ensure @CRAN@ entries are resolved + repos[repos == "@CRAN@"] <- getOption( + "renv.repos.cran", + "https://cloud.r-project.org" + ) + + # add in renv.bootstrap.repos if set + default <- c(FALLBACK = "https://cloud.r-project.org") + extra <- getOption("renv.bootstrap.repos", default = default) + repos <- c(repos, extra) + + # remove duplicates that might've snuck in + dupes <- duplicated(repos) | duplicated(names(repos)) + repos[!dupes] + + } + + renv_bootstrap_repos_lockfile <- function() { + + lockpath <- Sys.getenv("RENV_PATHS_LOCKFILE", unset = "renv.lock") + if (!file.exists(lockpath)) + return(NULL) + + lockfile <- tryCatch(renv_json_read(lockpath), error = identity) + if (inherits(lockfile, "error")) { + warning(lockfile) + return(NULL) + } + + repos <- lockfile$R$Repositories + if (length(repos) == 0) + return(NULL) + + keys <- vapply(repos, `[[`, "Name", FUN.VALUE = character(1)) + vals <- vapply(repos, `[[`, "URL", FUN.VALUE = character(1)) + names(vals) <- keys + + return(vals) + + } + + renv_bootstrap_download <- function(version) { + + # if the renv version number has 4 components, assume it must + # be retrieved via github + nv <- numeric_version(version) + components <- unclass(nv)[[1]] + + # if this appears to be a development version of 'renv', we'll + # try to restore from github + dev <- length(components) == 4L + + # begin collecting different methods for finding renv + methods <- c( + renv_bootstrap_download_tarball, + if (dev) + renv_bootstrap_download_github + else c( + renv_bootstrap_download_cran_latest, + renv_bootstrap_download_cran_archive + ) + ) + + for (method in methods) { + path <- tryCatch(method(version), error = identity) + if (is.character(path) && file.exists(path)) + return(path) + } + + stop("failed to download renv ", version) + + } + + renv_bootstrap_download_impl <- function(url, destfile) { + + mode <- "wb" + + # https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17715 + fixup <- + Sys.info()[["sysname"]] == "Windows" && + substring(url, 1L, 5L) == "file:" + + if (fixup) + mode <- "w+b" + + args <- list( + url = url, + destfile = destfile, + mode = mode, + quiet = TRUE + ) + + if ("headers" %in% names(formals(utils::download.file))) + args$headers <- renv_bootstrap_download_custom_headers(url) + + do.call(utils::download.file, args) + + } + + renv_bootstrap_download_custom_headers <- function(url) { + + headers <- getOption("renv.download.headers") + if (is.null(headers)) + return(character()) + + if (!is.function(headers)) + stopf("'renv.download.headers' is not a function") + + headers <- headers(url) + if (length(headers) == 0L) + return(character()) + + if (is.list(headers)) + headers <- unlist(headers, recursive = FALSE, use.names = TRUE) + + ok <- + is.character(headers) && + is.character(names(headers)) && + all(nzchar(names(headers))) + + if (!ok) + stop("invocation of 'renv.download.headers' did not return a named character vector") + + headers + + } + + renv_bootstrap_download_cran_latest <- function(version) { + + spec <- renv_bootstrap_download_cran_latest_find(version) + type <- spec$type + repos <- spec$repos + + message("* Downloading renv ", version, " ... ", appendLF = FALSE) + + baseurl <- utils::contrib.url(repos = repos, type = type) + ext <- if (identical(type, "source")) + ".tar.gz" + else if (Sys.info()[["sysname"]] == "Windows") + ".zip" + else + ".tgz" + name <- sprintf("renv_%s%s", version, ext) + url <- paste(baseurl, name, sep = "/") + + destfile <- file.path(tempdir(), name) + status <- tryCatch( + renv_bootstrap_download_impl(url, destfile), + condition = identity + ) + + if (inherits(status, "condition")) { + message("FAILED") + return(FALSE) + } + + # report success and return + message("OK (downloaded ", type, ")") + destfile + + } + + renv_bootstrap_download_cran_latest_find <- function(version) { + + # check whether binaries are supported on this system + binary <- + getOption("renv.bootstrap.binary", default = TRUE) && + !identical(.Platform$pkgType, "source") && + !identical(getOption("pkgType"), "source") && + Sys.info()[["sysname"]] %in% c("Darwin", "Windows") + + types <- c(if (binary) "binary", "source") + + # iterate over types + repositories + for (type in types) { + for (repos in renv_bootstrap_repos()) { + + # retrieve package database + db <- tryCatch( + as.data.frame( + utils::available.packages(type = type, repos = repos), + stringsAsFactors = FALSE + ), + error = identity + ) + + if (inherits(db, "error")) + next + + # check for compatible entry + entry <- db[db$Package %in% "renv" & db$Version %in% version, ] + if (nrow(entry) == 0) + next + + # found it; return spec to caller + spec <- list(entry = entry, type = type, repos = repos) + return(spec) + + } + } + + # if we got here, we failed to find renv + fmt <- "renv %s is not available from your declared package repositories" + stop(sprintf(fmt, version)) + + } + + renv_bootstrap_download_cran_archive <- function(version) { + + name <- sprintf("renv_%s.tar.gz", version) + repos <- renv_bootstrap_repos() + urls <- file.path(repos, "src/contrib/Archive/renv", name) + destfile <- file.path(tempdir(), name) + + message("* Downloading renv ", version, " ... ", appendLF = FALSE) + + for (url in urls) { + + status <- tryCatch( + renv_bootstrap_download_impl(url, destfile), + condition = identity + ) + + if (identical(status, 0L)) { + message("OK") + return(destfile) + } + + } + + message("FAILED") + return(FALSE) + + } + + renv_bootstrap_download_tarball <- function(version) { + + # if the user has provided the path to a tarball via + # an environment variable, then use it + tarball <- Sys.getenv("RENV_BOOTSTRAP_TARBALL", unset = NA) + if (is.na(tarball)) + return() + + # allow directories + info <- file.info(tarball, extra_cols = FALSE) + if (identical(info$isdir, TRUE)) { + name <- sprintf("renv_%s.tar.gz", version) + tarball <- file.path(tarball, name) + } + + # bail if it doesn't exist + if (!file.exists(tarball)) { + + # let the user know we weren't able to honour their request + fmt <- "* RENV_BOOTSTRAP_TARBALL is set (%s) but does not exist." + msg <- sprintf(fmt, tarball) + warning(msg) + + # bail + return() + + } + + fmt <- "* Bootstrapping with tarball at path '%s'." + msg <- sprintf(fmt, tarball) + message(msg) + + tarball + + } + + renv_bootstrap_download_github <- function(version) { + + enabled <- Sys.getenv("RENV_BOOTSTRAP_FROM_GITHUB", unset = "TRUE") + if (!identical(enabled, "TRUE")) + return(FALSE) + + # prepare download options + pat <- Sys.getenv("GITHUB_PAT") + if (nzchar(Sys.which("curl")) && nzchar(pat)) { + fmt <- "--location --fail --header \"Authorization: token %s\"" + extra <- sprintf(fmt, pat) + saved <- options("download.file.method", "download.file.extra") + options(download.file.method = "curl", download.file.extra = extra) + on.exit(do.call(base::options, saved), add = TRUE) + } else if (nzchar(Sys.which("wget")) && nzchar(pat)) { + fmt <- "--header=\"Authorization: token %s\"" + extra <- sprintf(fmt, pat) + saved <- options("download.file.method", "download.file.extra") + options(download.file.method = "wget", download.file.extra = extra) + on.exit(do.call(base::options, saved), add = TRUE) + } + + message("* Downloading renv ", version, " from GitHub ... ", appendLF = FALSE) + + url <- file.path("https://api.github.com/repos/rstudio/renv/tarball", version) + name <- sprintf("renv_%s.tar.gz", version) + destfile <- file.path(tempdir(), name) + + status <- tryCatch( + renv_bootstrap_download_impl(url, destfile), + condition = identity + ) + + if (!identical(status, 0L)) { + message("FAILED") + return(FALSE) + } + + message("OK") + return(destfile) + + } + + renv_bootstrap_install <- function(version, tarball, library) { + + # attempt to install it into project library + message("* Installing renv ", version, " ... ", appendLF = FALSE) + dir.create(library, showWarnings = FALSE, recursive = TRUE) + + # invoke using system2 so we can capture and report output + bin <- R.home("bin") + exe <- if (Sys.info()[["sysname"]] == "Windows") "R.exe" else "R" + r <- file.path(bin, exe) + + args <- c( + "--vanilla", "CMD", "INSTALL", "--no-multiarch", + "-l", shQuote(path.expand(library)), + shQuote(path.expand(tarball)) + ) + + output <- system2(r, args, stdout = TRUE, stderr = TRUE) + message("Done!") + + # check for successful install + status <- attr(output, "status") + if (is.numeric(status) && !identical(status, 0L)) { + header <- "Error installing renv:" + lines <- paste(rep.int("=", nchar(header)), collapse = "") + text <- c(header, lines, output) + writeLines(text, con = stderr()) + } + + status + + } + + renv_bootstrap_platform_prefix <- function() { + + # construct version prefix + version <- paste(R.version$major, R.version$minor, sep = ".") + prefix <- paste("R", numeric_version(version)[1, 1:2], sep = "-") + + # include SVN revision for development versions of R + # (to avoid sharing platform-specific artefacts with released versions of R) + devel <- + identical(R.version[["status"]], "Under development (unstable)") || + identical(R.version[["nickname"]], "Unsuffered Consequences") + + if (devel) + prefix <- paste(prefix, R.version[["svn rev"]], sep = "-r") + + # build list of path components + components <- c(prefix, R.version$platform) + + # include prefix if provided by user + prefix <- renv_bootstrap_platform_prefix_impl() + if (!is.na(prefix) && nzchar(prefix)) + components <- c(prefix, components) + + # build prefix + paste(components, collapse = "/") + + } + + renv_bootstrap_platform_prefix_impl <- function() { + + # if an explicit prefix has been supplied, use it + prefix <- Sys.getenv("RENV_PATHS_PREFIX", unset = NA) + if (!is.na(prefix)) + return(prefix) + + # if the user has requested an automatic prefix, generate it + auto <- Sys.getenv("RENV_PATHS_PREFIX_AUTO", unset = NA) + if (auto %in% c("TRUE", "True", "true", "1")) + return(renv_bootstrap_platform_prefix_auto()) + + # empty string on failure + "" + + } + + renv_bootstrap_platform_prefix_auto <- function() { + + prefix <- tryCatch(renv_bootstrap_platform_os(), error = identity) + if (inherits(prefix, "error") || prefix %in% "unknown") { + + msg <- paste( + "failed to infer current operating system", + "please file a bug report at https://github.com/rstudio/renv/issues", + sep = "; " + ) + + warning(msg) + + } + + prefix + + } + + renv_bootstrap_platform_os <- function() { + + sysinfo <- Sys.info() + sysname <- sysinfo[["sysname"]] + + # handle Windows + macOS up front + if (sysname == "Windows") + return("windows") + else if (sysname == "Darwin") + return("macos") + + # check for os-release files + for (file in c("/etc/os-release", "/usr/lib/os-release")) + if (file.exists(file)) + return(renv_bootstrap_platform_os_via_os_release(file, sysinfo)) + + # check for redhat-release files + if (file.exists("/etc/redhat-release")) + return(renv_bootstrap_platform_os_via_redhat_release()) + + "unknown" + + } + + renv_bootstrap_platform_os_via_os_release <- function(file, sysinfo) { + + # read /etc/os-release + release <- utils::read.table( + file = file, + sep = "=", + quote = c("\"", "'"), + col.names = c("Key", "Value"), + comment.char = "#", + stringsAsFactors = FALSE + ) + + vars <- as.list(release$Value) + names(vars) <- release$Key + + # get os name + os <- tolower(sysinfo[["sysname"]]) + + # read id + id <- "unknown" + for (field in c("ID", "ID_LIKE")) { + if (field %in% names(vars) && nzchar(vars[[field]])) { + id <- vars[[field]] + break + } + } + + # read version + version <- "unknown" + for (field in c("UBUNTU_CODENAME", "VERSION_CODENAME", "VERSION_ID", "BUILD_ID")) { + if (field %in% names(vars) && nzchar(vars[[field]])) { + version <- vars[[field]] + break + } + } + + # join together + paste(c(os, id, version), collapse = "-") + + } + + renv_bootstrap_platform_os_via_redhat_release <- function() { + + # read /etc/redhat-release + contents <- readLines("/etc/redhat-release", warn = FALSE) + + # infer id + id <- if (grepl("centos", contents, ignore.case = TRUE)) + "centos" + else if (grepl("redhat", contents, ignore.case = TRUE)) + "redhat" + else + "unknown" + + # try to find a version component (very hacky) + version <- "unknown" + + parts <- strsplit(contents, "[[:space:]]")[[1L]] + for (part in parts) { + + nv <- tryCatch(numeric_version(part), error = identity) + if (inherits(nv, "error")) + next + + version <- nv[1, 1] + break + + } + + paste(c("linux", id, version), collapse = "-") + + } + + renv_bootstrap_library_root_name <- function(project) { + + # use project name as-is if requested + asis <- Sys.getenv("RENV_PATHS_LIBRARY_ROOT_ASIS", unset = "FALSE") + if (asis) + return(basename(project)) + + # otherwise, disambiguate based on project's path + id <- substring(renv_bootstrap_hash_text(project), 1L, 8L) + paste(basename(project), id, sep = "-") + + } + + renv_bootstrap_library_root <- function(project) { + + prefix <- renv_bootstrap_profile_prefix() + + path <- Sys.getenv("RENV_PATHS_LIBRARY", unset = NA) + if (!is.na(path)) + return(paste(c(path, prefix), collapse = "/")) + + path <- renv_bootstrap_library_root_impl(project) + if (!is.null(path)) { + name <- renv_bootstrap_library_root_name(project) + return(paste(c(path, prefix, name), collapse = "/")) + } + + renv_bootstrap_paths_renv("library", project = project) + + } + + renv_bootstrap_library_root_impl <- function(project) { + + root <- Sys.getenv("RENV_PATHS_LIBRARY_ROOT", unset = NA) + if (!is.na(root)) + return(root) + + type <- renv_bootstrap_project_type(project) + if (identical(type, "package")) { + userdir <- renv_bootstrap_user_dir() + return(file.path(userdir, "library")) + } + + } + + renv_bootstrap_validate_version <- function(version) { + + loadedversion <- utils::packageDescription("renv", fields = "Version") + if (version == loadedversion) + return(TRUE) + + # assume four-component versions are from GitHub; three-component + # versions are from CRAN + components <- strsplit(loadedversion, "[.-]")[[1]] + remote <- if (length(components) == 4L) + paste("rstudio/renv", loadedversion, sep = "@") + else + paste("renv", loadedversion, sep = "@") + + fmt <- paste( + "renv %1$s was loaded from project library, but this project is configured to use renv %2$s.", + "Use `renv::record(\"%3$s\")` to record renv %1$s in the lockfile.", + "Use `renv::restore(packages = \"renv\")` to install renv %2$s into the project library.", + sep = "\n" + ) + + msg <- sprintf(fmt, loadedversion, version, remote) + warning(msg, call. = FALSE) + + FALSE + + } + + renv_bootstrap_hash_text <- function(text) { + + hashfile <- tempfile("renv-hash-") + on.exit(unlink(hashfile), add = TRUE) + + writeLines(text, con = hashfile) + tools::md5sum(hashfile) + + } + + renv_bootstrap_load <- function(project, libpath, version) { + + # try to load renv from the project library + if (!requireNamespace("renv", lib.loc = libpath, quietly = TRUE)) + return(FALSE) + + # warn if the version of renv loaded does not match + renv_bootstrap_validate_version(version) + + # load the project + renv::load(project) + + TRUE + + } + + renv_bootstrap_profile_load <- function(project) { + + # if RENV_PROFILE is already set, just use that + profile <- Sys.getenv("RENV_PROFILE", unset = NA) + if (!is.na(profile) && nzchar(profile)) + return(profile) + + # check for a profile file (nothing to do if it doesn't exist) + path <- renv_bootstrap_paths_renv("profile", profile = FALSE, project = project) + if (!file.exists(path)) + return(NULL) + + # read the profile, and set it if it exists + contents <- readLines(path, warn = FALSE) + if (length(contents) == 0L) + return(NULL) + + # set RENV_PROFILE + profile <- contents[[1L]] + if (!profile %in% c("", "default")) + Sys.setenv(RENV_PROFILE = profile) + + profile + + } + + renv_bootstrap_profile_prefix <- function() { + profile <- renv_bootstrap_profile_get() + if (!is.null(profile)) + return(file.path("profiles", profile, "renv")) + } + + renv_bootstrap_profile_get <- function() { + profile <- Sys.getenv("RENV_PROFILE", unset = "") + renv_bootstrap_profile_normalize(profile) + } + + renv_bootstrap_profile_set <- function(profile) { + profile <- renv_bootstrap_profile_normalize(profile) + if (is.null(profile)) + Sys.unsetenv("RENV_PROFILE") + else + Sys.setenv(RENV_PROFILE = profile) + } + + renv_bootstrap_profile_normalize <- function(profile) { + + if (is.null(profile) || profile %in% c("", "default")) + return(NULL) + + profile + + } + + renv_bootstrap_path_absolute <- function(path) { + + substr(path, 1L, 1L) %in% c("~", "/", "\\") || ( + substr(path, 1L, 1L) %in% c(letters, LETTERS) && + substr(path, 2L, 3L) %in% c(":/", ":\\") + ) + + } + + renv_bootstrap_paths_renv <- function(..., profile = TRUE, project = NULL) { + renv <- Sys.getenv("RENV_PATHS_RENV", unset = "renv") + root <- if (renv_bootstrap_path_absolute(renv)) NULL else project + prefix <- if (profile) renv_bootstrap_profile_prefix() + components <- c(root, renv, prefix, ...) + paste(components, collapse = "/") + } + + renv_bootstrap_project_type <- function(path) { + + descpath <- file.path(path, "DESCRIPTION") + if (!file.exists(descpath)) + return("unknown") + + desc <- tryCatch( + read.dcf(descpath, all = TRUE), + error = identity + ) + + if (inherits(desc, "error")) + return("unknown") + + type <- desc$Type + if (!is.null(type)) + return(tolower(type)) + + package <- desc$Package + if (!is.null(package)) + return("package") + + "unknown" + + } + + renv_bootstrap_user_dir <- function() { + dir <- renv_bootstrap_user_dir_impl() + path.expand(chartr("\\", "/", dir)) + } + + renv_bootstrap_user_dir_impl <- function() { + + # use local override if set + override <- getOption("renv.userdir.override") + if (!is.null(override)) + return(override) + + # use R_user_dir if available + tools <- asNamespace("tools") + if (is.function(tools$R_user_dir)) + return(tools$R_user_dir("renv", "cache")) + + # try using our own backfill for older versions of R + envvars <- c("R_USER_CACHE_DIR", "XDG_CACHE_HOME") + for (envvar in envvars) { + root <- Sys.getenv(envvar, unset = NA) + if (!is.na(root)) + return(file.path(root, "R/renv")) + } + + # use platform-specific default fallbacks + if (Sys.info()[["sysname"]] == "Windows") + file.path(Sys.getenv("LOCALAPPDATA"), "R/cache/R/renv") + else if (Sys.info()[["sysname"]] == "Darwin") + "~/Library/Caches/org.R-project.R/R/renv" + else + "~/.cache/R/renv" + + } + + + renv_json_read <- function(file = NULL, text = NULL) { + + # if jsonlite is loaded, use that instead + if ("jsonlite" %in% loadedNamespaces()) + renv_json_read_jsonlite(file, text) + else + renv_json_read_default(file, text) + + } + + renv_json_read_jsonlite <- function(file = NULL, text = NULL) { + text <- paste(text %||% read(file), collapse = "\n") + jsonlite::fromJSON(txt = text, simplifyVector = FALSE) + } + + renv_json_read_default <- function(file = NULL, text = NULL) { + + # find strings in the JSON + text <- paste(text %||% read(file), collapse = "\n") + pattern <- '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' + locs <- gregexpr(pattern, text, perl = TRUE)[[1]] + + # if any are found, replace them with placeholders + replaced <- text + strings <- character() + replacements <- character() + + if (!identical(c(locs), -1L)) { + + # get the string values + starts <- locs + ends <- locs + attr(locs, "match.length") - 1L + strings <- substring(text, starts, ends) + + # only keep those requiring escaping + strings <- grep("[[\\]{}:]", strings, perl = TRUE, value = TRUE) + + # compute replacements + replacements <- sprintf('"\032%i\032"', seq_along(strings)) + + # replace the strings + mapply(function(string, replacement) { + replaced <<- sub(string, replacement, replaced, fixed = TRUE) + }, strings, replacements) + + } + + # transform the JSON into something the R parser understands + transformed <- replaced + transformed <- gsub("{}", "`names<-`(list(), character())", transformed, fixed = TRUE) + transformed <- gsub("[[{]", "list(", transformed, perl = TRUE) + transformed <- gsub("[]}]", ")", transformed, perl = TRUE) + transformed <- gsub(":", "=", transformed, fixed = TRUE) + text <- paste(transformed, collapse = "\n") + + # parse it + json <- parse(text = text, keep.source = FALSE, srcfile = NULL)[[1L]] + + # construct map between source strings, replaced strings + map <- as.character(parse(text = strings)) + names(map) <- as.character(parse(text = replacements)) + + # convert to list + map <- as.list(map) + + # remap strings in object + remapped <- renv_json_remap(json, map) + + # evaluate + eval(remapped, envir = baseenv()) + + } + + renv_json_remap <- function(json, map) { + + # fix names + if (!is.null(names(json))) { + lhs <- match(names(json), names(map), nomatch = 0L) + rhs <- match(names(map), names(json), nomatch = 0L) + names(json)[rhs] <- map[lhs] + } + + # fix values + if (is.character(json)) + return(map[[json]] %||% json) + + # handle true, false, null + if (is.name(json)) { + text <- as.character(json) + if (text == "true") + return(TRUE) + else if (text == "false") + return(FALSE) + else if (text == "null") + return(NULL) + } + + # recurse + if (is.recursive(json)) { + for (i in seq_along(json)) { + json[i] <- list(renv_json_remap(json[[i]], map)) + } + } + + json + + } + + # load the renv profile, if any + renv_bootstrap_profile_load(project) + + # construct path to library root + root <- renv_bootstrap_library_root(project) + + # construct library prefix for platform + prefix <- renv_bootstrap_platform_prefix() + + # construct full libpath + libpath <- file.path(root, prefix) + + # attempt to load + if (renv_bootstrap_load(project, libpath, version)) + return(TRUE) + + # load failed; inform user we're about to bootstrap + prefix <- paste("# Bootstrapping renv", version) + postfix <- paste(rep.int("-", 77L - nchar(prefix)), collapse = "") + header <- paste(prefix, postfix) + message(header) + + # perform bootstrap + bootstrap(version, libpath) + + # exit early if we're just testing bootstrap + if (!is.na(Sys.getenv("RENV_BOOTSTRAP_INSTALL_ONLY", unset = NA))) + return(TRUE) + + # try again to load + if (requireNamespace("renv", lib.loc = libpath, quietly = TRUE)) { + message("* Successfully installed and loaded renv ", version, ".") + return(renv::load()) + } + + # failed to download or load renv; warn the user + msg <- c( + "Failed to find an renv installation: the project will not be loaded.", + "Use `renv::activate()` to re-initialize the project." + ) + + warning(paste(msg, collapse = "\n"), call. = FALSE) + +}) diff --git a/renv/settings.dcf b/renv/settings.dcf new file mode 100644 index 0000000000..169d82f1bc --- /dev/null +++ b/renv/settings.dcf @@ -0,0 +1,10 @@ +bioconductor.version: +external.libraries: +ignored.packages: +package.dependency.fields: Imports, Depends, LinkingTo +r.version: +snapshot.type: implicit +use.cache: TRUE +vcs.ignore.cellar: TRUE +vcs.ignore.library: TRUE +vcs.ignore.local: TRUE diff --git a/scripts/calibration/calc_calib.R b/scripts/calibration/calc_calib.R index d0842ee533..9ffd6773e7 100644 --- a/scripts/calibration/calc_calib.R +++ b/scripts/calibration/calc_calib.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -10,28 +10,29 @@ # *** based on a pre run of magpie *** # ********************************************************************* -calibration_run<-function(putfolder,calib_magpie_name,logoption=3){ +calibration_run <- function(putfolder, calib_magpie_name, logoption = 3) { require(lucode2) # create putfolder for the calib run - unlink(putfolder,recursive=TRUE) + unlink(putfolder, recursive = TRUE) dir.create(putfolder) # create a modified magpie.gms for the calibration run - unlink(paste(calib_magpie_name,".gms",sep="")) + unlink(paste(calib_magpie_name, ".gms", sep = "")) unlink("fulldata.gdx") - if(!file.copy("main.gms",paste(calib_magpie_name,".gms",sep=""))){ - stop(paste("Unable to create",paste(calib_magpie_name,".gms",sep=""))) + if (!file.copy("main.gms", paste(calib_magpie_name, ".gms", sep = ""))) { + stop(paste("Unable to create", paste(calib_magpie_name, ".gms", sep = ""))) } - lucode2::manipulateConfig(paste(calib_magpie_name,".gms",sep=""),c_timesteps=1) - lucode2::manipulateConfig(paste(calib_magpie_name,".gms",sep=""),s_use_gdx=0) - file.copy(paste(calib_magpie_name,".gms",sep=""),putfolder) + lucode2::manipulateConfig(paste(calib_magpie_name, ".gms", sep = ""), c_timesteps = 1) + lucode2::manipulateConfig(paste(calib_magpie_name, ".gms", sep = ""), s_use_gdx = 0) + file.copy(paste(calib_magpie_name, ".gms", sep = ""), putfolder) # execute calibration run - system(paste("gams ",calib_magpie_name,".gms"," -errmsg=1 -PUTDIR ./",putfolder," -LOGOPTION=",logoption,sep=""),wait=TRUE) - file.copy("fulldata.gdx",putfolder) + system(paste("gams ", calib_magpie_name, ".gms", " -errmsg=1 -PUTDIR ./", putfolder, " -LOGOPTION=", logoption, + sep = ""), wait = TRUE) + file.copy("fulldata.gdx", putfolder) } # get ratio between modelled area and reference area @@ -39,15 +40,15 @@ get_areacalib <- function(gdx_file) { require(magclass) require(magpie4) require(gdx) - require(luscale) - data <- readGDX(gdx_file,"pm_land_start")[,,c("crop","past")] - data <- superAggregate(data,"sum",level="reg") - magpie <- land(gdx_file)[,,c("crop","past")] - if(nregions(magpie)!=nregions(data) | !all(getRegions(magpie) %in% getRegions(data))) { + data <- readGDX(gdx_file, "pm_land_start")[, , c("crop", "past")] + data <- dimSums(data, dim = 1.2) + magpie <- land(gdx_file)[, , c("crop", "past")] + if (nregions(magpie) != nregions(data) || !all(getCells(magpie) %in% getCells(data))) { stop("Regions in MAgPIE do not agree with regions in reference calibration area data set!") } - out <- magpie/data - out[out==0] <- 1 + out <- magpie / data + out[out == 0] <- 1 + out[is.na(out)] <- 1 return(magpiesort(out)) } @@ -58,73 +59,128 @@ get_yieldcalib <- function(gdx_file) { prep <- function(x) { # use maiz as surrogate for all crops - elem <- c("maiz","pasture") - y <- collapseNames(x[,,"rainfed"][,,elem]) - getNames(y) <- c("crop","past") - return(superAggregate(y,level="reg",aggr_type="mean", na.rm=TRUE)) + elem <- c("maiz", "pasture") + y <- collapseNames(x[, , "rainfed"][, , elem]) + getNames(y) <- c("crop", "past") + return(superAggregate(y, level = "reg", aggr_type = "mean", na.rm = TRUE)) } - y_ini <- prep(readGDX(gdx_file,"i14_yields")) - y <- prep(readGDX(gdx_file,"vm_yld")[,,"l"]) + y_ini <- prep(readGDX(gdx_file, "i14_yields", "i14_yields_calib", + format = "first_found", react = "silent")) + y <- prep(readGDX(gdx_file, "vm_yld")[, , "l"]) - out <- y/y_ini - out[out==0] <- 1 + out <- y / y_ini + out[out == 0] <- 1 + out[is.na(out)] <- 1 return(magpiesort(out)) } # Calculate the correction factor and save it -update_calib<-function(gdx_file, calib_accuracy=0.1, calibrate_pasture=TRUE,calibrate_cropland=TRUE,damping_factor=0.8, calib_file, crop_max=1, calibration_step=""){ +update_calib <- function(gdx_file, calib_accuracy = 0.1, calibrate_pasture = TRUE, calibrate_cropland = TRUE, + damping_factor = 0.8, calib_file, crop_max = 2, calibration_step = "", + n_maxcalib = 20, best_calib = FALSE) { require(magclass) require(magpie4) - if(!(modelstat(gdx_file)[1,1,1]%in%c(1,2,7))) stop("Calibration run infeasible") + if (!(modelstat(gdx_file)[1, 1, 1] %in% c(1, 2, 7))) stop("Calibration run infeasible") area_factor <- get_areacalib(gdx_file) tc_factor <- get_yieldcalib(gdx_file) calib_correction <- area_factor * tc_factor - calib_divergence <- abs(calib_correction-1) + calib_divergence <- abs(calib_correction - 1) - old_calib <- magpiesort(read.magpie(calib_file)) - calib_factor <- old_calib * (damping_factor*(calib_correction-1) + 1) + calib_factor <- readGDX(gdx_file, "f14_yld_calib") + calib_factor_calc <- calib_factor * (damping_factor * (calib_correction - 1) + 1) - if(!is.null(crop_max)) { - above_limit <- (calib_factor[,,"crop"] > crop_max) - calib_factor[,,"crop"][above_limit] <- crop_max - calib_divergence[getRegions(calib_factor),,"crop"][above_limit] <- 0 + if (!is.null(crop_max)) { + above_limit <- (calib_factor[, , "crop"] > crop_max) + calib_factor[, , "crop"][above_limit] <- crop_max + calib_divergence[getCells(calib_factor), , "crop"][above_limit] <- calib_accuracy } - if(!calibrate_pasture) { - calib_factor[,,"past"] <- 1 - calib_divergence[,,"past"] <- 0 + if (!calibrate_pasture) { + calib_factor[, , "past"] <- 1 + calib_divergence[, , "past"] <- 0 } - if(!calibrate_cropland) { - calib_factor[,,"crop"] <- 1 - calib_divergence[,,"crop"] <- 0 + if (!calibrate_cropland) { + calib_factor[, , "crop"] <- 1 + calib_divergence[, , "crop"] <- 0 } ### write down current calib factors (and area_factors) for tracking - write_log <- function(x,file,calibration_step) { - x <- add_dimension(x, dim=3.1, add="iteration", nm=calibration_step) - try(write.magpie(round(setYears(x,NULL),2), file, append = (calibration_step!=1))) + write_log <- function(x, file, calibration_step) { + x <- add_dimension(x, dim = 3.1, add = "iteration", nm = calibration_step) + try(write.magpie(round(setYears(x, NULL), 3), file, append = (calibration_step != 1))) } - write_log(calib_correction, "calib_correction.cs3" , calibration_step) - write_log(calib_divergence, "calib_divergence.cs3" , calibration_step) - write_log(area_factor, "calib_area_factor.cs3", calibration_step) - write_log(tc_factor, "calib_tc_factor.cs3" , calibration_step) + write_log(calib_correction, "calib_correction.cs3", calibration_step) + write_log(calib_divergence, "calib_divergence.cs3", calibration_step) + write_log(area_factor, "calib_area_factor.cs3", calibration_step) + write_log(tc_factor, "calib_tc_factor.cs3", calibration_step) + write_log(calib_factor, "calib_factor.cs3", calibration_step) # in case of sufficient convergence, stop here (no additional update of # calibration factors!) - if(all(calib_divergence < calib_accuracy)) return(TRUE) - - comment <- c(" description: Regional yield calibration file", - " unit: -", - paste0(" note: Calibration step ",calibration_step), - " origin: scripts/calibration/calc_calib.R (path relative to model main directory)", - paste0(" creation date: ",date())) - write.magpie(round(setYears(calib_factor,NULL),2), calib_file, comment = comment) + if (all(calib_divergence <= calib_accuracy) || calibration_step == n_maxcalib) { + ### Depending on the selected calibration selection type (best_calib FALSE or TRUE) + # the reported and used regional calibration factors can be either the ones of the last iteration, + # or the "best" based on the iteration value with the lowest divergence. + if (best_calib == TRUE) { + + calib_best <- new.magpie(cells_and_regions = getCells(calib_divergence), + years = getYears(calib_divergence), names = c("crop", "past")) + calib_best_div <- new.magpie(cells_and_regions = getCells(calib_divergence), + years = getYears(calib_divergence), names = c("crop", "past")) + divergence_data <- read.magpie("calib_divergence.cs3") + factors_data <- read.magpie("calib_factor.cs3") + + for (i in getCells(calib_best)) { + + factors_data_sub_crop <- as.data.frame(factors_data[i, , "crop"]) + n_iterations <- nrow(factors_data_sub_crop) + factors_data_sub_crop <- factors_data_sub_crop[2:n_iterations, ] + divergence_data_sub_crop <- as.data.frame(divergence_data[i, , "crop"])[2:n_iterations, ] + factors_data_sub_past <- as.data.frame(factors_data[i, , "past"])[2:n_iterations, ] + divergence_data_sub_past <- as.data.frame(divergence_data[i, , "past"])[2:n_iterations, ] + + + min_index_crop <- max(which(divergence_data_sub_crop$Value == min(divergence_data_sub_crop$Value, + na.rm = TRUE))) + min_index_past <- max(which(divergence_data_sub_past$Value == min(divergence_data_sub_past$Value, + na.rm = TRUE))) + + calib_best[i, NULL, "crop"] <- factors_data_sub_crop[min_index_crop, "Value"] + calib_best[i, NULL, "past"] <- factors_data_sub_past[min_index_past, "Value"] + calib_best_div[i, NULL, "crop"] <- divergence_data_sub_crop[min_index_crop, "Value"] + calib_best_div[i, NULL, "past"] <- divergence_data_sub_crop[min_index_past, "Value"] + } + comment <- c(" description: Regional yield calibration file", + " unit: -", + paste0(" note: Best calibration factor from the run"), + " origin: scripts/calibration/calc_calib.R (path relative to model main directory)", + paste0(" creation date: ", date())) + write.magpie(round(setYears(calib_best, NULL), 2), calib_file, comment = comment) + + write_log(calib_best, "calib_factor.cs3", "best") + write_log(calib_best_div, "calib_divergence.cs3", "best") + #### + if (any(calib_best) == crop_max) message("Note: A region or a few regions have a calibration factor equal to the maximum possible. + Check for possible reasons/inconsistencies.") + return(TRUE) + } else { + if (any(calib_factor) == crop_max) message("Note: A region or a few regions have a calibration factor equal to the maximum possible. + Check for possible reasons/inconsistencies.") + return(TRUE) + } + } else { + comment <- c(" description: Regional yield calibration file", + " unit: -", + paste0(" note: Calibration step ", calibration_step), + " origin: scripts/calibration/calc_calib.R (path relative to model main directory)", + paste0(" creation date: ", date())) + write.magpie(round(setYears(calib_factor_calc, NULL), 2), calib_file, comment = comment) + return(FALSE) + } - write_log(calib_factor, "calib_factor.cs3" , calibration_step) - return(FALSE) } @@ -132,29 +188,35 @@ calibrate_magpie <- function(n_maxcalib = 1, calib_accuracy = 0.1, calibrate_pasture = FALSE, calibrate_cropland = TRUE, + crop_max = 2, calib_magpie_name = "magpie_calib", damping_factor = 0.6, calib_file = "modules/14_yields/input/f14_yld_calib.csv", putfolder = "calib_run", data_workspace = NULL, logoption = 3, - debug = FALSE) { + debug = FALSE, + best_calib = FALSE) { require(magclass) - for(i in 1:n_maxcalib){ - cat(paste("\nStarting calibration iteration",i,"\n")) - calibration_run(putfolder=putfolder, calib_magpie_name=calib_magpie_name, logoption=logoption) - if(debug) file.copy(paste0(putfolder,"/fulldata.gdx"),paste0("fulldata_calib",i,".gdx")) - done <- update_calib(gdx_file=paste0(putfolder,"/fulldata.gdx"),calib_accuracy=calib_accuracy, calibrate_pasture=calibrate_pasture,calibrate_cropland=calibrate_cropland,damping_factor=damping_factor, calib_file=calib_file, calibration_step=i) - if(done){ + if (file.exists(calib_file)) file.remove(calib_file) + for (i in 1:n_maxcalib) { + cat(paste("\nStarting yield calibration iteration", i, "\n")) + calibration_run(putfolder = putfolder, calib_magpie_name = calib_magpie_name, logoption = logoption) + if (debug) file.copy(paste0(putfolder, "/fulldata.gdx"), paste0("fulldata_calib", i, ".gdx")) + done <- update_calib(gdx_file = paste0(putfolder, "/fulldata.gdx"), calib_accuracy = calib_accuracy, + calibrate_pasture = calibrate_pasture, calibrate_cropland = calibrate_cropland, + crop_max = crop_max, damping_factor = damping_factor, calib_file = calib_file, + calibration_step = i, n_maxcalib = n_maxcalib, best_calib = best_calib) + if (done) { break } } # delete calib_magpie_gms in the main folder - unlink(paste0(calib_magpie_name,".*")) + unlink(paste0(calib_magpie_name, ".*")) unlink("fulldata.gdx") - cat("\ncalibration finished\n") + cat("\nYield calibration finished\n") } diff --git a/scripts/calibration/landconversion_cost.R b/scripts/calibration/landconversion_cost.R new file mode 100644 index 0000000000..a149101479 --- /dev/null +++ b/scripts/calibration/landconversion_cost.R @@ -0,0 +1,291 @@ +# | (C) 2008-2023 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 + +# ********************************************************************* +# *** This script calculates a regional calibration factor *** +# *** based on a pre run of magpie *** +# ********************************************************************* + +calibration_run <- function(putfolder, calib_magpie_name, logoption = 3, s_use_gdx = 0) { + require(lucode2) + + # create putfolder for the calib run + unlink(putfolder, recursive = TRUE) + dir.create(putfolder) + + # create a modified magpie.gms for the calibration run + unlink(paste(calib_magpie_name, ".gms", sep = "")) + unlink("fulldata.gdx") + + if (!file.copy("main.gms", paste(calib_magpie_name, ".gms", sep = ""))) { + stop(paste("Unable to create", paste(calib_magpie_name, ".gms", sep = ""))) + } + lucode2::manipulateConfig(paste(calib_magpie_name, ".gms", sep = ""), c_timesteps = "calib") + lucode2::manipulateConfig(paste(calib_magpie_name, ".gms", sep = ""), s_use_gdx = s_use_gdx) + file.copy(paste(calib_magpie_name, ".gms", sep = ""), putfolder) + + # execute calibration run + system(paste("gams ", calib_magpie_name, ".gms", " -errmsg=1 -PUTDIR ./", putfolder, " -LOGOPTION=", logoption, sep = ""), wait = TRUE) + file.copy("fulldata.gdx", putfolder) +} + +# get ratio between modelled area and reference area + +getCalibFactor <- function(gdx_file, mode = "cost", calib_accuracy = 0.05) { + require(magclass) + require(magpie4) + require(gdx) + y <- 2015 + magpie <- setYears(land(gdx_file)[, y, "crop"], NULL) + hist <- dimSums(readGDX(gdx_file, "f10_land")[, , "crop"], dim = 1.2) + data <- setYears(hist[, y, "crop"], NULL) + shrLost <- (setYears(hist[getRegions(magpie), 2015, ], NULL) - setYears(hist[getRegions(magpie), 1995, ], NULL)) / setYears(hist[getRegions(magpie), 1995, ], NULL) + if (nregions(magpie) != nregions(data) | !all(getRegions(magpie) %in% getRegions(data))) { + stop("Regions in MAgPIE do not agree with regions in reference calibration area data set!") + } + if (mode == "cost") { + out <- magpie / data + out[out == 0] <- 1 + out[is.na(out)] <- 1 + getNames(out) <- NULL + getYears(out) <- NULL + + out[which(out < 0, arr.ind = T)] <- 1 + } else if (mode == "reward") { + out <- magpie / data + out[is.na(out)] <- 0 + getNames(out) <- NULL + getYears(out) <- NULL + + # only reward if share of cropland lost between 1995 and 2015 exceeds a certain threshold. Otherwise set to 0. + out[which(shrLost > -calib_accuracy, arr.ind = T)] <- 0 + out[which(out < 0, arr.ind = T)] <- 0 + } + return(magpiesort(out)) +} + +time_series_cost <- function(calib_factor) { + out2 <- new.magpie(getRegions(calib_factor), years = c(1995, 2015, seq(2050, 2150, by = 5)), fill = 1) + out2[, 2015, ] <- calib_factor + out2 <- time_interpolate(out2, seq(2000, 2015, by = 5), integrate_interpolated_years = T) + out2050 <- calib_factor + out2050[out2050 < 1] <- 1 + out2[, seq(2050, 2150, by = 5), ] <- out2050 + out2 <- time_interpolate(out2, seq(2020, 2050, by = 5), integrate_interpolated_years = T) + return(out2) +} + +time_series_reward <- function(calib_factor) { + out2 <- new.magpie(getRegions(calib_factor), + years = c(1995, 2015, seq(2050, 2150, by = 5)), fill = 0 + ) + out2[, 2015, ] <- calib_factor + out2 <- time_interpolate(out2, seq(2000, 2015, by = 5), integrate_interpolated_years = T) + out2 <- time_interpolate(out2, seq(2020, 2050, by = 5), integrate_interpolated_years = T) + return(out2) +} + +getHistCrop <- function() { + rep <- read.report("input/validation.mif", as.list = FALSE) + crop <- collapseNames(rep[, , "historical.FAO_crop_past.Resources|Land Cover|+|Cropland (million ha)"]) + return(crop) +} + +# Calculate the correction factor and save it +update_calib <- function(gdx_file, calib_accuracy = 0.05, damping_factor = 0.96, calib_file, cost_max = 3, cost_min = 0.05, calibration_step = "", n_maxcalib = 40, best_calib = TRUE) { + require(magclass) + require(magpie4) + if (!(modelstat(gdx_file)[1, 1, 1] %in% c(1, 2, 7))) stop("Calibration run infeasible") + + calib_correction_cost <- getCalibFactor(gdx_file, mode = "cost", calib_accuracy = calib_accuracy) + calib_divergence_cost <- abs(calib_correction_cost - 1) + + calib_correction_reward <- getCalibFactor(gdx_file, mode = "reward", calib_accuracy = calib_accuracy) + calib_divergence_reward <- calib_correction_reward + calib_divergence_reward[calib_divergence_reward > 0] <- calib_divergence_reward[calib_divergence_reward > 0] - 1 + calib_divergence_reward <- abs(calib_divergence_reward) + + ### -> in case it is the first step, it forces the initial factors to be equal to 1 + if (file.exists(calib_file)) { + old_calib <- setYears(magpiesort(read.magpie(calib_file))[, 2015, ], NULL) + start_flag <- FALSE + } else { + old_calib <- new.magpie(cells_and_regions = getCells(calib_divergence_cost), names = c("cost", "reward"), fill = 1) + start_flag <- TRUE + } + + calib_factor_cost <- setNames(old_calib[, , "cost"], NULL) * (damping_factor * (calib_correction_cost - 1) + 1) + calib_factor_reward <- setNames(old_calib[, , "reward"], NULL) * (damping_factor * (calib_correction_reward)) + + # if reward exists, start cost calibration with cost_max instead of 1 + if (start_flag & !is.null(cost_max)) { + reward_exists <- (calib_factor_reward > 0) + calib_factor_cost[reward_exists] <- cost_max + + # also set start value for India to cost_max for better convergence + if ("IND" %in% getRegions(calib_factor_cost)) { + calib_factor_cost["IND", , ] <- cost_max + } + } + + if (!start_flag) { + # use calibration factors where accuracy was reached + # use stricter divergence threshold in first 5 calibration_step steps + cost_acc_reached <- calib_divergence_cost <= ifelse(calibration_step < 6, 0.01, calib_accuracy) + calib_factor_cost[cost_acc_reached] <- setNames(old_calib[, , "cost"], NULL)[cost_acc_reached] + + reward_acc_reached <- calib_divergence_reward <= ifelse(calibration_step < 6, 0.01, calib_accuracy) + calib_factor_reward[reward_acc_reached] <- setNames(old_calib[, , "reward"], NULL)[reward_acc_reached] + + # make sure cost factor does not fall below 1 during iteration where there is a reward + reward_exists <- (calib_factor_reward > 0) + set_to_one <- reward_exists & (calib_factor_cost < 1) + calib_factor_cost[set_to_one] <- 1 + } + + if (!is.null(cost_max)) { + above_limit <- (calib_factor_cost > cost_max) + calib_factor_cost[above_limit] <- cost_max + calib_divergence_cost[getRegions(calib_factor_cost), , ][above_limit] <- 0 + } + + if (!is.null(cost_min)) { + below_limit <- (calib_factor_cost < cost_min) + calib_factor_cost[below_limit] <- cost_min + calib_divergence_cost[getRegions(calib_factor_cost), , ][below_limit] <- 0 + } + + ### write down current calib factors (and area_factors) for tracking + write_log <- function(x, file, calibration_step) { + x <- add_dimension(x, dim = 3.1, add = "iteration", nm = paste0("iter", calibration_step)) + try(write.magpie(round(setYears(x, NULL), 3), file, append = (calibration_step != 1))) + } + + write_log(calib_correction_cost, "land_conversion_cost_calib_correction.cs3", calibration_step) + write_log(calib_divergence_cost, "land_conversion_cost_calib_divergence.cs3", calibration_step) + write_log(calib_factor_cost, "land_conversion_cost_calib_factor.cs3", calibration_step) + + write_log(calib_correction_reward, "land_conversion_reward_calib_correction.cs3", calibration_step) + write_log(calib_divergence_reward, "land_conversion_reward_calib_divergence.cs3", calibration_step) + write_log(calib_factor_reward, "land_conversion_reward_calib_factor.cs3", calibration_step) + + # in case of sufficient convergence, stop here (no additional update of + # calibration factors!) + + if (all(all(calib_divergence_cost <= calib_accuracy) & all(calib_divergence_reward <= calib_accuracy)) | calibration_step == n_maxcalib) { + + ### Depending on the selected calibration selection type (best_calib FALSE or TRUE) + # the reported and used regional calibration factors can be either the ones of the last iteration, + # or the "best" based on the iteration value with the lowest standard deviation of regional divergence. + if (best_calib == TRUE) { + divergence_data <- read.magpie("land_conversion_cost_calib_divergence.cs3") + factors_data <- read.magpie("land_conversion_cost_calib_factor.cs3") + calib_cost_best <- factors_data[, , which.min(apply(as.array(divergence_data), c(3), sd))] + getNames(calib_cost_best) <- NULL + getYears(calib_cost_best) <- NULL + calib_cost_best <- time_series_cost(calib_cost_best) + + divergence_data <- read.magpie("land_conversion_reward_calib_divergence.cs3") + factors_data <- read.magpie("land_conversion_reward_calib_factor.cs3") + calib_reward_best <- factors_data[, , which.min(apply(as.array(divergence_data), c(3), sd))] + getNames(calib_reward_best) <- NULL + getYears(calib_reward_best) <- NULL + calib_reward_best <- time_series_reward(calib_reward_best) + + calib_best_full <- mbind( + add_dimension(calib_cost_best, dim = 3.1, nm = "cost"), + add_dimension(calib_reward_best, dim = 3.1, nm = "reward") + ) + calib_best_full[is.na(calib_best_full)] <- 1 + + comment <- c( + " description: Regional land conversion cost calibration file", + " unit: -", + paste0(" note: Best calibration factor from the run"), + " origin: scripts/calibration/landconversion_cost.R (path relative to model main directory)", + paste0(" creation date: ", date()) + ) + write.magpie(round(calib_best_full, 3), calib_file, comment = comment) + + write_log(calib_best_full[, 2015, "cost"], "land_conversion_cost_calib_factor.cs3", "best") + write_log(calib_best_full[, 2015, "reward"], "land_conversion_reward_calib_factor.cs3", "best") + #### + return(TRUE) + } else { + return(TRUE) + } + } else { + calib_factor_cost <- time_series_cost(calib_factor_cost) + calib_factor_reward <- time_series_reward(calib_factor_reward) + + calib_full <- mbind( + add_dimension(calib_factor_cost, dim = 3.1, nm = "cost"), + add_dimension(calib_factor_reward, dim = 3.1, nm = "reward") + ) + calib_full[is.na(calib_full)] <- 1 + + comment <- c( + " description: Regional land conversion cost calibration file", + " unit: -", + paste0(" note: Calibration step ", calibration_step), + " origin: scripts/calibration/landconversion_cost.R (path relative to model main directory)", + paste0(" creation date: ", date()) + ) + + write.magpie(round(calib_full, 3), calib_file, comment = comment) + return(FALSE) + } +} + + + + +calibrate_magpie <- function(n_maxcalib = 40, + restart = TRUE, + calib_accuracy = 0.05, + cost_max = 3, + cost_min = 0.05, + calib_magpie_name = "magpie_calib", + damping_factor = 0.96, + calib_file = "modules/39_landconversion/input/f39_calib.csv", + putfolder = "land_conversion_cost_calib_run", + data_workspace = NULL, + logoption = 3, + debug = FALSE, + best_calib = TRUE) { + require(magclass) + + if (!restart) { + cat(paste0("\nStarting land conversion cost calibration from default values\n")) + if (file.exists(calib_file)) file.remove(calib_file) + } else { + if (file.exists(calib_file)) cat(paste0("\nStarting land conversion cost calibration from existing values\n")) else cat(paste0("\nStarting land conversion cost calibration from default values\n")) + } + + for (i in 1:n_maxcalib) { + if (i == 1) s_use_gdx <- 0 + cat(paste("\nStarting land conversion cost calibration iteration", i, "with s_use_gdx =", s_use_gdx, "\n")) + calibration_run(putfolder = putfolder, calib_magpie_name = calib_magpie_name, logoption = logoption, s_use_gdx = s_use_gdx) + if (debug) file.copy(paste0(putfolder, "/fulldata.gdx"), paste0("fulldata_calib", i, ".gdx")) + done <- update_calib(gdx_file = paste0(putfolder, "/fulldata.gdx"), calib_accuracy = calib_accuracy, cost_max = cost_max, cost_min = cost_min, damping_factor = damping_factor, calib_file = calib_file, calibration_step = i, n_maxcalib = n_maxcalib, best_calib = best_calib) + if (done & s_use_gdx == 2) { + s_use_gdx <- 0 + next + } else if (done & s_use_gdx == 0) { + break + } else { + s_use_gdx <- 2 + } + } + + + # delete calib_magpie_gms in the main folder + unlink(paste0(calib_magpie_name, ".*")) + unlink("fulldata.gdx") + + cat("\nLand conversion cost calibration finished\n") +} diff --git a/scripts/downloader/inputdelete.cfg b/scripts/downloader/inputdelete.cfg index 6053462057..9d2fc65ce9 100644 --- a/scripts/downloader/inputdelete.cfg +++ b/scripts/downloader/inputdelete.cfg @@ -1,11 +1,11 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 file;destination -*-to-*_*.spam;input +clustermap_rev*.rds;input avl_land_*.mz;input diagnostics.log;input diagnostics.csv;input @@ -13,7 +13,6 @@ diagnostics_full.log;input file2destination.csv;input info.txt;input ready.rdy;input -spamplot.pdf;input spatial_header.rda;input validation.mif;input rr_layer_*.mz;input diff --git a/scripts/insertheader/insertheader.R b/scripts/insertheader/insertheader.R index c2cbb56e6f..9753476410 100644 --- a/scripts/insertheader/insertheader.R +++ b/scripts/insertheader/insertheader.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -6,7 +6,7 @@ # | Contact: magpie@pik-potsdam.de insertheader <- function(maindir=".", - header=c("(C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK)", + header=c("(C) 2008-2023 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", @@ -16,7 +16,7 @@ insertheader <- function(maindir=".", ".spam",".xlsx",".sh","files",".md",".RData", ".jpg", ".png",".cff", ".rds", ".aux", ".log", ".out", ".pdf", ".tex", ".htm", ".css", ".bib", ".ref", ".mif", ".gdx", - ".lst", ".git-id", ".csv", ".Rdata"), + ".lst", ".git-id", ".csv", ".Rdata", ".txt"), comments=c(".R"="#",".gms"="***",".cfg"="#",".csv"="*",".cs2"="*", ".cs3"="*",".cs4"="*",".sh"="#",".txt"="#"), key = "| ", @@ -33,9 +33,7 @@ insertheader <- function(maindir=".", return(gsub(".*(\\..*)","\\1",basename(file))) } - cwd <- getwd() - on.exit(setwd(cwd)) - setwd(maindir) + withr::local_dir(maindir) if(is.null(oldkey)) oldkey <- key diff --git a/scripts/npi_ndc/start_npi_ndc.R b/scripts/npi_ndc/start_npi_ndc.R index fbe2973794..237650a8df 100644 --- a/scripts/npi_ndc/start_npi_ndc.R +++ b/scripts/npi_ndc/start_npi_ndc.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -9,23 +9,21 @@ ## calculates policy for protecting different land pools from land use change calc_NPI_NDC <- function(policyregions = "iso", pol_def_file = "policies/policy_definitions.csv", - spatialheader_file = "../../input/spatial_header.rda", cellmapping = "policies/country2cell.rds", land_stock_file = "../../modules/10_land/input/avl_land_t_0.5.mz", - spam_file = Sys.glob("../../input/*-to-*_sum.spam"), + map_file = Sys.glob("../../input/clustermap_rev*.rds"), outfolder_ad_aolc = c("policies/","../../modules/35_natveg/input/"), outfolder_aff = c("policies/","../../modules/32_forestry/input/"), out_ad_file = "npi_ndc_ad_aolc_pol.cs3", out_aff_file = "npi_ndc_aff_pol.cs3"){ require(magclass) - require(luscale) require(madrat) # load the cell mapping policy pol_mapping <- readRDS(cellmapping) if(!(policyregions %in% names(pol_mapping))) stop("No cell mapping available for policyregions = ",policyregions) - pol_mapping <- pol_mapping[,policyregions] + pol_mapping$policyregions <- pol_mapping[[policyregions]] ############################################################################## ########## Information from the reference observed data ########### @@ -33,7 +31,32 @@ calc_NPI_NDC <- function(policyregions = "iso", #read in cellular land cover (stock) from landuse initialization land_stock <- read.magpie(land_stock_file) - getRegions(land_stock) <- paste(pol_mapping,1:59199,sep=".") + + # use pol_mapping to update spatial mapping of cells to regions + # so that not only countries can be used for policies but also smaller + # units such as provinces + if(dim(land_stock)[1] == 59199) { # 59199 cells + if(dim(pol_mapping)[1] > 59199) { + pol_mapping <- pol_mapping[order(pol_mapping$cell),] + pol_mapping <- pol_mapping[!is.na(pol_mapping$cell),] + } + getItems(land_stock, dim = 1, raw = TRUE) <- paste(pol_mapping$policyregions,1:59199,sep=".") + } else { + coords <- getCoords(land_stock) + names(coords) <- c("lon","lat") + m <- merge(coords, pol_mapping, sort =FALSE) + getItems(land_stock, dim = "iso") <- m$policyregions + } + + # select map_file if more than one has been found + if(length(map_file) > 1) { + if(dim(land_stock)[1] == 67420) { + map_file <- grep("67420", map_file, value = TRUE) + } else { + map_file <- grep("67420", map_file, value = TRUE, invert = TRUE) + } + } + stopifnot(length(map_file) == 1) forest_stock <- dimSums(land_stock[,,c("primforest","secdforest","forestry")], dim=3) getNames(forest_stock) <- "forest" @@ -83,7 +106,7 @@ calc_NPI_NDC <- function(policyregions = "iso", npi_ad <- droplevels(subset(pol_def, policy=="npi" & landpool=="forest")) addtable(npi_ad[,c(-2,-3)]) npi_ad <- calc_policy(npi_ad, forest_stock, pol_type="ad", pol_mapping=pol_mapping, - spatialheader_file=spatialheader_file, spam_file=spam_file) + map_file=map_file) getNames(npi_ad) <- "npi.forest" cat(paste0(" (time elapsed: ",format(proc.time()["elapsed"]-ptm,width=6,nsmall=2,digits=2),"s)\n")) @@ -95,7 +118,7 @@ calc_NPI_NDC <- function(policyregions = "iso", ndc_ad <- droplevels(subset(pol_def, policy=="ndc" & landpool=="forest")) addtable(ndc_ad[,c(-2,-3)]) ndc_ad <- calc_policy(ndc_ad, forest_stock, pol_type="ad", pol_mapping=pol_mapping, - spatialheader_file=spatialheader_file, spam_file=spam_file) + map_file=map_file) getNames(ndc_ad) <- "ndc.forest" #Set all values before 2015 to NPI values; copy the values til 2010 from the NPI data ndc_ad[,which(getYears(ndc_ad,as.integer=TRUE)<=2020),] <- @@ -116,8 +139,8 @@ calc_NPI_NDC <- function(policyregions = "iso", addline("################") npi_aolc <- droplevels(subset(pol_def, policy=="npi" & landpool=="other")) addtable(npi_aolc[,c(-2,-3)]) - npi_aolc <- calc_policy(npi_aolc, land_stock[,,"other"], pol_type="ad", pol_mapping=pol_mapping, - spatialheader_file=spatialheader_file, spam_file=spam_file) + npi_aolc <- calc_policy(npi_aolc, land_stock[,,"other"], pol_type="ad", + pol_mapping=pol_mapping, map_file=map_file) getNames(npi_aolc) <- "npi.other" cat(paste0(" (time elapsed: ",format(proc.time()["elapsed"]-ptm,width=6,nsmall=2,digits=2),"s)\n")) @@ -128,8 +151,8 @@ calc_NPI_NDC <- function(policyregions = "iso", addline("################") ndc_aolc <- droplevels(subset(pol_def, policy=="ndc" & landpool=="other")) addtable(ndc_aolc[,c(-2,-3)]) - ndc_aolc <- calc_policy(ndc_aolc,land_stock[,,"other"],pol_type="ad",pol_mapping=pol_mapping, - spatialheader_file=spatialheader_file, spam_file=spam_file) + ndc_aolc <- calc_policy(ndc_aolc, land_stock[,,"other"], pol_type="ad", + pol_mapping=pol_mapping, map_file=map_file) getNames(ndc_aolc) <- "ndc.other" #Set all values before 2015 to NPI values; copy the values til 2010 from the NPI data ndc_aolc[,which(getYears(ndc_aolc,as.integer=TRUE)<=2020),] <- @@ -160,7 +183,7 @@ calc_NPI_NDC <- function(policyregions = "iso", addtable(npi_aff[,c(-2,-3)]) npi_aff <- calc_policy(npi_aff, land_stock, pol_type="aff", pol_mapping=pol_mapping, weight=dimSums(land_stock[,2005,c("crop","past")]), - spatialheader_file=spatialheader_file, spam_file=spam_file) + map_file=map_file) getNames(npi_aff) <- "npi" cat(paste0(" (time elapsed: ",format(proc.time()["elapsed"]-ptm,width=6,nsmall=2,digits=2),"s)\n")) @@ -173,7 +196,7 @@ calc_NPI_NDC <- function(policyregions = "iso", addtable(ndc_aff[,c(-2,-3)]) ndc_aff <- calc_policy(ndc_aff, land_stock, pol_type="aff", pol_mapping=pol_mapping, weight=dimSums(land_stock[,2005,c("crop","past")]), - spatialheader_file=spatialheader_file, spam_file=spam_file) + map_file=map_file) getNames(ndc_aff) <- "ndc" #set all values before 2015 to NPI values; copy the values til 2010 from the NPI data ndc_aff[,which(getYears(ndc_aff,as.integer=TRUE)<=2020),] <- @@ -209,11 +232,9 @@ calc_flows <- function(stock) { ### calc npi & ndc policy calc_policy <- function(policy, stock, pol_type="aff", pol_mapping=pol_mapping, - weight=NULL, spatialheader_file = "../../input/spatial_header.rda", - spam_file = Sys.glob("../../input/*-to-*_sum.spam")) { + weight=NULL, map_file = Sys.glob("../../input/clustermap_rev*.rds")) { ## pol_type = {"aff","ad"} - require(luscale) require(madrat) #extent stock beyond last observed value with constant values from the last year @@ -227,7 +248,7 @@ calc_policy <- function(policy, stock, pol_type="aff", pol_mapping=pol_mapping, tp <- getYears(stock, as.integer=TRUE) #select and filter countries that exist in the chosen policy mapping - policy_countries <- intersect(policy$dummy,unique(pol_mapping)) + policy_countries <- intersect(policy$dummy,unique(pol_mapping$policyregions)) policy <- policy[policy$dummy %in% policy_countries,] #create key to distinguish different cases of baseyear, targetyear combinations @@ -247,7 +268,7 @@ calc_policy <- function(policy, stock, pol_type="aff", pol_mapping=pol_mapping, #Initialize magpie_policy with 0 (country level) #This is a return object of this function and contains policy targets at #cluster level - magpie_policy <- new.magpie(unique(pol_mapping),tp,NULL,0) + magpie_policy <- new.magpie(unique(pol_mapping$policyregions),tp,NULL,0) keys <- unique(policy$key) for (i in keys) { #get baseyear and targetyear @@ -284,19 +305,26 @@ calc_policy <- function(policy, stock, pol_type="aff", pol_mapping=pol_mapping, } #calculate the reduction target in absolute numbers - rel <- data.frame(from=pol_mapping,to=paste(pol_mapping,1:length(pol_mapping),sep="."), stringsAsFactors = FALSE) + if(dim(pol_mapping)[1] == 59199) { + rel <- data.frame(from=pol_mapping$policyregions,to=paste(pol_mapping$policyregions,1:59199,sep="."), stringsAsFactors = FALSE) + countryCell <- paste(pol_mapping$iso,1:59199,sep=".") + } else { + lon <- sub(".", "p", pol_mapping$lon, fixed = TRUE) + lat <- sub(".", "p", pol_mapping$lat, fixed = TRUE) + rel <- data.frame(from=pol_mapping$policyregions,to=paste(lon, lat, pol_mapping$policyregions,sep="."), stringsAsFactors = FALSE) + countryCell <- paste(lon, lat, pol_mapping$iso,sep=".") + } if(pol_type=="aff") { magpie_policy <- madrat::toolAggregate(x=magpie_policy, rel=rel, weight=weight) } else if(pol_type=="ad") { - magpie_policy <- speed_aggregate(x=magpie_policy, rel=rel) + magpie_policy <- madrat::toolAggregate(x=magpie_policy, rel=rel) t_periods <- calc_tperiods(c(tp[1],tp)) magpie_policy <- magpie_policy * flow * t_periods + stock } - load(spatialheader_file) - getCells(magpie_policy) <- spatial_header - - magpie_policy <- speed_aggregate(magpie_policy,spam_file) + map <- readRDS(map_file) + getItems(magpie_policy, dim = 1, raw = TRUE) <- map$cell + magpie_policy <- madrat::toolAggregate(magpie_policy,map) return(magpie_policy) } diff --git a/scripts/output/comparison_validation.R b/scripts/output/comparison_validation.R index 2e89d48b4f..68dc26672d 100644 --- a/scripts/output/comparison_validation.R +++ b/scripts/output/comparison_validation.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -12,10 +12,11 @@ library(mip) library(magpie4) +library(gms) ############################# BASIC CONFIGURATION ############################# if(!exists("source_include")) { - outputdirs <-"." + outputdir <-"." } hist <- "input/validation.mif" file <- paste0("comparison_validation_",format(Sys.time(), "%Y%H%M%S"),".pdf") @@ -23,14 +24,14 @@ file <- paste0("comparison_validation_",format(Sys.time(), "%Y%H%M%S"),".pdf" x <- NULL; i <- 1 for(outputdir in outputdirs) { - config <- path(outputdir,"config.Rdata") + config <- file.path(outputdir,"config.yml") if(file.exists(config)) { - load(config) + cfg <- gms::loadConfig(config) title <- cfg$title } else { title <- paste0("run",i) } - gdx <- paste0(outputdir, "/fulldata.gdx") + gdx <- paste0(outputdir_x, "/fulldata.gdx") if(!is.null(x)) { scenarios <- getNames(x,dim=2) if(title %in% scenarios) { diff --git a/scripts/output/extra/disaggregation_cropsplit.R b/scripts/output/deprecated/disaggregation_cropsplit.R similarity index 82% rename from scripts/output/extra/disaggregation_cropsplit.R rename to scripts/output/deprecated/disaggregation_cropsplit.R index 19c20e3b24..f4e92ba427 100644 --- a/scripts/output/extra/disaggregation_cropsplit.R +++ b/scripts/output/deprecated/disaggregation_cropsplit.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -25,6 +25,7 @@ library(lucode2) library(magpie4) library(luscale) +library(gms) ############################# BASIC CONFIGURATION ####################################### land_lr_file <- "avl_land_t.cs3" @@ -45,7 +46,7 @@ if(!exists("source_include")) { } ######################################################################################### -load(paste0(outputdir, "/config.Rdata")) +cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) title <- cfg$title print(title) @@ -69,10 +70,10 @@ print(sum_spam_file) # Load input data -gdx <- path(outputdir,"fulldata.gdx") +gdx <- file.path(outputdir,"fulldata.gdx") land_ini_lr <- readGDX(gdx,"f10_land","f_land", format="first_found")[,"y1995",] land_lr <- land(gdx,sum=FALSE,level="cell") -land_ini_hr <- read.magpie(path(in_folder,land_hr_file))[,"y1995",] +land_ini_hr <- read.magpie(file.path(in_folder,land_hr_file))[,"y1995",] land_ini_hr <- land_ini_hr[,,getNames(land_lr)] if(any(land_ini_hr < 0)) { warning(paste0("Negative values in inital high resolution dataset detected and set to 0. Check the file ",land_hr_file)) @@ -84,14 +85,14 @@ print("Interpolation") land_hr <- interpolate( x = land_lr, x_ini_lr = land_ini_lr, x_ini_hr = land_ini_hr, - spam = path(outputdir,sum_spam_file), + spam = file.path(outputdir,sum_spam_file), prev_year = prev_year) # Write outputs # Write spam files (crop weighted for each time step) -for(y in getYears(land_hr)) create_spam(land_hr[,y,"crop"],read.spam(path(outputdir,sum_spam_file)),fname=path(outputdir,sub("sum",paste("crop_weighted_mean",y,sep="_"),sum_spam_file))) +for(y in getYears(land_hr)) create_spam(land_hr[,y,"crop"],read.spam(file.path(outputdir,sum_spam_file)),fname=file.path(outputdir,sub("sum",paste("crop_weighted_mean",y,sep="_"),sum_spam_file))) # Disaggregate other cellular files reshape_folder(outputdir) @@ -114,7 +115,7 @@ area_shr[is.nan(area_shr)] <- 0 area_shr[is.infinite(area_shr)] <- 0 # disaggregate share of crop types in terms of croparea to 0.5 resolution -area_shr_hr <- speed_aggregate(area_shr,t(read.spam(path(outputdir,sum_spam_file)))) +area_shr_hr <- speed_aggregate(area_shr,t(read.spam(file.path(outputdir,sum_spam_file)))) # calculate crop tpye specific croparea in 0.5 resolution area_hr <- area_shr_hr*setNames(land_hr[,,"crop"],NULL) @@ -133,12 +134,12 @@ land_hr <- land_hr[,,"crop",invert=TRUE] #combine land_hr with crop_hr. land_hr <- mbind(crop_hr,land_hr) #write landpool -write.magpie(land_hr,path(outputdir,paste(land_hr_out_file,sep="_")),comment="unit: Mha per grid-cell") -write.magpie(land_hr,path(outputdir,paste(sub(".mz",".nc",land_hr_out_file),sep="_")),comment="unit: Mha per grid-cell", verbose=FALSE) +write.magpie(land_hr,file.path(outputdir,paste(land_hr_out_file,sep="_")),comment="unit: Mha per grid-cell") +write.magpie(land_hr,file.path(outputdir,paste(sub(".mz",".nc",land_hr_out_file),sep="_")),comment="unit: Mha per grid-cell", verbose=FALSE) print("Write netCDF outputs #2") #calculate share of land pools in terms of tatal cell size land_shr_hr <- land_hr/dimSums(land_hr,dim=3.1) #write landpool shares -write.magpie(land_shr_hr,path(outputdir,paste(land_hr_share_out_file,sep="_")),comment="unit: grid-cell land area fraction") -write.magpie(land_shr_hr,path(outputdir,paste(sub(".mz",".nc",land_hr_share_out_file),sep="_")),comment="unit: grid-cell land area fraction", verbose=FALSE) +write.magpie(land_shr_hr,file.path(outputdir,paste(land_hr_share_out_file,sep="_")),comment="unit: grid-cell land area fraction") +write.magpie(land_shr_hr,file.path(outputdir,paste(sub(".mz",".nc",land_hr_share_out_file),sep="_")),comment="unit: grid-cell land area fraction", verbose=FALSE) diff --git a/scripts/output/extra/disaggregation_transitions.R b/scripts/output/deprecated/disaggregation_transitions.R similarity index 78% rename from scripts/output/extra/disaggregation_transitions.R rename to scripts/output/deprecated/disaggregation_transitions.R index f891d4379b..d062d47fcb 100644 --- a/scripts/output/extra/disaggregation_transitions.R +++ b/scripts/output/deprecated/disaggregation_transitions.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -16,6 +16,7 @@ library(lucode2) library(magpie4) library(luscale) library(madrat) +library(gms) ############################# BASIC CONFIGURATION ####################################### land_lr_file <- "avl_land_t.cs3" @@ -36,7 +37,7 @@ if(!exists("source_include")) { } ######################################################################################### -load(paste0(outputdir, "/config.Rdata")) +cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) title <- cfg$title print(title) @@ -61,10 +62,10 @@ print(sum_spam_file) ### Land Stock # Load input data -gdx <- path(outputdir,"fulldata.gdx") +gdx <- file.path(outputdir,"fulldata.gdx") land_ini_lr <- readGDX(gdx,"f10_land","f_land", format="first_found")[,"y1995",] land_lr <- land(gdx,sum=FALSE,level="cell") -land_ini_hr <- read.magpie(path(in_folder,land_hr_file))[,"y1995",] +land_ini_hr <- read.magpie(file.path(in_folder,land_hr_file))[,"y1995",] land_ini_hr <- land_ini_hr[,,getNames(land_lr)] if(any(land_ini_hr < 0)) { warning(paste0("Negative values in inital high resolution dataset detected and set to 0. Check the file ",land_hr_file)) @@ -76,7 +77,7 @@ print("Disaggregation Land Stock") land_hr <- interpolate( x = land_lr, x_ini_lr = land_ini_lr, x_ini_hr = land_ini_hr, - spam = path(outputdir,sum_spam_file), + spam = file.path(outputdir,sum_spam_file), prev_year = prev_year) land_hr <- land_hr[,-1,] @@ -87,12 +88,12 @@ CountryToCell <- toolGetMapping("CountryToCellMapping.csv", type = "cell") land_lr <- readGDX(gdx,"ov10_lu_transitions",select = list(type="level"),react = "silent") if(is.null(land_lr)) stop("No land transitions available in GDX file") land_ini_hr <- new.magpie(CountryToCell$cell,NULL,getNames(land_lr),fill = 0) -x <- read.magpie(path(in_folder,land_hr_file))[,"y1995",] +x <- read.magpie(file.path(in_folder,land_hr_file))[,"y1995",] x <- x[,,getNames(land_lr,dim=1)] for (i in getNames(land_lr,dim=1)) { - land_ini_hr[,,paste(i,i,sep=".")] <- x[,,i] + land_ini_hr[,,paste(i,i,sep=".")] <- x[,,i] } -land_ini_lr <- speed_aggregate(land_ini_hr,path(outputdir,sum_spam_file)) +land_ini_lr <- speed_aggregate(land_ini_hr,file.path(outputdir,sum_spam_file)) getCells(land_ini_lr) <- getCells(land_lr) # Interpolate Transitions @@ -100,7 +101,7 @@ print("Disaggregation Land Transitions") land_trans_hr <- interpolate( x = land_lr, x_ini_lr = land_ini_lr, x_ini_hr = land_ini_hr, - spam = path(outputdir,sum_spam_file), + spam = file.path(outputdir,sum_spam_file), prev_year = prev_year) land_trans_hr <- land_trans_hr[,-1,] @@ -114,12 +115,12 @@ if(max(test)>0.1||min(test)< -0.1) warning("Sum over land transitions and land s print("Write outputs cell.land") # write landpool -write.magpie(land_trans_hr,path(outputdir,paste(land_hr_out_file,sep="_")),comment="unit: Mha per grid-cell") -write.magpie(land_trans_hr,path(outputdir,paste(sub(".mz",".nc",land_hr_out_file),sep="_")),comment="unit: Mha per grid-cell", verbose=FALSE) +write.magpie(land_trans_hr,file.path(outputdir,paste(land_hr_out_file,sep="_")),comment="unit: Mha per grid-cell") +write.magpie(land_trans_hr,file.path(outputdir,paste(sub(".mz",".nc",land_hr_out_file),sep="_")),comment="unit: Mha per grid-cell", verbose=FALSE) print("Write outputs cell.land_share") # calculate share of land pools in terms of tatal cell size land_trans_hr_shr <- land_trans_hr/dimSums(land_trans_hr,dim=3) # write landpool shares -write.magpie(land_trans_hr_shr,path(outputdir,paste(land_hr_share_out_file,sep="_")),comment="unit: grid-cell land area fraction") -write.magpie(land_trans_hr_shr,path(outputdir,paste(sub(".mz",".nc",land_hr_share_out_file),sep="_")),comment="unit: grid-cell land area fraction", verbose=FALSE) +write.magpie(land_trans_hr_shr,file.path(outputdir,paste(land_hr_share_out_file,sep="_")),comment="unit: grid-cell land area fraction") +write.magpie(land_trans_hr_shr,file.path(outputdir,paste(sub(".mz",".nc",land_hr_share_out_file),sep="_")),comment="unit: grid-cell land area fraction", verbose=FALSE) diff --git a/scripts/output/extra/ForestChangeCluster.R b/scripts/output/extra/ForestChangeCluster.R new file mode 100644 index 0000000000..152e989f9f --- /dev/null +++ b/scripts/output/extra/ForestChangeCluster.R @@ -0,0 +1,64 @@ +# | (C) 2008-2023 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: Compares Forest Area Change at Cluster Level +# comparison script: TRUE +# --------------------------------------------------------------- + +# Version 1.0, Florian Humpenoeder +# +library(lucode2) +library(magclass) +library(luplot) +library(magpie4) +library(ggplot2) +library(gms) +library(dplyr) + +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") + +forest <- NULL +missing <- NULL + +for (i in 1:length(outputdir)) { + print(paste("Processing",outputdir[i])) + #gdx file + gdx<-file.path(outputdir[i],"fulldata.gdx") + if(file.exists(gdx)) { + #get scenario name + cfg <- gms::loadConfig(file.path(outputdir[i], "config.yml")) + scen <- cfg$title + #read-in reporting file + x <- dimSums(land(gdx,level="cell")[,,c("forestry","primforest","secdforest")],dim=3) + x <- x-setYears(x[,2020,],NULL) + x <- x[,getYears(x,as.integer = T)>=2020 & getYears(x,as.integer = T)<=2100,] + getNames(x) <- scen + forest <- mbind(forest,x) + } else missing <- c(missing,outputdir[i]) +} +if (!is.null(missing)) { + cat("\nList of folders with missing fulldata.gdx\n") + print(missing) +} + +forest <- as.data.frame(forest) +saveRDS(forest,"output/ForestChangeCluster.rds") +write.csv(forest, "output/ForestChangeCluster.csv",quote=F, row.names=F) + +p <- ggplot(forest,aes(x=Year,y=Value)) + geom_line(aes(color=Cell,group=Cell)) + facet_wrap(vars(Data1),ncol = 4) + scale_color_viridis_c() + ggtitle("Forest Cover Change") + ylab("Mha compared to 2020") + theme_bw() + theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5)) +ggsave("output/ForestChangeCluster.pdf",p,bg = "white",width = 12,height = 5) +ggsave("output/ForestChangeCluster.png",p,bg = "white",width = 12,height = 5) diff --git a/scripts/output/extra/aff_area.R b/scripts/output/extra/aff_area.R index 77f77ea002..e52798f9b7 100644 --- a/scripts/output/extra/aff_area.R +++ b/scripts/output/extra/aff_area.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -17,12 +17,13 @@ library(magclass) library(luplot) library(magpie4) library(ggplot2) +library(gms) options(error=function()traceback(2)) ############################# BASIC CONFIGURATION ############################# if(!exists("source_include")) { - outputdirs <- path("output/",list.dirs("output/", full.names = FALSE, recursive = FALSE)) + outputdirs <- file.path("output/",list.dirs("output/", full.names = FALSE, recursive = FALSE)) #Define arguments that can be read from command line lucode2::readArgs("outputdirs") } @@ -35,10 +36,10 @@ missing <- NULL for (i in 1:length(outputdirs)) { print(paste("Processing",outputdirs[i])) #gdx file - gdx<-path(outputdirs[i],"fulldata.gdx") + gdx<-file.path(outputdirs[i],"fulldata.gdx") if(file.exists(gdx)) { #get scenario name - load(path(outputdirs[i],"config.Rdata")) + cfg <- gms::loadConfig(file.path(outputdirs[i], "config.yml")) scen <- cfg$title #read-in reporting file x <- collapseNames(land(gdx,level="glo")[,,"forestry"]) diff --git a/scripts/output/extra/disaggregation.R b/scripts/output/extra/disaggregation.R index 1524675e14..41c2438ab2 100644 --- a/scripts/output/extra/disaggregation.R +++ b/scripts/output/extra/disaggregation.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -10,125 +10,407 @@ # comparison script: FALSE # --------------------------------------------------------------- -#Version 1.03 - Jan Philipp Dietrich -# 1.00: first working version -# 1.01: execution of reshape_folder function added at the end -# 1.02: uses now the land function to read the simulated land input -# 1.03: introduced function interpolate, all possible input is read from the GDX file now - library(lucode2) library(magpie4) library(luscale) +library(madrat) +library(dplyr) +library(gms) + +# ============================================= +# Basic configuration +# ============================================= +if (!exists("source_include")) { + outputdir <- "output/LAMA65_Sustainability/" + readArgs("outputdir") +} +map_file <- Sys.glob(file.path(outputdir, "clustermap_*.rds")) +gdx <- file.path(outputdir, "fulldata.gdx") +land_hr_file <- file.path(outputdir, "avl_land_full_t_0.5.mz") +urban_land_hr_file <- file.path(outputdir, "f34_urbanland_0.5.mz") +land_hr_out_file <- file.path(outputdir, "cell.land_0.5.mz") +land_hr_share_out_file <- file.path(outputdir, "cell.land_0.5_share.mz") +croparea_hr_share_out_file <- file.path(outputdir, "cell.croparea_0.5_share.mz") +land_hr_split_file <- file.path(outputdir, "cell.land_split_0.5.mz") +land_hr_shr_split_file <- file.path(outputdir, "cell.land_split_0.5_share.mz") +luh_side_layers <- file.path(outputdir, "luh2_side_layers_0.5.mz") +bii_hr_out_file <- file.path(outputdir, "cell.bii_0.5.mz") + +cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) + +withr::local_options(list(magclass_sizeLimit = 1e+12)) + +if (length(map_file) == 0) stop("Could not find map file!") +if (length(map_file) > 1) { + warning("More than one map file found. First occurrence will be used!") + map_file <- map_file[1] +} + + +# ----------------------------------------- +# Output functions +# ----------------------------------------- + +.writeDisagg <- function(x, file, comment, message) { + write.magpie(x, file, comment = comment) + write.magpie(x, sub(".mz", ".nc", file), comment = comment, verbose = FALSE) +} -############################# BASIC CONFIGURATION ####################################### -land_lr_file <- "avl_land_t.cs3" -land_hr_file <- "avl_land_t_0.5.mz" -land_hr_out_file <- "cell.land_0.5.mz" -land_hr_share_out_file <- "cell.land_0.5_share.mz" -croparea_hr_share_out_file <- "cell.croparea_0.5_share.mz" +.dissagcrop <- function(gdx, land_hr, map) { + area <- croparea(gdx, + level = "cell", products = "kcr", + product_aggr = FALSE, water_aggr = FALSE + ) + fallow <- fallow(gdx, level = "cell") + area_shr <- area / (dimSums(area, dim = 3) + setNames(fallow, NULL) + 10^-10) -prev_year <- "y1985" #timestep before calculations in MAgPIE -in_folder <- "modules/10_land/input" + # calculate share of crop land on total cell area + crop_shr <- land_hr / dimSums(land_hr, dim = 3) + crop_shr <- setNames(crop_shr[, getYears(area_shr), "crop"], NULL) -if(!exists("source_include")) { - sum_spam_file <- "0.5-to-n200_sum.spam" - title <- "base_run" - outputdir <- "output/SSP2_Ref_c200" + # calculate crop area as share of total cell area + area_shr_hr <- madrat::toolAggregate(area_shr, map, to = "cell") * crop_shr + return(area_shr_hr) +} + +.dissagBII <- function(gdx, map, dir) { + # Biodiversity intactness indicator (BII) at cluster level + bii_lr <- BII(gdx, + file = NULL, level = "cell", mode = "auto", landClass = "all", + bii_coeff = NULL, side_layers = NULL, dir = dir + ) + + # 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 - ###Define arguments that can be read from command line - readArgs("sum_spam_file","outputdir","title") + # Disaggregate BII coefficients to grid cell level + bii_hr <- toolAggregate(x = bii_lr, rel = map_file, from = "cluster", to = "cell") + return(bii_hr) } -######################################################################################### - -load(paste0(outputdir, "/config.Rdata")) -title <- cfg$title -print(title) - -# Function to extract information from info.txt -get_info <- function(file, grep_expression, sep, pattern="", replacement="") { - if(!file.exists(file)) return("#MISSING#") - file <- readLines(file, warn=FALSE) - tmp <- grep(grep_expression, file, value=TRUE) - tmp <- strsplit(tmp, sep) - tmp <- sapply(tmp, "[[", 2) - tmp <- gsub(pattern, replacement ,tmp) - if(all(!is.na(as.logical(tmp)))) return(as.vector(sapply(tmp, as.logical))) - if (all(!(regexpr("[a-zA-Z]",tmp) > 0))) { - tmp <- as.numeric(tmp) + +.extend2luhv2 <- function(x, land = deparse(substitute(x))) { + if (land == "land_lr") { + grassland_areas <- readGDX(gdx, "ov31_grass_area")[, , "level"] + grassland_areas <- collapseNames(grassland_areas) + land_lr <- mbind(x, grassland_areas) + drop_past <- !grepl("past$", getNames(land_lr)) + land_lr <- land_lr[, , drop_past] + getNames(land_lr) <- gsub("pastr", "past", getNames(land_lr)) + return(land_lr) + } + + if (land == "land_ini_lr") { + grassland_areas <- readGDX(gdx, "ov31_grass_area")[, "y1995", "level"] + grassland_areas <- collapseNames(grassland_areas) + land_ini_lr <- mbind(x, grassland_areas) + drop_past <- !grepl("past$", getNames(land_ini_lr)) + land_ini_lr <- land_ini_lr[, , drop_past] + getNames(land_ini_lr) <- gsub("pastr", "past", getNames(land_ini_lr)) + return(land_ini_lr) } - return(tmp) } -low_res <- get_info(paste0(outputdir,"/info.txt"),"^\\* Output ?resolution:",": ") -sum_spam_file <- paste0("0.5-to-",low_res,"_sum.spam") -print(sum_spam_file) +# ======================================== +# Prepare data for disaggregation +# ======================================== # Load input data -gdx <- path(outputdir,"fulldata.gdx") -land_ini_lr <- readGDX(gdx,"f10_land","f_land", format="first_found")[,"y1995",] -land_lr <- land(gdx,sum=FALSE,level="cell") -land_ini_hr <- read.magpie(path(in_folder,land_hr_file))[,"y1995",] -land_ini_hr <- land_ini_hr[,,getNames(land_lr)] -if(any(land_ini_hr < 0)) { - warning(paste0("Negative values in inital high resolution dataset detected and set to 0. Check the file ",land_hr_file)) - land_ini_hr[which(land_ini_hr < 0,arr.ind = T)] <- 0 +land_ini_lr <- readGDX(gdx, "f10_land", "f_land", format = "first_found")[, "y1995", ] +land_lr <- land(gdx, sum = FALSE, level = "cell") +land_ini_hr <- read.magpie(land_hr_file)[, "y1995", ] + +### Make sure grassland types are consistent +magpie2luh2 <- data.frame(matrix(nrow = 4, ncol = 2)) +names(magpie2luh2) <- c("MAgPIE", "LUH2") +magpie2luh2[1, ] <- c("crop", "crop") +magpie2luh2[4, ] <- c("urban", "urban") +magpie2luh2[5, ] <- c("primforest", "primforest") +magpie2luh2[6, ] <- c("secdforest", "secdforest") +magpie2luh2[7, ] <- c("forestry", "forestry") +magpie2luh2[8, ] <- c("other", "primother") +magpie2luh2[9, ] <- c("other", "secdother") + +if (grepl("grass", cfg$gms$past)) { + land_lr <- .extend2luhv2(land_lr) + land_ini_lr <- .extend2luhv2(land_ini_lr) + magpie2luh2[3, ] <- c("range", "range") + magpie2luh2[2, ] <- c("past", "past") +} else { + magpie2luh2[3, ] <- c("past", "range") + magpie2luh2[2, ] <- c("past", "past") +} + +land_ini_hr <- madrat::toolAggregate(land_ini_hr, magpie2luh2, from = "LUH2", to = "MAgPIE", dim = 3.1) +land_ini_hr <- land_ini_hr[, , getNames(land_lr)] +if (any(land_ini_hr < 0)) { + warning(paste0("Negative values in inital high resolution dataset detected and set to 0. Check the file ", land_hr_file)) + land_ini_hr[which(land_ini_hr < 0, arr.ind = T)] <- 0 +} + +### Read in hr urban land +if (cfg$gms$urban == "exo_nov21") { + urban_land_hr <- read.magpie(urban_land_hr_file) + ssp <- cfg$gms$c34_urban_scenario + urban_land_hr <- urban_land_hr[, , ssp] + getNames(urban_land_hr) <- "urban" +} else if (cfg$gms$urban == "static") { + urban_land_hr <- "static" +} + +### Get land conservation data +wdpa_hr <- NULL +if (file.exists(file.path(outputdir, "wdpa_baseline_0.5.mz"))) { + wdpa_hr <- file.path(outputdir, "wdpa_baseline_0.5.mz") +} +consv_prio_hr <- NULL +if (!all(c(cfg$gms$c22_protect_scenario, cfg$gms$c22_protect_scenario_noselect) %in% "none")) { + if (file.exists(file.path(outputdir, "consv_prio_areas_0.5.mz"))) { + consv_prio_all <- read.magpie(file.path(outputdir, "consv_prio_areas_0.5.mz")) + consv_prio_hr <- new.magpie( + cells = getCells(consv_prio_all), + names = getNames(consv_prio_all, dim = 2), fill = 0 + ) + iso <- readGDX(gdx, "iso") + consv_iso <- readGDX(gdx, "policy_countries22") + consv_iso <- consv_iso[consv_iso %in% getItems(consv_prio_all, dim = 1.1)] + consv_select <- cfg$gms$c22_protect_scenario + consv_noselect <- cfg$gms$c22_protect_scenario_noselect + + if (consv_noselect != "none") { + consv_prio_hr <- collapseDim(consv_prio_all[, , consv_noselect], dim = 3.1) + } + if (consv_select != "none") { + consv_prio_hr[consv_iso, , ] <- collapseDim(consv_prio_all[consv_iso, , consv_select], dim = 3.1) + } else if (consv_select == "none") { + consv_prio_hr[consv_iso, , ] <- 0 + } + } } -# Start interpolation (use interpolate from luscale) -print("Disaggregation") -land_hr <- interpolate( x = land_lr, - x_ini_lr = land_ini_lr, - x_ini_hr = land_ini_hr, - spam = path(outputdir,sum_spam_file), - prev_year = prev_year) +### Account for country-specific SNV shares in post-processing +iso <- readGDX(gdx, "iso") +snv_pol_iso <- readGDX(gdx, "policy_countries30") +snv_pol_select <- readGDX(gdx, "s30_snv_shr", "s30_set_aside_shr") +snv_pol_noselect <- readGDX(gdx, "s30_snv_shr_noselect", "s30_set_aside_shr_noselect") +snv_pol_shr <- new.magpie(iso, fill = snv_pol_noselect) +snv_pol_shr[snv_pol_iso, , ] <- snv_pol_select + +avl_cropland_hr <- file.path(outputdir, "avl_cropland_0.5.mz") # available cropland (at high resolution) +marginal_land <- cfg$gms$c30_marginal_land # marginal land scenario +target_year <- cfg$gms$c30_snv_target # target year of SNV policy (default: "none") +if (is.null(target_year)) { + target_year <- cfg$gms$c30_set_aside_target +} +snv_pol_fader <- readGDX(gdx, "f30_scenario_fader", "f30_set_aside_fader", + format = "first_found", react = "silent" +)[, , target_year] +if (is.null(snv_pol_fader)) { + snv_pol_fader <- readGDX(gdx, "p30_snv_scenario_fader", format = "first_found") +} + +# ============================================ +# Start disaggregation +# ============================================ + +# --------------------------------- +# Disaggregate MAgPIE land pools +# --------------------------------- +# Start interpolation (use interpolateAvlCroplandWeighted from luscale) +message("Disaggregating MAgPIE land pools") +land_hr <- interpolateAvlCroplandWeighted( + x = land_lr, + x_ini_lr = land_ini_lr, + x_ini_hr = land_ini_hr, + avl_cropland_hr = avl_cropland_hr, + map = map_file, + marginal_land = marginal_land, + snv_pol_shr = snv_pol_shr, + snv_pol_fader = snv_pol_fader, + urban_land_hr = urban_land_hr, + wdpa_hr = wdpa_hr, + consv_prio_hr = consv_prio_hr +) -# Write outputs +# Write output +.writeDisagg(land_hr, land_hr_out_file, + comment = "unit: Mha per grid-cell", + message = "Write outputs cell.land" +) +.writeDisagg(land_hr / dimSums(land_hr, dim = 3.1), land_hr_share_out_file, + comment = "unit: grid-cell land area fraction", + message = "Write outputs cell.land_share" +) +gc() -print("Write outputs cell.land") -# write landpool -write.magpie(land_hr,path(outputdir,paste(land_hr_out_file,sep="_")),comment="unit: Mha per grid-cell") -write.magpie(land_hr,path(outputdir,paste(sub(".mz",".nc",land_hr_out_file),sep="_")),comment="unit: Mha per grid-cell", verbose=FALSE) +# --------------------------------- +# Disaggregate MAgPIE crop types +# --------------------------------- -print("Write outputs cell.land_share") -# calculate share of land pools in terms of tatal cell size -land_shr_hr <- land_hr/dimSums(land_hr,dim=3.1) -# write landpool shares -write.magpie(land_shr_hr,path(outputdir,paste(land_hr_share_out_file,sep="_")),comment="unit: grid-cell land area fraction") -write.magpie(land_shr_hr,path(outputdir,paste(sub(".mz",".nc",land_hr_share_out_file),sep="_")),comment="unit: grid-cell land area fraction", verbose=FALSE) +message("Disaggregating MAgPIE crop types") +area_shr_hr <- .dissagcrop(gdx, land_hr, map = map_file) -# Write spam files (crop weighted for each time step) -for(y in getYears(land_hr)) create_spam(land_hr[,y,"crop"],read.spam(path(outputdir,sum_spam_file)),fname=path(outputdir,sub("sum",paste("crop_weighted_mean",y,sep="_"),sum_spam_file))) +# Write output +.writeDisagg(area_shr_hr, croparea_hr_share_out_file, + comment = "unit: croparea fractions of total grid-cell", + message = "Write outputs cell.cropara_share" +) +gc() -# Disaggregate other cellular files -reshape_folder(outputdir) +# --------------------------------- +# Split land pools +# --------------------------------- +land_split_hr <- land_hr[, getYears(area_shr_hr), ] +area_hr <- area_shr_hr * dimSums(land_split_hr, dim = 3) + +# replace crop in land_hr in with crop_kfo_rf, crop_kfo_ir, crop_kbe_rf +# and crop_kbe_ir +kbe <- c("betr", "begr") +kfo <- setdiff(getNames(area_hr, dim = 1), kbe) +crop_kfo_rf <- setNames( + dimSums(area_hr[, , kfo][, , "rainfed"], dim = 3), + "crop_kfo_rf" +) +crop_kfo_ir <- setNames( + dimSums(area_hr[, , kfo][, , "irrigated"], dim = 3), + "crop_kfo_ir" +) +crop_kbe_rf <- setNames( + dimSums(area_hr[, , kbe][, , "rainfed"], dim = 3), + "crop_kbe_rf" +) +crop_kbe_ir <- setNames( + dimSums(area_hr[, , kbe][, , "irrigated"], dim = 3), + "crop_kbe_ir" +) +crop_hr <- mbind(crop_kfo_rf, crop_kfo_ir, crop_kbe_rf, crop_kbe_ir) +# calculate Fallow +fallow <- setNames(land_split_hr[, , "crop"] - dimSums(area_hr, dim = 3), "fallow") +# drop crop +land_split_hr <- land_split_hr[, , "crop", invert = TRUE] +# combine land_split_hr with crop_hr. +land_split_hr <- mbind(crop_hr, fallow, land_split_hr) + +# split "forestry" into timber plantations, pre-scribed afforestation (NPi/NDC) and endogenous afforestation (CO2 price driven) +message("Disaggregating forestry") +farea <- dimSums(landForestry(gdx, level = "cell"), dim = "ac") +farea_shr <- farea / (dimSums(farea, dim = 3) + 10^-10) +# calculate forestry area as share of total cell area +farea_hr <- madrat::toolAggregate(farea_shr, map_file, to = "cell") * setNames(land_split_hr[, , "forestry"], NULL) +# check +if (abs(sum(dimSums(farea_hr, dim = 3) - setNames(land_split_hr[, , "forestry"], NULL), na.rm = T)) > 0.1) warning("large Difference in crop disaggregation detected!") +# rename +df <- data.frame(matrix(nrow = 3, ncol = 2)) +names(df) <- c("internal", "output") +df[1, ] <- c("aff", "PlantedForest_Afforestation") +df[2, ] <- c("ndc", "PlantedForest_NPiNDC") +df[3, ] <- c("plant", "PlantedForest_Timber") +farea_hr <- madrat::toolAggregate(farea_hr, df, from = "internal", to = "output", dim = 3.1) + +# drop forestry +land_split_hr <- land_split_hr[, , "forestry", invert = TRUE] +# combine land_split_hr with farea_hr +land_split_hr <- mbind(land_split_hr, farea_hr) + +# Write output +.writeDisagg(land_split_hr, land_hr_split_file, + comment = "unit: Mha per grid-cell", + message = "Write cropsplit land area" +) +.writeDisagg(land_split_hr / dimSums(land_split_hr, dim = 3), land_hr_shr_split_file, + comment = "unit: grid-cell land area fraction", + message = "Write cropsplit land area share" +) +gc() + +# -------------------------------- +# Disaggregate BII +# -------------------------------- + +message("Disaggregating BII values") + +# Load input data for BII disaggregation +land_ini_hr <- read.magpie(land_hr_file)[, "y1995", ] +side_layers_hr <- read.magpie(luh_side_layers) +landArea <- dimSums(land_ini_hr, dim = 3) +side_layers_lr <- toolAggregate(x = side_layers_hr, rel = map_file, weight = landArea, from = "cell", to = "cluster") + +# Convert land types for BII disaggregation +land_ini_hr <- mbind( + land_ini_hr[, , c("primother", "secdother"), invert = TRUE], + setNames(dimSums(land_ini_hr[, , c("primother", "secdother")], dim = 3), + nm = "other" + ) +) +getNames(land_ini_hr) <- gsub( + "past", "manpast", + gsub("range", "rangeland", getNames(land_ini_hr)) +) + +if (grepl("grass", cfg$gms$past)) { + getNames(land_ini_lr) <- gsub( + "past", "manpast", + gsub("range", "rangeland", getNames(land_ini_lr)) + ) + getNames(land_lr) <- gsub( + "past", "manpast", + gsub("range", "rangeland", getNames(land_lr)) + ) +} else { + # Disaggregate pasture + land_ini_lr <- mbind( + land_ini_lr[, , c("past"), invert = TRUE], + collapseNames(land_ini_lr[, , "past"]) * side_layers_lr[, , c("manpast", "rangeland")] + ) + + land_lr <- mbind( + land_lr[, , c("past"), invert = TRUE], + collapseNames(land_lr[, , "past"]) * side_layers_lr[, , c("manpast", "rangeland")] + ) +} -print("Disaggregation crop types") -# detailed output (crop types, rf + if), disaggregate shares of cropland within cluster level to cellular level -# get rid of y1985 -land_hr <- land_hr[,-1,] +# Sort and rename +land_ini_hr <- land_ini_hr[,,getNames(land_ini_lr)] +getSets(land_ini_hr)["d3.1"] <- "land" -# total crop tpye specific croparea -area <- croparea(gdx,level="cell",products="kcr",product_aggr=FALSE,water_aggr = FALSE) +# Disaggregate BII values to high resolution +bii_hr <- .dissagBII(gdx, map = map_file, dir = outputdir) -# share of crop types in terms of croparea -area_shr <- area/dimSums(area,dim=c(3.1,3.2)) +# Disaggregate land pools for BII estimation +land_bii_hr <- interpolateAvlCroplandWeighted( + x = land_lr, + x_ini_lr = land_ini_lr, + x_ini_hr = land_ini_hr, + avl_cropland_hr = avl_cropland_hr, + map = map_file, + marginal_land = marginal_land, + snv_pol_shr = snv_pol_shr, + snv_pol_fader = snv_pol_fader, + urban_land_hr = urban_land_hr, + wdpa_hr = wdpa_hr, + consv_prio_hr = consv_prio_hr, + unit = "share" +) -# set inf to 0 -area_shr[is.na(area_shr)] <- 0 -area_shr[is.nan(area_shr)] <- 0 -area_shr[is.infinite(area_shr)] <- 0 +# Add primary and secondaray other land +land_bii_hr <- PrimSecdOtherLand(land_bii_hr, land_hr_file) -# disaggregate share of crop types in terms of croparea to 0.5 resolution -area_shr_hr <- speed_aggregate(area_shr,t(read.spam(path(outputdir,sum_spam_file)))) +# specify potential natural vegetation +land_bii_hr <- land_bii_hr * side_layers_hr[, , c("forested", "nonforested")] -# calculate crop tpye specific croparea in 0.5 resolution -area_hr <- area_shr_hr*setNames(land_hr[,,"crop"],NULL) +# Sum over land classes +bii_hr <- dimSums(land_bii_hr * bii_hr, dim = 3, na.rm = TRUE) -# calculate share of crop types in terms of total cell size -area_shr_hr <- area_hr/dimSums(land_hr,dim=3.1) +# Write output +.writeDisagg(bii_hr, bii_hr_out_file, + comment = "unitless", + message = "Write output BII at 0.5°" +) +gc() -print("Write outputs cell.cropara_share") -# write share of crop types in terms of total cell size -write.magpie(area_shr_hr,path(outputdir,paste(croparea_hr_share_out_file,sep="_")),comment="unit: grid-cell land area fraction") -write.magpie(area_shr_hr,path(outputdir,paste(sub(".mz",".nc",croparea_hr_share_out_file),sep="_")),comment="unit: grid-cell land area fraction", verbose=FALSE) +message("Finished disaggregation") diff --git a/scripts/output/extra/disaggregation_LUH2.R b/scripts/output/extra/disaggregation_LUH2.R new file mode 100644 index 0000000000..0d013240de --- /dev/null +++ b/scripts/output/extra/disaggregation_LUH2.R @@ -0,0 +1,487 @@ +# | (C) 2008-2023 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: Interpolates MAgPIE results to 0.5 degree resolution in LUH2 format for ISIMIP 3b +# comparison script: FALSE +# ------------------------------------------------------------------------------------------------ + +library(lucode2) +library(magpie4) +library(luscale) +library(madrat) +library(raster) +library(mrcommons) + +############################# BASIC CONFIGURATION ############################## +if(!exists("source_include")) { + outputdir <- "/p/projects/magpie/data/ISIMIP/ISIMIP_150322/magpie/output/c1000_150322_Calib/ISIMIP_150322_med_ssp585_IPSL-CM6A-LR_cc_c1000/" + + readArgs("outputdir") +} + +map_file <- Sys.glob(file.path(outputdir, "clustermap_*.rds")) +gdx <- file.path(outputdir,"fulldata.gdx") +land_hr_file <- file.path(outputdir,"avl_land_full_t_0.5.mz") +urban_land_hr_file <- file.path(outputdir,"f34_urbanland_0.5.mz") +land_hr_out_file <- file.path(outputdir,"cell.land_0.5.mz") +croparea_hr_share_out_file <- file.path(outputdir,"cell.croparea_0.5_share.mz") + +cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) +if (!file.exists(file.path(outputdir,"cell.land_0.5.mz"))) stop('No disaggrated land use patterns found. Run "disaggregation.R" first!') +################################################################################ + + +#### Folder for saving results +out_dir<-paste0(outputdir,"/disaggregation_LUH2") + if(!dir.exists(out_dir)) dir.create(out_dir) + + +#### Year interpolation and re-projection from 0.5 to 0.25 degree + +convertLUH2 <- function(x) { + #interpolate years + years <- getYears(x,as.integer = TRUE) + x <- toolFillYears(x,seq(range(years)[1],range(years)[2],by=1)) + + + for(n in seq(1995,2085,15)){ + x_1<- if(n==1995) as.RasterBrick(x[,n:(n+15),]) else as.RasterBrick(x[,(n+1):(n+15),]) + x_aux<- if(n==1995) x_1 else stack(x_aux,x_1) + } + #re-project raster from 0.5 to 0.25 degree + x <- suppressWarnings(projectRaster(x_aux,raster(res=c(0.25,0.25)),method = "ngb")) + return(x) + +} + +withr::local_options(list(magclass_sizeLimit = 1e+12)) + + +#### Spatial mapping +if(length(map_file)==0) stop("Could not find map file!") +if(length(map_file)>1) { + warning("More than one map file found. First occurrence will be used!") + map_file <- map_file[1] +} + +#### Crops mapping and grid to cell mapping +mapping_spatial<-readRDS(map_file) +gdx<-paste0(outputdir,"/fulldata.gdx") +mapping<-calcOutput(type = "LUH2MAgPIE", aggregate = FALSE, share = "LUHofMAG", bioenergy = "fix", missing = "fill",rice="total")[,2010,] +if(!dir.exists(paste0(out_dir,"/mappingLUH2MAgPIE/"))) dir.create(paste0(out_dir,"/mappingLUH2MAgPIE")) +if(!file.exists(paste0(out_dir,"/mappingLUH2MAgPIE/LUH2MAgPIE.csv"))) write.csv(as.data.frame(mapping),file=paste0(out_dir,"/mappingLUH2MAgPIE/LUH2MAgPIE.csv")) +countries<-intersect(getCells(mapping),unique(mapping_spatial$country)) +mapping_spatial<-subset(mapping_spatial,country %in% countries) +map_LUHMAg_grid<-setYears(speed_aggregate(mapping[countries,,],rel=mapping_spatial,weight=NULL,from="country",to="cell",dim=1),NULL) + +#### calculates grid cell area of the earths sphere +land_hr <- read.magpie(land_hr_out_file) +land_hr <- land_hr[,-1,] +cal_area <- function(ix,iy,res=0.5,mha=1) { # pixelarea in m2, mha as factor + mha*(111.263*1000*res)*(111.263*1000*res)*cos(iy*pi/180.) +} + +# grid cell area as magclass object +coord <- mrcommons:::magpie_coord +grarea <- new.magpie(cells_and_regions=mapping_spatial$cell, + fill=cal_area(coord[,"lon"],coord[,"lat"], mha=10^-10)) +#grarea <- round(grarea,6) + +# adjust total grid land area so that it is smaller than the gridcell area (some cells have a larger area acually; should be investigated) +frac <- grarea/dimSums(land_hr, dim=3) +frac[frac>1] <- 1 +land_hr <- land_hr*frac + +land_hr_shr <- land_hr/dimSums(land_hr, dim=3) +land_hr_shr[is.na(land_hr_shr)] <- 0 + +#### Crops including bioenergy crops +crop_hr_shr<- read.magpie(croparea_hr_share_out_file) +crop_hr_shr[!is.finite(crop_hr_shr)]<-0 +crop_hr<-crop_hr_shr*dimSums(land_hr,dim=3) +crop_hr[!is.finite(crop_hr)]<-0 +bioener<-c("begr","betr") +noBioener<-getNames(crop_hr,dim=1)[!(getNames(crop_hr,dim=1)%in%bioener)] +crop_hr_noBio<-crop_hr[,,noBioener]*map_LUHMAg_grid[,,noBioener] + +names<-unique(getNames(collapseNames(crop_hr_noBio[,,"tece"]))) +crop_hr_LUH<-new.magpie(cells_and_regions=getCells(crop_hr_noBio),years=getYears(crop_hr_noBio),names=names) + +for(n in names){ +crop_hr_LUH[,,n]<-dimSums(crop_hr_noBio[,,n],dim=3.1) +} + +crop_hr_Bio<-setNames(crop_hr[,,bioener],c("c4per.rainfed","c4per.irrigated","c3per.rainfed","c3per.irrigated")) +crop_hr_LUH<-dimOrder(crop_hr_LUH,perm=c(2,1),dim=3) + +for (n in getNames(crop_hr_Bio)){ + crop_hr_LUH[,,n]<- crop_hr_LUH[,,n]+crop_hr_Bio[,,n] +} + +crop_hr_shr_LUH2_FAO<-round(crop_hr_LUH/dimSums(land_hr,dim=3),3) +crop_hr_shr_LUH2_FAO[!is.finite(crop_hr_shr_LUH2_FAO)]<-0 + +rm(crop_hr_Bio,crop_hr_noBio) + +#### Disaggregation Forestry +forestry_hr_shr <- land_hr_shr[,,"forestry"] +.dissagForestry <- function(gdx, forestry_hr_shr, map) { + message("Disaggregation Forestry") + area <- dimSums(landForestry(gdx, level="cell"),dim="ac") + area_shr <- area/(dimSums(area,dim=3) + 10^-10) + + # calculate forestry area as share of total cell area + forestry_hr_shr <- forestry_hr_shr[,getYears(area_shr),] + area_shr_hr <- madrat::toolAggregate(area_shr, map, to="cell") * setNames(forestry_hr_shr,NULL) + + #check + if (abs(sum(dimSums(area_shr_hr,dim=3)-forestry_hr_shr,na.rm=T)) > 0.1) warning("large Difference in crop disaggregation detected!") + + return(area_shr_hr) +} +forestry_hr_shr <- .dissagForestry(gdx, forestry_hr_shr, map=map_file) + +#### Split pasture into pasture and rangeland +avl_land_full_his <- read.magpie(land_hr_file) +past_range <- c("past","range") +past_range_his_shr <- avl_land_full_his[,,past_range]/dimSums(avl_land_full_his[,,past_range],dim=3) +past_range_his_shr[!is.finite(past_range_his_shr)] <- 0.5 +past_range_hr_shr<- new.magpie(cells_and_regions=getCells(past_range_his_shr),years=getYears(land_hr), + names=past_range) +past_range_land<- new.magpie(cells_and_regions=getCells(past_range_his_shr),years=getYears(land_hr), + names=past_range) +past_range_land[,getYears(past_range_his_shr),]<-past_range_his_shr*land_hr[,getYears(past_range_his_shr),"past"] +range_land_2015<-setYears(past_range_land[,2015,"range"],NULL) + +yer<-getYears(past_range_land,as.integer=TRUE)[getYears(past_range_land,as.integer=TRUE)>2015] +past_range_land[,yer,"range"]<-range_land_2015[,,"range"] +past_range_land[,yer,"range"]<-magpply(X = mbind(past_range_land[,yer,"range"],land_hr[,yer,"past"]), FUN = min, DIM = 3) +past_range_land[,yer,"past"]<-land_hr[,yer,"past"]-past_range_land[,yer,"range"] +past_range_hr_shr<-round(past_range_land/dimSums(land_hr,dim=3),3) +past_range_hr_shr[!is.finite(past_range_hr_shr)]<-0 +rm(past_range_his_shr,past_range_land,range_land_2015) + +#### Split other land into primary and secondary other land +other <- c("primother","secdother") +avl_land_full <- setYears(avl_land_full_his[,1995,],NULL) +other_hr_shr <- avl_land_full[,,other]/dimSums(avl_land_full[,,other],dim=3) +other_hr_shr[is.na(other_hr_shr)] <- 0.5 +other_hr_shr <- other_hr_shr * setNames(land_hr_shr[,,"other"],NULL) + +if(!file.exists(paste0(out_dir,"/LUH2_states.nc"))){ +states <- mbind(dimSums(crop_hr_shr_LUH2_FAO,dim=3.2), + setNames(past_range_hr_shr[,,"past"],"pastr"), + setNames(past_range_hr_shr[,,"range"],"range"), + setNames(land_hr_shr[,,"primforest"],"primf"), + setNames(forestry_hr_shr[,,"plant"],"timber"), + setNames(land_hr_shr[,,"secdforest"]+forestry_hr_shr[,,"ndc"]+forestry_hr_shr[,,"aff"],"secdf"), + setNames(other_hr_shr[,,"primother"],"primn"), + setNames(other_hr_shr[,,"secdother"],"secdn"), + setNames(land_hr_shr[,,"urban"],"urban") +) + +rm(avl_land_full,past_range_hr_shr,forestry_hr_shr,other_hr_shr) +gc() +saveRDS(states,paste0(outputdir,"/states.rds")) +gc() +states <- convertLUH2(states) +gc() +write.magpie(states,paste0(out_dir,"/LUH2_states.nc"),comment = "unit: fraction of grid-cell area") +rm(states) +gc() +} + +#### Protected areas + +b <- protectedArea(gdx,level = "grid",dir=outputdir) / dimSums(land_hr, dim=3) +b[is.na(b)] <- 0 +luh2 <- data.frame(matrix(nrow=3,ncol=2)) +names(luh2) <- c("LUH2","MAgPIE") +luh2[1,] <- c("primf_prot","primforest") +luh2[2,] <- c("secdf_prot","secdforest") +luh2[3,] <- c("primn_secdn_prot","other") +b <- madrat::toolAggregate(b, luh2, from="MAgPIE", to="LUH2",dim = 3) +gc() +if(!file.exists(paste0(out_dir,"/LUH2_protected_area.nc"))){ +b <- convertLUH2(b) +gc() +write.magpie(b,paste0(out_dir,"/LUH2_protected_area.nc"),comment = "unit: fraction of grid-cell") +rm(b) +gc() +} + +####### ONLY DYNAMIC FORESTRY ON############# + +#### Wood +land_lr <- madrat::toolAggregate(dimSums(land_hr,dim=3), map_file, from = "cell",to = "cluster") + +### Wood: Harvested Area +a <- harvested_area_timber(gdx,level = "cell") +b <- a / land_lr +b <- madrat::toolAggregate(b, map_file, from = "cluster",to = "cell") +luh2 <- data.frame(matrix(nrow=4,ncol=2)) +names(luh2) <- c("LUH2","MAgPIE") +luh2[1,] <- c("timber_harv","Forestry") +luh2[2,] <- c("primf_harv","Primary forest") +luh2[3,] <- c("secdf_harv","Secondary forest") +luh2[4,] <- c("primn_secdn_harv","Other land") +b <- madrat::toolAggregate(b, luh2, from="MAgPIE", to="LUH2",dim = 3) +gc() +if(!file.exists(paste0(out_dir,"/LUH2_wood_harvest_area.nc"))){ +b <- convertLUH2(b) +gc() +write.magpie(b,paste0(out_dir,"/LUH2_wood_harvest_area.nc"),comment = "unit: fraction of grid-cell area per year") +rm(a,b) +gc() +} + +#### Wood: Yields +a <- ForestYield(gdx,level="cell") +a_fix<- new.magpie(cells_and_regions=getCells(a),years=getYears(a), + names=getNames(a)) + +# BugFix in the mean time. Strange jump from ForestYield +a_fix[,1,]<-0 +a_fix[,-1,]<-setYears(a[,2100,,invert=TRUE],getYears(a_fix[,-1,])) +a[a>500]<-a_fix[a>500] +b <- madrat::toolAggregate(a, map_file, from = "cluster",to = "cell") +luh2 <- data.frame(matrix(nrow=4,ncol=2)) +names(luh2) <- c("LUH2","MAgPIE") +luh2[1,] <- c("timber_bioh","Forestry") +luh2[2,] <- c("primf_bioh","Primary forest") +luh2[3,] <- c("secdf_bioh","Secondary forest") +luh2[4,] <- c("primn_secdn_bioh","Other land") +b <- madrat::toolAggregate(b, luh2, from="MAgPIE", to="LUH2",dim = 3) +gc() +if(!file.exists(paste0(out_dir,"/LUH2_wood_harvest_yields.nc"))){ +b <- convertLUH2(b) +gc() +write.magpie(b,paste0(out_dir,"/LUH2_wood_harvest_yields.nc"),comment = "unit: m3 per ha per year") +rm(a,b) +gc() +} + +#### Wood: Harvested Biomass Product Split +b <- TimberProductionVolumetric(gdx,level = "cell",sumSource = FALSE,sumProduct = FALSE) +b <- dimSums(b,dim=3.1) +b <- b/dimSums(b,dim=3) +getNames(b) <- c("rndwd","fulwd") +b <- madrat::toolAggregate(b, map_file, from = "cluster",to = "cell") +if(!file.exists(paste0(out_dir,"/LUH2_wood_harvest_biomass_split.nc"))){ +b <- convertLUH2(b) +gc() +write.magpie(b,paste0(out_dir,"/LUH2_wood_harvest_biomass_split.nc"),comment = "unit: fraction of wood harvest biomass") +rm(b) +gc() +} + +####### ONLY DYNAMIC FORESTRY ON############# + +#### Irrigation +irrig_hr_shr <- collapseNames(crop_hr_shr_LUH2_FAO[,,"irrigated"],collapsedim = 3.2) +getNames(irrig_hr_shr) <- paste("irrig",getNames(irrig_hr_shr),sep="_") +irrig_hr_shr <- collapseNames(irrig_hr_shr/(round(setNames(land_hr_shr[,,"crop"],NULL),3))) +irrig_hr_shr[!is.finite(irrig_hr_shr)]<-0 +d <- dimSums(irrig_hr_shr*dimSums(land_hr[,,"crop"],dim=3),dim=c(1,3))-croparea(gdx,level="glo",product_aggr = T,water_aggr = FALSE)[,,"irrigated"] +if (any(abs(d) > 0.1 )) message(paste0("Difference between cluster and grid cell production > 0.1 detected!")) + +if(!file.exists(paste0(out_dir,"/LUH2_irrigation.nc"))){ +irrig_hr_shr <- convertLUH2(irrig_hr_shr) +gc() +write.magpie(irrig_hr_shr,paste0(out_dir,"/LUH2_irrigation.nc"),comment = "unit: fraction of crop area") +rm(irrig_hr_shr,d) +gc() +} + +#### Flood + +rice_historical<-calcOutput("Ricearea",cellular=TRUE,aggregate=FALSE, share = FALSE) +rice_historical<-speed_aggregate(rice_historical,rel=mapping_spatial,from="cell",to="region",weight=NULL) +share_rice_flooded<-setNames(1-(rice_historical[,,"nonflooded"]/rice_historical[,,"total"])[,c(1995,2000,2005,2010),],NULL) +share<-speed_aggregate(share_rice_flooded,rel=mapping_spatial,from="region",to="cell",weight=NULL) + +rice <- dimSums(crop_hr_shr[,,"rice_pro"],dim=3.2) +rice[,c(1995,2000,2005,2010),]<-rice[,c(1995,2000,2005,2010),]*share[,c(1995,2000,2005,2010),] +ye<-getYears(rice, as.integer=T)[!(getYears(rice, as.integer=T) %in% c(1995,2000,2005,2010))] +rice[,ye,]<-rice[,ye,]*setYears(share[,2010,],NULL) +flooded<-round(rice,3) +getNames(flooded,dim=1) <- "flood" +flooded <- flooded / dimSums(crop_hr_shr_LUH2_FAO[,,"c3ann"],dim=3) +flooded[!is.finite(flooded)]<-0 +d <- dimSums(flooded* dimSums(crop_hr_shr_LUH2_FAO[,,"c3ann"],dim=3)*dimSums(land_hr,dim=3),dim=c(1,3))-croparea(gdx,level="glo",product_aggr = F,water_aggr = T)[,,"rice_pro"] +if (any(abs(d) > 0.1 )) message(paste0("Difference between cluster and grid cell production > 0.1 detected!")) +if(!file.exists(paste0(out_dir,"/LUH2_flood.nc"))){ +flooded <- convertLUH2(flooded) +gc() +write.magpie(flooded,paste0(out_dir,"/LUH2_flood.nc"),comment = "unit: flooded fraction of C3 annual crop area") +rm(flooded,d) +gc() +} + +#### Bioenergy +bio_hr_shr <- dimSums(crop_hr_shr[,,c("begr","betr")],dim=3.2) +getNames(bio_hr_shr,dim=1) <- c("c4per","c3per") +bio_hr_shr[bio_hr_shr<0.01]<-0 +bio_hr_shr <- round(bio_hr_shr,3) / dimSums(crop_hr_shr_LUH2_FAO[,,c("c4per","c3per")],dim=3.2) +bio_hr_shr[!is.finite(bio_hr_shr)]<-0 +d<-dimSums((bio_hr_shr[,,c("c4per","c3per")])*dimSums(crop_hr_shr_LUH2_FAO[,,c("c4per","c3per")],dim=3.2)*dimSums(land_hr,dim=3),dim=c(1,3))-croparea(gdx,level="glo",products = c("begr","betr"),product_aggr = T) +if (any(abs(d) > 0.1 )) message(paste0("Difference between cluster and grid cell production > 0.1 detected!")) +getNames(bio_hr_shr,dim=1) <- c("crpbf_c4per","crpbf_c3per") + +if(!file.exists(paste0(out_dir,"/LUH2_bioenergy.nc"))){ +bio_hr_shr <- convertLUH2(bio_hr_shr) +gc() +write.magpie(bio_hr_shr,paste0(out_dir,"/LUH2_bioenergy.nc"),comment = "unit: fraction of crop type area occupied by biofuel crops") +rm(bio_hr_shr,d) +gc() +} + +#Croparea from LUH to avoid re-mapping LUH and magpie +crop_threshold <- 0.0001 +crop<- crop_hr_LUH +crop_hr<-dimSums(crop,dim=3.2) +crop_hr_shr <- dimSums(crop_hr_shr_LUH2_FAO,dim=3.2) + +crop_hr_rf <- collapseNames(crop[,,"rainfed"],collapsedim = 3.2) +crop_hr_rf_shr <- collapseNames(crop_hr_shr_LUH2_FAO[,,"rainfed"]) + +crop_hr_ir <- collapseNames(crop[,,"irrigated"],collapsedim = 3.2) +crop_hr_ir_shr <- collapseNames(crop_hr_shr_LUH2_FAO[,,"irrigated"]) + +#### Nitrogen budget + +if(file.exists(paste0(outputdir,"/NitrogenBudget.rds")) & file.exists(paste0(outputdir,"/NitrogenBudgetWeight.rds"))) { + a <- readRDS(paste0(outputdir,"/NitrogenBudget.rds")) + weight_kr <- readRDS(paste0(outputdir,"/NitrogenBudgetWeight.rds")) +} else { + #read-in NR budget in mio t N + a <- NitrogenBudget(gdx,level="grid",dir = outputdir) + saveRDS(a,paste0(outputdir,"/NitrogenBudget.rds")) + #read-in crop specific weight + weight_kr <- NitrogenBudgetWithdrawals(gdx,kcr="kcr",level="grid",net=TRUE,dir=outputdir) + saveRDS(weight_kr,paste0(outputdir,"/NitrogenBudgetWeight.rds")) +} + +#Rename and aggregate crop types in weight from MAgPIE to LUH2 +weight_kr_luh<-weight_kr*map_LUHMAg_grid +rm(weight_kr) +names<-unique(getNames(dimSums(map_LUHMAg_grid,dim=3.2))) +weight<-new.magpie(cells_and_regions=getCells(weight_kr_luh),years=getYears(weight_kr_luh),names=names) + +for(n in names){ +weight[,,n]<-dimSums(weight_kr_luh[,,n],dim=3.1) +} + +#subset +a <- a[,,c("fertilizer","manure","surplus")] +a[a<0] <- 0 +#make it crop specific +a <- ((a * weight) / dimSums(weight,dim=3,na.rm = TRUE)) +#filter +a[crop_hr tN/ha; convert from tN/ha to kgN/ha: tN/ha*1000kg/t = 1000 kgN/ha + +a <- (a/crop_hr)*1000 + +if(!file.exists(paste0(out_dir,"/LUH2_Nitrogen_fertilizer.nc"))){ +x <- convertLUH2(clean_magpie(collapseNames(a[,,"fertilizer"],collapsedim = 3.1))) +gc() +write.magpie(x,paste0(out_dir,"/LUH2_Nitrogen_fertilizer.nc"),comment = "unit: kgN-per-ha") +} + +if(!file.exists(paste0(out_dir,"/LUH2_Nitrogen_manure.nc"))){ +x <- convertLUH2(clean_magpie(collapseNames(a[,,"manure"],collapsedim = 3.1))) +gc() +write.magpie(x,paste0(out_dir,"/LUH2_Nitrogen_manure.nc"),comment = "unit: kgN-per-ha") +} + +if(!file.exists(paste0(out_dir,"/LUH2_Nitrogen_surplus.nc"))){ +x <- convertLUH2(clean_magpie(collapseNames(a[,,"surplus"],collapsedim = 3.1))) +gc() +write.magpie(x,paste0(out_dir,"/LUH2_Nitrogen_surplus.nc"),comment = "unit: kgN-per-ha") +} + +rm(a,x,weight) +gc() + +#### Yields DM +yield_kr <- collapseNames(yields(gdx,level="cell",products = "kcr",product_aggr = FALSE,water_aggr = TRUE,attributes = "dm")) +yield_kr <-gdxAggregate(gdx,yield_kr,weight=NULL, absolute=FALSE,to="grid",dir=outputdir) +yield_kr_su <- yield_kr*map_LUHMAg_grid + +a<-new.magpie(cells_and_regions=getCells(yield_kr_su),years=getYears(yield_kr_su), + names=unique(getNames(collapseNames(yield_kr_su[,,"tece"])))) +for(n in names){ +a[,,n]<-dimSums(yield_kr_su[,,n],dim=3)/dimSums(map_LUHMAg_grid[,,n],dim=3) +} + +if(!file.exists(paste0(out_dir,"/LUH2_Yield_DM.nc"))){ +a <- convertLUH2(a) +gc() +write.magpie(a,paste0(out_dir,"/LUH2_Yield_DM.nc"),comment = "unit: tDM-per-ha") +rm(a,yield_kr,yield_kr_su) +gc() +} + +#### Yields DM rainfed +#read-in production in mio tDM +yield_kr <- collapseNames(yields(gdx,level="cell",products = "kcr",product_aggr = FALSE,water_aggr = FALSE,attributes = "dm")[,,"rainfed"]) +yield_kr <-gdxAggregate(gdx,yield_kr,weight=NULL, absolute=FALSE,to="grid",dir=outputdir) +yield_kr_su <- yield_kr*map_LUHMAg_grid +a<-new.magpie(cells_and_regions=getCells(yield_kr_su),years=getYears(yield_kr_su), + names=unique(getNames(collapseNames(yield_kr_su[,,"tece"])))) +for(n in names){ +a[,,n]<-dimSums(yield_kr_su[,,n],dim=3)/dimSums(map_LUHMAg_grid[,,n],dim=3) +} + +if(!file.exists(paste0(out_dir,"/LUH2_Yield_DM_rainfed.nc"))){ +a <- convertLUH2(a) +gc() +write.magpie(a,paste0(out_dir,"/LUH2_Yield_DM_rainfed.nc"),comment = "unit: tDM-per-ha") +rm(a,yield_kr,yield_kr_su) +gc() +} + +#### Yields DM irrigated +#read-in production in mio tDM +yield_kr <- collapseNames(yields(gdx,level="cell",products = "kcr",product_aggr = FALSE,water_aggr = FALSE,attributes = "dm")[,,"irrigated"]) +yield_kr <-gdxAggregate(gdx,yield_kr,weight=NULL, absolute=FALSE,to="grid",dir=outputdir) +yield_kr_su <- yield_kr*map_LUHMAg_grid +a<-new.magpie(cells_and_regions=getCells(yield_kr_su),years=getYears(yield_kr_su), + names=unique(getNames(collapseNames(yield_kr_su[,,"tece"])))) +for(n in names){ +a[,,n]<-dimSums(yield_kr_su[,,n],dim=3)/dimSums(map_LUHMAg_grid[,,n],dim=3) +} + +if(!file.exists(paste0(out_dir,"/LUH2_Yield_DM_irrigated.nc"))){ +a <- convertLUH2(a) +gc() +write.magpie(a,paste0(out_dir,"/LUH2_Yield_DM_irrigated.nc"),comment = "unit: tDM-per-ha") +rm(a,yield_kr,yield_kr_su) +gc() +} + +#### Yields Nr +#read-in production in mio tN +yield_kr <- collapseNames(yields(gdx,level="cell",products = "kcr",product_aggr = FALSE,water_aggr = TRUE,attributes = "nr"))*1000 +yield_kr <-gdxAggregate(gdx,yield_kr,weight=NULL, absolute=FALSE,to="grid",dir=outputdir) +yield_kr_su <- yield_kr*map_LUHMAg_grid + +a<-new.magpie(cells_and_regions=getCells(yield_kr_su),years=getYears(yield_kr_su), + names=unique(getNames(collapseNames(yield_kr_su[,,"tece"])))) +for(n in names){ +a[,,n]<-dimSums(yield_kr_su[,,n],dim=3)/dimSums(map_LUHMAg_grid[,,n],dim=3) +} +if(!file.exists(paste0(out_dir,"/LUH2_Yield_Nr.nc"))){ +a <- convertLUH2(a) +gc() +write.magpie(a,paste0(out_dir,"/LUH2_Yield_Nr.nc"),comment = "unit: kgN-per-ha") +rm(a,yield_kr,yield_kr_su) +gc() +} diff --git a/scripts/output/extra/emulator.R b/scripts/output/extra/emulator.R index bd99d734a5..68adaa910c 100644 --- a/scripts/output/extra/emulator.R +++ b/scripts/output/extra/emulator.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -14,10 +14,11 @@ library(magclass) library(lucode2) library(lusweave) -library(magpie) +library(magpie4) library(luplot) library(ggplot2) library(remulator) +library(gms) ######################################################################################################## ######################################## Define function ############################################### @@ -25,14 +26,14 @@ library(remulator) collect_data_and_make_emulator <- function(outputdir,name_of_fit="linear") { require(gms) - load(paste0(outputdir, "/config.Rdata")) + cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) #setwd("~/Documents/0_GIT/magpie") #cfg<-list(title="SSP2-26-1") # lock the model (other emulaotr scripts have to wait until this one finished) lock_id <- gms::model_lock(file=".lockemu") - on.exit(gms::model_unlock(lock_id,file=".lockemu")) + withr::defer(gms::model_unlock(lock_id,file=".lockemu")) results_path <- "output" diff --git a/scripts/output/extra/force_runstatistics.R b/scripts/output/extra/force_runstatistics.R index 86ee0077ef..84da313c8a 100644 --- a/scripts/output/extra/force_runstatistics.R +++ b/scripts/output/extra/force_runstatistics.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -15,6 +15,7 @@ ## Load necessary libraries library(lucode2) library(magpie4) +library(gms) ## Check outputdir if(!exists("source_include")) { @@ -27,7 +28,7 @@ runstatistics <- paste0(outputdir,"/runstatistics.rda") gdx <- paste0(outputdir,"/fulldata.gdx") ## Load run config -load(paste0(outputdir, "/config.Rdata")) +cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) ## Load runstatistics load(runstatistics) diff --git a/scripts/output/extra/highres.R b/scripts/output/extra/highres.R index 8c4f3a0796..e1707e82e2 100644 --- a/scripts/output/extra/highres.R +++ b/scripts/output/extra/highres.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -10,21 +10,25 @@ # comparison script: FALSE # --------------------------------------------------------------- +# Author: Florian Humpenoeder + library(magclass) library(gdx) library(magpie4) library(lucode2) library(gms) +library(madrat) +library(gms) options("magclass.verbosity" = 1) ############################# BASIC CONFIGURATION ############################# if(!exists("source_include")) { - outputdir <- "/p/projects/landuse/users/miodrag/projects/tests/flexreg/output/H12_setup1_2016-11-23_12.38.56/" + outputdir <- "output/LAMA86_Sustainability" readArgs("outputdir") } -load(paste0(outputdir, "/config.Rdata")) -gdx <- path(outputdir,"fulldata.gdx") +cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) +gdx <- file.path(outputdir,"fulldata.gdx") rds <- paste0(outputdir, "/report.rds") runstatistics <- paste0(outputdir,"/runstatistics.rda") resultsarchive <- "/p/projects/rd3mod/models/results/magpie" @@ -33,55 +37,135 @@ resultsarchive <- "/p/projects/rd3mod/models/results/magpie" # Load start_run(cfg) function which is needed to start MAgPIE runs source("scripts/start_functions.R") -#lock the model folder -lock_id <- gms::model_lock(timeout1=1) -on.exit(gms::model_unlock(lock_id)) - -cfg$results_folder <- "output/:title:" - -cfg$output <- c("rds_report") - -#set high resolution -hr <- "c1000" - -#update input files. The following files are needed: -#isimip_rcp-IPSL_CM5A_LR-rcp2p6-co2_rev42_c200_690d3718e151be1b450b394c1064b1c5.tgz -#isimip_rcp-IPSL_CM5A_LR-rcp2p6-co2_rev42_c1000_690d3718e151be1b450b394c1064b1c5.tgz -#The calibration file must exist for c200 and c1000 with the same date -#calibration_H12_c200_26Feb20 -#calibration_H12_c1000_26Feb20 -cfg$input <- gsub("c200",hr,cfg$input) - -#max resources for parallel runs -cfg$qos <- "short_maxMem" -#magpie4::submitCalibration("H12_c1000") -#c1000 with endoTC - -input_old <- .get_info("input/info.txt", "^Used data set:", ": ") - -if(!setequal(cfg$input, input_old)) { - # download data and update code +highres <- function(cfg) { + #lock the model folder + lockId <- gms::model_lock(timeout1 = 1) + withr::defer(gms::model_unlock(lockId)) + + if(any(!(modelstat(gdx) %in% c(2,7)))) stop("Modelstat different from 2 or 7 detected") + + cfg$output <- cfg$output[cfg$output!="extra/highres"] + + # set high resolution, available options are c1000 and c2000 + res <- "c1000" + + # search for matching high resolution file in repositories + # pattern: "rev4.65_h12_*_cellularmagpie_c2000_MRI-ESM2-0-ssp370_lpjml-3eb70376.tgz" + x <- unlist(strsplit(cfg$input["cellular"],"_")) + x[3] <- "*" + x[5] <- res + file <- paste0(x,collapse = "_") + message(paste0("Searching for ",file," in repositories")) + repositories <- cfg$repositories + found <- NULL + debug <- FALSE + for (repo in names(repositories)) { + if (grepl("https://|http://", repo)) { + #read html index file and extract file names + h <- try(curl::new_handle(verbose = debug, .list = repositories[[repo]]), silent = !debug) + con <- curl::curl(paste0(repo,"/"), handle = h) + dat <- try(readLines(con), silent = TRUE) + close(con) + dat <- grep("href",dat,value = T) + dat <- unlist(lapply(strsplit(dat, "\\]\\] "),function(x) x[2])) + dat <- gsub(" 1) { + found <- found[1] + warning("More than one file found that matches the pattern. Only the first one will be used.") + } else found <- found[1] + message(paste0("Matching file with ",res," resolution found: ",found)) + } + + #update cellular input files + cfg$input["cellular"] <- found + + #copy gdx file for 1st time step from low resolution run for better starting point + #note: using gdx files for more than the 1st time step sometimes pushes the model into corner solutions, which might result in infeasibilites. + cfg$files2export$start <- c(cfg$files2export$start, + paste0(cfg$results_folder, "/", "magpie_y1995.gdx")) + cfg$gms$s_use_gdx <- 1 + cfg$gms$s80_optfile <- 1 + + #max resources for parallel runs + cfg$qos <- "standby_maxMem_dayMax" + + # 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) -} - -#set title -cfg$title <- paste0("hr_",cfg$title) - -#get trade pattern from low resolution run with c200 -ov_prod_reg <- readGDX(gdx,"ov_prod_reg",select=list(type="level")) -ov_supply <- readGDX(gdx,"ov_supply",select=list(type="level")) -f21_trade_balance <- ov_prod_reg - ov_supply -write.magpie(round(f21_trade_balance,6),paste0("modules/21_trade/input/f21_trade_balance.cs3")) -#get tau from low resolution run with c200, currently not used. -tau(gdx,file = "modules/13_tc/input/f13_tau_scenario.csv",digits = 4) + # set title + tmp <- unlist(strsplit(cfg$title, "_")) + tmp[1] <- paste0(tmp[1], paste0("HR", res)) + cfg$title <- paste(tmp, collapse = "_") + + cfg$results_folder <- paste0("output/HR", res, "/:title:") + cfg$force_replace <- TRUE + cfg$recalc_npi_ndc <- TRUE + + #get trade pattern from low resolution run with c200 + ov_prod_reg <- readGDX(gdx, "ov_prod_reg", select = list(type = "level")) + ov_supply <- readGDX(gdx, "ov_supply", select = list(type = "level")) + supreg <- readGDX(gdx, "supreg") + f21_trade_balance <- toolAggregate(ov_prod_reg - ov_supply, supreg) + write.magpie(f21_trade_balance, paste0("modules/21_trade/input/f21_trade_balance.cs3")) + + #get tau from low resolution run with c200 + ov_tau <- readGDX(gdx, "ov_tau",select=list(type="level")) + write.magpie(ov_tau,"modules/13_tc/input/f13_tau_scenario.csv") + cfg$gms$tc <- "exo" + + #use exo trade and parallel optimization + cfg$gms$trade <- "exo" + cfg$gms$optimization <- "nlp_par" + cfg$gms$s15_elastic_demand <- 0 + + #get regional afforestation patterns from low resolution run with c200 + aff <- dimSums(landForestry(gdx)[,,c("aff","ndc")],dim=3) + #Take away initial NDC area for consistency with global afforestation limit + aff <- aff-setYears(aff[,1,],NULL) + #calculate maximum regional afforestation over time + aff_max <- setYears(aff[,1,],NULL) + for (r in getRegions(aff)) { + aff_max[r,,] <- max(aff[r,,]) + } + aff_max[aff_max < 0] <- 0 + write.magpie(aff_max,"modules/32_forestry/input/f32_max_aff_area.cs4") + cfg$gms$s32_max_aff_area_glo <- 0 + #check + if(cfg$gms$s32_max_aff_area < Inf) { + indicator <- abs(sum(aff_max)-cfg$gms$s32_max_aff_area) + if(indicator > 1e-06) warning(paste("Global and regional afforestation limit differ by",indicator,"Mha")) + } + + Sys.sleep(2) + + start_run(cfg, codeCheck = FALSE, lock_model = FALSE) + + Sys.sleep(1) + + if (file.exists("modules/32_forestry/input/f32_max_aff_area.cs4")) file.remove("modules/32_forestry/input/f32_max_aff_area.cs4") -#use exo trade and parallel optimization -cfg$gms$trade <- "exo" -cfg$gms$optimization <- "nlp_par" -#cfg$gms$s15_elastic_demand <- 0 -#cfg$gms$tc <- "exo" - -#cfg$gms$c60_bioenergy_subsidy <- 0 - -start_run(cfg,codeCheck=FALSE,lock_model=FALSE) +} +highres(cfg) diff --git a/scripts/output/extra/land_cluster_shapefile.R b/scripts/output/extra/land_cluster_shapefile.R new file mode 100644 index 0000000000..ec89d56ebb --- /dev/null +++ b/scripts/output/extra/land_cluster_shapefile.R @@ -0,0 +1,39 @@ +# | (C) 2008-2023 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: Write land use information on cluster level to a shapefile +# comparison script: FALSE +# --------------------------------------------------------------- + +if (packageVersion("magpie4") < "1.180.0") { + stop("land_cluster_shapefile.R requires magpie4 >= 1.180.0, please update magpie4") +} + +if (!exists("source_include")) { + outputdir <- Sys.glob("output/*")[[1]] + lucode2::readArgs("outputdir") +} + +landUse <- magpie4::land(file.path(outputdir, "fulldata.gdx"), + dir = outputdir, + level = "cell") + +clustermap <- Sys.glob(file.path(outputdir, "clustermap_*.rds")) +if (length(clustermap) == 0) { + stop("no clustermap file found") +} else if (length(clustermap) > 1) { + warning("found multiple clustermaps, using ", clustermap[[1]]) + clustermap <- clustermap[[1]] +} +clustermap <- readRDS(clustermap) + +clusterPolygons <- magpie4::clusterOutputToTerraVector(landUse, clustermap) + +outfile <- file.path(outputdir, "cluster_resolution.shp") +message("Writing ", outfile) +terra::writeVector(clusterPolygons, outfile, overwrite = TRUE) diff --git a/scripts/output/extra/modelstat.R b/scripts/output/extra/modelstat.R index 73b6344d72..7ba7bbfb78 100644 --- a/scripts/output/extra/modelstat.R +++ b/scripts/output/extra/modelstat.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -22,7 +22,7 @@ options(error=function()traceback(2)) ############################# BASIC CONFIGURATION ############################# if(!exists("source_include")) { - outputdir <- lucode2::path("output/",list.dirs("output/", full.names = FALSE, recursive = FALSE)) + outputdir <- file.path("output/",list.dirs("output/", full.names = FALSE, recursive = FALSE)) #Define arguments that can be read from command line lucode2::readArgs("outputdir") } @@ -35,7 +35,7 @@ missing <- NULL for (i in 1:length(outputdir)) { print(paste("Processing",outputdir[i])) #gdx file - gdx<-path(outputdir[i],"fulldata.gdx") + gdx<-file.path(outputdir[i],"fulldata.gdx") if(file.exists(gdx)) { tmp <- modelstat(gdx) dimnames(tmp)[[3]] <- paste(outputdir[i],dimnames(tmp)[[3]],sep=".") diff --git a/scripts/output/extra/reportMAgPIE2REMIND.R b/scripts/output/extra/reportMAgPIE2REMIND.R new file mode 100644 index 0000000000..8275548f5f --- /dev/null +++ b/scripts/output/extra/reportMAgPIE2REMIND.R @@ -0,0 +1,30 @@ +# | (C) 2008-2023 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: Write only those variables into a report that are relevant for the REMIND coupling +# comparison script: FALSE +# --------------------------------------------------------------- + +local ({ + withr::local_options("magclass.verbosity" = 1) + + ############################# BASIC CONFIGURATION ############################# + if(!exists("source_include")) { + outputdir <- "/p/projects/remind/runs/REMIND-MAgPIE-2022-10-12/magpie/output/C_SDP-PkBudg1150-mag-4" + lucode2::readArgs("outputdir") + } + + cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) + gdx <- file.path(outputdir, "fulldata.gdx") + mif <- file.path(outputdir, "report.mif") + ############################################################################### + + report <- magpie4::getReportMAgPIE2REMIND(gdx, scenario = cfg$title) + magclass::write.report(report, file = mif) + +}) diff --git a/scripts/output/extra/resubmit.R b/scripts/output/extra/resubmit.R index 9c2be91b38..7997323c54 100644 --- a/scripts/output/extra/resubmit.R +++ b/scripts/output/extra/resubmit.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -22,7 +22,7 @@ options(error=function()traceback(2)) ############################# BASIC CONFIGURATION ############################# if(!exists("source_include")) { - outputdir <- path("output/",list.dirs("output/", full.names = FALSE, recursive = FALSE)) + outputdir <- file.path("output/",list.dirs("output/", full.names = FALSE, recursive = FALSE)) #Define arguments that can be read from command line readArgs("outputdir") } @@ -35,10 +35,10 @@ missing <- NULL for (i in 1:length(outputdir)) { print(paste("Checking",outputdir[i])) #gdx file - gdx<-path(outputdir[i],"fulldata.gdx") + gdx<-file.path(outputdir[i],"fulldata.gdx") if(file.exists(gdx)) tmp <- modelstat(gdx) else tmp <- 0 if (any(tmp>2) | all(tmp==0)) { - file.copy(from = "scripts/run_submit/submit.sh",to = path(outputdir[i],"submit.sh"),overwrite = TRUE) + file.copy(from = "scripts/run_submit/submit.sh",to = file.path(outputdir[i],"submit.sh"),overwrite = TRUE) current <- getwd() setwd(outputdir[i]) if (file.exists("magpie_y1995.gdx")) file.remove("magpie_y1995.gdx") diff --git a/scripts/output/extra/runtime.R b/scripts/output/extra/runtime.R index 99fcefc18f..70617156db 100644 --- a/scripts/output/extra/runtime.R +++ b/scripts/output/extra/runtime.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 diff --git a/scripts/output/extra/timestep_duration.R b/scripts/output/extra/timestep_duration.R index f312329f12..c888f56244 100644 --- a/scripts/output/extra/timestep_duration.R +++ b/scripts/output/extra/timestep_duration.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -37,7 +37,7 @@ infor <- infor[order(infor$mtime),] infor$Tdiff <- 0 for(i in 2:nrow(infor)){ - infor$Tdiff[i] <- round(difftime(infor$mtime[i], infor$mtime[i-1], units='mins'),2) + infor$Tdiff[i] <- round(difftime(infor$mtime[i], infor$mtime[i-1], units='mins'),2) } infor <- infor[order(infor$mtime),] diff --git a/scripts/output/extra/validation_exising_report.R b/scripts/output/extra/validation_existing_report.R similarity index 90% rename from scripts/output/extra/validation_exising_report.R rename to scripts/output/extra/validation_existing_report.R index d3db9ea221..6de5fac3fd 100644 --- a/scripts/output/extra/validation_exising_report.R +++ b/scripts/output/extra/validation_existing_report.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -12,6 +12,7 @@ library(mip) library(magpie4) +library(gms) ############################# BASIC CONFIGURATION ############################# if(!exists("source_include")) { @@ -22,9 +23,9 @@ file <- paste0("comparison_validation_",format(Sys.time(), "%Y%H%M%S"),".pdf" x <- NULL; i <- 1 for(outputdir in outputdirs) { - config <- path(outputdir,"config.Rdata") + config <- file.path(outputdir,"config.yml") if(file.exists(config)) { - load(config) + cfg <- gms::loadConfig(config) title <- cfg$title } else { title <- paste0("run",i) diff --git a/scripts/output/merge_report.R b/scripts/output/merge_report.R index 0649cfdc4c..4dcb31adc4 100644 --- a/scripts/output/merge_report.R +++ b/scripts/output/merge_report.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -8,7 +8,7 @@ # -------------------------------------------------------------- # description: Merges report.mif files from several runs into a single mif file # comparison script: TRUE -# position: 2 +# position: 3 # --------------------------------------------------------------- # Version 1.0, Florian Humpenoeder @@ -16,12 +16,13 @@ library(lucode2) library(magclass) library(quitte) +library(gms) options(error=function()traceback(2)) ############################# BASIC CONFIGURATION ############################# if(!exists("source_include")) { - outputdir <- lucode2::path("output/",list.dirs("output/", full.names = FALSE, recursive = FALSE)) + outputdir <- file.path("output/",list.dirs("output/", full.names = FALSE, recursive = FALSE)) #Define arguments that can be read from command line lucode2::readArgs("outputdir") } @@ -35,16 +36,16 @@ if(file.exists("output/report_all.mif")) file.rename("output/report_all.mif","ou for (i in 1:length(outputdir)) { print(paste("Processing",outputdir[i])) #gdx file - rep<-path(outputdir[i],"report.mif") + rep<-file.path(outputdir[i],"report.mif") if(file.exists(rep)) { #get scenario name - load(path(outputdir[i],"config.Rdata")) + 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 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/output_check.R b/scripts/output/output_check.R new file mode 100644 index 0000000000..c404170375 --- /dev/null +++ b/scripts/output/output_check.R @@ -0,0 +1,26 @@ +# | (C) 2008-2023 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: check output for known problems +# comparison script: FALSE +# position: 1 +# --------------------------------------------------------------- + + +library(magpie4, quietly = TRUE) + +############################# BASIC CONFIGURATION ############################# +if(!exists("source_include")) { + outputdir <- "" + readArgs("outputdir") +} + +gdx <- file.path(outputdir,"fulldata.gdx") +############################################################################### + +magpie4::outputCheck(gdx) diff --git a/scripts/output/projects/BEST_merge_report.R b/scripts/output/projects/BEST_merge_report.R new file mode 100644 index 0000000000..53c3436f9a --- /dev/null +++ b/scripts/output/projects/BEST_merge_report.R @@ -0,0 +1,53 @@ +# | (C) 2008-2023 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 single report files into one file +# comparison script: TRUE +# position: 3 +# --------------------------------------------------------------- + +library(lucode2) +library(magclass) +library(quitte) +library(iamc) +library(magpie4) + +options(error=function()traceback(2)) + +############################# BASIC CONFIGURATION ############################# +if(!exists("source_include")) { + outputdir <- path("output/",list.dirs("output/", full.names = FALSE, recursive = FALSE)) + #Define arguments that can be read from command line + readArgs("outputdir") +} +############################################################################### +cat("\nStarting output generation\n") + +file_name <- "output/BEST_V13.csv" + +missing <- NULL + +if(file.exists(file_name)) file.rename(file_name,(sub(".csv",".bak",file_name))) + +for (i in 1:length(outputdir)) { + print(paste("Processing",outputdir[i])) + #gdx file + rep<-path(outputdir[i],"report.mif") + if(file.exists(rep)) { + #read-in reporting file + a <- read.report(rep,as.list = FALSE) + #add to reporting csv file + mapfile <- system.file("extdata", "variablemappingBEST.csv", package="magpie4") + write.reportProject(a,mapping=mapfile,file=file_name,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) +} diff --git a/scripts/output/projects/FABLE_India_subnational_validation.R b/scripts/output/projects/FABLE_India_subnational_validation.R new file mode 100644 index 0000000000..70cd6ebcb6 --- /dev/null +++ b/scripts/output/projects/FABLE_India_subnational_validation.R @@ -0,0 +1,104 @@ +# | (C) 2008-2023 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: India subnational validation +# comparison script: FALSE +# --------------------------------------------------------------- + +#Version 1.00 - Miodrag Stevanovic, Prantika Das +# 1.00: first working version + +library(lucode2) +library(magpie4) +library(madrat) +library(mrfable) +library(mip) +library(mrvalidation) +library(magpiesets) +library(lusweave) + +print("Start India state level validation output runscript") + +############################# BASIC CONFIGURATION ####################################### + +if(!exists("source_include")) { + + outputdir <- "output/v4p77/h12_2022-12-15_22.09.46" + + ###Define arguments that can be read from command line + readArgs("outputdir") +} +file <- file.path(outputdir,paste0("India_subnational_validation_",format(Sys.time(), "%Y%H%M%S"),".pdf")) +######################################################################################### + +print(paste0("Script started for output directory: ",outputdir)) + +# Determine cells for India +mapping <- toolGetMapping("scripts/npi_ndc/policies/country2cell.rds") +mapping$iso_mag <- paste(mapping$iso,mapping$cell,sep=".") +# load Indian states +indStates <- toolGetMapping(system.file("extdata", "regional/india_state_code.csv", package = "mrfable")) +indCells <- which(mapping$ind %in% indStates$State_code) + +# Subnational validation data of specific crops +landHr <- read.magpie(file.path(outputdir,"cell.land_0.5.mz"))[indCells,,] +cropareaHrShare <- read.magpie(file.path(outputdir,"cell.croparea_0.5_share.mz"))[indCells,,] +cellHr <- dimSums(landHr, dim=3) +cropareaHr <- cropareaHrShare[,,]*setItems(cell_hr[,1,], dim=2, NULL) +cropareaHr <- dimSums(cropareaHr, dim=3.2) + +# aggregate land from grid to state level +mappingInd <- mapping[indCells,] +cropareaState <- toolAggregate(cropareaHr, rel=mappingInd, from="iso_mag", to="ind") + +# Observed data from mrfable +setConfig(extramappings = "mappingIndiaAPY.csv") +indApyMapping <- toolGetMapping(system.file("extdata", "regional/mappingIndiaAPY.csv", package = "mrfable")) +h <- calcOutput("IndiaFoodcrop", subtype = "Area", aggregate = "Region") +# Data cleaning: +h <- h[indStates$State_code,,] +h <- collapseNames(h) +h <- collapseNames(h[,,"total"]) +h <- h/1000 +# Crops in the APY database: +mappingCropsAPY <- as.matrix(data.frame(APYcrop=c("Bajra", "Barley", "Gram", + "Jowar", "Tur", "Maize", + "Wheat", "Ragi", "Rice"), + k=c("trce", "tece", "puls_pro", + "trce", "puls_pro", "maiz", + "tece", "trce", "rice_pro"))) +# Aggregate to magpie crops: +h <- toolAggregate(h, rel=mappingCropsAPY, from="APYcrop", to="k", dim=3) +h <- add_dimension(h, dim=3.1, add="scenario", nm="historical") +h <- add_dimension(h, dim=3.2, add="model", nm="APY") +h <- setItems(h, dim=3.3, reportingnames(getItems(h,dim=3.3))) + +cropareaState <- cropareaState[,,unique(mappingCropsAPY[,"k"])] +names(dimnames(cropareaState)) <- c("state","year","crop") +cropareaState <- add_dimension(cropareaState, dim=3.1, add="scenario", nm="") +cropareaState <- add_dimension(cropareaState, dim=3.2, add="model", nm="MAgPIE") +cropareaState <- setItems(cropareaState, dim=3.3, reportingnames(getItems(cropareaState,dim=3.3))) + +sw <- swopen(file) +swlatex(sw,"\\huge") +swlatex(sw,"\\textbf{MAgPIE state level croparea comparison for India}\\newline") +swlatex(sw,"\\normalsize") +swlatex(sw,"\\newline") +swlatex(sw,"\\tableofcontents") + +for(k in getItems(h, dim=3.3)){ + for(state in getItems(h, dim=1)){ + swlatex(sw,"\\newpage") + swlatex(sw,paste0("\\section{Croparea ",k," in ",indStates[which(indStates$State_code==state),"State_name"],"}")) + swfigure(sw, print, mipLineHistorical(cropareaState[state,,k],h[state,,k],ylab="Mha")) + } +} + +swclose(sw,clean_output=TRUE) + + diff --git a/scripts/output/projects/FSDP_collect.R b/scripts/output/projects/FSDP_collect.R new file mode 100644 index 0000000000..f9b0961aa8 --- /dev/null +++ b/scripts/output/projects/FSDP_collect.R @@ -0,0 +1,532 @@ +# | (C) 2008-2023 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") +} +############################################################################### + +# For case of sub-folder structure write to the respective folder +title <- basename(outputdir) + +# Select runs to be displayed +x <- unlist(lapply(strsplit(basename(outputdir), "_"), function(x) x[2])) +outputdir <- outputdir[which(x %in% c("FSECa", "FSECb", "FSECc", "FSECd", "FSECe"))] + +# Get revision number +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("No corresponding version ID was found within the health impacts datasets. Using the latest available.") + + 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("Duplicated version IDs were found in the health impacts datasets, 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("Unable to append health impacts for scenario: ", title, ". Likely it is non-dietary.") + } + ) + } + lapply(X = outputdir, FUN = .appendHealthImpacts) + +} else { + message("The directory storing health impacts datasets wasn't found. Skipping health impacts.") +} + +magicc7_datasets_path <- "/p/projects/magpie/data/FSEC_magicc7Datasets_raw" +if (dir.exists(magicc7_datasets_path)) { + + magicc7_datasets <- list.files(magicc7_datasets_path) + magicc7_versionToUse <- grep(rev, magicc7_datasets, value = TRUE) + + if (length(magicc7_versionToUse) == 0) { + + message("No corresponding version ID was found within the MAGICC7 datasets. Using the latest available.") + + highestVersionNr <- max(as.numeric(str_extract(magicc7_datasets, "(?<=v)(.*?)(?=_)"))) + magicc7_versionToUse <- grep(paste0("v", highestVersionNr), magicc7_datasets, value = TRUE) + + } else if (length(magicc7_versionToUse) >= 2) { + stop("Duplicated version IDs were found in the MAGICC7 datasets, only one is expected.") + } + + magicc7_versionToUse_path <- file.path(magicc7_datasets_path, magicc7_versionToUse) + + .appendMAGICC7 <- function(.x) { + cfg <- gms::loadConfig(file.path(.x, "config.yml")) + title <- cfg$title + + tryCatch( + expr = { + appendReportMAGICC7(resultsPath = magicc7_versionToUse_path, scenario = title, dir = .x) + }, error = function(e) { + message("Unable to append MAGICC7 dataset for scenario: ", title) + } + ) + } + lapply(X = outputdir, FUN = .appendMAGICC7) + +} else { + message("The directory storing MAGICC7 datasets wasn't found. Skipping AR6 global warming calculations.") +} + + +########## +# Generate output files +cat("\nStarting output generation\n") + +reg <- NULL +iso <- NULL +grid <- NULL +missing <- NULL + +saveRDS(outputdir,"outputdir.rds") + +indicators_main <- getVariables() +names(indicators_main) <- NULL +var_reg <- c(indicators_main, + ### Validation + "Biodiversity|Agricultural landscape intactness", + "Biodiversity|Biodiversity hotspot intactness", + "Biodiversity|Biodiversity hotspot intactness (unitless)", + "Biodiversity|BII in areas outside Biodiversity Hotspots, Intact Forest & Cropland Landscapes", + "Biodiversity|Biodiversity Hotspot and Intact Forest Landscapes BII", + "Biodiversity|Biodiversity Hotspot BII", + "Biodiversity|Cropland Landscapes BII", + "Key Biodiversity Area BII", + "Biodiversity|Inverted Simpson crop area diversity index", + "Population", + "Income", + "Nutrition|Calorie Supply|+|Crops", + "Nutrition|Calorie Supply|+|Livestock products", + "Demand|++|Crops", + "Demand|++|Livestock products", + "Resources|Land Cover", + "Resources|Land Cover|+|Cropland", + "Resources|Land Cover|+|Pastures and Rangelands", + "Resources|Land Cover|+|Forest", + "Resources|Land Cover|Forest|+|Managed Forest", + "Resources|Land Cover|Forest|Natural Forest|+|Primary Forest", + "Resources|Land Cover|Forest|Natural Forest|+|Secondary Forest", + "Resources|Land Cover|+|Other Land", + "Resources|Land Cover|+|Urban Area", + "Productivity|Landuse Intensity Indicator Tau", + "Resources|Nitrogen|Cropland Budget|Inputs|+|Fertilizer", + "Resources|Nitrogen|Nutrient surplus from land and manure management", + "Resources|Water|Withdrawal|Agriculture", + ### Maps + "Costs", + "Population", + "Labor|Employment|Share of working age population employed in agriculture", + "Labor|Wages|Hourly labor costs", + ### Suppl plots + "Population", + "Prices|Index2020|Agriculture|Food products", + "Prices|Index2020|Agriculture|Food products|Livestock", + "Prices|Index2020|Agriculture|Food products|Plant-based", + "SDG|SDG02|Investment in AgR&D", + "Costs|TC", + "Agricultural Research Intensity", + "Nutrition|Calorie Intake", + "Nutrition|Calorie Intake|+|Crops", + "Nutrition|Calorie Intake|+|Fish", + "Nutrition|Calorie Intake|+|Livestock products", + "Nutrition|Calorie Intake|+|Secondary products", + "Nutrition|Calorie Intake|Crops|+|Cereals", + "Nutrition|Calorie Intake|Crops|+|Oil crops", + "Nutrition|Calorie Intake|Crops|+|Other crops", + "Nutrition|Calorie Intake|Crops|+|Sugar crops", + "Nutrition|Calorie Intake|Crops|Cereals|+|Maize", + "Nutrition|Calorie Intake|Crops|Cereals|+|Rice", + "Nutrition|Calorie Intake|Crops|Cereals|+|Temperate cereals", + "Nutrition|Calorie Intake|Crops|Cereals|+|Tropical cereals", + "Nutrition|Calorie Intake|Crops|Oil crops|+|Groundnuts", + "Nutrition|Calorie Intake|Crops|Oil crops|+|Other oil crops incl rapeseed", + "Nutrition|Calorie Intake|Crops|Oil crops|+|Soybean", + "Nutrition|Calorie Intake|Crops|Oil crops|+|Sunflower", + "Nutrition|Calorie Intake|Crops|Other crops|+|Fruits Vegetables Nuts", + "Nutrition|Calorie Intake|Crops|Other crops|+|Potatoes", + "Nutrition|Calorie Intake|Crops|Other crops|+|Pulses", + "Nutrition|Calorie Intake|Crops|Other crops|+|Tropical roots", + "Nutrition|Calorie Intake|Crops|Sugar crops|+|Sugar beet", + "Nutrition|Calorie Intake|Crops|Sugar crops|+|Sugar cane", + "Nutrition|Calorie Intake|Livestock products|+|Dairy", + "Nutrition|Calorie Intake|Livestock products|+|Eggs", + "Nutrition|Calorie Intake|Livestock products|+|Monogastric meat", + "Nutrition|Calorie Intake|Livestock products|+|Poultry meat", + "Nutrition|Calorie Intake|Livestock products|+|Ruminant meat", + "Nutrition|Calorie Intake|Secondary products|+|Alcoholic beverages", + "Nutrition|Calorie Intake|Secondary products|+|Brans", + "Nutrition|Calorie Intake|Secondary products|+|Molasses", + "Nutrition|Calorie Intake|Secondary products|+|Oils", + "Nutrition|Calorie Intake|Secondary products|+|Sugar", + "Nutrition|Calorie Supply", + "Nutrition|Calorie Supply|+|Crops", + "Nutrition|Calorie Supply|+|Fish", + "Nutrition|Calorie Supply|+|Livestock products", + "Nutrition|Calorie Supply|+|Secondary products", + "Nutrition|Calorie Supply|Crops|+|Cereals", + "Nutrition|Calorie Supply|Crops|+|Oil crops", + "Nutrition|Calorie Supply|Crops|+|Other crops", + "Nutrition|Calorie Supply|Crops|+|Sugar crops", + "Nutrition|Calorie Supply|Crops|Cereals|+|Maize", + "Nutrition|Calorie Supply|Crops|Cereals|+|Rice", + "Nutrition|Calorie Supply|Crops|Cereals|+|Temperate cereals", + "Nutrition|Calorie Supply|Crops|Cereals|+|Tropical cereals", + "Nutrition|Calorie Supply|Crops|Oil crops|+|Groundnuts", + "Nutrition|Calorie Supply|Crops|Oil crops|+|Other oil crops incl rapeseed", + "Nutrition|Calorie Supply|Crops|Oil crops|+|Soybean", + "Nutrition|Calorie Supply|Crops|Oil crops|+|Sunflower", + "Nutrition|Calorie Supply|Crops|Other crops|+|Fruits Vegetables Nuts", + "Nutrition|Calorie Supply|Crops|Other crops|+|Potatoes", + "Nutrition|Calorie Supply|Crops|Other crops|+|Pulses", + "Nutrition|Calorie Supply|Crops|Other crops|+|Tropical roots", + "Nutrition|Calorie Supply|Crops|Sugar crops|+|Sugar beet", + "Nutrition|Calorie Supply|Crops|Sugar crops|+|Sugar cane", + "Nutrition|Calorie Supply|Livestock products|+|Dairy", + "Nutrition|Calorie Supply|Livestock products|+|Eggs", + "Nutrition|Calorie Supply|Livestock products|+|Monogastric meat", + "Nutrition|Calorie Supply|Livestock products|+|Poultry meat", + "Nutrition|Calorie Supply|Livestock products|+|Ruminant meat", + "Nutrition|Calorie Supply|Secondary products|+|Alcoholic beverages", + "Nutrition|Calorie Supply|Secondary products|+|Brans", + "Nutrition|Calorie Supply|Secondary products|+|Molasses", + "Nutrition|Calorie Supply|Secondary products|+|Oils", + "Nutrition|Calorie Supply|Secondary products|+|Sugar", + "Demand|+|Agricultural Supply Chain Loss", + "Demand|+|Bioenergy", + "Demand|+|Feed", + "Demand|+|Food", + "Demand|+|Material", + "Demand|+|Processing", + "Demand|+|Seed", + "Demand|+|Roundwood", + "Demand|+|Domestic Balanceflow", + "Emissions|CO2|Land|+|Land-use Change", + "Emissions|CH4|Land|+|Agriculture", + "Emissions|N2O|Land|+|Agriculture", + "Resources|Land Cover|+|Cropland", + "Resources|Land Cover|+|Pastures and Rangelands", + "Resources|Land Cover|Forest|Natural Forest|+|Primary Forest", + "Resources|Land Cover|Forest|Natural Forest|+|Secondary Forest", + "Resources|Land Cover|Forest|Managed Forest|+|Plantations", + "Resources|Land Cover|Forest|Managed Forest|+|NPI/NDC", + "Resources|Land Cover|Forest|Managed Forest|+|Afforestation", + "Resources|Land Cover|Cropland|+|Bioenergy crops", + "Resources|Land Cover|+|Other Land", + "Resources|Land Cover|+|Urban Area", + "Resources|Land Cover|Cropland|Crops|Cereals|+|Maize", + "Resources|Land Cover|Cropland|Crops|Cereals|+|Rice", + "Resources|Land Cover|Cropland|Crops|Cereals|+|Temperate cereals", + "Resources|Land Cover|Cropland|Crops|Cereals|+|Tropical cereals", + "Resources|Land Cover|Cropland|Crops|Oil crops|+|Cotton seed", + "Resources|Land Cover|Cropland|Crops|Oil crops|+|Groundnuts", + "Resources|Land Cover|Cropland|Crops|Oil crops|+|Oilpalms", + "Resources|Land Cover|Cropland|Crops|Oil crops|+|Other oil crops incl rapeseed", + "Resources|Land Cover|Cropland|Crops|Oil crops|+|Soybean", + "Resources|Land Cover|Cropland|Crops|Oil crops|+|Sunflower", + "Resources|Land Cover|Cropland|Crops|Sugar crops|+|Sugar beet", + "Resources|Land Cover|Cropland|Crops|Sugar crops|+|Sugar cane", + "Resources|Land Cover|Cropland|Crops|Other crops|+|Fruits Vegetables Nuts", + "Resources|Land Cover|Cropland|Crops|Other crops|+|Potatoes", + "Resources|Land Cover|Cropland|Crops|Other crops|+|Pulses", + "Resources|Land Cover|Cropland|Crops|Other crops|+|Tropical roots", + "Resources|Land Cover|Cropland|+|Bioenergy crops", + "Resources|Land Cover|Cropland|+|Fallow Cropland", + "Resources|Nitrogen|Pollution|Surplus|+|Cropland", + "Resources|Nitrogen|Pollution|Surplus|+|Pasture", + "Resources|Nitrogen|Pollution|Surplus|+|Animal Waste Management", + "Resources|Nitrogen|Pollution|Surplus|+|Non-agricultural land", + "Resources|Water|Withdrawal|Agriculture", + "Nutrition|Anthropometrics|People normalweight", + "Nutrition|Anthropometrics|People obese", + "Nutrition|Anthropometrics|People overweight", + "Nutrition|Anthropometrics|People underweight", + "Labor|Employment|Agricultural employment", + "Labor|Employment|Agricultural employment|+|Crop products", + "Labor|Employment|Agricultural employment|+|Livestock products", + "Labor|Employment|Agricultural employment|+|MACCS", + "Labor|Wages|Hourly labor costs", + "Labor|Total Hours Worked", + "Income|Gini Coefficient", + "Income|Average Income of Lower 40% of Population", + "Income|Fraction of Population below half of Median Income", + "Income|Number of People Below 1p90 USDppp11/day", + "Income|Number of People Below 3p20 USDppp11/day", + "Income|Number of People Below 5p50 USDppp11/day", + "Health|Years of life lost|Disease", + "Health|Years of life lost|Disease|+|Congenital Heart Disease", + "Health|Years of life lost|Disease|+|Stroke", + "Health|Years of life lost|Disease|+|Cancer", + "Health|Years of life lost|Disease|+|Type-2 Diabetes", + "Health|Years of life lost|Disease|+|Respiratory Disease", + "Health|Percent change in Years of life lost|Disease", + "Health|Percent change in Years of life lost|Disease|+|Congenital Heart Disease", + "Health|Percent change in Years of life lost|Disease|+|Stroke", + "Health|Percent change in Years of life lost|Disease|+|Cancer", + "Health|Percent change in Years of life lost|Disease|+|Type-2 Diabetes", + "Health|Percent change in Years of life lost|Disease|+|Respiratory Disease" + ) +var_reg <- unique(var_reg) + +var_iso <- c("Population", + "Health|Years of life lost|Disease", + "Labor|Employment|Agricultural employment", + "Nutrition|Anthropometrics|People underweight", + "Nutrition|Anthropometrics|People obese", + "Household Expenditure|Food|Expenditure", + "Income|Number of People Below 3p20 USDppp11/day", + "Income|Gini Coefficient") +var_iso <- unique(var_iso) + +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)) { + a <- as.data.table(readRDS(rep)) + a <- a[variable %in% var_reg,] + a <- droplevels(a) + reg <- rbind(reg, a) + } else missing <- c(missing,rep) + + ### ISO and Grid level outputs + ## only for BAU and SDP in 2020 and 2050 to save time and storage + years <- c(2020, 2050) + scen <- c("BAU", "FSDP", "SSP2fsdp") + thisScen <- unlist(strsplit(cfg$title, "_"))[3] + if (thisScen %in% scen) { + + ### ISO level outputs + rep <- file.path(outputdir[i], "report_iso.rds") + if(file.exists(rep)) { + a <- as.data.table(readRDS(rep)) + a <- a[variable %in% var_iso & period %in% years,] + a <- droplevels(a) + iso <- rbind(iso, a) + } else missing <- c(missing,rep) + + ###Grid level outputs + y <- NULL + + ## BII + nc_file <- file.path(outputdir[i], "cell.bii_0.5.mz") #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,nc_file) + + ## Gridded temperature data from ISIMIP archive for relevant SSP/RCP + rcp <- switch(thisScen, + "BAU" = "ssp460", + "FSDP" = "ssp119", + "SSP2fsdp" = "ssp245", + "Invalid case") + + nc_file <- "./input/FSEC_GlobalSurfaceTempPerRCP_v3_04-05-23/FSEC_GlobalSurfaceTempPerRCP_v3_04-05-23.mz" + if (file.exists(nc_file)) { + a <- read.magpie(nc_file)[, years, rcp] + getNames(a) <- "Global Surface Temperature (C)" + getSets(a, fulldim = FALSE)[3] <- "variable" + a <- addLocation(a) + y <- mbind(y, a) + } else missing <- c(missing, nc_file) + + ## Crop diversity + nc_file <- file.path(outputdir[i], paste0(cfg$title, "-CropDiversityGridded.mz")) + 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,nc_file) + + ## 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,nc_file) + + ## 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,] + land_hr_shr <- a #needed for croparea shares + getNames(a) <- paste0(getNames(a)," (area share)") + getSets(a,fulldim = F)[3] <- "variable" + a <- addLocation(a) + y <- mbind(y,a) + } else missing <- c(missing,nc_file) + + ## croparea shares + nc_file <- file.path(outputdir[i], "cell.croparea_0.5_share.mz") + if(file.exists(nc_file)) { + a <- read.magpie(nc_file)[,years,] + a <- dimSums(a,dim = "w") + getNames(a) <- reportingnames(getNames(a)) + a <- mbind(a, setNames(collapseNames(land_hr_shr[,,"crop"]) - dimSums(a, dim = 3), "Fallow")) + a[a < 0] <- 0 + getNames(a) <- paste0("Cropland|",getNames(a)," (area share)") + getSets(a,fulldim = F)[3] <- "variable" + a <- addLocation(a) + y <- mbind(y,a) + } else missing <- c(missing,nc_file) + + ## 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, nc_file) + + ## Water + nc_file <- file.path(outputdir[i], "watStressViolations.mz") + 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, nc_file) + + nc_file <- file.path(outputdir[i], "efvVolume.mz") + if (file.exists(nc_file)) { + a <- read.magpie(nc_file)[, years, ] + getNames(a) <- "water environmental flow violations volume (km3)" + getSets(a, fulldim = FALSE)[3] <- "variable" + a <- addLocation(a) + y <- mbind(y, a) + } else missing <- c(missing, nc_file) + + nc_file <- file.path(outputdir[i], "efvVolume_ha.mz") + if (file.exists(nc_file)) { + a <- read.magpie(nc_file)[, years, ] + getNames(a) <- "water environmental flow violations volume (m3/ha)" + getSets(a, fulldim = FALSE)[3] <- "variable" + a <- addLocation(a) + y <- mbind(y, a) + } else missing <- c(missing, nc_file) + + #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) +} + +renameScenario <- function(rep) { + rep <- rep[!get("scenario") %like% "calibration_FSEC", ] + rep[, c("version", "scenset", "scenario") := tstrsplit(scenario, "_", fixed = TRUE)] + return(rep) +} + +reg <- renameScenario(reg) +iso <- renameScenario(iso) +grid <- renameScenario(grid) + +message("Saving rds files ...") + +saveRDS(reg, file = file.path("output", paste0(rev, "_FSDP_reg.rds")), version = 2, compress = "xz") +saveRDS(iso, file = file.path("output", paste0(rev, "_FSDP_iso.rds")), version = 2, compress = "xz") +saveRDS(grid, file = file.path("output", paste0(rev, "_FSDP_grid.rds")), 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, file.path("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", paste0(rev, "_FSDP_validation.rds")), version = 2, compress = "xz") + +message("Plotting figures ...") +#Add new plots here: +#https://github.com/pik-piam/m4fsdp/blob/master/R/plotFSDP.R +plotFSDP(outputfolder = "output", + reg = reg, + iso = iso, + grid = grid, + val = val, + reg2iso = reg2iso, + rev = rev) diff --git a/scripts/output/projects/FSDP_process.R b/scripts/output/projects/FSDP_process.R new file mode 100644 index 0000000000..a1729640af --- /dev/null +++ b/scripts/output/projects/FSDP_process.R @@ -0,0 +1,124 @@ +# | (C) 2008-2023 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) +library(dplyr) +library(tidyr) + +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) + + dietaryIndicators <- dietaryIndicators %>% + pivot_longer(cols = c("population", + "bodyweight", + "bodyheight", + "PAL", + "intake"), + names_to = "Data", + values_to = "Value") + + if (file.info(caloricSupply_mergePath)$size == 0) { + # Include the header + write.table(caloricSupply, file = caloricSupply_mergePath, + quote = TRUE, sep = ",", row.names = FALSE, col.names = TRUE) + } 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 = TRUE) + } 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_HalfOverweight", "a_NoOverweight", + "a_DietVegFruitsNutsSeeds", "a_DietMonogastrics", "a_DietRuminants", + "a_DietLegumes", "a_DietEmptyCals", "a_DietFish", + "a_LessFoodWaste", + "a_Population", "a_EconDevelop", + "e_FSDP", + "b_REDDaffRuminants", "b_Diet", "b_DietRotations", "b_MonogastricsRotations", + "b_ExternalPressures", "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..7 values=8 useHeader=y\n", + file = gamsScript, append = TRUE) + cat("$call csv2gdx caloricSupply.csv output=caloricSupply.gdx id=caloricSupply index=1..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..d78c741ceb --- /dev/null +++ b/scripts/output/projects/FSEC_AlessandroPassaro.R @@ -0,0 +1,53 @@ +# | (C) 2008-2023 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) diff --git a/scripts/output/projects/FSEC_SimonDietz.R b/scripts/output/projects/FSEC_SimonDietz.R new file mode 100644 index 0000000000..72dec6b34a --- /dev/null +++ b/scripts/output/projects/FSEC_SimonDietz.R @@ -0,0 +1,54 @@ +# | (C) 2008-2023 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 new file mode 100644 index 0000000000..473ea52e40 --- /dev/null +++ b/scripts/output/projects/FSEC_StevenLord.R @@ -0,0 +1,53 @@ +# | (C) 2008-2023 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 output dataset for Steven Lord +# comparison script: FALSE +# --------------------------------------------------------------- + +# Version 1.00 - Michael Crawford +# 1.00: first working version + +library(gms) +library(magpie4) + +message("Starting FSEC_StevenLord 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 Steven Lord's datasets") +stevenLordDir <- file.path(".", "output", "StevenLord") +if (!dir.exists(stevenLordDir)) { + dir.create(stevenLordDir) +} + +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) + +out <- getReportFSECStevenLord(magpieOutputDir = outputdir, + reportOutputDir = reportOutputDir, + scenario = title) diff --git a/scripts/output/projects/FSEC_costs.R b/scripts/output/projects/FSEC_costs.R new file mode 100644 index 0000000000..1ad7b5d941 --- /dev/null +++ b/scripts/output/projects/FSEC_costs.R @@ -0,0 +1,42 @@ +# | (C) 2008-2023 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 costs output dataset +# comparison script: FALSE +# --------------------------------------------------------------- + +# Version 1.00 - Michael Crawford +# 1.00: first working version + +library(gms) +library(magpie4) + +message("Starting FSEC costs 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 costs output for the run: ", title) +gdx <- file.path(outputdir, "fulldata.gdx") + +out <- getReportFSECCosts(gdx = gdx, + 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..49cf84eb16 --- /dev/null +++ b/scripts/output/projects/FSEC_cropDiversityGrid.R @@ -0,0 +1,44 @@ +# | (C) 2008-2023 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 new file mode 100644 index 0000000000..a07219e229 --- /dev/null +++ b/scripts/output/projects/FSEC_dietaryIndicators.R @@ -0,0 +1,45 @@ +# | (C) 2008-2023 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 population-level dietary information and consumption data from a MAgPIE run +# comparison script: FALSE +# --------------------------------------------------------------- + +# Version 1.00 - Michael Crawford +# 1.00: first working version + +library(gms) +library(magpie4) + +message("Starting FSEC_DietaryIndicators output runscript") + +############################# BASIC CONFIGURATION ####################################### +if (!exists("source_include")) { + + title <- NULL + outputdir <- NULL + + # Define arguments that can be read from command line + readArgs("outputdir", "title") + +} +######################################################################################### + +baseDir <- getwd() +message("Script started for output directory: ", outputdir) +cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) +title <- cfg$title + +message("Generating DietaryIndicators output for the run: ", title) +gdx <- file.path(outputdir, "fulldata.gdx") +report <- getReportDietaryIndicators(gdx, scenario = title) + +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 new file mode 100644 index 0000000000..c03cb38fc6 --- /dev/null +++ b/scripts/output/projects/FSEC_nitrogenPollution.R @@ -0,0 +1,42 @@ +# | (C) 2008-2023 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 environmental pollutants output dataset +# comparison script: FALSE +# --------------------------------------------------------------- + +# Version 1.00 - Michael Crawford +# 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 nitrogen pollution output for the run: ", title) + +# Grid-level nitrogen pollution +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..436af518b5 --- /dev/null +++ b/scripts/output/projects/FSEC_water.R @@ -0,0 +1,61 @@ +# | (C) 2008-2023 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 water 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") + +### Grid-level water indicators ### +# Volume of environmental flow violations (EFV) (in km^3) +efvViolation <- waterEFViolation(gdx, level = "grid", dir = outputdir) +write.magpie(efvViolation, file_name = file.path(outputdir, "efvVolume.mz")) + +# Total land (in mio. ha) +gridLand <- reportGridLand(gdx, dir = outputdir) +# transform to ha +totalLand <- dimSums(gridLand, dim = 3) * 1e6 +# Environmental flow violations per hectare of total area (in m3/ha) +efvViolation_ha <- ifelse(totalLand > 10, (efvViolation * 1e9) / totalLand, 0) +write.magpie(efvViolation_ha, file_name = file.path(outputdir, "efvVolume_ha.mz")) + +# Binary indicator of EFV +efvViolation[efvViolation > 0] <- 1 + +# Water stress indicator (use-to-availability ratio) +watStress <- waterStressRatio(gdx, level = "grid", dir = outputdir) +watStressViolations <- watStress +# mark violations in different color +watStressViolations[efvViolation == 1] <- 100 +write.magpie(watStressViolations, file_name = file.path(outputdir, "watStressViolations.mz")) diff --git a/scripts/output/projects/MAgPIE2GAINS.R b/scripts/output/projects/MAgPIE2GAINS.R index c73b26f3d1..2ee67514db 100644 --- a/scripts/output/projects/MAgPIE2GAINS.R +++ b/scripts/output/projects/MAgPIE2GAINS.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -16,6 +16,7 @@ library(lucode2) library(magpie4) library(MagpieNCGains) +library(gms) print("Start GAINS reporting reg runscript") @@ -33,7 +34,7 @@ if(!exists("source_include")) { print(paste0("script started for output directory ",outputdir)) -load(paste0(outputdir, "/config.Rdata")) +cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) title <- cfg$title print("generating GAINS outputs for the run: ") print(title) diff --git a/scripts/output/projects/MAgPIE2LPJmL.R b/scripts/output/projects/MAgPIE2LPJmL.R index 3b5f857c0f..eaa94c5f8e 100644 --- a/scripts/output/projects/MAgPIE2LPJmL.R +++ b/scripts/output/projects/MAgPIE2LPJmL.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -15,16 +15,17 @@ library(lucode2) library(magpie4) +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") } @@ -32,7 +33,7 @@ if(!exists("source_include")) { print(paste0("script started for output directory ",outputdir)) -load(paste0(outputdir, "/config.Rdata")) +cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) title <- cfg$title print("generating INMS output for the run: ") print(title) @@ -53,4 +54,4 @@ print("starting cellular output generation using getReportMAgPIE2LPJmL") a <- getReportMAgPIE2LPJmL(gdx = gdx, folder=outputpath, - spamfiledirectory = outputdir) + dir = outputdir) diff --git a/scripts/output/projects/agmip_merge_report.R b/scripts/output/projects/agmip_merge_report.R index 770db9872b..d7bf55b10d 100644 --- a/scripts/output/projects/agmip_merge_report.R +++ b/scripts/output/projects/agmip_merge_report.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -15,12 +15,13 @@ library(magclass) library(quitte) library(madrat) library(iamc) +library(gms) options(error=function()traceback(2)) ############################# BASIC CONFIGURATION ############################# if(!exists("source_include")) { - outputdir <- path("output/",list.dirs("output/", full.names = FALSE, recursive = FALSE)) + outputdir <- file.path("output/",list.dirs("output/", full.names = FALSE, recursive = FALSE)) #Define arguments that can be read from command line readArgs("outputdir") } @@ -34,10 +35,10 @@ if(file.exists("output/agmip_report_full.csv")) file.rename("output/agmip_report for (i in 1:length(outputdir)) { print(paste("Processing",outputdir[i])) #gdx file - rep<-path(outputdir[i],"agmip_report.mif") + rep<-file.path(outputdir[i],"agmip_report.mif") if(file.exists(rep)) { #get scenario name - load(path(outputdir[i],"config.Rdata")) + cfg <- gms::loadConfig(file.path(outputdir[i], "config.yml")) scen <- cfg$title #Remove prefix starting with "V", like "V2" scen_parts <- unlist(strsplit(scen,"_")) @@ -47,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)) { @@ -61,4 +62,3 @@ if(file.exists("output/agmip_report_full.csv")) { write.reportProject(mif="output/agmip_report_full.csv",mapping = system.file("extdata",mapping="variablemappingAgMIP.csv",package = "magpie4"), file = "output/agmip_report_subset.csv",format="AgMIP") #write.reportProject(mif="output/agmip_report_full.csv",mapping = "mapping_magpie_agmip.csv", file = "agmip_report_subset.csv",format="AgMIP") } - diff --git a/scripts/output/projects/agmip_report.R b/scripts/output/projects/agmip_report.R index 671e6f4cd7..23545059d2 100644 --- a/scripts/output/projects/agmip_report.R +++ b/scripts/output/projects/agmip_report.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -6,7 +6,7 @@ # | Contact: magpie@pik-potsdam.de # -------------------------------------------------------------- -# description: extract agmip-report in rds format from run +# description: extract agmip-report in rds format from run # comparison script: FALSE # --------------------------------------------------------------- @@ -14,6 +14,7 @@ library(magclass) library(magpie4) library(lucode2) library(quitte) +library(gms) options("magclass.verbosity" = 1) ############################# BASIC CONFIGURATION ############################# @@ -22,16 +23,16 @@ if(!exists("source_include")) { readArgs("outputdir") } -load(paste0(outputdir, "/config.Rdata")) -gdx <- path(outputdir,"fulldata.gdx") +cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) +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/inms_merge_report.R b/scripts/output/projects/inms_merge_report.R index 97d82a71c2..67c2b17525 100644 --- a/scripts/output/projects/inms_merge_report.R +++ b/scripts/output/projects/inms_merge_report.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -16,12 +16,13 @@ library(lucode2) library(magclass) library(quitte) +library(gms) options(error=function()traceback(2)) ############################# BASIC CONFIGURATION ############################# if(!exists("source_include")) { - outputdir <- lucode2::path("output/",list.dirs("output/", full.names = FALSE, recursive = FALSE)) + outputdir <- file.path("output/",list.dirs("output/", full.names = FALSE, recursive = FALSE)) #Define arguments that can be read from command line lucode2::readArgs("outputdir") } @@ -30,24 +31,26 @@ 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<-path(outputdir[i],"report_inms.mif") + rep <- file.path(outputdir[i], "report_inms.mif") if(file.exists(rep)) { #get scenario name - load(path(outputdir[i],"config.Rdata")) + 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]) + 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_cell.R b/scripts/output/projects/inms_reporting_cell.R new file mode 100644 index 0000000000..0d614c17a8 --- /dev/null +++ b/scripts/output/projects/inms_reporting_cell.R @@ -0,0 +1,61 @@ +# | (C) 2008-2023 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 cellular cropland management data +# comparison script: FALSE +# --------------------------------------------------------------- + +#Version 1.00 - Benjamin Leon Bodirsky +# 1.00: first working version + +library(lucode2) +library(magpie4) +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)) + +cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) +title <- cfg$title +print("generating INMS output for the run: ") +print(title) +title=strsplit(title,"_v") + +gdx <- paste0(outputdir,"/fulldata.gdx") + +tgz <- paste0("/p/projects/landuse/data/input/archive/",strsplit(cfg$input[1],split = "c200")[[1]][[1]],"0.5.tgz") +print(paste0("trying to extract lpj_yields_0.5.mz from ",tgz)) +untar(tarfile = tgz, files = "lpj_yields_0.5.mz", exdir=outputdir) + +print("create an separate output directory for cellular results") +outputpath<-paste0("./output/inms/") +if(!dir.exists(outputpath)) {dir.create(outputpath)} +#print("save origin path in folder so that original run data can be found") +#write.table(x = outputdir,file = paste0(outputpath,"origin_folder.txt"),row.names = FALSE,col.names = FALSE) + +print("starting cellular output generation using getReportMAgPIE2LPJmL") + +a <- getReportGridINMS(gdx = gdx, + folder=outputpath, + dir = outputdir, + scenario=paste0("v",title[[1]][1]), + versionnr=paste0("v",title[[1]][2]) + ) diff --git a/scripts/output/projects/inms_reporting_reg.R b/scripts/output/projects/inms_reporting_reg.R index 63775a4664..2ad83e0ee9 100644 --- a/scripts/output/projects/inms_reporting_reg.R +++ b/scripts/output/projects/inms_reporting_reg.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -6,7 +6,7 @@ # | Contact: magpie@pik-potsdam.de # -------------------------------------------------------------- -# description: extract inms-report in mif format from run +# description: extract inms-report in mif format from run # comparison script: FALSE # --------------------------------------------------------------- @@ -17,15 +17,16 @@ 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") } @@ -33,14 +34,16 @@ if(!exists("source_include")) { print(paste0("script started for output directory",outputdir)) -load(paste0(outputdir, "/config.Rdata")) +withr::local_dir(outputdir) + +cfg <- gms::loadConfig("config.yml") title <- cfg$title print("generating INMS output for the run: ") print(title) -filename=paste0(outputdir,"report_",title,".mif") -gdx=paste0(outputdir,"/fulldata.gdx") -a=getReportINMS(gdx,file=filename,scenario = title) +filename=paste0("report_",title,".mif") +gdx=paste0("fulldata.gdx") +a=getReportINMS(gdx,file=filename,scenario = title,dir=".") print(filename) mif=read.report(filename) @@ -56,7 +59,6 @@ missingyears=function(x){ #a=c(missingyears(ssp1),missingyears(ssp2)) a=missingyears(mif) -write.reportProject(a,mapping="mapping_inms.csv",file=paste0(outputdir,"report_inms.mif")) -#write.report2(a,file="magpie_results_nov2019.mif") - - +write.reportProject(a,mapping=paste0(wdbefore,"/mapping_inms.csv"),file="report_inms.mif") +#write.report(a,file="magpie_results_nov2019.mif") +warnings() diff --git a/scripts/output/projects/peatland.R b/scripts/output/projects/peatland.R index d84e237762..d00423dc2c 100644 --- a/scripts/output/projects/peatland.R +++ b/scripts/output/projects/peatland.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -26,12 +26,13 @@ library(data.table) library(ggrepel) library(patchwork) library(quitte) +library(gms) options(error=function()traceback(2)) ############################# BASIC CONFIGURATION ############################# if(!exists("source_include")) { - outputdir <- path("output/",list.dirs("output/", full.names = FALSE, recursive = FALSE)) + outputdir <- file.path("output/",list.dirs("output/", full.names = FALSE, recursive = FALSE)) #Define arguments that can be read from command line readArgs("outputdir") } @@ -59,10 +60,10 @@ missing <- NULL for (i in 1:length(outputdir)) { print(paste("Processing",outputdir[i])) - gdx<-path(outputdir[i],"fulldata.gdx") - rep<-path(outputdir[i],"report.rds") + gdx<-file.path(outputdir[i],"fulldata.gdx") + rep<-file.path(outputdir[i],"report.rds") if(file.exists(gdx)) { - load(path(outputdir[i],"config.Rdata")) + cfg <- gms::loadConfig(file.path(outputdir[i], "config.yml")) scen <- cfg$title prefix <- substring(scen, 1, 4) diff --git a/scripts/output/rds_report.R b/scripts/output/rds_report.R index 0c97c0896d..f8787603ac 100644 --- a/scripts/output/rds_report.R +++ b/scripts/output/rds_report.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -6,9 +6,9 @@ # | 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: 1 +# position: 2 # --------------------------------------------------------------- @@ -16,6 +16,7 @@ library(magclass) library(magpie4) library(lucode2) library(quitte) +library(gms) options("magclass.verbosity" = 1) ############################# BASIC CONFIGURATION ############################# @@ -24,21 +25,21 @@ if(!exists("source_include")) { readArgs("outputdir") } -load(paste0(outputdir, "/config.Rdata")) -gdx <- path(outputdir,"fulldata.gdx") +cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) +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, dir = outputdir) +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() @@ -48,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..4aaab1f8a9 --- /dev/null +++ b/scripts/output/rds_report_iso.R @@ -0,0 +1,39 @@ +# | (C) 2008-2023 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..96c78a2d31 --- /dev/null +++ b/scripts/output/runBlackmagicc.R @@ -0,0 +1,35 @@ +# | (C) 2008-2023 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/output/validation.R b/scripts/output/validation.R index 6201fe9901..7fd189847a 100644 --- a/scripts/output/validation.R +++ b/scripts/output/validation.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -6,20 +6,21 @@ # | Contact: magpie@pik-potsdam.de # -------------------------------------------------------------- -# description: creates a validation pdf file for a run +# description: creates a validation pdf file for a run (long version - single crop types) # comparison script: FALSE -# position: 3 +# position: 4 # --------------------------------------------------------------- library(magpie4) +library(gms) ############################# BASIC CONFIGURATION ############################# if(!exists("source_include")) { outputdir <-"." } -load(paste0(outputdir, "/config.Rdata")) +cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) hist <- c(paste0(outputdir, "/validation.mif"), "input/validation.mif") file <- paste0(outputdir, "/", cfg$title, "_validation.pdf") reportrds <- paste0(outputdir, "/report.rds") diff --git a/scripts/output/validation_short.R b/scripts/output/validation_short.R new file mode 100644 index 0000000000..51ae291320 --- /dev/null +++ b/scripts/output/validation_short.R @@ -0,0 +1,48 @@ +# | (C) 2008-2023 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: creates a validation pdf file for a run (short version - aggregated crop types) +# comparison script: FALSE +# position: 5 +# --------------------------------------------------------------- + + +library(magpie4) +library(gms) + +############################# BASIC CONFIGURATION ############################# +if(!exists("source_include")) { + outputdir <-"." +} + +cfg <- gms::loadConfig(file.path(outputdir, "config.yml")) +hist <- c(paste0(outputdir, "/validation.mif"), "input/validation.mif") +file <- paste0(outputdir, "/", cfg$title, "_validation.pdf") +reportrds <- paste0(outputdir, "/report.rds") +gdx <- paste0(outputdir, "/fulldata.gdx") +runinfo <- paste0(outputdir, "/", cfg$title, "_*.RData") +############################################################################### + +#### Choose validation data ### +# Use first hist file that can be found + +for(h in hist) { + if(file.exists(h)) break +} + +runinfo <- Sys.glob(runinfo) +if(length(runinfo)>1) { + runinfo <- runinfo[1] + warnings("More than one runinfo file found. The first one will be used.") +} else if (length(runinfo)==0) { + runinfo <- NULL +} + +getReport <- getReport(gdx,scenario = cfg$title,detail=FALSE) + +validation(gdx=gdx, hist=h, file = file, runinfo=runinfo, scenario=cfg$title, getReport=getReport) diff --git a/scripts/performance_test.R b/scripts/performance_test.R index 9884f38035..df18953a59 100644 --- a/scripts/performance_test.R +++ b/scripts/performance_test.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -13,7 +13,7 @@ performance_start <- function(cfg="default.cfg",modulepath="modules/",id="perfor if(!is.list(cfg)) { if(is.character(cfg)) { - source(path("config",cfg),local=TRUE) + source(file.path("config",cfg),local=TRUE) if(!is.list(cfg)) stop("Wrong input file format: config file does not contain a cfg list!") } else { stop("Wrong input format: cfg is neither a list nor a character!") @@ -52,9 +52,7 @@ performance_start <- function(cfg="default.cfg",modulepath="modules/",id="perfor performance_collect <- function(id="performance",results_folder="output/",plot=TRUE) { require(magpie4) require(lucode2) - maindir <- getwd() - on.exit(setwd(maindir)) - setwd(results_folder) + withr::local_dir(results_folder) folders <- grep(paste("^",id,"__",sep=""),list.dirs(full.names = FALSE, recursive = FALSE),value=TRUE) tmp <- grep(paste("^",id,"__default",sep=""),folders) default <- folders[tmp] @@ -63,7 +61,7 @@ performance_collect <- function(id="performance",results_folder="output/",plot=T if(length(folders)==0) stop("No folders found which fit to the given id (",id,")") .modelstats <- function(f,colMeans=TRUE) { - logfile <- path(f,"full.log") + logfile <- file.path(f,"full.log") if(file.exists(logfile)) { tmp <- readLines(logfile) p1 <- "--- ([^ ]*) rows ([^ ]*) columns ([^ ]*) non-zeroes" @@ -112,14 +110,14 @@ performance_collect <- function(id="performance",results_folder="output/",plot=T for(f in folders){ tmp <- strsplit(f,"__")[[1]] ms <- .modelstats(f,colMeans=TRUE) - tmp2 <- data.frame(module=tmp[2],realization=tmp[3],default=FALSE,runtime=.gettime(path(f,f,ftype="RData")),infes=.infescheck(path(f,"fulldata.gdx")), + tmp2 <- data.frame(module=tmp[2],realization=tmp[3],default=FALSE,runtime=.gettime(file.path(f,paste0(f,".RData"))),infes=.infescheck(file.path(f,"fulldata.gdx")), rows=ms["rows"],columns=ms["columns"],nonzeroes=ms["nonzeroes"],nlcode=ms["nlcode"],nlnonzeroes=ms["nlnonzeroes"]) results <- rbind(results,tmp2) } - load(path(default,"config.Rdata")) + cfg <- gms::loadConfig(file.path(default, "config.yml")) for(n in unique(results$module)) { ms <- .modelstats(default,colMeans=TRUE) - tmp <- data.frame(module=n,realization=cfg$gms[[n]],default=TRUE,runtime=.gettime(path(default,default,ftype="RData")),infes=.infescheck(path(default,"fulldata.gdx")), + tmp <- data.frame(module=n,realization=cfg$gms[[n]],default=TRUE,runtime=.gettime(file.path(default,paste0(default,".RData"))),infes=.infescheck(file.path(default,"fulldata.gdx")), rows=ms["rows"],columns=ms["columns"],nonzeroes=ms["nonzeroes"],nlcode=ms["nlcode"],nlnonzeroes=ms["nlnonzeroes"]) results <- rbind(results,tmp) } @@ -138,8 +136,8 @@ performance_collect <- function(id="performance",results_folder="output/",plot=T attr(results,"default_cfg") <- cfg attr(results,"id") <- id - if(file.exists(path(default,"git.rda"))) { - load(path(default,"git.rda")) + if(file.exists(file.path(default,"git.rda"))) { + load(file.path(default,"git.rda")) attr(results,"git") <- git } diff --git a/scripts/postRelease.R b/scripts/postRelease.R new file mode 100644 index 0000000000..6c5f3195bf --- /dev/null +++ b/scripts/postRelease.R @@ -0,0 +1,45 @@ +postRelease <- function() { + gert::git_fetch("upstream") + gert::git_merge("upstream/master") + + pattern <- "and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)." + textToAdd <- paste("", + "", + "", + "## [Unreleased]", + "", + "### changed", + "-", + "", + "### added", + "-", + "", + "### removed", + "-", + "", + "### fixed", + "-", + sep = "\n") + + readLines("CHANGELOG.md") |> + sub(pattern = pattern, replacement = paste0(pattern, textToAdd), fixed = TRUE) |> + writeLines("CHANGELOG.md") + + readLines("CITATION.cff") |> + sub(pattern = "^(version:.*)$", replacement = "\\1dev") |> + writeLines("CITATION.cff") + + citation::cff2zenodo("CITATION.cff") + + message("TODO: git add -p\n", + "Press enter when done to commit, push and create PR") + gms::getLine() + + gert::git_commit("merge master into develop") + gert::git_push() + system(paste0("gh pr create --base develop --title 'merge master into develop' --body ''")) +} + +postRelease() +message("warnings:") +print(warnings()) diff --git a/scripts/projects/fsec.R b/scripts/projects/fsec.R new file mode 100644 index 0000000000..8800339922 --- /dev/null +++ b/scripts/projects/fsec.R @@ -0,0 +1,223 @@ +# | (C) 2008-2023 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 <- "v36_FSEC" + + x <- list(c_BAU = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "RCP60")), + d_SSP1bau = list(standard = c("cc", "SSP1", "NDC", "ForestryEndo"), + fsec = c("FSEC", "SSP1", "RCP45")), + d_SSP1PLUSbau = list(standard = c("cc", "SSP1", "NDC", "ForestryEndo"), + fsec = c("FSEC", "SSP1", + "energy", "bioplastics", "population", "institutions", "timberCities", "RCP26")), + d_SSP3bau = list(standard = c("cc", "SSP3", "NDC", "ForestryEndo"), + fsec = c("FSEC", "SSP3", "RCP70")), + d_SSP4bau = list(standard = c("cc", "SSP4", "NDC", "ForestryEndo"), + fsec = c("FSEC", "SSP4", "RCP45")), + d_SSP5bau = list(standard = c("cc", "SSP5", "NDC", "ForestryEndo"), + fsec = c("FSEC", "SSP5", "RCP85")), + # FSDP (all transformations active) + e_FSDP = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", + "energy", "bioplastics", "population", "institutions", "timberCities", + "awms", "livestock", "nueMAC", "riceMAC", "biodiversity", "fairTrade", "capitalSubst", "minWage", + "REDDaff", "REDD", "landscapeElements", "landSharing", "landSparing", "waterSparing", "peatland", + "soil", "allDietAndWaste", "allEnvPrice", "SSP1energy", "RCP19")), + # FSDPs (without external) + d_SSP1fsdp = list(standard = c("cc", "SSP1", "NDC", "ForestryEndo"), + fsec = c("FSEC", "SSP1", + "awms", "livestock", "nueMAC", "riceMAC", "biodiversity", "fairTrade", "capitalSubst", "minWage", + "REDDaff", "REDD", "landscapeElements", "landSharing", "landSparing", "waterSparing", "peatland", + "soil", "allDietAndWaste", "allEnvPrice", "RCP26")), + d_SSP2fsdp = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "SSP2", + "awms", "livestock", "nueMAC", "riceMAC", "biodiversity", "fairTrade", "capitalSubst", "minWage", + "REDDaff", "REDD", "landscapeElements", "landSharing", "landSparing", "waterSparing", "peatland", + "soil", "allDietAndWaste", "allEnvPrice", "RCP45")), + d_SSP3fsdp = list(standard = c("cc", "SSP3", "NDC", "ForestryEndo"), + fsec = c("FSEC", "SSP3", + "awms", "livestock", "nueMAC", "riceMAC", "biodiversity", "fairTrade", "capitalSubst", "minWage", + "REDDaff", "REDD", "landscapeElements", "landSharing", "landSparing", "waterSparing", "peatland", + "soil", "allDietAndWaste", "allEnvPrice", "RCP45")), + d_SSP4fsdp = list(standard = c("cc", "SSP4", "NDC", "ForestryEndo"), + fsec = c("FSEC", "SSP4", + "awms", "livestock", "nueMAC", "riceMAC", "biodiversity", "fairTrade", "capitalSubst", "minWage", + "REDDaff", "REDD", "landscapeElements", "landSharing", "landSparing", "waterSparing", "peatland", + "soil", "allDietAndWaste", "allEnvPrice", "RCP26")), + d_SSP5fsdp = list(standard = c("cc", "SSP5", "NDC", "ForestryEndo"), + fsec = c("FSEC", "SSP5", + "awms", "livestock", "nueMAC", "riceMAC", "biodiversity", "fairTrade", "capitalSubst", "minWage", + "REDDaff", "REDD", "landscapeElements", "landSharing", "landSparing", "waterSparing", "peatland", + "soil", "allDietAndWaste", "allEnvPrice", "RCP60")), + # Individual transformation clusters: + a_Population = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "population", "RCP60")), + a_EconDevelop = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "institutions", "RCP60")), + a_EnergyTrans = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "energy", "RCP26")), + a_Bioplastics = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "bioplastics", "RCP60")), + a_CapitalSubst = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "capitalSubst", "RCP60")), + a_MinWage = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "minWage", "RCP60")), + a_NoUnderweight = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "noUnderweight", "RCP60")), + a_HalfOverweight = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "halfOverweight", "RCP60")), + a_DietVegFruitsNutsSeeds = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "fruitsNutsVegSeeds", "RCP60")), + a_DietMonogastrics = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "monogastrics", "RCP60")), + a_DietRuminants = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "ruminants", "RCP45")), + a_DietLegumes = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "pulses", "RCP60")), + a_DietEmptyCals = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "processed", "RCP60")), + a_DietFish = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "fish", "RCP60")), + a_LessFoodWaste = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "waste", "RCP60")), + a_ManureMngmt = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "awms", "RCP60")), + a_LivestockMngmt = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "livestock", "RCP60")), + a_CropeffTax = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "cropefficiency", "RCP60")), + a_NitrogenEff = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "nueMAC", "RCP60")), + a_RiceMit = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "riceMAC", "RCP60")), + a_BiodivSparing = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "biodiversity", "RCP60")), + a_LiberalizedTrade = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "fairTrade", "RCP60")), + a_TimberCities = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "timberCities", "RCP60")), + a_REDDaff = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "REDDaff", "RCP60")), + a_REDD = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "REDD", "RCP60")), + a_CropRotations = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "landSharing", "RCP60")), + a_LandscapeElements = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "landscapeElements", "RCP60")), + a_LandSparing = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "landSparing", "RCP60")), + a_WaterSparing = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "waterSparing", "RCP60")), + a_PeatlandSparing = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "peatland", "RCP60")), + a_SoilCarbon = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "soil", "RCP60")), + # Scenarios (combinations of transformation clusters) + b_ExternalPressures = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "population", "institutions", "energy", "bioplastics", "timberCities", "SSP1energy", "RCP26")), + b_WaterSoil = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "waterSparing", "soil", "RCP60")), + b_REDDaffRuminants = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "ruminants", "REDDaff", "RCP60")), + b_DietRotations = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "landSharing", "allDiet", "RCP60")), + b_MonogastricsRotations = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "landSharing", "monogastrics", "RCP60")), + b_TradeRotations = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "landSharing", "fairTrade", "RCP60")), + b_TradeREDDaff = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "fairTrade", "REDDaff", "RCP60")), + b_TradeSoil = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "fairTrade", "soil", "RCP60")), + b_TradeMonogastrics = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "fairTrade", "monogastrics", "RCP60")), + b_TradeRuminants = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "fairTrade", "ruminants", "RCP60")), + b_TradeVeggies = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "fairTrade", "fruitsNutsVegSeeds", "RCP60")), + b_MonogastricsVeggies = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "monogastrics", "fruitsNutsVegSeeds", "RCP60")), + b_SoilMonogastric = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "monogastrics", "soil", "RCP60")), + b_SoilMonogastricRuminants = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "monogastrics", "ruminants","soil", "RCP60")), + b_SoilRotations = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "landSharing", "soil", "RCP60")), + b_LivestockManureMngmt = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "livestock", "awms", "RCP60")), + b_LivestockNUEMngmt = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "livestock", "nueMAC", "RCP60")), + b_AllNitrogen = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "awms", "nueMAC", "monogastrics", "ruminants", "waste", "RCP60")), + b_AllClimate = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "nueMAC", "riceMAC", "awms", "allEnvPrice", "RCP60")), + b_FullBiodiv = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "biodiversity", "landSharing", "RCP60")), + b_AllEnvironment = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "biodiversity", "REDDaff", + "landSparing", "waterSparing", "peatland", "soil", "allEnvPrice", "RCP60")), + b_AllHealth = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "allDiet", "RCP60")), + b_AllInclusion = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "population", "institutions", "timberCities", "fairTrade", "capitalSubst", "minWage", "RCP60")), + b_Livelihoods = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "fairTrade", "capitalSubst", "minWage", "RCP60")), + b_LivelihoodsExt = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "fairTrade", "capitalSubst", "minWage", "bioplastics", "energy", "timberCities", "RCP60")), + b_Bioeconomy = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "bioplastics", "energy", "timberCities", "RCP60")), + b_AgroMngmt = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "landSharing", "landscapeElements", "nueMAC", "riceMAC", "livestock", "awms", "soil", "RCP45")), + b_Efficiency = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "awms", "waste", "fairTrade", "nueMAC", "RCP60")), + b_Diet = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "allDietAndWaste", "RCP45")), + b_Protection = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "waterSparing", "landSparing", "peatland", "RCP60")), + b_NatureSparing = list(standard = c("cc", "SSP2", "NDC", "ForestryEndo"), + fsec = c("FSEC", "waterSparing", "landSparing", "peatland", "biodiversity", "REDDaff", "RCP45")) + ) + # 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) + # Download gridded RCP temperature data + gms::download_unpack(input = "FSEC_GlobalSurfaceTempPerRCP_v3_04-05-23.tgz", + targetdir = "./input", + repositories = cfg$repositories) + + # general + cfg$title <- paste(v, scenario, sep = "") + cfg$recalibrate <- FALSE + cfg$qos <- "standby_maxMem_dayMax" + cfg$output <- c("extra/highres", + "extra/disaggregation", + "projects/FSEC_nitrogenPollution", + "projects/FSEC_cropDiversityGrid", + "projects/FSEC_dietaryIndicators", + "projects/FSEC_costs", + "projects/FSEC_water", + "rds_report_iso", + "rds_report") + cfg$force_download <- TRUE + cfg$gms$s80_optfile <- 1 + + return(cfg) +} diff --git a/scripts/release.R b/scripts/release.R new file mode 100644 index 0000000000..3160219ff9 --- /dev/null +++ b/scripts/release.R @@ -0,0 +1,56 @@ +release <- function(newVersion) { + if (Sys.which("sbatch") == "") { + stop("release must be created on cluster") + } + + releaseDate <- format(Sys.time(), "%Y-%m-%d") + oldVersion <- readLines("CITATION.cff") |> + grep(pattern = "^version: (.*)$", value = TRUE) |> + sub(pattern = "^version: (.*)$", replacement = "\\1") |> + sub(pattern = "dev", replacement = "") + + githubUrl <- "https://github.com/magpiemodel/magpie/compare/" + readLines("CHANGELOG.md") |> + sub(pattern = "## [Unreleased]", replacement = paste0("## [", newVersion, "] - ", releaseDate), fixed = TRUE) |> + sub(pattern = paste0("\\[Unreleased\\]: ", githubUrl, "v(.+)\\.\\.\\.develop"), + replacement = paste0("[Unreleased]: ", githubUrl, "v", newVersion, "...develop\n", + "[", newVersion, "]: ", githubUrl, "v\\1...v", newVersion)) |> + writeLines("CHANGELOG.md") + + readLines("CITATION.cff") |> + sub(pattern = "^version:.*$", replacement = paste("version:", newVersion)) |> + sub(pattern = "^date-released:.*$", replacement = paste("date-released:", releaseDate)) |> + writeLines("CITATION.cff") + + readLines("README.md") |> + gsub(pattern = oldVersion, replacement = newVersion) |> + writeLines("README.md") + + citation::cff2zenodo("CITATION.cff") + + message("creating documentation using goxygen...") + goxygen::goxygen() + message("uploading documentation to RSE server") + system(paste0("rsync -e ssh -avz doc/html/* rse:/webservice/doc/magpie/", newVersion)) + + message("uploading input data to RSE server") + sys.source("scripts/start/extra/publish_data.R", envir = new.env()) # only works on cluster + + message("TODO:\n", + "- CHANGELOG.md: sort lines in each category: changed, added, removed, fixed; remove empty categories\n", + "- git add -p\n", + "Press enter when done to commit, push and create PR") + gms::getLine() + + gert::git_commit(paste("magpie release", newVersion)) + gert::git_push() + system(paste0("gh pr create --base master --title 'magpie release ", newVersion, "' --body ''")) +} + +arguments <- commandArgs(TRUE) +if (length(arguments) != 1) { + stop("Please pass the new version number, e.g. `Rscript scripts/release.R 4.6.2`") +} +release(arguments) +message("warnings:") +print(warnings()) diff --git a/scripts/run_submit/submit.R b/scripts/run_submit/submit.R index 30b4395c7d..a333b02ce1 100644 --- a/scripts/run_submit/submit.R +++ b/scripts/run_submit/submit.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -8,21 +8,34 @@ library(magclass) library(lucode2) library(magpie4) +library(gms) #options(error=function()traceback(2)) -load("config.Rdata") +.getRestartFiles <- function() { + restartFiles <- dir(pattern="restart_.*\\.g00") + names(restartFiles) <- gsub("restart_y([0-9]*)\\.g00", "\\1", restartFiles) + return(restartFiles) +} -maindir <- cfg$magpie_folder +.getRestartCode <- function() { + restartFiles <- .getRestartFiles() + if (length(restartFiles) == 0) return("") + restartFiles <- tail(restartFiles, 1) + return(paste0(" --RESTARTPOINT=TimeLoop --TIMESTEP=", names(restartFiles), " r=", restartFiles)) +} -# write the config file in the output_folder: config.log -write(capture.output(cfg), file="config.log") +cfg <- gms::loadConfig("config.yml") + +maindir <- cfg$magpie_folder # Capture start time timeGAMSStart <- Sys.time() cat("\nStarting MAgPIE...\n") -system(paste("gams full.gms -errmsg=1 -lf=full.log -lo=",cfg$logoption,sep="")) +system(paste0("gams full.gms -errmsg=1 -lf=full.log -lo=",cfg$logoption, .getRestartCode())) + +if (isFALSE(cfg$keep_restarts)) unlink(.getRestartFiles()) # Capture runtimes timeGAMSEnd <- Sys.time() @@ -87,9 +100,9 @@ for (file in cfg$files2export$end) { #update validation.RData #### Collect technical information for validation ############################## # info on the used dataset -input_data<-readLines(path(cfg$results_folder,"info.txt")) +input_data<-readLines(file.path(cfg$results_folder,"info.txt")) # extract module info from full.gms -tmp<-readLines(path(cfg$results_folder,"full.gms"),warn=FALSE,encoding="ASCII") +tmp<-readLines(file.path(cfg$results_folder,"full.gms"),warn=FALSE,encoding="ASCII") lines<-grep(".*MODULE SETUP.*",tmp)[1]:grep(".*MODULE SETUP.*",tmp)[2] module_setup<-c("","","### MODULE SETUP ###",grep("\\$",tmp[lines],value=TRUE)) @@ -126,3 +139,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/run_submit/submit_standby_dayMax.sh b/scripts/run_submit/submit_standby_dayMax.sh new file mode 100644 index 0000000000..a63c56cd31 --- /dev/null +++ b/scripts/run_submit/submit_standby_dayMax.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +#SBATCH --qos=standby +#SBATCH --job-name=mag-run +#SBATCH --output=slurm.log +#SBATCH --mail-type=END +#SBATCH --cpus-per-task=3 +#SBATCH --partition=priority +#SBATCH --time=24:00:00 + +Rscript submit.R diff --git a/scripts/run_submit/submit_standby_maxMem.sh b/scripts/run_submit/submit_standby_maxMem.sh new file mode 100644 index 0000000000..0b2497b9bb --- /dev/null +++ b/scripts/run_submit/submit_standby_maxMem.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +#SBATCH --qos=standby +#SBATCH --job-name=mag-run +#SBATCH --output=slurm.log +#SBATCH --mail-type=END +#SBATCH --cpus-per-task=16 +#SBATCH --mem-per-cpu=0 +#SBATCH --partition=priority + +Rscript submit.R diff --git a/scripts/run_submit/submit_standby_maxMem_dayMax.sh b/scripts/run_submit/submit_standby_maxMem_dayMax.sh new file mode 100644 index 0000000000..f5cd6a05a7 --- /dev/null +++ b/scripts/run_submit/submit_standby_maxMem_dayMax.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +#SBATCH --qos=standby +#SBATCH --job-name=mag-run +#SBATCH --output=slurm.log +#SBATCH --mail-type=END +#SBATCH --cpus-per-task=16 +#SBATCH --mem-per-cpu=0 +#SBATCH --partition=priority +#SBATCH --time=24:00:00 + +Rscript submit.R diff --git a/scripts/start/Rprofile.R b/scripts/start/Rprofile.R new file mode 100644 index 0000000000..46001513cf --- /dev/null +++ b/scripts/start/Rprofile.R @@ -0,0 +1,53 @@ +# | (C) 2008-2023 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: Add R snapshot to ".Rprofile" +# position: 4 +# ------------------------------------------------- + +setSnapshot <- function(snapshotdir=NULL) { + choose_snapshot <- function(title="Please choose a R snapshot") { + if(dir.exists("/p/projects/rd3mod/R/libraries/snapshots/")) { + dirs <- base::list.dirs("/p/projects/rd3mod/R/libraries/snapshots/",recursive=F,full.names=F) + dirs <- sort(dirs) + cat("\n",title,":\n", sep="") + cat("0: No snapshot\n") + cat(paste(1:length(dirs), dirs, sep=": " ),sep="\n") + cat("Number: ") + identifier <- as.numeric(gms::getLine()) + if(identifier > 0 & identifier <= length(dirs)) { + return(paste0("/p/projects/rd3mod/R/libraries/snapshots/",dirs[identifier])) + } else return(invisible(NULL)) + } else stop("R snapshot folder is only available on PIK cluster") + } + + if(is.null(snapshotdir)) snapshotdir <- choose_snapshot("Please choose a R snapshot") + + if(is.null(snapshotdir)) { + fc <- file(".Rprofile") + withr::defer(close(fc)) + writeLines(c('if(file.exists("~/.Rprofile")) source("~/.Rprofile")'), + fc) + } else { + fc <- file(".Rprofile") + withr::defer(close(fc)) + writeLines(c('if(file.exists("~/.Rprofile")) source("~/.Rprofile")', + paste0('.libPaths(',deparse(snapshotdir),')'), + paste0('print("Setting libPaths to ',snapshotdir,'")')), + fc) + } + message(".Rprofile written") +} +if(!exists("source_include")) { + snapshotdir <- NULL + lucode2::readArgs("snapshotdir", .silent=TRUE) +} + +setSnapshot(snapshotdir = snapshotdir) + + diff --git a/scripts/start/check_code.R b/scripts/start/check_code.R index e98181734b..eea63d13a5 100644 --- a/scripts/start/check_code.R +++ b/scripts/start/check_code.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 diff --git a/scripts/start/compilation_check.R b/scripts/start/compilation_check.R new file mode 100644 index 0000000000..78c40f0a88 --- /dev/null +++ b/scripts/start/compilation_check.R @@ -0,0 +1,18 @@ +# | (C) 2008-2023 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: download input and compile main.gms +# position: 7 +# ------------------------------------------------ + +source("scripts/start_functions.R") +source("config/default.cfg") +download_and_update(cfg) + +# compile main.gms +system("gams main.gms action=c") diff --git a/scripts/start/default.R b/scripts/start/default.R index 681d207bd0..02ec919a35 100644 --- a/scripts/start/default.R +++ b/scripts/start/default.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 diff --git a/scripts/start/download_data.R b/scripts/start/download_data.R index 79849961bc..be69358736 100644 --- a/scripts/start/download_data.R +++ b/scripts/start/download_data.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 diff --git a/scripts/start/extra/empty_model.R b/scripts/start/extra/empty_model.R new file mode 100644 index 0000000000..30196831b5 --- /dev/null +++ b/scripts/start/extra/empty_model.R @@ -0,0 +1,25 @@ +# | (C) 2023 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: run an empty model, output is the latest AMT run +# ------------------------------------------------------------- + +source("scripts/start_functions.R") +source("config/default.cfg") + +# Find latest fulldata.gdx from automated model test (AMT) runs +amtRunDirs <- list.files("/p/projects/landuse/tests/magpie/output", + pattern = "default_\\d{4}-\\d{2}-\\d{2}_\\d{2}\\.\\d{2}.\\d{2}", + full.names = TRUE) +fullDataGdxs <- file.path(amtRunDirs, "fulldata.gdx") +latestFullData <- sort(fullDataGdxs[file.exists(fullDataGdxs)], decreasing = TRUE)[[1]] + +cfg <- configureEmptyModel(cfg, latestFullData) +cfg$title <- "empty_model" + +start_run(cfg = cfg, codeCheck = FALSE) diff --git a/scripts/start/extra/emulator.R b/scripts/start/extra/emulator.R index 69ba03672c..7a5b65bd1c 100644 --- a/scripts/start/extra/emulator.R +++ b/scripts/start/extra/emulator.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -17,6 +17,7 @@ library(gms) library(magpie4) library(txtplot) +library(lucode2) source("scripts/start_functions.R") source("config/default.cfg") @@ -59,7 +60,7 @@ scenarios <- subset(scenarios, subset=(start == "1")) # calculate expoLinear tax with transition in 2060 write.ghgtax <- function(co2tax_2025=NULL,regions=NULL,out="./modules/56_ghg_policy/input/f56_pollutant_prices_emulator.cs3") { - fname <- paste0("REMIND_generic_",scenarios[scen,"co2tax_2025"],".mif") + fname <- paste0(scenarios[scen,"co2tax_2025"],".mif") if (file.exists(fname)) { @@ -88,6 +89,8 @@ write.ghgtax <- function(co2tax_2025=NULL,regions=NULL,out="./modules/56_ghg_pol ghgtax[,,"n2o_n_indirect"] <- tmp[,,"Price|N2O (US$2005/t N2O)"] * 44/28 # US$2005/tN2O -> US$2005/tN } else { + + stop("Could not find ", fname) # Calculate expo-linear tax diff --git a/scripts/start/extra/highres.R b/scripts/start/extra/highres.R deleted file mode 100644 index a23f7b7b89..0000000000 --- a/scripts/start/extra/highres.R +++ /dev/null @@ -1,50 +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: Start a set of runs with default and high resolution -# ---------------------------------------------------------- - -library(gms) -library(magclass) -library(gdx) -library(magpie4) - -# Load start_run(cfg) function which is needed to start MAgPIE runs -source("scripts/start_functions.R") -source("config/default.cfg") - -#cfg$force_download <- TRUE - -cfg$results_folder <- "output/:title:" - -#the high resolution can be adjusted in the output script "highres.R" -cfg$output <- c("rds_report","highres") - -prefix <- "T07" - -#cfg$qos <- "priority" -lr <- "c200" -cfg$input <- c(paste0("isimip_rcp-IPSL_CM5A_LR-rcp2p6-co2_rev44_",lr,"_690d3718e151be1b450b394c1064b1c5.tgz"), - "rev4.44_h12_magpie.tgz", - "rev4.44_h12_validation.tgz", - paste0("calibration_H12_",lr,"_26Feb20.tgz"), - "additional_data_rev3.79.tgz") - -download_and_update(cfg) - -ssps <- c("SSP1","SSP2","SSP3","SSP4","SSP5") -scen <- "2p6" - -for (ssp in ssps) { - cfg$title <- paste(prefix,ssp,scen,sep="_") - cfg <- gms::setScenario(cfg,c(ssp,"NDC")) - cfg$gms$c56_pollutant_prices <- "SSPDB-SSP2-26-REMIND-MAGPIE" - cfg$gms$c60_2ndgen_biodem <- "SSPDB-SSP2-26-REMIND-MAGPIE" - start_run(cfg,codeCheck=FALSE) -} diff --git a/scripts/start/extra/input_REMIND.R b/scripts/start/extra/input_REMIND.R index ded0db9ef4..8a61eddde4 100644 --- a/scripts/start/extra/input_REMIND.R +++ b/scripts/start/extra/input_REMIND.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 diff --git a/scripts/start/extra/irrig_dep_test.R b/scripts/start/extra/irrig_dep_test.R new file mode 100644 index 0000000000..4ba340b955 --- /dev/null +++ b/scripts/start/extra/irrig_dep_test.R @@ -0,0 +1,53 @@ +# | (C) 2008-2023 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 irrigation depreciation settings +# ------------------------------------------------ + +# Load start_run(cfg) function which is needed to start MAgPIE runs +source("scripts/start_functions.R") +source("config/default.cfg") + +# short description of the actual run +cfg$title <- "develop_default" + +# Should input data be downloaded from source even if cfg$input did not change? +cfg$force_download <- TRUE + +#Selection of QOS to be used for submitted runs on cluster. +cfg$qos <- "priority" + +#Setting value for depreciation rate in 41_area_equipped_for_irrigation +cfg$gms$s41_AEI_depreciation <- 0 # def = 0 + +#start MAgPIE run +start_run(cfg) + +##dep rate as 0.05## + +## Load start_run(cfg) function which is needed to start MAgPIE runs +source("scripts/start_functions.R") +source("config/default.cfg") + +# short description of the actual run +cfg$title <- "develop_dep05" + +# Should input data be downloaded from source even if cfg$input did not change? +cfg$force_download <- TRUE + +#Selection of QOS to be used for submitted runs on cluster. +cfg$qos <- "priority" + +#Setting value for depreciation rate in 41_area_equipped_for_irrigation +cfg$gms$s41_AEI_depreciation <- 0.05 # def = 0 + + +#start MAgPIE run +start_run(cfg) +# +# diff --git a/scripts/start/extra/publish_data.R b/scripts/start/extra/publish_data.R index ae94cf083d..72ac2b0b53 100644 --- a/scripts/start/extra/publish_data.R +++ b/scripts/start/extra/publish_data.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 diff --git a/scripts/start/extra/recalibrate.R b/scripts/start/extra/recalibrate.R index 2c344c0b1d..e769c0f279 100644 --- a/scripts/start/extra/recalibrate.R +++ b/scripts/start/extra/recalibrate.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -6,7 +6,8 @@ # | Contact: magpie@pik-potsdam.de # -------------------------------------------------------- -# description: calculate and store new calibration factors +# description: calculate and store new calibration factors for yields +# for default setup (land conversion cost calibration factors are only calculated if needed) # -------------------------------------------------------- library(magpie4) @@ -19,9 +20,10 @@ source("scripts/start_functions.R") source("config/default.cfg") cfg$results_folder <- "output/:title:" cfg$recalibrate <- TRUE +cfg$recalibrate_landconversion_cost <- "ifneeded" cfg$title <- "calib_run" -cfg$gms$c_timesteps <- 1 -cfg$output <- c("rds_report") -cfg$sequential <- TRUE +cfg$output <- c("rds_report","validation_short") +cfg$force_replace <- TRUE +cfg$best_calib <- TRUE start_run(cfg,codeCheck=FALSE) magpie4::submitCalibration("H12") diff --git a/scripts/start/extra/recalibrate_FSEC.R b/scripts/start/extra/recalibrate_FSEC.R new file mode 100644 index 0000000000..5833ccaf5b --- /dev/null +++ b/scripts/start/extra/recalibrate_FSEC.R @@ -0,0 +1,32 @@ +# | (C) 2008-2023 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) + +source("scripts/start_functions.R") +source("scripts/projects/fsec.R") + +# Calibration run +cfg <- fsecScenario(scenario = "c_BAU") +cfg$title <- "FSEC24Mar23" +cfg$results_folder <- "output/:title:" +cfg$recalibrate <- TRUE +cfg$best_calib <- TRUE +cfg$recalibrate_landconversion_cost <- TRUE +cfg$best_calib_landconversion_cost <- FALSE +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/recalibrate_all.R b/scripts/start/extra/recalibrate_all.R new file mode 100644 index 0000000000..7586968782 --- /dev/null +++ b/scripts/start/extra/recalibrate_all.R @@ -0,0 +1,54 @@ +# | (C) 2008-2023 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 default setup +# (time consuming; up to 40 model runs with 1 or 5 time steps) +# -------------------------------------------------------- + +library(magpie4) +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:" + +## Yield calibration +cfg$recalibrate <- TRUE +# Up to which accuracy shall be recalibrated? +cfg$calib_accuracy <- 0.05 # def = 0.05 +# What is the maximum number of iterations if the precision goal is not reached? +cfg$calib_maxiter <- 20 # def = 20 +cfg$damping_factor <- 0.96 # def= 0.96 + +cfg$best_calib <- TRUE # def = TRUE + +## Land conversion cost calibration +cfg$recalibrate_landconversion_cost <- TRUE +# Up to which accuracy shall be recalibrated? +cfg$calib_accuracy_landconversion_cost <- 0.05 # def = 0.05 +# What is the maximum number of iterations if the precision goal is not reached? +cfg$calib_maxiter_landconversion_cost <- 40 # def = 40 +cfg$best_calib_landconversion_cost <- FALSE # def = FALSE + +# set upper limit for cropland calibration factor +cfg$cost_calib_max_landconversion_cost <- 3 # def= 3 +# set lower limit for cropland calibration factor +cfg$cost_calib_min_landconversion_cost <- 0.05 # def= 0.05 + +# factor determining how much the new calibration factor influences the result (0-1) +cfg$damping_factor_landconversion_cost <- 0.96 # def= 0.96 + +cfg$title <- "calib_run" +cfg$output <- c("rds_report","validation_short") +cfg$force_replace <- TRUE +start_run(cfg, codeCheck = FALSE) +magpie4::submitCalibration("H12") diff --git a/scripts/start/extra/recalibrate_land_conversion_costs.R b/scripts/start/extra/recalibrate_land_conversion_costs.R new file mode 100644 index 0000000000..d07d5f9519 --- /dev/null +++ b/scripts/start/extra/recalibrate_land_conversion_costs.R @@ -0,0 +1,32 @@ +# | (C) 2008-2023 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 land conversion cost calibration factors for default setup (time consuming; up to 40 model runs with 1 or 5 time steps) +# -------------------------------------------------------- + +library(magpie4) +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:" + +cfg$recalibrate_landconversion_cost <- TRUE +cfg$best_calib_landconversion_cost <- FALSE + +cfg$recalibrate <- "ifneeded" +cfg$gms$c_timesteps <- 5 +cfg$sequential <- TRUE +cfg$title <- "calib_run" +cfg$output <- c("rds_report","validation_short") +cfg$force_replace <- TRUE +start_run(cfg,codeCheck=FALSE) +magpie4::submitCalibration("H12") diff --git a/scripts/start/extra/recalibrate_realizations.R b/scripts/start/extra/recalibrate_realizations.R new file mode 100644 index 0000000000..0b33c7b95c --- /dev/null +++ b/scripts/start/extra/recalibrate_realizations.R @@ -0,0 +1,47 @@ +# | (C) 2008-2023 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 yield and +# land conversion cost calib factors +# for realizations of factor costs +# -------------------------------------------------------- + +library(magpie4) +library(magclass) + +# Load start_run(cfg) function which is needed to start MAgPIE runs +source("scripts/start_functions.R") + +# get default settings +source("config/default.cfg") + +realizations <- c("per_ton_fao_may22", "sticky_feb18") # "sticky_labor" is very similar to sticky_feb18. No extra calibration needed. +type <- NULL + +cfg$results_folder <- "output/:title:" +cfg$recalibrate <- TRUE +cfg$recalibrate_landconversion_cost <- TRUE + +cfg$output <- c("rds_report", "validation_short") +cfg$force_download <- TRUE + +cfg$gms$c_timesteps <- "calib" + +for (r in realizations) { + cfg$gms$factor_costs <- r + + cfg$best_calib <- TRUE + + for (fac_req in c("reg", "glo")) { + cfg$gms$c38_fac_req <- fac_req + cfg$gms$c70_fac_req_regr <- fac_req + cfg$title <- paste("calib_run", r, fac_req, sep = "_") + start_run(cfg) + magpie4::submitCalibration(paste("H12", r, fac_req, sep = "_")) + } +} diff --git a/scripts/start/extra/test_maccs.R b/scripts/start/extra/test_maccs.R new file mode 100644 index 0000000000..fd6c757259 --- /dev/null +++ b/scripts/start/extra/test_maccs.R @@ -0,0 +1,51 @@ +# | (C) 2008-2023 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/extra/test_n.R b/scripts/start/extra/test_n.R index a280fa2c42..c5970c6e47 100644 --- a/scripts/start/extra/test_n.R +++ b/scripts/start/extra/test_n.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -19,7 +19,7 @@ cfg$gms$nitrogen="ipcc2006_sep16" cfg$title="default_high_nue" cfg$gms$c50_scen_neff <- "neff85_85_starty2010" # def = neff60_60_starty2010 cfg$gms$c50_scen_neff_noselect <- "neff85_85_starty2010" # def = neff60_60_starty2010 -cfg$gms$c50_scen_neff_pasture <- "neff80_85_starty2010" # def = constant +cfg$gms$c50_scen_neff_pasture <- "neff80_85_starty2010" # def = constant cfg$gms$c50_scen_neff_pasture_noselect <- "neff80_85_starty2010" start_run(cfg) @@ -27,7 +27,7 @@ cfg$gms$nitrogen="rescaled_jan21" cfg$title="rescaled_high_nue" cfg$gms$c50_scen_neff <- "neff85_85_starty2010" # def = neff60_60_starty2010 cfg$gms$c50_scen_neff_noselect <- "neff85_85_starty2010" # def = neff60_60_starty2010 -cfg$gms$c50_scen_neff_pasture <- "neff80_85_starty2010" # def = constant +cfg$gms$c50_scen_neff_pasture <- "neff80_85_starty2010" # def = constant cfg$gms$c50_scen_neff_pasture_noselect <- "neff80_85_starty2010" start_run(cfg) diff --git a/scripts/start/forestry.R b/scripts/start/forestry.R index c17a1899e0..2145190baf 100644 --- a/scripts/start/forestry.R +++ b/scripts/start/forestry.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 diff --git a/scripts/start/projects/TAUhistfree.R b/scripts/start/projects/TAUhistfree.R new file mode 100644 index 0000000000..3a0602f65c --- /dev/null +++ b/scripts/start/projects/TAUhistfree.R @@ -0,0 +1,83 @@ +# | (C) 2008-2023 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: TAUhistfree +# ---------------------------------------------------------- + + +###################################### +#### 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") + +prefix <- "THF02" +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 (scen in c("REF","POL")) { + if (scen == "REF") { + cfg <- setScenario(cfg,c("SSP2","NPI")) + cfg$gms$c56_pollutant_prices <- "R2M41-SSP2-NPi" + cfg$gms$c60_2ndgen_biodem <- "R2M41-SSP2-NPi" + } else if (scen == "POL") { + cfg <- setScenario(cfg,c("SSP2","NDC")) + cfg$gms$c56_pollutant_prices <- "R2M41-SSP2-Budg600" + cfg$gms$c60_2ndgen_biodem <- "R2M41-SSP2-Budg600" + } + for (sec in c("Ag","AgF","AgFsecdini0")) { + if (sec == "Ag") { + cfg <- setScenario(cfg,c("ForestryOff")) + } else if (sec == "AgF") { + cfg <- setScenario(cfg,c("ForestryEndo")) + } else if (sec == "AgFsecdini0") { + cfg <- setScenario(cfg,c("ForestryEndo")) + cfg$gms$s35_secdf_distribution <- 0 + } + for (TC in c("TCfix","TCfree")) { + if (TC == "TCfix") { + cfg$gms$s13_tau_hist_lower_bound <- 1 + } else if (TC == "TCfree") { + cfg$gms$s13_tau_hist_lower_bound <- 0 + } + for (LC in c("LC888","LC881")) { + if (LC == "LC888") { + cfg$gms$s39_cost_establish_crop <- 8000 + cfg$gms$s39_cost_establish_past <- 8000 + cfg$gms$s39_cost_establish_forestry <- 8000 + } else if (LC == "LC881") { + cfg$gms$s39_cost_establish_crop <- 8000 + cfg$gms$s39_cost_establish_past <- 8000 + cfg$gms$s39_cost_establish_forestry <- 1000 + } + cfg$title <- paste(prefix,"SSP2",scen,sec,TC,LC,sep="_") + start_run(cfg,codeCheck=FALSE) + } + } + } +} diff --git a/scripts/start/projects/aff_bgp.R b/scripts/start/projects/aff_bgp.R index 2cd7c082d9..8455c768c0 100644 --- a/scripts/start/projects/aff_bgp.R +++ b/scripts/start/projects/aff_bgp.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -10,7 +10,7 @@ #### Script to start a MAgPIE run #### ###################################### -library(lucode) +library(lucode2) library(magclass) # Switch between control and experiment, "exp", "ctr" @@ -31,7 +31,7 @@ cfg$input <- c("isimip_rcp-IPSL_CM5A_LR-rcp2p6-co2_rev46_0.5.tgz", "isimip_rcp-IPSL_CM5A_LR-rcp2p6-co2_rev44_c200_690d3718e151be1b450b394c1064b1c5.tgz", "rev4.47_h12_magpie.tgz", "rev4.47_h12_validation.tgz", - "calibration_H12_c200_26Feb20.tgz", + "calibration_H12_c200_26Feb20.tgz", "additional_data_rev3.85.tgz") # Should input data be downloaded from source even if cfg$input did not change? @@ -47,8 +47,8 @@ cfg$gms$c56_pollutant_prices <- "SSPDB-SSP2-26-REMIND-MAGPIE" cfg$gms$c60_2ndgen_biodem <- "SSPDB-SSP2-26-REMIND-MAGPIE" # Set relevant policies to NDC -cfg$gms$c35_ad_policy <- "ndc" -cfg$gms$c35_aolc_policy <- "ndc" +cfg$gms$c22_ad_policy <- "ndc" +cfg$gms$c22_aolc_policy <- "ndc" cfg$gms$c32_aff_policy <- "ndc" # Afforestation restrictions "unrestricted" "noboreal" diff --git a/scripts/start/projects/bv_price.R b/scripts/start/projects/bv_price.R deleted file mode 100644 index fa9e845d53..0000000000 --- a/scripts/start/projects/bv_price.R +++ /dev/null @@ -1,50 +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 - - -###################################### -#### Script to start a MAgPIE run #### -###################################### - -library(lucode2) -library(magclass) -library(magpie4) -library(gms) - -source("scripts/start_functions.R") -source("scripts/performance_test.R") -source("config/default.cfg") - -cfg$qos <- "priority" - - -# biodiversity scenarios -#bvPriceScen <- c("p0","p1_p10","p10_p100","p10_p10000") -bvPriceScen <- c("p0", "p10_p10000") - -# Test different price levels - - for (pricelevel in bvPriceScen) { - - # basic scenario setting - cfg <- setScenario(cfg, c("SSP2", "NPI")) - cfg$gms$c56_pollutant_prices <- "R2M41-SSP2-NPi" - cfg$gms$c60_2ndgen_biodem <- "R2M41-SSP2-NPi" - - # biodiversity price - cfg$gms$c44_price_bv_loss <- pricelevel - - # Updating the title - cfg$title = paste0("SSP2_NPI_bv_",pricelevel) - - # Start run - start_run(cfg=cfg,codeCheck=TRUE) - - } -} - - diff --git a/scripts/start/projects/duallayer.R b/scripts/start/projects/duallayer.R new file mode 100644 index 0000000000..145da6a663 --- /dev/null +++ b/scripts/start/projects/duallayer.R @@ -0,0 +1,47 @@ +# | (C) 2008-2023 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 routine for duallayer implementation +# ---------------------------------------------------------- + + +## Load lucode2 and gms to use setScenario later +library(lucode2) +library(gms) + +# Load start_run(cfg) function which is needed to start MAgPIE runs +source("scripts/start_functions.R") + +# Source default cfg. This loads the object "cfg" in R environment +source("config/default.cfg") + +# choose a meaningful Pull Request (PR) flag. +# example for high risk modification requiring runs from the current develop and the feature branch to be merged: PR276_develop, PR276_TAUhistfree +pr_flag <- "PR282test" + +# Grab user name +user <- Sys.info()[["user"]] + +cfg$results_folder <- "output/:title:" + +## Create a set of runs based on default.cfg + +for(tc in c("endo_jun18","exo")) { + for (trade in c("exo","free_apr16","selfsuff_reduced","off")) { + #cfg <- setScenario(cfg,c(ssp,"NPI")) + cfg$gms$tc <- tc + cfg$gms$trade <- trade + + cfg$title <- paste0(pr_flag,"_",user,"_",tc,"-",trade) #Create easily distinguishable run title + + cfg$output <- c("rds_report") # Only run rds_report after model run + + start_run(cfg,codeCheck=TRUE) # Start MAgPIE run + #cat(cfg$title) + } +} diff --git a/scripts/start/projects/fable_india.R b/scripts/start/projects/fable_india.R new file mode 100644 index 0000000000..acb666a4a9 --- /dev/null +++ b/scripts/start/projects/fable_india.R @@ -0,0 +1,43 @@ +# | (C) 2008-2023 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: Default script for all India-specific runs +# ------------------------------------------------ + +###################################### +#### Script to start a MAgPIE run #### +###################################### + +source("scripts/start_functions.R") +source("config/default.cfg") + + +##Input data files to be used for India-specific analysis +cfg$input <- c(cellular = "rev4.732706_indiaYields_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", + regional = "rev4.732706_indiaYields_h12_magpie.tgz", + validation = "rev4.732706_indiaYields_h12_validation.tgz", + calibration = "calibration_Indiacalibration_473_27Jun22.tgz", + additional = "additional_data_rev4.26.tgz") + +##Please always use the updated `calibration` and `additional` files from the main default.cfg file + +cfg$repositories <- append(list("https://rse.pik-potsdam.de/data/magpie/public"=NULL), + getOption("magpie_repos")) + +#Download input data +cfg$force_download <- TRUE + +#Setting pumping to 1 +cfg$gms$s42_pumping <- 1 +#Setting year from which pumping costs will be implemented + cfg$gms$s42_multiplier_startyear <- 1995 +##Pumping cost value to default value for India +cfg$gms$s42_multiplier <- 1 + +cfg$recalibrate <- TRUE diff --git a/scripts/start/projects/forestry.R b/scripts/start/projects/forestry.R index 2a3d1c8d5a..6ee0427559 100644 --- a/scripts/start/projects/forestry.R +++ b/scripts/start/projects/forestry.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -6,7 +6,7 @@ # | Contact: magpie@pik-potsdam.de # ---------------------------------------------------------- -# description: Forestry paper simulations +# description: Forestry simulations # ---------------------------------------------------------- ###################################### @@ -23,51 +23,88 @@ source("scripts/start_functions.R") log_folder = "run_details" dir.create(log_folder,showWarnings = FALSE) -identifier_flag = "MAR01" -cat(paste0("Forestry on-off runs"), file=paste0(log_folder,"/",identifier_flag,".txt"),append=F) +identifier_flag = "AUG04" +cat(paste0("BH_IFL and WDPA runs"), file=paste0(log_folder,"/",identifier_flag,".txt"),append=F) xx <- c() +all_configs <- list() #scen_vector <- c("ForestryOff","ForestryEndo","ForestryExo") -scen_vector <- c("ForestryEndo","ForestryOff") +scen_vector <- c("ForestryEndo") -for(s80_maxiter in c(5)){ - for(scen in scen_vector){ +for(c73_wood_scen in c("default")){ - for(ssp in c("SSP2")){ - source("config/default.cfg") + for(s80_maxiter in c(30)){ + for(scen in scen_vector){ - cfg$gms$s80_maxiter = s80_maxiter + for(ssp in c("SSP2")){ - cfg = setScenario(cfg,c(ssp,"NPI",scen)) + for(pol_scen in c("NPI")){ + source("config/default.cfg") - #cfg$gms$c_timesteps <- "5year" + cfg$gms$c52_carbon_scenario <- "nocc" + cfg$gms$c59_som_scenario <- "nocc" - cfg$gms$s15_elastic_demand <- 0 + cfg$gms$s80_maxiter = s80_maxiter - if(cfg$gms$s73_foresight == 1) foresight_flag = "Forward" - if(cfg$gms$s73_foresight != 1) foresight_flag = "Myopic" + cfg = setScenario(cfg,c(ssp,pol_scen,scen)) -# cfg$gms$c57_macc_version = "PBL_2019" + for(c21_trade_liberalization in c("l909090r808080")) { - if(scen=="ForestryOff") scen_flag="Default" - if(scen=="ForestryEndo") scen_flag="Forestry" - if(scen=="ForestryExo") scen_flag="ForestryExo" + cfg$gms$c21_trade_liberalization <- c21_trade_liberalization - cfg$title = paste0(identifier_flag,"_",scen_flag) - cfg$output = c("extra/timestep_duration") + if(cfg$gms$c21_trade_liberalization=="l909090r808080") trade_flag="DefTrade" + if(cfg$gms$c21_trade_liberalization=="l908080r807070") trade_flag="LibTrade" - xx = c(xx,cfg$title) - cfg$gms$s80_optfile <- 1 - cfg$results_folder = "output/:title:" - start_run(cfg,codeCheck=FALSE) + for (c73_build_demand in c("BAU","10pc","50pc","90pc")) { - } - } -} + for(c35_protect_scenario in c("BH_IFL","WDPA")){ + + for(s73_expansion in c(0)){ + + cfg$gms$c35_protect_scenario <- c35_protect_scenario + + cfg$gms$s73_expansion <- s73_expansion + + #cfg$gms$tc <- "exo" + + cfg$gms$c73_build_demand <- c73_build_demand + cfg$gms$s15_elastic_demand <- 0 + + if(cfg$gms$s73_foresight == 1) foresight_flag = "Forward" + if(cfg$gms$s73_foresight != 1) foresight_flag = "Myopic" -# cfg$gms$c56_pollutant_prices = "coupling" -# cfg$gms$c60_2ndgen_biodem = "coupling" + cfg$force_download <- TRUE + cfg$recalibrate <- "ifneeded" # def = "ifneeded" -# file.copy(from = paste0("input/input_bioen_dem_",co2_price_path,".csv"), to = "modules/60_bioenergy/input/reg.2ndgen_bioenergy_demand.csv",overwrite = TRUE) -# file.copy(from = paste0("input/input_ghg_price_",co2_price_path,".cs3"), to = "modules/56_ghg_policy/input/f56_pollutant_prices_coupling.cs3",overwrite = TRUE) + if(scen=="ForestryOff") scen_flag="Default" + if(scen=="ForestryEndo") scen_flag="Forestry" + if(scen=="ForestryExo") scen_flag="ForestryExo" + + cfg$gms$c73_wood_scen = c73_wood_scen + + pol_flg = "Baseline" + + if(pol_scen == "NDC"){ + cfg$gms$c56_pollutant_prices <- "R2M41-SSP2-Budg600" + cfg$gms$c60_2ndgen_biodem <- "R2M41-SSP2-Budg600" + pol_flg = "Mitigation" + } + + cfg$title = paste0(identifier_flag,"_",c73_build_demand,"_",gsub(pattern="_",replacement="",x=c35_protect_scenario)) + cfg$output = c("extra/timestep_duration") + + xx = c(xx,cfg$title) + all_configs[[cfg$title]] <- cfg + #cfg$gms$s80_optfile <- 1 + cfg$results_folder = "output/:title:" + start_run(cfg,codeCheck=FALSE) + } + } + } + } + } + } + } + } +} diff --git a/scripts/start/projects/forestry_co2.R b/scripts/start/projects/forestry_co2.R new file mode 100644 index 0000000000..e033123534 --- /dev/null +++ b/scripts/start/projects/forestry_co2.R @@ -0,0 +1,58 @@ +# | (C) 2008-2023 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: start run with Forestry (Endogenous) +# position: 6 +# ------------------------------------------------ + + +library(gms) + +# 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:" + +cfg <- setScenario(cfg,c("SSP2","NPI","ForestryEndo")) + +run_flag <- "AFF01" + +xx <- c() + +for(c56_pollutant_prices in c("R2M41-SSP2-NPi","SSPDB-SSP2-26-REMIND-MAGPIE")){ + # Enable CO2 Pricing + cfg$gms$c56_pollutant_prices <- c56_pollutant_prices + cfg$gms$c60_2ndgen_biodem <- cfg$gms$c56_pollutant_prices + + for(s32_aff_plantation in c(0,1)){ + # Enable afforestation via plantation growth curve + cfg$gms$s32_aff_plantation <- s32_aff_plantation + + #cfg <- setScenario(cfg,c("SSP2","NPI","ForestryExo")) + #cfg <- setScenario(cfg,c("SSP2","NPI","ForestryOff")) + + if(cfg$gms$s32_aff_plantation == 1) aff_flag <- "AffPlant" + if(cfg$gms$s32_aff_plantation == 0) aff_flag <- "AffNatVeg" + + if(cfg$gms$c56_pollutant_prices == "SSPDB-SSP2-26-REMIND-MAGPIE") { + co2_flag = "CO2p" + cfg <- setScenario(cfg,"NDC") + } + if(cfg$gms$c56_pollutant_prices == "R2M41-SSP2-NPi") { + co2_flag = "Baseline" + cfg <- setScenario(cfg,"NPI") + } + + cfg$title <- paste0(run_flag,"_","ForestryEndo","_",co2_flag,"_",aff_flag) + xx = c(xx,cfg$title) + cfg$results_folder = "output/:title:" + start_run(cfg,codeCheck=FALSE) + } +} diff --git a/scripts/start/projects/gmd-2021-76.R b/scripts/start/projects/gmd-2021-76.R new file mode 100644 index 0000000000..bc5cd3ddb5 --- /dev/null +++ b/scripts/start/projects/gmd-2021-76.R @@ -0,0 +1,82 @@ +# | (C) 2008-2023 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: gmd-2021-76 forestry paper +# ---------------------------------------------------------- + +###################################### +#### 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") + +log_folder = "run_details" +dir.create(log_folder,showWarnings = FALSE) + +identifier_flag = "gmd-2021-76_03" +cat(paste0("Higher rotation, more share from EUR."), file=paste0(log_folder,"/",identifier_flag,".txt"),append=F) + +xx <- c() + +#scen_vector <- c("ForestryOff","ForestryEndo","ForestryExo") +scen_vector <- c("ForestryOff","ForestryEndo") + +for(c73_wood_scen in c("default")){ + + for(s80_maxiter in c(30)){ + for(scen in scen_vector){ + + for(ssp in c("SSP2")){ + source("config/default.cfg") + + cfg$gms$s80_maxiter = s80_maxiter + + cfg = setScenario(cfg,c(ssp,"NPI",scen)) + + # Should input data be downloaded from source even if cfg$input did not change? + cfg$force_download <- TRUE + + #cfg$gms$c_timesteps <- "5year" + + for(c32_rot_calc_type in c("mean_annual_increment","current_annual_increment","instantaneous_growth_rate")){ + cfg$gms$s15_elastic_demand <- 0 + cfg$gms$c32_rot_calc_type <- c32_rot_calc_type + + if(cfg$gms$s73_foresight == 1) foresight_flag = "Forward" + if(cfg$gms$s73_foresight != 1) foresight_flag = "Myopic" + + # cfg$gms$c57_macc_version = "PBL_2019" + + if(scen=="ForestryOff") scen_flag="Default" + if(scen=="ForestryEndo") scen_flag="Forestry" + if(scen=="ForestryExo") scen_flag="ForestryExo" + + if(c32_rot_calc_type=="mean_annual_increment") rl_flag="MAI" + if(c32_rot_calc_type=="current_annual_increment") rl_flag="CAI" + if(c32_rot_calc_type=="instantaneous_growth_rate") rl_flag="IGR" + + cfg$gms$c73_wood_scen = c73_wood_scen + + cfg$title = paste0(identifier_flag,"_",scen_flag,"_",rl_flag) + cfg$output = c("extra/timestep_duration") + + xx = c(xx,cfg$title) + cfg$gms$s80_optfile <- 0 + cfg$results_folder = "output/:title:" + start_run(cfg,codeCheck=FALSE) + } + } + } + } + +} diff --git a/scripts/start/projects/paper_ClimNat.R b/scripts/start/projects/paper_ClimNat.R new file mode 100644 index 0000000000..8f2eb167d9 --- /dev/null +++ b/scripts/start/projects/paper_ClimNat.R @@ -0,0 +1,110 @@ +# | (C) 2008-2023 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 Climate vs. Nature +# ---------------------------------------------------------- + + +###################################### +#### Script to start a MAgPIE run #### +###################################### + +library(gms) +library(lucode2) +library(magclass) + +source("scripts/start_functions.R") + +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$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$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$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$s56_c_price_induced_aff <- 1 + } + cfg$title <- paste(prefix,paste0(ssp,"-",pol),sep="_") + start_run(cfg,codeCheck=FALSE) + } +} diff --git a/scripts/start/projects/paper_fooddemand_standalone.R b/scripts/start/projects/paper_fooddemand_standalone.R index 634393b955..ec24e7c8b6 100644 --- a/scripts/start/projects/paper_fooddemand_standalone.R +++ b/scripts/start/projects/paper_fooddemand_standalone.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 diff --git a/scripts/start/projects/paper_grassland.R b/scripts/start/projects/paper_grassland.R new file mode 100644 index 0000000000..7968cc2deb --- /dev/null +++ b/scripts/start/projects/paper_grassland.R @@ -0,0 +1,44 @@ +# | (C) 2008-2023 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: Runs for Pasture mangagement paper +# ------------------------------------------------ +library(gms) +# Load start_run(cfg) function which is needed to start MAgPIE runs +source("scripts/start_functions.R") + +#start MAgPIE run + +scenarios <- list(c("SSP1","rcp2p6"), c("SSP2","rcp4p5"), c("SSP3","rcp7p0"), c("SSP4","rcp6p0"), c("SSP5", "rcp8p5")) + +for (ssp_setting in scenarios) { + name = "H12_G11" + cfg="default.cfg" + cfg <- setScenario(cfg,ssp_setting) + if(grepl("FSEC", name)) { + cfg$input["calibration"] <- "calibration_FSEC_G3_22Mar22.tgz" + if(SSP1 %in% ssp_setting){ + cfg$input["cellular"] <- "rev4.68_e2bdb6cd_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz" + } else if (SSP2 %in% ssp_setting) { + cfg$input["cellular"] <- "rev4.68_e2bdb6cd_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz" + } else if (SSP3 %in% ssp_setting) { + cfg$input["cellular"] <- "rev4.68_e2bdb6cd_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz" + } else if (SSP4 %in% ssp_setting) { + cfg$input["cellular"] <- "rev4.68_e2bdb6cd_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz" + } else if (SSP5 %in% ssp_setting) { + cfg$input["cellular"] <- "rev4.68_e2bdb6cd_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz" + } else { + stop("Select a correct SSP scenario!") + } + } else { + cfg$input["calibration"] <- "calibration_H12_grassland_mar22.tgz" + } + cfg$gms$past <- "grasslands_apr22" + cfg$title <- paste0(name,"_",ssp_setting[1],"_",ssp_setting[2],"_", substr(Sys.time(), 6,10),"-",gsub(":", "_I_", substr(Sys.time(), 12,16))) + start_run(cfg) +} diff --git a/scripts/start/projects/paper_peatland.R b/scripts/start/projects/paper_peatland.R index 8c7168c335..6a7cbc072c 100644 --- a/scripts/start/projects/paper_peatland.R +++ b/scripts/start/projects/paper_peatland.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 diff --git a/scripts/start/projects/paper_scp.R b/scripts/start/projects/paper_scp.R index 35572129ca..71208eb53a 100644 --- a/scripts/start/projects/paper_scp.R +++ b/scripts/start/projects/paper_scp.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -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_BEST.R b/scripts/start/projects/project_BEST.R new file mode 100644 index 0000000000..1ed15abd80 --- /dev/null +++ b/scripts/start/projects/project_BEST.R @@ -0,0 +1,177 @@ +# | (C) 2008-2023 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: BEST project bioenergy runs +# ---------------------------------------------------------- + +###################################### +#### Script to start a MAgPIE run #### +###################################### + +version <- "V13" + +library(lucode2) +library(magclass) +library(gdx) +library(magpie4) +library(gms) + +# Load start_run(cfg) function which is needed to start MAgPIE runs +source("scripts/start_functions.R") + +### define functions + +calc_bioen <- function(x) { + #B0 + B0 <- new.magpie("GLO",seq(1995,2150,by=5),NULL,fill = 0) + + #B50 + #50 EJ in 2050 globally, linear interpolation + B50 <- new.magpie("GLO",c(seq(1995,2020,by=5),2050,2100,2150),NULL,fill = 0) + B50[,"y2050",] <- 50*1000 + B50[,"y2100",] <- 50/30*80*1000 + B50[,"y2150",] <- 50/30*80*1000#50/40*90 + B50 <- time_interpolate(B50,seq(2020,2050,by=5),TRUE) + B50 <- time_interpolate(B50,seq(2050,2100,by=5),TRUE) + B50 <- time_interpolate(B50,seq(2100,2150,by=5),TRUE) + + #B100 + #100 EJ in 2050 globally, linear interpolation + B100 <- B50*2 + + if (x == "B0") { + return(B0) + } else if (x == "B50") { + return(B50) + } else if (x == "B100") { + return(B100) + } else stop("Not defined") +} +calc_ghgprice <- function(x) { + T0 <- read.magpie("modules/56_ghg_policy/input/f56_pollutant_prices.cs3") + T0 <- collapseNames(T0[,,getNames(T0,dim=2)[1]]) + T0[,,] <- 0 + + #T200 200 USD/tCO2 in 2050 + T200 <- new.magpie(getRegions(T0),c(seq(1995,2025,by=5),2050,2100,2150),getNames(T0),fill = 0) + T200[,"y2025","co2_c"] <- 25 + T200[,"y2050","co2_c"] <- 200 + T200[,"y2100","co2_c"] <- 525 + T200[,"y2150","co2_c"] <- 525 + T200 <- time_interpolate(T200,seq(2015,2100,by=5),TRUE) + T200 <- time_interpolate(T200,seq(2100,2150,by=5),TRUE) + T200[,,"ch4"] <- T200[,,"co2_c"]*28 + T200[,,"n2o_n_direct"] <- T200[,,"co2_c"]*265*44/28 + T200[,,"n2o_n_indirect"] <- T200[,,"co2_c"]*265*44/28 + T200[,,"co2_c"] <- T200[,,"co2_c"]*44/12 + + T40 <- T200*0.2 + + if (x == "T0") { + return(T0) + } else if (x == "T40") { + return(T40) + } else if (x == "T200") { + return(T200) + } else stop("Not defined") +} + +### source config +source("config/default.cfg") + +# overall setup +cfg$force_replace <- TRUE +cfg$results_folder <- "output/:title:" +cfg$gms$c60_biodem_level <- 0.01 +cfg$gms$c60_2ndgen_biodem <- "emulator" +cfg$gms$c56_pollutant_prices <- "emulator" + + +# define ssp scenarios +rcps <- c("rcp2p6","rcp6p0") +ssps <- c("SSP1","SSP2","SSP5") + +# define setup for TAU Reference run +biodem <- "B0" +ghgprice <- "T0" +bioen_type <- "all" +bioen_water <- "all" +tau_scen <- paste(biodem,ghgprice,paste0("Type",toupper(bioen_type)),paste0("Water",toupper(bioen_water)),sep="-") + +### start model runs with endogenous TAU +for (rcp in rcps) { + for (ssp in ssps) { + cfg$title <- paste("TAU",ssp,rcp,tau_scen,sep="-") + cfg <- setScenario(cfg,c(ssp,"NPI",rcp)) + cfg$gms$s32_max_aff_area <- 0 + cfg$gms$s56_c_price_induced_aff <- 0 + cfg$gms$c30_bioen_type <- bioen_type + cfg$gms$c30_bioen_water <- bioen_water + cfg$gms$tc <- "endo_jan22" + x <- try(modelstat(file.path("output",cfg$title,"fulldata.gdx")),silent = TRUE) + if(any(!x %in% c(2,7))) { + download_and_update(cfg) + write.magpie(calc_bioen(biodem),"modules/60_bioenergy/input/glo.2ndgen_bioenergy_demand.csv") + write.magpie(calc_ghgprice(ghgprice),"modules/56_ghg_policy/input/f56_pollutant_prices_emulator.cs3") + start_run(cfg,codeCheck=FALSE) + message(paste0("TAU run started: ",cfg$title)) + } + } +} + + +### wait until model runs with endogenous TAU are finished, check is performed every 10 minutes +success <- FALSE +while (!success) { + z <- NULL + for (rcp in rcps) { + for (ssp in ssps) { + x <- try(modelstat(file.path("output",paste("TAU",ssp,rcp,tau_scen,sep="-"),"fulldata.gdx")),silent = TRUE) + if (is(x, "try-error")) x <- NULL else if (is.magpie(x) & all(x %in% c(2,7))) x <- add_dimension(collapseNames(x),dim = 3.1,add = "scen",nm = paste0(ssp,rcp)) + z <- mbind(z,x) + } + } + print(str(z)) + print(dim(z)) + if (is.null(z)) { + message("Not any model run with endogenous TAU finished. Sleeping for 10 minutes.") + Sys.sleep(60*10) + } else if (dim(z)[3] < length(ssps) * length(rcps)) { + message("At least on model run with endogenous TAU not yet finished. Sleeping for 10 minutes.") + Sys.sleep(60*10) + } else if (dim(z)[3] == length(ssps) * length(rcps)) { + if (all(z %in% c(2,7))) success <- TRUE else stop("Modelstat different from 2 or 7 detected") + } +} + +### start model runs with exogenous TAU +message("Starting model runs with exogenous TAU") +for (rcp in rcps) { + for (ssp in ssps) { + for (biodem in c("B0","B50","B100")) { + for (ghgprice in c("T0","T40","T200")) { + for (bioen_type in c("all","begr","betr")) { + for (bioen_water in c("all","rainfed")) { + cfg <- setScenario(cfg,c(ssp,"NPI",rcp)) + cfg$title <- paste(version,ssp,rcp,biodem,ghgprice,paste0("Type",toupper(bioen_type)),paste0("Water",toupper(bioen_water)),sep="-") + cfg$gms$s32_max_aff_area <- 0 + cfg$gms$s56_c_price_induced_aff <- 0 + cfg$gms$tc <- "exo" + cfg$gms$c30_bioen_type <- bioen_type + cfg$gms$c30_bioen_water <- bioen_water + download_and_update(cfg) + write.magpie(readGDX(file.path("output",paste("TAU",ssp,rcp,tau_scen,sep="-"),"fulldata.gdx"), "ov_tau", select=list(type="level")),"modules/13_tc/input/f13_tau_scenario.csv") + write.magpie(calc_bioen(biodem),"modules/60_bioenergy/input/glo.2ndgen_bioenergy_demand.csv") + write.magpie(calc_ghgprice(ghgprice),"modules/56_ghg_policy/input/f56_pollutant_prices_emulator.cs3") + start_run(cfg,codeCheck=FALSE) + } + } + } + } + } +} diff --git a/scripts/start/projects/project_FSEC_Scenarios.R b/scripts/start/projects/project_FSEC_Scenarios.R new file mode 100644 index 0000000000..e9fd046b76 --- /dev/null +++ b/scripts/start/projects/project_FSEC_Scenarios.R @@ -0,0 +1,46 @@ +# | (C) 2008-2023 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("scripts/projects/fsec.R") + +codeCheck <- FALSE + +for (scenarioName in c( + # Single transformation runs + "a_Population", "a_EconDevelop", "a_EnergyTrans", + "a_NoUnderweight", "a_HalfOverweight", "a_DietVegFruitsNutsSeeds", "a_DietLegumes", + "a_DietMonogastrics", "a_DietRuminants", "a_DietEmptyCals", "a_LessFoodWaste", + "a_ManureMngmt", "a_LivestockMngmt", "a_BiodivSparing", + "a_NitrogenEff", "a_RiceMit", "a_CropeffTax", + "a_CapitalSubst", "a_MinWage", "a_Bioplastics", "a_LandscapeElements", + "a_LiberalizedTrade", "a_TimberCities", "a_REDDaff", "a_REDD", "a_CropRotations", + "a_LandSparing", "a_WaterSparing", "a_PeatlandSparing", "a_SoilCarbon", + # Scenario combination runs + "c_BAU", "d_SSP1bau", "d_SSP1PLUSbau", "d_SSP3bau", "d_SSP4bau", "d_SSP5bau", + "d_SSP1fsdp", "d_SSP2fsdp", "d_SSP3fsdp", "d_SSP4fsdp", "d_SSP5fsdp", + "e_FSDP", + "b_Diet", "b_Livelihoods", "b_NatureSparing", "b_AgroMngmt", "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_Protection", "b_Efficiency", + # "b_AllInclusion", "b_LivelihoodsExt", "b_Bioeconomy", +)) { + + # Start runs + cfg <- fsecScenario(scenario = scenarioName) + start_run(cfg = cfg, codeCheck = codeCheck) +} diff --git a/scripts/start/projects/project_GCS.R b/scripts/start/projects/project_GCS.R new file mode 100644 index 0000000000..063a780201 --- /dev/null +++ b/scripts/start/projects/project_GCS.R @@ -0,0 +1,134 @@ +# | (C) 2008-2023 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 of scenario design for the GCS project +# position: 5 +# ---------------------------------------------------------- + + +##### Version log (YYYYMMDD - Description - Author(s)) +## v0.1 - 20210927 - GCS scenarios - IW + +library(lucode2) +library(magclass) +library(gms) + +# Load start_run(cfg) function which is needed to start MAgPIE runs +source("scripts/start_functions.R") + +# Sources the default configuration file +source("config/default.cfg") + + + + +################################################################# +# SSP1 and SSP2 variants without carbon pricing # +################################################################# + + +### SSP2 NDC rcp7p0 ########################## +cfg$title <- "SSP2_NDC_rcp7p0" +cfg <- setScenario(cfg,c("SSP2","NDC","cc","rcp7p0")) +start_run(cfg,codeCheck=FALSE) + +### SSP2 NDC rcp6p0 ########################## +cfg$title <- "SSP2_NDC_rcp6p0" +cfg <- setScenario(cfg,c("SSP2","NDC","cc","rcp6p0")) +start_run(cfg,codeCheck=FALSE) + +### SSP2 NDC rcp2p6 ########################## +cfg$title <- "SSP2_NDC_rcp2p6" +cfg <- setScenario(cfg,c("SSP2","NDC","cc","rcp2p6")) +start_run(cfg,codeCheck=FALSE) + +### SSP2 NDC nocc ############################ +cfg$title <- "SSP2_NDC_nocc" +cfg <- setScenario(cfg,c("SSP2","NDC","nocc")) +start_run(cfg,codeCheck=FALSE) + +### SSP2-Tland NDC rcp2p6 ########################## +cfg$title <- "SSP2-Tland_NDC_rcp2p6" +cfg <- setScenario(cfg,c("SSP2","Tland","NDC","cc","rcp2p6")) +start_run(cfg,codeCheck=FALSE) + +### SSP1 NDC rcp2p6 ########################## +cfg$title <- "SSP1_NDC_rcp2p6" +cfg <- setScenario(cfg,c("SSP1","NDC","cc","rcp2p6")) +start_run(cfg,codeCheck=FALSE) + + + +################################################################# +# SSP2 with two carbon pricing variants # +################################################################# + + +### SSP2 with climate policy parametrized from R21M42-SSP2-PkBudg900 +cfg$title <- "SSP2_ssp2pkbudg900_rcp2p6" +cfg <- setScenario(cfg,c("SSP2","NDC","cc","rcp2p6")) +cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-PkBudg900" +cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-PkBudg900" +start_run(cfg,codeCheck=FALSE) + +### SSP2 with climate policy parametrized from R21M42-SDP-PkBudg1000 +cfg$title <- "SSP2_sdppkbudg1000_rcp2p6" +cfg <- setScenario(cfg,c("SSP2","NDC","cc","rcp2p6")) +cfg$gms$c56_pollutant_prices <- "R21M42-SDP-PkBudg1000" +cfg$gms$c60_2ndgen_biodem <- "R21M42-SDP-PkBudg1000" +start_run(cfg,codeCheck=FALSE) + + + +################################################################# +# SSP2 with sustainable land transformation (Tland) +# and with two carbon pricing variants # +################################################################# + + +### SSP2-Tland with climate policy parametrized from R21M42-SSP2-PkBudg900 +cfg$title <- "SSP2-Tland_ssp2pkbudg900_rcp2p6" +cfg <- setScenario(cfg,c("SSP2","Tland","NDC","cc","rcp2p6")) +cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-PkBudg900" +cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-PkBudg900" +start_run(cfg,codeCheck=FALSE) + +### SSP2-Tland with climate policy parametrized from R21M42-SDP-PkBudg1000 +cfg$title <- "SSP2-Tland_sdppkbudg1000_rcp2p6" +cfg <- setScenario(cfg,c("SSP2","Tland","NDC","cc","rcp2p6")) +cfg$gms$c56_pollutant_prices <- "R21M42-SDP-PkBudg1000" +cfg$gms$c60_2ndgen_biodem <- "R21M42-SDP-PkBudg1000" +start_run(cfg,codeCheck=FALSE) + + +################################################################# +# SSP1 with sustainable land transformation (Tland) +# and with two carbon pricing variants # +################################################################# + + +### SSP1-Tland with climate policy parametrized from R21M42-SSP1-PkBudg900 +cfg$title <- "SSP1-Tland_ssp1pkbudg900_rcp2p6" +cfg <- setScenario(cfg,c("SSP1","Tland","NDC","cc","rcp2p6")) +cfg$gms$c56_pollutant_prices <- "R21M42-SSP1-PkBudg900" +cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP1-PkBudg900" +start_run(cfg,codeCheck=FALSE) + +### SSP1-Tland with climate policy parametrized from R21M42-SDP-PkBudg1000 +cfg$title <- "SSP1-Tland_sdppkbudg1000_rcp2p6" +cfg <- setScenario(cfg,c("SSP1","Tland","NDC","cc","rcp2p6")) +cfg$gms$c56_pollutant_prices <- "R21M42-SDP-PkBudg1000" +cfg$gms$c60_2ndgen_biodem <- "R21M42-SDP-PkBudg1000" +start_run(cfg,codeCheck=FALSE) + + +##revert +cfg <- setScenario(cfg,c("SSP2","NPI","cc","rcp7p0")) +cfg$gms$c56_pollutant_prices <- "R2M41-SSP2-NPi" +cfg$gms$c60_2ndgen_biodem <- "R2M41-SSP2-NPi" + diff --git a/scripts/start/projects/project_LAMACLIMA_WP4.R b/scripts/start/projects/project_LAMACLIMA_WP4.R new file mode 100644 index 0000000000..e86dd6a26e --- /dev/null +++ b/scripts/start/projects/project_LAMACLIMA_WP4.R @@ -0,0 +1,113 @@ +# | (C) 2008-2023 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: LAMACLIMA WP4 runs +# ---------------------------------------------------------- + +###################################### +#### Script to start a MAgPIE run #### +###################################### + + +library(gms) +library(magclass) +library(gdx) + +# 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 <- "LAMA91" +cfg$force_replace <- TRUE + +cfg$gms$factor_costs <- "sticky_labor" +cfg$input["calibration"] <- "calibration_H12_sticky_feb18_dynamic_30Nov21.tgz" +cfg$gms$c17_prod_init <- "off" + +cfg$gms$labor_prod <- "exo" +cfg$gms$c37_labor_rcp <- "rcp119" +cfg$gms$c37_labor_metric <- "ISO" +cfg$gms$c37_labor_intensity <- "400W" +cfg$gms$c37_labor_uncertainty <- "ensmean" + +cfg$results_folder <- "output/:title:" +cfg$output <- c("rds_report","extra/disaggregation","extra/disaggregation_LUH2","extra/highres") +cfg$qos <- "priority_maxMem" + +#### Main scenarios + +### Global Sustainability, largely based on SDP +cfg$title <- paste(prefix,"Sustainability",sep="_") +cfg <- setScenario(cfg,c("LAMA_Sustainability","rcp1p9")) +cfg$gms$policy_countries30 <- all_iso_countries +cfg$gms$policy_countries22 <- all_iso_countries +cfg$gms$EFP_countries <- all_iso_countries +cfg$gms$cropneff_countries <- all_iso_countries +cfg$gms$scen_countries55 <- all_iso_countries +cfg$gms$policy_countries56 <- all_iso_countries +start_run(cfg,codeCheck=FALSE) + +### Global Inequality, largely based on SSP4 +cfg$title <- paste(prefix,"Inequality",sep="_") +cfg <- setScenario(cfg,c("LAMA_Inequal","rcp1p9")) +cfg$gms$policy_countries30 <- oecd90andEU +cfg$gms$policy_countries22 <- oecd90andEU +cfg$gms$EFP_countries <- oecd90andEU +cfg$gms$cropneff_countries <- oecd90andEU +cfg$gms$scen_countries55 <- oecd90andEU +cfg$gms$policy_countries56 <- oecd90andEU +start_run(cfg,codeCheck=FALSE) + +#### Sensitivity scenarios + +### LAMA_Inequal-SustDemand +cfg$title <- paste(prefix,"Inequality-SustDemand",sep="_") +cfg <- setScenario(cfg,c("LAMA_Inequal-SustDemand","rcp1p9")) +cfg$gms$policy_countries30 <- oecd90andEU +cfg$gms$policy_countries22 <- oecd90andEU +cfg$gms$EFP_countries <- oecd90andEU +cfg$gms$cropneff_countries <- oecd90andEU +cfg$gms$scen_countries55 <- oecd90andEU +cfg$gms$policy_countries56 <- oecd90andEU +start_run(cfg,codeCheck=FALSE) + +### LAMA_Inequal-EnvirProt +cfg$title <- paste(prefix,"Inequality-EnvirProt",sep="_") +cfg <- setScenario(cfg,c("LAMA_Inequal-EnvirProt","rcp1p9")) +cfg$gms$policy_countries30 <- all_iso_countries +cfg$gms$policy_countries22 <- all_iso_countries +cfg$gms$EFP_countries <- all_iso_countries +cfg$gms$cropneff_countries <- all_iso_countries +cfg$gms$scen_countries55 <- all_iso_countries +cfg$gms$policy_countries56 <- oecd90andEU +start_run(cfg,codeCheck=FALSE) + +### LAMA_Inequal-GHGPrice +cfg$title <- paste(prefix,"Inequality-GHGPrice",sep="_") +cfg <- setScenario(cfg,c("LAMA_Inequal-GHGPrice","rcp1p9")) +cfg$gms$policy_countries30 <- oecd90andEU +cfg$gms$policy_countries22 <- oecd90andEU +cfg$gms$EFP_countries <- oecd90andEU +cfg$gms$cropneff_countries <- oecd90andEU +cfg$gms$scen_countries55 <- oecd90andEU +cfg$gms$policy_countries56 <- all_iso_countries +start_run(cfg,codeCheck=FALSE) + +### Global Inequality with higher climate impacts +cfg$title <- paste(prefix,"Inequality-rcp7p0",sep="_") +cfg <- setScenario(cfg,c("LAMA_Inequal","rcp7p0")) +cfg$gms$policy_countries30 <- oecd90andEU +cfg$gms$policy_countries22 <- oecd90andEU +cfg$gms$EFP_countries <- oecd90andEU +cfg$gms$cropneff_countries <- oecd90andEU +cfg$gms$scen_countries55 <- oecd90andEU +cfg$gms$policy_countries56 <- oecd90andEU +cfg$gms$c37_labor_rcp <- "rcp585" +start_run(cfg,codeCheck=FALSE) diff --git a/scripts/start/projects/project_SHAPE.R b/scripts/start/projects/project_SHAPE.R new file mode 100644 index 0000000000..9d044879ee --- /dev/null +++ b/scripts/start/projects/project_SHAPE.R @@ -0,0 +1,164 @@ +# | (C) 2008-2023 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: SHAPE scenarios +# position: 5 +# ---------------------------------------------------------- + + +##### Version log (YYYYMMDD - Description - Author(s)) +## 20220106 - SHAPE Baseline and Policy runs. For climate policy parametrization, indentical inputs are used across all scenarios ("R21M42-SSP2-PkBudg900") - IW + +## Load lucode2 and gms to use setScenario later +library(lucode2) +library(gms) +library(magclass) + +# Load start_run(cfg) function which is needed to start MAgPIE runs +source("scripts/start_functions.R") + +# Source default cfg. This loads the object "cfg" in R environment +source("config/default.cfg") + + +### General configurations + +prefix <- "R5_SHAPE" +cfg$results_folder <- "output/:title:" +cfg$output <- c("rds_report") # Only run rds_report after model run + + + +################################################################# +# SSP2: NPI and climate policy runs # +################################################################# + +### SSP2 Base (NPI) +cfg$title <- paste(prefix,"SSP2_Base",sep="_") +cfg <- setScenario(cfg,c("SSP2","NPI")) +cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-NPi" +cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-NPi" +start_run(cfg,codeCheck=FALSE) + +### SSP2 with climate policy parametrized from R21M42-SSP2-PkBudg900 +cfg$title <- paste(prefix,"SSP2_Cpol",sep="_") +cfg <- setScenario(cfg,c("SSP2","NDC")) +cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-PkBudg900" +cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-PkBudg900" +start_run(cfg,codeCheck=FALSE) + + +################################################################# +# SDP-RC: NPI and climate policy runs # +################################################################# + +#### SDP-RC Base (NPI) +cfg$title <- paste(prefix,"SDP-RC_Base",sep="_") +cfg <- setScenario(cfg,c("SDP-RC","NPI")) +cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-NPi" +cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-NPi" +start_run(cfg,codeCheck=FALSE) + +### SDP-RC with climate policy parametrized from R21M42-SSP2-PkBudg900 +cfg$title <- paste(prefix,"SDP-RC_Cpol",sep="_") +cfg <- setScenario(cfg,c("SDP-RC","NDC")) +cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-PkBudg900" +cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-PkBudg900" +start_run(cfg,codeCheck=FALSE) + + +################################################################# +# SDP-MC: NPI and climate policy runs # +################################################################# + +#### SDP-MC Base (NPI) +cfg$title <- paste(prefix,"SDP-MC_Base",sep="_") +cfg <- setScenario(cfg,c("SDP-MC","NPI")) +cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-NPi" +cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-NPi" +start_run(cfg,codeCheck=FALSE) + +### SDP-MC with climate policy parametrized from R21M42-SSP2-PkBudg900 +cfg$title <- paste(prefix,"SDP-MC_Cpol",sep="_") +cfg <- setScenario(cfg,c("SDP-MC","NDC")) +cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-PkBudg900" +cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-PkBudg900" +start_run(cfg,codeCheck=FALSE) + + +################################################################# +# SDP-EI: NPI and climate policy runs # +################################################################# + + +#### SDP-EI Base (NPI) +cfg$title <- paste(prefix,"SDP-EI_Base",sep="_") +cfg <- setScenario(cfg,c("SDP-EI","NPI")) +cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-NPi" +cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-NPi" +start_run(cfg,codeCheck=FALSE) + +### SDP-EI with climate policy parametrized from R21M42-SSP2-PkBudg900 +cfg$title <- paste(prefix,"SDP-EI_Cpol",sep="_") +cfg <- setScenario(cfg,c("SDP-EI","NDC")) +cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-PkBudg900" +cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-PkBudg900" +start_run(cfg,codeCheck=FALSE) + + +#reset: +cfg$gms$kfo_rd <- "livst_rum,livst_milk" + + + + + +##################################################################### +# Additional scenarios # +##################################################################### + +############################### +# SSP1: NPI and climate policy runs # + +### SSP1 Base (NPI) +cfg$title <- paste(prefix,"SSP1_Base",sep="_") +cfg <- setScenario(cfg,c("SSP1","NPI")) +cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-NPi" +cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-NPi" +start_run(cfg,codeCheck=FALSE) + +### SSP1 with climate policy parametrized from R21M42-SSP2-PkBudg900 +cfg$title <- paste(prefix,"SSP1_Cpol",sep="_") +cfg <- setScenario(cfg,c("SSP1","NDC")) +cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-PkBudg900" +cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-PkBudg900" +start_run(cfg,codeCheck=FALSE) + + +############################### +# SDP: NPI and climate policy runs # + +### SDP Base (NPI) +cfg$title <- paste(prefix,"SDP_Base",sep="_") +cfg <- setScenario(cfg,c("SDP","NPI")) +cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-NPi" +cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-NPi" +start_run(cfg,codeCheck=FALSE) + +### SDP with climate policy parametrized from R21M42-SSP2-PkBudg900 +cfg$title <- paste(prefix,"SDP_Cpol",sep="_") +cfg <- setScenario(cfg,c("SDP","NDC")) +cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-PkBudg900" +cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-PkBudg900" +start_run(cfg,codeCheck=FALSE) + + + +#reset: +cfg$gms$c56_pollutant_prices <- "R21M42-SSP2-NPi" +cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-NPi" diff --git a/scripts/start/projects/project_agmip.R b/scripts/start/projects/project_agmip.R index 32dc6610b3..86202fd789 100644 --- a/scripts/start/projects/project_agmip.R +++ b/scripts/start/projects/project_agmip.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -115,13 +115,13 @@ start_run(cfg,codeCheck=FALSE) cfg$title <- "SSP2_NoMt_NoCC_FlexA_DEV" #region: CAZ, EUR, NEU, USA cfg$gms$scen_countries15 <- "AUS,CAN,HMD,NZL,SPM, - ALA,AUT,BEL,BGR,CYP,CZE,DEU,DNK,ESP,EST, - FIN,FRA,FRO,GBR,GGY,GIB,GRC,HRV,HUN,IMN, - IRL,ITA,JEY,LTU,LUX,LVA,MLT,NLD,POL,PRT, - ROU,SVK,SVN,SWE, - ALB,AND,BIH,CHE,GRL,ISL,LIE,MCO,MKD,MNE, - NOR,SJM,SMR,SRB,TUR,VAT, - USA" + ALA,AUT,BEL,BGR,CYP,CZE,DEU,DNK,ESP,EST, + FIN,FRA,FRO,GBR,GGY,GIB,GRC,HRV,HUN,IMN, + IRL,ITA,JEY,LTU,LUX,LVA,MLT,NLD,POL,PRT, + ROU,SVK,SVN,SWE, + ALB,AND,BIH,CHE,GRL,ISL,LIE,MCO,MKD,MNE, + NOR,SJM,SMR,SRB,TUR,VAT, + USA" start_run(cfg,codeCheck=FALSE) @@ -146,13 +146,13 @@ cfg <- setScenario(cfg,c("SSP2","NPI")) cfg$gms$c15_livescen <- "lin_50pc_20_50" #region: CAZ, EUR, NEU, USA cfg$gms$scen_countries15 <- "AUS,CAN,HMD,NZL,SPM, - ALA,AUT,BEL,BGR,CYP,CZE,DEU,DNK,ESP,EST, - FIN,FRA,FRO,GBR,GGY,GIB,GRC,HRV,HUN,IMN, - IRL,ITA,JEY,LTU,LUX,LVA,MLT,NLD,POL,PRT, - ROU,SVK,SVN,SWE, - ALB,AND,BIH,CHE,GRL,ISL,LIE,MCO,MKD,MNE, - NOR,SJM,SMR,SRB,TUR,VAT, - USA" + ALA,AUT,BEL,BGR,CYP,CZE,DEU,DNK,ESP,EST, + FIN,FRA,FRO,GBR,GGY,GIB,GRC,HRV,HUN,IMN, + IRL,ITA,JEY,LTU,LUX,LVA,MLT,NLD,POL,PRT, + ROU,SVK,SVN,SWE, + ALB,AND,BIH,CHE,GRL,ISL,LIE,MCO,MKD,MNE, + NOR,SJM,SMR,SRB,TUR,VAT, + USA" start_run(cfg,codeCheck=FALSE) #reset: cfg$gms$c15_livescen <- "constant" @@ -163,13 +163,13 @@ cfg <- setScenario(cfg,c("SSP2","NPI")) cfg$gms$c15_rumdairyscen <- "lin_50pc_20_50" #region: CAZ, EUR, NEU, USA cfg$gms$scen_countries15 <- "AUS,CAN,HMD,NZL,SPM, - ALA,AUT,BEL,BGR,CYP,CZE,DEU,DNK,ESP,EST, - FIN,FRA,FRO,GBR,GGY,GIB,GRC,HRV,HUN,IMN, - IRL,ITA,JEY,LTU,LUX,LVA,MLT,NLD,POL,PRT, - ROU,SVK,SVN,SWE, - ALB,AND,BIH,CHE,GRL,ISL,LIE,MCO,MKD,MNE, - NOR,SJM,SMR,SRB,TUR,VAT, - USA" + ALA,AUT,BEL,BGR,CYP,CZE,DEU,DNK,ESP,EST, + FIN,FRA,FRO,GBR,GGY,GIB,GRC,HRV,HUN,IMN, + IRL,ITA,JEY,LTU,LUX,LVA,MLT,NLD,POL,PRT, + ROU,SVK,SVN,SWE, + ALB,AND,BIH,CHE,GRL,ISL,LIE,MCO,MKD,MNE, + NOR,SJM,SMR,SRB,TUR,VAT, + USA" start_run(cfg,codeCheck=FALSE) #reset: cfg$gms$c15_rumdairyscen <- "constant" diff --git a/scripts/start/projects/project_coacch.R b/scripts/start/projects/project_coacch.R index bbb37f5067..76a79e10d1 100644 --- a/scripts/start/projects/project_coacch.R +++ b/scripts/start/projects/project_coacch.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -39,15 +39,15 @@ buildInputVector <- function(regionmapping = "H12", archive_rev = "38", madrat_rev = "4.18", validation_rev = "4.18", - calibration = "calibration_coacch_08Oct19.tgz", + calibration = "calibration_coacch_08Oct19.tgz", additional_data = "additional_data_rev3.68.tgz") { mappings <- c(H11="8a828c6ed5004e77d1ba2025e8ea2261", H12="690d3718e151be1b450b394c1064b1c5", - coacch="c2a48c5eae535d4b8fe9c953d9986f1b", + coacch="c2a48c5eae535d4b8fe9c953d9986f1b", mag="c30c1c580039c2b300d86cc46ff4036a", - agmip="c77f075908c3bc29bdbe1976165eccaf", - sim4nexus="25dd7264e8e145385b3bd0b89ec5f3fc", - inms="44f1e181a3da765729f2f1bfc926425a", + agmip="c77f075908c3bc29bdbe1976165eccaf", + sim4nexus="25dd7264e8e145385b3bd0b89ec5f3fc", + inms="44f1e181a3da765729f2f1bfc926425a", capri="e7e72fddc44cc3d546af7b038c651f51") archive_name=paste(project_name,climate_model,climatescen_name,co2,sep="-") archive <- paste0(archive_name, "_rev", archive_rev, "_", resolution, "_", mappings[regionmapping], ".tgz") @@ -101,85 +101,85 @@ cfg$recalibrate <- "ifneeded" start_the_run<-function(ssp,mit,rcp,gcm,co2,cc){ # select alias names for reporting - if(gcm=="IPSL_CM5A_LR"){gcm_alias="IPSL-CM5A-LR"} - if(gcm=="HadGEM2_ES"){gcm_alias="HadGEM2-ES"} - if(gcm=="GFDL_ESM2M"){gcm_alias="GFDL-ESM2M"} - if(gcm=="NorESM1_M"){gcm_alias="NNorESM1-M"} - if(rcp=="NoCC"){gcm_alias="NoCC"} - if(mit=="26"){mit_alias="2p6"} - if(mit=="45"){mit_alias="4p5"} - if(mit=="Ref"){mit_alias="NoMit"} + if(gcm=="IPSL_CM5A_LR"){gcm_alias="IPSL-CM5A-LR"} + if(gcm=="HadGEM2_ES"){gcm_alias="HadGEM2-ES"} + if(gcm=="GFDL_ESM2M"){gcm_alias="GFDL-ESM2M"} + if(gcm=="NorESM1_M"){gcm_alias="NNorESM1-M"} + if(rcp=="NoCC"){gcm_alias="NoCC"} + if(mit=="26"){mit_alias="2p6"} + if(mit=="45"){mit_alias="4p5"} + if(mit=="Ref"){mit_alias="NoMit"} # create runname - if(co2=="co2") { - title=paste(ssp,gcm_alias,substring(rcp,4),mit_alias,sep="_") - } else { - title=paste(ssp,gcm_alias,substring("rcp2p6",4),mit_alias,"NoCO2",sep="_") - } - cat(paste(title)) - - - cfg<-general_settings(title=title) - cfg<-gms::setScenario(cfg,ssp) - cfg$input <- buildInputVector(climatescen_name=rcp,climate_model = gcm, regionmapping = "coacch",calibration=calib) - mitigation=paste0("SSPDB-",ssp,"-",mit,"-",model) - cfg$gms$c56_pollutant_prices <- mitigation - cfg$gms$c60_2ndgen_biodem <- mitigation - if(cc==FALSE){ - cfg<-gms::setScenario(cfg,"nocc") - } else { - cfg<-gms::setScenario(cfg,"cc") - } - start_run(cfg=cfg,codeCheck=codeCheck) + if(co2=="co2") { + title=paste(ssp,gcm_alias,substring(rcp,4),mit_alias,sep="_") + } else { + title=paste(ssp,gcm_alias,substring("rcp2p6",4),mit_alias,"NoCO2",sep="_") + } + cat(paste(title)) + + + cfg<-general_settings(title=title) + cfg<-gms::setScenario(cfg,ssp) + cfg$input <- buildInputVector(climatescen_name=rcp,climate_model = gcm, regionmapping = "coacch",calibration=calib) + mitigation=paste0("SSPDB-",ssp,"-",mit,"-",model) + cfg$gms$c56_pollutant_prices <- mitigation + cfg$gms$c60_2ndgen_biodem <- mitigation + if(cc==FALSE){ + cfg<-gms::setScenario(cfg,"nocc") + } else { + cfg<-gms::setScenario(cfg,"cc") + } + start_run(cfg=cfg,codeCheck=codeCheck) } for (ssp in c("SSP1","SSP2","SSP3","SSP4","SSP5")){ - if(ssp=="SSP1"){ - model="IMAGE" - mitopt = c("Ref") - rcpopt = c("rcp2p6","rcp4p5","rcp6p0","NoCC") - gcmopt = c("HadGEM2_ES") - } - if(ssp=="SSP2"){ - model="MESSAGE-GLOBIOM" - mitopt = c("26","45","Ref") - rcpopt = c("rcp2p6","rcp4p5","rcp6p0","NoCC") - gcmopt = c("IPSL_CM5A_LR","HadGEM2_ES","GFDL_ESM2M","NorESM1_M") - } - if(ssp=="SSP3"){ - model="AIM-CGE" - mitopt = c("Ref") - rcpopt = c("rcp4p5","rcp6p0","NoCC") - gcmopt = c("HadGEM2_ES") - } - if(ssp=="SSP4"){ - model="GCAM4" - mitopt = c("Ref") - rcpopt = c("rcp2p6","rcp4p5","rcp6p0","NoCC") - gcmopt = c("HadGEM2_ES") - } - if(ssp=="SSP5"){ - model="REMIND-MAGPIE" - mitopt = c("Ref") - rcpopt = c("rcp2p6","rcp4p5","rcp6p0","rcp8p5","NoCC") - gcmopt = c("HadGEM2_ES") - } - for(mit in mitopt){ - for (rcp in rcpopt) { - co2="co2" - if(rcp=="NoCC"){ - gcm = c("HadGEM2_ES") - rcp= c("rcp4p5") - start_the_run(ssp,mit,rcp,gcm,co2,cc=FALSE) - } else { - for(gcm in gcmopt){ - start_the_run(ssp,mit,rcp,gcm,co2,cc=TRUE) - } - if (rcp == "rcp8p5"){ - co2="noco2" - start_the_run(ssp,mit,rcp,gcm,co2,cc=TRUE) - } - } - } - } + if(ssp=="SSP1"){ + model="IMAGE" + mitopt = c("Ref") + rcpopt = c("rcp2p6","rcp4p5","rcp6p0","NoCC") + gcmopt = c("HadGEM2_ES") + } + if(ssp=="SSP2"){ + model="MESSAGE-GLOBIOM" + mitopt = c("26","45","Ref") + rcpopt = c("rcp2p6","rcp4p5","rcp6p0","NoCC") + gcmopt = c("IPSL_CM5A_LR","HadGEM2_ES","GFDL_ESM2M","NorESM1_M") + } + if(ssp=="SSP3"){ + model="AIM-CGE" + mitopt = c("Ref") + rcpopt = c("rcp4p5","rcp6p0","NoCC") + gcmopt = c("HadGEM2_ES") + } + if(ssp=="SSP4"){ + model="GCAM4" + mitopt = c("Ref") + rcpopt = c("rcp2p6","rcp4p5","rcp6p0","NoCC") + gcmopt = c("HadGEM2_ES") + } + if(ssp=="SSP5"){ + model="REMIND-MAGPIE" + mitopt = c("Ref") + rcpopt = c("rcp2p6","rcp4p5","rcp6p0","rcp8p5","NoCC") + gcmopt = c("HadGEM2_ES") + } + for(mit in mitopt){ + for (rcp in rcpopt) { + co2="co2" + if(rcp=="NoCC"){ + gcm = c("HadGEM2_ES") + rcp= c("rcp4p5") + start_the_run(ssp,mit,rcp,gcm,co2,cc=FALSE) + } else { + for(gcm in gcmopt){ + start_the_run(ssp,mit,rcp,gcm,co2,cc=TRUE) + } + if (rcp == "rcp8p5"){ + co2="noco2" + start_the_run(ssp,mit,rcp,gcm,co2,cc=TRUE) + } + } + } + } } diff --git a/scripts/start/projects/project_coacch_lpjml5.R b/scripts/start/projects/project_coacch_lpjml5.R index 85459beeff..be003d2855 100644 --- a/scripts/start/projects/project_coacch_lpjml5.R +++ b/scripts/start/projects/project_coacch_lpjml5.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -39,15 +39,15 @@ buildInputVector <- function(regionmapping = "H12", archive_rev = "40.1", madrat_rev = "4.18", validation_rev = "4.18", - calibration = "calibration_coacch_08Oct19.tgz", + calibration = "calibration_coacch_08Oct19.tgz", additional_data = "additional_data_rev3.68.tgz") { mappings <- c(H11="8a828c6ed5004e77d1ba2025e8ea2261", H12="690d3718e151be1b450b394c1064b1c5", - coacch="c2a48c5eae535d4b8fe9c953d9986f1b", + coacch="c2a48c5eae535d4b8fe9c953d9986f1b", mag="c30c1c580039c2b300d86cc46ff4036a", - agmip="c77f075908c3bc29bdbe1976165eccaf", - sim4nexus="25dd7264e8e145385b3bd0b89ec5f3fc", - inms="44f1e181a3da765729f2f1bfc926425a", + agmip="c77f075908c3bc29bdbe1976165eccaf", + sim4nexus="25dd7264e8e145385b3bd0b89ec5f3fc", + inms="44f1e181a3da765729f2f1bfc926425a", capri="e7e72fddc44cc3d546af7b038c651f51") archive_name=paste(project_name,climate_model,climatescen_name,co2,sep="-") archive <- paste0(archive_name, "_rev", archive_rev, "_", resolution, "_", mappings[regionmapping], ".tgz") @@ -101,89 +101,89 @@ cfg$recalibrate <- "ifneeded" start_the_run<-function(ssp,mit,rcp,gcm,co2,cc){ # select alias names for reporting - if(gcm=="IPSL_CM5A_LR"){gcm_alias="IPSL-CM5A-LR"} - if(gcm=="HadGEM2_ES"){gcm_alias="HadGEM2-ES"} - if(gcm=="GFDL_ESM2G"){gcm_alias="GFDL-ESM2G"} - if(gcm=="NorESM1_M"){gcm_alias="NNorESM1-M"} + if(gcm=="IPSL_CM5A_LR"){gcm_alias="IPSL-CM5A-LR"} + if(gcm=="HadGEM2_ES"){gcm_alias="HadGEM2-ES"} + if(gcm=="GFDL_ESM2G"){gcm_alias="GFDL-ESM2G"} + if(gcm=="NorESM1_M"){gcm_alias="NNorESM1-M"} rcp_alias=substring(rcp,4) - if(cc==FALSE){ - gcm_alias="NoCC" - rcp_alias="NoCC" - } - if(mit=="26"){mit_alias="2p6"} - if(mit=="45"){mit_alias="4p5"} - if(mit=="Ref"){mit_alias="NoMit"} + if(cc==FALSE){ + gcm_alias="NoCC" + rcp_alias="NoCC" + } + if(mit=="26"){mit_alias="2p6"} + if(mit=="45"){mit_alias="4p5"} + if(mit=="Ref"){mit_alias="NoMit"} # create runname - if(co2=="co2") { - title=paste(ssp,gcm_alias,rcp_alias,mit_alias,sep="_") - } else { - title=paste(ssp,gcm_alias,rcp_alias,mit_alias,"NoCO2",sep="_") - } - cat(paste(title)) - - - cfg<-general_settings(title=title) - cfg<-gms::setScenario(cfg,ssp) - cfg$input <- buildInputVector(climatescen_name=rcp,climate_model = gcm, regionmapping = "coacch",co2=co2,calibration=calib) - mitigation=paste0("SSPDB-",ssp,"-",mit,"-",model) - cfg$gms$c56_pollutant_prices <- mitigation - cfg$gms$c60_2ndgen_biodem <- mitigation - if(cc==FALSE){ - cfg<-gms::setScenario(cfg,"nocc") - } else { - cfg<-gms::setScenario(cfg,"cc") - } - start_run(cfg=cfg,codeCheck=codeCheck) + if(co2=="co2") { + title=paste(ssp,gcm_alias,rcp_alias,mit_alias,sep="_") + } else { + title=paste(ssp,gcm_alias,rcp_alias,mit_alias,"NoCO2",sep="_") + } + cat(paste(title)) + + + cfg<-general_settings(title=title) + cfg<-gms::setScenario(cfg,ssp) + cfg$input <- buildInputVector(climatescen_name=rcp,climate_model = gcm, regionmapping = "coacch",co2=co2,calibration=calib) + mitigation=paste0("SSPDB-",ssp,"-",mit,"-",model) + cfg$gms$c56_pollutant_prices <- mitigation + cfg$gms$c60_2ndgen_biodem <- mitigation + if(cc==FALSE){ + cfg<-gms::setScenario(cfg,"nocc") + } else { + cfg<-gms::setScenario(cfg,"cc") + } + start_run(cfg=cfg,codeCheck=codeCheck) } for (ssp in c("SSP1","SSP2","SSP3","SSP4","SSP5")){ - if(ssp=="SSP1"){ - model="IMAGE" - mitopt = c("Ref") - rcpopt = c("rcp2p6","rcp4p5","rcp6p0","NoCC") - gcmopt = c("HadGEM2_ES") - } - if(ssp=="SSP2"){ - model="MESSAGE-GLOBIOM" - mitopt = c("26","45","Ref") - rcpopt = c("rcp2p6","rcp4p5","rcp6p0","NoCC") - gcmopt = c("IPSL_CM5A_LR","HadGEM2_ES","GFDL_ESM2G","NorESM1_M") - } - if(ssp=="SSP3"){ - model="AIM-CGE" - mitopt = c("60") - rcpopt = c("rcp4p5","rcp6p0","NoCC") - gcmopt = c("HadGEM2_ES") - } - if(ssp=="SSP4"){ - model="GCAM4" - mitopt = c("Ref") - rcpopt = c("rcp2p6","rcp4p5","rcp6p0","NoCC") - gcmopt = c("HadGEM2_ES") - } - if(ssp=="SSP5"){ - model="REMIND-MAGPIE" - mitopt = c("Ref") - rcpopt = c("rcp2p6","rcp4p5","rcp6p0","rcp8p5","NoCC") - gcmopt = c("HadGEM2_ES") - } - for(mit in mitopt){ - for (rcp in rcpopt) { - co2="co2" - if(rcp=="NoCC"){ - gcm = c("HadGEM2_ES") - rcp= c("rcp4p5") - start_the_run(ssp,mit,rcp,gcm,co2,cc=FALSE) - } else { - for(gcm in gcmopt){ - start_the_run(ssp,mit,rcp,gcm,co2,cc=TRUE) - } - if (rcp == "rcp8p5"){ - co2="noco2" - start_the_run(ssp,mit,rcp,gcm,co2,cc=TRUE) - } - } - } - } + if(ssp=="SSP1"){ + model="IMAGE" + mitopt = c("Ref") + rcpopt = c("rcp2p6","rcp4p5","rcp6p0","NoCC") + gcmopt = c("HadGEM2_ES") + } + if(ssp=="SSP2"){ + model="MESSAGE-GLOBIOM" + mitopt = c("26","45","Ref") + rcpopt = c("rcp2p6","rcp4p5","rcp6p0","NoCC") + gcmopt = c("IPSL_CM5A_LR","HadGEM2_ES","GFDL_ESM2G","NorESM1_M") + } + if(ssp=="SSP3"){ + model="AIM-CGE" + mitopt = c("60") + rcpopt = c("rcp4p5","rcp6p0","NoCC") + gcmopt = c("HadGEM2_ES") + } + if(ssp=="SSP4"){ + model="GCAM4" + mitopt = c("Ref") + rcpopt = c("rcp2p6","rcp4p5","rcp6p0","NoCC") + gcmopt = c("HadGEM2_ES") + } + if(ssp=="SSP5"){ + model="REMIND-MAGPIE" + mitopt = c("Ref") + rcpopt = c("rcp2p6","rcp4p5","rcp6p0","rcp8p5","NoCC") + gcmopt = c("HadGEM2_ES") + } + for(mit in mitopt){ + for (rcp in rcpopt) { + co2="co2" + if(rcp=="NoCC"){ + gcm = c("HadGEM2_ES") + rcp= c("rcp4p5") + start_the_run(ssp,mit,rcp,gcm,co2,cc=FALSE) + } else { + for(gcm in gcmopt){ + start_the_run(ssp,mit,rcp,gcm,co2,cc=TRUE) + } + if (rcp == "rcp8p5"){ + co2="noco2" + start_the_run(ssp,mit,rcp,gcm,co2,cc=TRUE) + } + } + } + } } 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_inms2.R b/scripts/start/projects/project_inms2.R index c69cc1f049..47971a3331 100644 --- a/scripts/start/projects/project_inms2.R +++ b/scripts/start/projects/project_inms2.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -24,10 +24,10 @@ buildInputVector <- function(regionmapping = "agmip", climate_model = "IPSL_CM5A_LR", resolution = "c200", archive_rev = "52", - madrat_rev = "4.57", - validation_rev = "4.57", - calibration = "calibration_calibration_inms_may2020_09Jul20.tgz", - additional_data = "additional_data_rev3.92.tgz") { + madrat_rev = "4.57bb4", + validation_rev = "4.57bb4", + calibration = "calibration_INMS_v6_16Feb21.tgz", + additional_data = "additional_data_rev3.95.tgz") { mappings <- c(h11="8a828c6ed5004e77d1ba2025e8ea2261", h12="690d3718e151be1b450b394c1064b1c5", mag="c30c1c580039c2b300d86cc46ff4036a", @@ -46,15 +46,18 @@ buildInputVector <- function(regionmapping = "agmip", ### General settings ### general_settings<-function(title) { source("config/default.cfg") - cfg<-lucode::setScenario(cfg,"cc") + cfg<-setScenario(cfg,"cc") cfg$force_download <- TRUE cfg$gms$c_timesteps <- 12 cfg$gms$som <- "cellpool_aug16" cfg$gms$factor_costs <- "sticky_feb18" cfg$gms$s15_elastic_demand <- 0 cfg$gms$nitrogen <- "rescaled_jan21" - cfg$title <- paste0("inms_",title,"_v5") - cfg$calib_cropland <- FALSE + cfg$gms$som <- "static_jan19" + cfg$title <- paste0(title,"_v10") + cfg$gms$maccs <- "on_sep16" + cfg$gms$c56_emis_policy <- "maccs_excl_cropland_n2o" + #cfg$calib_cropland <- FALSE cfg$recalibrate <- FALSE return(cfg) } @@ -62,17 +65,17 @@ general_settings<-function(title) { ############################################################################### ########## Calibration run ########## cfg<-general_settings(title="SSP2_RCP4p5_Calib") -cfg<-lucode::setScenario(cfg,"SSP2") -cfg<-lucode::setScenario(cfg,"cc") +cfg<-setScenario(cfg,"SSP2") +cfg<-setScenario(cfg,"cc") cfg$input <- buildInputVector(co2="co2",climatescen_name="rcp4p5",regionmapping="inms",calibration="calibration_inms_c200_08Jul2020.tgz") cfg$gms$c56_pollutant_prices <- "SSPDB-SSP2-45-MESSAGE-GLOBIOM" cfg$gms$c60_2ndgen_biodem <- "SSPDB-SSP2-45-MESSAGE-GLOBIOM" cfg$force_download <- TRUE -#cfg$recalibrate <- TRUE +cfg$recalibrate <- FALSE start_run(cfg=cfg,codeCheck=codeCheck) -calib<-magpie4::submitCalibration(name = "INMS_v5") +calib<-magpie4::submitCalibration(name = "INMS_v6") -#calib<-"calibration_calibration_inms_may2020_09Jul20.tgz" +calib<- "calibration_INMS_v6_16Feb21.tgz" ############################################################################### @@ -83,7 +86,7 @@ cfg$input <- buildInputVector(co2="co2",climatescen_name="rcp8p5",regionmapping= # Development: fossil-fuel driven (SSP5) # Land Use: medium regulation, high productivity # Diet: meat and dairy-rich -cfg<-lucode::setScenario(cfg,"SSP5") +cfg<-setScenario(cfg,"SSP5") # Climate: no mitigation (RCP8.5) cfg$gms$c56_pollutant_prices <- "SSPDB-SSP5-Ref-REMIND-MAGPIE" cfg$gms$c60_2ndgen_biodem <- "SSPDB-SSP5-Ref-REMIND-MAGPIE" @@ -100,7 +103,7 @@ cfg$input <- buildInputVector(co2="co2",climatescen_name="rcp4p5",regionmapping= # Development: historical trends (SSP2) # Land Use: medium regulation, medium productivity # Diet: medium meat and dairy -cfg<-lucode::setScenario(cfg,"SSP2") +cfg<-setScenario(cfg,"SSP2") # Climate: moderate mitigation (RCP4.5) cfg$gms$c56_pollutant_prices <- "SSPDB-SSP2-45-MESSAGE-GLOBIOM" cfg$gms$c60_2ndgen_biodem <- "SSPDB-SSP2-45-MESSAGE-GLOBIOM" @@ -117,7 +120,7 @@ cfg$input <- buildInputVector(co2="co2",climatescen_name="rcp4p5",regionmapping= # Development: historical trends (SSP2) # Land Use: medium regulation, medium productivity # Diet: medium meat and dairy -cfg<-lucode::setScenario(cfg,"SSP2") +cfg<-setScenario(cfg,"SSP2") # Climate: moderate mitigation (RCP4.5) cfg$gms$c56_pollutant_prices <- "SSPDB-SSP2-45-MESSAGE-GLOBIOM" cfg$gms$c60_2ndgen_biodem <- "SSPDB-SSP2-45-MESSAGE-GLOBIOM" @@ -134,7 +137,7 @@ cfg$input <- buildInputVector(co2="co2",climatescen_name="rcp4p5",regionmapping= # Development: historical trends (SSP2) # Land Use: medium regulation, medium productivity # Diet: medium meat and dairy -cfg<-lucode::setScenario(cfg,"SSP2") +cfg<-setScenario(cfg,"SSP2") # Climate: moderate mitigation (RCP4.5) cfg$gms$c56_pollutant_prices <- "SSPDB-SSP2-45-MESSAGE-GLOBIOM" cfg$gms$c60_2ndgen_biodem <- "SSPDB-SSP2-45-MESSAGE-GLOBIOM" @@ -151,7 +154,7 @@ cfg$input <- buildInputVector(co2="co2",climatescen_name="rcp4p5",regionmapping= # Development: sustainable development (SSP1) # Land Use: strong regulation, high productivity (SSP1) # Diet: low meat and dairy -cfg<-lucode::setScenario(cfg,"SSP1") +cfg<-setScenario(cfg,"SSP1") # Climate: moderate mitigation (RCP4.5) cfg$gms$c56_pollutant_prices <- "SSPDB-SSP1-26-IMAGE" cfg$gms$c60_2ndgen_biodem <- "SSPDB-SSP1-26-IMAGE" @@ -167,7 +170,7 @@ cfg<-general_settings(cfg$title <- "SSP1_RCP4p5_PolicyHighDiet") cfg$input <- buildInputVector(co2="co2",climatescen_name="rcp4p5",regionmapping="inms",calibration=calib) # Development: sustainable development (SSP1) # Land Use: strong regulation, high productivity (SSP1) -cfg<-lucode::setScenario(cfg,"SSP1") +cfg<-setScenario(cfg,"SSP1") # Climate: moderate mitigation (RCP4.5) cfg$gms$c56_pollutant_prices <- "SSPDB-SSP1-26-IMAGE" cfg$gms$c60_2ndgen_biodem <- "SSPDB-SSP1-26-IMAGE" @@ -191,7 +194,7 @@ cfg$input <- buildInputVector(co2="co2",climatescen_name="rcp2p6",regionmapping= # Development: sustainable development (SSP1) # Land Use: strong regulation, high productivity (SSP1) # Diet: low meat and dairy -cfg<-lucode::setScenario(cfg,"SSP1") +cfg<-setScenario(cfg,"SSP1") # Climate: high mitigation (RCP2.6) cfg$gms$c56_pollutant_prices <- "SSPDB-SSP1-26-IMAGE" cfg$gms$c60_2ndgen_biodem <- "SSPDB-SSP1-26-IMAGE" @@ -210,7 +213,7 @@ cfg$input <- buildInputVector(co2="co2",climatescen_name="rcp4p5",regionmapping= # Development: historical trends (SSP2) # Land Use: medium regulation, medium productivity (SSP2) # Diet: medium meat and dairy -cfg<-lucode::setScenario(cfg,"SSP2") +cfg<-setScenario(cfg,"SSP2") # Climate: moderate mitigation (RCP4.5) cfg$gms$c56_pollutant_prices <- "SSPDB-SSP2-45-MESSAGE-GLOBIOM" cfg$gms$c60_2ndgen_biodem <- "SSPDB-SSP2-45-MESSAGE-GLOBIOM" @@ -225,7 +228,7 @@ cfg$input <- buildInputVector(co2="co2",climatescen_name="rcp4p5",regionmapping= # Development: historical trends (SSP2) # Land Use: medium regulation, medium productivity (SSP2) # Diet: medium meat and dairy -cfg<-lucode::setScenario(cfg,"SSP2") +cfg<-setScenario(cfg,"SSP2") # Climate: moderate mitigation (RCP4.5) cfg$gms$c56_pollutant_prices <- "SSPDB-SSP2-45-MESSAGE-GLOBIOM" cfg$gms$c60_2ndgen_biodem <- "SSPDB-SSP2-45-MESSAGE-GLOBIOM" @@ -239,7 +242,7 @@ cfg<-general_settings(cfg$title <- "SSP2_RCP4p5_SensitivityAWShigh") cfg$input <- buildInputVector(co2="co2",climatescen_name="rcp4p5",regionmapping="inms",calibration=calib) # Development: historical trends (SSP2) # Land Use: medium regulation, medium productivity (SSP2) -cfg<-lucode::setScenario(cfg,"SSP2") +cfg<-setScenario(cfg,"SSP2") # Climate: moderate mitigation (RCP4.5) cfg$gms$c56_pollutant_prices <- "SSPDB-SSP2-45-MESSAGE-GLOBIOM" cfg$gms$c60_2ndgen_biodem <- "SSPDB-SSP2-45-MESSAGE-GLOBIOM" @@ -253,7 +256,7 @@ cfg<-general_settings(cfg$title <- "SSP2_RCP4p5_SensitivityAWSmoderate") ### cfg$input <- buildInputVector(co2="co2",climatescen_name="rcp4p5",regionmapping="inms",calibration=calib) # Development: historical trends (SSP2) # Land Use: medium regulation, medium productivity (SSP2) -cfg<-lucode::setScenario(cfg,"SSP2") +cfg<-setScenario(cfg,"SSP2") # Climate: moderate mitigation (RCP4.5) cfg$gms$c56_pollutant_prices <- "SSPDB-SSP2-45-MESSAGE-GLOBIOM" cfg$gms$c60_2ndgen_biodem <- "SSPDB-SSP2-45-MESSAGE-GLOBIOM" diff --git a/scripts/start/projects/project_sim4nexus.R b/scripts/start/projects/project_sim4nexus.R index 6c82e9fb34..e1349edc9c 100644 --- a/scripts/start/projects/project_sim4nexus.R +++ b/scripts/start/projects/project_sim4nexus.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -162,10 +162,10 @@ cfg<-general_settings(title="SSP2_IPSL-CM5A-LR_6p0_NoMit_biodiversity") # Land protection # land productivity increase (lower interest rate) # protection of biodiversity hotspots and WDPA - # Increased fertilizer efficiency (70% NUE of croplands) + # Increased fertilizer efficiency (70% NUE of croplands) # Improved animal waste management - # (LATER: Improved wastewater treatment) - # RCP6.0 + # (LATER: Improved wastewater treatment) + # RCP6.0 cfg<-gms::setScenario(cfg,"SSP2") cfg<-gms::setScenario(cfg,"cc") cfg$input <- buildInputVector(climatescen_name="rcp6p0",regionmapping = "coacch",calibration=calib) @@ -183,9 +183,9 @@ cfg<-general_settings(title="SSP2_IPSL-CM5A-LR_6p0_NoMit_diet") # Sustainable food production # Healthy and sufficient diet: Transformation towards a flexetarian healthy diet (similar to Lancet diet) with reduced meat consumption. Transformation pathway takes place until 2050 # Waste: max waste of 15% - # Agricultural efficiency: Crop production reduced interest risk premium for interest rate, increasing investments in yield-increasing technological change - # Livestock production improved animal waste management systems (Bodirsky et al 2014) - # Fertilizer: 70%NUE croplands + # Agricultural efficiency: Crop production reduced interest risk premium for interest rate, increasing investments in yield-increasing technological change + # Livestock production improved animal waste management systems (Bodirsky et al 2014) + # Fertilizer: 70%NUE croplands cfg<-gms::setScenario(cfg,"SSP2") cfg<-gms::setScenario(cfg,"cc") cfg$input <- buildInputVector(climatescen_name="rcp6p0",regionmapping = "coacch",calibration=calib) diff --git a/scripts/start/projects/project_sustag.R b/scripts/start/projects/project_sustag.R index 20a99f505c..8242da4faf 100644 --- a/scripts/start/projects/project_sustag.R +++ b/scripts/start/projects/project_sustag.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -27,15 +27,15 @@ buildInputVector <- function(regionmapping = "agmip", archive_rev = "34", madrat_rev = "4.14", validation_rev = "4.14", - calibration = "calibration_agmip_c200_19Dec18.tgz", + calibration = "calibration_agmip_c200_19Dec18.tgz", additional_data = "additional_data_rev3.58.tgz") { mappings <- c(H11="8a828c6ed5004e77d1ba2025e8ea2261", H12="690d3718e151be1b450b394c1064b1c5", mag="c30c1c580039c2b300d86cc46ff4036a", - agmip="c77f075908c3bc29bdbe1976165eccaf", - sim4nexus="270870819da5607e288b6d0e5a5e6594", - inms="69c65bb3c88e8033cf8df6b5ac5d52a9", - inms2="ef2ae7cd6110d5d142a9f8bd7d5a68f2", + agmip="c77f075908c3bc29bdbe1976165eccaf", + sim4nexus="270870819da5607e288b6d0e5a5e6594", + inms="69c65bb3c88e8033cf8df6b5ac5d52a9", + inms2="ef2ae7cd6110d5d142a9f8bd7d5a68f2", capri="e7e72fddc44cc3d546af7b038c651f51") archive_name=paste(project_name,climate_model,climatescen_name,co2,sep="-") archive <- paste0(archive_name, "_rev", archive_rev, "_", resolution, "_", mappings[regionmapping], ".tgz") diff --git a/scripts/start/projects/rcTest_default.R b/scripts/start/projects/rcTest_default.R index 74527b8a1e..0c58bc64c0 100644 --- a/scripts/start/projects/rcTest_default.R +++ b/scripts/start/projects/rcTest_default.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 diff --git a/scripts/start/projects/sticky.R b/scripts/start/projects/sticky.R index 447d60595d..fdeb330f5e 100644 --- a/scripts/start/projects/sticky.R +++ b/scripts/start/projects/sticky.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -24,20 +24,23 @@ source("scripts/start_functions.R") # Sources the default configuration file source("config/default.cfg") -#recalibrate -cfg$recalibrate <- "ifneeded" - - -for(cc in c("nocc","cc")){ +for(cc in c("cc")){ + cfg$force_download <- TRUE # Set cc cfg<-gms::setScenario(cfg,cc) + cfg$input <- c(regional = "rev4.69_h12_magpie.tgz", + cellular = "rev4.69_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", + validation = "rev4.69_h12_validation.tgz", + additional = "additional_data_rev4.17.tgz", + calibration = "calibration_H12_sticky_feb18_08May22.tgz") + # Set factor costs - cfg$gms$factor_costs = "sticky_feb18" + cfg$gms$factor_costs <- "sticky_feb18" #Change the results folder name - cfg$title<-paste0("Sticky_",cc) + cfg$title<-paste0("sticky_",cc) # Start run start_run(cfg=cfg) diff --git a/scripts/start/projects/test_bii.R b/scripts/start/projects/test_bii.R new file mode 100644 index 0000000000..bf35b38ce7 --- /dev/null +++ b/scripts/start/projects/test_bii.R @@ -0,0 +1,54 @@ +# | (C) 2008-2023 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 Biodiversity Prices +# ---------------------------------------------------------- + + +###################################### +#### 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:" +cfg$output <- c("rds_report","extra/disaggregation")#"extra/highres" + +prefix <- "BII07" + +cfg$qos <- "priority" + +ssp <- "SSP2" + +for (price in c(0,100,1000,2000,3000)) { + for (pol in c("Ref","Nature")) { + if (pol == "Ref") { + cfg <- setScenario(cfg,c(ssp,"NDC","rcp7p0")) + cfg$gms$s44_target_price <- price + cfg$gms$c35_protect_scenario <- "WDPA" + cfg$gms$c30_snv_target <- "by2030" + cfg$gms$s30_snv_shr <- 0 + } else if (pol == "Nature") { + cfg <- setScenario(cfg,c(ssp,"NDC","rcp7p0")) + cfg$gms$s44_target_price <- price + cfg$gms$c35_protect_scenario <- "BH_IFL" + cfg$gms$c30_snv_target <- "by2030" + cfg$gms$s30_snv_shr <- 0.2 + } + cfg$title <- paste(prefix,paste0(pol,"-BV",price),sep="_") + start_run(cfg,codeCheck=FALSE) + } +} diff --git a/scripts/start/projects/test_country.R b/scripts/start/projects/test_country.R new file mode 100644 index 0000000000..b3b86b59ee --- /dev/null +++ b/scripts/start/projects/test_country.R @@ -0,0 +1,69 @@ +# | (C) 2008-2023 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 routine for standardized test runs +# position: 5 +# ---------------------------------------------------------- + +## Load lucode2 and gms to use setScenario later +library(lucode2) +library(gms) + +# Load start_run(cfg) function which is needed to start MAgPIE runs +source("scripts/start_functions.R") + +# Source default cfg. This loads the object "cfg" in R environment +source("config/default.cfg") + +#download default input data +#download_and_update(cfg) + +# create additional information to describe the runs +cfg$info$flag <- "H100" + +cfg$output <- c("rds_report") # "extra/highres_country" +cfg$results_folder <- "output/:title:" +cfg$force_replace <- TRUE + +# support function to create standardized title +.title <- function(...) return(paste(cfg$info$flag, sep="_",...)) + +#Reference and Policy run for SSP1, SSP2 and SSP5 +for(ssp in c("SSP2")) { + cfg$title <- .title(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") + + cfg$gms$processing <- "off" + cfg$gms$residues <- "off" +# cfg$gms$nr_soil_budget <- nr_soil_budget + cfg$gms$disagg_lvst <- "off" + # #H40 + # cfg$input["cellular"] <- "rev4.65_76adaf1c_1998ea10_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz" + # cfg$input["validation"] <- "rev4.65_76adaf1c_validation.tgz" + # cfg$input["regional"] <- "rev4.65_76adaf1c_magpie.tgz" + # cfg$input["calibration"] <- "calibration_H40_23Dec21.tgz" + #H100 + cfg$input["cellular"] <- "rev4.65_6755efa7_1998ea10_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz" + cfg$input["validation"] <- "rev4.65_6755efa7_validation.tgz" + cfg$input["regional"] <- "rev4.65_6755efa7_magpie.tgz" + cfg$input["calibration"] <- "calibration_H100_26Dec21.tgz" + + cfg$recalibrate_landconversion_cost <- TRUE + cfg$recalibrate <- TRUE + # cfg$calib_maxiter <- 5 + # cfg$calib_maxiter_landconversion_cost <- 5 + + download_and_update(cfg) + Sys.sleep(3) + if (file.exists("modules/14_yields/input/f14_yld_calib.csv")) file.remove("modules/14_yields/input/f14_yld_calib.csv") + Sys.sleep(2) + + 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..5b34d09103 --- /dev/null +++ b/scripts/start/projects/test_diets.R @@ -0,0 +1,345 @@ +# | (C) 2008-2023 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 <- "no_underweight_half_overweight" +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 <- "no_underweight_half_overweight" +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,"NoUnderweightHalfOverweight",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_half_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,"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,"HalfOverweight",sep="_") +cfg$gms$food <- "anthro_iso_jun22" +cfg$gms$s15_exo_waste <- 0 +cfg$gms$s15_exo_diet <- 1 +cfg$gms$c15_kcal_scen <- "half_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 <- "no_underweight_half_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,"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 new file mode 100644 index 0000000000..ca6ded54dd --- /dev/null +++ b/scripts/start/projects/test_rotations.R @@ -0,0 +1,67 @@ +# | (C) 2008-2023 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 new rotational constraint 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$gms$s13_max_gdp_shr <- 0.01 + +cfg$results_folder <- "output/:title:" +#cfg$output <- c("rds_report","extra/disaggregation")#"extra/highres" +prefix <- "rota_penalty18" + +cfg$title <- paste(prefix,"olddefault",sep="_") +start_run(cfg,codeCheck=FALSE) + +#cfg$title <- paste(prefix,"olddefault_stickydynamic",sep="_") +#cfg$input <- c(regional = "rev4.68_h12_magpie.tgz", +# cellular = "rev4.68_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", +# validation = "rev4.68_h12_validation.tgz", +# additional = "additional_data_rev4.18.tgz", +# calibration = "calibration_H12_sticky_feb18_dynamic_rotation_14Jun22.tgz") + +#cfg$gms$c38_sticky_mode <- "dynamic" +#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 +start_run(cfg,codeCheck=FALSE) +magpie4::submitCalibration("H12_sticky_feb18_dynamic_rotation2") +cfg$recalibrate <- FALSE +cfg$recalibrate_landconversion_cost <- FALSE + +for (scenario in c("none","default","fallow","legumes","agroforestry","agroecology")){ + for (byyear in c("by2030","by2050")){ + cfg$gms$c30_rotation_scenario = scenario + cfg$gms$c30_rotation_scenario_speed = byyear + cfg$title <- paste(prefix,scenario,byyear,sep="_") + start_run(cfg,codeCheck=FALSE) + } + +} diff --git a/scripts/start/test_runs.R b/scripts/start/test_runs.R index 7751c36724..b7bf326f92 100644 --- a/scripts/start/test_runs.R +++ b/scripts/start/test_runs.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -6,14 +6,10 @@ # | Contact: magpie@pik-potsdam.de # ---------------------------------------------------------- -# description: test routine to run for new pull requests +# description: Test routine for standardized test runs # position: 5 # ---------------------------------------------------------- - -##### Version log (YYYYMMDD - Description - Author(s)) -## 20200527 - Default SSP2 Baseline and Policy runs - FH,AM,EMJB,JPD - ## Load lucode2 and gms to use setScenario later library(lucode2) library(gms) @@ -24,39 +20,66 @@ source("scripts/start_functions.R") # Source default cfg. This loads the object "cfg" in R environment source("config/default.cfg") -# choose a meaningful Pull Request (PR) flag -pr_flag <- "PR_MACC" +#download default input data +download_and_update(cfg) -# Grab user name -user <- Sys.info()[["user"]] +# create additional information to describe the runs +cfg$info$flag <- "weeklyTests" +cfg$output <- c("rds_report") # Only run rds_report after model run cfg$results_folder <- "output/:title:" +cfg$force_replace <- TRUE + +# support function to create standardized title +.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(cfg, paste(ssp,"Ref",sep="-")) + cfg <- setScenario(cfg,c(ssp,"NPI","rcp7p0")) + cfg$gms$c56_mute_ghgprices_until <- "y2150" + cfg$gms$c56_pollutant_prices <- paste0("R21M42-",ssp,"-NPi") + cfg$gms$c60_2ndgen_biodem <- paste0("R21M42-",ssp,"-NPi") + start_run(cfg, codeCheck = FALSE) + + cfg$title <- .title(cfg, paste(ssp,"NDC",sep="-")) + cfg <- setScenario(cfg,c(ssp,"NDC","rcp4p5")) + cfg$gms$c56_mute_ghgprices_until <- "y2150" +# Input for NDC from R21M42 is not available, therefore NPi is used. + cfg$gms$c56_pollutant_prices <- paste0("R21M42-",ssp,"-NPi") + cfg$gms$c60_2ndgen_biodem <- paste0("R21M42-",ssp,"-NPi") + start_run(cfg, codeCheck = FALSE) + + cfg$title <- .title(cfg, paste(ssp,"PkBudg900",sep="-")) + cfg <- setScenario(cfg,c(ssp,"NDC","rcp1p9")) + cfg$gms$c56_mute_ghgprices_until <- "y2030" + cfg$gms$c56_pollutant_prices <- paste0("R21M42-",ssp,"-PkBudg900") + cfg$gms$c60_2ndgen_biodem <- paste0("R21M42-",ssp,"-PkBudg900") + start_run(cfg, codeCheck = FALSE) -## Create a set of runs based on default.cfg - -for(ssp in c("SSP2")) { ## Add SSP* here for testing other SSPs. Basic test should be for SSP2 - for(macc in c("PBL_2007","PBL_2019")) { - for (co2_price_path in c("BAU","POL")) { - - cfg$gms$c57_macc_version <- macc +} - if (co2_price_path == "BAU") { - cfg <- setScenario(cfg,c(ssp,"NPI")) - cfg$gms$c56_pollutant_prices <- "R2M41-SSP2-NPi" #update to most recent coupled runs asap - cfg$gms$c60_2ndgen_biodem <- "R2M41-SSP2-NPi" ##update to most recent coupled runs asap +##################################################### +### FSEC Test runs (BAU + FSDP) with FSEC regions ### +##################################################### +source("scripts/projects/fsec.R") - } else if (co2_price_path == "POL"){ - cfg <- setScenario(cfg,c(ssp,"NDC")) - cfg$gms$c56_pollutant_prices <- "SSPDB-SSP2-26-REMIND-MAGPIE" #update to most recent coupled runs asap - cfg$gms$c60_2ndgen_biodem <- "SSPDB-SSP2-26-REMIND-MAGPIE" ##update to most recent coupled runs asap - } +codeCheck <- FALSE - cfg$title <- paste0(pr_flag,"_",user,"_",ssp,"-",co2_price_path,"_",macc) #Create easily distinguishable run title +### Business-as-usual +cfg <- fsecScenario(scenario = "c_BAU") +start_run(cfg = cfg, codeCheck = codeCheck) - cfg$output <- c("rds_report") # Only run rds_report after model run +### FSDP Scenario +cfg <- fsecScenario(scenario = "e_FSDP") +start_run(cfg = cfg, codeCheck = codeCheck) - start_run(cfg,codeCheck=TRUE) # Start MAgPIE run - #cat(cfg$title) - } - } -} diff --git a/scripts/start_functions.R b/scripts/start_functions.R index 3133ecb453..3e9cf03c01 100644 --- a/scripts/start_functions.R +++ b/scripts/start_functions.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -9,45 +9,14 @@ # Define internal functions ################################################################################ -.set_formatting <- function(x,space=' ',prefix="", suffix1=",", suffix2=" /", collapse=",", n=10) { - content <- NULL - tmp <- lapply(split(x, ceiling(seq_along(x)/n)),paste,collapse=collapse) - end <- suffix1 - for(i in 1:length(tmp)) { - if(i==length(tmp)) end <- suffix2 - content <- c(content,paste0(space,prefix,tmp[[i]],end)) - } - return(content) -} - -.write_sets <- function(name,desc,items,n,suffix,file) { - - if ((length(name)+length(desc)+length(items)+length(n)+length(suffix))/5 != length(name)) stop("Same number of entries for name, desc, items, n and suffix is required") - - subject <- 'SETS' - header <- c( - '*THIS CODE IS CREATED AUTOMATICALLY, DO NOT MODIFY THESE LINES DIRECTLY', - '*ANY DIRECT MODIFICATION WILL BE LOST AFTER NEXT INPUT DOWNLOAD', - '*CHANGES CAN BE DONE USING THE INPUT DOWNLOADER UNDER SCRIPTS/DOWNLOAD', - '*THERE YOU CAN ALSO FIND ADDITIONAL INFORMATION') - - content <- c(header,'','sets','') - - - for (i in 1:length(name)) { - content <- c(content,paste0(' ',name[[i]],' ',desc[[i]],' /')) - content <- c(content, .set_formatting(items[[i]], suffix1=suffix[[i]], suffix2=" /",n = n[[i]])) - content <- c(content,'') - } - content <- c(content,';') - - gms::replace_in_file(file,content,subject) -} - .update_sets_core <- function(cpr,map) { require(gms) - reg1 <- unique(map$RegionCode) + if (!("region" %in% names(map))) map$region <- map$RegionCode + if (!("country" %in% names(map))) map$country <- map$CountryCode + if (!("superregion" %in% names(map))) map$superregion <- map$region + + reg1 <- unique(as.character(map$region)) reg2 <- names(cpr) if(!all(union(reg1,reg2) %in% intersect(reg1,reg2))) { stop("Inconsistent region information!", @@ -57,64 +26,73 @@ j <- 0; cells <- NULL - for(i in 1:length(cpr)) { - cells <- c(cells,paste(names(cpr)[i],"_",j+1,"*",names(cpr)[i],"_",j+cpr[i],sep="")) - j <- j+cpr[i] - } - - map_i_to_j <- NULL - for(i in 1:length(cpr)) { - map_i_to_j <- c(map_i_to_j,paste('',names(cpr)[i],' . ',cells[i],sep='')) - } - #map_i_to_j <- paste(names(cpr),cells,sep=" . ") - - map$RegionCode <- as.factor(map$RegionCode) - map_i_to_iso <- NULL - for(i in levels(map$RegionCode)) { - map_i_to_iso <- c(map_i_to_iso, .set_formatting(map$CountryCode[map$RegionCode==i],space = '', prefix=paste0(i," . ("), suffix1=")", suffix2=")")) - } - - name <- list("i","iso","j","cell(i,j)","i_to_iso(i,iso)") - desc <- list("all economic regions","list of iso countries","number of LPJ cells","number of LPJ cells per region i","mapping regions to iso countries") - items <- list(names(cpr),map$CountryCode,cells,map_i_to_j,map_i_to_iso) - n <- c(12,10,1,1,1) - suffix <- c(",",",",",","","") - file <- "core/sets.gms" - - .write_sets(name,desc,items,n,suffix,file) + for (i in 1:length(cpr)) { + if (cpr[i] == 1) { + cells <- c(cells, paste0(names(cpr)[i], "_", j + 1)) + } else { + cells <- c(cells, paste0(names(cpr)[i], "_", j + 1, "*", + names(cpr)[i], "_", j + cpr[i])) + } + j <- j + cpr[i] + } + ij <- data.frame(i = names(cpr), j = cells) + + hi <- unique(map[c("superregion", "region")]) + hi <- hi[order(hi$superregion),] + + sets <- list(list(name = "h", + desc = "all superregional economic regions", + items = sort(unique(as.character(map$superregion)))), + list(name = "i", + desc = "all economic regions", + items = names(cpr)), + list(name = "supreg(h,i)", + desc = "mapping of superregions to its regions", + items = hi), + list(name = "iso", + desc = "list of iso countries", + items = as.character(map$country)), + list(name = "j", + desc = "number of LPJ cells", + items = cells), + list(name = "cell(i,j)", + desc = "number of LPJ cells per region i", + items = ij), + list(name = "i_to_iso(i,iso)", + desc = "mapping regions to iso countries", + items = map[c("region","country")][order(map$region),])) + + gms::writeSets(sets, "core/sets.gms") } .update_sets_modules <- function() { require(gms) - + ### 56_ghg_policy ghgscen56 <- magclass::read.magpie("modules/56_ghg_policy/input/f56_pollutant_prices.cs3") ghgscen56 <- magclass::getNames(ghgscen56,dim=2) - + scen56 <- magclass::read.magpie("modules/56_ghg_policy/input/f56_emis_policy.csv",file_type = "cs3") scen56 <- magclass::getNames(scen56,dim=1) - - name <- list("ghgscen56","scen56") - desc <- list("ghg price scenarios","emission policy scenarios") - items <- list(ghgscen56,scen56) - n <- c(1,1) - suffix <- c(",",",") - file <- "modules/56_ghg_policy/price_jan20/sets.gms" - - .write_sets(name,desc,items,n,suffix,file) - + + sets <- list(list(name = "ghgscen56", + desc = "ghg price scenarios", + items = ghgscen56), + list(name = "scen56", + desc = "emission policy scenarios", + items = scen56)) + + 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") scen2nd60 <- magclass::getNames(scen2nd60,dim=1) - - name <- list("scen2nd60") - desc <- list("second generation bioenergy scenarios") - items <- list(scen2nd60) - n <- c(1) - suffix <- c(",") - file <- "modules/60_bioenergy/1stgen_priced_dec18/sets.gms" - - .write_sets(name,desc,items,n,suffix,file) + + sets <- list(list(name = "scen2nd60", + desc = "second generation bioenergy scenarios", + items = scen2nd60)) + + gms::writeSets(sets , "modules/60_bioenergy/1stgen_priced_dec18/sets.gms") } # Function to extract information from info.txt @@ -181,6 +159,20 @@ } +.spam2rds <- function(spatial_header, cells_tmp, + outfile = "clustermap_rev0_dummy.rds", + spamfile = Sys.glob("input/0.5-to-*_sum.spam")) { + + sp <- luscale::read.spam(spamfile) + a <- apply(sp, 2, function(x) return(which(x == 1))) + out <- data.frame(cell = cells_tmp, region = sub("\\..*$","",spatial_header), + country = sub("\\..*$","",cells_tmp), global = "GLO") + out$cluster <- paste0(out$region,".",a) + out <- out[,c("cell", "cluster","region","country","global")] + saveRDS(out, paste0("input/",outfile), version = 2) +} + + ################################################################################ ######################### MAIN FUNCTIONS ####################################### ################################################################################ @@ -204,51 +196,53 @@ download_and_update <- function(cfg) { # updating the general information in magpie.gms and input/info.txt # and .update_sets, which is updating the resolution- and region-depending # sets in core/sets.gms - tmp <- magclass::read.magpie("modules/10_land/input/avl_land_t.cs3") - cpr <- magclass::getCPR(tmp) + tmp <- magclass::read.magpie("modules/10_land/input/avl_land_t.cs3") + cpr <- magclass::getCPR(tmp) + tmp2 <- magclass::read.magpie("modules/10_land/input/avl_land_t_0.5.mz") + cel <- magclass::getItems(tmp2,1) # read spatial_header, map, reg_revision and regionscode load("input/spatial_header.rda") + rds <- any(grepl(pattern = "clustermap_rev.*.rds", x=list.files("input"))) + if(!rds) .spam2rds(spatial_header, cel, "clustermap_rev0_dummy.rds") .update_info(filemap,cpr,regionscode,reg_revision, warnings) .update_sets_core(cpr,map) .update_sets_modules() } -start_run <- function(cfg,scenario=NULL,codeCheck=TRUE, - path_to_report=NULL,LU_pricing="y2010", lock_model=TRUE) { +start_run <- function(cfg, scenario = NULL, codeCheck = TRUE, lock_model = TRUE) { timePrepareStart <- Sys.time() - if (!requireNamespace("gms", quietly = TRUE)) { - stop("Package \"gms\" needed for this function to work. Please install it.", - call. = FALSE) - } - - if (!requireNamespace("lucode2", quietly = TRUE)) { - stop("Package \"lucode2\" needed for this function to work. Please install it.", - call. = FALSE) - } - - if (!requireNamespace("magclass", quietly = TRUE)) { - stop("Package \"magclass\" needed for this function to work. Please install it.", - call. = FALSE) + checkNamespace <- function(...) { + for(package in c(...)) { + if (!requireNamespace(package, quietly = TRUE)) { + stop("Package \"",package,"\" needed for this function to work. Please install it.", + call. = FALSE) + } + } } + checkNamespace("gms", "lucode2", "magclass") Sys.setlocale(locale="C") maindir <- getwd() - on.exit(setwd(maindir)) + withr::defer(setwd(maindir)) if(lock_model) { lock_id <- gms::model_lock(timeout1=1) - on.exit(gms::model_unlock(lock_id), add=TRUE) + withr::defer(gms::model_unlock(lock_id)) } + # Apply scenario settings ans check configuration file for consistency if(!is.null(scenario)) cfg <- gms::setScenario(cfg,scenario) - cfg <- gms::check_config(cfg) + cfg <- gms::check_config(cfg, extras = c("info", "repositories"), saveCheck = TRUE) + + # save model version + cfg$info$version <- citation::read_cff("CITATION.cff")$version # Make 'title' a setglobal in gams to include it in the gdx - cfg$gms$c_title <- cfg$title + cfg$gms$c_title <- sub(".", "p", cfg$title, fixed = TRUE) rundate <- Sys.time() date <- format(rundate, "_%Y-%m-%d_%H.%M.%S") @@ -256,21 +250,64 @@ start_run <- function(cfg,scenario=NULL,codeCheck=TRUE, cfg$results_folder <- gsub(":title:", cfg$title, cfg$results_folder, fixed=TRUE) # Create output folder - if (!file.exists(cfg$results_folder)) { - dir.create(cfg$results_folder, recursive=TRUE, showWarnings=FALSE) - } else if (cfg$force_replace) { - cat("Deleting results folder because it alreay exists:",cfg$results_folder,"\n") - unlink(cfg$results_folder, recursive = TRUE) - dir.create(cfg$results_folder, recursive = TRUE, showWarnings = FALSE) + if (file.exists(cfg$results_folder)) { + if (cfg$force_replace) { + message("Deleting results folder because it already exists:", cfg$results_folder) + unlink(cfg$results_folder, recursive = TRUE) + } else { + stop(paste0("Results folder ", cfg$results_folder, + " could not be created because it already exists.")) + } + } + dir.create(cfg$results_folder, recursive = TRUE) + + if (is.null(renv::project())) { + message("No active renv project found, not using renv.") } else { - stop(paste0("Results folder ",cfg$results_folder, - " could not be created because is already exists.")) + # this script always runs in repo root, so we can check whether the main renv is loaded with: + if (normalizePath(renv::project()) == normalizePath(".")) { + message("Generating lockfile in '", cfg$results_folder, "'... ", appendLF = FALSE) + # suppress output of renv::snapshot + utils::capture.output({ + errorMessage <- utils::capture.output({ + snapshotSuccess <- tryCatch({ + # snapshot current main renv into run folder + renv::snapshot(lockfile = file.path(cfg$results_folder, "_renv.lock"), prompt = FALSE) + TRUE + }, error = function(error) FALSE) + }, type = "message") + }) + if (!snapshotSuccess) { + stop(paste(errorMessage, collapse = "\n")) + } + message("done.") + } else { + # a run renv is loaded, we are presumably starting a HR follow up run + message("Copying lockfile into '", cfg$results_folder, "'") + file.copy(renv::paths$lockfile(), file.path(cfg$results_folder, "_renv.lock")) + } + + createResultsfolderRenv <- function() { + renv::init() # will overwrite renv.lock if existing... + file.rename("_renv.lock", "renv.lock") # so we need this rename + renv::restore(prompt = FALSE) + message("renv creation done.") + } + + renvLogPath <- file.path(cfg$results_folder, "log_renv.txt") + message("Initializing run renv, see '", renvLogPath, "'...", appendLF = FALSE) + # init renv in a separate session so the libPaths of the current session remain unchanged + callr::r(createResultsfolderRenv, + wd = cfg$results_folder, + env = c(RENV_PATHS_LIBRARY = "renv/library"), + stdout = renvLogPath, stderr = "2>&1") + message("done.") } - # If report and scenname are available the data of this scenario in the report - # will be converted to MAgPIE input, saved to the respective input folders - # and used as input by the model - if (!is.null(path_to_report)) { - getReportData(path_to_report, LU_pricing) + + # If reports for both bioenergy and GHG prices are available convert them + # to MAgPIE input, save to the respective input folders, and use it as input + if (!is.na(cfg$path_to_report_bioenergy) & !is.na(cfg$path_to_report_ghgprices)) { + getReportData(cfg$path_to_report_bioenergy, cfg$path_to_report_ghgprices) cfg <- gms::setScenario(cfg,"coupling") } @@ -286,13 +323,13 @@ start_run <- function(cfg,scenario=NULL,codeCheck=TRUE, lucode2::manipulateConfig(cfg$model, cfg$gms) # configure input.gms in all modules based on settings of cfg file - l1 <- lucode2::path("modules", list.dirs("modules/", full.names = FALSE, + l1 <- file.path("modules", list.dirs("modules/", full.names = FALSE, recursive = FALSE)) for(l in l1) { - l2 <- lucode2::path(l, list.dirs(l, full.names = FALSE, recursive = FALSE)) + l2 <- file.path(l, list.dirs(l, full.names = FALSE, recursive = FALSE)) for(ll in l2) { - if(file.exists(lucode2::path(ll, "input.gms"))) { - lucode2::manipulateConfig(lucode2::path(ll, "input.gms"), cfg$gms) + if(file.exists(file.path(ll, "input.gms"))) { + lucode2::manipulateConfig(file.path(ll, "input.gms"), cfg$gms) } } } @@ -385,25 +422,55 @@ start_run <- function(cfg,scenario=NULL,codeCheck=TRUE, # Yield calibration calib_file <- "modules/14_yields/input/f14_yld_calib.csv" - if(!file.exists(calib_file)) stop("Yield calibration file missing!") if(cfg$recalibrate=="ifneeded") { - # recalibrate if all calibration factors are 1, otherwise don't - cfg$recalibrate <- all(magclass::read.magpie(calib_file)==1) + 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 calibration factor calculation!\n") + cat("Starting yield calibration factor calculation!\n") source("scripts/calibration/calc_calib.R") calibrate_magpie(n_maxcalib = cfg$calib_maxiter, calib_accuracy = cfg$calib_accuracy, - calibrate_pasture = (cfg$gms$past!="static"), + calibrate_pasture = (cfg$gms$past!="static" & cfg$gms$past!="grasslands_apr22"), calibrate_cropland = (cfg$calib_cropland), damping_factor = cfg$damping_factor, + crop_max = cfg$crop_calib_max, calib_file = calib_file, data_workspace = cfg$val_workspace, logoption = 3, - debug = cfg$debug) + debug = cfg$debug, + best_calib = cfg$best_calib) file.copy("calibration_results.pdf", cfg$results_folder, overwrite=TRUE) - cat("Calibration factor calculated!\n") + cat("Yield calibration factor calculated!\n") + } + + land_calib_file <- "modules/39_landconversion/input/f39_calib.csv" + if(cfg$recalibrate_landconversion_cost=="ifneeded") { + # recalibrate if file does not exist + if(!file.exists(land_calib_file)) cfg$recalibrate_landconversion_cost <- TRUE else cfg$recalibrate_landconversion_cost <- FALSE + } + if(cfg$recalibrate_landconversion_cost){ + #if(cfg$gms$landconversion!="devstate") stop("Land conversion cost calibration works only with realization devstate") + cat("Starting land conversion cost calibration factor calculation!\n") + source("scripts/calibration/landconversion_cost.R") + calibrate_magpie(n_maxcalib = cfg$calib_maxiter_landconversion_cost, + restart = cfg$restart_landconversion_cost, + calib_accuracy = cfg$calib_accuracy_landconversion_cost, + damping_factor = cfg$damping_factor_landconversion_cost, + cost_max = cfg$cost_calib_max_landconversion_cost, + cost_min = cfg$cost_calib_min_landconversion_cost, + calib_file = land_calib_file, + data_workspace = cfg$val_workspace, + logoption = 3, + debug = cfg$debug, + best_calib = cfg$best_calib_landconversion_cost) + cat("Land conversion cost calibration factor calculated!\n") } # copy important files into output_folder (before MAgPIE execution) @@ -411,21 +478,16 @@ start_run <- function(cfg,scenario=NULL,codeCheck=TRUE, try(file.copy(Sys.glob(file), cfg$results_folder, overwrite=TRUE)) } - # copy spam files to output folder - cfg$files2export$spam <- list.files(path="input/cellular", pattern = "*.spam", - full.names=TRUE) - for(file in cfg$files2export$spam) { - file.copy(file, cfg$results_folder, overwrite=TRUE) - } - cfg$magpie_folder <- getwd() + # only store repository paths, not their credentials + cfg$repositories <- sapply(names(cfg$repositories),function(x) NULL) + # store config in human and machine readable form + gms::saveConfig(cfg, file.path(cfg$results_folder, "config.yml")) - save(cfg, file=lucode2::path(cfg$results_folder, "config.Rdata")) - - gms::singleGAMSfile(mainfile=cfg$model, output=lucode2::path(cfg$results_folder, "full.gms")) + gms::singleGAMSfile(mainfile=cfg$model, output=file.path(cfg$results_folder, "full.gms")) if(lock_model) { gms::model_unlock(lock_id) - on.exit(setwd(maindir)) + withr::defer(setwd(maindir)) } setwd(cfg$results_folder) @@ -433,7 +495,7 @@ start_run <- function(cfg,scenario=NULL,codeCheck=TRUE, # Save run statistics to local file cat("Saving timePrepareStart and timePrepareEnd to runstatistics.rda\n") timePrepareEnd <- Sys.time() - lucode2::runstatistics(file = paste0("runstatistics.rda"), + lucode2::runstatistics(file = "runstatistics.rda", timePrepareStart = timePrepareStart, timePrepareEnd = timePrepareEnd) @@ -468,21 +530,24 @@ start_run <- function(cfg,scenario=NULL,codeCheck=TRUE, return(cfg$results_folder) } -getReportData <- function(path_to_report,LU_pricing="y2010") { +getReportData <- function(path_to_report_bioenergy, path_to_report_ghgprices = NA) { if (!requireNamespace("magclass", quietly = TRUE)) { stop("Package \"magclass\" needed for this function to work. Please install it.", call. = FALSE) } - .bioenergy_demand <- function(mag){ + .bioenergyDemand <- function(mag){ notGLO <- getRegions(mag)[!(getRegions(mag)=="GLO")] out <- mag[,,"Primary Energy Production|Biomass|Energy Crops (EJ/yr)"]*10^3 dimnames(out)[[3]] <- NULL - write.magpie(out[notGLO,,],"./modules/60_bioenergy/input/reg.2ndgen_bioenergy_demand.csv") + # delete old input file before updating it + f <- "./modules/60_bioenergy/input/reg.2ndgen_bioenergy_demand.csv" + suppressWarnings(unlink(f)) + write.magpie(out[notGLO,,],f) } - .emission_prices <- function(mag){ + .emissionPrices <- function(mag){ out_c <- mag[,,"Price|Carbon (US$2005/t CO2)"]*44/12 # US$2005/tCO2 -> US$2005/tC dimnames(out_c)[[3]] <- "co2_c" @@ -497,57 +562,75 @@ getReportData <- function(path_to_report,LU_pricing="y2010") { out <- mbind(out_n2o_direct,out_n2o_indirect,out_ch4,out_c) - # Set prices to zero before and in the year given in LU_pricing - y_zeroprices <- getYears(mag)<=LU_pricing - out[,y_zeroprices,]<-0 - # Remove GLO region notGLO <- getRegions(mag)[!(getRegions(mag)=="GLO")] - write.magpie(out[notGLO,,],"./modules/56_ghg_policy/input/f56_pollutant_prices_coupling.cs3") + # delete old input file before updating it + f <- "./modules/56_ghg_policy/input/f56_pollutant_prices_coupling.cs3" + suppressWarnings(unlink(f)) + write.magpie(out[notGLO,,],f) + } + + .readAndPrepare <- function(mifPath) { + rep <- read.report(mifPath, as.list = FALSE) + if (length(getNames(rep, dim = "scenario")) != 1) stop("getReportData: report contains more or less than 1 scenario.") + mag <- collapseNames(rep) # get rid of scenario and model dimension if they exist + + if(!("y1995" %in% getYears(mag))){ + empty95 <- mag[, 1,] + empty95[,,] <- 0 + dimnames(empty95)[[2]] <- "y1995" + mag <- mbind(empty95, mag) + } + years <- 1990 + 5 * seq_len(32) + mag <- time_interpolate(mag, years) + return(mag) } # read REMIND report - rep <- read.report(path_to_report, as.list = FALSE) - if (length(getNames(rep,dim="scenario"))!=1) stop("getReportData: REMIND report contains more or less than 1 scenario.") - rep <- collapseNames(rep) # get rid of scenrio and model dimension if they exist - mag <- deletePlus(rep) #delete "+" and "++" from variable names - - if(!("y1995" %in% getYears(mag))){ - empty95<-mag[,1,];empty95[,,]<-0;dimnames(empty95)[[2]] <- "y1995" - mag <- mbind(empty95,mag) - } - years <- 1990+5*(1:32) - mag <- time_interpolate(mag,years) + message("Reading bioenergy_demand from ", path_to_report_bioenergy) + mag <- .readAndPrepare(path_to_report_bioenergy) - # delete old input files before updating them - files <- c("./modules/56_ghg_policy/input/f56_pollutant_prices_coupling.cs3","./modules/60_bioenergy/input/reg.2ndgen_bioenergy_demand.csv") - for(f in files) suppressWarnings(unlink(f)) + .bioenergyDemand(mag) - .bioenergy_demand(mag) - .emission_prices(mag) + # write emission files, if specified use path_to_report_ghgprices instead of the bioenergy report + if (is.na(path_to_report_ghgprices)) { + message("Reading ghg prices from the same file (", path_to_report_bioenergy, ")") + .emissionPrices(mag) + } else { + message("Reading ghg prices from ", path_to_report_ghgprices) + ghgmag <- .readAndPrepare(path_to_report_ghgprices) + .emissionPrices(ghgmag) + } } - -start_reportrun <- function (cfg, path_report, inmodel=NULL, sceninreport=NULL, codeCheck=FALSE){ - if (!requireNamespace("magclass", quietly = TRUE)) { - stop("Package \"magclass\" needed for this function to work. Please install it.", - call. = FALSE) - } - if (!requireNamespace("gms", quietly = TRUE)) { - stop("Package \"gms\" needed for this function to work. Please install it.", - call. = FALSE) - } - rep <- magclass::convert.report(path_report,inmodel=inmodel,outmodel="MAgPIE") - magclass::write.report(rep,"report.mif") - if (!is.null(sceninreport)) - sceninreport <- intersect(sceninreport,names(rep)) - else - sceninreport <- names(rep) - - for(scen in sceninreport) { - cfg$title <- scen - # extract scenario from scenarioname and apply it - cfg <- gms::setScenario(cfg,substring(scen,first=1,last=4)) - start_run(cfg, report=rep, sceninreport=scen, codeCheck=codeCheck) - } +# Will not actually solve the model: after compilation, this just copies the results +# of a previous run, useful for testing compilation and input/output handling. +# Used in scripts/start/extra/empty_model.R and tests for REMIND-MAgPIE coupling. +configureEmptyModel <- function(cfg, inputGdxPath) { + message("Configuring to use empty MAgPIE model, reproduces prior run ", inputGdxPath) + originalModel <- withr::local_connection(file(cfg$model, "r")) + emptyModelFile <- "standalone/empty_test_model.gms" + emptyModel <- withr::local_connection(file(emptyModelFile, "w")) + while (TRUE) { + originalLine <- readLines(originalModel, n = 1) + if (length(originalLine) == 0) { + break + } + writeLines(originalLine, emptyModel) + if (grepl("*END MODULE SETUP*", originalLine)) { + # add code for short-circuiting the model + writeLines(c( + "***********************TEST USING EMPTY MODEL***********************************", + "*** empty model just uses input gdx as the result", + "*** rest of the model is compiled, but not executed", + "$setglobal c_input_gdx_path path", + "execute \"cp %c_input_gdx_path% fulldata.gdx\";", + "abort.noerror \"cp %c_input_gdx_path% fulldata.gdx\";", + "********************************************************************************"), + emptyModel) + } + } + cfg$model <- emptyModelFile + cfg$gms$c_input_gdx_path <- inputGdxPath + return(cfg) } diff --git a/standalone/.gitignore b/standalone/.gitignore new file mode 100644 index 0000000000..f836b512c0 --- /dev/null +++ b/standalone/.gitignore @@ -0,0 +1 @@ +empty_test_model.gms diff --git a/standalone/demand_model.gms b/standalone/demand_model.gms index 612e58d272..20c44f2abf 100644 --- a/standalone/demand_model.gms +++ b/standalone/demand_model.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/standalone/template.gms b/standalone/template.gms index cc0eb7deec..1fd74a3cd0 100644 --- a/standalone/template.gms +++ b/standalone/template.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2023 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 diff --git a/start.R b/start.R index 3822da8216..9ca78a4cae 100644 --- a/start.R +++ b/start.R @@ -1,4 +1,4 @@ -# | (C) 2008-2021 Potsdam Institute for Climate Impact Research (PIK) +# | (C) 2008-2023 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 @@ -9,28 +9,35 @@ #### MAgPIE output generation #### ########################################################## +if (!is.null(renv::project())) { + ask <- function(question) { + message(question, appendLF = FALSE) + return(tolower(gms::getLine()) %in% c("", "y", "yes")) + } + + message("Checking for updates... ", appendLF = FALSE) + if (getOption("autoRenvUpdates", FALSE) || + (!is.null(piamenv::showUpdates()) && ask("Update now? (Y/n): "))) { + updates <- piamenv::updateRenv() + piamenv::stopIfLoaded(names(updates)) + } + message("Update check done.") + + message("Checking package version requirements... ", appendLF = FALSE) + updates <- piamenv::fixDeps(ask = TRUE) + piamenv::stopIfLoaded(names(updates)) + message("Requirements check done.") +} + library(lucode2) library(gms) runOutputs <- function(runscripts=NULL, submit=NULL) { - - get_line <- function(){ - # gets characters (line) from the terminal or from a connection - # and returns it - if(interactive()){ - s <- readline() - } else { - con <- file("stdin") - s <- readLines(con, 1, warn=FALSE) - on.exit(close(con)) - } - return(s); - } - choose_submit <- function(title="Please choose run submission type") { slurm <- suppressWarnings(ifelse(system2("srun",stdout=FALSE,stderr=FALSE) != 127, TRUE, FALSE)) modes <- c("SLURM priority", "SLURM standby", + "SLURM medium", "Direct execution", "Background execution", "Debug mode") @@ -42,17 +49,18 @@ runOutputs <- function(runscripts=NULL, submit=NULL) { modes <- grep("SLURM",modes,invert=TRUE,value=TRUE) } cat("\n",title,":\n", sep="") - cat(paste(1:length(modes), modes, sep=": " ),sep="\n") + cat(paste(seq_along(modes), modes, sep=": " ),sep="\n") cat("Number: ") - identifier <- get_line() + identifier <- gms::getLine() identifier <- as.numeric(strsplit(identifier,",")[[1]]) if(slurm) { comp <- switch(identifier, "1" = "slurmpriority", "2" = "slurmstandby", - "3" = "direct", - "4" = "background", - "5" = "debug") + "3" = "slurmmedium", + "4" = "direct", + "5" = "background", + "6" = "debug") } else { comp <- switch(identifier, "1" = "direct", @@ -64,6 +72,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)) { @@ -77,14 +87,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")) @@ -92,6 +102,9 @@ runOutputs <- function(runscripts=NULL, submit=NULL) { } else if(submit=="slurmstandby") { system(paste(sbatch_command,"--qos=standby")) Sys.sleep(1) + } else if(submit=="slurmmedium") { + system(paste(sbatch_command,"--qos=medium")) + Sys.sleep(1) } else if(submit=="debug") { tmp.env <- new.env() sys.source(name,envir=tmp.env)