diff --git a/.zenodo.json b/.zenodo.json index efa149f699..a721129a86 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,6 +1,6 @@ { "title": "MAgPIE - An Open Source land-use modeling framework", - "version": "4.7.3dev", + "version": "4.8.1dev", "creators": [ { "name": "Dietrich, Jan Philipp", @@ -99,6 +99,11 @@ "affiliation": "Potsdam Institute for Climate Impact Research", "orcid": "0000-0003-0328-4750" }, + { + "name": "Steinhauser, Jan", + "affiliation": "Potsdam Institute for Climate Impact Research", + "orcid": "0000-0002-5989-6855" + }, { "name": "Lotze-Campen, Hermann", "affiliation": "Potsdam Institute for Climate Impact Research", @@ -110,9 +115,9 @@ "orcid": "0000-0001-9500-1986" } ], - "keywords": ["landuse", "modeling", "nlp", "partial equilibrium"], + "keywords": ["landuse", "modeling", "model", "nlp", "partial equilibrium"], "license": { "id": "AGPL-3.0-or-later" }, - "publication_date": "2024-04-12" + "publication_date": "2024-06-19" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 3006273180..7c38f4392c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,44 +7,108 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] ### changed -- **22_land_conservation and default.cfg** Added options for baseline protection +- + +### added +- **scripts** added output report `EU_report.R` that uses `EU_report.Rmd` +- **70_livestock** added realization `fbask_jan16_sticky` + +### removed +- + +### fixed +- + + +## [4.8.1] - 2024-06-19 + +### changed +- **29_ageclass** module 29_ageclass has been renamed to 28_ageclass to make space for `29_cropland` just before `30_croparea` +- **30_crop** module `30_crop` renamed to `30_croparea`, which now only accounts for crop area. +- **30_crop** Semi-Natural Vegetation (SNV) implementation has been moved from `30_crop` to `29_cropland` +- **30_crop** the previous `30_crop/endo_apr21` realization has been moved to `30_croparea/simple_apr24` +- **30_crop** the two realizations `penalty_apr22` and `rotation_apr22` have been merged into a single `30_croparea/detail_apr24` realization +- **default.cfg** update additional data to rev4.51 +- **scripts** adjusted SLURM job handling +- **scripts** updated EL2p0 start scripts + +### added +- **10_land** added interface `pm_land_hist` with historic land use patterns +- **29_cropland** new module `29_cropland` accounting for crop area, fallow cropland and tree cover on cropland with two realizations: `detail_apr24` and `simple_apr24` (default). +- **42_water_demand** added non-agricultural water demand for entire year + +### removed +- **32_forestry** removed technical balance term `v32_land_missing_ndc` + +### fixed +- **22_land_conservation** avoid infeasibilities due to very small numbers, account for cropland tree cover and lower bound of cropland +- **32_forestry** avoid infeasibilities due to very small numbers +- **35_natveg** avoid infeasibilities due to very small numbers +- **44_biodiversity** Fixing to SSP2 parameters until 2025 was not working +- **config** update to input data rev4.109. In the previous rev4.108, MER GDP was wrong and was identical to PPP GDP + + + +## [4.8.0] - 2024-06-10 + +### changed +- **14_yields** revised timber yield calculations - **15_food, default.cfg and scenario_config.csv** changed fader setup and introduced new switches for specifying food substitution scenarios and exogeneous food intake scenarios -- **70_livestock, default.cfg and scenario_config.csv** changed fader setup and introduced new switches for specifying feed substitution with SCP scenarios -- **default.cfg** update additional data to rev4.50 -- **default.cfg** changed default realization for 44_biodiversity to new realization `bii_target_apr24` +- **22_land_conservation and default.cfg** Added options for baseline protection +- **32_forestry** renamed interface `pm_demand_ext` to `pm_demand_forestry` +- **32_forestry** revision and simplification of forestry implementation, renamed realization from `dynamic_feb21` to `dynamic_may24`. +- **35_natveg** `vm_land(j2,"forestry")` included in NPI/NDC constraint `q35_min_forest` +- **35_natveg** replaced the realisation `dynamic_feb21` with realisation `pot_forest_may24`. The new realisation provides additional information on the potential forest area, which is now used to constrain forest and forestry expansion and recovery. The remaining area for forest establishment is provided to the forestry module via the new interface parameter `pcm_max_forest_est`. +- **41_area_equipped_for_irrigation** updated (non-default) AEI data (from Mehta2022 to Mehta2024) +- **52_carbon** Separate carbon densities for forest and other land. Before there was only a single carbon density for natural vegetation land. +- **70_livestock** default.cfg and scenario_config.csv** changed fader setup and introduced new switches for specifying feed substitution with SCP scenarios - **80_optimization** Simplifed cycling through CONOPT4, CONOPT4 with OPTFILE, CONOPT4 without preprocessing and CONOPT3. +- **default.cfg** changed default realization for 44_biodiversity to new realization `bii_target_apr24` +- **default.cfg** defaults for `cfg$gms$sm_fix_SSP2`, `cfg$gms$sm_fix_cc` and other switches changed from 2020 to 2025 +- **default.cfg** Forestry sector included by default by using the `ForestryEndo` settings from `scenario_config.csv`: `s32_initial_distribution = 1`, `s32_demand_establishment = 1`, `s32_hvarea = 2`, `s35_secdf_distribution = 2`, `s35_hvarea = 2`, `s73_timber_demand_switch = 1` +- **default.cfg** update additional data to rev4.50 +- **scripts** modified agmip_merge_report to use piamInterfaces - **scripts** start/test_runs.R added 2 more test runs from FSEC ### added -- **70_livestock** added realization `fbask_jan16_sticky` -- **default.cfg** added cropland growth constraint `cfg$gms$s30_annual_max_growth` -- **default.cfg** added technical cost for missing BII increase `cfg$gms$s44_cost_bii_missing` -- **default.cfg** added settings for new price-driven bioenergy realization `1st2ndgen_priced_feb24`: `cfg$gms$s60_2ndgen_bioenergy_dem_min_post_fix`, `cfg$gms$c60_bioenergy_subsidy_fix_SSP2`, `s60_bioenergy_gj_price_1st`, -`s60_bioenergy_price_2nd`, `c60_price_implementation` -- **core** added `coup2110`timesteps - **15_food** added additional sigmoid food substition scenarios `sigmoid_75pc_25_50`, `sigmoid_50pc_25_50` and `sigmoid_25pc_25_50` +- **21_trade** Minimum trade margin for forestry products `s21_min_trade_margin_forestry` - **30_crop** added regional cropland equation `q30_crop_reg` and presolve growth constraint - **44_biodiversity** added new realization `bii_target_apr24`, taking into account `f44_rr_layer` - **60_bioenergy** added new realization `1st2ndgen_priced_feb24` to enable price-driven 2nd gen bioenergy production -- **scripts** added automatic set writer for new bioenergy realization to `start_functions` -- **scripts** added start scripts for the GENIE project -- **scenario_config.csv** added preset for GENIE project +- **73_timber** added interface `im_timber_prod_cost` +- **citation** added abstract +- **core** added `coup2110`timesteps +- **default.cfg** added cropland growth constraint `cfg$gms$s30_annual_max_growth` +- **default.cfg** added settings for new price-driven bioenergy realization `1st2ndgen_priced_feb24`: `cfg$gms$s60_2ndgen_bioenergy_dem_min_post_fix`, `cfg$gms$c60_bioenergy_subsidy_fix_SSP2`, `s60_bioenergy_gj_price_1st`, +- **default.cfg** added technical cost for missing BII increase `cfg$gms$s44_cost_bii_missing` - **default.cfg** cfg$gms$s80_secondsolve option for second solve statement with 0=off as default +- **scenario_config.csv** added preset for GENIE project - **scripts** added "checkSummation" output script for consistency checking a report.mif -- **citation** added abstract +- **scripts** added automatic set writer for new bioenergy realization to `start_functions` +- **scripts** added start scripts for the GENIE project +`s60_bioenergy_price_2nd`, `c60_price_implementation` ### removed -- **scripts/output/extra** removed scripts disaggregation_cropsplit and disaggregation_transitions +- **14_yields** removed interface `pm_timber_yield_initial` +- **21_trade** removed interface `pm_selfsuff_ext`, removed `v21_manna_from_heaven` +- **32_forestry** removed interface `pm_representative_rotation` +- **35_natveg** removed growing stock calculation and calibration, which is no longer needed. +- **62_material/16_demand** Removed double structure for forestry products. `pm_demand_foresty` is now used in `62_material` +- **73_timber** removed interfaces `pm_demand_forestry_future` and `sm_wood_density` - **scripts** removed support for spam files in start_functions +- **scripts/output/extra** removed scripts disaggregation_cropsplit and disaggregation_transitions ### fixed -- **extra/disaggregation** fixed bug in disaggregation of land conservation related to switch from 59k to 67k that produced erroneous outputs +- **14_yields** fix division by zero in preloop of managementcalib_aug19 - **44_biodiversity** avoid division by zero +- **58_peatland** Added balance variable to avoid random infeasibilites +- **80_optimization** fixed a bug in nlp_apr17; cycling through CONOPT4, CONOPT4 without preprocessing and CONOPT3 was not working +- **extra/disaggregation** fixed bug in disaggregation of land conservation related to switch from 59k to 67k that produced erroneous outputs - **scenario_config.csv** same revision for input files as in default.cfg - **scenario_fsec.csv** scenario settings +- **scripts/start/test_runs.R** include all default output script, in particular disaggregation.R, which is needed for BII - **start/projects/fsec.R** scenario settings -- **80_optimization** fixed a bug in nlp_apr17; cycling through CONOPT4, CONOPT4 without preprocessing and CONOPT3 was not working -- **58_peatland** Added balance variable to avoid random infeasibilites ## [4.7.3] - 2024-04-12 @@ -914,7 +978,9 @@ 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.7.3...develop +[Unreleased]: https://github.com/magpiemodel/magpie/compare/v4.8.1...develop +[4.8.1]: https://github.com/magpiemodel/magpie/compare/v4.8.0...v4.8.1 +[4.8.0]: https://github.com/magpiemodel/magpie/compare/v4.7.3...v4.8.0 [4.7.3]: https://github.com/magpiemodel/magpie/compare/v4.7.2...v4.7.3 [4.7.2]: https://github.com/magpiemodel/magpie/compare/v4.7.1...v4.7.2 [4.7.1]: https://github.com/magpiemodel/magpie/compare/v4.7.0...v4.7.1 diff --git a/CITATION.cff b/CITATION.cff index 051c1c18dc..450dabd249 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -146,7 +146,7 @@ title: MAgPIE - An Open Source land-use modeling framework abstract: The *Model of Agricultural Production and its Impact on the Environment* (MAgPIE) is a modular open source framework for modeling global land-systems, which is coupled to the grid-based dynamic vegetation model LPJmL, with a spatial resolution - of 0.5°x0.5°. It takes regional economic conditions such as demand for agricultural + of 0.5degx0.5deg. It takes regional economic conditions such as demand for agricultural commodities, technological development and production costs as well as spatially explicit data on potential crop yields, land and water constraints (from LPJmL) into account. Based on these, the model derives specific land use patterns, yields and @@ -156,8 +156,8 @@ abstract: The *Model of Agricultural Production and its Impact on the Environmen exogenously given population in 10 food energy categories, based on regional diets. Future trends in food demand are derived from a cross-country regression analysis, based on future scenarios on GDP and population growth. -version: 4.7.3dev -date-released: 2024-04-12 +version: 4.8.1dev +date-released: 2024-06-19 repository-code: https://github.com/magpiemodel/magpie keywords: - landuse diff --git a/DESCRIPTION b/DESCRIPTION index 0b44903520..ba76854991 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -22,7 +22,7 @@ Imports: m4fsdp, madrat, magclass (>= 6.14.0), - magpie4, + magpie4 (>= 2.3.10), MagpieNCGains, magpiesets, mip, diff --git a/README.md b/README.md index 221d210608..4871b882dc 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.7.3 can be found at -https://rse.pik-potsdam.de/doc/magpie/4.7.3/ +The model documentation for version 4.8.1 can be found at +https://rse.pik-potsdam.de/doc/magpie/4.8.1/ A most recent version of the documentation can also be extracted from the model source code via the R package goxygen @@ -226,7 +226,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.7.3/#how-to-cite) in the model documentation for information how to cite the model. +See file CITATION.cff or the [How-to-Cite section](https://rse.pik-potsdam.de/doc/magpie/4.8.1/#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 d51079889b..dea1e9fa64 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -22,10 +22,10 @@ cfg$model <- "main.gms" #def = "main.gms" #### input settings #### # which input data sets should be used? -cfg$input <- c(regional = "rev4.105_h12_magpie.tgz", - cellular = "rev4.105_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", - validation = "rev4.105_h12_validation.tgz", - additional = "additional_data_rev4.50.tgz", +cfg$input <- c(regional = "rev4.109_h12_magpie.tgz", + cellular = "rev4.109_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", + validation = "rev4.109_h12_validation.tgz", + additional = "additional_data_rev4.51.tgz", calibration = "calibration_H12_26Mar24.tgz") # NOTE: It is recommended to recalibrate the model when changing cellular input data @@ -175,6 +175,11 @@ oecd90andEU <- "ALB,AUS,AUT,BEL,BIH,BGR,CAN,CYP,CZE,DNK,EST,FIN,FRA, NLD,NOR,NZL,POL,PRT,ROU,SRB,SVK,SVN,ESP,SWE,CHE,MKD,TUR, GBR,USA" +isoCountriesEUR <- "ALB,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" + + # ***--------------------- 09_drivers ---------------------------------------- # * (aug17): default drivers cfg$gms$drivers <- "aug17" # def = aug17 @@ -192,10 +197,10 @@ cfg$gms$c09_pal_scenario <- "SSP2" # def = SSP2 # * SDP: "SDP", "SDP_EI", "SDP_MC", "SDP_RC" # Year until which all parameters are fixed to SSP2 values -cfg$gms$sm_fix_SSP2 <- 2020 +cfg$gms$sm_fix_SSP2 <- 2025 # Year until which all parameters affected by climate change are fixed to historical values -cfg$gms$sm_fix_cc <- 2020 +cfg$gms$sm_fix_cc <- 2025 # ***--------------------- 10_land ---------------------------------------- # * (landmatrix_dec18): includes a land transition matrix @@ -205,7 +210,7 @@ cfg$gms$land <- "landmatrix_dec18" # def = landmatrix_dec18 # * 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 +cfg$gms$s10_cost_balance <- 1e+06 # def = 1e+06 # ***--------------------- 11_costs ------ -------------------------------- @@ -332,7 +337,7 @@ cfg$gms$s14_use_yield_calib <- 0 # def = 0 # Include a minimum yield for wood harvest in secondary vegetation (tDM per ha per yr). # Age classes with wood yields below this threshold have a production of zero. -cfg$gms$s14_minimum_wood_yield <- 20 #def = 20 +cfg$gms$s14_minimum_wood_yield <- 10 #def = 10 # ***--------------------- 15_food --------------------------------------- # * (anthropometrics_jan18): estimates food using scenario dependent regression @@ -573,11 +578,6 @@ cfg$gms$c20_scp_type <- "sugar" # def = sugar # * (selfsuff_reduced_bilateral22): same as `selfsuff_reduced` but with bilateral trade flows cfg$gms$trade <- "selfsuff_reduced" # def = selfsuff_reduced -# * option for `exo` realization only: -# * fix `v21_manna_from_heaven` to zero (0) or not (1) -# Note: Without fixing to zero, v21_manna_from_heaven might be used unnecessarily in runs started with highres.R -cfg$gms$s21_manna_from_heaven <- 0 - # * options for `selfsuff_reduced` and `selfsuff_reduced_bilateral22` realizations: # * Commodities that can have additional imports to maintain feasibility cfg$gms$k_import21 <- "wood, woodfuel" @@ -609,12 +609,16 @@ 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 +# * start year of fadeout if s21_trade_tariff_fadeout = 1 # def = 2025 +cfg$gms$s21_trade_tariff_startyear <- 2025 # * end year of fadeout if s21_trade_tariff_fadeout = 1 # def = 2050 cfg$gms$s21_trade_tariff_targetyear <- 2050 +# * Minimum trade margin for forestry products (USD05MER per tDM) +cfg$gms$s21_min_trade_margin_forestry <- 50 # def = 50 + + # ***--------------------- 22_land_conservation -------------------------------------- # * (area_based_apr22): Area-based conservation (baseline and future) # * based on WDPA and conservation priority areas @@ -676,41 +680,24 @@ cfg$gms$s22_restore_land <- 1 # def = 1 # * 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 +cfg$gms$s22_conservation_start <- 2025 # def = 2025 # * Target year (year when full protection is reached): -cfg$gms$s22_conservation_target <- 2030 # def = 2030 +cfg$gms$s22_conservation_target <- 2050 # def = 2050 -# ***--------------------- 29_ageclass ----------------------------------- +# ***--------------------- 28_ageclass ----------------------------------- # * (feb21): Distribution of age-classes according to Poulter et al 2018 cfg$gms$ageclass <- "feb21" # def = feb21 -# ***--------------------- 30_crop --------------------------------------- -# * (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. +# ***--------------------- 29_cropland ----------------------------------- +# * Cropland is defined as the sum of croparea, fallow land and tree cover +# * Croparea is provided by 30_crop. +# * Fallow land and tree cover are defined by 29_cropland, +# * (simple_apr24): Fallow land and tree cover on cropland are fixed to zero +# * (detail_apr24): Fallow land and tree cover based on rules or incentives # 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" -# * (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 +cfg$gms$cropland <- "simple_apr24" # def = simple_apr24 +# *** Options for all cropland realizations *** # * Switch to determine whether marginal land (suitability index below 0.33) should be included # * in the total available cropland. Options are: @@ -719,7 +706,13 @@ cfg$gms$s30_rotation_scenario_target <- 2050 # def = 2050 # * ("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" +cfg$gms$c29_marginal_land <- "q33_marginal" # def = "q33_marginal" + +# * Switch and specification of countries for selected policies in 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_countries29 <- all_iso_countries # * Share of available cropland that is withheld for maintaining semi-natural vegetation (SNV) # * in each square km in cropland areas, including grassland, forest and other land. For example, @@ -727,31 +720,133 @@ cfg$gms$c30_marginal_land <- "q33_marginal" # def = "q33_marginal" # * The amount of cropland relocation is estimated based on external high resolution # * land cover information from the Copernicus Global Land Service for the year 2019. # * Accepted sensible values are between 0 and 0.5 -# 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. +# Note: s29_snv_shr applies to countries selected in policy_countries29 +# s29_snv_shr_noselect applies to all other countries. +cfg$gms$s29_snv_shr <- 0 # def = 0 +cfg$gms$s29_snv_shr_noselect <- 0 # def = 0 +# * Year by which SNV policy ('s29_snv_shr') is fully implemented. # * Start year (should be close to 2019): -cfg$gms$s30_snv_scenario_start <- 2020 # def = 2020 +cfg$gms$s29_snv_scenario_start <- 2025 # def = 2025 # * 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 +cfg$gms$s29_snv_scenario_target <- 2050 # def = 2050 # * 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" +# *** Options only available for `detail_apr24` realization *** + +## Agroforestry settings for treecover on cropland +# * Sigmoid fader for minimum area share of treecover on total cropland at cluster level +# * Minimum area share of treecover on total cropland in target year +# Note: s29_treecover_target applies to countries selected in policy_countries29 +# s29_treecover_target_noselect applies to all other countries. +cfg$gms$s29_treecover_target <- 0 # def = 0 +cfg$gms$s29_treecover_target_noselect <- 0 # def = 0 +# * Avoid loss of existing treecover (1=yes 0=no). +# * If set to 1, `s29_treecover_target` will be adjusted based existing treecover area. +cfg$gms$s29_treecover_keep <- 1 # def = 1 +# * Maximum share of treecover on total cropland (1) +cfg$gms$s29_treecover_max <- 0.4 # def = 0.4 +# * Start year of fader +cfg$gms$s29_treecover_scenario_start <- 2025 # def = 2025 +# * Target year of fader (year when full implementation is reached) +cfg$gms$s29_treecover_scenario_target <- 2050 # def = 2050 +# * Penalty for violation of treecover target before scenario start (USD05MER per ha) +cfg$gms$s29_treecover_penalty_before <- 5000 # def = 5000 +# * Penalty for violation of treecover target after scenario start (USD05MER per ha) +cfg$gms$s29_treecover_penalty <- 5000 # def = 5000 +# * Tree cover establishment cost (USD05MER per ha) +cfg$gms$s29_cost_treecover_est <- 2000 # def = 2000 +# * Tree cover recurring cost (USD05MER per ha) +cfg$gms$s29_cost_treecover_recur <- 500 # def = 500 + +# * Sigmoid fader for minimum area share of fallow land on total cropland at cluster level +# * Minimum area share of fallow land on total cropland in target year +cfg$gms$s29_fallow_target <- 0 # def = 0 +# * Maximum share of fallow land on total cropland +cfg$gms$s29_fallow_max <- 0.4 # def = 0.4 +# * Start year of fader +cfg$gms$s29_fallow_scenario_start <- 2025 # def = 2025 +# * Target year of fader (year when full implementation is reached) +cfg$gms$s29_fallow_scenario_target <- 2050 # def = 2050 +# * Penalty for violation of fallow land target (USD05MER per ha) +cfg$gms$s29_fallow_penalty <- 500 # def = 500 + +# ***--------------------- 30_croparea --------------------------------------- +# * 30_croparea defines the croparea, which is a subcomponent of total cropland defined in 29_cropland. +# * (simple_apr24): Dynamic croparea with simple rotational constraints +# * (detail_apr24): Dynamic croparea with detailed rules and incentives for rotational constraints +# NOTE: It is recommended to recalibrate the model when changing this setting! +cfg$gms$croparea <- "simple_apr24" # def = simple_apr24 + +# *** Options for all croparea realizations *** + +# * (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" + +# * Switch and specification of countries for selected policies in 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 + +## Agroforestry settings for bioenergy trees +# * Sigmoid fader for minimum area share of bioenergy trees (betr) on total cropland at cluster level +# * Minimum area share of bioenergy trees on total cropland in start year +# Note: s30_betr_start applies to countries selected in policy_countries30, +# s30_betr_start_noselect applies to all other countries. +cfg$gms$s30_betr_start <- 0 # def = 0 +cfg$gms$s30_betr_start_noselect <- 0 # def = 0 +# * Minimum area share of bioenergy trees on total cropland in target year +# Note: s30_betr_target applies to countries selected in policy_countries30, +# s30_betr_target_noselect applies to all other countries. +cfg$gms$s30_betr_target <- 0 # def = 0 +cfg$gms$s30_betr_target_noselect <- 0 # def = 0 +# * Start year of fader +cfg$gms$s30_betr_scenario_start <- 2025 # def = 2025 +# * Target year of fader (year when full implementation is reached) +cfg$gms$s30_betr_scenario_target <- 2050 # def = 2050 +# * Penalty for violation of the target (USD05MER per ha) +cfg$gms$s30_betr_penalty <- 2000 # def = 2000 + # * Allowed annual cropland growth per year per region, relative to the current cropland level # * e.g., 0.02: 2% annual growth, compounded to 10.4% growth for five-years timestep cfg$gms$s30_annual_max_growth <- Inf # def = Inf +# *** Options only available for `simple_apr24` realization *** + +# * (c30_rotation_constraints): switch for rotational constraints: on, off +cfg$gms$c30_rotation_constraints <- "on" # def = "on" + +# *** Options only available for `detail_apr24` realization *** + +# * Switch for rule-based (1) or penalty-based (0) implementation of rotation scenarios +cfg$gms$s30_implementation <- 1 # def = 1 + +# * Rotation rules: +# * 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), sixfoldrotation (crops can only repeat after 6 years), +# * agroecology (mix of previous scenarios), FSEC (similar to agroecology) +# * betr0 (minimum share of short rotation agroforestry trees), betr10, betr20, betr25, betr30, betr40, betr50. +cfg$gms$c30_rotation_rules <- "default" # def = "default" + +# * Rotation incentives: +# * none (no incentives), default (best guess), +# * legumes (increased incentives for legumes), agroecology (mix), +# * betr500 and betr1000 (incentives for short rotation agroforestry trees) +cfg$gms$c30_rotation_incentives <- "none" # def = "none" + +# * Year by which rotation scenario is fully implemented: +# * Start year: +cfg$gms$s30_rotation_scenario_start <- 2025 # def = 2025 +# * Target year (year when full implementation is reached): +cfg$gms$s30_rotation_scenario_target <- 2050 # def = 2050 + # ***--------------------- 31_past --------------------------------------- # * (static): static pasture # * (endo_jun13): dynamic pasture @@ -784,8 +879,8 @@ cfg$gms$c31_grassl_yld_scenario <- "cc" # def = "cc" cfg$gms$s31_limit_calib <- 1 # def = 1 # ***--------------------- 32_forestry ----------------------------------- -# * (dynamic_feb21): Dynamic forestry sector including afforestation with detailed age-classes -cfg$gms$forestry <- "dynamic_feb21" # def = dynamic_feb21 +# * (dynamic_may24): Dynamic forestry sector including afforestation with detailed age-classes +cfg$gms$forestry <- "dynamic_may24" # def = dynamic_may24 # * afforestation planing horizon (years) cfg$gms$s32_planing_horizon <- 50 # def = 50 @@ -866,16 +961,9 @@ cfg$gms$c32_tcre_ctrl <- "ann_TCREmean" # In addition, timber plantations are fixed to 1995 levels in the "off" case. # In other cases, age-classes in timber plantations are initialized based on # rotation length and can change dynamically over time. -# Note that this switch has no effect in the "static_sep16" realization, -# in which forestry area is assumed static. # * 0= off -# * 1= Equal distribution -# * 2= FAO distribution based on planted forest estimates 2006 -# * 3= Poulter distribution -# * 4= Manual distribution - Similar to equal distribution but higher weight on -# * younger age-classes as plantation areas increase strongly -# * in recent history (ca. >1990). -cfg$gms$s32_initial_distribution <- 0 # def = 0 +# * 1= Area is distributed equally to all age-classes within the rotation period +cfg$gms$s32_initial_distribution <- 1 # def = 1 # Switch fore regional or global interest rate for rotation length calculations. # Using the global setting would mean that the timber plantation decisions are @@ -889,23 +977,17 @@ cfg$gms$c32_interest_rate <- "regional" # def = "regional" # Accepted values between 0 and 1. cfg$gms$s32_forestry_int_rate <- 0.05 # def = 0.05 -# Scenarios for using FAO scenarios of future proportion of production coming from -# Timber plantations used for deciding how much establishment should be made in -# simulation time step. This setting is only used when s32_hvarea is set to 2 ("Endogenous") -# * ("abare") = Global outlook for plantations. Australian Bureau of Agriculture and Resource Economics (ABARE) and Jaakko Pöyry Consulting 1999 -# * ("brown") = The global outlook for future wood supply from forest plantations. Working paper GFPOS/WP/03 prepared for the 1999 Global Forest Products Outlook Study 1999 -cfg$gms$c32_dev_scen <- "abare" # def = "abare" - -# Scenarios for future development of timber production contribution to roundwood demand -# based on the settings from c32_dev_scen. -# * ("constant") = Constant share over time (1995-2250) -# * ("h5s5l5") = In every time step 5% increase from 1995 till 2020, 5% increase from 2025 till 2050, 5% increase from 2055 till 2250 -# * ("h5s2l2") = In every time step 5% increase from 1995 till 2020, 2% increase from 2025 till 2050, 2% increase from 2055 till 2250 -# * ("h5s2l1") = In every time step 5% increase from 1995 till 2020, 2% increase from 2025 till 2050, 1% increase from 2055 till 2250 -# * ("h5s1l1") = In every time step 5% increase from 1995 till 2020, 1% increase from 2025 till 2050, 1% increase from 2055 till 2250 -# * ("h5s1l05") = In every time step 5% increase from 1995 till 2020, 1% increase from 2025 till 2050, 0.5% increase from 2055 till 2250 -# * ("h2s1l05") = In every time step 2% increase from 1995 till 2020, 1% increase from 2025 till 2050, 0.5% increase from 2055 till 2250 -cfg$gms$c32_incr_rate <- "h5s2l1" # def = "h5s2l1" +# Setting to define if the model should be forward looking or not in terms of +# seeing the future demand for current timestep establishment of new plantations. +# * 0 = static (establishment based on current demand) +# * 1 = forward looking (establishment based on future demand according to rotation length) +cfg$gms$s32_demand_establishment <- 1 # def = 1 + +# Establishment cost for plantations (USD per ha) +cfg$gms$s32_est_cost_plant <- 2000 # def = 2000 + +# Establishment cost for natural vegetation (USD per ha) +cfg$gms$s32_est_cost_natveg <- 2000 # def = 2000 # Harvesting switch for timber production # * 0 = No harvested area from plantations, no age-class shifting (area held constant at 1995 levels) @@ -915,7 +997,7 @@ cfg$gms$c32_incr_rate <- "h5s2l1" # def = "h5s2l1" # * such that the total plantation area remains constant. # * 2 = "Endogenous" scenario. Harvest from plantations including age-class shifting # * All plantations are harvested at rotation age. Plantation establishment is endogenous. -cfg$gms$s32_hvarea = 0 # def = 0 +cfg$gms$s32_hvarea = 2 # def = 2 # Type of rotation length selection criteria # * ("mean_annual_increment") = Harvesting when the average annual increment is maximum @@ -944,8 +1026,8 @@ cfg$gms$c34_urban_scenario <- "SSP2" # def = SSP2 # ***--------------------- 35_natveg -------------------------------------- # * 35_natveg includes primforest, secdforest and other land -# * (dynamic_feb21): Dynamic natural vegetation land with detailed age-classes -cfg$gms$natveg <- "dynamic_feb21" # def = dynamic_feb21 +# * (pot_forest_may24): Dynamic natural vegetation land with detailed age-classes +cfg$gms$natveg <- "pot_forest_may24" # def = pot_forest_may24 # Avoided Deforestation policy # * ("none"): no avoided deforestation @@ -963,7 +1045,7 @@ cfg$gms$c35_aolc_policy <- "npi" # def = "npi" # * (0): All secondary forest belongs to highest age class # * (1): Equal distribution of secondary forest in all age-classes # * (2): Distribution of secondary forest according to Poulter et al 2018 based on MODIS satellite data -cfg$gms$s35_secdf_distribution <- 0 # def = 0 +cfg$gms$s35_secdf_distribution <- 2 # def = 2 # Damages in natural forests # * (0): No damage simulated @@ -978,7 +1060,7 @@ cfg$gms$s35_forest_damage_end <- 2050 #def = 2050 # * 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 <- 2 # def = 2 # Generic forest shock scenarios. Disturbance sets percentage of all age classes back to 0 # * ("none") No disturbance applied @@ -988,6 +1070,12 @@ cfg$gms$s35_hvarea <- 0 # def = 0 # * ("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" +# * Scenario for potential forest area +# * options: cc (climate change) +# * nocc (no climate change) +# * nocc_hist (no climate change after year defined by sm_fix_cc) +cfg$gms$c35_pot_forest_scenario <- "cc" # def = "cc" + # ***--------------------- 36_employment ------------------------------- # * This module calculates agricultural employment. # * (exo_may22): employment is calculated based on labor costs and not affecting the @@ -1050,7 +1138,7 @@ cfg$gms$c38_fac_req <- "glo" # default "glo" # * 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 +cfg$gms$s38_startyear_labor_substitution <- 2025 # default 2025 # * The following two settings are to create exogenous scenarios in which capital is substituted by labor to increase # * employment: @@ -1101,7 +1189,8 @@ cfg$gms$area_equipped_for_irrigation <- "endo_apr13" # def = endo_apr13 # * switch for initialization area # * (LUH2v2): area equipped for irrigation based on LUH2v2 irrigated areas -# * (Mehta2022): area equipped for irrigation from Mehta et al. (2022) +# * (Mehta2024_Siebert2013): area equipped for irrigation from Mehta et al. (2024) using GMIA (Siebert et al, 2013) base map +# * (Mehta2024_Meier2018): are equipped for irrigation from Mehta et al. (2024) using Meier et al. (2018) base map cfg$gms$c41_initial_irrigation_area <- "LUH2v2" # def = LUH2v2 # * Sets the rate of depreciation of irrigation infrastructure in every timestep. @@ -1153,7 +1242,7 @@ cfg$gms$c42_env_flow_policy <- "off" # def = "off" # * 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 +cfg$gms$s42_efp_startyear <- 2025 # def = 2025 # * Target year (year when full protection is reached): cfg$gms$s42_efp_targetyear <- 2040 # def = 2040 @@ -1876,17 +1965,7 @@ cfg$gms$timber <- "default" # def = default # (implicitly assuming the same rate for plantation harvest and establishment). # * 1=on # * 0=off -cfg$gms$s73_timber_demand_switch <- 0 # def = 0 - -# Setting to define if the model should be forward looking or not in terms of -# seeing the future demand for current timestep establishment of new plantations -# in the forward setting, the model sees only current demand for establishment -# decisions in the historical time period but then sees future demand for non -# historic time periods. In myopic setting, the model sees always the current -# timber demand for establishment decisions. -# * 1 = forward looking. Model sees future demand for establishment in current step -# * 0 = myopic. Model sees current demand for establishment in current step -cfg$gms$s73_foresight <- 0 # def = 0 +cfg$gms$s73_timber_demand_switch <- 1 # def = 1 # harvesting cost per ton of dry matter produced (USD/tDM) s73_timber_prod_cost <- 2000 # def = 2000 @@ -1941,7 +2020,7 @@ cfg$gms$s73_expansion <- 0 # def = 0 cfg$gms$optimization <- "nlp_apr17" # def = nlp_apr17 # maximal number of solve iterations -cfg$gms$s80_maxiter <- 30 +cfg$gms$s80_maxiter <- 30 # def = 30 # Solver settings only for realization `lp_nlp_apr17`. All other realizations use `conopt4`. # * (conopt4): conopt4 @@ -2019,7 +2098,7 @@ cfg$files2export$start <- c("input/info.txt", "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/29_cropland/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", diff --git a/config/scenario_config.csv b/config/scenario_config.csv index 8f86e20357..8a2870327f 100755 --- a/config/scenario_config.csv +++ b/config/scenario_config.csv @@ -1,47 +1,56 @@ -;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;EL2_Diet;EL2_default;EL2_lessSus;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;NGFS_o_lowdem;GENIE_SCP +;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;EL2_PHD;EL2_Demand;EL2_default;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;NGFS_o_lowdem;GENIE_SCP +gms$c_timesteps;;;;;;;;;;;;;;;;;less_TS;less_TS;;;;;;;5year;5year;5year;5year;5year;;;;;;;;;;;;;;;;;;;;coup2110 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$c09_pal_scenario;;;;SSP1;SSP2;SSP2EU;SSP3;SSP4;SSP5;SSP1;SSP2;SSP1;SSP1;;;;;;;;;SDP;SDP;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;;; gms$s12_interest_lic;;;;;;;;;;;;;;;;;;;;;;0.06;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s12_interest_hic;;;;;;;;;;;;;;;;;;;;;;0.04;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c13_tccost;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;high +gms$c14_yields_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;;nocc +gms$food;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;anthropometrics_jan18 gms$c15_food_scenario;;;;SSP1;SSP2;SSP2;SSP3;SSP4;SSP5;SSP1;SSP2;SSP1;SSP1;;;;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;;SSP2; gms$c15_food_scenario_noselect;;;;;;;;;;;;;;;;;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;;SSP2; -gms$s15_elastic_demand;;;;0;0;0;0;0;0;0;0;0;0;;;;;;;0;0;0;;;0;0;0;0;0;;;;;;;;;;;;;;;;;;;; +gms$s15_elastic_demand;;;;0;0;0;0;0;0;0;0;0;0;;;;;;;0;0;0;0;;0;0;0;0;0;;;;;;;;;;;;;;;;;;;; gms$s15_rumdairy_scp_substitution;;;;0;0;0;0;0;0;0;0.5;0;0;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s15_food_subst_functional_form;;;;;;;;;;;2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s15_food_substitution_start;;;;;;;;;;;2020;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s15_food_substitution_target;;;;;;;;;;;2050;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$kfo_rd;;;;;;;;;;;livst_rum;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;livst_rum,livst_milk -gms$s15_exo_foodscen_convergence;;;;;;;;;;1;1;1;1;;;;;;;1;1;1;;;;1;;;1;;;;;;;;;;;;;;;;;;;1; -gms$s15_exo_foodscen_functional_form;;;;;;;;;;1;1;1;1;;;;;;;1;1;1;;;;1;;;1;;;;;;;;;;;;;;;;;;;1; -gms$s15_exo_foodscen_start;;;;;;;;;;2020;2020;2020;2020;;;;;;;2020;2020;2020;;;;2020;;;2020;;;;;;;;;;;;;;;;;;;2020; -gms$s15_exo_foodscen_target;;;;;;;;;;2050;2050;2050;2070;;;;;;;2050;2050;2050;;;;2050;;;2050;;;;;;;;;;;;;;;;;;;2050; -gms$s15_exo_waste;;;;0;0;0;0;0;0;1;1;1;1;;;;;;;1;0;1;;;0;1;0;0;1;0;0;1;1;;;;;;;;;;;;;;;1; -gms$s15_waste_scen;;;;;;;;;;1.2;1.3;1.2;1.25;;;;;;;1.2;1.2;1.2;;;;1.2;;;1.2;;;;;;;;;;;;;;;;;;;1.2; -gms$s15_exo_diet;;;;0;0;0;0;0;0;1;1;1;1;;;;;;;1;1;3;;;0;1;0;0;1;0;0;1;1;;;;;;;;;;;;;;;1; -gms$c15_kcal_scen;;;;;;;;;;healthy_BMI;no_underweight;healthy_BMI;healthy_BMI;;;;;;;healthy_BMI;healthy_BMI;healthy_BMI;;;;healthy_BMI;;;healthy_BMI;;;;;;;;;;;;;;;;;;;healthy_BMI; -gms$c15_EAT_scen;;;;;;;;;;FLX;;FLX;FLX;;;;;;;FLX;FLX;FLX;;;;FLX;;;FLX;;;;;;;;;;;;;;;;;;;; -gms$s15_exo_monogastric;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; -gms$s15_exo_ruminant;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; -gms$s15_exo_fish;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; -gms$s15_exo_fruitvegnut;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; -gms$s15_exo_roots;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; -gms$s15_exo_pulses;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; -gms$s15_exo_sugar;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; -gms$s15_exo_oils;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; -gms$s15_exo_brans;;;;;;;;;;1;0;1;1;;;;;;;1;1;0;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; -gms$s15_exo_scp;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; -gms$s15_exo_alcohol;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; -gms$s15_alc_scen;0.014;;;;;;;;;;;;;;;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_foodscen_convergence;;;;;;;;;;1;1;1;1;;;;;;;1;1;1;1;;;1;;;1;;;;;;;;;;;;;;;;;;;1; +gms$s15_exo_foodscen_functional_form;;;;;;;;;;1;1;1;1;;;;;;;1;1;1;1;;;1;;;1;;;;;;;;;;;;;;;;;;;1; +gms$s15_exo_foodscen_start;;;;;;;;;;2020;2020;2020;2020;;;;;;;2020;2025;2020;2020;;;2020;;;2020;;;;;;;;;;;;;;;;;;;2020; +gms$s15_exo_foodscen_target;;;;;;;;;;2050;2050;2050;2070;;;;;;;2050;2050;2050;2050;;;2050;;;2050;;;;;;;;;;;;;;;;;;;2050; +gms$s15_exo_waste;;;;0;0;0;0;0;0;1;1;1;1;;;;;;;1;0;1;1;;0;1;0;0;1;0;0;1;1;;;;;;;;;;;;;;;1; +gms$s15_waste_scen;;;;;;;;;;1.2;1.3;1.2;1.25;;;;;;;1.2;1.2;1.2;1.2;;;1.2;;;1.2;;;;;;;;;;;;;;;;;;;1.2; +gms$s15_exo_diet;;;;0;0;0;0;0;0;1;1;1;1;;;;;;;1;1;3;3;;0;1;0;0;1;0;0;1;1;;;;;;;;;;;;;;;1; +gms$c15_kcal_scen;;;;;;;;;;healthy_BMI;no_underweight;healthy_BMI;healthy_BMI;;;;;;;healthy_BMI;healthy_BMI;healthy_BMI;healthy_BMI;;;healthy_BMI;;;healthy_BMI;;;;;;;;;;;;;;;;;;;healthy_BMI; +gms$c15_EAT_scen;;;;;;;;;;FLX;;FLX;FLX;;;;;;;FLX;FLX;FLX;FLX;;;FLX;;;FLX;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_monogastric;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_ruminant;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_fish;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_fruitvegnut;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_roots;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_pulses;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_sugar;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_oils;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_brans;;;;;;;;;;1;0;1;1;;;;;;;1;1;0;0;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_scp;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_alcohol;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; +gms$s15_alc_scen;0.014;;;;;;;;;;;;;;;;;;;;;0;0;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c20_scp_type;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;hydrogen 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$s29_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$s29_snv_shr_noselect;;;;;;;;;;;;;;;;;;;;;;;;;0;0;0.2;0;0.2;;;;;;;;;;;;;;;;;;;; +gms$s29_snv_scenario_target;;;;;;;;;;;;;2030;;;;;;;;;;;;2030;2030;2030;2030;2030;;;;;;;;;;;;;;;;;;;; gms$c30_bioen_water;;;;rainfed;rainfed;rainfed;rainfed;rainfed;rainfed;rainfed;all;rainfed;rainfed;;;;;;;rainfed;;;rainfed;all;;;;;;;;;;;;;;;;;;;;;;;;; -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$s30_annual_max_growth;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0.02 gms$c31_grassl_yld_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -gms$s32_aff_plantation;;;;0;0;0;0;0;0;0;1;0;0;;;;;;;0;;;0;1;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c32_shock_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;none;002lin2030;004lin2030;008lin2030;016lin2030;;;;;;;; +gms$s32_initial_distribution;;;;;;;;;;;;;;;;;;;;;;;;;1;1;1;1;1;;;;;1;1;0;;;;;;;;;;;;; +gms$s32_hvarea;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;1;0;;;;;;;;;;;;; +gms$s32_aff_plantation;;;;0;0;0;0;0;0;0;1;0;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;;;;;;;;;;;;;;;;;;;; @@ -50,55 +59,47 @@ 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$c35_pot_forest_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;; gms$s35_forest_damage_end;;;;2030;2050;2050;2050;2050;2030;2030;2030;2030;2030;;;;;;;2030;;;;;2030;2030;2030;2030;2030;;;;;;;;;;;;;;;;;;;; +gms$c35_shock_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;none;002lin2030;004lin2030;008lin2030;016lin2030;;;;;;;; +gms$s35_forest_damage;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4;4;4;4;4;;;;;;;; +gms$s35_secdf_distribution;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;2;0;;;;;;;;;;;;; +gms$s35_hvarea;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;2;0;;;;;;;;;;;;; +gms$factor_costs;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sticky_feb18 +gms$c42_watdem_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;; 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$c43_watavail_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;; gms$s44_target_price;;;;0;0;0;0;0;0;0;0;0;0;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$s44_cost_bii_missing;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10000000 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$c52_carbon_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;; +gms$c52_land_carbon_sink_rcp;;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;RCP19;RCP26;RCP45;RCP60;RCPBU;RCPBU;; 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;;;;none;none;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;;;R32M46-SSP2EU-NPi -gms$c56_pollutant_prices_noselect;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;none;none;R21M42-SDP-NPi;R21M42-SDP-NPi;R21M42-SDP-NPi;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;;;R32M46-SSP2EU-NPi +gms$c56_pollutant_prices;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;;none;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;;;R32M46-SSP2EU-NPi +gms$c56_pollutant_prices_noselect;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;;none;R21M42-SDP-NPi;R21M42-SDP-NPi;R21M42-SDP-NPi;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;;;R32M46-SSP2EU-NPi gms$s56_c_price_exp_aff;;;;50;50;50;50;50;50;50;30;50;50;;;;;;;50;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s56_buffer_aff;;;;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.2;0.3;;;;;;;0.5;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -gms$c56_emis_policy;;;;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;redd_nosoil;all_nosoil;;;;;;;reddnatveg_nosoil;;;none;none;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c56_emis_policy;;;;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;redd_nosoil;all_nosoil;;;;;;;reddnatveg_nosoil;;;;none;;;;;;;;;;;;;;;;;;;;;;;;; gms$s56_minimum_cprice;;;;;;;;;;;;;;0;0;18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c56_mute_ghgprices_until;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;y2020 +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;;;;;;;;;;;;;;;; +gms$c59_som_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;; gms$maccs;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -gms$c60_2ndgen_biodem;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;none;none;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;;;R32M46-SSP2EU-NPi -gms$c60_2ndgen_biodem_noselect;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;none;none;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;;;R32M46-SSP2EU-NPi +gms$bioenergy;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1st2ndgen_priced_feb24 +gms$c60_2ndgen_biodem;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;;none;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;;;R32M46-SSP2EU-NPi +gms$c60_2ndgen_biodem_noselect;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;;none;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;;;R32M46-SSP2EU-NPi gms$c60_1stgen_biodem;;;;phaseout2020;const2020;const2020;const2030;const2020;phaseout2020;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;;ssp1;;;ssp4;ssp1;ssp4;ssp4;ssp1;;;;;;;;;;;;;;;;;;;; -gms$c_timesteps;;;;;;;;;;;;;;;;;less_TS;less_TS;;;;;;;5year;5year;5year;5year;5year;;;;;;;;;;;;;;;;;;;;coup2110 -gms$c14_yields_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;;nocc -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;;;;;;;;;;;;;;;;;;;; -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;;;;;;;;;;;;;;;;;;;;;;;;;0;0;0;0;0;;;;;0;0;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.105_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.105_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.105_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.105_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.105_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.105_h12_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;; -gms$c52_land_carbon_sink_rcp;;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;; -magicc_emis_scen;;;;;;;;;;;;;;;;;;;;;;SSP2EU-DSPkB500-DS_betax.mif;SSP2EU-DSPkB500-DS_betax.mif;SSP2EU-DSPkB500-DS_betax.mif;;;;;;;;;;;;;;;;;;;;;;;;; -gms$c13_tccost;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;high -gms$food;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;anthropometrics_jan18 -gms$c20_scp_type;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;hydrogen -gms$s30_annual_max_growth;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0.02 -gms$s44_cost_bii_missing;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10000000 -gms$c56_mute_ghgprices_until;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;y2020 -gms$bioenergy;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1st2ndgen_priced_feb24 -gms$factor_costs;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sticky_feb18 +input['cellular'];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.109_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.109_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.109_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.109_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.109_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.109_h12_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;; +magicc_emis_scen;;;;;;;;;;;;;;;;;;;;;;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/config/scenario_fsec.csv b/config/scenario_fsec.csv index 1ef7d7cb66..9bf407fa60 100644 --- a/config/scenario_fsec.csv +++ b/config/scenario_fsec.csv @@ -26,13 +26,15 @@ gms$c15_food_scenario;;;SSP1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c21_trade_liberalization;;;;;;;;;;;;;;;;;;;;;;;l908080r807070;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s21_trade_bal_damper;0.65;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c22_protect_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;BH_IFL;;;;;;;;;;;;;;;;;;;;;; -gms$crop;penalty_apr22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -gms$c30_rotation_scenario;default;;;;;;;;;;;;;;;;;;;;;;;;;;;agroecology;;;;;;;;;;;;;;;;;;;;;;; +gms$croparea;detail_apr24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c30_rotation_rules;FSEC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c30_rotation_incentives;default;;;;;;;;;;;;;;;;;;;;;;;;;;;agroecology;;;;;;;;;;;;;;;;;;;;;;; +gms$s30_implementation;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s30_rotation_scenario_target;2050;;;;;;;;;;;;;;;;;;;;;;;;;;;2050;;;;;;;;;;;;;;;;;;;;;;; -gms$c30_marginal_land;q33_marginal;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c29_marginal_land;q33_marginal;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c30_bioen_water;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rainfed;;;;;;;;;;;;;;;;;;;;; -gms$s30_snv_scenario_target;;;;;;;;;;;;;;;;;;;;;;;;;;;2050;;;;;;;;;;;;;;;;;;;;;;;; -gms$s30_snv_shr;;;;;;;;;;;;;;;;;;;;;;;;;;;0.2;;;;;;;;;;;;;;;;;;;;;;;; +gms$s29_snv_scenario_target;;;;;;;;;;;;;;;;;;;;;;;;;;;2050;;;;;;;;;;;;;;;;;;;;;;;; +gms$s29_snv_shr;;;;;;;;;;;;;;;;;;;;;;;;;;;0.2;;;;;;;;;;;;;;;;;;;;;;;; gms$past;endo_jun13;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c32_aff_policy;ndc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c32_aff_mask;;;;;;;;;;;;;;;;;;;;;;;;;onlytropical;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -50,7 +52,7 @@ 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_startyear;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2025;;;;;;;;;;;;;;;;;;;;; gms$s42_efp_targetyear;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2050;;;;;;;;;;;;;;;;;;;;; gms$s44_bii_lower_bound;;;;;;;;;;;;;;;;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c44_bii_decrease;;;;;;;;;;;;;;;;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -74,9 +76,9 @@ 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.105_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.105_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.105_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.105_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.105_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.105_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.105_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;;; -input['regional'];rev4.105_FSEC_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -input['validation'];rev4.105_FSEC_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -input['additional'];additional_data_rev4.48.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['cellular'];rev4.109_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.109_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.109_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.109_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.109_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.109_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.109_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;;; +input['regional'];rev4.109_FSEC_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['validation'];rev4.109_FSEC_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['additional'];additional_data_rev4.51.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; input['calibration'];calibration_FSEC_26Mar24.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; magicc_emis_scen;bjoernAR6_C_SSP2-NDC.mif;;;bjoernAR6_C_SSP2-PkBudg900.mif;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;bjoernAR6_C_SSP1-NDC.mif;;;;;;;;;;;;bjoernAR6_C_RemSDP-900-MagSSP1.mif;; diff --git a/core/macros.gms b/core/macros.gms index 0103e94c73..b2304979ef 100644 --- a/core/macros.gms +++ b/core/macros.gms @@ -8,8 +8,9 @@ *****************************Technical macros*********************************** * Macro for fixing a variable in the case that lower and upper bound are too -* close to each other (closer than argument "sens") -* EXAMPLE: ma_boundfix(vm_land,(j,"ifft"),up,10e-5); +* close to each other (closer than argument "sens"). +* "arg" specifies the set for fixing. "sufx" specifies to what value the variable should be fixed ("l","lo","up"). +* EXAMPLE: m_boundfix(vm_land,(j,"ifft"),up,1e-6); $macro m_boundfix(x,arg,sufx,sens) x.fx arg$(x.up arg-x.lo arg0) + 0$(sum(s,w)<=0); @@ -97,12 +98,12 @@ $macro m_linear_cell_data_interpol(output,x,input_x1,input_x2,input_y1,input_y2) * 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")); + (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")); + sum((&&sets_sub), land(j2,&&sets_sub) * sum(ct, carbon_density(ct,j2,&&sets_sub,ag_pools)))$(sameas(stockType,"actualNoAcEst")) * macros for peatland module $macro m58_LandMerge(land,landForestry,set) \ diff --git a/core/sets.gms b/core/sets.gms index 7850c15c4c..d68a6b0774 100644 --- a/core/sets.gms +++ b/core/sets.gms @@ -242,20 +242,23 @@ sets wat_dem Water demand sectors / agriculture, domestic, manufacturing, electricity, ecosystem / ***LAND POOLS*** - land Land pools + land Land pools / crop, past, forestry, primforest, secdforest, urban, other / land_ag(land) Agricultural land pools - / crop, past / + / crop, past / - forest_land(land) land from which timber can be taken away - / forestry, primforest, secdforest,other / + land_timber(land) land from which timber can be taken away + / forestry, primforest, secdforest, other / - land_natveg(forest_land) Natural vegetation land pools + land_forest(land_timber) Forested land pools + / forestry, primforest, secdforest / + + land_natveg(land_timber) Natural vegetation land pools / primforest, secdforest, other / forest_type forest type - / plantations, natveg / + / plantations, natveg / ***Forestry** ac Age classes / ac0,ac5,ac10,ac15,ac20,ac25,ac30,ac35,ac40,ac45,ac50, diff --git a/literature.bib b/literature.bib index d4ee7ea751..7f64577c5a 100644 --- a/literature.bib +++ b/literature.bib @@ -1023,6 +1023,39 @@ @article{siebert_FAO_2007 year = {2007}, } +@article{siebert_FAO_2007, + author = {Stefan Siebert and Petra Döll and Sebastian Feick and Jippe Hoogeveen and Karen Frenken}, + year = {2007}, + 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}, +} + +@article{siebert_FAO_2013, + author = {Stefan Siebert, Verena Henrich, Karen Frenken and Jacob Burk}, + year = {2013}, + title = {Global Map of Irrigation Areas version 5}, + journal = {Rheinische Friedrich-Wilhelms-University, Bonn, Germany / Food and Agriculture Organization of the United Nations, Rome, Italy}, + url = {https://data.apps.fao.org/catalog/iso/f79213a0-88fd-11da-a88f-000d939bc5d8}, +} + +@article{meier_global_2018, + author = {Meier, Jonas; Zabel, Florian; Mauser, Wolfram}, + year = {2018}, + title = {Global Irrigated Areas dataset}, + journal = {PANGAEA}, + doi = {https://doi.org/10.1594/PANGAEA.884744}, + url = {https://doi.pangaea.de/10.1594/PANGAEA.884744}, +} + +@article{mehta_half_2024, + author = {Mehta, P., Siebert, S., Kummu, M. et al.}, + year = {2024}, + title = {Half of twenty-first century global irrigation expansion has been in water-stressed regions}, + journal = {Nature Water}, + doi = {https://doi.org/10.1038/s44221-024-00206-9}, +} + @book{fao_aquastat_2016, address = {Rome}, title = {{AQUASTAT} core database}, @@ -1030,7 +1063,7 @@ @book{fao_aquastat_2016 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} + note = {Database accessed on 2023/02/06}, } @techreport{worldbank_irrigation_1995, diff --git a/main.gms b/main.gms index e4c5470725..b3dc7e93f8 100644 --- a/main.gms +++ b/main.gms @@ -147,44 +147,45 @@ $title magpie *' * Always try to access model outputs through the corresponding magpie package instead of accessing them directly with readGDX. It cannot be guaranteed that your script will work in the future if you do otherwise (as only the corresponding magpie package will be continuously adapted to changes in the GAMS code). *##################### R SECTION START (VERSION INFO) ########################## -* -* Used data set: rev4.104_h12_magpie.tgz +* +* Used data set: rev4.109_h12_magpie.tgz * md5sum: NA * Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output -* -* Used data set: rev4.104_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz +* +* Used data set: rev4.109_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz * md5sum: NA * Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output -* -* Used data set: rev4.104_h12_validation.tgz +* +* Used data set: rev4.109_h12_validation.tgz * md5sum: NA * Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output -* -* Used data set: additional_data_rev4.48.tgz +* +* Used data set: additional_data_rev4.50.tgz * md5sum: NA -* Repository: scp://cluster.pik-potsdam.de/p/projects/landuse/data/input/archive -* +* Repository: https://rse.pik-potsdam.de/data/magpie/public + +* * Used data set: calibration_H12_26Mar24.tgz * md5sum: NA * Repository: https://rse.pik-potsdam.de/data/magpie/public -* +* * Low resolution: c200 * High resolution: 0.5 -* +* * Total number of cells: 200 -* +* * Number of cells per region: * CAZ CHA EUR IND JPN LAM MEA NEU OAS REF SSA USA * 14 23 10 7 4 26 21 9 16 23 32 15 -* +* * Regionscode: 62eff8f7 -* -* Regions data revision: 4.104 -* +* +* Regions data revision: 4.109 +* * lpj2magpie settings: * * LPJmL data: MRI-ESM2-0:ssp370 -* * Revision: 4.104 -* +* * Revision: 4.109 +* * aggregation settings: * * Input resolution: 0.5 * * Output resolution: c200 @@ -193,10 +194,11 @@ $title magpie * CAZ CHA EUR IND JPN LAM MEA NEU OAS REF SSA USA * 14 23 10 7 4 26 21 9 16 23 32 15 * * Call: withCallingHandlers(expr, message = messageHandler, warning = warningHandler, error = errorHandler) -* -* -* Last modification (input data): Wed May 8 14:54:42 2024 -* +* +* +* Last modification (input data): Tue Jun 18 09:52:31 2024 + +* *###################### R SECTION END (VERSION INFO) ########################### $offupper @@ -249,13 +251,14 @@ $setglobal land_conservation area_based_apr22 $setglobal ageclass feb21 -$setglobal crop endo_apr21 +$setglobal cropland simple_apr24 +$setglobal croparea simple_apr24 $setglobal past endo_jun13 -$setglobal forestry dynamic_feb21 +$setglobal forestry dynamic_may24 $setglobal urban exo_nov21 -$setglobal natveg dynamic_feb21 +$setglobal natveg pot_forest_may24 $setglobal employment exo_may22 $setglobal labor_prod off diff --git a/modules/09_drivers/aug17/declarations.gms b/modules/09_drivers/aug17/declarations.gms index ac0ea2b3e5..004c7bc854 100644 --- a/modules/09_drivers/aug17/declarations.gms +++ b/modules/09_drivers/aug17/declarations.gms @@ -33,7 +33,4 @@ parameters 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 6266da6fe6..627d78607b 100644 --- a/modules/09_drivers/aug17/input.gms +++ b/modules/09_drivers/aug17/input.gms @@ -17,6 +17,11 @@ $setglobal c09_pal_scenario SSP2 * options: SSP: "SSP1", "SSP2", "SSP3", "SSP4", "SSP5", "SSP2EU" * SDP: "SDP", "SDP_EI", "SDP_MC", "SDP_RC" +parameters +* Years where SSPs and nocc/cc scenarios diverge + sm_fix_SSP2 year until which all parameters are fixed to SSP2 values (year) / 2025 / + sm_fix_cc year until which all parameters affected by cc are fixed to historical values (year) / 2025 / +; table f09_gdp_ppp_iso(t_all,iso,pop_gdp_scen09) Income in purchasing power parity (mio. USD05PPP per yr) $ondelim diff --git a/modules/10_land/landmatrix_dec18/declarations.gms b/modules/10_land/landmatrix_dec18/declarations.gms index 003b3b9046..8a7737a301 100644 --- a/modules/10_land/landmatrix_dec18/declarations.gms +++ b/modules/10_land/landmatrix_dec18/declarations.gms @@ -7,6 +7,7 @@ parameters pm_land_start(j,land) Land initialization area (mio. ha) + pm_land_hist(t_ini10,j,land) Land area for historial time steps (mio. ha) pcm_land(j,land) Land area in previous time step including possible changes after optimization (mio. ha) ; diff --git a/modules/10_land/landmatrix_dec18/input.gms b/modules/10_land/landmatrix_dec18/input.gms index 628fefa710..092ae72b41 100644 --- a/modules/10_land/landmatrix_dec18/input.gms +++ b/modules/10_land/landmatrix_dec18/input.gms @@ -14,6 +14,11 @@ $ondelim $include "./modules/10_land/input/avl_land_t.cs3" $offdelim ; +*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! +f10_land(t_ini10,j,land)$(f10_land(t_ini10,j,land)<0) = 0; + table fm_luh2_side_layers(j,luh2_side_layers10) luh2 side layers (grid cell share) $ondelim diff --git a/modules/10_land/landmatrix_dec18/presolve.gms b/modules/10_land/landmatrix_dec18/presolve.gms index edee5163dc..5a79286fe5 100644 --- a/modules/10_land/landmatrix_dec18/presolve.gms +++ b/modules/10_land/landmatrix_dec18/presolve.gms @@ -22,4 +22,4 @@ vm_lu_transitions.up(j,"primforest","primforest") = Inf; *' @stop -m_boundfix(vm_land,(j,land),up,10e-5); +m_boundfix(vm_land,(j,land),up,1e-6); diff --git a/modules/10_land/landmatrix_dec18/start.gms b/modules/10_land/landmatrix_dec18/start.gms index 0dc09b22b2..b8d25847d5 100644 --- a/modules/10_land/landmatrix_dec18/start.gms +++ b/modules/10_land/landmatrix_dec18/start.gms @@ -5,11 +5,8 @@ *** | 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; +pm_land_hist(t_ini10,j,land) = f10_land(t_ini10,j,land); pcm_land(j,land) = pm_land_start(j,land); vm_land.l(j,land) = pcm_land(j,land); diff --git a/modules/11_costs/default/equations.gms b/modules/11_costs/default/equations.gms index 92ad7e32eb..c3d758a20d 100644 --- a/modules/11_costs/default/equations.gms +++ b/modules/11_costs/default/equations.gms @@ -37,6 +37,7 @@ + vm_costs_additional_mon(i2) + sum(cell(i2,j2),vm_cost_land_transition(j2)) + sum(cell(i2,j2), vm_peatland_cost(j2)) + + sum(cell(i2,j2), vm_cost_cropland(j2)) + 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)) diff --git a/modules/14_yields/managementcalib_aug19/declarations.gms b/modules/14_yields/managementcalib_aug19/declarations.gms index 68eaecbcaf..22aa3f5eda 100644 --- a/modules/14_yields/managementcalib_aug19/declarations.gms +++ b/modules/14_yields/managementcalib_aug19/declarations.gms @@ -14,10 +14,7 @@ parameters 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_timber_yield(t,j,ac,land_timber) Forest growing stock (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) diff --git a/modules/14_yields/managementcalib_aug19/input.gms b/modules/14_yields/managementcalib_aug19/input.gms index 4677381139..da314b8bd6 100644 --- a/modules/14_yields/managementcalib_aug19/input.gms +++ b/modules/14_yields/managementcalib_aug19/input.gms @@ -18,7 +18,7 @@ scalar s14_degradation Switch to include yield impacts of land degradation(0=n scalar s14_use_yield_calib Switch for using or not using yield calibration factors from the preprocessing (1=use facs 0=not use facs) / 0 /; -scalar s14_minimum_wood_yield Minimum wood yield for timber harvest in natural vegetation (tDM per ha per yr) / 20 /; +scalar s14_minimum_wood_yield Minimum wood yield for timber harvest in natural vegetation (tDM per ha per yr) / 10 /; scalars s14_yld_past_switch Spillover parameter for translating technological change in the crop sector into pasture yield increases (1) / 0.25 / @@ -26,7 +26,6 @@ scalars ; 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/ ; @@ -77,7 +76,7 @@ $include "./modules/14_yields/input/f14_ipcc_bce.cs3" $offdelim ; -parameter f14_aboveground_fraction(forest_land) Root to shoot ratio (1) +parameter f14_aboveground_fraction(land_timber) Root to shoot ratio (1) / $ondelim $include "./modules/14_yields/input/f14_aboveground_fraction.csv" diff --git a/modules/14_yields/managementcalib_aug19/preloop.gms b/modules/14_yields/managementcalib_aug19/preloop.gms index a23737fd6e..dcbb8453c0 100644 --- a/modules/14_yields/managementcalib_aug19/preloop.gms +++ b/modules/14_yields/managementcalib_aug19/preloop.gms @@ -59,9 +59,9 @@ i14_croparea_total(t_all,w,j) = sum(kcr, fm_croparea(t_all,j,w,kcr)); 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), fm_croparea(t_past,j,w,knbe14)))$(sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14))>0.00001) + (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); + 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.00001); *' The factor `i14_lambda_yields` is calculated for the initial time step depending @@ -127,9 +127,9 @@ if ((s14_calib_ir2rf = 1), * 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), fm_croparea("y1995",j,w,knbe14)))$(sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14))>0.00001) + (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); + sum((cell(i,j),w), i14_croparea_total("y1995",w,j)))$(sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14))<0.00001); i14_yields_calib(t,j,knbe14,w) = sum((cell(i,j)), i14_fao_yields_hist("y1995",i,knbe14) / i14_modeled_yields_hist2(i,knbe14)) * @@ -146,11 +146,11 @@ if ((s14_calib_ir2rf = 1), *' @code *' Calibrated yields can additionally be 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 in some cases +*' yields are outlier corrected, historical production and croparea can in some cases *' be better represented with this additional correction: -* set yield calib factors to 1 in case of no use of yield calibration factors (s14_use_yield_calib = 0) -* or missing input file +* set yield calib factors to 1 in case of no use of yield calibration factors (s14_use_yield_calib = 0) +* or missing input file if(s14_use_yield_calib = 0 OR sum((i,ltype14),f14_yld_calib(i,ltype14)) = 0, f14_yld_calib(i,ltype14) = 1; ); @@ -184,37 +184,3 @@ if ((s14_degradation = 1), ); *' @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/managementcalib_aug19/presolve.gms b/modules/14_yields/managementcalib_aug19/presolve.gms index e9b652f06c..ca1189f665 100644 --- a/modules/14_yields/managementcalib_aug19/presolve.gms +++ b/modules/14_yields/managementcalib_aug19/presolve.gms @@ -11,7 +11,7 @@ *** YIELDS -*` `pm_carbon_density_ac_forestry` for vegetation Carbon is above- and belowground +*` `pm_carbon_density_plantation_ac` 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 aboveground biomass information, therefore we multiply with @@ -20,36 +20,46 @@ *' biomass in tDM/ha. *` @code -p14_growing_stock(t,j,ac,"forestry","plantations") = + +pm_timber_yield(t,j,ac,"forestry") = ( - pm_carbon_density_ac_forestry(t,j,ac,"vegc") - / s14_carbon_fraction - * f14_aboveground_fraction("forestry") - / sum(clcl, pm_climate_class(j,clcl) * f14_ipcc_bce(clcl,"plantations")) - ) + pm_carbon_density_plantation_ac(t,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(t,j,ac,land_natveg,"natveg") = +pm_timber_yield(t,j,ac,"primforest") = ( - pm_carbon_density_ac(t,j,ac,"vegc") + fm_carbon_density(t,j,"primforest","vegc") / s14_carbon_fraction - * f14_aboveground_fraction(land_natveg) + * f14_aboveground_fraction("primforest") / sum(clcl, pm_climate_class(j,clcl) * f14_ipcc_bce(clcl,"natveg")) ) ; -*` @stop -**** Hard constraint to always have a positive number in p14_growing_stock -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); +pm_timber_yield(t,j,ac,"secdforest") = + ( + pm_carbon_density_secdforest_ac(t,j,ac,"vegc") + / s14_carbon_fraction + * f14_aboveground_fraction("secdforest") + / sum(clcl, pm_climate_class(j,clcl) * f14_ipcc_bce(clcl,"natveg")) + ) + ; + +pm_timber_yield(t,j,ac,"other") = + ( + pm_carbon_density_other_ac(t,j,ac,"vegc") + / s14_carbon_fraction + * f14_aboveground_fraction("other") + / sum(clcl, pm_climate_class(j,clcl) * f14_ipcc_bce(clcl,"natveg")) + ) + ; + +*` @stop -** Used in equations -- Annual value hence division by timestep -*************************************************************** -** 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"); +** Hard constraint to always have a positive number in pm_timber_yield +pm_timber_yield(t,j,ac,land_timber) = pm_timber_yield(t,j,ac,land_timber)$(pm_timber_yield(t,j,ac,land_timber) > 0) + 0.0001$(pm_timber_yield(t,j,ac,land_timber) = 0); ** Put yields to 0 where they dont exceed a minimum yield for harvest pm_timber_yield(t,j,ac,land_natveg)$(pm_timber_yield(t,j,ac,land_natveg) < s14_minimum_wood_yield) = 0; -** If the plantation yield switch is off, then the forestry yields are given the same values as secdforest yields, -pm_timber_yield(t,j,ac,"forestry")$(s14_timber_plantation_yield = 0) = pm_timber_yield(t,j,ac,"secdforest"); diff --git a/modules/16_demand/sector_may15/equations.gms b/modules/16_demand/sector_may15/equations.gms index 7ae902205a..b5bab81189 100644 --- a/modules/16_demand/sector_may15/equations.gms +++ b/modules/16_demand/sector_may15/equations.gms @@ -84,5 +84,5 @@ q16_seed_demand(i2,kcr) .. q16_supply_forestry(i2,kforestry) .. vm_supply(i2,kforestry) =e= - sum(ct,pm_demand_ext(ct,i2,kforestry)) + vm_dem_material(i2,kforestry) ; diff --git a/modules/16_demand/sector_may15/sets.gms b/modules/16_demand/sector_may15/sets.gms index bca7e9f565..1e31617a36 100644 --- a/modules/16_demand/sector_may15/sets.gms +++ b/modules/16_demand/sector_may15/sets.gms @@ -30,3 +30,4 @@ sets ; alias(kap,kap4); +alias(kforestry,kforestry2); diff --git a/modules/21_trade/exo/declarations.gms b/modules/21_trade/exo/declarations.gms index 43eec6aa8c..67b0151950 100644 --- a/modules/21_trade/exo/declarations.gms +++ b/modules/21_trade/exo/declarations.gms @@ -5,24 +5,17 @@ *** | 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(h,kall) Last resort resource for otherwise infeasible trade balance constraints (mio. tDM per yr) ; equations 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,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) + ov_cost_trade(t,i,type) Regional trade costs (mio. USD05MER 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/exo/equations.gms b/modules/21_trade/exo/equations.gms index 22a59aeb61..d84819634e 100644 --- a/modules/21_trade/exo/equations.gms +++ b/modules/21_trade/exo/equations.gms @@ -5,22 +5,9 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de +*' The regional production must be larger than the regional demand plus exports +*' from that region (or minus imports in case of a negative trade balance). + 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 -*' the trade balance in this realization is exogenously defined there is the -*' imminent risk of infeasibilities. To get results even in case of infeasble -*' trade balance conditions `v21_manna_from_heaven` is introduced. It is an -*' 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(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 -*' between model simulation and exogenously provided trade balances. + + sum(ct,f21_trade_balance(ct,h2,kall)); diff --git a/modules/21_trade/exo/input.gms b/modules/21_trade/exo/input.gms index d79312c2cf..3ae07b84d6 100644 --- a/modules/21_trade/exo/input.gms +++ b/modules/21_trade/exo/input.gms @@ -5,16 +5,7 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -scalars - s21_manna_from_heaven v21_manna_from_heaven fixed to zero (0) or available at high cost (1) (binary) / 0 / -; - 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/postsolve.gms b/modules/21_trade/exo/postsolve.gms index 38495b7f8e..78358260dc 100644 --- a/modules/21_trade/exo/postsolve.gms +++ b/modules/21_trade/exo/postsolve.gms @@ -7,20 +7,12 @@ *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_cost_trade(t,i,"marginal") = vm_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,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,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,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); + ov_cost_trade(t,i,"marginal") = vm_cost_trade.m(i); + 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,h,kall,"level") = q21_notrade.l(h,kall); + ov_cost_trade(t,i,"upper") = vm_cost_trade.up(i); + 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,h,kall,"lower") = q21_notrade.lo(h,kall); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/21_trade/exo/preloop.gms b/modules/21_trade/exo/preloop.gms index 81d5fcb68e..88e0dbf793 100644 --- a/modules/21_trade/exo/preloop.gms +++ b/modules/21_trade/exo/preloop.gms @@ -5,9 +5,4 @@ *** | 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); - -** fix to zero by default -v21_manna_from_heaven.fx(h,kall)$(s21_manna_from_heaven = 0) = 0; +vm_cost_trade.fx(i) = 0; diff --git a/modules/21_trade/free_apr16/declarations.gms b/modules/21_trade/free_apr16/declarations.gms index f93d7f3b8b..811b4f5676 100644 --- a/modules/21_trade/free_apr16/declarations.gms +++ b/modules/21_trade/free_apr16/declarations.gms @@ -9,7 +9,6 @@ parameters i21_trade_bal_reduction(t_all,k_trade) Trade balance reduction (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 diff --git a/modules/21_trade/free_apr16/preloop.gms b/modules/21_trade/free_apr16/preloop.gms index bfc429a3eb..11b775455d 100644 --- a/modules/21_trade/free_apr16/preloop.gms +++ b/modules/21_trade/free_apr16/preloop.gms @@ -5,10 +5,5 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de - - *set vm_cost_trade zero in order to avoid a free variable vm_cost_trade.fx(i) = 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); diff --git a/modules/21_trade/module.gms b/modules/21_trade/module.gms index f50e59d819..c38f8d8d64 100644 --- a/modules/21_trade/module.gms +++ b/modules/21_trade/module.gms @@ -7,7 +7,7 @@ *' @title Agricultural trade *' -*' @description This module represents agricutlural trade among world regions. +*' @description This module represents agricultural trade among world regions. *' It ensures that the regional demand is met by domestic production and imports from other regions. *' The global trade balance dictates that global production must be larger than or equal to global demand. *' For non-traded goods, the regional production must be larger than or equal to regional demand. diff --git a/modules/21_trade/off/declarations.gms b/modules/21_trade/off/declarations.gms index f4eb5cb097..5488673ee2 100644 --- a/modules/21_trade/off/declarations.gms +++ b/modules/21_trade/off/declarations.gms @@ -5,10 +5,6 @@ *** | 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) ; diff --git a/modules/21_trade/off/preloop.gms b/modules/21_trade/off/preloop.gms index 0441d70f3d..11b775455d 100644 --- a/modules/21_trade/off/preloop.gms +++ b/modules/21_trade/off/preloop.gms @@ -5,9 +5,5 @@ *** | 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/selfsuff_reduced/declarations.gms b/modules/21_trade/selfsuff_reduced/declarations.gms index f6ccffef43..59bc20b4d9 100644 --- a/modules/21_trade/selfsuff_reduced/declarations.gms +++ b/modules/21_trade/selfsuff_reduced/declarations.gms @@ -9,7 +9,6 @@ parameters i21_trade_bal_reduction(t_all,k_trade) Trade balance reduction (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 diff --git a/modules/21_trade/selfsuff_reduced/input.gms b/modules/21_trade/selfsuff_reduced/input.gms index e8e98ff152..19a8d28d00 100644 --- a/modules/21_trade/selfsuff_reduced/input.gms +++ b/modules/21_trade/selfsuff_reduced/input.gms @@ -16,6 +16,7 @@ sets scalars s21_trade_tariff Trade tariff switch (1=on 0=off) (1) / 1 / s21_cost_import Cost for additional imports to maintain feasibility (USD05MER per tDM) / 10000 / + s21_min_trade_margin_forestry Minimum trade margin for forestry products (USD05MER per tDM) / 50 / ; table f21_trade_bal_reduction(t_all,trade_groups21,trade_regime21) Share of inelastic trade pool (1) diff --git a/modules/21_trade/selfsuff_reduced/preloop.gms b/modules/21_trade/selfsuff_reduced/preloop.gms index 9a91265c27..7a04513e1b 100644 --- a/modules/21_trade/selfsuff_reduced/preloop.gms +++ b/modules/21_trade/selfsuff_reduced/preloop.gms @@ -16,10 +16,8 @@ elseif (s21_trade_tariff=0), i21_trade_tariff(h,k_trade) = 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); +i21_trade_margin(h,"wood")$(i21_trade_margin(h,"wood") < s21_min_trade_margin_forestry) = s21_min_trade_margin_forestry; +i21_trade_margin(h,"woodfuel")$(i21_trade_margin(h,"woodfuel") < s21_min_trade_margin_forestry) = s21_min_trade_margin_forestry; v21_import_for_feasibility.fx(h,k_trade) = 0; v21_import_for_feasibility.lo(h,k_import21) = 0; diff --git a/modules/21_trade/selfsuff_reduced_bilateral22/declarations.gms b/modules/21_trade/selfsuff_reduced_bilateral22/declarations.gms index 02c0278f0c..52bfeefb13 100644 --- a/modules/21_trade/selfsuff_reduced_bilateral22/declarations.gms +++ b/modules/21_trade/selfsuff_reduced_bilateral22/declarations.gms @@ -9,7 +9,6 @@ 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 diff --git a/modules/21_trade/selfsuff_reduced_bilateral22/equations.gms b/modules/21_trade/selfsuff_reduced_bilateral22/equations.gms index 09bc08180c..4e25b7c5ce 100644 --- a/modules/21_trade/selfsuff_reduced_bilateral22/equations.gms +++ b/modules/21_trade/selfsuff_reduced_bilateral22/equations.gms @@ -37,8 +37,9 @@ q21_trade_bilat(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)) - v21_import_for_feasibility(h2,k_trade)) - $(sum(ct,f21_self_suff(ct,h2,k_trade) < 1)); + *sum(ct,i21_trade_bal_reduction(ct,k_trade))) + $(sum(ct,f21_self_suff(ct,h2,k_trade) < 1)) + - v21_import_for_feasibility(h2,k_trade); *' Upper bound for production. diff --git a/modules/21_trade/selfsuff_reduced_bilateral22/input.gms b/modules/21_trade/selfsuff_reduced_bilateral22/input.gms index 75dc72a26f..e73d9007a3 100644 --- a/modules/21_trade/selfsuff_reduced_bilateral22/input.gms +++ b/modules/21_trade/selfsuff_reduced_bilateral22/input.gms @@ -16,9 +16,10 @@ sets 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_startyear year to start fading out trade tariffs / 2025 / s21_trade_tariff_targetyear year to finish fading out trade tariffs / 2050 / s21_cost_import Cost for additional imports to maintain feasibility (USD05MER per tDM) / 10000 / + s21_min_trade_margin_forestry Minimum trade margin for forestry products (USD05MER per tDM) / 50 / ; table f21_trade_bal_reduction(t_all,trade_groups21,trade_regime21) Share of inelastic trade pool (1) diff --git a/modules/21_trade/selfsuff_reduced_bilateral22/preloop.gms b/modules/21_trade/selfsuff_reduced_bilateral22/preloop.gms index 7a27f3c715..9f56067666 100644 --- a/modules/21_trade/selfsuff_reduced_bilateral22/preloop.gms +++ b/modules/21_trade/selfsuff_reduced_bilateral22/preloop.gms @@ -26,10 +26,8 @@ i21_trade_tariff(t_all,i_ex,i_im,k_trade)$(m_year(t_all) >= s21_trade_tariff_tar ); ); -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); +i21_trade_margin(h,"wood")$(i21_trade_margin(h,"wood") < s21_min_trade_margin_forestry) = s21_min_trade_margin_forestry; +i21_trade_margin(h,"woodfuel")$(i21_trade_margin(h,"woodfuel") < s21_min_trade_margin_forestry) = s21_min_trade_margin_forestry; v21_import_for_feasibility.fx(h,k_trade) = 0; v21_import_for_feasibility.lo(h,k_import21) = 0; diff --git a/modules/22_land_conservation/area_based_apr22/input.gms b/modules/22_land_conservation/area_based_apr22/input.gms index f72e91fe8a..d2a1d29841 100644 --- a/modules/22_land_conservation/area_based_apr22/input.gms +++ b/modules/22_land_conservation/area_based_apr22/input.gms @@ -12,8 +12,8 @@ $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 / +s22_conservation_start Land conservation start year / 2025 / +s22_conservation_target Land conservation target year / 2050 / ; * Set-switch for countries affected by regional land conservation policy diff --git a/modules/22_land_conservation/area_based_apr22/presolve.gms b/modules/22_land_conservation/area_based_apr22/presolve.gms index 1ff0c39820..bfcd84b69e 100644 --- a/modules/22_land_conservation/area_based_apr22/presolve.gms +++ b/modules/22_land_conservation/area_based_apr22/presolve.gms @@ -70,7 +70,7 @@ pm_land_conservation(t,j,"past","restore")$(p22_conservation_area(t,j,"past") > 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; +pm_land_conservation(t,j,"secdforest","restore")$(pm_land_conservation(t,j,"secdforest","restore") < 1e-6) = 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"); @@ -80,27 +80,33 @@ pm_land_conservation(t,j,"other","restore")$(p22_conservation_area(t,j,"other") * 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; + - sum(land_timber, pcm_land(j, land_timber)) + - pm_land_conservation(t,j,"past","protect") + - vm_land.lo(j,"crop") + - vm_treecover.l(j); +p22_secdforest_restore_pot(t,j)$(p22_secdforest_restore_pot(t,j) < 1e-6) = 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)) + - sum(land_timber, pcm_land(j, land_timber)) - 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,"secdforest","restore") + - vm_land.lo(j,"crop") + - vm_treecover.l(j); +p22_past_restore_pot(t,j)$(p22_past_restore_pot(t,j) < 1e-6) = 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(land_timber, pcm_land(j, land_timber)) - 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,"secdforest","restore") + - vm_land.lo(j,"crop") + - vm_treecover.l(j); +p22_other_restore_pot(t,j)$(p22_other_restore_pot(t,j) < 1e-6) = 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 diff --git a/modules/29_ageclass/feb21/declarations.gms b/modules/28_ageclass/feb21/declarations.gms similarity index 100% rename from modules/29_ageclass/feb21/declarations.gms rename to modules/28_ageclass/feb21/declarations.gms diff --git a/modules/29_ageclass/feb21/input.gms b/modules/28_ageclass/feb21/input.gms similarity index 77% rename from modules/29_ageclass/feb21/input.gms rename to modules/28_ageclass/feb21/input.gms index 5bfacde746..7e645fecdb 100644 --- a/modules/29_ageclass/feb21/input.gms +++ b/modules/28_ageclass/feb21/input.gms @@ -5,8 +5,8 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -table f29_forestageclasses(j,ac_poulter) Poulter age-class area in each cluster (1) +table f28_forestageclasses(j,ac_poulter) Poulter age-class area in each cluster (1) $ondelim -$include "./modules/29_ageclass/input/forestageclasses.cs3" +$include "./modules/28_ageclass/input/forestageclasses.cs3" $offdelim ; diff --git a/modules/29_ageclass/feb21/preloop.gms b/modules/28_ageclass/feb21/preloop.gms similarity index 88% rename from modules/29_ageclass/feb21/preloop.gms rename to modules/28_ageclass/feb21/preloop.gms index a8581ef8cd..12cffe2e9c 100644 --- a/modules/29_ageclass/feb21/preloop.gms +++ b/modules/28_ageclass/feb21/preloop.gms @@ -7,8 +7,8 @@ * Ben Poulter age class distribution im_plantedclass_ac(j,ac) = 0; -*im_plantedclass_ac(j,ac) = sum(ac_poulter_to_ac(ac_poulter,ac),f29_forestageclasses(j,ac_poulter)$(not sameas(ac_poulter,"class15"))); -im_plantedclass_ac(j,ac) = sum(ac_poulter_to_ac(ac_poulter,ac),f29_forestageclasses(j,ac_poulter)); +*im_plantedclass_ac(j,ac) = sum(ac_poulter_to_ac(ac_poulter,ac),f28_forestageclasses(j,ac_poulter)$(not sameas(ac_poulter,"class15"))); +im_plantedclass_ac(j,ac) = sum(ac_poulter_to_ac(ac_poulter,ac),f28_forestageclasses(j,ac_poulter)); * As summing over makes double counting (two magpie age classes in one poulter class) * We divide by 2 diff --git a/modules/28_ageclass/feb21/presolve.gms b/modules/28_ageclass/feb21/presolve.gms new file mode 100644 index 0000000000..ae9b575c01 --- /dev/null +++ b/modules/28_ageclass/feb21/presolve.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 + +*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)); diff --git a/modules/29_ageclass/feb21/realization.gms b/modules/28_ageclass/feb21/realization.gms similarity index 81% rename from modules/29_ageclass/feb21/realization.gms rename to modules/28_ageclass/feb21/realization.gms index 65c3379e65..f88a2c1b85 100644 --- a/modules/29_ageclass/feb21/realization.gms +++ b/modules/28_ageclass/feb21/realization.gms @@ -18,8 +18,9 @@ *' in MAgPIE and hence using these numbers directly in the model might generate biases. *####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/29_ageclass/feb21/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/29_ageclass/feb21/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/29_ageclass/feb21/input.gms" -$Ifi "%phase%" == "preloop" $include "./modules/29_ageclass/feb21/preloop.gms" +$Ifi "%phase%" == "sets" $include "./modules/28_ageclass/feb21/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/28_ageclass/feb21/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/28_ageclass/feb21/input.gms" +$Ifi "%phase%" == "preloop" $include "./modules/28_ageclass/feb21/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/28_ageclass/feb21/presolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/29_ageclass/feb21/sets.gms b/modules/28_ageclass/feb21/sets.gms similarity index 100% rename from modules/29_ageclass/feb21/sets.gms rename to modules/28_ageclass/feb21/sets.gms diff --git a/modules/29_ageclass/input/files b/modules/28_ageclass/input/files similarity index 100% rename from modules/29_ageclass/input/files rename to modules/28_ageclass/input/files diff --git a/modules/29_ageclass/module.gms b/modules/28_ageclass/module.gms similarity index 93% rename from modules/29_ageclass/module.gms rename to modules/28_ageclass/module.gms index f196dbbbab..27f03a3081 100644 --- a/modules/29_ageclass/module.gms +++ b/modules/28_ageclass/module.gms @@ -14,5 +14,5 @@ *' @authors Abhijeet Mishra, Florian Humpenöder *###################### R SECTION START (MODULETYPES) ########################## -$Ifi "%ageclass%" == "feb21" $include "./modules/29_ageclass/feb21/realization.gms" +$Ifi "%ageclass%" == "feb21" $include "./modules/28_ageclass/feb21/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/29_cropland/detail_apr24/declarations.gms b/modules/29_cropland/detail_apr24/declarations.gms new file mode 100644 index 0000000000..bfa7e79f98 --- /dev/null +++ b/modules/29_cropland/detail_apr24/declarations.gms @@ -0,0 +1,95 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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 + s29_shift number of 5-year age-classes corresponding to current time step length (1) +; + +parameters + p29_avl_cropland(t,j) Total available land for crop cultivation (mio. ha) + p29_country_weight(i) Policy country weight per region (1) + p29_snv_shr(t,j) Share of semi-natural vegetation in cropland areas (1) + i29_snv_relocation_target(j) Overall cropland area that requires relocation due to SNV policy (mio. ha) + p29_snv_relocation(t,j) Cropland area that is actually relocated during time step (mio. ha) + p29_max_snv_relocation(t,j) Maximum cropland relocation during time step (mio. ha) + p29_country_dummy(iso) Dummy parameter indicating whether country is affected by selected cropland policy (1) + pm_avl_cropland_iso(iso) Available land area for cropland at ISO level (mio. ha) + i29_snv_scenario_fader(t_all) SNV scenario fader (1) + + i29_treecover_scenario_fader(t_all) Cropland treecover scenario fader (1) + i29_treecover_target(t,j) Target share for treecover on total cropland (1) + i29_treecover_penalty(t) Penalty for violation of treecover target (USD05MER per ha) + p29_treecover_bii_coeff(bii_class_secd,potnatveg) BII coefficient for cropland treecover (1) + p29_carbon_density_ac(t,j,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha) + p29_treecover(t,j,ac) Cropland tree cover per age class (mio. ha) + pc29_treecover(j,ac) Cropland tree cover per age class in current time step (mio. ha) + pc29_treecover_share(j) Share of treecover on total cropland (1) + + i29_fallow_scenario_fader(t_all) Fallow land scenario fader (1) + i29_fallow_target(t) Target share for fallow land on total cropland (1) + i29_fallow_penalty(t) Penalty for violation of fallow target (USD05MER per ha) +; + +positive variables + vm_cost_cropland(j) Cost for total cropland (mio. USD05MER per yr) + vm_treecover(j) Cropland tree cover (mio. ha) + v29_treecover(j,ac) Cropland tree cover per age class (mio. ha) + v29_treecover_missing(j) Missing treecover area towards target (mio. ha) + v29_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) + v29_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) + vm_fallow(j) Fallow land is temporarily fallow cropland (mio. ha) + v29_fallow_missing(j) Missing fallow land towards target (mio. ha) +; + +equations + q29_cropland(j) Total cropland calculation (mio. ha) + q29_avl_cropland(j) Available cropland constraint (mio. ha) + q29_cost_cropland(j) Costs and benefits related to agroforestry (mio. USD05MER per yr) + q29_carbon(j,ag_pools,stockType) Cropland above ground carbon content calculation (mio. tC) + q29_land_snv(j) Land constraint for the SNV policy in cropland areas (mio. ha) + q29_land_snv_trans(j) Land transition constraint for SNV policy in cropland areas (mio. ha) + q29_fallow_min(j) Missing fallow land towards target (mio. ha) + q29_fallow_max(j) Maximum fallow land towards target (mio. ha) + q29_fallow_bv(j,potnatveg) Biodiversity value for fallow land (mio. ha) + q29_treecover(j) Cropland tree cover (mio. ha) + q29_treecover_min(j) Missing treecover area towards target (mio. ha) + q29_treecover_max(j) Maximum treecover area (mio. ha) + q29_treecover_bv(j,potnatveg) Biodiversity value for cropland treecover (mio. ha) + q29_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) + q29_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) + q29_treecover_est(j,ac) Cropland treecover establishment (mio. ha) +; + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov_cost_cropland(t,j,type) Cost for total cropland (mio. USD05MER per yr) + ov_treecover(t,j,type) Cropland tree cover (mio. ha) + ov29_treecover(t,j,ac,type) Cropland tree cover per age class (mio. ha) + ov29_treecover_missing(t,j,type) Missing treecover area towards target (mio. ha) + ov29_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) + ov29_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) + ov_fallow(t,j,type) Fallow land is temporarily fallow cropland (mio. ha) + ov29_fallow_missing(t,j,type) Missing fallow land towards target (mio. ha) + oq29_cropland(t,j,type) Total cropland calculation (mio. ha) + oq29_avl_cropland(t,j,type) Available cropland constraint (mio. ha) + oq29_cost_cropland(t,j,type) Costs and benefits related to agroforestry (mio. USD05MER per yr) + oq29_carbon(t,j,ag_pools,stockType,type) Cropland above ground carbon content calculation (mio. tC) + oq29_land_snv(t,j,type) Land constraint for the SNV policy in cropland areas (mio. ha) + oq29_land_snv_trans(t,j,type) Land transition constraint for SNV policy in cropland areas (mio. ha) + oq29_fallow_min(t,j,type) Missing fallow land towards target (mio. ha) + oq29_fallow_max(t,j,type) Maximum fallow land towards target (mio. ha) + oq29_fallow_bv(t,j,potnatveg,type) Biodiversity value for fallow land (mio. ha) + oq29_treecover(t,j,type) Cropland tree cover (mio. ha) + oq29_treecover_min(t,j,type) Missing treecover area towards target (mio. ha) + oq29_treecover_max(t,j,type) Maximum treecover area (mio. ha) + oq29_treecover_bv(t,j,potnatveg,type) Biodiversity value for cropland treecover (mio. ha) + oq29_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) + oq29_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) + oq29_treecover_est(t,j,ac,type) Cropland treecover establishment (mio. ha) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### + diff --git a/modules/29_cropland/detail_apr24/equations.gms b/modules/29_cropland/detail_apr24/equations.gms new file mode 100644 index 0000000000..8d4f749503 --- /dev/null +++ b/modules/29_cropland/detail_apr24/equations.gms @@ -0,0 +1,123 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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 +*' Total cropland is calculated as the sum of croparea, fallow land and tree cover area. + + q29_cropland(j2) .. + vm_land(j2,"crop") =e= sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2) + sum(ac, v29_treecover(j2,ac)); + +*' 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. + + q29_avl_cropland(j2) .. + vm_land(j2,"crop") =l= sum(ct, p29_avl_cropland(ct,j2)); + + +*' Total cost for the cropland module. + + q29_cost_cropland(j2) .. + vm_cost_cropland(j2) =e= + v29_cost_treecover_est(j2) + v29_cost_treecover_recur(j2) + + v29_fallow_missing(j2) * sum(ct, i29_fallow_penalty(ct)) + + v29_treecover_missing(j2) * sum(ct, i29_treecover_penalty(ct)); + + +*' The carbon stocks of total cropland are calculated as the sum of carbon stocks in +*' cropland, fallow land and tree cover area. + + q29_carbon(j2,ag_pools,stockType) .. + vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= + vm_carbon_stock_croparea(j2,ag_pools) + + vm_fallow(j2) * sum(ct, fm_carbon_density(ct,j2,"crop",ag_pools)) + + m_carbon_stock_ac(v29_treecover,p29_carbon_density_ac,"ac","ac_sub"); + + +*' 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). + + q29_land_snv(j2) .. + sum(land_snv, vm_land(j2,land_snv)) =g= + sum(ct, p29_snv_shr(ct,j2)) * vm_land(j2,"crop") + + sum((ct,land_snv,consv_type), pm_land_conservation(ct,j2,land_snv,consv_type)); + +*' The semi-natural vegetation constraint for cropland areas has been suggested at the per square +*' kilometer scale. The amount of cropland requiring relocation has therefore been derived from +*' exogeneous high-resolution land cover information from the Copernicus Global Land Service +*' (@buchhorn_copernicus_2020). + + q29_land_snv_trans(j2) .. + sum(land_snv, vm_lu_transitions(j2,"crop",land_snv)) =g= sum(ct, p29_snv_relocation(ct,j2)); + +*' A penalty is applied for the violation of fallow land rules. +*' The penalty applies to the missing fallow land, i.e. where fallow land +*' is lower than a certain fraction of total cropland. + + q29_fallow_min(j2)$(sum(ct, i29_fallow_penalty(ct)) > 0) .. + v29_fallow_missing(j2) =g= + vm_land(j2,"crop") * sum(ct, i29_fallow_target(ct)) - vm_fallow(j2); + + q29_fallow_max(j2) .. + vm_fallow(j2) =l= + vm_land(j2,"crop") * s29_fallow_max; + +*' Fallow land biodiversity value is based on perennial crops. + + q29_fallow_bv(j2,potnatveg) .. + vm_bv(j2,"crop_fallow",potnatveg) =e= + vm_fallow(j2) * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); + + +*' Interface vm_treecover for other modules. + + q29_treecover(j2) .. + vm_treecover(j2) =e= sum(ac, v29_treecover(j2,ac)); + +*' A penalty is applied for the violation of treecover rules. +*' The penalty applies to the missing treecover area, i.e. where treecover area +*' is lower than a certain fraction of total cropland. + + q29_treecover_min(j2)$(sum(ct, i29_treecover_penalty(ct)) > 0) .. + v29_treecover_missing(j2) =g= + vm_land(j2,"crop") * sum(ct, i29_treecover_target(ct,j2)) - sum(ac, v29_treecover(j2,ac)); + + q29_treecover_max(j2) .. + sum(ac, v29_treecover(j2,ac)) =l= + vm_land(j2,"crop") * s29_treecover_max; + +*' Depending on `s29_treecover_bii_coeff`, tree cover biodiversity value +*' is based on natural vegetation or plantation BII coefficients. + + q29_treecover_bv(j2,potnatveg) .. + vm_bv(j2,"crop_tree",potnatveg) =e= + sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v29_treecover(j2,ac)) * + p29_treecover_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); + +*' Cropland tree cover annuity cost. + + q29_cost_treecover_est(j2) .. + v29_cost_treecover_est(j2) =e= + sum(ac_est, v29_treecover(j2,ac_est)) * s29_cost_treecover_est * + sum((cell(i2,j2),ct),pm_interest(ct,i2)/(1+pm_interest(ct,i2))); + +*' Cropland tree cover recurring cost. + + q29_cost_treecover_recur(j2) .. + v29_cost_treecover_recur(j2) =e= + sum(ac_sub, v29_treecover(j2,ac_sub)) * s29_cost_treecover_recur; + +*' Cropland tree cover establishment rules for distributing areas equally to age-classes. +*' For a 5-year time step ac_est includes only ac0. But for a 10-year time step ac_est includes ac0 and ac5. + + q29_treecover_est(j2,ac_est) .. + v29_treecover(j2,ac_est) =e= sum(ac_est2, v29_treecover(j2,ac_est2))/card(ac_est2); diff --git a/modules/29_cropland/detail_apr24/input.gms b/modules/29_cropland/detail_apr24/input.gms new file mode 100644 index 0000000000..163dc134e1 --- /dev/null +++ b/modules/29_cropland/detail_apr24/input.gms @@ -0,0 +1,101 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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 c29_marginal_land q33_marginal +* options: all_marginal, q33_marginal, no_marginal + +scalars + s29_snv_shr Share of available cropland that is witheld for other land cover types (1) / 0 / + s29_snv_shr_noselect Share of available cropland that is witheld for other land cover types (1) / 0 / + s29_snv_scenario_start SNV scenario start year / 2025 / + s29_snv_scenario_target SNV scenario target year / 2050 / + s29_snv_relocation_data_x1 First reference value in SNV target cropland data (1) / 0.2 / + s29_snv_relocation_data_x2 Second reference value in SNV target cropland data (1) / 0.5 / + s29_cost_treecover_est Tree cover establishment cost (USD05MER per ha) / 2000 / + s29_cost_treecover_recur Tree cover recurring cost (USD05MER per ha) / 500 / + s29_treecover_plantation Growth curve switch for tree cover on cropland 0=natveg 1=plantations (1) / 0 / + s29_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=secondary vegetation 1=timber plantations (1) / 0 / + s29_treecover_scenario_start Cropland treecover scenario start year / 2025 / + s29_treecover_scenario_target Cropland treecover scenario target year / 2050 / + s29_treecover_target Minimum share of treecover on total cropland in target year (1) / 0 / + s29_treecover_target_noselect Minimum share of treecover on total cropland in target year (1) / 0 / + s29_treecover_keep Avoid loss of existing treecover (1=yes 0=no) / 1 / + s29_treecover_max Maximum share of treecover on total cropland (1) / 0.4 / + s29_treecover_penalty_before Penalty for violation of treecover target before scenario start (USD05MER per ha) / 5000 / + s29_treecover_penalty Penalty for violation of treecover target after sceanrio start (USD05MER per ha) / 5000 / + s29_fallow_scenario_start Fallow land scenario start year / 2025 / + s29_fallow_scenario_target Fallow land scenario target year / 2050 / + s29_fallow_target Minimum share of fallow land on total cropland in target year (1) / 0 / + s29_fallow_max Maximum share of fallow land on total cropland (1) / 0.4 / + s29_fallow_penalty Penalty for violation of fallow target (USD05MER per ha) / 500 / +; + + +* Set-switch for countries affected by certain policies +* Default: all iso countries selected +sets + policy_countries29(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 / +; + +********* AVAILABLE CROPLAND ******************************************* + +table f29_avl_cropland(j,marginal_land29) Available land area for cropland (mio. ha) +$ondelim +$include "./modules/29_cropland/input/avl_cropland.cs3" +$offdelim +; + +table f29_avl_cropland_iso(iso,marginal_land29) Available land area for cropland at ISO level (mio. ha) +$ondelim +$include "./modules/29_cropland/input/avl_cropland_iso.cs3" +$offdelim +; + +********* SNV TARGET CROPLAND ******************************************* + +table f29_snv_target_cropland(j,relocation_target29) Cropland in 2019 requiring relocation due to SNV policy (mio. ha) +$ondelim +$include "./modules/29_cropland/input/SNVTargetCropland.cs3" +$offdelim +; + +********* Cropland tree cover ******************************************* + +parameter f29_treecover(j) Tree cover on cropland in 2019 (mio. ha) +/ +$ondelim +$include "./modules/29_cropland/input/CroplandTreecover.cs2" +$offdelim +/ +; diff --git a/modules/29_cropland/detail_apr24/postsolve.gms b/modules/29_cropland/detail_apr24/postsolve.gms new file mode 100644 index 0000000000..43d88e04c7 --- /dev/null +++ b/modules/29_cropland/detail_apr24/postsolve.gms @@ -0,0 +1,108 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +pc29_treecover(j,ac) = v29_treecover.l(j,ac); + +*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### + ov_cost_cropland(t,j,"marginal") = vm_cost_cropland.m(j); + ov_treecover(t,j,"marginal") = vm_treecover.m(j); + ov29_treecover(t,j,ac,"marginal") = v29_treecover.m(j,ac); + ov29_treecover_missing(t,j,"marginal") = v29_treecover_missing.m(j); + ov29_cost_treecover_est(t,j,"marginal") = v29_cost_treecover_est.m(j); + ov29_cost_treecover_recur(t,j,"marginal") = v29_cost_treecover_recur.m(j); + ov_fallow(t,j,"marginal") = vm_fallow.m(j); + ov29_fallow_missing(t,j,"marginal") = v29_fallow_missing.m(j); + oq29_cropland(t,j,"marginal") = q29_cropland.m(j); + oq29_avl_cropland(t,j,"marginal") = q29_avl_cropland.m(j); + oq29_cost_cropland(t,j,"marginal") = q29_cost_cropland.m(j); + oq29_carbon(t,j,ag_pools,stockType,"marginal") = q29_carbon.m(j,ag_pools,stockType); + oq29_land_snv(t,j,"marginal") = q29_land_snv.m(j); + oq29_land_snv_trans(t,j,"marginal") = q29_land_snv_trans.m(j); + oq29_fallow_min(t,j,"marginal") = q29_fallow_min.m(j); + oq29_fallow_max(t,j,"marginal") = q29_fallow_max.m(j); + oq29_fallow_bv(t,j,potnatveg,"marginal") = q29_fallow_bv.m(j,potnatveg); + oq29_treecover(t,j,"marginal") = q29_treecover.m(j); + oq29_treecover_min(t,j,"marginal") = q29_treecover_min.m(j); + oq29_treecover_max(t,j,"marginal") = q29_treecover_max.m(j); + oq29_treecover_bv(t,j,potnatveg,"marginal") = q29_treecover_bv.m(j,potnatveg); + oq29_cost_treecover_est(t,j,"marginal") = q29_cost_treecover_est.m(j); + oq29_cost_treecover_recur(t,j,"marginal") = q29_cost_treecover_recur.m(j); + oq29_treecover_est(t,j,ac,"marginal") = q29_treecover_est.m(j,ac); + ov_cost_cropland(t,j,"level") = vm_cost_cropland.l(j); + ov_treecover(t,j,"level") = vm_treecover.l(j); + ov29_treecover(t,j,ac,"level") = v29_treecover.l(j,ac); + ov29_treecover_missing(t,j,"level") = v29_treecover_missing.l(j); + ov29_cost_treecover_est(t,j,"level") = v29_cost_treecover_est.l(j); + ov29_cost_treecover_recur(t,j,"level") = v29_cost_treecover_recur.l(j); + ov_fallow(t,j,"level") = vm_fallow.l(j); + ov29_fallow_missing(t,j,"level") = v29_fallow_missing.l(j); + oq29_cropland(t,j,"level") = q29_cropland.l(j); + oq29_avl_cropland(t,j,"level") = q29_avl_cropland.l(j); + oq29_cost_cropland(t,j,"level") = q29_cost_cropland.l(j); + oq29_carbon(t,j,ag_pools,stockType,"level") = q29_carbon.l(j,ag_pools,stockType); + oq29_land_snv(t,j,"level") = q29_land_snv.l(j); + oq29_land_snv_trans(t,j,"level") = q29_land_snv_trans.l(j); + oq29_fallow_min(t,j,"level") = q29_fallow_min.l(j); + oq29_fallow_max(t,j,"level") = q29_fallow_max.l(j); + oq29_fallow_bv(t,j,potnatveg,"level") = q29_fallow_bv.l(j,potnatveg); + oq29_treecover(t,j,"level") = q29_treecover.l(j); + oq29_treecover_min(t,j,"level") = q29_treecover_min.l(j); + oq29_treecover_max(t,j,"level") = q29_treecover_max.l(j); + oq29_treecover_bv(t,j,potnatveg,"level") = q29_treecover_bv.l(j,potnatveg); + oq29_cost_treecover_est(t,j,"level") = q29_cost_treecover_est.l(j); + oq29_cost_treecover_recur(t,j,"level") = q29_cost_treecover_recur.l(j); + oq29_treecover_est(t,j,ac,"level") = q29_treecover_est.l(j,ac); + ov_cost_cropland(t,j,"upper") = vm_cost_cropland.up(j); + ov_treecover(t,j,"upper") = vm_treecover.up(j); + ov29_treecover(t,j,ac,"upper") = v29_treecover.up(j,ac); + ov29_treecover_missing(t,j,"upper") = v29_treecover_missing.up(j); + ov29_cost_treecover_est(t,j,"upper") = v29_cost_treecover_est.up(j); + ov29_cost_treecover_recur(t,j,"upper") = v29_cost_treecover_recur.up(j); + ov_fallow(t,j,"upper") = vm_fallow.up(j); + ov29_fallow_missing(t,j,"upper") = v29_fallow_missing.up(j); + oq29_cropland(t,j,"upper") = q29_cropland.up(j); + oq29_avl_cropland(t,j,"upper") = q29_avl_cropland.up(j); + oq29_cost_cropland(t,j,"upper") = q29_cost_cropland.up(j); + oq29_carbon(t,j,ag_pools,stockType,"upper") = q29_carbon.up(j,ag_pools,stockType); + oq29_land_snv(t,j,"upper") = q29_land_snv.up(j); + oq29_land_snv_trans(t,j,"upper") = q29_land_snv_trans.up(j); + oq29_fallow_min(t,j,"upper") = q29_fallow_min.up(j); + oq29_fallow_max(t,j,"upper") = q29_fallow_max.up(j); + oq29_fallow_bv(t,j,potnatveg,"upper") = q29_fallow_bv.up(j,potnatveg); + oq29_treecover(t,j,"upper") = q29_treecover.up(j); + oq29_treecover_min(t,j,"upper") = q29_treecover_min.up(j); + oq29_treecover_max(t,j,"upper") = q29_treecover_max.up(j); + oq29_treecover_bv(t,j,potnatveg,"upper") = q29_treecover_bv.up(j,potnatveg); + oq29_cost_treecover_est(t,j,"upper") = q29_cost_treecover_est.up(j); + oq29_cost_treecover_recur(t,j,"upper") = q29_cost_treecover_recur.up(j); + oq29_treecover_est(t,j,ac,"upper") = q29_treecover_est.up(j,ac); + ov_cost_cropland(t,j,"lower") = vm_cost_cropland.lo(j); + ov_treecover(t,j,"lower") = vm_treecover.lo(j); + ov29_treecover(t,j,ac,"lower") = v29_treecover.lo(j,ac); + ov29_treecover_missing(t,j,"lower") = v29_treecover_missing.lo(j); + ov29_cost_treecover_est(t,j,"lower") = v29_cost_treecover_est.lo(j); + ov29_cost_treecover_recur(t,j,"lower") = v29_cost_treecover_recur.lo(j); + ov_fallow(t,j,"lower") = vm_fallow.lo(j); + ov29_fallow_missing(t,j,"lower") = v29_fallow_missing.lo(j); + oq29_cropland(t,j,"lower") = q29_cropland.lo(j); + oq29_avl_cropland(t,j,"lower") = q29_avl_cropland.lo(j); + oq29_cost_cropland(t,j,"lower") = q29_cost_cropland.lo(j); + oq29_carbon(t,j,ag_pools,stockType,"lower") = q29_carbon.lo(j,ag_pools,stockType); + oq29_land_snv(t,j,"lower") = q29_land_snv.lo(j); + oq29_land_snv_trans(t,j,"lower") = q29_land_snv_trans.lo(j); + oq29_fallow_min(t,j,"lower") = q29_fallow_min.lo(j); + oq29_fallow_max(t,j,"lower") = q29_fallow_max.lo(j); + oq29_fallow_bv(t,j,potnatveg,"lower") = q29_fallow_bv.lo(j,potnatveg); + oq29_treecover(t,j,"lower") = q29_treecover.lo(j); + oq29_treecover_min(t,j,"lower") = q29_treecover_min.lo(j); + oq29_treecover_max(t,j,"lower") = q29_treecover_max.lo(j); + oq29_treecover_bv(t,j,potnatveg,"lower") = q29_treecover_bv.lo(j,potnatveg); + oq29_cost_treecover_est(t,j,"lower") = q29_cost_treecover_est.lo(j); + oq29_cost_treecover_recur(t,j,"lower") = q29_cost_treecover_recur.lo(j); + oq29_treecover_est(t,j,ac,"lower") = q29_treecover_est.lo(j,ac); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### + diff --git a/modules/29_cropland/detail_apr24/preloop.gms b/modules/29_cropland/detail_apr24/preloop.gms new file mode 100644 index 0000000000..1f288bd228 --- /dev/null +++ b/modules/29_cropland/detail_apr24/preloop.gms @@ -0,0 +1,59 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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_time_interpol(i29_snv_scenario_fader,s29_snv_scenario_start,s29_snv_scenario_target,0,1); +m_sigmoid_time_interpol(i29_treecover_scenario_fader,s29_treecover_scenario_start,s29_treecover_scenario_target,0,1); +m_sigmoid_time_interpol(i29_fallow_scenario_fader,s29_fallow_scenario_start,s29_fallow_scenario_target,0,1); + +* linear interpolation to estimate the cropland that +* requires relocation due to SNV policy +if (s29_snv_shr = 0, + i29_snv_relocation_target(j) = 0; +elseif s29_snv_shr <= s29_snv_relocation_data_x1, + m_linear_cell_data_interpol(i29_snv_relocation_target, s29_snv_shr,0,s29_snv_relocation_data_x1,0, f29_snv_target_cropland(j, "SNV20TargetCropland")); +elseif s29_snv_shr > s29_snv_relocation_data_x1, + m_linear_cell_data_interpol(i29_snv_relocation_target, s29_snv_shr,s29_snv_relocation_data_x1, s29_snv_relocation_data_x2,f29_snv_target_cropland(j, "SNV20TargetCropland"), f29_snv_target_cropland(j, "SNV50TargetCropland")); +); + + +* Initial tree cover on cropland is assumed to be equally distributed among all age-classes +pc29_treecover_share(j) = 0; +pc29_treecover_share(j)$(pm_land_hist("y2015",j,"crop") > 1e-10) = f29_treecover(j) / pm_land_hist("y2015",j,"crop"); +pc29_treecover_share(j)$(pc29_treecover_share(j) > s29_treecover_max) = s29_treecover_max; +pc29_treecover(j,ac) = (pc29_treecover_share(j) * pm_land_hist("y1995",j,"crop")) / card(ac); + +vm_treecover.l(j) = sum(ac, pc29_treecover(j,ac)); + +*' Switch for tree cover on cropland: +*' 0 = Use natveg growth curve towards LPJmL natural vegetation +*' 1 = Use plantation growth curve (faster than natveg) towards LPJmL natural vegetation +if(s29_treecover_plantation = 0, + p29_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_secdforest_ac(t,j,ac,ag_pools); +elseif s29_treecover_plantation = 1, + p29_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_plantation_ac(t,j,ac,ag_pools); +); + +** set bii coefficients +p29_treecover_bii_coeff(bii_class_secd,potnatveg) = 0; +if(s29_treecover_bii_coeff = 0, + p29_treecover_bii_coeff(bii_class_secd,potnatveg) = fm_bii_coeff(bii_class_secd,potnatveg) +elseif s29_treecover_bii_coeff = 1, + p29_treecover_bii_coeff(bii_class_secd,potnatveg) = fm_bii_coeff("timber",potnatveg) +); + + +* Country switch to determine countries for which certain policies shall be applied. +* In the default case, the policy affects all countries when activated. +p29_country_dummy(iso) = 0; +p29_country_dummy(policy_countries29) = 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. +pm_avl_cropland_iso(iso) = f29_avl_cropland_iso(iso,"%c29_marginal_land%"); +p29_country_weight(i) = sum(i_to_iso(i,iso), p29_country_dummy(iso) * pm_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), pm_avl_cropland_iso(iso)); diff --git a/modules/29_cropland/detail_apr24/presolve.gms b/modules/29_cropland/detail_apr24/presolve.gms new file mode 100644 index 0000000000..e1a7d63bcf --- /dev/null +++ b/modules/29_cropland/detail_apr24/presolve.gms @@ -0,0 +1,112 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +* ------------------------------------------------------- +* Semi-Natural Vegetation (SNV) +* ------------------------------------------------------- + +*' @code +*' Minimum semi-natural vegetation (SNV) share is fading in after 2020 +p29_snv_shr(t,j) = i29_snv_scenario_fader(t) * + (s29_snv_shr * sum(cell(i,j), p29_country_weight(i)) + + s29_snv_shr_noselect * sum(cell(i,j), 1-p29_country_weight(i))); + +*' Cropland relocation in response to SNV policy is based on exogeneous land +*' cover information from the Copernicus Global Land Service (@buchhorn_copernicus_2020). +*' The rate of the policy implementation is derived based +*' on the difference of scenario fader values in consecutive time steps +p29_snv_relocation(t,j) = (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t-1)) * + (i29_snv_relocation_target(j) * sum(cell(i,j), p29_country_weight(i)) + + s29_snv_shr_noselect * sum(cell(i,j), 1-p29_country_weight(i))); +*' The following lines take care of mismatches in the input +*' data (derived from satellite imagery from the Copernicus +*' Global Land Service (@buchhorn_copernicus_2020)) and in +*' cases of cropland reduction +p29_max_snv_relocation(t,j) = p29_snv_shr(t,j) * (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t-1)) * pcm_land(j,"crop") + - sum(ac, pc29_treecover(j,ac)); +p29_max_snv_relocation(t,j)$(p29_max_snv_relocation(t,j) < 1e-6) = 0; +p29_snv_relocation(t,j)$(p29_snv_relocation(t, j) > p29_max_snv_relocation(t,j)) = p29_max_snv_relocation(t,j); + +*' Area potentially available for cropping +p29_avl_cropland(t,j) = f29_avl_cropland(j,"%c29_marginal_land%") * (1 - p29_snv_shr(t,j)); +*' @stop + + +* ------------------------------------------------------- +* Tree cover on cropland +* ------------------------------------------------------- + +* Growth of trees on cropland is modelled by shifting age-classes according to time step length. +s29_shift = m_timestep_length_forestry/5; +* example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s29_shift = 1) + p29_treecover(t,j,ac)$(ord(ac) > s29_shift) = pc29_treecover(j,ac-s29_shift); +* account for cases at the end of the age class set (s29_shift > 1) which are not shifted by the above calculation + p29_treecover(t,j,"acx") = p29_treecover(t,j,"acx") + + sum(ac$(ord(ac) > card(ac)-s29_shift), pc29_treecover(j,ac)); + +pc29_treecover(j,ac) = p29_treecover(t,j,ac); +v29_treecover.l(j,ac) = p29_treecover(t,j,ac); + +* create treecover target and penalty scenario +i29_treecover_target(t,j) = i29_treecover_scenario_fader(t) * + (s29_treecover_target * sum(cell(i,j), p29_country_weight(i)) + + s29_treecover_target_noselect * sum(cell(i,j), 1-p29_country_weight(i))); + +* calculate treecover share +pc29_treecover_share(j) = 0; +pc29_treecover_share(j)$(pcm_land(j,"crop") > 1e-10) = sum(ac, pc29_treecover(j,ac)) / pcm_land(j,"crop"); +pc29_treecover_share(j)$(pc29_treecover_share(j) > s29_treecover_max) = s29_treecover_max; +if (s29_treecover_keep = 1, + i29_treecover_target(t,j)$(i29_treecover_target(t,j) < pc29_treecover_share(j)) = pc29_treecover_share(j); +); + +* Bounds for treecover. Only ac_est can increase in optimization. ac_sub can only decrease. +v29_treecover.lo(j,ac_est) = 0; +v29_treecover.up(j,ac_est) = Inf; +v29_treecover.lo(j,ac_sub) = 0; +v29_treecover.up(j,ac_sub) = pc29_treecover(j,ac_sub); +m_boundfix(v29_treecover,(j,ac_sub),l,1e-6); + +* set treecover penalty +if (m_year(t) <= s29_treecover_scenario_start, + i29_treecover_penalty(t) = s29_treecover_penalty_before; +else + i29_treecover_penalty(t) = s29_treecover_penalty; +); + +* fix missing tree cover variable to zero in case of no penalty +if (i29_treecover_penalty(t) > 0, + v29_treecover_missing.lo(j) = 0; + v29_treecover_missing.up(j) = Inf; +else + v29_treecover_missing.fx(j) = 0; +); + +* ------------------------------------------------------- +* Fallow land +* ------------------------------------------------------- + +* create fallow land target and penalty scenario +i29_fallow_target(t) = s29_fallow_target * i29_fallow_scenario_fader(t); + +if (m_year(t) <= s29_fallow_scenario_start, + i29_fallow_penalty(t) = 0; + v29_fallow_missing.fx(j) = 0; +else + i29_fallow_penalty(t) = s29_fallow_penalty; + if (i29_fallow_penalty(t) > 0, + v29_fallow_missing.lo(j) = 0; + v29_fallow_missing.up(j) = Inf; + else + v29_fallow_missing.fx(j) = 0; + ); +); + +* Bounds for fallow land +vm_fallow.lo(j) = 0; +vm_fallow.up(j) = p29_avl_cropland(t,j); +m_boundfix(vm_fallow,(j),l,1e-6); diff --git a/modules/29_cropland/detail_apr24/realization.gms b/modules/29_cropland/detail_apr24/realization.gms new file mode 100644 index 0000000000..071000bd1e --- /dev/null +++ b/modules/29_cropland/detail_apr24/realization.gms @@ -0,0 +1,31 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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, total cropland equals the sum of croparea, +*' fallow land and tree cover on cropland. Correspondingly, cropland carbon stocks consist +*' of carbons stocks for croparea, fallow land and tree cover on cropland. +*' The development of fallow land and tree cover on cropland depends on targets defined +*' as a certain fraction of total cropland. These targets can be either exogenously enforced +*' (rule-based) or endogenously incentivized by a penalty term, which enters the objective function. + +*' 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/29_cropland/detail_apr24/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/29_cropland/detail_apr24/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/29_cropland/detail_apr24/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/29_cropland/detail_apr24/equations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/29_cropland/detail_apr24/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/29_cropland/detail_apr24/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/29_cropland/detail_apr24/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/29_cropland/detail_apr24/sets.gms b/modules/29_cropland/detail_apr24/sets.gms new file mode 100644 index 0000000000..aa5a49bb36 --- /dev/null +++ b/modules/29_cropland/detail_apr24/sets.gms @@ -0,0 +1,16 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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 + + marginal_land29 Marginal land scenarios + / all_marginal, q33_marginal, no_marginal / + + relocation_target29 Cropland requiring relocation based on different SNV targets + / SNV20TargetCropland, SNV50TargetCropland / + +; diff --git a/modules/30_crop/endo_apr21/input/files b/modules/29_cropland/input/files similarity index 65% rename from modules/30_crop/endo_apr21/input/files rename to modules/29_cropland/input/files index d0cfbda228..c4a894d426 100644 --- a/modules/30_crop/endo_apr21/input/files +++ b/modules/29_cropland/input/files @@ -1,9 +1,8 @@ * 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 SNVTargetCropland.cs3 SNVTargetCropland_0.5.mz +CroplandTreecover.cs2 +CroplandTreecover_0.5.mz diff --git a/modules/29_cropland/module.gms b/modules/29_cropland/module.gms new file mode 100644 index 0000000000..bcf335c661 --- /dev/null +++ b/modules/29_cropland/module.gms @@ -0,0 +1,20 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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 Cropland + +*' @description Cropland is defined as the sum of croparea, fallow land and tree cover on cropland. +*' Croparea and corresponding carbon stocks are provided from [30_crop]. +*' Area and carbon stocks for fallow land and tree cover are defined in this module. + + +*' @authors Florian Humpenöder, Benjamin Bodirsky, Patrick v. Jeetze + +*###################### R SECTION START (MODULETYPES) ########################## +$Ifi "%cropland%" == "detail_apr24" $include "./modules/29_cropland/detail_apr24/realization.gms" +$Ifi "%cropland%" == "simple_apr24" $include "./modules/29_cropland/simple_apr24/realization.gms" +*###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/29_cropland/simple_apr24/declarations.gms b/modules/29_cropland/simple_apr24/declarations.gms new file mode 100644 index 0000000000..625f819b2c --- /dev/null +++ b/modules/29_cropland/simple_apr24/declarations.gms @@ -0,0 +1,46 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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 + p29_avl_cropland(t,j) Total available land for crop cultivation (mio. ha) + p29_country_weight(i) Policy country weight per region (1) + p29_snv_shr(t,j) Share of semi-natural vegetation in cropland areas (1) + i29_snv_relocation_target(j) Overall cropland area that requires relocation due to SNV policy (mio. ha) + p29_snv_relocation(t,j) Cropland area that is actually relocated during time step (mio. ha) + p29_max_snv_relocation(t,j) Maximum cropland relocation during time step (mio. ha) + p29_country_dummy(iso) Dummy parameter indicating whether country is affected by selected cropland policy (1) + pm_avl_cropland_iso(iso) Available land area for cropland at ISO level (mio. ha) + i29_snv_scenario_fader(t_all) SNV scenario fader (1) +; + +positive variables + vm_cost_cropland(j) Cost for total cropland (mio. USD05MER per yr) + vm_fallow(j) Fallow land is temporarily fallow cropland (mio. ha) + vm_treecover(j) Cropland tree cover (mio. ha) +; + +equations + q29_cropland(j) Total cropland calculation (mio. ha) + q29_avl_cropland(j) Available cropland constraint (mio. ha) + q29_carbon(j,ag_pools,stockType) Cropland above ground carbon content calculation (mio. tC) + q29_land_snv(j) Land constraint for the SNV policy in cropland areas (mio. ha) + q29_land_snv_trans(j) Land transition constraint for SNV policy in cropland areas (mio. ha) +; + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov_cost_cropland(t,j,type) Cost for total cropland (mio. USD05MER per yr) + ov_fallow(t,j,type) Fallow land is temporarily fallow cropland (mio. ha) + ov_treecover(t,j,type) Cropland tree cover (mio. ha) + oq29_cropland(t,j,type) Total cropland calculation (mio. ha) + oq29_avl_cropland(t,j,type) Available cropland constraint (mio. ha) + oq29_carbon(t,j,ag_pools,stockType,type) Cropland above ground carbon content calculation (mio. tC) + oq29_land_snv(t,j,type) Land constraint for the SNV policy in cropland areas (mio. ha) + oq29_land_snv_trans(t,j,type) Land transition constraint for SNV policy in cropland areas (mio. ha) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### + diff --git a/modules/29_cropland/simple_apr24/equations.gms b/modules/29_cropland/simple_apr24/equations.gms new file mode 100644 index 0000000000..376cf3e2c8 --- /dev/null +++ b/modules/29_cropland/simple_apr24/equations.gms @@ -0,0 +1,49 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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 +*' Total cropland equals croparea, because fallow land is fixed to zero +*' and tree cover on cropland does not exist in this realization. + + q29_cropland(j2) .. + vm_land(j2,"crop") =e= sum((kcr,w), vm_area(j2,kcr,w)); + + +*' 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. + + q29_avl_cropland(j2) .. + vm_land(j2,"crop") =l= sum(ct, p29_avl_cropland(ct,j2)); + + +*' The carbon stocks of total cropland are calculated as the sum of carbon stocks in +*' cropland, fallow land and tree cover area. + + q29_carbon(j2,ag_pools,stockType) .. + vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= + vm_carbon_stock_croparea(j2,ag_pools); + + +*' 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). + + q29_land_snv(j2) .. + sum(land_snv, vm_land(j2,land_snv)) =g= + sum(ct, p29_snv_shr(ct,j2)) * vm_land(j2,"crop") + + sum((ct,land_snv,consv_type), pm_land_conservation(ct,j2,land_snv,consv_type)); + +*' The semi-natural vegetation constraint for cropland areas has been suggested at the per square +*' kilometer scale. The amount of cropland requiring relocation has therefore been derived from +*' exogeneous high-resolution land cover information from the Copernicus Global Land Service +*' (@buchhorn_copernicus_2020). + + q29_land_snv_trans(j2) .. + sum(land_snv, vm_lu_transitions(j2,"crop",land_snv)) =g= sum(ct, p29_snv_relocation(ct,j2)); diff --git a/modules/29_cropland/simple_apr24/input.gms b/modules/29_cropland/simple_apr24/input.gms new file mode 100644 index 0000000000..f13c46f56f --- /dev/null +++ b/modules/29_cropland/simple_apr24/input.gms @@ -0,0 +1,73 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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 c29_marginal_land q33_marginal +* options: all_marginal, q33_marginal, no_marginal + +scalars + s29_snv_shr Share of available cropland that is witheld for other land cover types (1) / 0 / + s29_snv_shr_noselect Share of available cropland that is witheld for other land cover types (1) / 0 / + s29_snv_scenario_start SNV scenario start year / 2025 / + s29_snv_scenario_target SNV scenario target year / 2050 / + s29_snv_relocation_data_x1 First reference value in SNV target cropland data (1) / 0.2 / + s29_snv_relocation_data_x2 Second reference value in SNV target cropland data (1) / 0.5 / +; + +* Set-switch for countries affected by certain policies +* Default: all iso countries selected +sets + policy_countries29(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 / +; + +********* AVAILABLE CROPLAND ******************************************* + +table f29_avl_cropland(j,marginal_land29) Available land area for cropland (mio. ha) +$ondelim +$include "./modules/29_cropland/input/avl_cropland.cs3" +$offdelim +; + +table f29_avl_cropland_iso(iso,marginal_land29) Available land area for cropland at ISO level (mio. ha) +$ondelim +$include "./modules/29_cropland/input/avl_cropland_iso.cs3" +$offdelim +; + +********* SNV TARGET CROPLAND ******************************************* + +table f29_snv_target_cropland(j,relocation_target29) Cropland in 2019 requiring relocation due to SNV policy (mio. ha) +$ondelim +$include "./modules/29_cropland/input/SNVTargetCropland.cs3" +$offdelim +; diff --git a/modules/29_cropland/simple_apr24/not_used.txt b/modules/29_cropland/simple_apr24/not_used.txt new file mode 100644 index 0000000000..9ee70dc271 --- /dev/null +++ b/modules/29_cropland/simple_apr24/not_used.txt @@ -0,0 +1,8 @@ +name,type,reason +pm_land_hist,input,not needed +fm_luh2_side_layers,input,not needed +pm_interest,input,not needed +fm_bii_coeff,input,not needed +pm_carbon_density_secdforest_ac,input,not needed +pm_carbon_density_plantation_ac,input,not needed +fm_carbon_density,input,not needed diff --git a/modules/29_cropland/simple_apr24/postsolve.gms b/modules/29_cropland/simple_apr24/postsolve.gms new file mode 100644 index 0000000000..450d616814 --- /dev/null +++ b/modules/29_cropland/simple_apr24/postsolve.gms @@ -0,0 +1,42 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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_cropland(t,j,"marginal") = vm_cost_cropland.m(j); + ov_fallow(t,j,"marginal") = vm_fallow.m(j); + ov_treecover(t,j,"marginal") = vm_treecover.m(j); + oq29_cropland(t,j,"marginal") = q29_cropland.m(j); + oq29_avl_cropland(t,j,"marginal") = q29_avl_cropland.m(j); + oq29_carbon(t,j,ag_pools,stockType,"marginal") = q29_carbon.m(j,ag_pools,stockType); + oq29_land_snv(t,j,"marginal") = q29_land_snv.m(j); + oq29_land_snv_trans(t,j,"marginal") = q29_land_snv_trans.m(j); + ov_cost_cropland(t,j,"level") = vm_cost_cropland.l(j); + ov_fallow(t,j,"level") = vm_fallow.l(j); + ov_treecover(t,j,"level") = vm_treecover.l(j); + oq29_cropland(t,j,"level") = q29_cropland.l(j); + oq29_avl_cropland(t,j,"level") = q29_avl_cropland.l(j); + oq29_carbon(t,j,ag_pools,stockType,"level") = q29_carbon.l(j,ag_pools,stockType); + oq29_land_snv(t,j,"level") = q29_land_snv.l(j); + oq29_land_snv_trans(t,j,"level") = q29_land_snv_trans.l(j); + ov_cost_cropland(t,j,"upper") = vm_cost_cropland.up(j); + ov_fallow(t,j,"upper") = vm_fallow.up(j); + ov_treecover(t,j,"upper") = vm_treecover.up(j); + oq29_cropland(t,j,"upper") = q29_cropland.up(j); + oq29_avl_cropland(t,j,"upper") = q29_avl_cropland.up(j); + oq29_carbon(t,j,ag_pools,stockType,"upper") = q29_carbon.up(j,ag_pools,stockType); + oq29_land_snv(t,j,"upper") = q29_land_snv.up(j); + oq29_land_snv_trans(t,j,"upper") = q29_land_snv_trans.up(j); + ov_cost_cropland(t,j,"lower") = vm_cost_cropland.lo(j); + ov_fallow(t,j,"lower") = vm_fallow.lo(j); + ov_treecover(t,j,"lower") = vm_treecover.lo(j); + oq29_cropland(t,j,"lower") = q29_cropland.lo(j); + oq29_avl_cropland(t,j,"lower") = q29_avl_cropland.lo(j); + oq29_carbon(t,j,ag_pools,stockType,"lower") = q29_carbon.lo(j,ag_pools,stockType); + oq29_land_snv(t,j,"lower") = q29_land_snv.lo(j); + oq29_land_snv_trans(t,j,"lower") = q29_land_snv_trans.lo(j); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### + diff --git a/modules/29_cropland/simple_apr24/preloop.gms b/modules/29_cropland/simple_apr24/preloop.gms new file mode 100644 index 0000000000..9b06b11d8f --- /dev/null +++ b/modules/29_cropland/simple_apr24/preloop.gms @@ -0,0 +1,36 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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_cropland.fx(j) = 0; +vm_fallow.fx(j) = 0; +vm_treecover.fx(j) = 0; +vm_bv.fx(j,"crop_fallow",potnatveg) = 0; +vm_bv.fx(j,"crop_tree",potnatveg) = 0; + +** Trajectory for cropland scenarios +* sigmoidal interpolation between start year and target year +m_sigmoid_time_interpol(i29_snv_scenario_fader,s29_snv_scenario_start,s29_snv_scenario_target,0,1); + +* linear interpolation to estimate the cropland that +* requires relocation due to SNV policy +if (s29_snv_shr = 0, + i29_snv_relocation_target(j) = 0; +elseif s29_snv_shr <= s29_snv_relocation_data_x1, + m_linear_cell_data_interpol(i29_snv_relocation_target, s29_snv_shr,0,s29_snv_relocation_data_x1,0, f29_snv_target_cropland(j, "SNV20TargetCropland")); +elseif s29_snv_shr > s29_snv_relocation_data_x1, + m_linear_cell_data_interpol(i29_snv_relocation_target, s29_snv_shr,s29_snv_relocation_data_x1, s29_snv_relocation_data_x2,f29_snv_target_cropland(j, "SNV20TargetCropland"), f29_snv_target_cropland(j, "SNV50TargetCropland")); +); + +* Country switch to determine countries for which certain policies shall be applied. +* In the default case, the policy affects all countries when activated. +p29_country_dummy(iso) = 0; +p29_country_dummy(policy_countries29) = 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. +pm_avl_cropland_iso(iso) = f29_avl_cropland_iso(iso,"%c29_marginal_land%"); +p29_country_weight(i) = sum(i_to_iso(i,iso), p29_country_dummy(iso) * pm_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), pm_avl_cropland_iso(iso)); diff --git a/modules/29_cropland/simple_apr24/presolve.gms b/modules/29_cropland/simple_apr24/presolve.gms new file mode 100644 index 0000000000..955befb1e4 --- /dev/null +++ b/modules/29_cropland/simple_apr24/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 +*' Minimum semi-natural vegetation (SNV) share is fading in after 2020 +p29_snv_shr(t,j) = i29_snv_scenario_fader(t) * + (s29_snv_shr * sum(cell(i,j), p29_country_weight(i)) + + s29_snv_shr_noselect * sum(cell(i,j), 1-p29_country_weight(i))); + +*' Cropland relocation in response to SNV policy is based on exogeneous land +*' cover information from the Copernicus Global Land Service (@buchhorn_copernicus_2020). +*' The rate of the policy implementation is derived based +*' on the difference of scenario fader values in consecutive time steps +p29_snv_relocation(t,j) = (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t-1)) * + (i29_snv_relocation_target(j) * sum(cell(i,j), p29_country_weight(i)) + + s29_snv_shr_noselect * sum(cell(i,j), 1-p29_country_weight(i))); +*' The following lines take care of mismatches in the input +*' data (derived from satellite imagery from the Copernicus +*' Global Land Service (@buchhorn_copernicus_2020)) and in +*' cases of cropland reduction +p29_max_snv_relocation(t,j) = p29_snv_shr(t,j) * (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t-1)) * pcm_land(j,"crop") + - vm_treecover.l(j); +p29_max_snv_relocation(t,j)$(p29_max_snv_relocation(t,j) < 1e-6) = 0; +p29_snv_relocation(t,j)$(p29_snv_relocation(t, j) > p29_max_snv_relocation(t,j)) = p29_max_snv_relocation(t,j); + +*' Area potentially available for cropping +p29_avl_cropland(t,j) = f29_avl_cropland(j,"%c29_marginal_land%") * (1 - p29_snv_shr(t,j)); +*' @stop + diff --git a/modules/29_cropland/simple_apr24/realization.gms b/modules/29_cropland/simple_apr24/realization.gms new file mode 100644 index 0000000000..ae6d324c77 --- /dev/null +++ b/modules/29_cropland/simple_apr24/realization.gms @@ -0,0 +1,30 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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, total cropland equals croparea because +*' fallow land and tree cover on cropland are fixed to zero. +*' Therefore, also cropland carbon stocks consist only of croparea carbon stocks. +*' Biodiversity BII values are fixed to zero. +*' Costs are fixed to zero. + +*' 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 Fallow land and tree cover on cropland are fixed to zero + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/29_cropland/simple_apr24/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/29_cropland/simple_apr24/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/29_cropland/simple_apr24/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/29_cropland/simple_apr24/equations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/29_cropland/simple_apr24/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/29_cropland/simple_apr24/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/29_cropland/simple_apr24/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/29_cropland/simple_apr24/sets.gms b/modules/29_cropland/simple_apr24/sets.gms new file mode 100644 index 0000000000..aa5a49bb36 --- /dev/null +++ b/modules/29_cropland/simple_apr24/sets.gms @@ -0,0 +1,16 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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 + + marginal_land29 Marginal land scenarios + / all_marginal, q33_marginal, no_marginal / + + relocation_target29 Cropland requiring relocation based on different SNV targets + / SNV20TargetCropland, SNV50TargetCropland / + +; diff --git a/modules/30_crop/endo_apr21/declarations.gms b/modules/30_crop/endo_apr21/declarations.gms deleted file mode 100644 index e0998d679d..0000000000 --- a/modules/30_crop/endo_apr21/declarations.gms +++ /dev/null @@ -1,63 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-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) - i30_snv_relocation_target(j) Overall cropland area that requires relocation due to SNV policy (mio. ha) - p30_snv_relocation(t,j) Cropland area that is actually relocated during time step (mio. ha) - p30_max_snv_relocation(t,j) Maximum cropland relocation during time step (mio. ha) - p30_country_dummy(iso) Dummy parameter indicating whether country is affected by selected cropland 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) - v30_crop_area(i) Total regional crop 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) - q30_crop_reg(i) Total regional crop production area (mio. ha) - q30_land_snv_trans(j) Land transition constraint for 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) - ov30_crop_area(t,i,type) Total regional crop 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) - oq30_crop_reg(t,i,type) Total regional crop production area (mio. ha) - oq30_land_snv_trans(t,j,type) Land transition constraint for SNV policy in cropland areas (mio. ha) -; -*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### - -*** EOF declarations.gms *** diff --git a/modules/30_crop/endo_apr21/equations.gms b/modules/30_crop/endo_apr21/equations.gms deleted file mode 100644 index a9abc49e6c..0000000000 --- a/modules/30_crop/endo_apr21/equations.gms +++ /dev/null @@ -1,86 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-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"); - -*' 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)); - -*' The semi-natural vegetation constraint for cropland areas has been suggested at the per square -*' kilometer scale. The amount of cropland requiring relocation has therefore been derived from -*' exogeneous high-resolution land cover information from the Copernicus Global Land Service -*' (@buchhorn_copernicus_2020). - - q30_land_snv_trans(j2) .. - sum(land_snv, vm_lu_transitions(j2,"crop",land_snv)) =g= sum(ct, p30_snv_relocation(ct,j2)); - -*' 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,crpmax30,w) .. - sum((crp_kcr30(crpmax30,kcr)), vm_area(j2,kcr,w)) =l= - sum(kcr, vm_area(j2,kcr,w)) * f30_rotation_max_shr(crpmax30); - -*' On the other hand, it reflects boundary conditions such as minimum self -*' sufficiency constraints: - - q30_rotation_min(j2,crpmin30,w) .. - sum((crp_kcr30(crpmin30,kcr)), vm_area(j2,kcr,w)) =g= - sum(kcr, vm_area(j2,kcr,w)) * f30_rotation_min_shr(crpmin30); - -*' 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); - - 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); - -*' regional cropland area is calculated for the cropland growth constraint - q30_crop_reg(i2) .. v30_crop_area(i2) - =e= - sum((cell(i2,j2), kcr, w), vm_area(j2,kcr,w)); diff --git a/modules/30_crop/endo_apr21/postsolve.gms b/modules/30_crop/endo_apr21/postsolve.gms deleted file mode 100644 index 991688e36d..0000000000 --- a/modules/30_crop/endo_apr21/postsolve.gms +++ /dev/null @@ -1,70 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-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); - ov30_crop_area(t,i,"marginal") = v30_crop_area.m(i); - 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); - oq30_crop_reg(t,i,"marginal") = q30_crop_reg.m(i); - oq30_land_snv_trans(t,j,"marginal") = q30_land_snv_trans.m(j); - ov_fallow(t,j,"level") = vm_fallow.l(j); - ov_area(t,j,kcr,w,"level") = vm_area.l(j,kcr,w); - ov30_crop_area(t,i,"level") = v30_crop_area.l(i); - 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); - oq30_crop_reg(t,i,"level") = q30_crop_reg.l(i); - oq30_land_snv_trans(t,j,"level") = q30_land_snv_trans.l(j); - ov_fallow(t,j,"upper") = vm_fallow.up(j); - ov_area(t,j,kcr,w,"upper") = vm_area.up(j,kcr,w); - ov30_crop_area(t,i,"upper") = v30_crop_area.up(i); - 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); - oq30_crop_reg(t,i,"upper") = q30_crop_reg.up(i); - oq30_land_snv_trans(t,j,"upper") = q30_land_snv_trans.up(j); - ov_fallow(t,j,"lower") = vm_fallow.lo(j); - ov_area(t,j,kcr,w,"lower") = vm_area.lo(j,kcr,w); - ov30_crop_area(t,i,"lower") = v30_crop_area.lo(i); - 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); - oq30_crop_reg(t,i,"lower") = q30_crop_reg.lo(i); - oq30_land_snv_trans(t,j,"lower") = q30_land_snv_trans.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 deleted file mode 100644 index d121c0dbab..0000000000 --- a/modules/30_crop/endo_apr21/preloop.gms +++ /dev/null @@ -1,39 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-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_time_interpol(p30_snv_scenario_fader,s30_snv_scenario_start,s30_snv_scenario_target,0,1); -m_sigmoid_time_interpol(p30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1); - -* linear interpolation to estimate the cropland that -* requires relocation due to SNV policy -if (s30_snv_shr = 0, -i30_snv_relocation_target(j) = 0; - -elseif s30_snv_shr <= s30_snv_relocation_data_x1, -m_linear_cell_data_interpol(i30_snv_relocation_target, s30_snv_shr,0,s30_snv_relocation_data_x1,0, f30_snv_target_cropland(j, "SNV20TargetCropland")); - -elseif s30_snv_shr > s30_snv_relocation_data_x1, -m_linear_cell_data_interpol(i30_snv_relocation_target, s30_snv_shr,s30_snv_relocation_data_x1, s30_snv_relocation_data_x2,f30_snv_target_cropland(j, "SNV20TargetCropland"), f30_snv_target_cropland(j, "SNV50TargetCropland")); -); - -*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 deleted file mode 100644 index d7fb95e8af..0000000000 --- a/modules/30_crop/endo_apr21/presolve.gms +++ /dev/null @@ -1,59 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-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))); - -*' Cropland relocation in response to SNV policy is based on exogeneous land -*' cover information from the Copernicus Global Land Service (@buchhorn_copernicus_2020). -*' The rate of the policy implementation is derived based -*' on the difference of scenario fader values in consecutive time steps -p30_snv_relocation(t,j) = (p30_snv_scenario_fader(t) - p30_snv_scenario_fader(t-1)) * - (i30_snv_relocation_target(j) * sum(cell(i,j), p30_country_snv_weight(i)) - + s30_snv_shr_noselect * sum(cell(i,j), 1-p30_country_snv_weight(i))); -*' The following lines take care of mismatches in the input -*' data (derived from satellite imagery from the Copernicus -*' Global Land Service (@buchhorn_copernicus_2020)) and in -*' cases of cropland reduction -p30_max_snv_relocation(t,j) = p30_snv_shr(t,j) * (p30_snv_scenario_fader(t) - p30_snv_scenario_fader(t-1)) * pcm_land(j,"crop"); -p30_snv_relocation(t,j)$(p30_snv_relocation(t, j) > p30_max_snv_relocation(t,j)) = p30_max_snv_relocation(t,j); - -*' Area potentially available for cropping -p30_avl_cropland(t,j) = f30_avl_cropland(j,"%c30_marginal_land%") * (1 - p30_snv_shr(t,j)); -*' @stop - -*' Cropland growth constraint after SSP2 fix -if(m_year(t) <= sm_fix_SSP2, - v30_crop_area.up(i) = Inf; -else - v30_crop_area.up(i) = v30_crop_area.l(i) * (1 + s30_annual_max_growth) ** m_yeardiff(t); -); diff --git a/modules/30_crop/endo_apr21/realization.gms b/modules/30_crop/endo_apr21/realization.gms deleted file mode 100644 index af702a13ba..0000000000 --- a/modules/30_crop/endo_apr21/realization.gms +++ /dev/null @@ -1,35 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-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 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 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_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/penalty_apr22/equations.gms b/modules/30_crop/penalty_apr22/equations.gms deleted file mode 100644 index da1b55f9c0..0000000000 --- a/modules/30_crop/penalty_apr22/equations.gms +++ /dev/null @@ -1,117 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-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 -*' the land area for crops vm_land and the croparea 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)); - -*' The semi-natural vegetation constraint for cropland areas has been suggested at the per square -*' kilometer scale. The amount of cropland requiring relocation has therefore been derived from -*' exogeneous high-resolution land cover information from the Copernicus Global Land Service -*' (@buchhorn_copernicus_2020). - - q30_land_snv_trans(j2) .. - sum(land_snv, vm_lu_transitions(j2,"crop",land_snv)) =g= sum(ct, p30_snv_relocation(ct,j2)); - -*' 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); - -*' regional cropland area is calculated for the cropland growth constraint - q30_crop_reg(i2) .. v30_crop_area(i2) - =e= - sum((cell(i2,j2), kcr, w), vm_area(j2,kcr,w)); diff --git a/modules/30_crop/penalty_apr22/preloop.gms b/modules/30_crop/penalty_apr22/preloop.gms deleted file mode 100644 index a5b75b7935..0000000000 --- a/modules/30_crop/penalty_apr22/preloop.gms +++ /dev/null @@ -1,46 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-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_time_interpol(p30_snv_scenario_fader,s30_snv_scenario_start,s30_snv_scenario_target,0,1); -m_sigmoid_time_interpol(p30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1); - -* linear interpolation to estimate the cropland that -* requires relocation due to SNV policy -if (s30_snv_shr = 0, -i30_snv_relocation_target(j) = 0; - -elseif s30_snv_shr <= s30_snv_relocation_data_x1, -m_linear_cell_data_interpol(i30_snv_relocation_target, s30_snv_shr,0,s30_snv_relocation_data_x1,0, f30_snv_target_cropland(j, "SNV20TargetCropland")); - -elseif s30_snv_shr > s30_snv_relocation_data_x1, -m_linear_cell_data_interpol(i30_snv_relocation_target, s30_snv_shr,s30_snv_relocation_data_x1, s30_snv_relocation_data_x2,f30_snv_target_cropland(j, "SNV20TargetCropland"), f30_snv_target_cropland(j, "SNV50TargetCropland")); -); - - -** 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 deleted file mode 100644 index 4d3b6a1f64..0000000000 --- a/modules/30_crop/penalty_apr22/presolve.gms +++ /dev/null @@ -1,55 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-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))); - -*' Cropland relocation in response to SNV policy is based on exogeneous land -*' cover information from the Copernicus Global Land Service (@buchhorn_copernicus_2020). -*' The rate of the policy implementation is derived based -*' on the difference of scenario fader values in consecutive time steps -p30_snv_relocation(t,j) = (p30_snv_scenario_fader(t) - p30_snv_scenario_fader(t-1)) * - (i30_snv_relocation_target(j) * sum(cell(i,j), p30_country_snv_weight(i)) - + s30_snv_shr_noselect * sum(cell(i,j), 1-p30_country_snv_weight(i))); -*' The following lines take care of mismatches in the input -*' data (derived from satellite imagery from the Copernicus -*' Global Land Service (@buchhorn_copernicus_2020)) and in -*' cases of cropland reduction -p30_max_snv_relocation(t,j) = p30_snv_shr(t,j) * (p30_snv_scenario_fader(t) - p30_snv_scenario_fader(t-1)) * pcm_land(j,"crop"); -p30_snv_relocation(t,j)$(p30_snv_relocation(t, j) > p30_max_snv_relocation(t,j)) = p30_max_snv_relocation(t,j); - -*' 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); - -*' Cropland growth constraint after SSP2 fix -if(m_year(t) <= sm_fix_SSP2, - v30_crop_area.up(i) = Inf; -else - v30_crop_area.up(i) = v30_crop_area.l(i) * (1 + s30_annual_max_growth) ** m_yeardiff(t); -); diff --git a/modules/30_crop/penalty_apr22/realization.gms b/modules/30_crop/penalty_apr22/realization.gms deleted file mode 100644 index 993a8d461a..0000000000 --- a/modules/30_crop/penalty_apr22/realization.gms +++ /dev/null @@ -1,40 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-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 deleted file mode 100644 index 91881757d7..0000000000 --- a/modules/30_crop/penalty_apr22/sets.gms +++ /dev/null @@ -1,95 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-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 / - - relocation_target30 Cropland requiring relocation based on different SNV targets - / SNV20TargetCropland, SNV50TargetCropland / -; diff --git a/modules/30_crop/rotation_apr22/declarations.gms b/modules/30_crop/rotation_apr22/declarations.gms deleted file mode 100644 index cc3cca87f7..0000000000 --- a/modules/30_crop/rotation_apr22/declarations.gms +++ /dev/null @@ -1,67 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-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) - i30_snv_relocation_target(j) Overall cropland area that requires relocation due SNV policy (mio. ha) - p30_snv_relocation(t,j) Cropland area that is actually relocated during time step (mio. ha) - p30_max_snv_relocation(t,j) Maximum cropland relocation during time step (mio. ha) - p30_country_dummy(iso) Dummy parameter indicating whether country is affected by selected cropland 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) - v30_crop_area(i) Total regional crop production area (mio. ha) -; - -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) - q30_crop_reg(i) Total regional crop production area (mio. ha) - q30_land_snv_trans(j) Land transition constraint for 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) - ov30_crop_area(t,i,type) Total regional crop production area (mio. ha) - 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) - oq30_crop_reg(t,i,type) Total regional crop production area (mio. ha) - oq30_land_snv_trans(t,j,type) Land transition constraint for 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 deleted file mode 100644 index 0ffafca291..0000000000 --- a/modules/30_crop/rotation_apr22/equations.gms +++ /dev/null @@ -1,98 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-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 -*' the land area for crops vm_land and the croparea 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)); - -*' The semi-natural vegetation constraint for cropland areas has been suggested at the per square -*' kilometer scale. The amount of cropland requiring relocation has therefore been derived from -*' exogeneous high-resolution land cover information from the Copernicus Global Land Service -*' (@buchhorn_copernicus_2020). - - q30_land_snv_trans(j2) .. - sum(land_snv, vm_lu_transitions(j2,"crop",land_snv)) =g= sum(ct, p30_snv_relocation(ct,j2)); - -*' 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); - -*' regional cropland area is calculated for the cropland growth constraint - q30_crop_reg(i2) .. v30_crop_area(i2) - =e= - sum((cell(i2,j2), kcr, w), vm_area(j2,kcr,w)); diff --git a/modules/30_crop/rotation_apr22/input.gms b/modules/30_crop/rotation_apr22/input.gms deleted file mode 100644 index f7b3c06424..0000000000 --- a/modules/30_crop/rotation_apr22/input.gms +++ /dev/null @@ -1,128 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-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 / -s30_annual_max_growth Max annual cropland growth as share of previous cropland (1) / Inf / -s30_snv_relocation_data_x1 First reference value in SNV target cropland data (1) / 0.2 / -s30_snv_relocation_data_x2 Second reference value in SNV target cropland data (1) / 0.5 / -; - -* 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 -; - -********* SNV TARGET CROPLAND ******************************************* - -table f30_snv_target_cropland(j,relocation_target30) Cropland in 2019 requiring relocation due to SNV policy (mio. ha) -$ondelim -$include "./modules/30_crop/rotation_apr22/input/SNVTargetCropland.cs3" -$offdelim -; diff --git a/modules/30_crop/rotation_apr22/input/files b/modules/30_crop/rotation_apr22/input/files deleted file mode 100644 index 6fe1594cf5..0000000000 --- a/modules/30_crop/rotation_apr22/input/files +++ /dev/null @@ -1,9 +0,0 @@ -* 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 -SNVTargetCropland.cs3 -SNVTargetCropland_0.5.mz diff --git a/modules/30_crop/rotation_apr22/postsolve.gms b/modules/30_crop/rotation_apr22/postsolve.gms deleted file mode 100644 index b501b40db1..0000000000 --- a/modules/30_crop/rotation_apr22/postsolve.gms +++ /dev/null @@ -1,74 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-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_crop_area(t,i,"marginal") = v30_crop_area.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); - oq30_crop_reg(t,i,"marginal") = q30_crop_reg.m(i); - oq30_land_snv_trans(t,j,"marginal") = q30_land_snv_trans.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_crop_area(t,i,"level") = v30_crop_area.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); - oq30_crop_reg(t,i,"level") = q30_crop_reg.l(i); - oq30_land_snv_trans(t,j,"level") = q30_land_snv_trans.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_crop_area(t,i,"upper") = v30_crop_area.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); - oq30_crop_reg(t,i,"upper") = q30_crop_reg.up(i); - oq30_land_snv_trans(t,j,"upper") = q30_land_snv_trans.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_crop_area(t,i,"lower") = v30_crop_area.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); - oq30_crop_reg(t,i,"lower") = q30_crop_reg.lo(i); - oq30_land_snv_trans(t,j,"lower") = q30_land_snv_trans.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 deleted file mode 100644 index c6dd29d8d5..0000000000 --- a/modules/30_crop/rotation_apr22/preloop.gms +++ /dev/null @@ -1,51 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-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_time_interpol(p30_snv_scenario_fader,s30_snv_scenario_start,s30_snv_scenario_target,0,1); -m_sigmoid_time_interpol(p30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1); - -* linear interpolation to estimate the cropland that -* requires relocation due to SNV policy -if (s30_snv_shr = 0, -i30_snv_relocation_target(j) = 0; - -elseif s30_snv_shr <= s30_snv_relocation_data_x1, -m_linear_cell_data_interpol(i30_snv_relocation_target, s30_snv_shr,0,s30_snv_relocation_data_x1,0, f30_snv_target_cropland(j, "SNV20TargetCropland")); - -elseif s30_snv_shr > s30_snv_relocation_data_x1, -m_linear_cell_data_interpol(i30_snv_relocation_target, s30_snv_shr,s30_snv_relocation_data_x1, s30_snv_relocation_data_x2,f30_snv_target_cropland(j, "SNV20TargetCropland"), f30_snv_target_cropland(j, "SNV50TargetCropland")); -); - -** 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 deleted file mode 100644 index 05b99e4ed5..0000000000 --- a/modules/30_crop/rotation_apr22/presolve.gms +++ /dev/null @@ -1,56 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-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))); - -*' Cropland relocation in response to SNV policy is based on exogeneous land -*' cover information from the Copernicus Global Land Service (@buchhorn_copernicus_2020). -*' The rate of the policy implementation is derived based -*' on the difference of scenario fader values in consecutive time steps -p30_snv_relocation(t,j) = (p30_snv_scenario_fader(t) - p30_snv_scenario_fader(t-1)) * - (i30_snv_relocation_target(j) * sum(cell(i,j), p30_country_snv_weight(i)) - + s30_snv_shr_noselect * sum(cell(i,j), 1-p30_country_snv_weight(i))); -*' The following lines take care of mismatches in the input -*' data (derived from satellite imagery) and in -*' cases of cropland reduction -p30_max_snv_relocation(t,j) = p30_snv_shr(t,j) * (p30_snv_scenario_fader(t) - p30_snv_scenario_fader(t-1)) * pcm_land(j,"crop"); -p30_snv_relocation(t,j)$(p30_snv_relocation(t, j) > p30_max_snv_relocation(t,j)) = p30_max_snv_relocation(t,j); - -*' 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; - -*' Cropland growth constraint after SSP2 fix -if(m_year(t) <= sm_fix_SSP2, - v30_crop_area.up(i) = Inf; -else - v30_crop_area.up(i) = v30_crop_area.l(i) * (1 + s30_annual_max_growth) ** m_yeardiff(t); -); diff --git a/modules/30_crop/rotation_apr22/realization.gms b/modules/30_crop/rotation_apr22/realization.gms deleted file mode 100644 index 3e2f37077f..0000000000 --- a/modules/30_crop/rotation_apr22/realization.gms +++ /dev/null @@ -1,41 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-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/penalty_apr22/declarations.gms b/modules/30_croparea/detail_apr24/declarations.gms similarity index 60% rename from modules/30_crop/penalty_apr22/declarations.gms rename to modules/30_croparea/detail_apr24/declarations.gms index c577f9d864..749c03c37b 100644 --- a/modules/30_crop/penalty_apr22/declarations.gms +++ b/modules/30_croparea/detail_apr24/declarations.gms @@ -6,66 +6,63 @@ *** | 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) - i30_snv_relocation_target(j) Overall cropland area that requires relocation due to SNV policy (mio. ha) - p30_snv_relocation(t,j) Cropland area that is actually relocated during time step (mio. ha) - p30_max_snv_relocation(t,j) Maximum cropland relocation during time step (mio. ha) - p30_country_dummy(iso) Dummy parameter indicating whether country is affected by selected cropland policy (1) - i30_avl_cropland_iso(iso) Available land area for cropland at ISO level (mio. ha) + i30_rotation_rules(t_all,rota30) Rotational constraints (1) 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) + i30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) + i30_implementation Switch for rule-based (1) or penalty-based (0) implementation of rotation scenarios + i30_betr_scenario_fader(t_all) Bioenergy land scenario fader (1) + i30_betr_target(t,j) Target share for bioenergy land on total cropland (1) + i30_betr_penalty(t) Penalty for violation of betr target (USD05MER per ha) + p30_country_weight(i) Policy country weight per region (1) + p30_country_dummy(iso) Dummy parameter indicating whether country is affected by selected policy (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) + vm_carbon_stock_croparea(j,ag_pools) Carbon stock in croparea (tC) 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) + v30_penalty(j,rota30) Penalty for violating rotational constraints (mio. USD05MER) + v30_betr_missing(j) Missing bioenergy tree land towards target (mio. ha) v30_crop_area(i) Total regional crop production area (mio. ha) ; equations - q30_cropland(j) Total cropland calculation (mio. ha) - q30_avl_cropland(j) Available cropland constraint (mio. ha) + q30_prod(j,kcr) Production of cropped products (mio. tDM) + q30_betr_missing(j) Missing bioenergy tree land towards target (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_max2(j,rotamax30) Local maximum rotational constraints (mio. ha) + q30_rotation_min2(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_carbon(j,ag_pools) Croplarea 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) q30_crop_reg(i) Total regional crop production area (mio. ha) - q30_land_snv_trans(j) Land transition constraint for 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) + ov_carbon_stock_croparea(t,j,ag_pools,type) Carbon stock in croparea (tC) 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) + ov30_betr_missing(t,j,type) Missing bioenergy tree land towards target (mio. ha) ov30_crop_area(t,i,type) Total regional crop production area (mio. ha) - oq30_cropland(t,j,type) Total cropland calculation (mio. ha) - oq30_avl_cropland(t,j,type) Available cropland constraint (mio. ha) + oq30_prod(t,j,kcr,type) Production of cropped products (mio. tDM) + oq30_betr_missing(t,j,type) Missing bioenergy tree land towards target (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_max2(t,j,rotamax30,type) Local maximum rotational constraints (mio. ha) + oq30_rotation_min2(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_carbon(t,j,ag_pools,type) Croplarea 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) oq30_crop_reg(t,i,type) Total regional crop production area (mio. ha) - oq30_land_snv_trans(t,j,type) Land transition constraint for SNV policy in cropland areas (mio. ha) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/30_croparea/detail_apr24/equations.gms b/modules/30_croparea/detail_apr24/equations.gms new file mode 100644 index 0000000000..2015529b0d --- /dev/null +++ b/modules/30_croparea/detail_apr24/equations.gms @@ -0,0 +1,107 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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 + +*' 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)); + +*' A penalty is applied for the violation of bioenergy tree (betr) rules. +*' The penalty applies to the missing bioenergy tree land, i.e. where bioenergy tree land +*' is lower than a certain fraction of total cropland. + + q30_betr_missing(j2)$(sum(ct, i30_betr_penalty(ct)) > 0) .. + v30_betr_missing(j2) =g= + vm_land(j2,"crop") * sum(ct, i30_betr_target(ct,j2)) - vm_area(j2,"betr","rainfed"); + +*' Rotational constraints prevent over-specialization. In this realization, +*' they are either implemented via rules (i30_implementation = 1) or +*' a penalty payment if the constraints are violated (i30_implementation = 0). + +*' Rule-based rotational constraints (i30_implementation = 1): + +*' Minimum and maximum rotational constraints limit +*' the placing of crops. 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)$(i30_implementation = 1) .. + sum((rota_kcr30(rotamax_red30,kcr),w), vm_area(j2,kcr,w)) =l= + sum((kcr,w),vm_area(j2,kcr,w)) * sum(ct,i30_rotation_rules(ct,rotamax_red30)); + + q30_rotation_min(j2,rotamin_red30)$(i30_implementation = 1) .. + sum((rota_kcr30(rotamin_red30,kcr),w), vm_area(j2,kcr,w)) =g= + sum((kcr,w),vm_area(j2,kcr,w)) * sum(ct,i30_rotation_rules(ct,rotamin_red30)); + +* 'Penalty-based rotational constraints (i30_implementation = 0): + + 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))) + + v30_betr_missing(j2) * sum(ct, i30_betr_penalty(ct)) + ); + +*' 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_max2(j2,rotamax_red30)$(i30_implementation = 0) .. + v30_penalty(j2,rotamax_red30) =g= + sum((rota_kcr30(rotamax_red30,kcr),w),vm_area(j2,kcr,w)) + - sum((kcr,w),vm_area(j2,kcr,w)) * sum(ct,i30_rotation_rules(ct,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_min2(j2,rotamin_red30)$(i30_implementation = 0) .. + v30_penalty(j2,rotamin_red30) =g= + sum((kcr,w),vm_area(j2,kcr,w)) * sum(ct,i30_rotation_rules(ct,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) * sum(ct,i30_rotation_rules(ct,rotamax_red30)); + + +*' The carbon stocks of the above ground carbon pools are calculated based on croparea and related carbon density. + + q30_carbon(j2,ag_pools) .. + vm_carbon_stock_croparea(j2,ag_pools) =e= + sum((kcr,w), vm_area(j2,kcr,w)) * sum(ct, fm_carbon_density(ct,j2,"crop",ag_pools)); + + +*' 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); + + 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); + + +*' regional cropland area is calculated for the cropland growth constraint + q30_crop_reg(i2) .. v30_crop_area(i2) + =e= + sum((cell(i2,j2), kcr, w), vm_area(j2,kcr,w)); diff --git a/modules/30_crop/penalty_apr22/input.gms b/modules/30_croparea/detail_apr24/input.gms similarity index 52% rename from modules/30_crop/penalty_apr22/input.gms rename to modules/30_croparea/detail_apr24/input.gms index 540f7df5ea..47c979fc0e 100644 --- a/modules/30_crop/penalty_apr22/input.gms +++ b/modules/30_croparea/detail_apr24/input.gms @@ -11,37 +11,32 @@ $setglobal c30_bioen_type 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_rotation_rules default +*options: min, default, good, good_20div, setaside, legumes, sixfoldrotation, agroecology, FSEC -$setglobal c30_snv_target none -* options: none, by2030, by2020 +$setglobal c30_rotation_incentives none +*options: none, default, legumes, agroecology -$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 / -s30_annual_max_growth Max annual cropland growth as share of previous cropland (1) / Inf / -s30_snv_relocation_data_x1 First reference value in SNV target cropland data (1) / 0.2 / -s30_snv_relocation_data_x2 Second reference value in SNV target cropland data (1) / 0.5 / + s30_rotation_scenario_start Rotation scenario start year / 2025 / + s30_rotation_scenario_target Rotation scenario target year / 2050 / + s30_implementation Switch for rule-based (1) or penalty-based (0) implementation of rotation scenarios / 1 / + s30_betr_scenario_start Bioenergy land scenario start year / 2025 / + s30_betr_scenario_target Bioenergy land scenario target year / 2050 / + s30_betr_start Share of bioenergy land on total cropland in start year (1) / 0 / + s30_betr_start_noselect Share of bioenergy land on total cropland in start year (1) / 0 / + s30_betr_target Share of bioenergy land on total cropland in target year (1) / 0 / + s30_betr_target_noselect Share of bioenergy land on total cropland in target year (1) / 0 / + s30_betr_penalty Penalty for violation of betr target (USD05MER per ha) / 2000 / + s30_annual_max_growth Max annual cropland growth as share of previous cropland (1) / Inf / ; -* Set-switch for countries affected by regional SNV policy +* Set-switch for countries affected by certain policies * 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, + 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, @@ -66,8 +61,6 @@ sets 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; @@ -82,46 +75,22 @@ $endif 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" +$include "./modules/30_croparea/detail_apr24/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) +table f30_rotation_incentives(rota30,incentscen30) penalties for violating rotation rules (USD05MER) $ondelim -$include "./modules/30_crop/penalty_apr22/input/f30_rotation_incentives.csv" +$include "./modules/30_croparea/detail_apr24/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) +table f30_rotation_rules(rota30,rotascen30) Rotation min or max shares (1) $ondelim -$include "./modules/30_crop/penalty_apr22/input/avl_cropland.cs3" +$include "./modules/30_croparea/detail_apr24/input/f30_rotation_rules.csv" $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 -; - -********* SNV TARGET CROPLAND ******************************************* - -table f30_snv_target_cropland(j,relocation_target30) Cropland in 2019 requiring relocation due to SNV policy (mio. ha) -$ondelim -$include "./modules/30_crop/penalty_apr22/input/SNVTargetCropland.cs3" -$offdelim -; diff --git a/modules/30_crop/penalty_apr22/input/files b/modules/30_croparea/detail_apr24/input/files similarity index 54% rename from modules/30_crop/penalty_apr22/input/files rename to modules/30_croparea/detail_apr24/input/files index b1795d1c21..5f3d3ac1e2 100644 --- a/modules/30_crop/penalty_apr22/input/files +++ b/modules/30_croparea/detail_apr24/input/files @@ -1,9 +1,4 @@ * 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 -SNVTargetCropland.cs3 -SNVTargetCropland_0.5.mz diff --git a/modules/30_crop/penalty_apr22/postsolve.gms b/modules/30_croparea/detail_apr24/postsolve.gms similarity index 70% rename from modules/30_crop/penalty_apr22/postsolve.gms rename to modules/30_croparea/detail_apr24/postsolve.gms index d1da0b193c..3c4c180418 100644 --- a/modules/30_crop/penalty_apr22/postsolve.gms +++ b/modules/30_croparea/detail_apr24/postsolve.gms @@ -7,80 +7,80 @@ *#################### 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); + ov_carbon_stock_croparea(t,j,ag_pools,"marginal") = vm_carbon_stock_croparea.m(j,ag_pools); 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); + ov30_betr_missing(t,j,"marginal") = v30_betr_missing.m(j); ov30_crop_area(t,i,"marginal") = v30_crop_area.m(i); - oq30_cropland(t,j,"marginal") = q30_cropland.m(j); - oq30_avl_cropland(t,j,"marginal") = q30_avl_cropland.m(j); + oq30_prod(t,j,kcr,"marginal") = q30_prod.m(j,kcr); + oq30_betr_missing(t,j,"marginal") = q30_betr_missing.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_max2(t,j,rotamax30,"marginal") = q30_rotation_max2.m(j,rotamax30); + oq30_rotation_min2(t,j,rotamin30,"marginal") = q30_rotation_min2.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_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); - oq30_land_snv(t,j,"marginal") = q30_land_snv.m(j); oq30_crop_reg(t,i,"marginal") = q30_crop_reg.m(i); - oq30_land_snv_trans(t,j,"marginal") = q30_land_snv_trans.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); + ov_carbon_stock_croparea(t,j,ag_pools,"level") = vm_carbon_stock_croparea.l(j,ag_pools); 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); + ov30_betr_missing(t,j,"level") = v30_betr_missing.l(j); ov30_crop_area(t,i,"level") = v30_crop_area.l(i); - oq30_cropland(t,j,"level") = q30_cropland.l(j); - oq30_avl_cropland(t,j,"level") = q30_avl_cropland.l(j); + oq30_prod(t,j,kcr,"level") = q30_prod.l(j,kcr); + oq30_betr_missing(t,j,"level") = q30_betr_missing.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_max2(t,j,rotamax30,"level") = q30_rotation_max2.l(j,rotamax30); + oq30_rotation_min2(t,j,rotamin30,"level") = q30_rotation_min2.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_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); - oq30_land_snv(t,j,"level") = q30_land_snv.l(j); oq30_crop_reg(t,i,"level") = q30_crop_reg.l(i); - oq30_land_snv_trans(t,j,"level") = q30_land_snv_trans.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); + ov_carbon_stock_croparea(t,j,ag_pools,"upper") = vm_carbon_stock_croparea.up(j,ag_pools); 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); + ov30_betr_missing(t,j,"upper") = v30_betr_missing.up(j); ov30_crop_area(t,i,"upper") = v30_crop_area.up(i); - oq30_cropland(t,j,"upper") = q30_cropland.up(j); - oq30_avl_cropland(t,j,"upper") = q30_avl_cropland.up(j); + oq30_prod(t,j,kcr,"upper") = q30_prod.up(j,kcr); + oq30_betr_missing(t,j,"upper") = q30_betr_missing.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_max2(t,j,rotamax30,"upper") = q30_rotation_max2.up(j,rotamax30); + oq30_rotation_min2(t,j,rotamin30,"upper") = q30_rotation_min2.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_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); - oq30_land_snv(t,j,"upper") = q30_land_snv.up(j); oq30_crop_reg(t,i,"upper") = q30_crop_reg.up(i); - oq30_land_snv_trans(t,j,"upper") = q30_land_snv_trans.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); + ov_carbon_stock_croparea(t,j,ag_pools,"lower") = vm_carbon_stock_croparea.lo(j,ag_pools); 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); + ov30_betr_missing(t,j,"lower") = v30_betr_missing.lo(j); ov30_crop_area(t,i,"lower") = v30_crop_area.lo(i); - oq30_cropland(t,j,"lower") = q30_cropland.lo(j); - oq30_avl_cropland(t,j,"lower") = q30_avl_cropland.lo(j); + oq30_prod(t,j,kcr,"lower") = q30_prod.lo(j,kcr); + oq30_betr_missing(t,j,"lower") = q30_betr_missing.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_max2(t,j,rotamax30,"lower") = q30_rotation_max2.lo(j,rotamax30); + oq30_rotation_min2(t,j,rotamin30,"lower") = q30_rotation_min2.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_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); - oq30_land_snv(t,j,"lower") = q30_land_snv.lo(j); oq30_crop_reg(t,i,"lower") = q30_crop_reg.lo(i); - oq30_land_snv_trans(t,j,"lower") = q30_land_snv_trans.lo(j); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/30_croparea/detail_apr24/preloop.gms b/modules/30_croparea/detail_apr24/preloop.gms new file mode 100644 index 0000000000..cdef528e7f --- /dev/null +++ b/modules/30_croparea/detail_apr24/preloop.gms @@ -0,0 +1,41 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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_time_interpol(i30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1); +m_sigmoid_time_interpol(i30_betr_scenario_fader,s30_betr_scenario_start,s30_betr_scenario_target,0,1); + +** Fader for rotational constraints +i30_rotation_rules(t_all,rota30) = + f30_rotation_rules(rota30,"default") * (1-i30_rotation_scenario_fader(t_all)) + + f30_rotation_rules(rota30,"%c30_rotation_rules%") * (i30_rotation_scenario_fader(t_all)); + +** Fader for penalty for violating rotational constraints +i30_rotation_incentives(t_all,rota30) = + f30_rotation_incentives(rota30,"default") * (1-i30_rotation_scenario_fader(t_all)) + + f30_rotation_incentives(rota30,"%c30_rotation_incentives%") * (i30_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; + +* fix penalty to zero in case of rule-based rotational contraints +if(s30_implementation = 1, + v30_penalty.fx(j,rota30) = 0; +); + +* Country switch to determine countries for which certain policies shall be applied. +* In the default case, the 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. +p30_country_weight(i) = sum(i_to_iso(i,iso), p30_country_dummy(iso) * pm_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), pm_avl_cropland_iso(iso)); diff --git a/modules/30_croparea/detail_apr24/presolve.gms b/modules/30_croparea/detail_apr24/presolve.gms new file mode 100644 index 0000000000..c110499ec6 --- /dev/null +++ b/modules/30_croparea/detail_apr24/presolve.gms @@ -0,0 +1,61 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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. +*' In addition, rule-based rotational constraints (i30_implementation = 1) +*' are assumed for the historic period. +if(m_year(t) <= sm_fix_SSP2, + vm_area.up(j,kbe30,"rainfed") = Inf; + i30_implementation = 1; +else + vm_area.up(j,bioen_type_30,bioen_water_30) = Inf; + i30_implementation = s30_implementation; +); +*' @stop + +* only activate constraints which are binding +if (i30_implementation = 1, + rotamax_red30(rotamax30) = yes$(i30_rotation_rules(t,rotamax30) < 1); + rotamin_red30(rotamin30) = yes$(i30_rotation_rules(t,rotamin30) > 0); +else + rotamax_red30(rotamax30) = yes$(i30_rotation_incentives(t,rotamax30) > 0); + rotamin_red30(rotamin30) = yes$(i30_rotation_incentives(t,rotamin30) > 0); +); + +* create betr target and penalty scenario +i30_betr_target(t,j) = (1-i30_betr_scenario_fader(t)) * + (s30_betr_start * sum(cell(i,j), p30_country_weight(i)) + + s30_betr_start_noselect * sum(cell(i,j), 1-p30_country_weight(i))) + + i30_betr_scenario_fader(t) * + (s30_betr_target * sum(cell(i,j), p30_country_weight(i)) + + s30_betr_target_noselect * sum(cell(i,j), 1-p30_country_weight(i))); + +if (m_year(t) <= s30_betr_scenario_start, + i30_betr_penalty(t) = 0; + v30_betr_missing.fx(j) = 0; +else + i30_betr_penalty(t) = s30_betr_penalty; + if (i30_betr_penalty(t) > 0, + v30_betr_missing.lo(j) = 0; + v30_betr_missing.up(j) = Inf; + else + v30_betr_missing.fx(j) = 0; + ); +); + +*' Cropland growth constraint after SSP2 fix +if(m_year(t) <= sm_fix_SSP2, + v30_crop_area.up(i) = Inf; +else + v30_crop_area.up(i) = v30_crop_area.l(i) * (1 + s30_annual_max_growth) ** m_yeardiff(t); +); diff --git a/modules/30_croparea/detail_apr24/realization.gms b/modules/30_croparea/detail_apr24/realization.gms new file mode 100644 index 0000000000..42d40a5156 --- /dev/null +++ b/modules/30_croparea/detail_apr24/realization.gms @@ -0,0 +1,33 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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 crop specific +*' agricultural crop area endogenously based on yield data provided by +*' module [14_yields] and detailed rotational constraints. +*' In addition, corresponding carbons stocks and BII values are calculated. +*' +*' The crop specific interface `vm_area` is used in many other modules, +*' including [18_residues], [38_factor_costs], +*' [41_area_equipped_for_irrigation], [42_water_demand], [50_nr_soil_budget], +*' [53_methane] and [59_som]. +*' +*' This realization allows for different scenarios of rotational +*' constraints which are either implemented via hard constraints or penalty payments +*' if constraints are exceeded. Rotational constraints are defined for total croparea +*' as well as for irrigated areas only to avoid overspecialization on irrigated land. + +*' @limitations There are currently no known limitations of this realization. + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/30_croparea/detail_apr24/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/30_croparea/detail_apr24/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/30_croparea/detail_apr24/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/30_croparea/detail_apr24/equations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/30_croparea/detail_apr24/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/30_croparea/detail_apr24/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/30_croparea/detail_apr24/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/30_crop/rotation_apr22/sets.gms b/modules/30_croparea/detail_apr24/sets.gms similarity index 54% rename from modules/30_crop/rotation_apr22/sets.gms rename to modules/30_croparea/detail_apr24/sets.gms index 72b3040f6a..ff7210ef89 100644 --- a/modules/30_crop/rotation_apr22/sets.gms +++ b/modules/30_croparea/detail_apr24/sets.gms @@ -6,24 +6,36 @@ *** | Contact: magpie@pik-potsdam.de sets + incentscen30 rotation inventive scenarios + / none, default, legumes, agroecology / + rotascen30 rotation constraint scenarios - /min,default,good,good_20div,setaside,legumes,agroforestry,sixfoldrotation,agroecology/ + / min, default, good, good_20div, setaside, legumes, sixfoldrotation, agroecology, FSEC / - rotamax30 Maximum crop rotation categories - / all_max, cereals_excl_rice_max, stalk_max, - biomass_max, roots_max, legume_max, rape_sugr_max, + rota30 rotational rules + / cereals1_max, cereals2_max, cereals_excl_rice_max, stalk_max, + resistant_max, oilcrops_max, + legumes_max, rootsrape_max, roots_max, rape_sugr_max, biomass_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 - / + biomass_min, legumes_min, stalk_min, others_min, + minor_min, cereals_min / + + rotamax30(rota30) rotational maximum rules + / cereals1_max, cereals2_max, cereals_excl_rice_max, stalk_max, + resistant_max, oilcrops_max, + legumes_max, rootsrape_max, roots_max, rape_sugr_max, biomass_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 - / + rotamin30(rota30) rotational minimum rules + / biomass_min, legumes_min, stalk_min, others_min, minor_min, cereals_min / rotamax_red30(rotamax30) Maximum crop rotation reduced set rotamin_red30(rotamin30) Minimum crop rotation reduced set @@ -41,16 +53,18 @@ sets * 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) + rota_kcr30(rota30, kcr) Mapping of crop types into crop rotation types + / cereals1_max . (tece, maiz, trce, rice_pro) + cereals2_max . (tece, maiz, trce, rice_pro) 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) + stalk_max . (tece, maiz, trce, rice_pro, sugr_cane, begr, foddr) + 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) + roots_max . (sugr_beet, cassav_sp, potato) + rape_sugr_max . (rapeseed, sugr_beet) + biomass_max . (sugr_cane, oilpalm, begr, betr) tece_max . (tece) maiz_max . (maiz) @@ -70,19 +84,15 @@ sets 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) - / + betr_max . (betr) + 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) + stalk_min . (tece, maiz, trce, rice_pro, sugr_cane, foddr) + others_min . (others) + / kbe30(kcr) bio energy activities / betr, begr / @@ -96,12 +106,4 @@ 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 / - - relocation_target30 Cropland requiring relocation based on different SNV targets - / SNV20TargetCropland, SNV50TargetCropland / ; diff --git a/modules/30_crop/module.gms b/modules/30_croparea/module.gms similarity index 76% rename from modules/30_crop/module.gms rename to modules/30_croparea/module.gms index 2c80e2a8db..3b8eedc704 100644 --- a/modules/30_crop/module.gms +++ b/modules/30_croparea/module.gms @@ -15,7 +15,6 @@ *' @authors Jan Philipp Dietrich, Florian Humpenöder, Benjamin Bodirsky *###################### R SECTION START (MODULETYPES) ########################## -$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" +$Ifi "%croparea%" == "detail_apr24" $include "./modules/30_croparea/detail_apr24/realization.gms" +$Ifi "%croparea%" == "simple_apr24" $include "./modules/30_croparea/simple_apr24/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/30_croparea/simple_apr24/declarations.gms b/modules/30_croparea/simple_apr24/declarations.gms new file mode 100644 index 0000000000..cc118fa84a --- /dev/null +++ b/modules/30_croparea/simple_apr24/declarations.gms @@ -0,0 +1,56 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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 + i30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) + i30_betr_scenario_fader(t_all) Bioenergy land scenario fader (1) + i30_betr_target(t,j) Target share for bioenergy land on total cropland (1) + i30_betr_penalty(t) Penalty for violation of betr target (USD05MER per ha) + p30_country_weight(i) Policy country weight per region (1) + p30_country_dummy(iso) Dummy parameter indicating whether country is affected by selected policy (1) +; + +positive variables + vm_area(j,kcr,w) Agricultural production area (mio. ha) + vm_rotation_penalty(i) Penalty for violating rotational constraints (mio. USD05MER) + vm_carbon_stock_croparea(j,ag_pools) Carbon stock in croparea (tC) + v30_betr_missing(j) Missing bioenergy tree land towards target (mio. ha) + v30_crop_area(i) Total regional crop production area (mio. ha) +; + +equations + q30_prod(j,kcr) Production of cropped products (mio. tDM) + q30_betr_missing(j) Missing bioenergy tree land towards target (mio. ha) + q30_cost(i) Cost (mio. USD05MER) + 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_carbon(j,ag_pools) Croplarea 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_crop_reg(i) Total regional crop production area (mio. ha) +; + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + 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) + ov_carbon_stock_croparea(t,j,ag_pools,type) Carbon stock in croparea (tC) + ov30_betr_missing(t,j,type) Missing bioenergy tree land towards target (mio. ha) + ov30_crop_area(t,i,type) Total regional crop production area (mio. ha) + oq30_prod(t,j,kcr,type) Production of cropped products (mio. tDM) + oq30_betr_missing(t,j,type) Missing bioenergy tree land towards target (mio. ha) + oq30_cost(t,i,type) Cost (mio. USD05MER) + 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_carbon(t,j,ag_pools,type) Croplarea 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_crop_reg(t,i,type) Total regional crop production area (mio. ha) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### + +*** EOF declarations.gms *** diff --git a/modules/30_croparea/simple_apr24/equations.gms b/modules/30_croparea/simple_apr24/equations.gms new file mode 100644 index 0000000000..42f01c1794 --- /dev/null +++ b/modules/30_croparea/simple_apr24/equations.gms @@ -0,0 +1,68 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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 + +*' 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)); + +*' A penalty is applied for the violation of bioenergy tree (betr) rules. +*' The penalty applies to the missing bioenergy tree land, i.e. where bioenergy tree land +*' is lower than a certain fraction of total cropland. + + q30_betr_missing(j2)$(sum(ct, i30_betr_penalty(ct)) > 0) .. + v30_betr_missing(j2) =g= + vm_land(j2,"crop") * sum(ct, i30_betr_target(ct,j2)) - vm_area(j2,"betr","rainfed"); + + q30_cost(i2) .. + vm_rotation_penalty(i2) =g= + sum(cell(i2,j2), v30_betr_missing(j2) * sum(ct, i30_betr_penalty(ct))); + +*' 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,crpmax30,w) .. + sum((crp_kcr30(crpmax30,kcr)), vm_area(j2,kcr,w)) =l= + sum(kcr, vm_area(j2,kcr,w)) * f30_rotation_max_shr(crpmax30); + + +*' On the other hand, it reflects boundary conditions such as minimum self +*' sufficiency constraints: + + q30_rotation_min(j2,crpmin30,w) .. + sum((crp_kcr30(crpmin30,kcr)), vm_area(j2,kcr,w)) =g= + sum(kcr, vm_area(j2,kcr,w)) * f30_rotation_min_shr(crpmin30); + + +*' The carbon stocks of the above ground carbon pools are calculated based on croparea and related carbon density. + + q30_carbon(j2,ag_pools) .. + vm_carbon_stock_croparea(j2,ag_pools) =e= + sum((kcr,w), vm_area(j2,kcr,w)) * sum(ct, fm_carbon_density(ct,j2,"crop",ag_pools)); + + +*' 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); + + 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); + + +*' regional cropland area is calculated for the cropland growth constraint + q30_crop_reg(i2) .. v30_crop_area(i2) + =e= + sum((cell(i2,j2), kcr, w), vm_area(j2,kcr,w)); diff --git a/modules/30_crop/endo_apr21/input.gms b/modules/30_croparea/simple_apr24/input.gms similarity index 60% rename from modules/30_crop/endo_apr21/input.gms rename to modules/30_croparea/simple_apr24/input.gms index cd040e783b..e99a128cb0 100644 --- a/modules/30_crop/endo_apr21/input.gms +++ b/modules/30_croparea/simple_apr24/input.gms @@ -11,31 +11,27 @@ $setglobal c30_bioen_type 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_snv_relocation_data_x1 First reference value in SNV target cropland data (1) / 0.2 / -s30_snv_relocation_data_x2 Second reference value in SNV target cropland data (1) / 0.5 / -s30_rotation_scenario_start Rotation scenario start year / 2020 / -s30_rotation_scenario_target Rotation scenario target year / 2050 / -s30_annual_max_growth Max annual cropland growth as share of previous cropland (1) / Inf / + s30_rotation_scenario_start Rotation scenario start year / 2025 / + s30_rotation_scenario_target Rotation scenario target year / 2050 / + s30_betr_scenario_start Bioenergy land scenario start year / 2025 / + s30_betr_scenario_target Bioenergy land scenario target year / 2050 / + s30_betr_start Share of bioenergy land on total cropland in start year (1) / 0 / + s30_betr_start_noselect Share of bioenergy land on total cropland in start year (1) / 0 / + s30_betr_target Share of bioenergy land on total cropland in target year (1) / 0 / + s30_betr_target_noselect Share of bioenergy land on total cropland in target year (1) / 0 / + s30_betr_penalty Penalty for violation of betr target (USD05MER per ha) / 2000 / + s30_annual_max_growth Max annual cropland growth as share of previous cropland (1) / Inf / ; -* Set-switch for countries affected by regional SNV policy +* Set-switch for countries affected by certain policies * 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, + 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, @@ -60,8 +56,6 @@ sets 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; @@ -76,7 +70,7 @@ $endif 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" +$include "./modules/30_croparea/simple_apr24/input/f30_croparea_w_initialisation.cs3" $offdelim ; m_fillmissingyears(fm_croparea,"j,w,kcr"); @@ -86,7 +80,7 @@ m_fillmissingyears(fm_croparea,"j,w,kcr"); 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" +$include "./modules/30_croparea/simple_apr24/input/f30_rotation_max.csv" $offdelim /; $if "%c30_rotation_constraints%" == "off" f30_rotation_max_shr(crp30) = 1; @@ -95,31 +89,8 @@ $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" +$include "./modules/30_croparea/simple_apr24/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 -; - -********* SNV TARGET CROPLAND ******************************************* - -table f30_snv_target_cropland(j,relocation_target30) Cropland in 2019 requiring relocation due to SNV policy (mio. ha) -$ondelim -$include "./modules/30_crop/endo_apr21/input/SNVTargetCropland.cs3" -$offdelim -; diff --git a/modules/30_croparea/simple_apr24/input/files b/modules/30_croparea/simple_apr24/input/files new file mode 100644 index 0000000000..f87525bfbd --- /dev/null +++ b/modules/30_croparea/simple_apr24/input/files @@ -0,0 +1,4 @@ +* list of files that are required here +f30_rotation_max.csv +f30_rotation_min.csv +f30_croparea_w_initialisation.cs3 diff --git a/modules/30_crop/endo_apr21/not_used.txt b/modules/30_croparea/simple_apr24/not_used.txt similarity index 100% rename from modules/30_crop/endo_apr21/not_used.txt rename to modules/30_croparea/simple_apr24/not_used.txt diff --git a/modules/30_croparea/simple_apr24/postsolve.gms b/modules/30_croparea/simple_apr24/postsolve.gms new file mode 100644 index 0000000000..fe6f167e3e --- /dev/null +++ b/modules/30_croparea/simple_apr24/postsolve.gms @@ -0,0 +1,66 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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); + ov_rotation_penalty(t,i,"marginal") = vm_rotation_penalty.m(i); + ov_carbon_stock_croparea(t,j,ag_pools,"marginal") = vm_carbon_stock_croparea.m(j,ag_pools); + ov30_betr_missing(t,j,"marginal") = v30_betr_missing.m(j); + ov30_crop_area(t,i,"marginal") = v30_crop_area.m(i); + oq30_prod(t,j,kcr,"marginal") = q30_prod.m(j,kcr); + oq30_betr_missing(t,j,"marginal") = q30_betr_missing.m(j); + oq30_cost(t,i,"marginal") = q30_cost.m(i); + 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_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); + oq30_crop_reg(t,i,"marginal") = q30_crop_reg.m(i); + ov_area(t,j,kcr,w,"level") = vm_area.l(j,kcr,w); + ov_rotation_penalty(t,i,"level") = vm_rotation_penalty.l(i); + ov_carbon_stock_croparea(t,j,ag_pools,"level") = vm_carbon_stock_croparea.l(j,ag_pools); + ov30_betr_missing(t,j,"level") = v30_betr_missing.l(j); + ov30_crop_area(t,i,"level") = v30_crop_area.l(i); + oq30_prod(t,j,kcr,"level") = q30_prod.l(j,kcr); + oq30_betr_missing(t,j,"level") = q30_betr_missing.l(j); + oq30_cost(t,i,"level") = q30_cost.l(i); + 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_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); + oq30_crop_reg(t,i,"level") = q30_crop_reg.l(i); + ov_area(t,j,kcr,w,"upper") = vm_area.up(j,kcr,w); + ov_rotation_penalty(t,i,"upper") = vm_rotation_penalty.up(i); + ov_carbon_stock_croparea(t,j,ag_pools,"upper") = vm_carbon_stock_croparea.up(j,ag_pools); + ov30_betr_missing(t,j,"upper") = v30_betr_missing.up(j); + ov30_crop_area(t,i,"upper") = v30_crop_area.up(i); + oq30_prod(t,j,kcr,"upper") = q30_prod.up(j,kcr); + oq30_betr_missing(t,j,"upper") = q30_betr_missing.up(j); + oq30_cost(t,i,"upper") = q30_cost.up(i); + 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_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); + oq30_crop_reg(t,i,"upper") = q30_crop_reg.up(i); + ov_area(t,j,kcr,w,"lower") = vm_area.lo(j,kcr,w); + ov_rotation_penalty(t,i,"lower") = vm_rotation_penalty.lo(i); + ov_carbon_stock_croparea(t,j,ag_pools,"lower") = vm_carbon_stock_croparea.lo(j,ag_pools); + ov30_betr_missing(t,j,"lower") = v30_betr_missing.lo(j); + ov30_crop_area(t,i,"lower") = v30_crop_area.lo(i); + oq30_prod(t,j,kcr,"lower") = q30_prod.lo(j,kcr); + oq30_betr_missing(t,j,"lower") = q30_betr_missing.lo(j); + oq30_cost(t,i,"lower") = q30_cost.lo(i); + 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_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); + oq30_crop_reg(t,i,"lower") = q30_crop_reg.lo(i); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/30_croparea/simple_apr24/preloop.gms b/modules/30_croparea/simple_apr24/preloop.gms new file mode 100644 index 0000000000..adffa58780 --- /dev/null +++ b/modules/30_croparea/simple_apr24/preloop.gms @@ -0,0 +1,25 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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_time_interpol(i30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1); +m_sigmoid_time_interpol(i30_betr_scenario_fader,s30_betr_scenario_start,s30_betr_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; + +* Country switch to determine countries for which certain policies shall be applied. +* In the default case, the 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. +p30_country_weight(i) = sum(i_to_iso(i,iso), p30_country_dummy(iso) * pm_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), pm_avl_cropland_iso(iso)); diff --git a/modules/30_croparea/simple_apr24/presolve.gms b/modules/30_croparea/simple_apr24/presolve.gms new file mode 100644 index 0000000000..adc5cba7e2 --- /dev/null +++ b/modules/30_croparea/simple_apr24/presolve.gms @@ -0,0 +1,52 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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 + +crpmax30(crp30) = yes$(f30_rotation_max_shr(crp30) < 1); +crpmin30(crp30) = yes$(f30_rotation_min_shr(crp30) > 0); + +* create betr target and penalty scenario +i30_betr_target(t,j) = (1-i30_betr_scenario_fader(t)) * + (s30_betr_start * sum(cell(i,j), p30_country_weight(i)) + + s30_betr_start_noselect * sum(cell(i,j), 1-p30_country_weight(i))) + + i30_betr_scenario_fader(t) * + (s30_betr_target * sum(cell(i,j), p30_country_weight(i)) + + s30_betr_target_noselect * sum(cell(i,j), 1-p30_country_weight(i))); + +if (m_year(t) <= s30_betr_scenario_start, + i30_betr_penalty(t) = 0; + v30_betr_missing.fx(j) = 0; +else + i30_betr_penalty(t) = s30_betr_penalty; + if (i30_betr_penalty(t) > 0, + v30_betr_missing.lo(j) = 0; + v30_betr_missing.up(j) = Inf; + else + v30_betr_missing.fx(j) = 0; + ); +); + +*' Cropland growth constraint after SSP2 fix +if(m_year(t) <= sm_fix_SSP2, + v30_crop_area.up(i) = Inf; +else + v30_crop_area.up(i) = v30_crop_area.l(i) * (1 + s30_annual_max_growth) ** m_yeardiff(t); +); diff --git a/modules/30_croparea/simple_apr24/realization.gms b/modules/30_croparea/simple_apr24/realization.gms new file mode 100644 index 0000000000..f4c9140600 --- /dev/null +++ b/modules/30_croparea/simple_apr24/realization.gms @@ -0,0 +1,28 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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 crop specific +*' agricultural crop area endogenously based on yield data provided by +*' module [14_yields] and simplified rotational constraints. +*' In addition, corresponding carbons stocks and BII values are calculated. +*' +*' The crop specific interface `vm_area` is used in many other modules, +*' including [18_residues], [38_factor_costs], +*' [41_area_equipped_for_irrigation], [42_water_demand], [50_nr_soil_budget], +*' [53_methane] and [59_som]. + +*' @limitations There are currently no known limitations of this realization. + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/30_croparea/simple_apr24/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/30_croparea/simple_apr24/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/30_croparea/simple_apr24/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/30_croparea/simple_apr24/equations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/30_croparea/simple_apr24/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/30_croparea/simple_apr24/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/30_croparea/simple_apr24/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/30_crop/endo_apr21/sets.gms b/modules/30_croparea/simple_apr24/sets.gms similarity index 86% rename from modules/30_crop/endo_apr21/sets.gms rename to modules/30_croparea/simple_apr24/sets.gms index 0c18871533..4d37950315 100644 --- a/modules/30_crop/endo_apr21/sets.gms +++ b/modules/30_croparea/simple_apr24/sets.gms @@ -48,13 +48,4 @@ 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 / - - relocation_target30 Cropland requiring relocation based on different SNV targets - / SNV20TargetCropland, SNV50TargetCropland / - ; diff --git a/modules/32_forestry/dynamic_feb21/declarations.gms b/modules/32_forestry/dynamic_may24/declarations.gms similarity index 84% rename from modules/32_forestry/dynamic_feb21/declarations.gms rename to modules/32_forestry/dynamic_may24/declarations.gms index 199e78df99..5a806f3fa4 100644 --- a/modules/32_forestry/dynamic_feb21/declarations.gms +++ b/modules/32_forestry/dynamic_may24/declarations.gms @@ -20,12 +20,9 @@ parameters 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) - 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) - pc32_yield_forestry_future_reg(i) Regional timber yield expected in the future (m3 per ha per year) - p32_plant_ini_ac(j) Initialization of plantation area (mio. ha) + p32_land(t,j,type32,ac) Forestry land pools before optimization (mio. ha) + pc32_land(j,type32,ac) Forestry land pools in current time step (mio. ha) + p32_yield_forestry_future(t,j) Cellular timber yield expected in the future (m3 per ha per year) p32_IGR(t_all,j,ac) Instantaneous growth rate or periodic annual increment of forest growth (1) p32_rot_flg(t_all,j,ac) Identifier flag when calculating rotation length (1) p32_rotation_regional(t_all,i) Regional average rotation length of plantations translated to age class equivalent for future (1) @@ -35,7 +32,6 @@ parameters p32_cdr_ac(t,j,ac) Non-cumulative CDR from afforestation plantations for each age-class depending on planning horizon (tC per ha) p32_rotation_offset Offset calc in age class equivalents (1) p32_land_start_ac(j,type32,ac) Saving first value of starting land (mio. ha) - p32_land_before(t,j,type32,ac) Saving time value of starting land (mio. ha) p32_time(ac) Time as a function of age-classes (yr) p32_discount_factor(t_all,j,ac) Discount factor for each age class (1) p32_net_present_value(t_all,j,ac) Net present value for a representative 1ha land of plantations (mio. USD) @@ -45,28 +41,27 @@ parameters p32_rot_flg_faustmann(t_all,j,ac) Identifier flag when calculating faustmann rotation length (1) p32_rot_length_faustmann(t_all,j) Cellular Faustmann rotation length of plantations translated to age class equivalent (1) p32_ncells(i) Number of cells in each region (1) - pm_representative_rotation(t_all,i) Representative regional rotation (1) p32_aff_bgp(j,ac) Biophysical impact of afforestation (tCeq per ha) p32_tcre_glo(j) Global mean Transient Climate Response to cumulative Emissions (degree C per tC per ha) - p32_observed_gs_reg(i) Observed growing stock (m3 per ha) - p32_gs_scaling_reg(i) Calibration factor for scaling up the relative growing stock (1) - p32_rotation_dist(j,ac) Poulter distribution within celular rotation lengths (1) - p32_updated_gs_reg(t,i) Updated growing stock information after calibration (m3 per ha) - 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) pcm_land_forestry(j,type32) Forestry land pools (mio. ha) + pc32_prod_forestry_ini(i) Initial procution from timber plantations (mio. tDM per yr) + pc32_plant_contr_ini(i) Inital share of roundwood production coming from timber plantations (percent) + i32_plant_contr_growth_fader(t_all) Fader for growth rate of timber plantation share (percent) + p32_plant_contr(t,i) Share of roundwood production coming from timber plantations (percent) + p32_forestry_product_dist(t,i,kforestry) Distribution of wood products (1) + p32_future_to_current_demand_ratio(t,i) Ratio of future and current timber demand (1) + p32_demand_forestry_future(t,i,kforestry) Future forestry demand in current time step (tDM per yr) + p32_est_cost(type32) Establishment cost (USD per ha) ; positive variables vm_cost_fore(i) Forestry costs (Mio USD) v32_cost_hvarea(i) Cost of harvesting timber from forests (mio. USD per yr) v32_land(j,type32,ac) Forestry land pools (mio. ha) - v32_land_missing(j) Forestry land which can be used at extrmemly high costs in case not enough area is available for new establishment (mio. ha) + v32_land_missing(j) Technical area balance term for timber plantation establishment (mio. ha) vm_landdiff_forestry Aggregated difference in forestry land compared to previous timestep (mio. ha) v32_cost_recur(i) Recurring forest management costs (USD per ha) v32_land_expansion(j,type32) Forestry land expansion (mio. ha) @@ -77,6 +72,7 @@ positive variables vm_landexpansion_forestry(j,type32) Forestry land expansion (mio. ha) vm_landreduction_forestry(j,type32) Forestry land reduction (mio. ha) vm_land_forestry(j,type32) Forestry land pools (mio. ha) + v32_prod_forestry_future(i) Future expected production of woody biomass from commercial plantations (mio. tDM per yr) ; variables @@ -86,7 +82,7 @@ variables equations q32_cost_total(i) Total forestry costs constraint (mio. USD) q32_land(j) Land constraint (mio. ha) - q32_land_type32(j,type32) Land constraint (mio. ha) + q32_land_type32(j,type32) Land constraint (mio. ha) q32_cdr_aff(j,ac) Calculation of CDR from afforestation (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) @@ -96,8 +92,9 @@ equations 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_prod_forestry_future(i) Future expected production of woody biomass from commercial plantations (mio. tDM per yr) + q32_establishment_demand(i) Future expected production of woody biomass from commercial plantations (mio. tDM per yr) + q32_establishment_hvarea(j) Establishment in current time step for future demand (mio. ha) q32_establishment_fixed(j) Establishment in current time step for future demand (mio. ha) q32_land_expansion(j,type32) Land expansion (mio. ha) q32_land_reduction(j,type32,ac) Land contraction (mio. ha) @@ -119,7 +116,7 @@ parameters ov_cost_fore(t,i,type) Forestry costs (Mio USD) ov32_cost_hvarea(t,i,type) Cost of harvesting timber from forests (mio. USD per yr) ov32_land(t,j,type32,ac,type) Forestry land pools (mio. ha) - ov32_land_missing(t,j,type) Forestry land which can be used at extrmemly high costs in case not enough area is available for new establishment (mio. ha) + ov32_land_missing(t,j,type) Technical area balance term for timber plantation establishment (mio. ha) ov_landdiff_forestry(t,type) Aggregated difference in forestry land compared to previous timestep (mio. ha) ov32_cost_recur(t,i,type) Recurring forest management costs (USD per ha) ov32_land_expansion(t,j,type32,type) Forestry land expansion (mio. ha) @@ -130,6 +127,7 @@ parameters ov_landexpansion_forestry(t,j,type32,type) Forestry land expansion (mio. ha) ov_landreduction_forestry(t,j,type32,type) Forestry land reduction (mio. ha) ov_land_forestry(t,j,type32,type) Forestry land pools (mio. ha) + ov32_prod_forestry_future(t,i,type) Future expected production of woody biomass from commercial plantations (mio. tDM per yr) ov_cdr_aff(t,j,ac,aff_effect,type) Expected bgc (CDR) and local bph effects of afforestation depending on planning horizon (mio. tC) oq32_cost_total(t,i,type) Total forestry costs constraint (mio. USD) oq32_land(t,j,type) Land constraint (mio. ha) @@ -143,8 +141,9 @@ parameters 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) oq32_cost_recur(t,i,type) Recurruing costs (mio. USD) - oq32_establishment_dynamic(t,i,type) Establishment in current time step for future demand (mio. ha) - oq32_establishment_dynamic_yield(t,i,type) Regional timber yield (tDM per ha) + oq32_prod_forestry_future(t,i,type) Future expected production of woody biomass from commercial plantations (mio. tDM per yr) + oq32_establishment_demand(t,i,type) Future expected production of woody biomass from commercial plantations (mio. tDM per yr) + oq32_establishment_hvarea(t,j,type) Establishment in current time step for future demand (mio. ha) oq32_establishment_fixed(t,j,type) Establishment in current time step for future demand (mio. ha) oq32_land_expansion(t,j,type32,type) Land expansion (mio. ha) oq32_land_reduction(t,j,type32,ac,type) Land contraction (mio. ha) diff --git a/modules/32_forestry/dynamic_feb21/equations.gms b/modules/32_forestry/dynamic_may24/equations.gms similarity index 76% rename from modules/32_forestry/dynamic_feb21/equations.gms rename to modules/32_forestry/dynamic_may24/equations.gms index 259fdc7206..1cfdcf2597 100644 --- a/modules/32_forestry/dynamic_feb21/equations.gms +++ b/modules/32_forestry/dynamic_may24/equations.gms @@ -70,17 +70,17 @@ 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 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`. +*' 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$(s32_max_aff_area_glo=1) .. + 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) .. + 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)); @@ -100,7 +100,7 @@ sum(ac_est, v32_land(j2,"aff",ac_est)) =l= sum(ac, v32_land(j2,"aff",ac)) - sum( + sum(ac_sub, v32_land_reduction(j2,type32,ac_sub))); q32_land_expansion(j2,type32) .. - v32_land_expansion(j2,type32) =e= + v32_land_expansion(j2,type32) =e= sum(ac_est, v32_land(j2,type32,ac_est)); q32_land_reduction(j2,type32,ac_sub) .. @@ -112,17 +112,17 @@ sum(ac_est, v32_land(j2,"aff",ac_est)) =l= sum(ac, v32_land(j2,"aff",ac)) - sum( q32_bv_aff(j2,potnatveg) .. vm_bv(j2,"aff_co2p",potnatveg) =e= - sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v32_land(j2,"aff",ac)) * + 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(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v32_land(j2,"ndc",ac)) * + 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(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v32_land(j2,"plant",ac)) * + 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); @@ -141,51 +141,58 @@ q32_bv_plant(j2,potnatveg) .. vm_bv(j2,"plant",potnatveg) *' investment over time. q32_cost_establishment(i2).. - 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))); + v32_cost_establishment(i2) + =e= + (sum((cell(i2,j2),type32,ac_est), v32_land(j2,type32,ac_est) * p32_est_cost(type32))) + * sum(ct,pm_interest(ct,i2)/(1+pm_interest(ct,i2))) + + sum((ct,kforestry), v32_prod_forestry_future(i2) * p32_forestry_product_dist(ct,i2,kforestry) * im_timber_prod_cost(kforestry)) + / ((1+sum(ct,pm_interest(ct,i2))**sum(ct, p32_rotation_regional(ct,i2)*5))); *' Recurring costs are paid for plantations where the trees have to be regularly monitored -*' and maintained. These costs are only calculated becuase we see active human intervention +*' and maintained. These costs are only calculated because we see active human intervention *' in commercial plantations. These costs are paid for trees used for timber production or -*' trees established for afforestation purposes. +*' trees established for re/afforestation purposes. q32_cost_recur(i2) .. v32_cost_recur(i2) =e= sum((cell(i2,j2),type32,ac_sub), v32_land(j2,type32,ac_sub)) * s32_recurring_cost; -**** New establishment decision +**** Plantation establishment decision *------------------------------ -*' New plantations are already established in the optimization step based on a certain -*' percentage (`p32_plantation_contribution`) of current demand (`pm_demand_forestry_future`). -*' Its called `pm_demand_forestry_future` because the model also has a foresight switch which -*' give the model an ability to account for future changes in demand. By default `pm_demand_forestry_future` -*' is set to existing roundwood demand. As plantation establishment decisions should +*' New plantations are established in the optimization step based on a certain +*' percentage (`p32_plant_contr`) of expected future demand (`p32_demand_forestry_future`). +*' As plantation establishment decisions should *' also know some indication of expected future yields, we calculate how much yield *' newly established plantation can realize based on rotation lengths. This is defined as -*' the expected future yield (`pc32_yield_forestry_future`) at harvest (year in time -*' step are accounted for). +*' the expected future yield (`p32_yield_forestry_future`) at harvest. -*' Area constraint for plantation establishment based on expected average regional timber yield at rotation age -*' (`pc32_yield_forestry_future_reg`) to ovoid overspecialization of plantation establishment towards highly productive cells. +*' Future expected production is calculated for the establishment decision below and the costs above +*' based on newly established areas and expected future yields. -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)) +q32_prod_forestry_future(i2) .. + v32_prod_forestry_future(i2) =e= - 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)) + sum(cell(i2,j2), (sum(ac_est, v32_land(j2,"plant",ac_est)) + v32_land_missing(j2)) * sum(ct, p32_yield_forestry_future(ct,j2))) / m_timestep_length_forestry ; -*' Constraint to maintain the average regional timber yield at rotation age, accounting for the cellular timber yield (`pc32_yield_forestry_future`). +*' Future expected production has to be equal or larger than future demand multiplied with the plantation contribution factor. -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)) - =e= - pc32_yield_forestry_future_reg(i2) * (sum(cell(i2,j2), sum(ac_est, v32_land(j2,"plant",ac_est))+v32_land_missing(j2))); +q32_establishment_demand(i2)$s32_establishment_dynamic .. + v32_prod_forestry_future(i2) + =g= + sum((ct,kforestry), p32_demand_forestry_future(ct,i2,kforestry)) * sum(ct, p32_plant_contr(ct,i2)) + ; + +*' Harvested areas are fully re-established at cell level, unless the ratio of future and current demand drops below 1. + +q32_establishment_hvarea(j2)$s32_establishment_dynamic .. + sum(ac_est, v32_land(j2,"plant",ac_est)) + =g= + sum(ac_sub, v32_hvarea_forestry(j2,ac_sub)) * sum(cell(i2,j2), min(1, sum(ct, p32_future_to_current_demand_ratio(ct,i2)))) + ; -*' If plantations have to be static (defined by `s32_establishment_static`) then +*' If plantations should be static (defined by `s32_establishment_static`) then *' the model simply establishes the amount of plantations which are harvested. *' this keeps the plantation area static but accounts for age-class changes and *' regrowth during every time step. @@ -205,7 +212,7 @@ v32_land(j2,type32,ac_est) =e= sum(ac_est2, v32_land(j2,type32,ac_est2))/card(ac q32_hvarea_forestry(j2,ac_sub) .. v32_hvarea_forestry(j2,ac_sub) - =l= + =e= v32_land_reduction(j2,"plant",ac_sub); ** Timber plantation diff --git a/modules/32_forestry/dynamic_feb21/input.gms b/modules/32_forestry/dynamic_may24/input.gms similarity index 73% rename from modules/32_forestry/dynamic_feb21/input.gms rename to modules/32_forestry/dynamic_may24/input.gms index 961bb68cb5..4561adace6 100644 --- a/modules/32_forestry/dynamic_feb21/input.gms +++ b/modules/32_forestry/dynamic_may24/input.gms @@ -4,8 +4,6 @@ *** | AGPL-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 c32_timber_plantations plantations -* option: natveg, plantations $setglobal c32_aff_mask noboreal * options: unrestricted, noboreal, onlytropical $setglobal c32_aff_policy npi @@ -16,10 +14,6 @@ $setglobal c32_tcre_ctrl ann_TCREmean * options: ann_TCREmean, ann_TCREhigh, ann_TCRElow $setglobal c32_interest_rate regional * options regional, global -$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 @@ -29,16 +23,17 @@ $setglobal c32_shock_scenario none scalars - 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_hvarea Flag for harvested area and establishemt (0=zero 1=exognous 2=endogneous) / 2 / + s32_est_cost_plant Establishment cost for plantations (USD per ha) / 2000 / + s32_est_cost_natveg Establishment cost for natural vegetation (USD per ha) / 2000 / s32_recurring_cost Recurring costs (USD per ha) / 500 / - s32_harvesting_cost Harvesting cost (USD per ha) / 1000 / + s32_harvesting_cost Harvesting cost (USD per ha) / 2000 / s32_planing_horizon Afforestation planing horizon (years) / 50 / s32_rotation_extension Rotation extension factor 1=original rotations 2=100 percent increase in rotations etc (1) / 1 / s32_faustmann_rotation Switch to activate faustmann rotations (1=on 0=off) / 0 / - s32_initial_distribution Switch to Activate ageclass distribution in plantations 0=off 1=equal distribution 2=FAO distribution 3=Poulter distribution 4=Manual distribution (1) / 0 / + s32_initial_distribution Switch to Activate ageclass distribution in plantations 0=off 1=equal distribution / 1 / s32_price Price for timber (USD) / 45 / - s32_free_land_cost Very high cost for using non existing land for plantation establishment (USD per ha) /1000000/ + s32_free_land_cost Penalty for technial area balance term (USD per ha) / 1e+06 / 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_tcre_local Switch for local (1) or global (0) TRCE factors (1) / 1 / @@ -47,6 +42,12 @@ scalars 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) / 1 / + s32_plant_contr_growth_startyear Start year for plantation contribution growth fader (year) / 2020 / + s32_plant_contr_growth_endyear End year for plantation contribution growth fader (year) / 2050 / + s32_plant_contr_growth_startvalue Start value for plantation contribution growth fader (percent per year) / 0.05 / + s32_plant_contr_growth_endvalue End value for plantation contribution growth fader (percent per year) / 0 / + s32_plant_contr_max Maximum plantation contribution for establishment decision (percent) / 0.5 / + s32_demand_establishment Boolean switch for establishment demand assumption 1=forward looking 0=static (1) / 1 / ; parameter f32_aff_mask(j) afforestation mask (binary) @@ -73,14 +74,6 @@ $include "./modules/32_forestry/input/npi_ndc_aff_pol.cs3" $offdelim ; -parameter f32_plant_prod_share(t_all) Share of overall production coming from plantations (1) -/ -$ondelim -$include "./modules/32_forestry/input/f32_plant_prod_share.csv" -$offdelim -/ -; - table f32_aff_bgp(j,bgp32) Biogeophysical temperature change of afforestation (degree C) $ondelim $include "./modules/32_forestry/input/f32_bph_effect_noTCRE.cs3" @@ -93,26 +86,6 @@ $include "./modules/32_forestry/input/f32_localTCRE.cs3" $ondelim ; -parameter f32_ac_dist(ac) Age class distribution share (1) -/ -$ondelim -$include "./modules/32_forestry/input/f32_ac_dist.csv" -$offdelim -/; - -parameter f32_gs_relativetarget(i) Relative growing stock target in each region (m3 per ha) -/ -$ondelim -$include "./modules/32_forestry/input/f32_gs_relativetarget.cs4" -$offdelim -/; - -table f32_plantation_contribution(t_ext,i,inter32,scen32) Share of roundwood production coming from timber plantations (percent) -$ondelim -$include "./modules/32_forestry/input/f32_plantation_contribution.cs3" -$ondelim -; - parameter f32_plantedforest(i) Share of plantation forest in planted forest (1) / $ondelim @@ -120,13 +93,6 @@ $include "./modules/32_forestry/input/f32_plantedforest.cs4" $offdelim /; -parameter f32_estb_calib(i) Calibration factor for plantation forest establishment (1) -/ -$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" diff --git a/modules/32_forestry/dynamic_feb21/postsolve.gms b/modules/32_forestry/dynamic_may24/postsolve.gms similarity index 90% rename from modules/32_forestry/dynamic_feb21/postsolve.gms rename to modules/32_forestry/dynamic_may24/postsolve.gms index 69a4b4e0de..be0c978644 100644 --- a/modules/32_forestry/dynamic_feb21/postsolve.gms +++ b/modules/32_forestry/dynamic_may24/postsolve.gms @@ -6,7 +6,7 @@ *** | Contact: magpie@pik-potsdam.de *' @code *' Exchange land information after optimization -p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); +pc32_land(j,type32,ac) = v32_land.l(j,type32,ac); *' @stop *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### @@ -24,6 +24,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); ov_landexpansion_forestry(t,j,type32,"marginal") = vm_landexpansion_forestry.m(j,type32); ov_landreduction_forestry(t,j,type32,"marginal") = vm_landreduction_forestry.m(j,type32); ov_land_forestry(t,j,type32,"marginal") = vm_land_forestry.m(j,type32); + ov32_prod_forestry_future(t,i,"marginal") = v32_prod_forestry_future.m(i); ov_cdr_aff(t,j,ac,aff_effect,"marginal") = vm_cdr_aff.m(j,ac,aff_effect); oq32_cost_total(t,i,"marginal") = q32_cost_total.m(i); oq32_land(t,j,"marginal") = q32_land.m(j); @@ -37,8 +38,9 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); oq32_aff_est(t,j,"marginal") = q32_aff_est.m(j); oq32_hvarea_forestry(t,j,ac,"marginal") = q32_hvarea_forestry.m(j,ac); oq32_cost_recur(t,i,"marginal") = q32_cost_recur.m(i); - oq32_establishment_dynamic(t,i,"marginal") = q32_establishment_dynamic.m(i); - oq32_establishment_dynamic_yield(t,i,"marginal") = q32_establishment_dynamic_yield.m(i); + oq32_prod_forestry_future(t,i,"marginal") = q32_prod_forestry_future.m(i); + oq32_establishment_demand(t,i,"marginal") = q32_establishment_demand.m(i); + oq32_establishment_hvarea(t,j,"marginal") = q32_establishment_hvarea.m(j); oq32_establishment_fixed(t,j,"marginal") = q32_establishment_fixed.m(j); oq32_land_expansion(t,j,type32,"marginal") = q32_land_expansion.m(j,type32); oq32_land_reduction(t,j,type32,ac,"marginal") = q32_land_reduction.m(j,type32,ac); @@ -66,6 +68,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); ov_landexpansion_forestry(t,j,type32,"level") = vm_landexpansion_forestry.l(j,type32); ov_landreduction_forestry(t,j,type32,"level") = vm_landreduction_forestry.l(j,type32); ov_land_forestry(t,j,type32,"level") = vm_land_forestry.l(j,type32); + ov32_prod_forestry_future(t,i,"level") = v32_prod_forestry_future.l(i); ov_cdr_aff(t,j,ac,aff_effect,"level") = vm_cdr_aff.l(j,ac,aff_effect); oq32_cost_total(t,i,"level") = q32_cost_total.l(i); oq32_land(t,j,"level") = q32_land.l(j); @@ -79,8 +82,9 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); oq32_aff_est(t,j,"level") = q32_aff_est.l(j); oq32_hvarea_forestry(t,j,ac,"level") = q32_hvarea_forestry.l(j,ac); oq32_cost_recur(t,i,"level") = q32_cost_recur.l(i); - oq32_establishment_dynamic(t,i,"level") = q32_establishment_dynamic.l(i); - oq32_establishment_dynamic_yield(t,i,"level") = q32_establishment_dynamic_yield.l(i); + oq32_prod_forestry_future(t,i,"level") = q32_prod_forestry_future.l(i); + oq32_establishment_demand(t,i,"level") = q32_establishment_demand.l(i); + oq32_establishment_hvarea(t,j,"level") = q32_establishment_hvarea.l(j); oq32_establishment_fixed(t,j,"level") = q32_establishment_fixed.l(j); oq32_land_expansion(t,j,type32,"level") = q32_land_expansion.l(j,type32); oq32_land_reduction(t,j,type32,ac,"level") = q32_land_reduction.l(j,type32,ac); @@ -108,6 +112,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); ov_landexpansion_forestry(t,j,type32,"upper") = vm_landexpansion_forestry.up(j,type32); ov_landreduction_forestry(t,j,type32,"upper") = vm_landreduction_forestry.up(j,type32); ov_land_forestry(t,j,type32,"upper") = vm_land_forestry.up(j,type32); + ov32_prod_forestry_future(t,i,"upper") = v32_prod_forestry_future.up(i); ov_cdr_aff(t,j,ac,aff_effect,"upper") = vm_cdr_aff.up(j,ac,aff_effect); oq32_cost_total(t,i,"upper") = q32_cost_total.up(i); oq32_land(t,j,"upper") = q32_land.up(j); @@ -121,8 +126,9 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); oq32_aff_est(t,j,"upper") = q32_aff_est.up(j); oq32_hvarea_forestry(t,j,ac,"upper") = q32_hvarea_forestry.up(j,ac); oq32_cost_recur(t,i,"upper") = q32_cost_recur.up(i); - oq32_establishment_dynamic(t,i,"upper") = q32_establishment_dynamic.up(i); - oq32_establishment_dynamic_yield(t,i,"upper") = q32_establishment_dynamic_yield.up(i); + oq32_prod_forestry_future(t,i,"upper") = q32_prod_forestry_future.up(i); + oq32_establishment_demand(t,i,"upper") = q32_establishment_demand.up(i); + oq32_establishment_hvarea(t,j,"upper") = q32_establishment_hvarea.up(j); oq32_establishment_fixed(t,j,"upper") = q32_establishment_fixed.up(j); oq32_land_expansion(t,j,type32,"upper") = q32_land_expansion.up(j,type32); oq32_land_reduction(t,j,type32,ac,"upper") = q32_land_reduction.up(j,type32,ac); @@ -150,6 +156,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); ov_landexpansion_forestry(t,j,type32,"lower") = vm_landexpansion_forestry.lo(j,type32); ov_landreduction_forestry(t,j,type32,"lower") = vm_landreduction_forestry.lo(j,type32); ov_land_forestry(t,j,type32,"lower") = vm_land_forestry.lo(j,type32); + ov32_prod_forestry_future(t,i,"lower") = v32_prod_forestry_future.lo(i); ov_cdr_aff(t,j,ac,aff_effect,"lower") = vm_cdr_aff.lo(j,ac,aff_effect); oq32_cost_total(t,i,"lower") = q32_cost_total.lo(i); oq32_land(t,j,"lower") = q32_land.lo(j); @@ -163,8 +170,9 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); oq32_aff_est(t,j,"lower") = q32_aff_est.lo(j); oq32_hvarea_forestry(t,j,ac,"lower") = q32_hvarea_forestry.lo(j,ac); oq32_cost_recur(t,i,"lower") = q32_cost_recur.lo(i); - oq32_establishment_dynamic(t,i,"lower") = q32_establishment_dynamic.lo(i); - oq32_establishment_dynamic_yield(t,i,"lower") = q32_establishment_dynamic_yield.lo(i); + oq32_prod_forestry_future(t,i,"lower") = q32_prod_forestry_future.lo(i); + oq32_establishment_demand(t,i,"lower") = q32_establishment_demand.lo(i); + oq32_establishment_hvarea(t,j,"lower") = q32_establishment_hvarea.lo(j); oq32_establishment_fixed(t,j,"lower") = q32_establishment_fixed.lo(j); oq32_land_expansion(t,j,type32,"lower") = q32_land_expansion.lo(j,type32); oq32_land_reduction(t,j,type32,ac,"lower") = q32_land_reduction.lo(j,type32,ac); diff --git a/modules/32_forestry/dynamic_feb21/preloop.gms b/modules/32_forestry/dynamic_may24/preloop.gms similarity index 61% rename from modules/32_forestry/dynamic_feb21/preloop.gms rename to modules/32_forestry/dynamic_may24/preloop.gms index fae349543f..bcf1b96ed1 100644 --- a/modules/32_forestry/dynamic_feb21/preloop.gms +++ b/modules/32_forestry/dynamic_may24/preloop.gms @@ -4,9 +4,17 @@ *** | AGPL-3.0, you are granted additional permissions described in the *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de + +*m_sigmoid_time_interpol(i32_plant_contr_fader,2020,2050,0.05,0); +m_sigmoid_time_interpol(i32_plant_contr_growth_fader,s32_plant_contr_growth_startyear,s32_plant_contr_growth_endyear,s32_plant_contr_growth_startvalue,s32_plant_contr_growth_endvalue); + +p32_est_cost("plant") = s32_est_cost_plant; +p32_est_cost("ndc") = s32_est_cost_natveg; +p32_est_cost("aff") = s32_est_cost_natveg$(s32_aff_plantation = 0) + s32_est_cost_plant$(s32_aff_plantation = 1); + ** Calculation of Single rotation model rotation lengths ** Using forestry carbon densitiy here via carbon density data exchange from carbon module. -p32_carbon_density_ac_forestry(t_all,j,ac) = pm_carbon_density_ac_forestry(t_all,j,ac,"vegc"); +p32_carbon_density_ac_forestry(t_all,j,ac) = pm_carbon_density_plantation_ac(t_all,j,ac,"vegc"); ** Calculating the marginal of carbon density i.e. change in carbon density over two time steps ** The carbon densities are tC/ha/year so we don't have to divide by timestep length. @@ -44,7 +52,7 @@ $ifthen "%c32_rot_calc_type%" == "current_annual_increment" $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_avg_increment(t_all,j,ac) = pm_carbon_density_plantation_ac(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."; @@ -96,7 +104,6 @@ p32_ncells(i) = sum(cell(i,j),1); **** Representative regional rotation loop(t_all, p32_rotation_regional(t_all,i) = ceil(sum(cell(i,j), p32_rot_length_ac_eqivalent(t_all,j))/p32_ncells(i)); - pm_representative_rotation(t_all,i) = ord(t_all) + ceil(sum(cell(i,j),p32_rot_length_ac_eqivalent(t_all,j))/p32_ncells(i)); ); ** Earlier we converted rotation lengths to absolute numbers, now we make the Conversion @@ -140,6 +147,7 @@ p32_cdr_ac(t,j,ac) = 0; ini32(j,ac) = no; ini32(j,ac) = yes$(ord(ac) >= 1 AND ac.off < p32_rotation_cellular_harvesting("y1995",j)); +** divide initial forestry area by number of age classes within ini32 ** divide initial forestry area by number of age classes within ini32 if(s32_initial_distribution = 0, ** Initialize with highest age class @@ -149,65 +157,11 @@ if(s32_initial_distribution = 0, elseif s32_initial_distribution = 1, ** Initialize with equal distribution among rotation age classes ** Plantated forest area is divided into ndcs (other planted forest) and plantations - p32_plant_ini_ac(j) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); - p32_land_start_ac(j,"plant",ac)$(ini32(j,ac)) = p32_plant_ini_ac(j); + p32_land_start_ac(j,"plant",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); p32_land_start_ac(j,"ndc",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),1- f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); -elseif s32_initial_distribution = 2, -** Initialize with distribution based on FAO data (but this distribution is applied to all cells globally) -** Plantated forest area is divided into ndcs (other planted forest) and plantations - p32_plant_ini_ac(j) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i)); - p32_land_start_ac(j,"plant",ac) = p32_plant_ini_ac(j) * f32_ac_dist(ac); - p32_land_start_ac(j,"ndc",ac) = pm_land_start(j,"forestry") * sum(cell(i,j),1-f32_plantedforest(i)) * f32_ac_dist(ac); - -elseif s32_initial_distribution = 3, -** Initialize with Poulter distribution among rotation age classes -** Plantated forest area is divided into ndcs (other planted forest) and plantations - p32_plant_ini_ac(j) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i)); - p32_rotation_dist(j,ac) = (im_plantedclass_ac(j,ac)$(ini32(j,ac))/sum(ac2,im_plantedclass_ac(j,ac2)$(ini32(j,ac2))))$(sum(ac2,im_plantedclass_ac(j,ac2)$(ini32(j,ac2)))); - p32_land_start_ac(j,"plant",ac)$(ini32(j,ac)) = p32_plant_ini_ac(j) * p32_rotation_dist(j,ac); - p32_land_start_ac(j,"ndc",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),1-f32_plantedforest(i)) * p32_rotation_dist(j,ac); - -*use residual approach to avoid distributional errors i.e., poulter set with no plantations but luh reporting plantations in a cell - loop (j, - if(sum(ac,p32_land_start_ac(j,"plant",ac)$(ini32(j,ac))) = 0, - p32_land_start_ac(j,"plant",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); - p32_land_start_ac(j,"ndc",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),1-f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); - ); - ); - -elseif s32_initial_distribution = 4, -** Initialize with Manual distribution among rotation age classes -** Plantated forest area is divided into ndcs (other planted forest) and plantations - loop(j, -** Set all acs to 0 - p32_ac_dist_flag(j,ac) = 0; -** Calculate reverse of age-classes, if rotation is 11acs, then ac0 should get a value of 11, 11th ac should get value of 1 - p32_ac_dist_flag(j,ac) = (10*p32_rotation_cellular_harvesting("y1995",j)-((ord(ac)-1))*5)$(ord(ac) <= p32_rotation_cellular_harvesting("y1995",j)); -** Calculate the weights, youngest age-class will have highest weight - p32_ac_dist(j,ac) = (p32_ac_dist_flag(j,ac) / (sum(ac2,p32_ac_dist_flag(j,ac2)) + ord(ac)))$(ord(ac) <= p32_rotation_cellular_harvesting("y1995",j)); -** there can be isntances where this distribution is not summing up to 1, in that case we take the excess and remove it evenly from all age-classes -** 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)); -** Divide plantations according to distribution - p32_land_start_ac(j,"plant",ac) = p32_plant_ini_ac(j) * p32_ac_dist(j,ac); -** Divide NDCs according to same distribution - p32_land_start_ac(j,"ndc",ac) = pm_land_start(j,"forestry") * sum(cell(i,j),1-f32_plantedforest(i)) * p32_ac_dist(j,ac); - -*use residual approach to avoid distributional errors i.e., poulter set with no plantations but luh reporting plantations in a cell - loop (j, - if(sum(ac,p32_land_start_ac(j,"plant",ac)$(ini32(j,ac))) = 0, - p32_land_start_ac(j,"plant",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); - p32_land_start_ac(j,"ndc",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),1-f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); - ); - ); - ); + ** Redistribute to youngest age class in case the distribution to plantations and ** ndcs does not match fully with LUH initialized data loop(j, @@ -216,6 +170,9 @@ loop(j, ); ); +** Initialize forestry land types +pc32_land(j,type32,ac) = p32_land_start_ac(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); @@ -228,12 +185,12 @@ p32_aff_togo(t,i) = smax(t2, sum(cell(i,j), p32_aff_pol(t2,j))) - sum(cell(i,j), * 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)$(i32_max_aff_area_glo(t) < 1e-6) = 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)$(i32_max_aff_area_reg(t,i) < 1e-6) = 0; i32_max_aff_area_reg(t,i)$(m_year(t) <= sm_fix_SSP2) = Inf; i32_max_aff_area_glo(t) = 0; ); @@ -252,43 +209,10 @@ 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); 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) - p32_aff_bgp(j,ac_bph) = f32_aff_bgp(j,"%c32_aff_bgp%")/p32_tcre_glo(j)/card(ac_bph) + p32_tcre_glo(j2) = m_weightedmean(f32_tcre(j,"%c32_tcre_ctrl%"),sum(land, pcm_land(j,land)),j); + p32_aff_bgp(j,ac_bph) = f32_aff_bgp(j,"%c32_aff_bgp%")/p32_tcre_glo(j)/card(ac_bph); ); -** Calculate plantation contribution scaled to Growing stock in plantations -** Initialize with low values -p32_plantation_contribution(t_ext,i) = 0.001; -** Fill parameter with input file based on scenario settings -p32_plantation_contribution(t_ext,i)$(f32_gs_relativetarget(i)>0) = f32_plantation_contribution(t_ext,i,"%c32_dev_scen%","%c32_incr_rate%"); - -************************************************************************** -******************************************************************************* -** Calibrate plantations yields -******************************************************************************* -** Initialize with 1 m3 per 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 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 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; - -** 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)); -** keep c-density for timber plantations constant after rotation length to avoid unrealistic carbon sequestration in unharvested timber plantations -pm_carbon_density_ac_forestry(t_all,j,ac,"vegc")$(ac.off >= p32_rotation_cellular_harvesting(t_all,j)) = sum(ac2$(ac2.off = p32_rotation_cellular_harvesting(t_all,j)), pm_carbon_density_ac_forestry(t_all,j,ac2,"vegc")); - ** set bii coefficients p32_bii_coeff(type32,bii_class_secd,potnatveg) = 0; if(s32_aff_bii_coeff = 0, diff --git a/modules/32_forestry/dynamic_feb21/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms similarity index 68% rename from modules/32_forestry/dynamic_feb21/presolve.gms rename to modules/32_forestry/dynamic_may24/presolve.gms index 3717ece058..6ebf6d3240 100644 --- a/modules/32_forestry/dynamic_feb21/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -5,13 +5,6 @@ *** | 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)); - *Reduction of ac_est is not possible. v32_hvarea_forestry.fx(j,ac_est) = 0; v32_land_reduction.fx(j,type32,ac_est) = 0; @@ -21,41 +14,39 @@ v32_land_reduction.fx(j,type32,ac_est) = 0; 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"); + p32_aff_pot(t,j) = 0.95 * (sum((kcr,w),vm_area.l(j,kcr,w) - vm_area.lo(j,kcr,w)) + + (vm_fallow.l(j) - vm_fallow.lo(j)) + + (vm_land.l(j,"past") - vm_land.lo(j,"past")) + - pm_land_conservation(t,j,"other","restore")); +*** NDC/NPI re/afforesation is further constrained by the remaining forest establishment potential + p32_aff_pot(t,j)$(p32_aff_pot(t,j) > pm_max_forest_est(t,j)) = pm_max_forest_est(t,j); * 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; + p32_aff_pot(t,j)$(p32_aff_pot(t,j) < 1e-6) = 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 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); + p32_carbon_density_ac(t,j,"aff",ac,ag_pools) = pm_carbon_density_secdforest_ac(t,j,ac,ag_pools); elseif s32_aff_plantation = 1, - p32_carbon_density_ac(t,j,"aff",ac,ag_pools) = p32_c_density_ac_fast_forestry(t,j,ac); + p32_carbon_density_ac(t,j,"aff",ac,ag_pools) = pm_carbon_density_plantation_ac(t,j,ac,"vegc"); ); *' Timber plantations carbon densities: -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,"plant",ac,ag_pools) = pm_carbon_density_plantation_ac(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); +p32_carbon_density_ac(t,j,"ndc",ac,ag_pools) = pm_carbon_density_secdforest_ac(t,j,ac,ag_pools); *' CDR from afforestation for each age-class, depending on planning horizon. 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_est2); @@ -67,29 +58,20 @@ pc32_land(j,"aff",ac_sub) = pc32_land(j,"aff",ac_sub) - p32_disturbance_loss_fty s32_shift = m_yeardiff_forestry(t)/5; *' @stop -*' Shifting of age-classes in land. +*' Shifting of age-classes *` @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) = 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), 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); -p32_land_before(t,j,type32,ac) = p32_land(t,j,type32,ac); +pc32_land(j,type32,ac) = p32_land(t,j,type32,ac); vm_land.l(j,"forestry") = sum((type32,ac), v32_land.l(j,type32,ac)); pcm_land(j,"forestry") = sum((type32,ac), v32_land.l(j,type32,ac)); pcm_land_forestry(j,type32) = sum(ac, v32_land.l(j,type32,ac)); @@ -122,8 +104,8 @@ elseif s32_hvarea = 2, ** Fix timber plantations until the end of the rotation. "ac.off" identical to "ord(ac)-1". ** The offset is needed because the first element of ac is ac0, which is not included in p32_rotation_cellular_harvesting. v32_land.fx(j,"plant",ac)$(ac.off < p32_rotation_cellular_harvesting(t,j)) = pc32_land(j,"plant",ac); -** After the rotation period, plantations are free for harvesting - v32_land.up(j,"plant",ac)$(ac.off >= p32_rotation_cellular_harvesting(t,j)) = pc32_land(j,"plant",ac); +** After the rotation period, all plantations are harvested. + v32_land.fx(j,"plant",ac)$(ac.off >= p32_rotation_cellular_harvesting(t,j)) = 0; s32_establishment_static = 0; s32_establishment_dynamic = 1; ); @@ -143,7 +125,7 @@ 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.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; @@ -161,19 +143,40 @@ else *' 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; -m_boundfix(v32_land,(j,type32,ac_sub),up,10e-5); +m_boundfix(v32_land,(j,type32,ac_sub),up,1e-6); ** Calculate future yield based on rotation length -if((ord(t)=1), -pc32_yield_forestry_future(j) = sum(ac$(ord(ac) = p32_rotation_cellular_estb(t,j)-1), pm_timber_yield(t,j,ac,"forestry")); -pc32_area_rotation(j) = sum(ac$(ord(ac) = p32_rotation_cellular_estb(t,j)-1), p32_land(t,j,"plant",ac)); +p32_yield_forestry_future(t,j) = sum(ac$(ac.off = p32_rotation_cellular_estb(t,j)), pm_timber_yield(t,j,ac,"forestry")); + +* Fader for plantation share in establishment decision +if(ord(t) = 1, + pc32_prod_forestry_ini(i) = sum(cell(i,j), sum(ac$(ac.off = p32_rotation_cellular_harvesting(t,j)), pm_timber_yield(t,j,ac,"forestry") * p32_land(t,j,"plant",ac))) / m_timestep_length_forestry; + pc32_plant_contr_ini(i)$(sum(kforestry, pm_demand_forestry(t,i,kforestry)) > 0) = pc32_prod_forestry_ini(i) / sum(kforestry, pm_demand_forestry(t,i,kforestry)); + pc32_plant_contr_ini(i)$(sum(kforestry, pm_demand_forestry(t,i,kforestry)) = 0) = 0; + p32_plant_contr(t,i) = pc32_plant_contr_ini(i); +else + p32_plant_contr(t,i) = p32_plant_contr(t-1,i) * (1+i32_plant_contr_growth_fader(t))**m_timestep_length_forestry; ); -pc32_yield_forestry_future_reg(i) = m_weightedmean(pc32_yield_forestry_future(j),pc32_area_rotation(j),(cell(i,j))); -pc32_yield_forestry_future_reg(i)$(pc32_yield_forestry_future_reg(i) = 0) = smax(cell(i,j),pc32_yield_forestry_future(j)); +p32_plant_contr(t,i)$(p32_plant_contr(t,i) > s32_plant_contr_max) = s32_plant_contr_max; + +** demand for establishment decision depends on s32_demand_establishment: +** s32_demand_establishment = 0 static (establishment based on current demand) +** s32_demand_establishment = 1 forward looking (establishment based on future demand according to rotation length) +if(s32_demand_establishment = 1, + if(m_year(t) <= sm_fix_SSP2, + p32_demand_forestry_future(t,i,kforestry) = sum(t2$(m_year(t2) = sm_fix_SSP2), pm_demand_forestry(t2,i,kforestry)); + else + p32_demand_forestry_future(t,i,kforestry) = sum(t_ext$(t_ext.pos = t.pos + p32_rotation_regional(t,i)),pm_demand_forestry(t_ext,i,kforestry)); + ); +else + p32_demand_forestry_future(t,i,kforestry) = pm_demand_forestry(t,i,kforestry); + ); + +p32_forestry_product_dist(t,i,kforestry)$(p32_demand_forestry_future(t,i,kforestry) > 0) = p32_demand_forestry_future(t,i,kforestry) / sum(kforestry2, p32_demand_forestry_future(t,i,kforestry2)); +p32_forestry_product_dist(t,i,kforestry)$(p32_demand_forestry_future(t,i,kforestry) = 0) = 1/card(kforestry); -** Display -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))); +p32_future_to_current_demand_ratio(t,i)$(sum(kforestry, pm_demand_forestry(t,i,kforestry)) > 0) = sum(kforestry, p32_demand_forestry_future(t,i,kforestry)) / sum(kforestry, pm_demand_forestry(t,i,kforestry)); +p32_future_to_current_demand_ratio(t,i)$(sum(kforestry, pm_demand_forestry(t,i,kforestry)) = 0) = 0; * 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)) diff --git a/modules/32_forestry/dynamic_feb21/realization.gms b/modules/32_forestry/dynamic_may24/realization.gms similarity index 79% rename from modules/32_forestry/dynamic_feb21/realization.gms rename to modules/32_forestry/dynamic_may24/realization.gms index 6e839fd3e8..dd607eee92 100644 --- a/modules/32_forestry/dynamic_feb21/realization.gms +++ b/modules/32_forestry/dynamic_may24/realization.gms @@ -5,15 +5,15 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -*' @description The main feature of the this realization is afforestation for CDR -*' and timber production. Afforestation can be modelled exogenously (prescribed +*' @description The main features of the this realization are re/afforestation for CDR +*' and timber production. Re/afforestation can be modelled exogenously (prescribed *' by NPI/NDC policies) and/or endogenously (incentivized by a reward for CDR). *' National policies implemented (NPI) and nationally determined contributions to -*' the Paris agreement (NDC) for afforestation are based on country reports. The +*' the Paris agreement (NDC) for re/afforestation are based on country reports. The *' interface `vm_cdr_aff` includes the expected CDR and local bph effects from -*' afforestation depending on the planning horizon `s32_planing_horizon`. The -*' reward for CDR and local bph effects from afforestation is calculated in the -*' [56_ghg_policy] module. In this realization, afforestation is modeled by default +*' re/afforestation depending on the planning horizon `s32_planing_horizon`. The +*' reward for CDR and local bph effects from re/afforestation is calculated in the +*' [56_ghg_policy] module. In this realization, re/afforestation is modeled by default *' as regrowth of natural vegetation (see @humpenoder_investigating_2014 for details on the implemenation). *' The regrowth of natural vegetation follows S-shaped growth curves, which are *' parametrized based on @braakhekke_modelling_2019. Additionally this module @@ -34,12 +34,12 @@ *' @limitations Rotation lengths for timber plantations are not endogenous. *####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/32_forestry/dynamic_feb21/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/32_forestry/dynamic_feb21/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/32_forestry/dynamic_feb21/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/32_forestry/dynamic_feb21/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/32_forestry/dynamic_feb21/scaling.gms" -$Ifi "%phase%" == "preloop" $include "./modules/32_forestry/dynamic_feb21/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/32_forestry/dynamic_feb21/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/32_forestry/dynamic_feb21/postsolve.gms" +$Ifi "%phase%" == "sets" $include "./modules/32_forestry/dynamic_may24/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/32_forestry/dynamic_may24/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/32_forestry/dynamic_may24/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/32_forestry/dynamic_may24/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/32_forestry/dynamic_may24/scaling.gms" +$Ifi "%phase%" == "preloop" $include "./modules/32_forestry/dynamic_may24/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/32_forestry/dynamic_may24/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/32_forestry/dynamic_may24/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/32_forestry/dynamic_feb21/scaling.gms b/modules/32_forestry/dynamic_may24/scaling.gms similarity index 87% rename from modules/32_forestry/dynamic_feb21/scaling.gms rename to modules/32_forestry/dynamic_may24/scaling.gms index 284349ec52..029d892a2e 100644 --- a/modules/32_forestry/dynamic_feb21/scaling.gms +++ b/modules/32_forestry/dynamic_may24/scaling.gms @@ -5,8 +5,8 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -v32_cost_establishment.scale(i) = 10e3; +v32_cost_establishment.scale(i) = 10e4; v32_cost_recur.scale(i) = 10e4; -vm_cost_fore.scale(i) = 10e4; -v32_cost_hvarea.scale(i)$(s32_hvarea = 1 OR s32_hvarea = 2) = 10e3; +vm_cost_fore.scale(i) = 10e5; +v32_cost_hvarea.scale(i)$(s32_hvarea = 1 OR s32_hvarea = 2) = 10e4; 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_may24/sets.gms similarity index 100% rename from modules/32_forestry/dynamic_feb21/sets.gms rename to modules/32_forestry/dynamic_may24/sets.gms diff --git a/modules/32_forestry/input/files b/modules/32_forestry/input/files index 97cfd1ed3d..b4ae3f22af 100644 --- a/modules/32_forestry/input/files +++ b/modules/32_forestry/input/files @@ -3,12 +3,7 @@ aff_unrestricted.cs2 aff_noboreal.cs2 aff_onlytropical.cs2 npi_ndc_aff_pol.cs3 -f32_plant_prod_share.csv f32_bph_effect_noTCRE.cs3 f32_localTCRE.cs3 -f32_ac_dist.csv -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 61a7880e7b..54f13c6e06 100644 --- a/modules/32_forestry/module.gms +++ b/modules/32_forestry/module.gms @@ -22,5 +22,5 @@ *' @authors Florian Humpenöder, Abhijeet Mishra *###################### R SECTION START (MODULETYPES) ########################## -$Ifi "%forestry%" == "dynamic_feb21" $include "./modules/32_forestry/dynamic_feb21/realization.gms" +$Ifi "%forestry%" == "dynamic_may24" $include "./modules/32_forestry/dynamic_may24/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/34_urban/exo_nov21/realization.gms b/modules/34_urban/exo_nov21/realization.gms index a1e3dee0bd..bf154011f1 100644 --- a/modules/34_urban/exo_nov21/realization.gms +++ b/modules/34_urban/exo_nov21/realization.gms @@ -17,6 +17,7 @@ $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%" == "scaling" $include "./modules/34_urban/exo_nov21/scaling.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" diff --git a/modules/34_urban/exo_nov21/scaling.gms b/modules/34_urban/exo_nov21/scaling.gms new file mode 100644 index 0000000000..dec0009dd7 --- /dev/null +++ b/modules/34_urban/exo_nov21/scaling.gms @@ -0,0 +1,8 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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_urban.scale(j) = 10e4; diff --git a/modules/35_natveg/dynamic_feb21/declarations.gms b/modules/35_natveg/dynamic_feb21/declarations.gms deleted file mode 100644 index e949a349a4..0000000000 --- a/modules/35_natveg/dynamic_feb21/declarations.gms +++ /dev/null @@ -1,128 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-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 - s35_shift number of 5-year age-classes corresponding to current time step length (1) -; - -parameters - 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_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,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) Other land expansion (mio. ha) - q35_other_reduction(j,ac) Other land reduction (mio. ha) - q35_secdforest_expansion(j) 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 - 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 natveg land compared to previous timestep (mio. ha) - v35_other_expansion(j) Other land expansion compared to previous timestep (mio. ha) - v35_other_reduction(j,ac) Other land reduction compared to previous timestep (mio. ha) - v35_secdforest_expansion(j) 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) - 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) -; - - -*#################### 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,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,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,type) Other land expansion (mio. ha) - oq35_other_reduction(t,j,ac,type) Other land reduction (mio. ha) - oq35_secdforest_expansion(t,j,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/input/files b/modules/35_natveg/input/files index f1603f4a64..dc39074a1e 100644 --- a/modules/35_natveg/input/files +++ b/modules/35_natveg/input/files @@ -2,5 +2,6 @@ npi_ndc_ad_aolc_pol.cs3 f35_forest_disturbance_share.cs4 f35_forest_lost_share.cs3 -f35_gs_relativetarget.cs4 f35_forest_shock.csv +pot_forest_area.cs2 +pot_forest_area_0.5.mz diff --git a/modules/35_natveg/module.gms b/modules/35_natveg/module.gms index 9fec0983aa..8a39eecaa9 100644 --- a/modules/35_natveg/module.gms +++ b/modules/35_natveg/module.gms @@ -17,5 +17,5 @@ *' @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%" == "pot_forest_may24" $include "./modules/35_natveg/pot_forest_may24/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/35_natveg/pot_forest_may24/declarations.gms b/modules/35_natveg/pot_forest_may24/declarations.gms new file mode 100644 index 0000000000..a583d4da6c --- /dev/null +++ b/modules/35_natveg/pot_forest_may24/declarations.gms @@ -0,0 +1,136 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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 + s35_shift number of 5-year age-classes corresponding to current time step length (1) +; + +parameters + i35_secdforest(j,ac) Initial secdforest (mio. ha) + i35_land_other(j,othertype35,ac) Initial other land (mio. ha) + p35_secdforest(t,j,ac) Secdforest per age class (mio. ha) + p35_land_other(t,j,othertype35,ac) Other land per age class (mio. ha) + pc35_secdforest(j,ac) Secdforest per age class in current time step (mio. ha) + pc35_land_other(j,othertype35,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) + pc35_forest_recovery_shr(j) Forest share in natveg recovery (1) + p35_forest_recovery_area(t,j,ac) Recovered forest (mio. ha) + p35_maturesecdf(t,j,ac) Matured secondary forest (mio. ha) + pm_max_forest_est(t,j) Overall forest establishment potential in current time step (mio. ha) + pc35_max_forest_recovery(j) Maximum forest recovery potential after land abandonement (mio. ha) + p35_carbon_density_other(t,j,othertype35,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_start_ac(j,ac,land_natveg) Initial Natural vegetation area (mio. ha) + 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) + p35_restoration_shift(j) Restoration of other land instead of secdforest (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,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,othertype35) Other land expansion (mio. ha) + q35_other_reduction(j,othertype35,ac) Other land reduction (mio. ha) + q35_secdforest_expansion(j) Secdforest expansion (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 regeneration (mio. ha) + q35_max_forest_establishment(j) Maximum forestry regeneration based on potential forest area (mio. ha) + q35_other_regeneration(j) Other land regeneration (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,othertype35,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) + q35_secdforest_restoration(j) Secondary forest restoration constraint (mio. ha) + q35_other_restoration(j) Other land restoration constraint (mio. ha) +; + +positive variables + v35_secdforest(j,ac) Detailed stock of secdforest (mio. ha) + vm_land_other(j,othertype35,ac) Detailed stock of other land (mio. ha) + vm_landdiff_natveg Aggregated difference in natveg land compared to previous timestep (mio. ha) + v35_other_expansion(j,othertype35) Other land expansion compared to previous timestep (mio. ha) + v35_other_reduction(j,othertype35,ac) Other land reduction compared to previous timestep (mio. ha) + v35_secdforest_expansion(j) 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,othertype35,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) +; + + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov35_secdforest(t,j,ac,type) Detailed stock of secdforest (mio. ha) + ov_land_other(t,j,othertype35,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,othertype35,type) Other land expansion compared to previous timestep (mio. ha) + ov35_other_reduction(t,j,othertype35,ac,type) Other land reduction compared to previous timestep (mio. ha) + ov35_secdforest_expansion(t,j,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,othertype35,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,othertype35,type) Other land expansion (mio. ha) + oq35_other_reduction(t,j,othertype35,ac,type) Other land reduction (mio. ha) + oq35_secdforest_expansion(t,j,type) Secdforest expansion (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 regeneration (mio. ha) + oq35_max_forest_establishment(t,j,type) Maximum forestry regeneration based on potential forest area (mio. ha) + oq35_other_regeneration(t,j,type) Other land regeneration (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,othertype35,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) + oq35_secdforest_restoration(t,j,type) Secondary forest restoration constraint (mio. ha) + oq35_other_restoration(t,j,type) Other land restoration constraint (mio. ha) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/35_natveg/dynamic_feb21/equations.gms b/modules/35_natveg/pot_forest_may24/equations.gms similarity index 64% rename from modules/35_natveg/dynamic_feb21/equations.gms rename to modules/35_natveg/pot_forest_may24/equations.gms index 9b3f100c5b..034a61129b 100644 --- a/modules/35_natveg/dynamic_feb21/equations.gms +++ b/modules/35_natveg/pot_forest_may24/equations.gms @@ -10,7 +10,7 @@ q35_land_secdforest(j2) .. vm_land(j2,"secdforest") =e= sum(ac, v35_secdforest(j2,ac)); - q35_land_other(j2) .. vm_land(j2,"other") =e= sum(ac, v35_other(j2,ac)); + q35_land_other(j2) .. vm_land(j2,"other") =e= sum((othertype35,ac), vm_land_other(j2,othertype35,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 @@ -19,7 +19,18 @@ 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)); + sum((ct,land_natveg), pm_land_conservation(ct,j2,land_natveg,"protect")); + + q35_secdforest_restoration(j2) .. + sum(land_ag, vm_lu_transitions(j2,land_ag,"secdforest")) + + vm_lu_transitions(j2,"forestry","secdforest") + =g= + p35_land_restoration(j2,"secdforest"); + + q35_other_restoration(j2) .. + sum(land_ag, vm_lu_transitions(j2,land_ag,"other")) + =g= + p35_land_restoration(j2,"other"); *' Carbon stocks for primary forest, secondary forest or other natural land are calculated *' as the product of respective area and carbon density. @@ -34,11 +45,11 @@ 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"); + m_carbon_stock_ac(v35_secdforest,pm_carbon_density_secdforest_ac,"ac","ac_sub"); 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"); + m_carbon_stock_ac(vm_land_other,p35_carbon_density_other,"othertype35,ac","othertype35,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). @@ -53,7 +64,7 @@ q35_bv_other(j2,potnatveg) .. vm_bv(j2,"other",potnatveg) =e= - sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v35_other(j2,ac)) * + sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), sum(othertype35, vm_land_other(j2,othertype35,ac))) * fm_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); *' NPI/NDC land protection policies based on country reports are implemented as @@ -61,7 +72,7 @@ *' 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") + q35_min_forest(j2) .. sum(land_forest, vm_land(j2,land_forest)) =g= sum(ct, p35_min_forest(ct,j2)); @@ -74,19 +85,19 @@ q35_landdiff .. vm_landdiff_natveg =e= sum(j2, - v35_other_expansion(j2) - + sum(ac_sub, v35_other_reduction(j2,ac_sub)) + sum(othertype35,v35_other_expansion(j2,othertype35)) + + sum((othertype35,ac_sub), v35_other_reduction(j2,othertype35,ac_sub)) + v35_secdforest_expansion(j2) - + sum(ac_sub, v35_secdforest_reduction(j2,ac_sub)) + + sum((ac_sub), v35_secdforest_reduction(j2,ac_sub)) + v35_primforest_reduction(j2)); - q35_other_expansion(j2) .. - v35_other_expansion(j2) =e= - sum(ac_est, v35_other(j2,ac_est)); + q35_other_expansion(j2,othertype35) .. + v35_other_expansion(j2,othertype35) =e= + sum(ac_est, vm_land_other(j2,othertype35,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); + q35_other_reduction(j2,othertype35,ac_sub) .. + v35_other_reduction(j2,othertype35,ac_sub) =e= + pc35_land_other(j2,othertype35,ac_sub) - vm_land_other(j2,othertype35,ac_sub); q35_secdforest_expansion(j2) .. v35_secdforest_expansion(j2) =e= @@ -115,8 +126,8 @@ q35_cost_hvarea(i2).. vm_cost_hvarea_natveg(i2) =e= sum((ct,cell(i2,j2),ac_sub), v35_hvarea_secdforest(j2,ac_sub)) * s35_timber_harvest_cost_secdforest - + sum((ct,cell(i2,j2),ac_sub), v35_hvarea_other(j2, ac_sub)) * s35_timber_harvest_cost_other - + sum((ct,cell(i2,j2)), v35_hvarea_primforest(j2)) * s35_timber_harvest_cost_primforest + + sum((ct,cell(i2,j2),othertype35,ac_sub), v35_hvarea_other(j2,othertype35,ac_sub)) * s35_timber_harvest_cost_other + + sum((ct,cell(i2,j2)), v35_hvarea_primforest(j2)) * s35_timber_harvest_cost_primforest ; ** Secondary forest @@ -124,8 +135,8 @@ q35_cost_hvarea(i2).. *' area under production with corresponding yields of secondary forests, divided by the timestep length. q35_prod_secdforest(j2).. - sum(kforestry, vm_prod_natveg(j2,"secdforest",kforestry)) - =e= + 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; ** Primary forest @@ -133,9 +144,9 @@ q35_prod_secdforest(j2).. *' area under production with corresponding yields of primary forests, divided by the timestep length. q35_prod_primforest(j2).. - sum(kforestry, vm_prod_natveg(j2,"primforest",kforestry)) - =e= - v35_hvarea_primforest(j2) * sum(ct, pm_timber_yield(ct,j2,"acx","primforest")) / m_timestep_length_forestry; + sum(kforestry, vm_prod_natveg(j2,"primforest",kforestry)) + =e= + v35_hvarea_primforest(j2) * sum(ct, pm_timber_yield(ct,j2,"acx","primforest")) / m_timestep_length_forestry; ** Other land *' Wood-fuel production from other land is calculated by multiplying the area under @@ -143,10 +154,12 @@ q35_prod_primforest(j2).. *' Wood production from other landis not allowed. q35_prod_other(j2).. - vm_prod_natveg(j2,"other","woodfuel") - =e= - sum(ac_sub, v35_hvarea_other(j2,ac_sub) * sum(ct, pm_timber_yield(ct,j2,ac_sub,"other"))) / m_timestep_length_forestry - ; + vm_prod_natveg(j2,"other","woodfuel") + =e= + (sum(ac_sub, v35_hvarea_other(j2,"othernat",ac_sub) * sum(ct, pm_timber_yield(ct,j2,ac_sub,"other"))) + + sum(ac_sub, v35_hvarea_other(j2,"youngsecdf",ac_sub) * sum(ct, pm_timber_yield(ct,j2,ac_sub,"secdforest")))) + / m_timestep_length_forestry + ; *' Following equations show the harvested area from natural vegetation i.e. primary *' forests, secondary forests and other land. Important to note here that no wood @@ -155,20 +168,31 @@ q35_prod_other(j2).. *' not all lost area is (or should be) used for production. q35_hvarea_secdforest(j2,ac_sub).. - v35_hvarea_secdforest(j2,ac_sub) - =l= - v35_secdforest_reduction(j2,ac_sub); + v35_hvarea_secdforest(j2,ac_sub) + =l= + v35_secdforest_reduction(j2,ac_sub); q35_hvarea_primforest(j2).. - v35_hvarea_primforest(j2) - =l= - v35_primforest_reduction(j2); + v35_hvarea_primforest(j2) + =l= + v35_primforest_reduction(j2); + +q35_hvarea_other(j2,othertype35,ac_sub).. + v35_hvarea_other(j2,othertype35,ac_sub) + =l= + v35_other_reduction(j2,othertype35,ac_sub); + -q35_hvarea_other(j2,ac_sub).. - v35_hvarea_other(j2,ac_sub) - =l= - v35_other_reduction(j2,ac_sub); +*' The constraint for overall forest establishment, including forestry, is given +*' by the remaining potential forest area, which is derived from the potential +*' natural forestarea minus the recovering secondary forest area. +q35_max_forest_establishment(j2).. + sum(land_forest, vm_landexpansion(j2,land_forest)) + =l= + sum(ct,pm_max_forest_est(ct,j2)) + - sum(ac, vm_land_other(j2,"youngsecdf",ac) ) + ; *' Harvested secondary forest is still considered secondary forests due to *' restrictive NPI definitions. Also primary forest harvested will be considered @@ -176,20 +200,21 @@ q35_hvarea_other(j2,ac_sub).. *' secondary forest and ends up in the youngest age-class (and follows regrowth) 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") - ; + 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_regeneration(j2).. - sum(ac_est, v35_other(j2,ac_est)) - =g= - sum(ac_sub,v35_hvarea_other(j2,ac_sub)) - ; + sum(ac_est, vm_land_other(j2,"othernat",ac_est)) + =e= + sum((othertype35,ac_sub),v35_hvarea_other(j2,othertype35,ac_sub)) + + vm_landexpansion(j2,"other") + ; *' The following two constraints distribute additions to secdforest and other land *' over ac_est, which depends on the time step length (e.g. ac0 and ac5 for a 10 year time step). @@ -198,5 +223,5 @@ q35_secdforest_est(j2,ac_est) .. v35_secdforest(j2,ac_est) =e= sum(ac_est2, v35_secdforest(j2,ac_est2))/card(ac_est2); q35_other_est(j2,ac_est) .. -v35_other(j2,ac_est) =e= sum(ac_est2, v35_other(j2,ac_est2))/card(ac_est2); +vm_land_other(j2,"othernat",ac_est) =e= sum(ac_est2, vm_land_other(j2,"othernat",ac_est2))/card(ac_est2); diff --git a/modules/35_natveg/dynamic_feb21/input.gms b/modules/35_natveg/pot_forest_may24/input.gms similarity index 79% rename from modules/35_natveg/dynamic_feb21/input.gms rename to modules/35_natveg/pot_forest_may24/input.gms index 89828c827e..d4922eae94 100644 --- a/modules/35_natveg/dynamic_feb21/input.gms +++ b/modules/35_natveg/pot_forest_may24/input.gms @@ -9,8 +9,13 @@ $setglobal c35_ad_policy npi $setglobal c35_aolc_policy npi $setglobal c35_shock_scenario none +$setglobal c35_pot_forest_scenario cc +* options: cc (climate change) +* nocc (no climate change) +* nocc_hist (no climate change after year defined by sm_fix_cc) + scalars -s35_hvarea Flag for harvested area (0=zero 1=exognous 2=endogneous) / 0 / +s35_hvarea Flag for harvested area (0=zero 1=exognous 2=endogneous) / 2 / 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 / @@ -18,7 +23,7 @@ s35_timber_harvest_cost_secdforest Cost for harvesting from secondary forest ( 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_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) / 2 / s35_forest_damage Damage simulation in forests (0=none 1=shifting agriculture 2= Damage from shifting agriculture is faded out by c35_forest_damage_end 4= f35_forest_shock scenario) / 2 / s35_forest_damage_end Year of forest damage end (1) / 2050 / ; @@ -48,9 +53,13 @@ $include "./modules/35_natveg/input/f35_forest_disturbance_share.cs4" $offdelim /; -parameter f35_gs_relativetarget(i) Relative growing stock target in each region (m3 per ha) +parameter f35_pot_forest_area(t_all,j) Potential forest area (mio. ha) / $ondelim -$include "./modules/35_natveg/input/f35_gs_relativetarget.cs4" +$include "./modules/35_natveg/input/pot_forest_area.cs2" $offdelim /; + +$if "%c35_pot_forest_scenario%" == "nocc" f35_pot_forest_area(t_all,j) = f35_pot_forest_area("y1995",j); +$if "%c35_pot_forest_scenario%" == "nocc_hist" f35_pot_forest_area(t_all,j)$(m_year(t_all) > sm_fix_cc) = f35_pot_forest_area(t_all,j)$(m_year(t_all) = sm_fix_cc); +m_fillmissingyears(f35_pot_forest_area,"j"); diff --git a/modules/35_natveg/dynamic_feb21/postsolve.gms b/modules/35_natveg/pot_forest_may24/postsolve.gms similarity index 75% rename from modules/35_natveg/dynamic_feb21/postsolve.gms rename to modules/35_natveg/pot_forest_may24/postsolve.gms index 41f427750b..ec39f68557 100644 --- a/modules/35_natveg/dynamic_feb21/postsolve.gms +++ b/modules/35_natveg/pot_forest_may24/postsolve.gms @@ -6,22 +6,26 @@ *** | Contact: magpie@pik-potsdam.de *secdforest age class calculation -p35_secdforest(t,j,ac) = v35_secdforest.l(j,ac); +pc35_secdforest(j,ac) = v35_secdforest.l(j,ac); *other land age class calculation -p35_other(t,j,ac) = v35_other.l(j,ac); +pc35_land_other(j,othertype35,ac) = vm_land_other.l(j,othertype35,ac); + +* Set the forest establishment bound for the next time step +pm_max_forest_est(t+1,j) = f35_pot_forest_area(t+1,j) - sum(land_forest, vm_land.l(j,land_forest)); +pm_max_forest_est(t+1,j)$(pm_max_forest_est(t+1,j) < 1e-6) = 0; *#################### 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_land_other(t,j,othertype35,ac,"marginal") = vm_land_other.m(j,othertype35,ac); ov_landdiff_natveg(t,"marginal") = vm_landdiff_natveg.m; - ov35_other_expansion(t,j,"marginal") = v35_other_expansion.m(j); - ov35_other_reduction(t,j,ac,"marginal") = v35_other_reduction.m(j,ac); + ov35_other_expansion(t,j,othertype35,"marginal") = v35_other_expansion.m(j,othertype35); + ov35_other_reduction(t,j,othertype35,ac,"marginal") = v35_other_reduction.m(j,othertype35,ac); ov35_secdforest_expansion(t,j,"marginal") = v35_secdforest_expansion.m(j); 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_other(t,j,othertype35,ac,"marginal") = v35_hvarea_other.m(j,othertype35,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); @@ -33,16 +37,17 @@ p35_other(t,j,ac) = v35_other.l(j,ac); 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,"marginal") = q35_other_expansion.m(j); - oq35_other_reduction(t,j,ac,"marginal") = q35_other_reduction.m(j,ac); + oq35_other_expansion(t,j,othertype35,"marginal") = q35_other_expansion.m(j,othertype35); + oq35_other_reduction(t,j,othertype35,ac,"marginal") = q35_other_reduction.m(j,othertype35,ac); oq35_secdforest_expansion(t,j,"marginal") = q35_secdforest_expansion.m(j); 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_max_forest_establishment(t,j,"marginal") = q35_max_forest_establishment.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_other(t,j,othertype35,ac,"marginal") = q35_hvarea_other.m(j,othertype35,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); @@ -53,16 +58,18 @@ p35_other(t,j,ac) = v35_other.l(j,ac); 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); + oq35_secdforest_restoration(t,j,"marginal") = q35_secdforest_restoration.m(j); + oq35_other_restoration(t,j,"marginal") = q35_other_restoration.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_land_other(t,j,othertype35,ac,"level") = vm_land_other.l(j,othertype35,ac); ov_landdiff_natveg(t,"level") = vm_landdiff_natveg.l; - ov35_other_expansion(t,j,"level") = v35_other_expansion.l(j); - ov35_other_reduction(t,j,ac,"level") = v35_other_reduction.l(j,ac); + ov35_other_expansion(t,j,othertype35,"level") = v35_other_expansion.l(j,othertype35); + ov35_other_reduction(t,j,othertype35,ac,"level") = v35_other_reduction.l(j,othertype35,ac); ov35_secdforest_expansion(t,j,"level") = v35_secdforest_expansion.l(j); 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_other(t,j,othertype35,ac,"level") = v35_hvarea_other.l(j,othertype35,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); @@ -74,16 +81,17 @@ p35_other(t,j,ac) = v35_other.l(j,ac); 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,"level") = q35_other_expansion.l(j); - oq35_other_reduction(t,j,ac,"level") = q35_other_reduction.l(j,ac); + oq35_other_expansion(t,j,othertype35,"level") = q35_other_expansion.l(j,othertype35); + oq35_other_reduction(t,j,othertype35,ac,"level") = q35_other_reduction.l(j,othertype35,ac); oq35_secdforest_expansion(t,j,"level") = q35_secdforest_expansion.l(j); 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_max_forest_establishment(t,j,"level") = q35_max_forest_establishment.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_other(t,j,othertype35,ac,"level") = q35_hvarea_other.l(j,othertype35,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); @@ -94,16 +102,18 @@ p35_other(t,j,ac) = v35_other.l(j,ac); 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); + oq35_secdforest_restoration(t,j,"level") = q35_secdforest_restoration.l(j); + oq35_other_restoration(t,j,"level") = q35_other_restoration.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_land_other(t,j,othertype35,ac,"upper") = vm_land_other.up(j,othertype35,ac); ov_landdiff_natveg(t,"upper") = vm_landdiff_natveg.up; - ov35_other_expansion(t,j,"upper") = v35_other_expansion.up(j); - ov35_other_reduction(t,j,ac,"upper") = v35_other_reduction.up(j,ac); + ov35_other_expansion(t,j,othertype35,"upper") = v35_other_expansion.up(j,othertype35); + ov35_other_reduction(t,j,othertype35,ac,"upper") = v35_other_reduction.up(j,othertype35,ac); ov35_secdforest_expansion(t,j,"upper") = v35_secdforest_expansion.up(j); 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_other(t,j,othertype35,ac,"upper") = v35_hvarea_other.up(j,othertype35,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); @@ -115,16 +125,17 @@ p35_other(t,j,ac) = v35_other.l(j,ac); 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,"upper") = q35_other_expansion.up(j); - oq35_other_reduction(t,j,ac,"upper") = q35_other_reduction.up(j,ac); + oq35_other_expansion(t,j,othertype35,"upper") = q35_other_expansion.up(j,othertype35); + oq35_other_reduction(t,j,othertype35,ac,"upper") = q35_other_reduction.up(j,othertype35,ac); oq35_secdforest_expansion(t,j,"upper") = q35_secdforest_expansion.up(j); 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_max_forest_establishment(t,j,"upper") = q35_max_forest_establishment.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_other(t,j,othertype35,ac,"upper") = q35_hvarea_other.up(j,othertype35,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); @@ -135,16 +146,18 @@ p35_other(t,j,ac) = v35_other.l(j,ac); 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); + oq35_secdforest_restoration(t,j,"upper") = q35_secdforest_restoration.up(j); + oq35_other_restoration(t,j,"upper") = q35_other_restoration.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_land_other(t,j,othertype35,ac,"lower") = vm_land_other.lo(j,othertype35,ac); ov_landdiff_natveg(t,"lower") = vm_landdiff_natveg.lo; - ov35_other_expansion(t,j,"lower") = v35_other_expansion.lo(j); - ov35_other_reduction(t,j,ac,"lower") = v35_other_reduction.lo(j,ac); + ov35_other_expansion(t,j,othertype35,"lower") = v35_other_expansion.lo(j,othertype35); + ov35_other_reduction(t,j,othertype35,ac,"lower") = v35_other_reduction.lo(j,othertype35,ac); ov35_secdforest_expansion(t,j,"lower") = v35_secdforest_expansion.lo(j); 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_other(t,j,othertype35,ac,"lower") = v35_hvarea_other.lo(j,othertype35,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); @@ -156,16 +169,17 @@ p35_other(t,j,ac) = v35_other.l(j,ac); 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,"lower") = q35_other_expansion.lo(j); - oq35_other_reduction(t,j,ac,"lower") = q35_other_reduction.lo(j,ac); + oq35_other_expansion(t,j,othertype35,"lower") = q35_other_expansion.lo(j,othertype35); + oq35_other_reduction(t,j,othertype35,ac,"lower") = q35_other_reduction.lo(j,othertype35,ac); oq35_secdforest_expansion(t,j,"lower") = q35_secdforest_expansion.lo(j); 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_max_forest_establishment(t,j,"lower") = q35_max_forest_establishment.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_other(t,j,othertype35,ac,"lower") = q35_hvarea_other.lo(j,othertype35,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); @@ -176,4 +190,6 @@ p35_other(t,j,ac) = v35_other.l(j,ac); 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); + oq35_secdforest_restoration(t,j,"lower") = q35_secdforest_restoration.lo(j); + oq35_other_restoration(t,j,"lower") = q35_other_restoration.lo(j); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/35_natveg/dynamic_feb21/preloop.gms b/modules/35_natveg/pot_forest_may24/preloop.gms similarity index 73% rename from modules/35_natveg/dynamic_feb21/preloop.gms rename to modules/35_natveg/pot_forest_may24/preloop.gms index 85a49664f4..7d04a1928d 100644 --- a/modules/35_natveg/dynamic_feb21/preloop.gms +++ b/modules/35_natveg/pot_forest_may24/preloop.gms @@ -6,8 +6,8 @@ *** | Contact: magpie@pik-potsdam.de ** initialize other land -i35_other(j,ac) = 0; -i35_other(j,"acx") = pcm_land(j,"other"); +i35_land_other(j,othertype35,ac) = 0; +i35_land_other(j,"othernat","acx") = pcm_land(j,"other"); ** initialize secdforest area depending on switch. if(s35_secdf_distribution = 0, @@ -32,17 +32,24 @@ elseif s35_secdf_distribution = 2, *use residual approach to avoid rounding errors 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_recovered_forest(t,j,ac) = 0; - *initialize parameter -p35_other(t,j,ac) = 0; +p35_land_other(t,j,othertype35,ac) = 0; p35_secdforest(t,j,ac) = 0; * initialize forest disturbance losses p35_disturbance_loss_secdf(t,j,ac) = 0; p35_disturbance_loss_primf(t,j) = 0; +* ------------------------------------------------------------- +* Initialize remaining potential forest establishment area +* ------------------------------------------------------------- + +* Forest establishment is constrained by the potential forest area in each cluster. +* Hence, the area for forest establishments is given by the potential forest +* area minus all forest areas in the previous time step. +pm_max_forest_est(t,j) = f35_pot_forest_area(t,j) - sum(land_forest, pcm_land(j,land_forest)); +pm_max_forest_est(t,j)$(pm_max_forest_est(t,j) < 1e-6) = 0; + * ----------------------------------------- * Land conservation for climate mitigation * ----------------------------------------- @@ -66,3 +73,10 @@ p35_land_start_ac(j,ac,"secdforest") = i35_secdforest(j,ac); * Set forest damage trajectory * ----------------------------- m_sigmoid_time_interpol(p35_damage_fader,sm_fix_SSP2,s35_forest_damage_end,0,1); + +* --------------------------------------- +* Initialise natveg in first time step +* --------------------------------------- + + pc35_secdforest(j,ac) = i35_secdforest(j,ac); + pc35_land_other(j,othertype35,ac) = i35_land_other(j,othertype35,ac); diff --git a/modules/35_natveg/dynamic_feb21/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms similarity index 52% rename from modules/35_natveg/dynamic_feb21/presolve.gms rename to modules/35_natveg/pot_forest_may24/presolve.gms index 97a6f33b35..406ccbc762 100644 --- a/modules/35_natveg/dynamic_feb21/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -5,14 +5,6 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | 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); -else - 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 * ---------------------------------------------------- @@ -47,13 +39,50 @@ pc35_secdforest(j,ac_sub) = pc35_secdforest(j,ac_sub) - p35_disturbance_loss_sec pcm_land(j,"primforest") = pcm_land(j,"primforest") - p35_disturbance_loss_primf(t,j); vm_land.l(j,"primforest") = pcm_land(j,"primforest"); + +* ------------------------------------------------- +* Calculate area of secondary forest recovery +* ------------------------------------------------- + +*** Calculate the upper boundary for secondary forest recovery +pc35_max_forest_recovery(j) = pm_max_forest_est(t,j) - sum(ac, pc35_land_other(j,"youngsecdf",ac)); + +*** Distribute forestry abandonement +* Abandoned forestry is directly shifted into p35_forest_recovery_area(t,j,ac_est) because it is +* assumed that forestry was located in areas suitable to grow forests. +p35_forest_recovery_area(t,j,ac_est) = vm_lu_transitions.l(j,"forestry","other")/card(ac_est2); +p35_forest_recovery_area(t,j,ac_est)$(sum(ac_est2, p35_forest_recovery_area(t,j,ac_est2)) > pc35_max_forest_recovery(j)) = pc35_max_forest_recovery(j)/card(ac_est2); + +* The proportion of secondary forest recovery in total natveg +* recovery is derived from the remaining forest recovery area +pc35_forest_recovery_shr(j) = 0; +pc35_forest_recovery_shr(j)$((sum(land_ag, pcm_land(j,land_ag))+pcm_land(j,"urban")) > 0) = + (pc35_max_forest_recovery(j) - sum(ac_est, p35_forest_recovery_area(t,j,ac_est))) + / (sum(land_ag, pcm_land(j,land_ag))+pcm_land(j,"urban")); +pc35_forest_recovery_shr(j)$(pc35_forest_recovery_shr(j) < 1e-6) = 0; +pc35_forest_recovery_shr(j)$(pc35_forest_recovery_shr(j) > 1) = 1; +* Abandoned land pc35_land_other(j,"othernat",ac_est) that has not yet been allocated to +* p35_forest_recovery_area(t,j,ac_est) is then distributed proportionally using the forest recovery share. +p35_forest_recovery_area(t,j,ac_est) = p35_forest_recovery_area(t,j,ac_est) + + (pc35_land_other(j,"othernat",ac_est) - p35_forest_recovery_area(t,j,ac_est)) + * pc35_forest_recovery_shr(j); +p35_forest_recovery_area(t,j,ac_est)$(sum(ac_est2, p35_forest_recovery_area(t,j,ac_est2)) > pc35_max_forest_recovery(j)) = pc35_max_forest_recovery(j)/card(ac_est2); +p35_forest_recovery_area(t,j,ac_est)$(p35_forest_recovery_area(t,j,ac_est) > pc35_land_other(j,"othernat",ac_est)) = pc35_land_other(j,"othernat",ac_est); +p35_forest_recovery_area(t,j,ac_est)$(p35_forest_recovery_area(t,j,ac_est) < 1e-6) = 0; +pc35_land_other(j,"othernat",ac_est) = pc35_land_other(j,"othernat",ac_est) - p35_forest_recovery_area(t,j,ac_est); +pc35_land_other(j,"youngsecdf",ac_est) = pc35_land_other(j,"youngsecdf",ac_est) + p35_forest_recovery_area(t,j,ac_est); + +* ------------------------------------------------ +* Natural vegetation growth (age-class shift) +* ------------------------------------------------ + * Regrowth of natural vegetation (natural succession) is modelled by shifting age-classes according to time step length. s35_shift = m_timestep_length_forestry/5; * example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s35_shift = 1) - p35_other(t,j,ac)$(ord(ac) > s35_shift) = pc35_other(j,ac-s35_shift); + p35_land_other(t,j,othertype35,ac)$(ord(ac) > s35_shift) = pc35_land_other(j,othertype35,ac-s35_shift); * account for cases at the end of the age class set (s35_shift > 1) which are not shifted by the above calculation - p35_other(t,j,"acx") = p35_other(t,j,"acx") - + sum(ac$(ord(ac) > card(ac)-s35_shift), pc35_other(j,ac)); + p35_land_other(t,j,othertype35,"acx") = p35_land_other(t,j,othertype35,"acx") + + sum(ac$(ord(ac) > card(ac)-s35_shift), pc35_land_other(j,othertype35,ac)); * Usual shift * example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s35_shift = 1) @@ -62,17 +91,19 @@ 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 -* -------------------------------------- + +* ------------------------------------------------------- +* Carbon threshold for secondary forest maturation +* ------------------------------------------------------- *' @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) = 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); +*' exceeds a threshold of 20 tC/ha the respective area is shifted from young secondary +*' forest, which is still considered other land, to secondary forest land. +p35_maturesecdf(t,j,ac)$(not sameas(ac,"acx")) = + p35_land_other(t,j,"youngsecdf",ac)$(pm_carbon_density_secdforest_ac(t,j,ac,"vegc") > 20); +p35_land_other(t,j,"youngsecdf",ac) = p35_land_other(t,j,"youngsecdf",ac) - p35_maturesecdf(t,j,ac); +p35_secdforest(t,j,ac) = p35_secdforest(t,j,ac) + p35_maturesecdf(t,j,ac); *' @stop pc35_secdforest(j,ac) = p35_secdforest(t,j,ac); @@ -80,23 +111,24 @@ v35_secdforest.l(j,ac) = pc35_secdforest(j,ac); vm_land.l(j,"secdforest") = sum(ac, pc35_secdforest(j,ac)); pcm_land(j,"secdforest") = sum(ac, pc35_secdforest(j,ac)); -pc35_other(j,ac) = p35_other(t,j,ac); -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)); +pc35_land_other(j,othertype35,ac) = p35_land_other(t,j,othertype35,ac); +vm_land_other.l(j,othertype35,ac) = pc35_land_other(j,othertype35,ac); -* 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); +vm_land.l(j,"other") = sum((othertype35,ac), pc35_land_other(j,othertype35,ac)); +pcm_land(j,"other") = sum((othertype35,ac), pc35_land_other(j,othertype35,ac)); * ------------------------------------- * Set bounds based on land conservation * ------------------------------------- -* Within the optimization, primary and secondary forests can only decrease -* (e.g. for cropland expansion). +* Within the optimization, primary forests can only decrease +* (e.g. due to 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. +* 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); + ** Setting bounds for only allowing s35_natveg_harvest_shr percentage of available forest to be harvested (highest age class) * Primary forest @@ -117,7 +149,10 @@ vm_land.up(j,"primforest") = pcm_land(j,"primforest"); v35_secdforest.lo(j,ac) = 0; v35_secdforest.up(j,ac) = Inf; -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); +* Secondary forest conservation +p35_protection_dist(j,ac_sub) = 0; +p35_protection_dist(j,ac_sub)$(sum(ac_sub2,pc35_secdforest(j,ac_sub2)) > 0) = pc35_secdforest(j,ac_sub) / sum(ac_sub2,pc35_secdforest(j,ac_sub2)); +pm_land_conservation(t,j,"secdforest","protect")$(pm_land_conservation(t,j,"secdforest","protect") > sum(ac_sub, pc35_secdforest(j,ac_sub))) = sum(ac_sub, pc35_secdforest(j,ac_sub)); if (sum(sameas(t_past,t),1) = 1, v35_secdforest.lo(j,ac_sub) = pm_land_conservation(t,j,"secdforest","protect") * p35_protection_dist(j,ac_sub); else @@ -125,31 +160,45 @@ v35_secdforest.lo(j,ac_sub) = max((1-s35_natveg_harvest_shr) * pc35_secdforest(j ); * upper bound v35_secdforest.up(j,ac_sub) = pc35_secdforest(j,ac_sub); -m_boundfix(v35_secdforest,(j,ac_sub),l,10e-5); +m_boundfix(v35_secdforest,(j,ac_sub),l,1e-6); -* 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; + +* Since forest restoration cannot be bigger than the potential area for secdforest recovery, +* any remaining restoration area is substracted and shifted to other land restoration. +p35_restoration_shift(j) = p35_land_restoration(j,"secdforest") - pc35_max_forest_recovery(j); +p35_restoration_shift(j)$(p35_restoration_shift(j) < 1e-6) = 0; +p35_restoration_shift(j)$(p35_restoration_shift(j) > p35_land_restoration(j,"secdforest")) = p35_land_restoration(j,"secdforest"); +p35_land_restoration(j,"secdforest") = p35_land_restoration(j,"secdforest") - p35_restoration_shift(j); +pm_land_conservation(t,j,"other","restore") = pm_land_conservation(t,j,"other","restore") + p35_restoration_shift(j); + * 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; +vm_land_other.lo(j,"othernat",ac) = 0; +vm_land_other.up(j,"othernat",ac) = Inf; +vm_land_other.lo(j,"youngsecdf",ac) = 0; *set upper bound -v35_other.up(j,ac_sub) = pc35_other(j,ac_sub); -m_boundfix(v35_other,(j,ac_sub),l,10e-5); +vm_land_other.up(j,"othernat",ac_sub) = pc35_land_other(j,"othernat",ac_sub); +vm_land_other.up(j,"youngsecdf",ac_sub) = pc35_land_other(j,"youngsecdf",ac_sub); +vm_land_other.fx(j,"youngsecdf",ac_est) = 0; +m_boundfix(vm_land_other,(j,othertype35,ac_sub),l,1e-6); + +pm_max_forest_est(t,j)$(pm_max_forest_est(t,j) < sum(ac, pc35_land_other(j,"youngsecdf",ac))) = + sum(ac, pc35_land_other(j,"youngsecdf",ac)); * 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)); +pm_land_conservation(t,j,"other","protect")$(pm_land_conservation(t,j,"other","protect") > + sum((othertype35,ac_sub), pc35_land_other(j,othertype35,ac_sub))) = + sum((othertype35,ac_sub), pc35_land_other(j,othertype35,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 @@ -158,43 +207,38 @@ p35_land_restoration(j,"other")$(sum(land_natveg, pcm_land(j,land_natveg)) >= su * set conservation bound vm_land.lo(j,"other") = pm_land_conservation(t,j,"other","protect") + p35_land_restoration(j,"other"); -* ------------------------------ +* boundfix for land_natveg +m_boundfix(vm_land,(j,land_natveg),up,1e-6); + +* ---------------------------- * 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); +p35_carbon_density_other(t,j,"othernat",ac,ag_pools) = pm_carbon_density_other_ac(t,j,ac,ag_pools); +p35_carbon_density_other(t,j,"youngsecdf",ac,ag_pools) = pm_carbon_density_secdforest_ac(t,j,ac,ag_pools); -* ------------------ -* NPI/NDC policy -* ------------------ +* ---------------------------- +* NPI/NDC protection 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_forest(t,j)$(p35_min_forest(t,j) > pcm_land(j,"primforest") + pcm_land(j,"secdforest") + pcm_land(j,"forestry")) + = pcm_land(j,"primforest") + pcm_land(j,"secdforest") + pcm_land(j,"forestry"); p35_min_other(t,j)$(p35_min_other(t,j) > pcm_land(j,"other")) = pcm_land(j,"other"); -** Display -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) = 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; -v35_hvarea_other.fx(j,ac_est) = 0; +v35_hvarea_other.fx(j,othertype35,ac_est) = 0; v35_secdforest_reduction.fx(j,ac_est) = 0; -v35_other_reduction.fx(j,ac_est) = 0; +v35_other_reduction.fx(j,othertype35,ac_est) = 0; vm_prod_natveg.fx(j,"other","wood") = 0; if(s35_hvarea = 0, v35_hvarea_secdforest.fx(j,ac_sub) = 0; v35_hvarea_primforest.fx(j) = 0; - v35_hvarea_other.fx(j,ac_sub) = 0; + v35_hvarea_other.fx(j,othertype35,ac_sub) = 0; elseif s35_hvarea = 1, v35_hvarea_secdforest.fx(j,ac_sub) = (v35_secdforest.l(j,ac_sub) - v35_secdforest.lo(j,ac_sub))*s35_hvarea_secdforest*m_timestep_length_forestry; v35_hvarea_primforest.fx(j) = (vm_land.l(j,"primforest") - vm_land.lo(j,"primforest"))*s35_hvarea_primforest*m_timestep_length_forestry; - v35_hvarea_other.fx(j,ac_sub) = (v35_other.l(j,ac_sub) - v35_other.lo(j,ac_sub))*s35_hvarea_other*m_timestep_length_forestry; + v35_hvarea_other.fx(j,othertype35,ac_sub) = (vm_land_other.l(j,othertype35,ac_sub) - vm_land_other.lo(j,othertype35,ac_sub))*s35_hvarea_other*m_timestep_length_forestry; ); diff --git a/modules/35_natveg/dynamic_feb21/realization.gms b/modules/35_natveg/pot_forest_may24/realization.gms similarity index 67% rename from modules/35_natveg/dynamic_feb21/realization.gms rename to modules/35_natveg/pot_forest_may24/realization.gms index 8f357c35db..33081fc6d6 100644 --- a/modules/35_natveg/dynamic_feb21/realization.gms +++ b/modules/35_natveg/pot_forest_may24/realization.gms @@ -5,11 +5,15 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -*' @description In the dynamic_feb21 realization, land and carbon stock dynamics +*' @description In the pot_forest_may24 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]. +*' Forest establishment is constrained by the potential forest area, which is defined by +*' areas with a potential carbon density of >20 tC/ha. The remaining forest establishment +*' area in the current time step is provided to the [32_forestry] module via the +*' interface parameter `pm_max_forest_est`. *' 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 @@ -33,12 +37,12 @@ *' secondary forest and harvested primary forest is reclassified as secondary forest. *####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/35_natveg/dynamic_feb21/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/35_natveg/dynamic_feb21/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/35_natveg/dynamic_feb21/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/35_natveg/dynamic_feb21/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/35_natveg/dynamic_feb21/scaling.gms" -$Ifi "%phase%" == "preloop" $include "./modules/35_natveg/dynamic_feb21/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/35_natveg/dynamic_feb21/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/35_natveg/dynamic_feb21/postsolve.gms" +$Ifi "%phase%" == "sets" $include "./modules/35_natveg/pot_forest_may24/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/35_natveg/pot_forest_may24/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/35_natveg/pot_forest_may24/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/35_natveg/pot_forest_may24/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/35_natveg/pot_forest_may24/scaling.gms" +$Ifi "%phase%" == "preloop" $include "./modules/35_natveg/pot_forest_may24/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/35_natveg/pot_forest_may24/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/35_natveg/pot_forest_may24/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/35_natveg/dynamic_feb21/scaling.gms b/modules/35_natveg/pot_forest_may24/scaling.gms similarity index 100% rename from modules/35_natveg/dynamic_feb21/scaling.gms rename to modules/35_natveg/pot_forest_may24/scaling.gms diff --git a/modules/35_natveg/dynamic_feb21/sets.gms b/modules/35_natveg/pot_forest_may24/sets.gms similarity index 93% rename from modules/35_natveg/dynamic_feb21/sets.gms rename to modules/35_natveg/pot_forest_may24/sets.gms index 0ad78e215c..517e5d564b 100644 --- a/modules/35_natveg/dynamic_feb21/sets.gms +++ b/modules/35_natveg/pot_forest_may24/sets.gms @@ -20,6 +20,8 @@ sets pol_stock35 Land types for land protection policies / forest, other / + othertype35 Other land types + / othernat, youngsecdf / shock_scen Scenario name of forest carbon shock / none, 002lin2030,004lin2030,008lin2030,016lin2030 diff --git a/modules/37_labor_prod/exo/sets.gms b/modules/37_labor_prod/exo/sets.gms index c289793d1a..1a76082620 100644 --- a/modules/37_labor_prod/exo/sets.gms +++ b/modules/37_labor_prod/exo/sets.gms @@ -6,7 +6,7 @@ *** | Contact: magpie@pik-potsdam.de sets - rcp37 climate change impact sceanrios + rcp37 climate change impact scenarios / rcp119, rcp585 / metric37 labor productivity impact metric diff --git a/modules/38_factor_costs/sticky_labor/input.gms b/modules/38_factor_costs/sticky_labor/input.gms index 1d9b6416e4..f19986da00 100644 --- a/modules/38_factor_costs/sticky_labor/input.gms +++ b/modules/38_factor_costs/sticky_labor/input.gms @@ -14,7 +14,7 @@ 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_startyear_labor_substitution Year until which labor and capital requirements are fixed to historic values (year) / 2025 / 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 / 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 9208456cb5..f93521ee43 100644 --- a/modules/41_area_equipped_for_irrigation/endo_apr13/realization.gms +++ b/modules/41_area_equipped_for_irrigation/endo_apr13/realization.gms @@ -7,8 +7,9 @@ *' @description This realization allows the model to endogenously decide on investments to deploy additional -*' irrigation infrastructure, i.e. to increase the area equipped for irrigation (AEI). Initial values for AEI -*' in 1995 are taken from @siebert_FAO_2007. Contraction of AEI is not possible. +*' irrigation infrastructure, i.e. to increase the area equipped for irrigation (AEI). +*' Initial values for AEI are areas that are irrigated in the initial time step in LUH2v2. +*' Depreciation of AEI can be set via `s41_AEI_depreciation`. *' Irrigated crop production can only take place where irrigation infrastructure is present. *' *' Unit costs per hectare for AEI expansion are derived from a World Bank study (@worldbank_irrigation_1995) diff --git a/modules/41_area_equipped_for_irrigation/endo_apr13/sets.gms b/modules/41_area_equipped_for_irrigation/endo_apr13/sets.gms index 6f0264ed1b..3ffe557c32 100644 --- a/modules/41_area_equipped_for_irrigation/endo_apr13/sets.gms +++ b/modules/41_area_equipped_for_irrigation/endo_apr13/sets.gms @@ -10,5 +10,5 @@ sets / y1995, y2000, y2005, y2010, y2015 / aei41 Data source for area equipped for irrigation - / LUH2v2, Mehta2022 / + / LUH2v2, Mehta2024_Siebert2013, Mehta2024_Meier2018 / ; diff --git a/modules/41_area_equipped_for_irrigation/static/realization.gms b/modules/41_area_equipped_for_irrigation/static/realization.gms index a838b9fc32..5a50115a9c 100644 --- a/modules/41_area_equipped_for_irrigation/static/realization.gms +++ b/modules/41_area_equipped_for_irrigation/static/realization.gms @@ -7,7 +7,7 @@ *' In this realization, area equipped for irrigation is fixed to input data (around the year 2000) -*' for all time steps. The source of the input data is @siebert_FAO_2007. +*' for all time steps. The sources of the input data are @siebert_FAO_2013 and @mehta_half_2024. *' *' @limitations No irrigation is possible on areas that have not been equipped for irrigation in the past. *' diff --git a/modules/41_area_equipped_for_irrigation/static/sets.gms b/modules/41_area_equipped_for_irrigation/static/sets.gms index 6f0264ed1b..3ffe557c32 100644 --- a/modules/41_area_equipped_for_irrigation/static/sets.gms +++ b/modules/41_area_equipped_for_irrigation/static/sets.gms @@ -10,5 +10,5 @@ sets / y1995, y2000, y2005, y2010, y2015 / aei41 Data source for area equipped for irrigation - / LUH2v2, Mehta2022 / + / LUH2v2, Mehta2024_Siebert2013, Mehta2024_Meier2018 / ; diff --git a/modules/42_water_demand/agr_sector_aug13/declarations.gms b/modules/42_water_demand/agr_sector_aug13/declarations.gms index 67feae3dbb..b719d383f0 100644 --- a/modules/42_water_demand/agr_sector_aug13/declarations.gms +++ b/modules/42_water_demand/agr_sector_aug13/declarations.gms @@ -6,22 +6,23 @@ *** | 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_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) - 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) - 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) + 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) + 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) + 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) + i42_watdem_total(t,j,watdem_ineldo) Non-agricultural water demand for entire year used in post-processing (mio. m^3 per yr) ; equations 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) + q42_water_cost(i) Total cost of pumping irrigation water (USD05MER per yr) ; positive variables diff --git a/modules/42_water_demand/agr_sector_aug13/input.gms b/modules/42_water_demand/agr_sector_aug13/input.gms index fab1d14de8..30d9b37dfc 100644 --- a/modules/42_water_demand/agr_sector_aug13/input.gms +++ b/modules/42_water_demand/agr_sector_aug13/input.gms @@ -29,7 +29,7 @@ s42_env_flow_scenario EFP scenario. (1) / 2 / * 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_startyear Environmental flow policy start year / 2025 / 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 / diff --git a/modules/42_water_demand/agr_sector_aug13/presolve.gms b/modules/42_water_demand/agr_sector_aug13/presolve.gms index 6fa1cb23d3..91107677f3 100644 --- a/modules/42_water_demand/agr_sector_aug13/presolve.gms +++ b/modules/42_water_demand/agr_sector_aug13/presolve.gms @@ -39,6 +39,10 @@ vm_watdem.fx("manufacturing",j) = sum(wat_src, im_wat_avail(t,wat_src,j)) * s42_ vm_watdem.fx("electricity",j) = 0; vm_watdem.fx("domestic",j) = 0; +* Fill non-agricultural water demand parameter of entire year for post-processing +i42_watdem_total(t,j,watdem_ineldo) = 0; +i42_watdem_total(t,j,"manufacturing") = sum(wat_src, im_wat_avail(t,wat_src,j)) * s42_reserved_fraction; + * 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; diff --git a/modules/42_water_demand/agr_sector_aug13/realization.gms b/modules/42_water_demand/agr_sector_aug13/realization.gms index 4682d1fc6b..06cafc3fbc 100644 --- a/modules/42_water_demand/agr_sector_aug13/realization.gms +++ b/modules/42_water_demand/agr_sector_aug13/realization.gms @@ -33,6 +33,7 @@ *' efficiency times management factor") from @PIK_report104_2007. *' Here, irrigated area from @siebert_FAO_2007 has been used as aggregation *' weight. +*' Contraction of AEI happens if a depreciation rate is set in the switch `s41_AEI_depreciation`. *' *' * A regression of country values of the "conveyance efficiency times *' management factor" from @PIK_report104_2007 on GDP. diff --git a/modules/42_water_demand/agr_sector_aug13/sets.gms b/modules/42_water_demand/agr_sector_aug13/sets.gms index 03ca251782..78f20947c5 100644 --- a/modules/42_water_demand/agr_sector_aug13/sets.gms +++ b/modules/42_water_demand/agr_sector_aug13/sets.gms @@ -9,6 +9,9 @@ sets watdem_exo(wat_dem) Exogenous water demands / manufacturing, electricity, domestic, ecosystem / + watdem_ineldo(wat_dem) Exogenous water demand subset covering humanly induced demands + / domestic, manufacturing, electricity / + scen42 Environmental Flow Policy (EFP) / off, on / diff --git a/modules/42_water_demand/all_sectors_aug13/declarations.gms b/modules/42_water_demand/all_sectors_aug13/declarations.gms index 81503a7f78..42c836dfc6 100644 --- a/modules/42_water_demand/all_sectors_aug13/declarations.gms +++ b/modules/42_water_demand/all_sectors_aug13/declarations.gms @@ -6,22 +6,23 @@ *** | Contact: magpie@pik-potsdam.de parameters - 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) - 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) + 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) + 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) + i42_watdem_total(t,j,watdem_ineldo) Non-agricultural water demand for entire year used in post-processing (mio. m^3 per yr) ; equations - 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) + 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 diff --git a/modules/42_water_demand/all_sectors_aug13/input.gms b/modules/42_water_demand/all_sectors_aug13/input.gms index 07b0da00f0..e5823ca67f 100644 --- a/modules/42_water_demand/all_sectors_aug13/input.gms +++ b/modules/42_water_demand/all_sectors_aug13/input.gms @@ -32,7 +32,7 @@ s42_env_flow_scenario Environmental flow protection scenario * 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_startyear Environmental flow policy start year / 2025 / 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 / s42_env_flow_fraction Fraction of available water that is reserved under protection policies (1) / 0.2 / @@ -92,13 +92,21 @@ $include "./modules/42_water_demand/input/f42_wat_req_fao.csv" $offdelim /; -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) +table f42_watdem_ineldo(t_all,j,scen_watdem_nonagr,watdem_ineldo) Manufacturing electricity and domestic water demand under different socioeconomic scenarios in the growing period (mio. m^3) $ondelim $include "./modules/42_water_demand/input/watdem_nonagr_grper.cs3" $offdelim ; m_fillmissingyears(f42_watdem_ineldo,"j,scen_watdem_nonagr,watdem_ineldo"); +* This input is not used within MAgPIE, but necessary for the postprocessing +table f42_watdem_ineldo_total(t_all,j,scen_watdem_nonagr,watdem_ineldo) Manufacturing electricity and domestic water demand under different socioeconomic scenarios in the entire year (mio. m^3) +$ondelim +$if exist "./modules/42_water_demand/input/watdem_nonagr_total.cs3" $include "./modules/42_water_demand/input/watdem_nonagr_total.cs3" +$offdelim +; +m_fillmissingyears(f42_watdem_ineldo_total,"j,scen_watdem_nonagr,watdem_ineldo"); + parameter f42_env_flows(t_all,j) Environmental flow requirements from LPJ and Smakhtin algorithm (mio. m^3) / diff --git a/modules/42_water_demand/all_sectors_aug13/presolve.gms b/modules/42_water_demand/all_sectors_aug13/presolve.gms index 67275b377a..baa83ee407 100644 --- a/modules/42_water_demand/all_sectors_aug13/presolve.gms +++ b/modules/42_water_demand/all_sectors_aug13/presolve.gms @@ -37,12 +37,20 @@ if ((s42_pumping = 1), * 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,"ssp1",watdem_ineldo); -Elseif(s42_watdem_nonagr_scenario = 2), - 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,"ssp3",watdem_ineldo); +if (m_year(t) <= sm_fix_SSP2, + vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"ssp2",watdem_ineldo); + i42_watdem_total(t,j,watdem_ineldo) = f42_watdem_ineldo_total(t,j,"ssp2",watdem_ineldo); +else + if ((s42_watdem_nonagr_scenario = 1), + vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"ssp1",watdem_ineldo); + i42_watdem_total(t,j,watdem_ineldo) = f42_watdem_ineldo_total(t,j,"ssp1",watdem_ineldo); + Elseif (s42_watdem_nonagr_scenario = 2), + vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"ssp2",watdem_ineldo); + i42_watdem_total(t,j,watdem_ineldo) = f42_watdem_ineldo_total(t,j,"ssp2",watdem_ineldo); + Elseif (s42_watdem_nonagr_scenario = 3), + vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"ssp3",watdem_ineldo); + i42_watdem_total(t,j,watdem_ineldo) = f42_watdem_ineldo_total(t,j,"ssp3",watdem_ineldo); + ); ); diff --git a/modules/42_water_demand/input/files b/modules/42_water_demand/input/files index f9df64edc4..26723d5a30 100644 --- a/modules/42_water_demand/input/files +++ b/modules/42_water_demand/input/files @@ -2,5 +2,6 @@ lpj_airrig.cs2 lpj_envflow_grper.cs2 watdem_nonagr_grper.cs3 +watdem_nonagr_total.cs3 f42_wat_req_fao.csv f42_pumping_cost.cs4 diff --git a/modules/44_biodiversity/bii_target/input.gms b/modules/44_biodiversity/bii_target/input.gms index 3840e6c4ed..26deafacfd 100644 --- a/modules/44_biodiversity/bii_target/input.gms +++ b/modules/44_biodiversity/bii_target/input.gms @@ -10,7 +10,7 @@ scalars 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 / + s44_cost_bii_missing Technical costs for missing BII increase (USD per unit of BII) / 1e+06 / ; diff --git a/modules/44_biodiversity/bii_target/presolve.gms b/modules/44_biodiversity/bii_target/presolve.gms index f1bb9c25f4..de414061ef 100644 --- a/modules/44_biodiversity/bii_target/presolve.gms +++ b/modules/44_biodiversity/bii_target/presolve.gms @@ -5,12 +5,14 @@ *** | 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); +p44_start_value(i,biome44)$(m_year(t) = s44_start_year) = 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; - +p44_target_value(i,biome44) = s44_bii_lower_bound; + +if (m_year(t) <= sm_fix_SSP2, + v44_bii.lo(i,biome44) = 0; +else * 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); @@ -26,4 +28,3 @@ if(m_year(t) = s44_start_year, 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/sets.gms b/modules/44_biodiversity/bii_target/sets.gms index e7765a2c54..fb93906e40 100644 --- a/modules/44_biodiversity/bii_target/sets.gms +++ b/modules/44_biodiversity/bii_target/sets.gms @@ -8,7 +8,7 @@ sets landcover44 land cover classes used in bii calculation - / crop_ann, crop_per, manpast, rangeland, urban, aff_ndc, aff_co2p, primforest, secdforest, other, plant / + / crop_ann, crop_per, crop_tree, crop_fallow, 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 / diff --git a/modules/44_biodiversity/bii_target_apr24/input.gms b/modules/44_biodiversity/bii_target_apr24/input.gms index fc6d28b687..f5d19800c5 100644 --- a/modules/44_biodiversity/bii_target_apr24/input.gms +++ b/modules/44_biodiversity/bii_target_apr24/input.gms @@ -10,7 +10,7 @@ scalars 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 / + s44_cost_bii_missing Technical costs for missing BII increase (USD per unit of BII) / 1e+06 / ; diff --git a/modules/44_biodiversity/bii_target_apr24/presolve.gms b/modules/44_biodiversity/bii_target_apr24/presolve.gms index 7f9ba294f7..0a45321b2a 100644 --- a/modules/44_biodiversity/bii_target_apr24/presolve.gms +++ b/modules/44_biodiversity/bii_target_apr24/presolve.gms @@ -5,12 +5,14 @@ *** | 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); +p44_start_value(i,biome44)$(m_year(t) = s44_start_year) = 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; - +p44_target_value(i,biome44) = s44_bii_lower_bound; + +if (m_year(t) <= sm_fix_SSP2, + v44_bii.lo(i,biome44) = 0; +else * 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); @@ -26,4 +28,3 @@ if(m_year(t) = s44_start_year, 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_apr24/sets.gms b/modules/44_biodiversity/bii_target_apr24/sets.gms index 0a826f7791..c4e1566ef6 100644 --- a/modules/44_biodiversity/bii_target_apr24/sets.gms +++ b/modules/44_biodiversity/bii_target_apr24/sets.gms @@ -8,7 +8,7 @@ sets landcover44 land cover classes used in bii calculation - / crop_ann, crop_per, manpast, rangeland, urban, aff_ndc, aff_co2p, primforest, secdforest, other, plant / + / crop_ann, crop_per, crop_tree, crop_fallow, 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 / diff --git a/modules/44_biodiversity/bv_btc_mar21/not_used.txt b/modules/44_biodiversity/bv_btc_mar21/not_used.txt index bf287154ed..2430a1919c 100644 --- a/modules/44_biodiversity/bv_btc_mar21/not_used.txt +++ b/modules/44_biodiversity/bv_btc_mar21/not_used.txt @@ -1,2 +1,3 @@ name,type,reason pcm_land, input, not used +sm_fix_SSP2, input, not used diff --git a/modules/44_biodiversity/bv_btc_mar21/sets.gms b/modules/44_biodiversity/bv_btc_mar21/sets.gms index 67d498fa89..ebee4de5cf 100644 --- a/modules/44_biodiversity/bv_btc_mar21/sets.gms +++ b/modules/44_biodiversity/bv_btc_mar21/sets.gms @@ -8,7 +8,7 @@ sets landcover44 land cover classes used in bii calculation - / crop_ann, crop_per, manpast, rangeland, urban, aff_ndc, aff_co2p, primforest, secdforest, other, plant / + / crop_ann, crop_per, crop_tree, crop_fallow, 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 / diff --git a/modules/50_nr_soil_budget/macceff_aug22/equations.gms b/modules/50_nr_soil_budget/macceff_aug22/equations.gms index b6993d4f3d..8133c1316f 100644 --- a/modules/50_nr_soil_budget/macceff_aug22/equations.gms +++ b/modules/50_nr_soil_budget/macceff_aug22/equations.gms @@ -84,14 +84,6 @@ q50_nr_surplus_pasture(i2) .. v50_nr_withdrawals_pasture(i2) =e= vm_prod_reg(i2,"pasture") * fm_attributes("nr","pasture"); -* Calculating Budget surplus for non-agricultural land - -* q50_nr_surplus_nonagland(i2) .. -* vm_nr_surplus_nonagland(i2) -* =e= -* sum((cell(i2,j2),nonagland50), vm_land(j2,nonagland50)) * sum(ct,f50_nr_fixation_rates_nonagland(ct,i2)) -* + sum(nonagland50, v50_nr_deposition(i2,nonagland50)); - *' For both crop land and pasture land, this equation gives the amount of nitrogen deposited from the atmosphere. q50_nr_deposition(i2,land) .. v50_nr_deposition(i2,land) =e= diff --git a/modules/52_carbon/normal_dec17/declarations.gms b/modules/52_carbon/normal_dec17/declarations.gms index f102773491..e56ff128d1 100644 --- a/modules/52_carbon/normal_dec17/declarations.gms +++ b/modules/52_carbon/normal_dec17/declarations.gms @@ -6,8 +6,9 @@ *** | Contact: magpie@pik-potsdam.de 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_forestry(t_all,j,ac,ag_pools) Above ground plantation carbon density for age classes and carbon pools (tC per ha) + pm_carbon_density_secdforest_ac(t_all,j,ac,ag_pools) Above ground secondary forest carbon density for age classes and carbon pools (tC per ha) + pm_carbon_density_other_ac(t_all,j,ac,ag_pools) Above ground other land carbon density for age classes and carbon pools (tC per ha) + pm_carbon_density_plantation_ac(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) i52_land_carbon_sink(t_all,i) Land carbon sink adjustment factors from Grassi et al 2021 (GtCO2 per year) ; diff --git a/modules/52_carbon/normal_dec17/input.gms b/modules/52_carbon/normal_dec17/input.gms index a7f8de3df7..16cb94a19e 100644 --- a/modules/52_carbon/normal_dec17/input.gms +++ b/modules/52_carbon/normal_dec17/input.gms @@ -23,7 +23,14 @@ $if "%c52_carbon_scenario%" == "nocc" fm_carbon_density(t_all,j,land,c_pools) = $if "%c52_carbon_scenario%" == "nocc_hist" fm_carbon_density(t_all,j,land,c_pools)$(m_year(t_all) > sm_fix_cc) = fm_carbon_density(t_all,j,land,c_pools)$(m_year(t_all) = sm_fix_cc); m_fillmissingyears(fm_carbon_density,"j,land,c_pools"); -* Fix urban area soilc to natural land soilc as long as preprocessed +* Where no forest carbon density is reported, because the potential +* forest area is zero, use the carbon density of other land instead. +* This affects areas, where the land use intialisation reports some +* forest, although the forest potential is zero. Forest expansion in +* these cells is constrained by f35_pot_forest_area. +fm_carbon_density(t_all,j,land_forest,c_pools)$(fm_carbon_density(t_all,j,land_forest,c_pools) = 0) = fm_carbon_density(t_all,j,"other",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") @@ -37,7 +44,7 @@ $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 +* 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 @@ -50,10 +57,10 @@ $offEmpty $ifthen "%c52_land_carbon_sink_rcp%" == "nocc" i52_land_carbon_sink(t_all,i) = f52_land_carbon_sink("y1995",i,"RCPBU"); -$elseif "%c52_land_carbon_sink_rcp%" == "nocc_hist" +$elseif "%c52_land_carbon_sink_rcp%" == "nocc_hist" i52_land_carbon_sink(t_all,i) = f52_land_carbon_sink(t_all,i,"RCPBU"); i52_land_carbon_sink(t_all,i)$(m_year(t_all) > sm_fix_cc) = f52_land_carbon_sink(t_all,i,"RCPBU")$(m_year(t_all) = sm_fix_cc); -$else +$else i52_land_carbon_sink(t_all,i) = f52_land_carbon_sink(t_all,i,"%c52_land_carbon_sink_rcp%"); i52_land_carbon_sink(t_all,i)$(m_year(t_all) <= sm_fix_cc) = f52_land_carbon_sink(t_all,i,"RCPBU")$(m_year(t_all) <= sm_fix_cc); $endif diff --git a/modules/52_carbon/normal_dec17/start.gms b/modules/52_carbon/normal_dec17/start.gms index 1668e36251..a7e8879b67 100644 --- a/modules/52_carbon/normal_dec17/start.gms +++ b/modules/52_carbon/normal_dec17/start.gms @@ -9,19 +9,30 @@ 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 +* ---------------------------- +* 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)); +pm_carbon_density_plantation_ac(t_all,j,ac,"vegc") = m_growth_vegc(pc52_carbon_density_start(t_all,j,"vegc"),fm_carbon_density(t_all,j,"secdforest","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 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)); +pm_carbon_density_plantation_ac(t_all,j,ac,"litc") = m_growth_litc_soilc(pc52_carbon_density_start(t_all,j,"litc"),fm_carbon_density(t_all,j,"secdforest","litc"),(ord(ac)-1)); +* ----------------------------- +* Natveg +* ----------------------------- -*** Natveg +*** Secondary forest +*calculate vegetation age-class carbon density in current time step with chapman richards equation +pm_carbon_density_secdforest_ac(t_all,j,ac,"vegc") = m_growth_vegc(pc52_carbon_density_start(t_all,j,"vegc"),fm_carbon_density(t_all,j,"secdforest","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 carbon density based on linear growth funktion: carbon_density(ac) = intercept + slope*ac (20 year time horizon taken from IPCC) +pm_carbon_density_secdforest_ac(t_all,j,ac,"litc") = m_growth_litc_soilc(pc52_carbon_density_start(t_all,j,"litc"),fm_carbon_density(t_all,j,"secdforest","litc"),(ord(ac)-1)); +*** Other land *calculate vegetation age-class carbon density in current time step with chapman richards equation -pm_carbon_density_ac(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","natveg")),sum(clcl,pm_climate_class(j,clcl)*f52_growth_par(clcl,"m","natveg")),(ord(ac)-1)); +pm_carbon_density_other_ac(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","natveg")),sum(clcl,pm_climate_class(j,clcl)*f52_growth_par(clcl,"m","natveg")),(ord(ac)-1)); *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_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)); +pm_carbon_density_other_ac(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)); diff --git a/modules/56_ghg_policy/price_aug22/sets.gms b/modules/56_ghg_policy/price_aug22/sets.gms index 7bb8f6bde9..014de3106f 100644 --- a/modules/56_ghg_policy/price_aug22/sets.gms +++ b/modules/56_ghg_policy/price_aug22/sets.gms @@ -102,15 +102,19 @@ sets all, all_nosoil, redd_nosoil, + redd_nosoil_CH4GWP20, redd_nosoil_nopeat, redd_nosoil_peatCO2only, reddnatveg_nosoil, + reddnatveg_nosoil_CH4GWP20, reddnatveg_nosoil_nopeat, reddnatveg_nosoil_peatCO2only, redd+_nosoil, + redd+_nosoil_CH4GWP20, redd+_nosoil_nopeat, redd+_nosoil_peatCO2only, redd+natveg_nosoil, + redd+natveg_nosoil_CH4GWP20, redd+natveg_nosoil_nopeat, redd+natveg_nosoil_peatCO2only, all_vegc, diff --git a/modules/58_peatland/input/files b/modules/58_peatland/input/files index 3509c27c10..09985440b4 100644 --- a/modules/58_peatland/input/files +++ b/modules/58_peatland/input/files @@ -1,6 +1,3 @@ * list of files that are required here -f58_peatland_degrad.cs2 -f58_peatland_intact.cs2 -f58_ipcc_wetland_ef.cs3 f58_ipcc_wetland_ef2.cs3 -f58_peatland_area.cs2 +f58_peatland_area.cs3 diff --git a/modules/58_peatland/v2/input.gms b/modules/58_peatland/v2/input.gms index 0508ea5c3f..99c9207abf 100644 --- a/modules/58_peatland/v2/input.gms +++ b/modules/58_peatland/v2/input.gms @@ -13,13 +13,13 @@ scalars s58_cost_drain_rewet_onetime One-time costs for drainage of rewetted peatland (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 (year) / 2020 / - s58_balance_penalty Penalty for technical peatland balance term (USD05MER) / 1000000 / + s58_balance_penalty Penalty for technical peatland balance term (USD05MER) / 1e+06 / ; *Peatland area based on Global Peatland Map 2.0 and Global Peatland Database table f58_peatland_area(j,land58) Peatland area (mio. ha) $ondelim -$include "./modules/58_peatland/input/f58_peatland_area.cs2" +$include "./modules/58_peatland/input/f58_peatland_area.cs3" $offdelim ; diff --git a/modules/58_peatland/v2/scaling.gms b/modules/58_peatland/v2/scaling.gms index 3acae9e9b6..787936e8ca 100644 --- a/modules/58_peatland/v2/scaling.gms +++ b/modules/58_peatland/v2/scaling.gms @@ -6,3 +6,4 @@ *** | Contact: magpie@pik-potsdam.de v58_peatlandChange.scale(j,land58) = 10e-3; +v58_peatland.scale(j,land58) = 10e-3; diff --git a/modules/59_som/cellpool_aug16/declarations.gms b/modules/59_som/cellpool_aug16/declarations.gms index 46831d6429..81eff1839a 100644 --- a/modules/59_som/cellpool_aug16/declarations.gms +++ b/modules/59_som/cellpool_aug16/declarations.gms @@ -7,14 +7,16 @@ 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) + p59_carbon_density(t_all,j,land) Soil carbon density of a hectare of land (tC per ha) + pc59_carbon_density(j,land) Soil carbon density of a hectare of land between time steps (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_cratio_treecover Ratio of carbon density of tree cover on cropland relative to natural vegetation (1) + pc59_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) + pc59_land_before(j,land) Land area in previous time step (mio. ha) ; equations diff --git a/modules/59_som/cellpool_aug16/equations.gms b/modules/59_som/cellpool_aug16/equations.gms index ddf8108683..154f618422 100644 --- a/modules/59_som/cellpool_aug16/equations.gms +++ b/modules/59_som/cellpool_aug16/equations.gms @@ -7,15 +7,16 @@ *' @equations -*' For every cell a new equilibrium value for the soil organic carbon pool +*' 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)) - ; + + vm_fallow(j2) * i59_cratio_fallow(j2) + + vm_treecover(j2) * i59_cratio_treecover) + * sum(ct,f59_topsoilc_density(ct,j2)); + *' as well as for all non cropland given by q59_som_target_noncropland(j2,noncropland59) .. @@ -23,25 +24,25 @@ q59_som_target_noncropland(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`) +*' 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 +*' 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 +*' 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) * + 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 +*' Note that to account correctly for land-use transitions, carbon densities *' multiplied by the land-use transition matrix of the current timestep *' is used. @@ -49,23 +50,23 @@ q59_som_pool(j2,land) .. *' 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) * + 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 +*' 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) * + * (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 +*' The amount of nitrogen that becomes available to cropland farming is *' limited by loss of soil organic matter by q59_nr_som_fertilizer(j2) .. diff --git a/modules/59_som/cellpool_aug16/not_used.txt b/modules/59_som/cellpool_aug16/not_used.txt new file mode 100644 index 0000000000..a62a4ec738 --- /dev/null +++ b/modules/59_som/cellpool_aug16/not_used.txt @@ -0,0 +1,2 @@ +name,type,reason +vm_land_other,input,not needed diff --git a/modules/59_som/cellpool_aug16/postsolve.gms b/modules/59_som/cellpool_aug16/postsolve.gms index cd03390003..60e1f2c60f 100644 --- a/modules/59_som/cellpool_aug16/postsolve.gms +++ b/modules/59_som/cellpool_aug16/postsolve.gms @@ -5,9 +5,9 @@ *** | 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-10) = p59_som_pool(j,land) / pcm_land(j,land); +pc59_som_pool(j,land) = v59_som_pool.l(j,land); +pc59_land_before(j,land) = vm_land.l(j,land); +pc59_carbon_density(j,land)$(pc59_land_before(j,land) > 1e-10) = pc59_som_pool(j,land) / pc59_land_before(j,land); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov59_som_target(t,j,land,"marginal") = v59_som_target.m(j,land); diff --git a/modules/59_som/cellpool_aug16/preloop.gms b/modules/59_som/cellpool_aug16/preloop.gms index b75a85f126..a2625bdf21 100644 --- a/modules/59_som/cellpool_aug16/preloop.gms +++ b/modules/59_som/cellpool_aug16/preloop.gms @@ -11,12 +11,12 @@ 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") = +pc59_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) * sum(w, fm_croparea("y1995",j,w,kcr))); -p59_som_pool(j,noncropland59) = +pc59_som_pool(j,noncropland59) = f59_topsoilc_density("y1995",j) * pm_land_start(j,noncropland59); @@ -28,7 +28,7 @@ p59_som_pool(j,noncropland59) = * 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"); + pc59_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); @@ -73,8 +73,13 @@ i59_cratio_fallow(j) = sum(climate59, * f59_cratio_landuse(climate59,"maiz") * f59_cratio_tillage(climate59,"reduced_tillage") * f59_cratio_inputs(climate59,"low_input")); + +i59_cratio_treecover = 1; + *' @stop -p59_carbon_density(t,j,land) = 0; +pc59_land_before(j,land) = pm_land_start(j,land); -p59_land_before(j,land) = pm_land_start(j,land); +p59_carbon_density(t,j,land) = 0; +pc59_carbon_density(j,land) = 0; +pc59_carbon_density(j,land)$(pc59_land_before(j,land) > 1e-10) = pc59_som_pool(j,land) / pc59_land_before(j,land); diff --git a/modules/59_som/cellpool_aug16/presolve.gms b/modules/59_som/cellpool_aug16/presolve.gms index 26cdb91674..1cf578801c 100644 --- a/modules/59_som/cellpool_aug16/presolve.gms +++ b/modules/59_som/cellpool_aug16/presolve.gms @@ -12,18 +12,18 @@ * 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"); +pc59_som_pool(j,"secdforest") = pc59_som_pool(j,"secdforest") + + (pc59_land_before(j,"primforest") - pcm_land(j,"primforest")) * + pc59_carbon_density(j,"primforest") + + (pc59_land_before(j,"other") - pcm_land(j,"other")) * + pc59_carbon_density(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"); +pc59_som_pool(j,"other") = pc59_som_pool(j,"other") - + (pc59_land_before(j,"other") - pcm_land(j,"other")) * + pc59_carbon_density(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"); +pc59_som_pool(j,"primforest") = pc59_som_pool(j,"primforest") - + (pc59_land_before(j,"primforest") - pcm_land(j,"primforest")) * + pc59_carbon_density(j,"primforest"); -p59_carbon_density(t,j,land)$(pcm_land(j,land) > 1e-10) = p59_som_pool(j,land) / pcm_land(j,land); +p59_carbon_density(t,j,land)$(pcm_land(j,land) > 1e-10) = pc59_som_pool(j,land) / pcm_land(j,land); diff --git a/modules/59_som/cellpool_jan23/declarations.gms b/modules/59_som/cellpool_jan23/declarations.gms index 46831d6429..632aba9c32 100644 --- a/modules/59_som/cellpool_jan23/declarations.gms +++ b/modules/59_som/cellpool_jan23/declarations.gms @@ -7,14 +7,16 @@ 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) + p59_carbon_density(t_all,j,land) Soil carbon density of a hectare of land (tC per ha) + pc59_carbon_density(j,land) Soil carbon density of a hectare of land between time steps (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_cratio_treecover Ratio of carbon density of tree cover on cropland relative to natural vegetation (1) + pc59_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) + pc59_land_before(j,land) Land area in previous time step (mio. ha) ; equations @@ -24,7 +26,7 @@ equations 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) + q59_carbon_soil(j,land,stockType) Soil carbon content calculation (mio. tC) ; positive variables diff --git a/modules/59_som/cellpool_jan23/equations.gms b/modules/59_som/cellpool_jan23/equations.gms index ddf8108683..154f618422 100644 --- a/modules/59_som/cellpool_jan23/equations.gms +++ b/modules/59_som/cellpool_jan23/equations.gms @@ -7,15 +7,16 @@ *' @equations -*' For every cell a new equilibrium value for the soil organic carbon pool +*' 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)) - ; + + vm_fallow(j2) * i59_cratio_fallow(j2) + + vm_treecover(j2) * i59_cratio_treecover) + * sum(ct,f59_topsoilc_density(ct,j2)); + *' as well as for all non cropland given by q59_som_target_noncropland(j2,noncropland59) .. @@ -23,25 +24,25 @@ q59_som_target_noncropland(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`) +*' 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 +*' 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 +*' 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) * + 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 +*' Note that to account correctly for land-use transitions, carbon densities *' multiplied by the land-use transition matrix of the current timestep *' is used. @@ -49,23 +50,23 @@ q59_som_pool(j2,land) .. *' 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) * + 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 +*' 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) * + * (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 +*' The amount of nitrogen that becomes available to cropland farming is *' limited by loss of soil organic matter by q59_nr_som_fertilizer(j2) .. diff --git a/modules/59_som/cellpool_jan23/not_used.txt b/modules/59_som/cellpool_jan23/not_used.txt new file mode 100644 index 0000000000..a62a4ec738 --- /dev/null +++ b/modules/59_som/cellpool_jan23/not_used.txt @@ -0,0 +1,2 @@ +name,type,reason +vm_land_other,input,not needed diff --git a/modules/59_som/cellpool_jan23/postsolve.gms b/modules/59_som/cellpool_jan23/postsolve.gms index cd03390003..60e1f2c60f 100644 --- a/modules/59_som/cellpool_jan23/postsolve.gms +++ b/modules/59_som/cellpool_jan23/postsolve.gms @@ -5,9 +5,9 @@ *** | 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-10) = p59_som_pool(j,land) / pcm_land(j,land); +pc59_som_pool(j,land) = v59_som_pool.l(j,land); +pc59_land_before(j,land) = vm_land.l(j,land); +pc59_carbon_density(j,land)$(pc59_land_before(j,land) > 1e-10) = pc59_som_pool(j,land) / pc59_land_before(j,land); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov59_som_target(t,j,land,"marginal") = v59_som_target.m(j,land); diff --git a/modules/59_som/cellpool_jan23/preloop.gms b/modules/59_som/cellpool_jan23/preloop.gms index 0454db31bb..8393b1f201 100644 --- a/modules/59_som/cellpool_jan23/preloop.gms +++ b/modules/59_som/cellpool_jan23/preloop.gms @@ -11,12 +11,12 @@ 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") = +pc59_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) = +pc59_som_pool(j,noncropland59) = f59_topsoilc_density("y1995",j) * pm_land_start(j,noncropland59); @@ -28,7 +28,7 @@ p59_som_pool(j,noncropland59) = * 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"); + pc59_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); @@ -73,8 +73,13 @@ i59_cratio_fallow(j) = sum((cell(i,j),climate59), * f59_cratio_landuse(i,climate59,"maiz") * f59_cratio_tillage(climate59,"reduced_tillage") * f59_cratio_inputs(climate59,"low_input")); + +i59_cratio_treecover = 1; + *' @stop -p59_carbon_density(t,j,land) = 0; +pc59_land_before(j,land) = pm_land_start(j,land); -p59_land_before(j,land) = pm_land_start(j,land); +p59_carbon_density(t,j,land) = 0; +pc59_carbon_density(j,land) = 0; +pc59_carbon_density(j,land)$(pc59_land_before(j,land) > 1e-10) = pc59_som_pool(j,land) / pc59_land_before(j,land); diff --git a/modules/59_som/cellpool_jan23/presolve.gms b/modules/59_som/cellpool_jan23/presolve.gms index 26cdb91674..1cf578801c 100644 --- a/modules/59_som/cellpool_jan23/presolve.gms +++ b/modules/59_som/cellpool_jan23/presolve.gms @@ -12,18 +12,18 @@ * 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"); +pc59_som_pool(j,"secdforest") = pc59_som_pool(j,"secdforest") + + (pc59_land_before(j,"primforest") - pcm_land(j,"primforest")) * + pc59_carbon_density(j,"primforest") + + (pc59_land_before(j,"other") - pcm_land(j,"other")) * + pc59_carbon_density(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"); +pc59_som_pool(j,"other") = pc59_som_pool(j,"other") - + (pc59_land_before(j,"other") - pcm_land(j,"other")) * + pc59_carbon_density(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"); +pc59_som_pool(j,"primforest") = pc59_som_pool(j,"primforest") - + (pc59_land_before(j,"primforest") - pcm_land(j,"primforest")) * + pc59_carbon_density(j,"primforest"); -p59_carbon_density(t,j,land)$(pcm_land(j,land) > 1e-10) = p59_som_pool(j,land) / pcm_land(j,land); +p59_carbon_density(t,j,land)$(pcm_land(j,land) > 1e-10) = pc59_som_pool(j,land) / pcm_land(j,land); diff --git a/modules/59_som/static_jan19/declarations.gms b/modules/59_som/static_jan19/declarations.gms index e21b607893..85677def80 100644 --- a/modules/59_som/static_jan19/declarations.gms +++ b/modules/59_som/static_jan19/declarations.gms @@ -18,14 +18,16 @@ variables equations 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) + q59_soilcarbon_regular(j,regularland59,stockType) Regular soil carbon content calculation (mio. tC) + q59_soilcarbon_other(j,stockType) Other land 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,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) + 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_regular(t,j,regularland59,stockType,type) Regular soil carbon content calculation (mio. tC) + oq59_soilcarbon_other(t,j,stockType,type) Other land 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 ce63cccdb9..089229aa09 100644 --- a/modules/59_som/static_jan19/equations.gms +++ b/modules/59_som/static_jan19/equations.gms @@ -10,9 +10,18 @@ *' and the reference soil carbon densities of the subsoil. 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)); + (sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2)) * sum(ct, i59_topsoilc_density(ct,j2) + i59_subsoilc_density(ct,j2)) + + vm_treecover(j2) * sum(ct, fm_carbon_density(ct,j2,"secdforest","soilc")); *' 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,stockType) .. - vm_carbon_stock(j2,noncropland59,"soilc",stockType) =e= - sum(ct, vm_land(j2,noncropland59) * fm_carbon_density(ct,j2,noncropland59,"soilc")); + q59_soilcarbon_regular(j2,regularland59,stockType) .. + vm_carbon_stock(j2,regularland59,"soilc",stockType) =e= + sum(ct, vm_land(j2,regularland59) * fm_carbon_density(ct,j2,regularland59,"soilc")); + +q59_soilcarbon_other(j2,stockType) .. + vm_carbon_stock(j2,"other","soilc",stockType) =e= + sum((ct,ac), vm_land_other(j2,"othernat",ac) * fm_carbon_density(ct,j2,"other","soilc")) + + sum((ct,ac), vm_land_other(j2,"youngsecdf",ac) * fm_carbon_density(ct,j2,"secdforest","soilc")) ; + + + diff --git a/modules/59_som/static_jan19/not_used.txt b/modules/59_som/static_jan19/not_used.txt index 9bd4f91711..22a291399b 100644 --- a/modules/59_som/static_jan19/not_used.txt +++ b/modules/59_som/static_jan19/not_used.txt @@ -1,8 +1,6 @@ name,type,reason pm_land_start,input,questionnaire fm_croparea,input,questionnaire -vm_area,input,questionnaire vm_landexpansion,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 723fb9ba0a..36b8a66e20 100644 --- a/modules/59_som/static_jan19/postsolve.gms +++ b/modules/59_som/static_jan19/postsolve.gms @@ -8,21 +8,25 @@ *#################### 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,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); + 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_regular(t,j,regularland59,stockType,"marginal") = q59_soilcarbon_regular.m(j,regularland59,stockType); + oq59_soilcarbon_other(t,j,stockType,"marginal") = q59_soilcarbon_other.m(j,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_regular(t,j,regularland59,stockType,"level") = q59_soilcarbon_regular.l(j,regularland59,stockType); + oq59_soilcarbon_other(t,j,stockType,"level") = q59_soilcarbon_other.l(j,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_regular(t,j,regularland59,stockType,"upper") = q59_soilcarbon_regular.up(j,regularland59,stockType); + oq59_soilcarbon_other(t,j,stockType,"upper") = q59_soilcarbon_other.up(j,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_regular(t,j,regularland59,stockType,"lower") = q59_soilcarbon_regular.lo(j,regularland59,stockType); + oq59_soilcarbon_other(t,j,stockType,"lower") = q59_soilcarbon_other.lo(j,stockType); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/59_som/static_jan19/sets.gms b/modules/59_som/static_jan19/sets.gms index a55bf9518a..3a81f90c9c 100644 --- a/modules/59_som/static_jan19/sets.gms +++ b/modules/59_som/static_jan19/sets.gms @@ -6,8 +6,8 @@ *** | Contact: magpie@pik-potsdam.de sets -noncropland59(land) Soil carbon conserving landuse types -/past, forestry, primforest, secdforest, other, urban/ +regularland59(land) Soil carbon conserving landuse types +/ past, forestry, primforest, secdforest, urban / exo_scen59 exogenous scenarios for soil organic matter loss /constant, fadeout_2050/ diff --git a/modules/60_bioenergy/1st2ndgen_priced_feb24/input.gms b/modules/60_bioenergy/1st2ndgen_priced_feb24/input.gms index 5f8da47522..da938046e9 100644 --- a/modules/60_bioenergy/1st2ndgen_priced_feb24/input.gms +++ b/modules/60_bioenergy/1st2ndgen_priced_feb24/input.gms @@ -43,9 +43,9 @@ scalars s60_2ndgen_bioenergy_dem_min_post_fix Minimum dedicated 2nd generation bioenergy demand assumed in each region after SSP2-fix (mio. GJ per yr) / 1 / ; -$setglobal c60_price_implementation exp -$setglobal c60_2ndgen_biodem R21M42-SSP2-Npi-PhaseOut50 -$setglobal c60_2ndgen_biodem_noselect R21M42-SSP2-NPi +$setglobal c60_price_implementation lin +$setglobal c60_2ndgen_biodem R32M46-SSP2EU-NPi +$setglobal c60_2ndgen_biodem_noselect R32M46-SSP2EU-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/preloop.gms b/modules/60_bioenergy/1stgen_priced_dec18/preloop.gms index 0a914aae3f..f92a9a2590 100644 --- a/modules/60_bioenergy/1stgen_priced_dec18/preloop.gms +++ b/modules/60_bioenergy/1stgen_priced_dec18/preloop.gms @@ -22,6 +22,10 @@ $elseif "%c60_2ndgen_biodem%" == "emulator" i60_bioenergy_dem(t,i) = f60_bioenergy_dem_emulator(t)/card(i); $elseif "%c60_2ndgen_biodem%" == "none" i60_bioenergy_dem(t,i) = 0; +** 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,"R32M46-SSP2EU-NPi"); +); $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)); diff --git a/modules/62_material/exo_flexreg_apr16/declarations.gms b/modules/62_material/exo_flexreg_apr16/declarations.gms index f123033e91..ffb6234084 100644 --- a/modules/62_material/exo_flexreg_apr16/declarations.gms +++ b/modules/62_material/exo_flexreg_apr16/declarations.gms @@ -26,12 +26,14 @@ positive variables ; equations - q62_dem_material(i,kall) Estimating material demand (mio. tDM per yr) + q62_dem_material(i,kall_excl_kforestry) Estimating material demand (mio. tDM per yr) + q62_dem_material_forestry(i,kforestry) Demand for forestry products (mio. tDM per yr) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_dem_material(t,i,kall,type) Demand for material usage (mio. tDM per yr) - oq62_dem_material(t,i,kall,type) Estimating material demand (mio. tDM per yr) + ov_dem_material(t,i,kall,type) Demand for material usage (mio. tDM per yr) + oq62_dem_material(t,i,kall_excl_kforestry,type) Estimating material demand (mio. tDM per yr) + oq62_dem_material_forestry(t,i,kforestry,type) Demand for forestry products (mio. tDM per yr) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/62_material/exo_flexreg_apr16/equations.gms b/modules/62_material/exo_flexreg_apr16/equations.gms index 1f6221a307..1d588cb992 100644 --- a/modules/62_material/exo_flexreg_apr16/equations.gms +++ b/modules/62_material/exo_flexreg_apr16/equations.gms @@ -19,14 +19,20 @@ *' 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) + q62_dem_material(i2,kall_excl_kforestry) .. + vm_dem_material(i2,kall_excl_kforestry) =e= - sum(ct,f62_dem_material(ct,i2,kall))*s62_historical + sum(ct,f62_dem_material(ct,i2,kall_excl_kforestry))*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)) + (p62_dem_material_lastcalibyear(i2,kall_excl_kforestry) * p62_scaling_factor(i2)) + *(1-s62_historical) + sum(ct, p62_bioplastic_substrate(ct, i2, kall_excl_kforestry)) - + sum(ct, p62_bioplastic_substrate_double_counted(ct,i2,kall_excl_kforestry)) ; +*' Demand for forestry products (wood and woodfuel) is provided by the timber module. + q62_dem_material_forestry(i2,kforestry) .. + vm_dem_material(i2,kforestry) + =e= + sum(ct, pm_demand_forestry(ct,i2,kforestry)); + ; diff --git a/modules/62_material/exo_flexreg_apr16/postsolve.gms b/modules/62_material/exo_flexreg_apr16/postsolve.gms index 6151fa40de..979193f976 100644 --- a/modules/62_material/exo_flexreg_apr16/postsolve.gms +++ b/modules/62_material/exo_flexreg_apr16/postsolve.gms @@ -18,12 +18,16 @@ if (sum(sameas(t_past,t),1) = 1, *' @stop *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_dem_material(t,i,kall,"marginal") = vm_dem_material.m(i,kall); - oq62_dem_material(t,i,kall,"marginal") = q62_dem_material.m(i,kall); - ov_dem_material(t,i,kall,"level") = vm_dem_material.l(i,kall); - oq62_dem_material(t,i,kall,"level") = q62_dem_material.l(i,kall); - ov_dem_material(t,i,kall,"upper") = vm_dem_material.up(i,kall); - oq62_dem_material(t,i,kall,"upper") = q62_dem_material.up(i,kall); - ov_dem_material(t,i,kall,"lower") = vm_dem_material.lo(i,kall); - oq62_dem_material(t,i,kall,"lower") = q62_dem_material.lo(i,kall); + ov_dem_material(t,i,kall,"marginal") = vm_dem_material.m(i,kall); + oq62_dem_material(t,i,kall_excl_kforestry,"marginal") = q62_dem_material.m(i,kall_excl_kforestry); + oq62_dem_material_forestry(t,i,kforestry,"marginal") = q62_dem_material_forestry.m(i,kforestry); + ov_dem_material(t,i,kall,"level") = vm_dem_material.l(i,kall); + oq62_dem_material(t,i,kall_excl_kforestry,"level") = q62_dem_material.l(i,kall_excl_kforestry); + oq62_dem_material_forestry(t,i,kforestry,"level") = q62_dem_material_forestry.l(i,kforestry); + ov_dem_material(t,i,kall,"upper") = vm_dem_material.up(i,kall); + oq62_dem_material(t,i,kall_excl_kforestry,"upper") = q62_dem_material.up(i,kall_excl_kforestry); + oq62_dem_material_forestry(t,i,kforestry,"upper") = q62_dem_material_forestry.up(i,kforestry); + ov_dem_material(t,i,kall,"lower") = vm_dem_material.lo(i,kall); + oq62_dem_material(t,i,kall_excl_kforestry,"lower") = q62_dem_material.lo(i,kall_excl_kforestry); + oq62_dem_material_forestry(t,i,kforestry,"lower") = q62_dem_material_forestry.lo(i,kforestry); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/62_material/exo_flexreg_apr16/sets.gms b/modules/62_material/exo_flexreg_apr16/sets.gms index 253c23cbfd..e89607d1a0 100644 --- a/modules/62_material/exo_flexreg_apr16/sets.gms +++ b/modules/62_material/exo_flexreg_apr16/sets.gms @@ -13,4 +13,14 @@ sets a1,a2,b1,b2, history, SSP2_lowls,SSP2_lowcal / + + kall_excl_kforestry(kall) All products in the sectoral version excluding wood and woodfuel + / + tece,maiz,trce,rice_pro,soybean,rapeseed,groundnut,sunflower,oilpalm,puls_pro, + potato,cassav_sp,sugr_cane,sugr_beet,others,cottn_pro,foddr, pasture, begr, betr, + oils,oilcakes,sugar,molasses,alcohol,ethanol,distillers_grain,brans,scp,fibres, + livst_rum, livst_pig,livst_chick, livst_egg, livst_milk, fish, + res_cereals, res_fibrous, res_nonfibrous + / + ; diff --git a/modules/73_timber/default/declarations.gms b/modules/73_timber/default/declarations.gms index fc431387df..67ced42c84 100644 --- a/modules/73_timber/default/declarations.gms +++ b/modules/73_timber/default/declarations.gms @@ -8,14 +8,14 @@ parameters p73_timber_demand_gdp_pop(t_all,i,kforestry) Timber demand based on lauri et al 2019 (mio. m3 per yr) 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) +pm_demand_forestry(t_ext,i,kforestry) Extended demand for timber beyound simulation (mio. tDM per yr) 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) +im_timber_prod_cost(kforestry) Cost for producing one unit of wood and woodfuel (USD per tDM) ; positive variables diff --git a/modules/73_timber/default/equations.gms b/modules/73_timber/default/equations.gms index d78bdb9177..0b062cc877 100644 --- a/modules/73_timber/default/equations.gms +++ b/modules/73_timber/default/equations.gms @@ -8,8 +8,8 @@ *' @equations *' Timber production cost include the cost for producing wood, woodfuel and residues, -*' as well as additional costs for harvesting (see below) and technical costs for -*' a slack variable ('v73_prod_heaven_timber'). The slack variable (high costs) +*' and technical costs for a slack variable ('v73_prod_heaven_timber'). +*' The slack variable (high costs) *' is only used as a last resort when there is no other way to meet the timber *' demand. The purpose of the slack variable is to assure technically feasibility *' of the model under all conditions and to indicate shortage of wood supply, if any. @@ -17,15 +17,14 @@ q73_cost_timber(i2).. vm_cost_timber(i2) =e= - sum(cell(i2,j2), vm_prod(j2,"wood")) * s73_timber_prod_cost_wood - + sum(cell(i2,j2), vm_prod(j2,"woodfuel")) * s73_timber_prod_cost_woodfuel - + sum(cell(i2,j2), v73_prod_residues(j2)) * s73_reisdue_removal_cost + sum((cell(i2,j2),kforestry), vm_prod(j2,kforestry) * im_timber_prod_cost(kforestry)) + + sum(cell(i2,j2), v73_prod_residues(j2)) * s73_reisdue_removal_cost + sum((cell(i2,j2),kforestry), v73_prod_heaven_timber(j2,kforestry) * s73_free_prod_cost) ; *' The following equations describes cellular level production (in dry matter) of -*' woody biomass `vm_prod_reg` as the sum of the cluster level production of -*' timber coming from 'v73_prod_forestry' and 'v73_prod_natveg'. When production +*' woody biomass `vm_prod` as the sum of the cluster level production of +*' timber coming from 'vm_prod_forestry' and 'vm_prod_natveg'. When production *' capabilities are exhausted, the model can produce roundwood without using any *' land resources but by paying a very high cost ('s73_free_prod_cost'). *' Timber production equation is split in two parts, one each for industrial roundwood @@ -57,7 +56,7 @@ q73_prod_woodfuel(j2).. *' of industrial roundwood production is assumed to be lost during harvesting processes. *' USDA reports that ca. 30% of roundwood harvested are residues (@oswalt2019forest). *' Not all of this residue is recoverwed from forest and we assume 50% of residue -*' removal based on @pokharel2017factors. These numebrs (residue levels and residude +*' removal based on @pokharel2017factors. These numbers (residue levels and residude *' removals vary strongly among different studies, the numbers used here are from *' a USDA report on state of forests in USA which has consistent reporting over years) diff --git a/modules/73_timber/default/input.gms b/modules/73_timber/default/input.gms index c046fdfa64..91d789b5a2 100644 --- a/modules/73_timber/default/input.gms +++ b/modules/73_timber/default/input.gms @@ -17,12 +17,10 @@ scalars * https://unece.org/forests/prices 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 settling demand without production (USD per tDM) /20000/ - 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 (tDM per m3) /0.6/ + s73_free_prod_cost Very high cost for settling demand without production (USD per tDM) / 20000 / + s73_timber_demand_switch Logical switch to turn on or off timber demand 1=on 0=off (1) / 1 / + 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 / 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 / ; diff --git a/modules/73_timber/default/preloop.gms b/modules/73_timber/default/preloop.gms index 1d1af6183c..d5c9f58b72 100644 --- a/modules/73_timber/default/preloop.gms +++ b/modules/73_timber/default/preloop.gms @@ -13,7 +13,7 @@ p73_forestry_demand_prod_specific(t_past_forestry,iso,total_wood_products) = f73 ** Loop over time to calculate future demand ** Calculations based on Lauri et al. 2019 -loop(t_all$(m_year(t_all) >= sm_fix_SSP2 AND m_year(t_all) <= 2150), +loop(t_all$(m_year(t_all) > 2015 AND m_year(t_all) <= 2150), p73_forestry_demand_prod_specific(t_all,iso,total_wood_products)$(im_gdp_pc_ppp_iso(t_all,iso)>0 AND im_pop_iso(t_all,iso)>0) = p73_forestry_demand_prod_specific(t_all-1,iso,total_wood_products) * @@ -29,15 +29,15 @@ p73_timber_demand_gdp_pop(t_all,i,kforestry) = sum((i_to_iso(i,iso),kforestry_to ** Hard additive calibration for timber demand if(s73_timber_demand_switch=1, loop (t_all, - if(m_year(t_all) < sm_fix_SSP2, + if(m_year(t_all) <= 2015, p73_demand_calib(t_all,i,"wood") = f73_regional_timber_demand(t_all,i,"industrial_roundwood") - p73_timber_demand_gdp_pop(t_all,i,"wood"); p73_timber_demand_gdp_pop(t_all,i,"wood") = p73_timber_demand_gdp_pop(t_all,i,"wood") + p73_demand_calib(t_all,i,"wood"); ); ); - loop (t_all$(m_year(t_all)>=sm_fix_SSP2), - p73_timber_demand_gdp_pop(t_all,i,"wood")$(p73_timber_demand_gdp_pop(t_all,i,"wood") s73_increase_ceiling) = p73_timber_demand_gdp_pop(t_all-1,i,"wood") * s73_increase_ceiling; + loop (t_all$(m_year(t_all) > 2015), + p73_timber_demand_gdp_pop(t_all,i,"wood")$(p73_timber_demand_gdp_pop(t_all,i,"wood") < p73_timber_demand_gdp_pop(t_all-1,i,"wood")) = p73_timber_demand_gdp_pop(t_all-1,i,"wood") * s73_increase_ceiling; + p73_timber_demand_gdp_pop(t_all,i,"wood")$(p73_timber_demand_gdp_pop(t_all,i,"wood")/p73_timber_demand_gdp_pop(t_all-1,i,"wood") > s73_increase_ceiling) = p73_timber_demand_gdp_pop(t_all-1,i,"wood") * s73_increase_ceiling; ); ); @@ -48,18 +48,18 @@ $endif ** Convert to tDM from mio m3 ** p73_timber_demand_gdp_pop is in mio m^3 -** pm_demand_ext in mio ton DM +** pm_demand_forestry 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); +pm_demand_forestry(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); +pm_demand_forestry(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), +loop(t_all$(m_year(t_all) > 2015), p73_fraction(t_all) = s73_expansion/(m_year("y2100") - sm_fix_SSP2) * m_yeardiff(t_all) + p73_fraction(t_all-1); ); @@ -81,12 +81,15 @@ if(s73_expansion = 0, ** 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); + p73_demand_constr_wood(t_all,i) = pm_demand_forestry(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); +pm_demand_forestry(t_all,i,"wood") = pm_demand_forestry(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); +pm_demand_forestry(t_all,i,kforestry)$(m_year(t_all)>2100) = pm_demand_forestry("y2100",i,kforestry); ** Calculate global demand -p73_glo_wood(t_all,kforestry) = sum(i,pm_demand_ext(t_all,i,kforestry)); +p73_glo_wood(t_all,kforestry) = sum(i,pm_demand_forestry(t_all,i,kforestry)); + +im_timber_prod_cost("wood") = s73_timber_prod_cost_wood; +im_timber_prod_cost("woodfuel") = s73_timber_prod_cost_woodfuel; diff --git a/modules/73_timber/default/presolve.gms b/modules/73_timber/default/presolve.gms deleted file mode 100644 index 0637bd7719..0000000000 --- a/modules/73_timber/default/presolve.gms +++ /dev/null @@ -1,21 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -** Current demand for establishment until 2020, after 2020 depending on s73_foresight -** s73_foresight=1 forward looking (establishment based on future demand), -** s73_foresight=0 myopic (establishment based on current demand) - -if(m_year(t) <= sm_fix_SSP2, -* pm_demand_forestry_future(i,kforestry) = pm_demand_ext("y2010",i,kforestry)*1.5; - pm_demand_forestry_future(i,kforestry) = pm_demand_ext(t,i,kforestry); -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); - ); -); diff --git a/modules/73_timber/default/realization.gms b/modules/73_timber/default/realization.gms index 3e091e309d..571cb987fb 100644 --- a/modules/73_timber/default/realization.gms +++ b/modules/73_timber/default/realization.gms @@ -5,15 +5,13 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -*' @description biomass_mar20 realization acts as a common tunnel for land related -*' decisions in forestry [32_forestry] and natveg [35_natveg] modules and corresponding -*' production of woody biomass realized. This realization harvests timber from -*' 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 +*' @description In this realization, aggregated timber demand for wood and woodfuel +*' `pm_demand_forestry` is calculated based on demand equation from @lauri_timber_demand *' and income elasticities from @morland2018supply. See @mishra_forestry_2021 for more details. *' This realization can also account for construction wood demand based on *' @churkina2020buildings which is added on top of industrial roundwood demand (see @mishra_timbercities_2022). +*' Timber can be produced from both timber plantations `vm_prod_forestry` provided by [32_forestry] +*' and natural vegetation `vm_prod_natveg` provided by [35_natveg]. *' @limitations Timber demand cannot be determined endogenously @@ -24,6 +22,5 @@ $Ifi "%phase%" == "input" $include "./modules/73_timber/default/input.gms" $Ifi "%phase%" == "equations" $include "./modules/73_timber/default/equations.gms" $Ifi "%phase%" == "scaling" $include "./modules/73_timber/default/scaling.gms" $Ifi "%phase%" == "preloop" $include "./modules/73_timber/default/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/73_timber/default/presolve.gms" $Ifi "%phase%" == "postsolve" $include "./modules/73_timber/default/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/73_timber/module.gms b/modules/73_timber/module.gms index 6da09b4853..cbaad3d3fb 100644 --- a/modules/73_timber/module.gms +++ b/modules/73_timber/module.gms @@ -7,11 +7,10 @@ *' @title Timber *' -*' @description This module handles the production of timber using plantations [32_forestry] -*' and natural vegetation [35_natveg]. Timber can be produced from both commercial plantations -*' and natural forests. The module feeds `vm_prod` at cluster level to [17_production] and -*' [21_trade] modules. This module also calculates the "real" harvested area in natural -*' forests i.e. `v35_hvarea_primforest`,`v35_hvarea_secdforest` and `v73_hvarea_other`. +*' @description This module provides demand for forestry products via the interface `pm_demand_forestry` +*' to the modules [32_forestry] and [62_material], and merges production of timber from +*' different sources into the interface `vm_prod`, which is used in the [17_production] and +*' [21_trade] modules. *' *' @authors Abhijeet Mishra, Florian Humpenöder diff --git a/modules/80_optimization/nlp_apr17/solve.gms b/modules/80_optimization/nlp_apr17/solve.gms index 42984f030b..0a0ba81a4e 100644 --- a/modules/80_optimization/nlp_apr17/solve.gms +++ b/modules/80_optimization/nlp_apr17/solve.gms @@ -47,25 +47,25 @@ if (magpie.modelstat > 2, if(s80_resolve_option = 1, display "Modelstat > 2 | Retry solve with CONOPT4 default setting"; option nlp = conopt4; - magpie.optfile = 0; - elseif s80_resolve_option = 2, + magpie.optfile = 0; + elseif s80_resolve_option = 2, display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE"; option nlp = conopt4; - magpie.optfile = 1; - elseif s80_resolve_option = 3, + magpie.optfile = 1; + elseif s80_resolve_option = 3, display "Modelstat > 2 | Retry solve with CONOPT4 w/o preprocessing"; option nlp = conopt4; - magpie.optfile = 2; - elseif s80_resolve_option = 4, + magpie.optfile = 2; + elseif s80_resolve_option = 4, display "Modelstat > 2 | Retry solve with CONOPT3"; option nlp = conopt; - magpie.optfile = 0; + magpie.optfile = 0; ); solve magpie USING nlp MINIMIZING vm_cost_glo; if(s80_secondsolve = 1, solve magpie USING nlp MINIMIZING vm_cost_glo; ); option nlp = conopt4; - magpie.optfile = s80_optfile; + magpie.optfile = s80_optfile; display "vm_cost_glo.l"; display vm_cost_glo.l; @@ -78,9 +78,9 @@ if (magpie.modelstat > 2, display s80_counter; display magpie.modelstat; * Set modelstat to 13 in case of NA for the `until` check of the repeat loop. -* Otherwise, the repeat loop will never end. +* Otherwise, the repeat loop will never end. magpie.modelStat$(magpie.modelStat=NA) = 13; - + s80_resolve_option$(s80_resolve_option >= 4) = 0; until (magpie.modelstat <= 2 or s80_counter >= s80_maxiter) diff --git a/modules/include.gms b/modules/include.gms index 32b37ac6ae..d00709aaec 100644 --- a/modules/include.gms +++ b/modules/include.gms @@ -22,8 +22,9 @@ $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/28_ageclass/module.gms" +$include "./modules/29_cropland/module.gms" +$include "./modules/30_croparea/module.gms" $include "./modules/31_past/module.gms" $include "./modules/32_forestry/module.gms" $include "./modules/34_urban/module.gms" diff --git a/output.R b/output.R index a439f41537..e4775c7104 100644 --- a/output.R +++ b/output.R @@ -31,9 +31,10 @@ if (!is.null(renv::project()) && !exists("source_include") && Sys.getenv("SLURM_ library(lucode2) library(gms) +source("scripts/helper.R") runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { - choose_folder <- function(title="Please choose a folder") { + chooseFolder <- function(title="Please choose a folder") { dirs <- c(Sys.glob("./output/*/full.gms"), Sys.glob("./output/HR*/*/full.gms")) dirs <- sub("^\\./output/", "", dirs) dirs <- sub("/full\\.gms$", "", dirs) @@ -66,7 +67,7 @@ runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { if(answer=="y"){ return(paste0("./output/",dirs[id+1])) } else { - choose_folder(title) + chooseFolder(title) } } else if(any(dirs[identifier] == "all")){ identifier <- 2:length(dirs) @@ -76,51 +77,15 @@ 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 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 <- grep("^SLURM", modes, invert = TRUE, value = TRUE) - } - cat("\n",title,":\n",sep="") - cat(paste(seq_along(modes), modes, sep=": " ),sep="\n") - cat("Number: ") - identifier <- gms::getLine() - identifier <- as.numeric(strsplit(identifier,",")[[1]]) - if(slurm) { - system("sclass") - comp <- switch(identifier, - "1" = "slurm standby", - "2" = "slurm standby maxMem", - "3" = "slurm priority", - "4" = "slurm priority maxMem", - "5" = "direct", - "6" = "background", - "7" = "debug") - - } else { - comp <- switch(identifier, - "1" = "direct", - "2" = "background", - "3" = "debug") - } - if(is.null(comp)) stop("This type is invalid. Please choose a valid type") - return(comp) - } - - runsubmit <- function(output, alloutputdirs, submit, script_path) { + runsubmit <- function(output, alloutputdirs, submit, scriptPath, slurmModes) { 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 # nolint # run output scripts over all choosen folders for(rout in output){ - name <- ifelse(file.exists(paste0(script_path,rout)), rout, paste0(rout,".R")) - script <- paste0(script_path,name) + name <- ifelse(file.exists(paste0(scriptPath, rout)), rout, paste0(rout, ".R")) + script <- paste0(scriptPath, name) if(!file.exists(script)) { warning("Script ",name, " could not be found. Skip execution!") next @@ -135,45 +100,39 @@ runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { rout_name <- sub("\\.R$","",sub("/","_",rout)) for(outputdir in loop) { 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") { + rCommand <- paste0("output.R outputdir=",paste(outputdir,collapse=",")," output=",rout," submit=direct") + if(submit %in% c("Direct execution", "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") { + } else if(submit %in% c("Background execution", "background")) { 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") { + system2("Rscript", rCommand, stderr = log, stdout = log, wait=FALSE) + } else if(submit %in% c("Debug mode", "debug")) { tmp.env <- new.env() sys.source(script,envir=tmp.env) rm(tmp.env) } else { - stop("Unknown submission type") + slurmModes <- yaml::read_yaml(slurmModes)$slurmjobs + if(submit %in% names(slurmModes)) { + command <- slurmModes[submit] + command <- gsub("%NAME", rout_name, command) + command <- gsub("%SCRIPT", rCommand, command) + message(command) + system(command) + } else { + stop("Unknown submission type") + } } } } } - if (is.null(outputdir)) outputdir <- choose_folder("Choose runs") + if (is.null(outputdir)) outputdir <- chooseFolder("Choose runs") if (is.null(output)) output <- gms::selectScript("./scripts/output") - if (is.null(submit)) submit <- choose_submit("Choose submission type") + if (is.null(submit)) submit <- chooseSubmit("Choose submission type", + slurmModes = "scripts/slurmOutput.yml") if (is.null(output)) { message("No output script selected! Stop here.") return(invisible(NULL)) @@ -198,7 +157,7 @@ runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { }, type = "message") }) if (!snapshotSuccess) { - stop(paste(errorMessage1, collapse = "\n"), paste(errorMessage2, collapse = "\n")) + warning(paste(errorMessage1, collapse = "\n"), paste(errorMessage2, collapse = "\n")) } message("done.") @@ -213,6 +172,8 @@ runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { if (!file.exists(file.path(runFolder, "renv.lock"))) { warning(normalizePath(runFolder), "/renv.lock does not exist.") message("Lockfile written to ", newLockfile) + } else if (!file.exists(newLockfile)) { + message("Could not write lockfile, see warning thrown earlier.") } else if (identical(readLines(file.path(runFolder, "renv.lock")), readLines(newLockfile))) { file.remove(newLockfile) } else { @@ -221,13 +182,15 @@ runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { } } - runsubmit(output, alloutputdirs = outputdir, submit, "scripts/output/") + runsubmit(output = output, alloutputdirs = outputdir, + submit = submit, scriptPath = "scripts/output/", + slurmModes = "scripts/slurmOutput.yml") message("") } -if(!exists("source_include")) { +if (!exists("source_include")) { output <- outputdir <- submit <- NULL - lucode2::readArgs("output","outputdir","submit", .silent=TRUE) + lucode2::readArgs("output", "outputdir", "submit", .silent = TRUE) } -runOutputs(output=output, outputdir = outputdir, submit=submit) +runOutputs(output = output, outputdir = outputdir, submit = submit) diff --git a/scripts/helper.R b/scripts/helper.R new file mode 100644 index 0000000000..82c086f2c3 --- /dev/null +++ b/scripts/helper.R @@ -0,0 +1,27 @@ +# Collection of helper functions + +chooseSubmit <- function(title, slurmModes) { + modes <- c("Direct execution", + "Background execution", + "Debug mode") + + #Is SLURM available? + slurm <- lucode2::SystemCommandAvailable("srun") + if(slurm) { + slurmModes <- yaml::read_yaml(slurmModes)$slurmjobs + modes <- c(modes, names(slurmModes)) + if(lucode2::SystemCommandAvailable("sclass")) { + cat("\nCurrent cluster utilization:\n") + system("sclass") + cat("\n") + } + } + cat("\n",title,":\n", sep="") + cat(paste(seq_along(modes), modes, sep=": " ),sep="\n") + cat("Number: ") + identifier <- gms::getLine() + identifier <- as.integer(strsplit(identifier,",")[[1]]) + comp <- modes[identifier] + if(is.null(comp) || is.na(comp)) stop("This type is invalid. Please choose a valid type") + return(comp) +} diff --git a/scripts/output/extra/checkSummation.R b/scripts/output/extra/checkSummation.R index 12e524568b..0c0e01816c 100644 --- a/scripts/output/extra/checkSummation.R +++ b/scripts/output/extra/checkSummation.R @@ -16,16 +16,16 @@ library(piamInterfaces) options(width = 180) ## Check outputdir -if(!exists("source_include")) { +if (!exists("source_include")) { outputdir <- "." } f <- file.path(outputdir, "report.mif") -if(!file.exists(f)) { +if (!file.exists(f)) { warning("report.mif missing, cannot check anything. Please create report first!") } else { failvar <- checkSummations(f, outputDirectory = NULL, absDiff = 0.001, summationsFile = "extractVariableGroups") - if(nrow(failvars) > 0) saveRDS(failvar, file.path(outputdir, "summationCheck.rds")) -} \ No newline at end of file + if (nrow(failvars) > 0) saveRDS(failvar, file.path(outputdir, "summationCheck.rds")) +} diff --git a/scripts/output/extra/disaggregation.R b/scripts/output/extra/disaggregation.R index ef98b04fca..9194cc03bf 100644 --- a/scripts/output/extra/disaggregation.R +++ b/scripts/output/extra/disaggregation.R @@ -21,7 +21,7 @@ library(gms) # Basic configuration # ============================================= if (!exists("source_include")) { - outputdir <- "output/LAMA65_Sustainability/" + outputdir <- "output/default_2024-06-01_15.40.24/" readArgs("outputdir") } map_file <- Sys.glob(file.path(outputdir, "clustermap_*.rds")) @@ -75,12 +75,11 @@ if (length(map_file) > 1) { 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) + area_shr <- area / (dimSums(area, dim = 3) + 10^-10) # 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) + crop_shr <- setNames(crop_shr[, getYears(area_shr), "crop_area"], NULL) # calculate crop area as share of total cell area area_shr_hr <- madrat::toolAggregate(area_shr, map_file, to = "cell") * crop_shr @@ -161,7 +160,7 @@ if (length(map_file) > 1) { # for grassland and natural vegetation natveg <- c("primforest", "secdforest", "other") consv_sum_lr <- mbind( - dimSums(land_consv_lr[, , "past"], 3.2), + land_consv_lr[, , "past"], setNames(dimSums(land_consv_lr[, , natveg], dim = 3), "natveg") ) consv_sum_hr_agg <- mbind( @@ -291,24 +290,15 @@ if (file.exists(wdpa_hr_file)) { # 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_iso <- readGDX(gdx, "policy_countries29") +snv_pol_select <- readGDX(gdx, "s29_snv_shr") +snv_pol_noselect <- readGDX(gdx, "s29_snv_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") -} +marginal_land <- cfg$gms$c29_marginal_land # marginal land scenario +snv_pol_fader <- readGDX(gdx, "i29_snv_scenario_fader") # ============================================ # Start disaggregation @@ -345,30 +335,49 @@ land_hr <- .fixCoords(land_hr) ) gc() +# --------------------------------- +# Split land pools +# --------------------------------- +t <- readGDX(gdx,"t") +land_split_hr <- land_hr[ ,t , ] + +# split "crop" into crop_area, crop_fallow and crop_treecover +message("Disaggregating cropland") +carea <- land(gdx, level = "cell", subcategories = c("crop"))[,,c("crop_area","crop_fallow","crop_treecover")] +carea_shr <- carea / (dimSums(carea, dim = 3) + 10^-10) +# calculate crop area as share of total cell area +carea_hr <- madrat::toolAggregate(carea_shr, map_file, to = "cell") * setNames(land_split_hr[, , "crop"], NULL) +# check +if (abs(sum(dimSums(carea_hr, dim = 3) - setNames(land_split_hr[, , "crop"], NULL), na.rm = T)) > 0.1) warning("large Difference in crop disaggregation detected!") + +# drop crop +land_split_hr <- land_split_hr[, , "crop", invert = TRUE] +# combine land_split_hr with carea_hr +land_split_hr <- mbind(carea_hr, land_split_hr) + +rm(carea, carea_shr, carea_hr) +gc() + # --------------------------------- # Disaggregate MAgPIE crop types # --------------------------------- message("Disaggregating MAgPIE crop types") -area_shr_hr <- .dissagcrop(gdx, land_hr, map = map_file) +area_shr_hr <- .dissagcrop(gdx, land_split_hr, map = map_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" + message = "Write outputs cell.croparea_share" ) gc() -# --------------------------------- -# Split land pools -# --------------------------------- -land_split_hr <- land_hr[, getYears(area_shr_hr), ] area_hr <- area_shr_hr * dimSums(land_split_hr, dim = 3) rm(area_shr_hr) gc() -# replace crop in land_hr in with crop_kfo_rf, crop_kfo_ir, crop_kbe_rf +# replace crop_area 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) @@ -389,14 +398,12 @@ crop_kbe_ir <- setNames( "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] +# drop crop_area +land_split_hr <- land_split_hr[, , "crop_area", invert = TRUE] # combine land_split_hr with crop_hr. -land_split_hr <- mbind(crop_hr, fallow, land_split_hr) +land_split_hr <- mbind(crop_hr, land_split_hr) -rm(crop_kfo_rf, crop_kfo_ir, crop_kbe_rf, crop_kbe_ir, crop_hr, fallow, area_hr) +rm(crop_kfo_rf, crop_kfo_ir, crop_kbe_rf, crop_kbe_ir, crop_hr, area_hr) # split "forestry" into timber plantations, pre-scribed afforestation (NPi/NDC) and endogenous afforestation (CO2 price driven) message("Disaggregating forestry") @@ -405,7 +412,7 @@ 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!") +if (abs(sum(dimSums(farea_hr, dim = 3) - setNames(land_split_hr[, , "forestry"], NULL), na.rm = T)) > 0.1) warning("large Difference in forestry disaggregation detected!") # rename df <- data.frame(matrix(nrow = 3, ncol = 2)) names(df) <- c("internal", "output") @@ -506,7 +513,7 @@ rm(land_consv_hr, urban_land_hr) land_bii_hr <- .fixCoords(land_bii_hr) -# Add primary and secondaray other land +# Add primary and secondary other land land_bii_hr <- PrimSecdOtherLand(land_bii_hr, land_hr_file) # specify potential natural vegetation diff --git a/scripts/output/extra/highres.R b/scripts/output/extra/highres.R index 3d250abb7a..bde43b4419 100644 --- a/scripts/output/extra/highres.R +++ b/scripts/output/extra/highres.R @@ -100,9 +100,8 @@ highres <- function(cfg) { #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 + paste0(cfg$results_folder, "/", "magpie_y*.gdx")) + cfg$gms$s_use_gdx <- 2 #max resources for parallel runs cfg$qos <- "standby_maxMem_dayMax" @@ -129,10 +128,15 @@ highres <- function(cfg) { 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")) + k_trade <- readGDX(gdx, "k_trade") + ov_prod_reg <- readGDX(gdx, "ov_prod_reg", select = list(type = "level"))[,,k_trade] + ov_supply <- readGDX(gdx, "ov_supply", select = list(type = "level"))[,,k_trade] + import_for_feasibility <- readGDX(gdx, "ov21_import_for_feasibility", select = list(type = "level"), react = "silent") + if(is.null(import_for_feasibility)) { + import_for_feasibility <- new.magpie(getCells(ov_supply),getYears(ov_supply),getNames(ov_supply),fill = 0) + } supreg <- readGDX(gdx, "supreg") - f21_trade_balance <- toolAggregate(ov_prod_reg - ov_supply, supreg) + f21_trade_balance <- toolAggregate(ov_prod_reg - (ov_supply + import_for_feasibility), supreg) write.magpie(f21_trade_balance, paste0("modules/21_trade/input/f21_trade_balance.cs3")) #get tau from low resolution run with c200 diff --git a/scripts/output/extra/runtimePR.R b/scripts/output/extra/runtimePR.R new file mode 100644 index 0000000000..219d4a8c77 --- /dev/null +++ b/scripts/output/extra/runtimePR.R @@ -0,0 +1,128 @@ +# | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +# | authors, and contributors see CITATION.cff file. This file is part +# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +# | AGPL-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: Compiles model run time for PR +# comparison script: TRUE +# --------------------------------------------------------------- + +############################# LOAD LIBRARIES ############################# +library(lucode2, quietly = TRUE, warn.conflicts =FALSE) + +if(!exists("source_include")) { + outputdir <- file.path("output",list.dirs("output", full.names = FALSE, recursive = FALSE)) + lucode2::readArgs("outputdir") +} + +runtime <- NULL +maindir <- getwd() + +# ---- Read runtime data ---- + +cat("\nReading runtime for", length(outputdir), "runs\n") +for (d in outputdir) { + splittedpath <- strsplit(d, "/")[[1]] + runfolder <- splittedpath[length(splittedpath)] + datafile <- paste0(d, "/runstatistics.rda") + + # try to read runtime data from runstatistics.rda + tmp <- NULL + start <- NULL + end <- NULL + timePrepareStart <- NULL + timePrepareEnd <- NULL + timeGAMSStart <- NULL + timeGAMSEnd <- NULL + timeOutputStart <- NULL + timeOutputEnd <- NULL + + if (!file.exists(datafile)) { + cat("No file found ", datafile, "\n") + } else if (file.info(datafile)$size == 0) { + cat("Empty file ", datafile, "\n") + } else { + # if file exists and it's file size is >0: load it + stats <- NULL + load(datafile) + # try to load detailed runtime information + if (!is.null(stats) && !is.null(stats$timePrepareStart)) { + timePrepareStart <- stats$timePrepareStart + timePrepareEnd <- stats$timePrepareEnd + timeGAMSStart <- stats$timeGAMSStart + timeGAMSEnd <- stats$timeGAMSEnd + timeOutputStart <- stats$timeOutputStart + timeOutputEnd <- stats$timeOutputEnd + } else if (!is.null(stats) && !is.null(stats$starttime)) { + # if no detailed information is available load the old one (it's only the gams runtime) + start <- stats$starttime + end <- stats$endtime + } + } + + # if no start and end was extractable from runstatistics.rda + # conclude it from timestamps of the files in the results folder + if (is.null(end) && is.null(timePrepareEnd) && is.null(timeGAMSEnd) && is.null(timeOutputEnd)) { + local_dir(d) + # find all files + info <- file.info(dir()) + # sort files in info by mtime + info <- info[order(info$mtime), ] + # save time of first file in the list (oldest) + start <- info[1, ]$mtime + # save time if last file in the list (newest) + + if ("report.rds" %in% rownames(info)) { + # if run has finished normally the report.rds file should exist. In this case take the newest file + cat("Using the newest file in", runfolder, "as end\n") + end <- tail(info$mtime, n = 1) + } else { + # if report.rds does not exist, this indicates that the run did not finish properly and the mif file has been + # generated manually later without also producing the report.rds + # In this case do not take the newest file (which is the manually and belated produced mif file) but take the + # full.lst which is the newest file before the mif file + cat("Using", runfolder, "full.lst as end\n") + end <- info["full.lst", ]$mtime + } + local_dir(maindir) + } + + # if (total) runtime data was found + if (all(c(!is.null(start), !is.null(end)))) { + # need to be transformed to NA otherwise rbind would not work if one of them is NULL + tmp <- end - start + units(tmp) <- "hours" + if (is.null(start)) start <- NA + if (is.null(end)) end <- NA + new <- data.frame(section = "total", run = runfolder, mins = round(tmp,1), stringsAsFactors = FALSE) + runtime <- rbind(runtime, new) + } + + # if detailed runtime data was found append it + if (!is.null(timePrepareEnd)) { + tmp <- timePrepareEnd - timePrepareStart + units(tmp) <- "mins" + new <- data.frame(section = "prep", run = runfolder, mins = round(tmp,1), stringsAsFactors = FALSE) + runtime <- rbind(runtime, new) + } + + if (!is.null(timeGAMSEnd)) { + tmp <- timeGAMSEnd - timeGAMSStart + units(tmp) <- "mins" + new <- data.frame(section = "GAMS", run = runfolder, mins = round(tmp,1), stringsAsFactors = FALSE) + runtime <- rbind(runtime, new) + } + + if (!is.null(timeOutputEnd)) { + tmp <- timeOutputEnd - timeOutputStart + units(tmp) <- "mins" + new <- data.frame(section = "output", run = runfolder, mins = round(tmp,1), stringsAsFactors = FALSE) + runtime <- rbind(runtime, new) + } +} + +runtime <- runtime[order(runtime$section,runtime$run),] +write.csv(runtime, file = "output/runtimePR.csv", quote = FALSE,row.names = FALSE) diff --git a/scripts/output/projects/EU_report.R b/scripts/output/projects/EU_report.R new file mode 100644 index 0000000000..0eec8d917d --- /dev/null +++ b/scripts/output/projects/EU_report.R @@ -0,0 +1,3 @@ +readArgs("outputdir") +rmarkdown::render("./scripts/output/projects/EU_report.Rmd", + output_dir = outputdir) diff --git a/scripts/output/projects/EU_report.Rmd b/scripts/output/projects/EU_report.Rmd new file mode 100644 index 0000000000..3037e1706f --- /dev/null +++ b/scripts/output/projects/EU_report.Rmd @@ -0,0 +1,251 @@ +--- +title: "Compare EU results with LUH Data" +output: + html_document: + df_print: paged + code_folding: hide +--- + + + + +This output report validates spatial pattern of the EU regions against LUH2v2 data. + +# Setup data and plot functions +```{r, setup, include=FALSE} +knitr::opts_knit$set(root.dir = dirname(dirname(dirname(getwd())))) +``` + +```{r load-libraries, echo = T, results = 'hide', message=FALSE, warning=FALSE} +# setup working dir and packages, read outputdir +readArgs("outputdir") +library(madrat) +library(mrcommons) +library(magpie4) + +library(ggplot2) +library(plotly) +library(gridExtra) +library(patchwork) + +library(dplyr) +library(tidyr) +library(stringr) +``` + +```{r} +print(paste0("Script started for output directory: ", outputdir)) +``` + +```{r read-data, echo = T, results = 'hide', message = FALSE, warning = FALSE} +compareYears <- c(1995, 2000, 2005, 2010) +# ----- Read and process model output and luh2v2 data; then bind data to a validation object ----- +# load and process reference data to match with model data +luh2v2 <- calcOutput("LanduseInitialisation", aggregate = FALSE, cellular = TRUE, + nclasses = "seven", cells = "lpjmlcell") +luh2v2 <- luh2v2[, compareYears, ] +# add subdimension for reference data +getNames(luh2v2) <- paste0(getNames(luh2v2), ".ref") + +# load and process model data to match with reference data +path2landoutput <- file.path(outputdir, "cell.land_0.5.mz") +cellLand <- read.magpie(path2landoutput) +cellLand <- cellLand[, compareYears, ] +# add subdimension for model data +getNames(cellLand) <- paste0(getNames(cellLand), ".mod") +load(file.path(outputdir, "spatial_header.rda")) + +# bind model and reference data +validationObj <- mbind(cellLand, luh2v2) + +# get EU countries +mapping <- toolGetMapping("regionmappingH12.csv") +countriesEU <- mapping$CountryCode[mapping$RegionCode == "EUR"] +``` + +```{r, load-plot-functions, echo = T, results = 'hide'} +# ----- Create a plotting functions ----- +# helper function to convert magclass obj to wide dataframe +convertToWideDataframe <- function(magclassObj) { + as.data.frame(magclassObj) %>% + pivot_wider(names_from = "Data2", values_from = "Value") +} + +# helper function to subset all cluster of a country +subsetCountryCluster <- function(magclassObj, countries) { + magclassObj[intersect(countries, getItems(magclassObj, split=TRUE)[[1]][[1]]), , ] +} + +# function combines a scatter plot with maps such that facets are aligned +plotCombined <- function(validationObj) { + # create the plots + p1 <- plotScatter(validationObj) + p2 <- plotMaps(validationObj) + + # combine and align the plots using patchwork + combinedPlot <- p1 / p2 + + # print the combined plot + print(combinedPlot) +} + +# create scatter plot for eu countries faceted by year +plotScatter <- function(validationObj) { + validationObj <- toolCoord2Isocell(validationObj, "lpjcell") + validationObj <- subsetCountryCluster(validationObj, countriesEU) + + # create quality measure dataframe with RMSE, MAE a.o. + qualityMeasuresDf <- NULL # list of dataframes, one for each year + numericYears <- as.numeric(gsub("y", "", getItems(validationObj, 2))) + for (year in numericYears) { + # get a vector with the quality measures + qualityMeasures <- luplot::qualityMeasure( + validationObj[, year, "mod"], validationObj[, year, "ref"], + measures = c("Willmott", "Willmott refined", "Nash Sutcliffe", "RMSE", "MAE") + ) + + # create text for the year facet + text <- "" + for (i in seq_along(qualityMeasures)) { + text <- paste0(text, stringr::str_trunc(names(qualityMeasures)[i], 12, ellipsis = "."), + " : ", qualityMeasures[i], "\n") + } + + # create dataframe for that year + qualityMeasuresDf[[year]] <- data.frame( + Year = year, + text = text + ) + } + qualityMeasBinded <- dplyr::bind_rows(qualityMeasuresDf) # bind all year dataframes + + # create the plot with facets + validationDF <- convertToWideDataframe(validationObj) + + p <- ggplot(validationDF, + aes(x = mod, y = ref, reg = Region, cell = Cell, relativeErr = (mod - ref) / ref)) + + geom_point(size = 0.5) + + geom_abline(color = "#663939", size = 1.5) + + facet_wrap(~ Year, scales = "free", ncol = 4) + # Create facets based on 'Year' + labs(x = "MAgPIE output", y = "luh2v2") + + theme(panel.background = element_rect(fill = "gray55"), + panel.grid.major = element_line(color = "gray62"), + panel.grid.minor = element_line(color = "grey58")) + + # add quality measure text + p <- p + geom_text(x = 0, y = Inf, aes(label = text), color = "#ffb5b5", # bright color contrasting dark background + hjust = 0, vjust = 1.1, nudge_x = 10, size = 2.6, family = "sans", fontface = "bold", + data = qualityMeasBinded, inherit.aes = FALSE) + + return(p) +} + +# create EU maps faceted by year +plotMaps <- function(validationObj) { + # create a ggplot object using luplot + relErr <- (validationObj[, , paste0("mod")] - validationObj[, , paste0("ref")]) / + (validationObj[, , paste0("ref")]) + + p <- luplot::plotmap2(relErr, + legend_range = c(-2, 2), legendname = "relative\n diff \n to \n LUH2v2", ncol = 4, + midcol = "#ffffff", lowcol = "blue", highcol = "red", midpoint = 0, + title = "" + ) + + # adjust the plot + p <- p + coord_sf(xlim = c(-10, 40), ylim = c(35, 70)) + facet_wrap(~ Year, ncol = 4) + + theme(aspect.ratio = 1, legend.title = element_text(size = 8)) + + p <- p + guides(fill = guide_colorbar(barheight = 5, barwidth = 0.2)) + return(p) +} + +# create an interactive scatterplot for eu countries of a year +plotInteractiveSub <- function(validationObj, year) { + p <- plotScatter(validationObj[, year, ]) + p <- p + ggtitle(paste0("EU Countries ", year)) + p <- plotly::ggplotly(p) + return(p) +} +``` + +# Plot data + +## crop +```{r crop,message=FALSE, warning=FALSE, out.width="100%"} +type <- "crop" +plotCombined(validationObj[, , type]) +``` + +```{r crop2, message=FALSE, warning=FALSE, fig.align="center"} +plotInteractiveSub(validationObj[, , type], 2010) +``` + +## pasture +```{r past,message=FALSE, warning=FALSE, out.width="100%"} +type <- "past" +plotCombined(validationObj[, , type]) +``` + +```{r past2, message=FALSE, warning=FALSE, fig.align="center"} +plotInteractiveSub(validationObj[, , type], 2010) +``` + +## forestry +```{r forestry,message=FALSE, warning=FALSE, out.width="100%"} +type <- "forestry" +plotCombined(validationObj[, , type]) +``` + +```{r forestry2, message=FALSE, warning=FALSE, fig.align="center"} +plotInteractiveSub(validationObj[, , type], 2010) +``` + +## primforest +```{r primforest,message=FALSE, warning=FALSE, out.width="100%"} +type <- "primforest" +plotCombined(validationObj[, , type]) +``` + +```{r primforest2, message=FALSE, warning=FALSE, fig.align="center"} +plotInteractiveSub(validationObj[, , type], 2010) +``` + +## secdforest +```{r secdforest,message=FALSE, warning=FALSE, out.width="100%"} +type <- "secdforest" +plotCombined(validationObj[, , type]) +``` + +```{r secdforest2, message=FALSE, warning=FALSE, fig.align="center"} +plotInteractiveSub(validationObj[, , type], 2010) +``` + +## urban + +```{r urban,message=FALSE, warning=FALSE, out.width="100%"} +type <- "urban" +plotCombined(validationObj[, , type]) +``` + +```{r urban2, message=FALSE, warning=FALSE, fig.align="center"} +plotInteractiveSub(validationObj[, , type], 2010) +``` + +## other +```{r other, message=FALSE, warning=FALSE, out.width="100%"} +type <- "other" +plotCombined(validationObj[, , type]) +``` + +```{r other2, message=FALSE, warning=FALSE, fig.align="center"} +plotInteractiveSub(validationObj[, , type], 2010) +``` diff --git a/scripts/output/projects/FSEC_water.R b/scripts/output/projects/FSEC_water.R index 016ccd2868..564f89ba33 100644 --- a/scripts/output/projects/FSEC_water.R +++ b/scripts/output/projects/FSEC_water.R @@ -59,3 +59,7 @@ watStressViolations <- watStress # mark violations in different color watStressViolations[efvViolation == 1] <- 100 write.magpie(watStressViolations, file_name = file.path(outputdir, "watStressViolations.mz")) + +# Water EFV ratio (EFV to EFR) +watEFVratio <- waterEFVratio(gdx, level = "grid", dir = outputdir) +write.magpie(watEFVratio, file_name = file.path(outputdir, "watEFVratio.mz")) diff --git a/scripts/output/projects/agmip_merge_report.R b/scripts/output/projects/agmip_merge_report.R index 94dfa25996..301c111cf6 100644 --- a/scripts/output/projects/agmip_merge_report.R +++ b/scripts/output/projects/agmip_merge_report.R @@ -14,8 +14,9 @@ library(lucode2) library(magclass) library(quitte) library(madrat) -library(iamc) +library(piamInterfaces) library(gms) +library(dplyr) options(error=function()traceback(2)) @@ -64,10 +65,32 @@ if (!is.null(missing)) { } if (file.exists("output/agmip_report_full.csv")) { - #saveRDS(read.quitte("output/agmip_report_full.csv"),file = "output/agmip_report_full.rds") - #agmip_report_full <- read.report(file="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") + submission <- generateIIASASubmission( + mifs = "output/agmip_report_full.csv", + mapping = "AgMIP", + model = "MAgPIE", + outputFilename = NULL, + timesteps = c(seq(1995, 2100, 1)), + naAction = "na.pass" + ) + submission <- submission %>% + mutate( + "item" := gsub(".*\\.", "", variable), + "variable" := gsub("\\..*", "", variable) + ) %>% + select( + "Model" = "model", + "Scenario" = "scenario", + "Region" = "region", + "Item" = "item", + "Variable" = "variable", + "Year" = "period", + "Unit" = "unit", + "Value" = "value" + ) + write.csv(submission, + quote = FALSE, + file = "output/agmip_submission_report.csv", + row.names = FALSE + ) } diff --git a/scripts/output/projects/inms_reporting_reg.R b/scripts/output/projects/inms_reporting_reg.R index bcc2abd4ce..b4cd9aac27 100644 --- a/scripts/output/projects/inms_reporting_reg.R +++ b/scripts/output/projects/inms_reporting_reg.R @@ -24,15 +24,15 @@ print("Start inms reporting reg runscript") if(!exists("source_include")) { - title <- "inms_SSP2_RCP4p5_PolicyLow_v4" - outputdir <- "output/inms_SSP2_RCP4p5_PolicyLow_v4_2020-07-13_15.37.07" + 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") + readArgs("outputdir", "title") } ######################################################################################### -print(paste0("script started for output directory",outputdir)) +print(paste0("script started for output directory", outputdir)) withr::local_dir(outputdir) @@ -41,24 +41,26 @@ title <- cfg$title print("generating INMS output for the run: ") print(title) -filename=paste0("report_",title,".mif") -gdx=paste0("fulldata.gdx") -a=getReportINMS(gdx,file=filename,scenario = title,dir=".") +filename <- paste0("report_", title, ".mif") +gdx <- paste0("fulldata.gdx") +a <- getReportINMS(gdx, file = filename, scenario = title, dir = ".") print(filename) -mif=read.report(filename) +mif <- read.report(filename) -missingyears=function(x){ - history=paste0("y",1965+((0:5)*5)) - x[[1]][[1]] <- time_interpolate(x[[1]][[1]],interpolated_year = c(history,paste0("y",2005+((0:9)*10))),integrate_interpolated_years = TRUE) - x[[1]][[1]][,history,] = 0 +missingyears <- function(x) { + history <- paste0("y", 1965 + ((0:5) * 5)) + x[[1]][[1]] <- time_interpolate(x[[1]][[1]], + interpolated_year = c(history,paste0("y",2005+((0:9)*10))), + integrate_interpolated_years = TRUE) + x[[1]][[1]][, history, ] <- 0 return(x) } #a=c(missingyears(ssp1),missingyears(ssp2)) -a=missingyears(mif) +a <- missingyears(mif) -write.reportProject(a,mapping=paste0(wdbefore,"/mapping_inms.csv"),file="report_inms.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/run_submit/submit_medium.sh b/scripts/run_submit/submit_medium.sh index 46939f54cf..a8d81b7deb 100644 --- a/scripts/run_submit/submit_medium.sh +++ b/scripts/run_submit/submit_medium.sh @@ -5,6 +5,5 @@ #SBATCH --output=slurm.log #SBATCH --mail-type=END #SBATCH --cpus-per-task=3 -#SBATCH --partition=standard Rscript submit.R diff --git a/scripts/run_submit/submit_priority.sh b/scripts/run_submit/submit_priority.sh index c0722ac8fe..052080501f 100644 --- a/scripts/run_submit/submit_priority.sh +++ b/scripts/run_submit/submit_priority.sh @@ -5,6 +5,5 @@ #SBATCH --output=slurm.log #SBATCH --mail-type=END #SBATCH --cpus-per-task=3 -#SBATCH --partition=priority Rscript submit.R diff --git a/scripts/run_submit/submit_priority_maxMem.sh b/scripts/run_submit/submit_priority_maxMem.sh index 1681ef78f9..286be68440 100644 --- a/scripts/run_submit/submit_priority_maxMem.sh +++ b/scripts/run_submit/submit_priority_maxMem.sh @@ -6,6 +6,5 @@ #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_short.sh b/scripts/run_submit/submit_short.sh index e0ab5ada21..fb89bdaf15 100644 --- a/scripts/run_submit/submit_short.sh +++ b/scripts/run_submit/submit_short.sh @@ -5,6 +5,5 @@ #SBATCH --output=slurm.log #SBATCH --mail-type=END #SBATCH --cpus-per-task=3 -#SBATCH --partition=standard Rscript submit.R diff --git a/scripts/run_submit/submit_short_maxMem.sh b/scripts/run_submit/submit_short_maxMem.sh index c1da4fa176..b11c9e62a0 100644 --- a/scripts/run_submit/submit_short_maxMem.sh +++ b/scripts/run_submit/submit_short_maxMem.sh @@ -6,7 +6,6 @@ #SBATCH --mail-type=END #SBATCH --cpus-per-task=16 #SBATCH --mem-per-cpu=0 -#SBATCH --partition=standard Rscript submit.R diff --git a/scripts/run_submit/submit_standby.sh b/scripts/run_submit/submit_standby.sh index f959e505a3..c508d0bdec 100644 --- a/scripts/run_submit/submit_standby.sh +++ b/scripts/run_submit/submit_standby.sh @@ -5,6 +5,5 @@ #SBATCH --output=slurm.log #SBATCH --mail-type=END #SBATCH --cpus-per-task=3 -#SBATCH --partition=priority Rscript submit.R diff --git a/scripts/run_submit/submit_standby_dayMax.sh b/scripts/run_submit/submit_standby_dayMax.sh index a63c56cd31..80a981279a 100644 --- a/scripts/run_submit/submit_standby_dayMax.sh +++ b/scripts/run_submit/submit_standby_dayMax.sh @@ -5,7 +5,6 @@ #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 index 0b2497b9bb..dcfcd12169 100644 --- a/scripts/run_submit/submit_standby_maxMem.sh +++ b/scripts/run_submit/submit_standby_maxMem.sh @@ -6,6 +6,5 @@ #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 index f5cd6a05a7..0af5490672 100644 --- a/scripts/run_submit/submit_standby_maxMem_dayMax.sh +++ b/scripts/run_submit/submit_standby_maxMem_dayMax.sh @@ -6,7 +6,6 @@ #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/slurmOutput.yml b/scripts/slurmOutput.yml new file mode 100644 index 0000000000..950328816e --- /dev/null +++ b/scripts/slurmOutput.yml @@ -0,0 +1,5 @@ +slurmjobs: + SLURM standby: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=standby --time=24:00:00" + SLURM standby maxMem: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=standby --time=24:00:00 --mem-per-cpu=0 --cpus-per-task=16" + SLURM priority: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=priority" + SLURM priority maxMem: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=priority --mem-per-cpu=0 --cpus-per-task=16" diff --git a/scripts/slurmStart.yml b/scripts/slurmStart.yml new file mode 100644 index 0000000000..513adadf2e --- /dev/null +++ b/scripts/slurmStart.yml @@ -0,0 +1,4 @@ +slurmjobs: + SLURM priority: "sbatch --job-name=%NAME --output=logs/%NAME-%j.out --mail-type=END --wrap=\"Rscript %SCRIPT\" --qos=priority --cpus-per-task=3" + SLURM standby: "sbatch --job-name=%NAME --output=logs/%NAME-%j.out --mail-type=END --wrap=\"Rscript %SCRIPT\" --qos=standby --cpus-per-task=3" + SLURM medium: "sbatch --job-name=%NAME --output=logs/%NAME-%j.out --mail-type=END --wrap=\"Rscript %SCRIPT\" --qos=medium --cpus-per-task=3" diff --git a/scripts/start/projects/paper_peatlandTax.R b/scripts/start/projects/paper_peatlandTax.R new file mode 100644 index 0000000000..984c321eb5 --- /dev/null +++ b/scripts/start/projects/paper_peatlandTax.R @@ -0,0 +1,130 @@ +# | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +# | authors, and contributors see CITATION.cff file. This file is part +# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +# | AGPL-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 peatlandTax +# position: 5 +# ---------------------------------------------------------- + +## Load lucode2 and gms to use setScenario later +library(lucode2) +library(gms) +library(gdx) +library(magpie4) + +# 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") + +# create additional information to describe the runs +cfg$info$flag <- "PTax03H16" + +cfg$results_folder <- "output/:title:" +cfg$results_folder_highres <- "output" +cfg$force_replace <- TRUE +#cfg$qos <- "priority_maxMem" +cfg$qos <- "standby_maxMem_dayMax" + +# support function to create standardized title +.title <- function(cfg, ...) return(paste(cfg$info$flag, sep="_",...)) + +cfg$repositories <- append(list("https://rse.pik-potsdam.de/data/magpie/public"=NULL, + "./patch_inputdata"=NULL), + getOption("magpie_repos")) + +cfg$input['regional'] <- "rev4.109_36f73207_magpie.tgz" +cfg$input['validation'] <- "rev4.109_36f73207_validation.tgz" +cfg$input['calibration'] <- "calibration_H16_14Jun24.tgz" +cfg$input['zzzpatchGHGprices'] <- "patchGHGprices.tgz" + +cfg$gms$c_timesteps <- "5year" + +cfg$output <- c(cfg$output, "extra/highres") +ssp <- "SSP2" +cfg <- setScenario(cfg,c(ssp,"NPI","rcp7p0")) +cfg$input['cellular'] <- "rev4.109_36f73207_44a213b6_cellularmagpie_c400_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1_clusterweight-ba4466a8.tgz" +cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-NPi") +cfg$gms$c56_pollutant_prices_noselect <- "T0-CO2" +cfg$gms$policy_countries56 <- isoCountriesEUR + +calc_ghgprice <- function() { + 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"] <- 0 + T200[,"y2050","co2_c"] <- 200 + T200[,"y2100","co2_c"] <- 200 + T200[,"y2150","co2_c"] <- 200 + 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 + + T50 <- T200 * 0.25 + T100 <- T200 * 0.5 + + GHG <- mbind(add_dimension(T0, dim = 3.2, add = "scen", nm = "T0-GHG"), + add_dimension(T50, dim = 3.2, add = "scen", nm = "T50-GHG"), + add_dimension(T100, dim = 3.2, add = "scen", nm = "T100-GHG"), + add_dimension(T200, dim = 3.2, add = "scen", nm = "T200-GHG")) + + CO2 <- GHG + CO2[,,c("ch4", "n2o_n_direct", "n2o_n_indirect")] <- 0 + getNames(CO2,dim=2) <- gsub("GHG","CO2", getNames(CO2,dim=2)) + + GHGCH4GWP20 <- GHG + GHGCH4GWP20[,,"ch4"] <- GHGCH4GWP20[,,"ch4"]/28*84 + getNames(GHGCH4GWP20,dim=2) <- gsub("GHG","GHG-CH4GWP20", getNames(GHGCH4GWP20,dim=2)) + + GHG <- mbind(CO2, GHG, GHGCH4GWP20) + if (!dir.exists("./patch_inputdata")) dir.create("./patch_inputdata") + if (dir.exists("./patch_inputdata/patchGHGprices")) unlink("./patch_inputdata/patchGHGprices", recursive = TRUE) + dir.create("./patch_inputdata/patchGHGprices") + write.magpie(GHG,file_name = "patch_inputdata/patchGHGprices/f56_pollutant_prices.cs3") + tardir("patch_inputdata/patchGHGprices", "patch_inputdata/patchGHGprices.tgz") + + # scen56 <- magclass::read.magpie("modules/56_ghg_policy/input/f56_emis_policy.csv",file_type = "cs3") + # scen56 <- magclass::getNames(scen56,dim=1) + # + # 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") + unlink("patch_inputdata/patchGHGprices", recursive=TRUE) + return(getNames(GHG, dim = 2)) +} +ghgscen56 <- calc_ghgprice() + + +cfg$title <- .title(cfg, paste(ssp,"Ref",sep="-")) +cfg$gms$c56_mute_ghgprices_until <- "y2150" +cfg$gms$c56_pollutant_prices <- "T0-CO2" +cfg$gms$c56_emis_policy <- "reddnatveg_nosoil_nopeat" +download_and_update(cfg) +start_run(cfg, codeCheck = FALSE) + + +cfg$gms$c56_mute_ghgprices_until <- "y2025" + +for (tax in ghgscen56) { + for (peat in c("peatOff", "peatOn")) { + cfg$title <- .title(cfg, paste(ssp,tax,peat,sep="-")) + cfg$gms$c56_pollutant_prices <- tax + cfg$gms$c56_emis_policy <- if (peat=="peatOff") "reddnatveg_nosoil_nopeat" else "reddnatveg_nosoil" + start_run(cfg, codeCheck = FALSE) + } +} diff --git a/scripts/start/projects/project_ABCDR.R b/scripts/start/projects/project_ABCDR.R new file mode 100644 index 0000000000..b21af3cdf6 --- /dev/null +++ b/scripts/start/projects/project_ABCDR.R @@ -0,0 +1,84 @@ +# ---------------------------------------------------------- +# description: ABCDR Project runs +# position: 5 +# ---------------------------------------------------------- + +## Load lucode2 and gms to use setScenario later +library(lucode2) +library(gms) +library(magclass) +library(gdx) + +# 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 <- "ABCDR05" + +cfg$output <- c("rds_report") # Only run rds_report after model run +cfg$results_folder <- "output/:title:" +cfg$force_replace <- TRUE +cfg$force_download <- FALSE + +cfg$qos <- "standby_maxMem_dayMax" +#cfg$qos <- "priority" + +# support function to create standardized title +.title <- function(cfg, ...) return(paste(cfg$info$flag, sep="_",...)) + + +cfg$input['regional'] <- "rev4.109_36f73207_magpie.tgz" +cfg$input['validation'] <- "rev4.109_36f73207_validation.tgz" +cfg$input['calibration'] <- "calibration_H16_14Jun24.tgz" +cfg$input['cellular'] <- "rev4.109_36f73207_44a213b6_cellularmagpie_c400_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1_clusterweight-ba4466a8.tgz" + +ssp <- "SSP2" + +cfg$gms$cropland <- "detail_apr24" +# cfg$gms$croparea <- "detail_apr24" + + +cfg$gms$scen_countries15 <- isoCountriesEUR +cfg$gms$policy_countries29 <- isoCountriesEUR +cfg$gms$policy_countries30 <- isoCountriesEUR + +cfg$gms$s29_treecover_penalty <- 5000 +cfg$gms$s30_betr_penalty <- 5000 + +for (pol in c("NDC","1p5deg")) { + for (diet in c("dietDefault","dietShift")) { + for (AFS in c("SRC","treeCover")) { + for (shr in c(0, 0.01, 0.05, 0.1, 0.2)) { + cfg$title <- .title(cfg, paste(ssp,pol,diet,paste0(AFS,sprintf("%02d",shr*100)),sep="-")) + if (pol == "NDC") { + cfg <- setScenario(cfg,c(ssp,"NDC","rcp4p5")) + cfg$input['cellular'] <- "rev4.109_36f73207_30c9dc61_cellularmagpie_c400_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1_clusterweight-ba4466a8.tgz" + cfg$gms$c56_mute_ghgprices_until <- "y2150" + cfg$gms$c56_pollutant_prices <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-NDC") + cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-NDC") + } else if (pol == "1p5deg") { + cfg <- setScenario(cfg,c(ssp,"NDC","rcp1p9")) + cfg$input['cellular'] <- "rev4.109_36f73207_bc624950_cellularmagpie_c400_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1_clusterweight-ba4466a8.tgz" + cfg$gms$c56_mute_ghgprices_until <- "y2030" + cfg$gms$c56_pollutant_prices <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-PkBudg650") + cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-PkBudg650") + } + if (diet == "dietShift") cfg <- setScenario(cfg,"eat_lancet_diet") + if (AFS == "SRC") { + cfg$gms$s29_treecover_target <- 0 + cfg$gms$s30_betr_target <- shr + } else if (AFS == "treeCover") { + cfg$gms$s29_treecover_target <- shr + cfg$gms$s30_betr_target <- 0 + } + start_run(cfg, codeCheck = FALSE) + } + } + } +} diff --git a/scripts/start/projects/project_EAT2p0.R b/scripts/start/projects/project_EAT2p0.R index 901aaa42d3..1c4aadc720 100644 --- a/scripts/start/projects/project_EAT2p0.R +++ b/scripts/start/projects/project_EAT2p0.R @@ -33,9 +33,9 @@ cfg$output <- c("output_check", "extra/disaggregation", # "projects/FSEC_nitrogenPollution", # do manually on last (high-res) magpie run # "projects/FSEC_water", # do manually on last (high-res) magpie run - "agmip_report", # add output file: pb_report (magpie (special mif created by getReportPBindicators & remind mif (REMIND_generic_scenName.mif)) - "rds_report") + "rds_report", + "projects/agmip_report") ####################### # SCENARIO DEFINITION # @@ -82,16 +82,19 @@ bau <- function(cfg) { cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-NPi" # default # Climate Change - cfg$input['cellular'] <- "rev4.99_h12_c6a7458f_cellularmagpie_c200_IPSL-CM6A-LR-ssp370_lpjml-8e6c5eb1.tgz" - + cfg$input['cellular'] <- "rev4.109_h12_c6a7458f_cellularmagpie_c200_IPSL-CM6A-LR-ssp370_lpjml-8e6c5eb1.tgz" + return(cfg) } ### Diet component ## # Globally achieves EL2 diet by 2050 diet <- function(cfg) { + # Transition towards EL2 food intake recommendations until 2050 cfg$gms$s15_exo_diet <- 3 - + # Physical inactivity levels are reduced to 0 from 2020 to 2050 + cfg$gms$c09_pal_scenario <- "SDP" + return(cfg) } @@ -129,27 +132,15 @@ waste <- function(cfg) { # where miti is active. # Reference: Humpenöder, F., Popp, A., Merfort, L., Luderer, G., Weindl, I., Bodirsky, B., Stevanović, M., Klein, D., Rodrigues, R., Bauer, N., Dietrich, J., Lotze-Campen, H., & Rockström, J. (2023). Data repository - Dietary shifts increase the feasibility of 1.5°C pathways (Version 1) [Data set]. Zenodo. https://doi.org/10.5281/zenodo.8328217 miti <- function(cfg) { - # NDCs - cfg <- setScenario(cfg, c("SSP2", "NDC")) - # Mitigation: consistent with 1.5C considering diet change - cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive/remind/output/C_SSP2EU-DSPkB500-noDS-rem-5/REMIND_generic_C_SSP2EU-DSPkB500-noDS-rem-5.mif" + cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_default/remind/output/C_SSP2EU-DSPkB650-DS_betax_AgMIP-rem-5/REMIND_generic_C_SSP2EU-DSPkB500-noDS-rem-5.mif" cfg$gms$c56_pollutant_prices <- "coupling" - cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive/remind/output/C_SSP2EU-DSPkB500-noDS-rem-5/REMIND_generic_C_SSP2EU-DSPkB500-noDS-rem-5.mif" + cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_default/remind/output/C_SSP2EU-DSPkB650-DS_betax_AgMIP-rem-5/REMIND_generic_C_SSP2EU-DSPkB500-noDS-rem-5.mif" cfg$gms$c60_2ndgen_biodem <- "coupling" return(cfg) } -### NoCC component ## -# No climate change impacts -noCC <- function(cfg) { - # deactivate climate change impacts - cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI")) - - return(cfg) -} - ### RCP 2.6 ### # Decomposition Scenario. Apply lower climate impacts based on RCP 2.6 to BAU using GFDL climate model. rcp26 <- function(cfg) { @@ -165,6 +156,9 @@ rcp26 <- function(cfg) { # Business as usual scenario based on SSP2 # with a higher climate impact reflected by RCP 7.0 cfg$title <- "BAU" +# standard setting +cfg <- setScenario(cfg, c("cc", "SSP2", "NPI")) +# scenario settings cfg <- bau(cfg = cfg) start_run(cfg, codeCheck = FALSE) @@ -172,6 +166,9 @@ start_run(cfg, codeCheck = FALSE) # Decomposition scenario. Adds EL2.0 Diet to BAU: # Globally achieves EL2 diet by 2050 # To Do: Check implemention! cfg$title <- "BAU_DIET" +# standard setting +cfg <- setScenario(cfg, c("cc", "SSP2", "NPI")) +# scenario settings cfg <- bau(cfg = cfg) cfg <- diet(cfg = cfg) start_run(cfg, codeCheck = FALSE) @@ -179,6 +176,9 @@ start_run(cfg, codeCheck = FALSE) # BAU_PROD # # Decomposition scenario adds high productivity to BAU cfg$title <- "BAU_PROD" +# standard setting +cfg <- setScenario(cfg, c("cc", "SSP2", "NPI")) +# scenario settings cfg <- bau(cfg = cfg) cfg <- prod(cfg = cfg) start_run(cfg, codeCheck = FALSE) @@ -186,6 +186,9 @@ start_run(cfg, codeCheck = FALSE) # BAU_WAST # # Decomposition scenario. Adds a reduction (halving) of food loss and waste cfg$title <- "BAU_WAST" +# standard setting +cfg <- setScenario(cfg, c("cc", "SSP2", "NPI")) +# scenario settings cfg <- bau(cfg = cfg) cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) @@ -193,6 +196,9 @@ start_run(cfg, codeCheck = FALSE) # BAU_RCP26 # # Decomposition Scenario. Apply lower climate impacts based on RCP 2.6 to BAU cfg$title <- "BAU_RCP26" +# standard setting +cfg <- setScenario(cfg, c("cc", "SSP2", "NPI")) +# scenario settings cfg <- bau(cfg = cfg) cfg <- rcp26(cfg = cfg) start_run(cfg, codeCheck = FALSE) @@ -200,13 +206,18 @@ start_run(cfg, codeCheck = FALSE) # BAU_NoCC # # Decomposition scenario. Remove climate impacts (NoCC) from BAU to isolate climate effects cfg$title <- "BAU_NoCC" +# standard setting, but without CC +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI")) +# scenario settings cfg <- bau(cfg = cfg) -cfg <- noCC(cfg = cfg) start_run(cfg, codeCheck = FALSE) # BAU_MITI # # Decomposition Scenario. Adds mitigation and land-use policies consistent with 1.5C by 2050 to BAU cfg$title <- "BAU_MITI" +# standard setting, but with NDC activated (for miti) +cfg <- setScenario(cfg, c("cc", "SSP2", "NDC")) +# scenario settings cfg <- bau(cfg = cfg) cfg <- miti(cfg = cfg) start_run(cfg, codeCheck = FALSE) @@ -214,6 +225,9 @@ start_run(cfg, codeCheck = FALSE) # EL2 # # Full EAT-Lancet Scenario (diet, productivity, FLW) without mitigation and higher climate impacts based on RCP 7.0 cfg$title <- "EL2" +# standard setting +cfg <- setScenario(cfg, c("cc", "SSP2", "NPI")) +# scenario settings cfg <- bau(cfg = cfg) cfg <- diet(cfg = cfg) cfg <- prod(cfg = cfg) @@ -223,68 +237,88 @@ start_run(cfg, codeCheck = FALSE) # ELM # # Full EAT-Lancet scenario (diet, productivity, FLW) with mitigation policies consistent with 1.5C. Climate based on a lower climate impacts with RCP 2.6 cfg$title <- "ELM" +# standard setting, but with NDC activated (for miti) +cfg <- setScenario(cfg, c("cc", "SSP2", "NDC")) +# scenario settings cfg <- bau(cfg = cfg) +cfg <- miti(cfg = cfg) cfg <- diet(cfg = cfg) cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) -cfg <- miti(cfg = cfg) cfg <- rcp26(cfg = cfg) start_run(cfg, codeCheck = FALSE) # ELM_Diet # # Decomposition Scenario. Removes Diet from ELM cfg$title <- "ELM_DIET" +# standard setting, but with NDC activated (for miti) +cfg <- setScenario(cfg, c("cc", "SSP2", "NDC")) +# scenario settings cfg <- bau(cfg = cfg) +cfg <- miti(cfg = cfg) cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) -cfg <- miti(cfg = cfg) cfg <- rcp26(cfg = cfg) start_run(cfg, codeCheck = FALSE) # ELM_PROD # # Decomposition Scenario. Removed productivity trend from ELM cfg$title <- "ELM_PROD" +# standard setting, but with NDC activated (for miti) +cfg <- setScenario(cfg, c("cc", "SSP2", "NDC")) +# scenario settings cfg <- bau(cfg = cfg) +cfg <- miti(cfg = cfg) cfg <- diet(cfg = cfg) cfg <- waste(cfg = cfg) -cfg <- miti(cfg = cfg) cfg <- rcp26(cfg = cfg) start_run(cfg, codeCheck = FALSE) # ELM_WAST # # Decomposition Scenario. Removes FLW from ELM cfg$title <- "ELM_WAST" +# standard setting, but with NDC activated (for miti) +cfg <- setScenario(cfg, c("cc", "SSP2", "NDC")) +# scenario settings cfg <- bau(cfg = cfg) +cfg <- miti(cfg = cfg) cfg <- diet(cfg = cfg) cfg <- prod(cfg = cfg) -cfg <- miti(cfg = cfg) cfg <- rcp26(cfg = cfg) start_run(cfg, codeCheck = FALSE) # ELM_RCP70 # # Decomposition Scenario. Applies RCP 7.0 climate impacts to ELM cfg$title <- "ELM_RCP70" +# standard setting, but with NDC activated (for miti) +cfg <- setScenario(cfg, c("cc", "SSP2", "NDC")) +# scenario settings cfg <- bau(cfg = cfg) +cfg <- miti(cfg = cfg) cfg <- diet(cfg = cfg) cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) -cfg <- miti(cfg = cfg) start_run(cfg, codeCheck = FALSE) # ELM_NoCC # # Decomposition Scenario. Removes climate impacts (NoCC) from ELM cfg$title <- "ELM_NoCC" +# standard setting, but with NDC activated (for miti) and without CC +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC")) +# scenario settings cfg <- bau(cfg = cfg) +cfg <- miti(cfg = cfg) cfg <- diet(cfg = cfg) cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) -cfg <- miti(cfg = cfg) -cfg <- noCC(cfg = cfg) start_run(cfg, codeCheck = FALSE) # ELM_MITI # # Decomposition Scenario. Removes climate mitigation and LUC policies from ELM cfg$title <- "ELM_MITI" +# standard setting, but with NDC activated (for miti) +cfg <- setScenario(cfg, c("cc", "SSP2", "NDC")) +# scenario settings cfg <- bau(cfg = cfg) cfg <- diet(cfg = cfg) cfg <- prod(cfg = cfg) diff --git a/scripts/start/projects/project_EAT2p0_DeepDive.R b/scripts/start/projects/project_EAT2p0_DeepDive.R index bebf4dae73..e12c14a980 100644 --- a/scripts/start/projects/project_EAT2p0_DeepDive.R +++ b/scripts/start/projects/project_EAT2p0_DeepDive.R @@ -28,15 +28,22 @@ cfg$force_download <- TRUE # Special outputs required for Deep Dive cfg$qos <- "standby_maxMem_dayMax" -cfg$output <- c("output_check", - "extra/highres", - "extra/disaggregation", - "projects/FSEC_nitrogenPollution", - "projects/FSEC_water", - "agmip_report", - "runBlackmagicc", - # add output file: pb_report (magpie (special mif created by getReportPBindicators & remind mif (REMIND_generic_scenName.mif)) - "rds_report") +cfg$output <- c( + "output_check", + "extra/highres", + "extra/disaggregation", + "projects/FSEC_nitrogenPollution", + "projects/FSEC_water", + "projects/agmip_report", + "rds_report", + "runBlackmagicc" + # add output file: pb_report (magpie (special mif created by getReportPBindicators & remind mif (REMIND_generic_scenName.mif)) + +) + +# Set path to own coupled runs: +path2NPIrun <- "/p/projects/magpie/users/beier/EL2_DeepDive_default/remind/output/C_SSP2EU-NPi-rem-5/REMIND_generic_C_SSP2EU-NPi-rem-5.mif" +path2MitigationRun <- "/p/projects/magpie/users/beier/EL2_DeepDive_default/remind/output/C_SSP2EU-DSPkB650-DS_betax_DeepDive_noNDC-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_DeepDive_noNDC-rem-5.mif" ####################### # SCENARIO DEFINITION # @@ -56,44 +63,39 @@ cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) # RCP/GCM: 7p0 shocks on crops, livestock, labor # Trade: BAU bau <- function(cfg) { - ### Components for Decomposition ### # Diets: exogenous EATLancet diet - cfg$gms$s15_exo_diet <- 0 # default + cfg$gms$s15_exo_diet <- 0 # default cfg$gms$c15_kcal_scen <- "healthy_BMI" # default (but not active b/c of s15_exo_diet = 0) - cfg$gms$c15_EAT_scen <- "FLX" # default (but not active b/c of s15_exo_diet = 0) + cfg$gms$c15_EAT_scen <- "FLX" # default (but not active b/c of s15_exo_diet = 0) # Waste: half food waste - cfg$gms$s15_exo_waste <- 0 # default - cfg$gms$s15_waste_scen <- 1.2 # default (but not active b/c of s15_exo_waste = 0) + cfg$gms$s15_exo_waste <- 0 # default + cfg$gms$s15_waste_scen <- 1.2 # default (but not active b/c of s15_exo_waste = 0) # Default interest rate (for default productivity) - cfg$gms$s12_interest_lic <- 0.1 # default - cfg$gms$s12_interest_hic <- 0.04 # default + cfg$gms$s12_interest_lic <- 0.1 # default + cfg$gms$s12_interest_hic <- 0.04 # default # Default livestock productivity - cfg$gms$c70_feed_scen <- "ssp2" # default - # Mitigation: no mitigation beyond NDC (NDC set in setScenario) - cfg$gms$c56_emis_policy <- "none" - cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive/remind/output/C_SSP2EU-DSPkB500-noDS_betax-rem-5/REMIND_generic_C_SSP2EU-DSPkB500-noDS_betax-rem-5.mif" - cfg$gms$c56_pollutant_prices <- "none" - cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive/remind/output/C_SSP2EU-DSPkB500-noDS_betax-rem-5/REMIND_generic_C_SSP2EU-DSPkB500-noDS_betax-rem-5.mif" - cfg$gms$c60_2ndgen_biodem <- "none" - - ### Deactivate certain sustainability standard settings - # bioenergy plantations can be irrigated - cfg$gms$c30_bioen_water <- "all" - # forest plantations allowed for afforestation under ghg price - cfg$gms$s32_aff_plantation <- 1 + cfg$gms$c70_feed_scen <- "ssp2" # default + # Mitigation: no mitigation beyond NPi + cfg$gms$c56_emis_policy <- "none" + cfg$path_to_report_ghgprices <- path2NPIrun + cfg$gms$c56_pollutant_prices <- "coupling" + cfg$path_to_report_bioenergy <- path2NPIrun + cfg$gms$c60_2ndgen_biodem <- "coupling" # Setting REMIND scenario for blackmagicc - cfg$magicc_emis_scen <- "SSP2EU-DSPkB500-DS_betax" - + cfg$magicc_emis_scen <- "REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_DeepDive_noNDC-rem-5.mif" + return(cfg) } ### Diet component ## # Globally achieves EL2 diet by 2050 diet <- function(cfg) { - cfg$gms$s15_exo_diet <- 3 - + # Transition towards EL2 food intake recommendations until 2050 + cfg$gms$s15_exo_diet <- 3 + # Physical inactivity levels are reduced to 0 from 2020 to 2050 + cfg$gms$c09_pal_scenario <- "SDP" return(cfg) } @@ -114,7 +116,7 @@ prod <- function(cfg) { # Reduction (halving) of food loss and waste waste <- function(cfg) { # Waste: half food waste - cfg$gms$s15_exo_waste <- 1 + cfg$gms$s15_exo_waste <- 1 cfg$gms$s15_waste_scen <- 1.2 return(cfg) } @@ -125,49 +127,42 @@ waste <- function(cfg) { # We use a GHG pricing pathway based on a peak budget of 500 with overshoot # starting from 2020 and diet shift. miti <- function(cfg) { - # NDCs - cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC")) - # Mitigation: consistent with 1.5C considering Diet change + cfg$path_to_report_ghgprices <- path2MitigationRun cfg$gms$c56_pollutant_prices <- "coupling" - cfg$gms$c60_2ndgen_biodem <- "coupling" - cfg$gms$c56_emis_policy <- "ecoSysProtAll" + cfg$path_to_report_bioenergy <- path2MitigationRun + cfg$gms$c60_2ndgen_biodem <- "coupling" + # ecoSysProtAll: (Above ground CO2 emis from LUC in forest, forestry, natveg; All types of emis from peatland; All CH4 and N2O emis), + cfg$gms$c56_emis_policy <- "ecoSysProtAll" return(cfg) } # Bioenergy demand only. No carbon price on land included. bioenergy <- function(cfg) { - # NDCs - cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC")) - - # No ghg pricing in land system - # Bioenergy demand from coupled REMIND-MAgPIE run where 1.5 is reached with ghg prices on land and considering diet shift - cfg$gms$c60_2ndgen_biodem <- "coupling" + # Mitigation: only Bioenergy demand from coupled REMIND-MAgPIE run where 1.5 is reached with ghg prices on land and considering diet shift + cfg$path_to_report_bioenergy <- path2MitigationRun + cfg$gms$c60_2ndgen_biodem <- "coupling" return(cfg) } # CO2 from land use change is priced. priceCO2 <- function(cfg) { - # NDCs - cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC")) - - # Mitigation: consistent with 1.5C considering Diet change + # Mitigation: only price land CO2 cfg$gms$c56_pollutant_prices <- "coupling" - cfg$gms$c56_emis_policy <- "ecoSysProtAll" + cfg$path_to_report_ghgprices <- path2MitigationRun + cfg$gms$c56_emis_policy <- "ecoSysProtAll_agMgmtOff" #### double-check Florian or Leon return(cfg) } # Pricing of all CH4 and N2O emissions except for peatland priceNonCO2 <- function(cfg) { - # NDCs - cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC")) - - # Mitigation: consistent with 1.5C considering Diet change + # Mitigation: only CH4 and N2O price cfg$gms$c56_pollutant_prices <- "coupling" - cfg$gms$c56_emis_policy <- "ecoSysProtAll_agMgmtOff" + cfg$path_to_report_ghgprices <- path2MitigationRun + cfg$gms$c56_emis_policy <- "ecoSysProtOff" ### double-check Florian or Leon return(cfg) } @@ -177,37 +172,29 @@ priceNonCO2 <- function(cfg) { # SCENARIO RUNS # ################# # BAU # -# Business as usual scenario based on SSP2 +# Business as usual scenario based on SSP2 (NPis) cfg$title <- "BAU_NPi" cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) cfg <- bau(cfg = cfg) start_run(cfg, codeCheck = FALSE) -cfg$title <- "BAU_NDC" -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) -cfg <- bau(cfg = cfg) -start_run(cfg, codeCheck = FALSE) - -# BAU + EL2-Diet # -# Decomposition scenario. -# Globally achieves EL2 (Diet+Waste+Prod) by 2050 -cfg$title <- "BAU_Diet" +# (1b) BAU + Bioenergy # +# Decomposition Scenario. Adds bioenergy demand from coupled run with land-use policies consistent with 1.5C by 2050 to BAU +cfg$title <- "BAU_Bioenergy" cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) cfg <- bau(cfg = cfg) -cfg <- diet(cfg = cfg) -cfg <- prod(cfg = cfg) -cfg <- waste(cfg = cfg) +cfg <- bioenergy(cfg = cfg) start_run(cfg, codeCheck = FALSE) -# BAU + Bioenergy # -# Decomposition Scenario. Adds bioenergy demand from coupled run with land-use policies consistent with 1.5C by 2050 to BAU -cfg$title <- "BAU_Bioenergy" +# (1c) BAU + NonCO2 pricing in land sector # +# Decomposition Scenario. Adds non-CO2 pricing with ghg price from coupled run with land-use policies consistent with 1.5C by 2050 to BAU +cfg$title <- "BAU_NonCO2" cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) cfg <- bau(cfg = cfg) -cfg <- bioenergy(cfg = cfg) +cfg <- priceNonCO2(cfg = cfg) start_run(cfg, codeCheck = FALSE) -# BAU + pricing of CO2 in land sector # +# (1d) BAU + pricing of CO2 in land sector # # Decomposition Scenario. Adds CO2 pricing on land-use change emissions with ghg price from coupled run with land-use policies consistent with 1.5C by 2050 to BAU cfg$title <- "BAU_CO2" cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) @@ -215,75 +202,258 @@ cfg <- bau(cfg = cfg) cfg <- priceCO2(cfg = cfg) start_run(cfg, codeCheck = FALSE) -# BAU + NonCO2 pricing in land sector # -# Decomposition Scenario. Adds non-CO2 pricing with ghg price from coupled run with land-use policies consistent with 1.5C by 2050 to BAU -cfg$title <- "BAU_NonCO2" +# (1a,b,c,d) BAU_MIT # +# All production-side land-based mitigation measures +cfg$title <- "BAU_Miti" +# standard setting, but with NDC for miti cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +# BAU settings cfg <- bau(cfg = cfg) -cfg <- priceNonCO2(cfg = cfg) +# Mitigation (CO2, non-CO2, bioenergy) +cfg <- miti(cfg = cfg) start_run(cfg, codeCheck = FALSE) -# MITI_Diet (mitigation - PHD) # -# All production-side land-based mitigation measures, but no demand-side mitigation (diet change) -cfg$title <- "MITI_Diet" -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +# BAU_MITI - bioenergy # +# (1e) CO2 and non-CO2 pricing, but no bioenergy demand from REMIND +cfg$title <- "BAUMITI_Bioenergy" +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +# BAU settings +cfg <- bau(cfg = cfg) +# Mitigation +cfg <- miti(cfg = cfg) +cfg$gms$c60_2ndgen_biodem <- "coupling" +cfg$path_to_report_bioenergy <- path2NPIrun +start_run(cfg, codeCheck = FALSE) + +# BAU_MITI - non-CO2 # +# (1f) CO2 pricing and bioenergy demand from REMIND, but no non-CO2 pricing in land-system +cfg$title <- "BAUMITI_nonCO2" +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +# BAU settings cfg <- bau(cfg = cfg) -# Mititgation +# Mitigation cfg <- miti(cfg = cfg) +# 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 <- "ecoSysProtAll_agMgmtOff" +start_run(cfg, codeCheck = FALSE) + +# MITI_CO2 (mitigation - CO2) # +# (1g) non-CO2 pricing and bioenergy demand from REMIND, but no CO2 pricing in land-system +cfg$title <- "BAUMITI_CO2" +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +# BAU settings +cfg <- bau(cfg = cfg) +# Mitigation +cfg <- miti(cfg = cfg) +# ecoSysProtOff: (All CH4 and N2O emis except peatland), +cfg$gms$c56_emis_policy <- "ecoSysProtOff" +start_run(cfg, codeCheck = FALSE) + + +# BAU + EL2-Diet # +# PHD components: +# (1e) Productivity +#cfg$title <- "BAU_Prod" +#cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +#cfg <- bau(cfg = cfg) +#cfg <- prod(cfg = cfg) +#start_run(cfg, codeCheck = FALSE) + +# (1f) Waste +cfg$title <- "BAU_Waste" +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +cfg <- bau(cfg = cfg) +cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) +# (1g) Diet change +cfg$title <- "BAU_Diet" +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +cfg <- bau(cfg = cfg) +cfg <- diet(cfg = cfg) +start_run(cfg, codeCheck = FALSE) + +# (1e,f,g) Demand-side options (Diet+Waste) by 2050 +cfg$title <- "BAU_Dem" +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +cfg <- bau(cfg = cfg) +cfg <- diet(cfg = cfg) +#cfg <- prod(cfg = cfg) +cfg <- waste(cfg = cfg) +start_run(cfg, codeCheck = FALSE) + + +### Single measure Decomposition ### +# (2a) MITI_NDC # +# All production-side land-based mitigation measures and demand-side mitigation (diet change), but no NDCs +#cfg$title <- "MITI_NDC" +# standard setting, but with NDC for miti +#cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +# BAU settings +#cfg <- bau(cfg = cfg) +# Mitigation (CO2, non-CO2, bioenergy) +#cfg <- miti(cfg = cfg) +# PHD (diet, prod, waste) +#cfg <- diet(cfg = cfg) +#cfg <- prod(cfg = cfg) +#cfg <- waste(cfg = cfg) +#start_run(cfg, codeCheck = FALSE) + # MITI_Bioenergy (mitigation - bioenergy) # -# CO2 and non-CO2 pricing and demand-side mitigation (diet change), but no bioenergy demand from REMIND +# (2b) CO2 and non-CO2 pricing and demand-side mitigation (diet change), but no bioenergy demand from REMIND cfg$title <- "MITI_Bioenergy" -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +# BAU settings +cfg <- bau(cfg = cfg) +# Mitigation +cfg <- miti(cfg = cfg) +cfg$gms$c60_2ndgen_biodem <- "coupling" +cfg$path_to_report_bioenergy <- path2NPIrun +# PHD +cfg <- diet(cfg = cfg) +#cfg <- prod(cfg = cfg) +cfg <- waste(cfg = cfg) +start_run(cfg, codeCheck = FALSE) + +# MITI_nonCO2 (mitigation - non-CO2) # +# (2c) CO2 pricing and bioenergy demand from REMIND and demand-side mitigation (diet change), but no non-CO2 pricing in land-system +cfg$title <- "MITI_nonCO2" +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +# BAU settings cfg <- bau(cfg = cfg) -# Mititgation +# Mitigation cfg <- miti(cfg = cfg) -cfg$gms$c60_2ndgen_biodem <- "none" +# 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 <- "ecoSysProtAll_agMgmtOff" # PHD cfg <- diet(cfg = cfg) -cfg <- prod(cfg = cfg) +#cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) # MITI_CO2 (mitigation - CO2) # -# non-CO2 pricing and bioenergy demand from REMIND and demand-side mitigation (diet change), but no CO2 pricing in land-system +# (2d) non-CO2 pricing and bioenergy demand from REMIND and demand-side mitigation (diet change), but no CO2 pricing in land-system cfg$title <- "MITI_CO2" -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +# BAU settings cfg <- bau(cfg = cfg) -# Mititgation +# Mitigation cfg <- miti(cfg = cfg) -cfg$gms$c56_emis_policy <- "ecoSysProtAll_agMgmtOff" +# ecoSysProtOff: (All CH4 and N2O emis except peatland), +cfg$gms$c56_emis_policy <- "ecoSysProtOff" # PHD cfg <- diet(cfg = cfg) -cfg <- prod(cfg = cfg) +#cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) -# MITI_nonCO2 (mitigation - non-CO2) # -# CO2 pricing and bioenergy demand from REMIND and demand-side mitigation (diet change), but no non-CO2 pricing in land-system -cfg$title <- "MITI_nonCO2" -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +# MITI_MITI # +# (2a,b,c,d) All demand-side mitigation (PHD, but no other miti measures) +cfg$title <- "MITI_Miti" +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +# BAU settings cfg <- bau(cfg = cfg) -# Mititgation +# PHD (diet, prod, waste) +cfg <- diet(cfg = cfg) +#cfg <- prod(cfg = cfg) +cfg <- waste(cfg = cfg) +start_run(cfg, codeCheck = FALSE) + +# MITI_Waste # +# (2f) All production-side land-based mitigation measures and demand-side mitigation without Waste +cfg$title <- "MITI_Waste" +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +# BAU settings +cfg <- bau(cfg = cfg) +# Mitigation (CO2, non-CO2, bioenergy) cfg <- miti(cfg = cfg) -cfg$gms$c56_emis_policy <- "ecoSysProtAll" -# PHD +# PHD (diet, prod, waste) +cfg <- diet(cfg = cfg) +#cfg <- prod(cfg = cfg) +start_run(cfg, codeCheck = FALSE) + +# MITI_Diet # +# (2g) All production-side land-based mitigation measures and demand-side mitigation without Diet +cfg$title <- "MITI_Diet" +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +# BAU settings +cfg <- bau(cfg = cfg) +# Mitigation (CO2, non-CO2, bioenergy) +cfg <- miti(cfg = cfg) +# PHD (diet, prod, waste) +#cfg <- prod(cfg = cfg) +cfg <- waste(cfg = cfg) +start_run(cfg, codeCheck = FALSE) + +# MITI_PHD (mitigation - PHD) # +# (2e,f,g) All production-side land-based mitigation measures, but no demand-side mitigation +cfg$title <- "MITI_Dem" +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +# BAU settings +cfg <- bau(cfg = cfg) +# Mitigation +cfg <- miti(cfg = cfg) +start_run(cfg, codeCheck = FALSE) + +### Combining demand-side changes with single mitigation measures ### +# (3b) Demand-side change + Bioenergy # +# Decomposition Scenario with demand-side changes. Adds bioenergy demand from coupled run with land-use policies consistent with 1.5C by 2050 to BAU +cfg$title <- "DEM_Bioenergy" +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +cfg <- bau(cfg = cfg) +cfg <- bioenergy(cfg = cfg) +# Demand-side change (diet, waste) cfg <- diet(cfg = cfg) -cfg <- prod(cfg = cfg) +# cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) +# (3c) Demand-side + NonCO2 pricing in land sector # +# Decomposition Scenario with demand-side changes. Adds non-CO2 pricing with ghg price from coupled run with land-use policies consistent with 1.5C by 2050 to BAU +cfg$title <- "DEM_NonCO2" +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +cfg <- bau(cfg = cfg) +cfg <- priceNonCO2(cfg = cfg) +# Demand-side change (diet, waste) +cfg <- diet(cfg = cfg) +# cfg <- prod(cfg = cfg) +cfg <- waste(cfg = cfg) +start_run(cfg, codeCheck = FALSE) -# MITI_Full # +# (3d) Demand-side + pricing of CO2 in land sector # +# Decomposition Scenario with demand-side changes. Adds CO2 pricing on land-use change emissions with ghg price from coupled run with land-use policies consistent with 1.5C by 2050 to BAU +cfg$title <- "DEM_CO2" +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +cfg <- bau(cfg = cfg) +cfg <- priceCO2(cfg = cfg) +# Demand-side change (diet, waste) +cfg <- diet(cfg = cfg) +# cfg <- prod(cfg = cfg) +cfg <- waste(cfg = cfg) +start_run(cfg, codeCheck = FALSE) + +### All measures ### +# MITI_All # # All production-side land-based mitigation measures and demand-side mitigation (diet change) -cfg$title <- "MITI_Full" -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +cfg$title <- "MITI_All" +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +# BAU settings cfg <- bau(cfg = cfg) -# Mititgation +# Mitigation (CO2, non-CO2, bioenergy) cfg <- miti(cfg = cfg) -# PHD +# PHD (diet, prod, waste) cfg <- diet(cfg = cfg) -cfg <- prod(cfg = cfg) +#cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) diff --git a/scripts/start/test_runs.R b/scripts/start/test_runs.R index e30a77ab08..334a514ffb 100644 --- a/scripts/start/test_runs.R +++ b/scripts/start/test_runs.R @@ -26,7 +26,6 @@ download_and_update(cfg) # 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 diff --git a/scripts/start_functions.R b/scripts/start_functions.R index 2a0872fd38..1ce4a2f9c5 100644 --- a/scripts/start_functions.R +++ b/scripts/start_functions.R @@ -521,7 +521,7 @@ start_run <- function(cfg, scenario = NULL, codeCheck = TRUE, lock_model = TRUE) cfg$qos <- "standby" } else if(all(load > 80)) { cfg$qos <- "priority" - } else if(load["priority"] < load["standard"]) { + } else if(all(c("priority", "standard") %in% names(load)) && load["priority"] < load["standard"]) { cfg$qos <- "standby" } else { cfg$qos <- "short" diff --git a/start.R b/start.R index 79771dc14c..bb80b4c220 100644 --- a/start.R +++ b/start.R @@ -31,99 +31,62 @@ if (!is.null(renv::project())) { library(lucode2) library(gms) +source("scripts/helper.R") runOutputs <- function(runscripts=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 priority", - "SLURM standby", - "SLURM medium", - "Direct execution", - "Background execution", - "Debug mode") - if(slurm) { - cat("\nCurrent cluster utilization:\n") - system("sclass") - cat("\n") - } else { - modes <- grep("SLURM",modes,invert=TRUE,value=TRUE) - } - cat("\n",title,":\n", sep="") - cat(paste(seq_along(modes), modes, sep=": " ),sep="\n") - cat("Number: ") - identifier <- gms::getLine() - identifier <- as.numeric(strsplit(identifier,",")[[1]]) - if(slurm) { - comp <- switch(identifier, - "1" = "slurmpriority", - "2" = "slurmstandby", - "3" = "slurmmedium", - "4" = "direct", - "5" = "background", - "6" = "debug") - } else { - comp <- switch(identifier, - "1" = "direct", - "2" = "background", - "3" = "debug") - } - if(is.null(comp)) stop("This type is invalid. Please choose a valid type") - return(comp) - } - runsubmit <- function(runscripts, submit) { + runSubmit <- function(runscripts, submit, + slurmModes="scripts/slurmStart.yml") { if(!dir.exists("logs")) dir.create("logs") for(rout in runscripts){ - name <- paste0("./scripts/start/",rout) - if(!file.exists(name)) { - name2 <- paste0(name,".R") - if(!file.exists(name2)) { - warning("Script ",name2, " could not be found. Skip execution!") + script <- paste0("./scripts/start/",rout) + if(!file.exists(script)) { + script <- paste0(script,".R") + if(!file.exists(script)) { + warning("Script ",script, " could not be found. Skip execution!") next } - name <- name2 } - cat("Executing",name,"\n") - rout_name <- sub("\\.R$","",sub("/","_",rout)) - sbatch_command <- paste0("sbatch --job-name=",rout_name," --output=logs/",rout_name,"-%j.out --mail-type=END --wrap=\"Rscript ",name,"\"") - if(submit=="direct") { + cat("Executing",script,"\n") + name <- sub("\\.R$","",sub("/","_",rout)) + if(submit %in% c("Direct execution", "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!") + tmp.error <- try(sys.source(script, envir=tmp.env)) + if(!is.null(tmp.error)) warning("Script ",script," was stopped by an error and not executed properly!") rm(tmp.env) - } else if(submit=="background") { - 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 --cpus-per-task=3")) - Sys.sleep(1) - } else if(submit=="slurmstandby") { - system(paste(sbatch_command,"--qos=standby --cpus-per-task=3")) - Sys.sleep(1) - } else if(submit=="slurmmedium") { - system(paste(sbatch_command,"--qos=medium --cpus-per-task=3")) - Sys.sleep(1) - } else if(submit=="debug") { + } else if(submit %in% c("Background execution", "background")) { + log <- format(Sys.time(), paste0("logs/", name, "-%Y-%H-%M-%S-%OS3.log")) + system2("Rscript",script, stderr = log, stdout = log, wait=FALSE) + } else if(submit %in% c("Debug mode", "debug")) { tmp.env <- new.env() - sys.source(name,envir=tmp.env) + sys.source(script,envir=tmp.env) rm(tmp.env) } else { - stop("Unknown submission type") + slurmModes <- yaml::read_yaml(slurmModes)$slurmjobs + if(submit %in% names(slurmModes)) { + command <- slurmModes[submit] + command <- gsub("%NAME", name, command) + command <- gsub("%SCRIPT", script, command) + message(command) + system(command) + Sys.sleep(1) + } else { + stop("Unknown submission type") + } } } } - - if(is.null(runscripts)) runscripts <- gms::selectScript("./scripts/start") if(is.null(runscripts)) { message("No start script selected! Stop here.") return(invisible(NULL)) } - if(is.null(submit)) submit <- choose_submit("Choose submission type") - runsubmit(runscripts, submit) + if(is.null(submit)) submit <- chooseSubmit("Choose submission type", + slurmModes = "scripts/slurmStart.yml") + runSubmit(runscripts, submit) } @@ -131,5 +94,5 @@ system("git config core.hooksPath .githooks") submit <- NULL runscripts <- NULL -lucode2::readArgs("runscripts","submit", .silent=TRUE) -runOutputs(runscripts=runscripts, submit=submit) +lucode2::readArgs("runscripts", "submit", .silent = TRUE) +runOutputs(runscripts = runscripts, submit = submit)