diff --git a/config/default.cfg b/config/default.cfg index d282609a5a..f6491e547e 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -22,11 +22,11 @@ cfg$model <- "main.gms" # def = "main.gms" #### input settings #### # which input data sets should be used? -cfg$input <- c(regional = "rev4.132_h12_magpie.tgz", - cellular = "rev4.132_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz", - validation = "rev4.132_h12_92e02314_validation.tgz", - additional = "additional_data_rev4.67.tgz", - calibration = "calibration_H12_FAO_01Apr26.tgz") +cfg$input <- c(regional = "rev4.131l2m_v5-10-0m2_may2026+BEdata2_h12_magpie.tgz", + cellular = "rev4.131l2m_v5-10-0m2_may2026+BEdata2_h12_00e02813_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-a0c283bd.tgz", + validation = "rev4.131l2m_v5-10-0m2_may2026+BEdata2_h12_92e02314_validation.tgz", + additional = "additional_data_rev4.65.tgz", + calibration = "calibration_H12_FAO_01Apr26.tgz") # NOTE: It is recommended to recalibrate the model when changing cellular input data # as well as for any other setting that would affect initial values in the model, @@ -287,9 +287,10 @@ cfg$gms$s12_hist_interest_hic_noselect <- "0.04" # def = 0.04 # ***--------------------- 13_tc ----------------------------------------- # * (endo_jan22): endogenous technological change with full cost accounting and # * stepwise updated crop and managed pastures area information -# * (exo): exogenous technological change (removes non-linearities from the model); -# * requires an existing model run with endo tc for generating the input file -# * f13_tau_scenario.csv +# * including account of growing period adaptation in yields and tau +# * (exo): exogenous technological change (removes non-linearities from the model); +# * requires an existing model run with endo tc for generating the input file +# * f13_tau_scenario.csv cfg$gms$tc <- "endo_jan22" # def = endo_jan22 # * tc cost scenario crops: low, medium or high @@ -348,13 +349,13 @@ cfg$gms$s13_croparea_consv_target <- 2030 # def = 2030 # ***--------------------- 14_yield -------------------------------------- -# * (managementcalib_aug19): calibrate potential LPJmL-yields to FAO regional numbers, -# * pasture yields increase based on exogenous demand-side proxy -# * for growth rate of cattle stocks -# * (dynRegPastrTau_apr26): as managementcalib_aug19, but the pasture yield spillover -# * from crop-sector TC is a regional, time-varying parameter -# * f14_yld_past_switch(t_all,i) read from a CSV input file -cfg$gms$yields <- "managementcalib_aug19" # def = managementcalib_aug19 +# * (gsadapt_dynPastrTau_jul26): calibrate potential LPJmL-yields to FAO regional numbers, +# * pasture yields increase based on exogenous demand-side proxy +# * for growth rate of cattle stocks yields. Optionally, include +# * future growing period adaptation based on LPJmL simulations. +# * Pasture yield spillover from crop-sector TC can be controlled +# * via regional, time-varying parameter (see `s14_past_spillover_mode`) +cfg$gms$yields <- "gsadapt_dynPastrTau_jul26" # def = gsadapt_dynPastrTau_jul26 # * yield scenario # * options: cc (climate change) @@ -362,6 +363,13 @@ cfg$gms$yields <- "managementcalib_aug19" # def = managementcalib_aug1 # * nocc_hist (no climate change after year defined by sm_fix_cc) cfg$gms$c14_yields_scenario <- "cc" # def = "cc" +# * Switch for pasture spillover mode in gsadapt_dynPastrTau_jul26 realization +# * (0): static scalar mode - uses s14_yld_past_switch for all regions and timesteps +# * (1): regional dynamic mode - uses f14_yld_past_switch(t_all,i) per region and timestep +# * This switch allows switching between a uniform spillover effect across all regions +# * and region-specific, time-varying spillover effects read from input data. +cfg$gms$s14_past_spillover_mode <- 0 # def = 1 (regional dynamic mode) + # * switch determing the effectivity of translating crop tc into pasture yield # * increase. Value has to be in the range of 0 (no pasture yield growth) # * and 1 (pasture yields increase linearily with tau). Only used in the realizations: @@ -399,12 +407,24 @@ cfg$gms$s14_degradation <- 0 # def = 0 # For other realizations, it is recommended not to use this yield calibration. cfg$gms$s14_use_yield_calib <- 0 # def = 0 +# Growing period adaption for yield under climate change +# Options: 1 (growing period adaption is included in yield projections), +# 0 (growing period adaption is not included in yield projections; i.e. constant growing periods are assumed) +cfg$gms$s14_use_gsadapt <- 1 # def = 0 + +# Accounting for growing period adaption (gsadapt) in tau with consequences for tc costs +# Only relevant if s14_use_gsadapt is activated (1). +# Options: 1 (gsadapt is considered in tau, which leads to higher tc costs), +# 0 (gsadapt is not considered in tau, which implies that tau comes free of charge) +cfg$gms$s14_gsadapt2tau <- 1 # def = 0 + # Minimum growing stock for timber harvest in natural vegetation (tDM per ha). # Age classes below this threshold cannot be harvested. # 5 tDM/ha ~ 10 m3/ha, i.e. very sparse woodland where commercial timber # harvest would be unrealistic (expert guess). cfg$gms$s14_minimum_growing_stock <- 5 # def = 5 + # ***--------------------- 15_food --------------------------------------- # * (anthropometrics_jan18): estimates food using scenario dependent regression # * and demography drivers diff --git a/core/sets.gms b/core/sets.gms index 7f07b28586..b3a8eee287 100644 --- a/core/sets.gms +++ b/core/sets.gms @@ -55,32 +55,32 @@ sets VEN, VGB, VIR, VNM, VUT, WLF, WSM, YEM, ZAF, ZMB, ZWE / j number of LPJ cells - / CAZ_1*CAZ_5, - CHA_6*CHA_24, - EUR_25*EUR_36, - IND_37*IND_48, - JPN_49*JPN_55, - LAM_56*LAM_88, - MEA_89*MEA_113, - NEU_114*NEU_121, - OAS_122*OAS_137, - REF_138*REF_149, - SSA_150*SSA_182, - USA_183*USA_200 / + / CAZ_1*CAZ_14, + CHA_15*CHA_31, + EUR_32*EUR_43, + IND_44*IND_57, + JPN_58*JPN_65, + LAM_66*LAM_99, + MEA_100*MEA_117, + NEU_118*NEU_126, + OAS_127*OAS_153, + REF_154*REF_164, + SSA_165*SSA_186, + USA_187*USA_200 / cell(i,j) number of LPJ cells per region i - / CAZ . (CAZ_1*CAZ_5) - CHA . (CHA_6*CHA_24) - EUR . (EUR_25*EUR_36) - IND . (IND_37*IND_48) - JPN . (JPN_49*JPN_55) - LAM . (LAM_56*LAM_88) - MEA . (MEA_89*MEA_113) - NEU . (NEU_114*NEU_121) - OAS . (OAS_122*OAS_137) - REF . (REF_138*REF_149) - SSA . (SSA_150*SSA_182) - USA . (USA_183*USA_200) / + / CAZ . (CAZ_1*CAZ_14) + CHA . (CHA_15*CHA_31) + EUR . (EUR_32*EUR_43) + IND . (IND_44*IND_57) + JPN . (JPN_58*JPN_65) + LAM . (LAM_66*LAM_99) + MEA . (MEA_100*MEA_117) + NEU . (NEU_118*NEU_126) + OAS . (OAS_127*OAS_153) + REF . (REF_154*REF_164) + SSA . (SSA_165*SSA_186) + USA . (USA_187*USA_200) / i_to_iso(i,iso) mapping regions to iso countries / CAZ . (AUS, CAN, HMD, NZL, SPM) diff --git a/literature.bib b/literature.bib index 3ad81cc362..6e1e46bb5c 100644 --- a/literature.bib +++ b/literature.bib @@ -1794,3 +1794,23 @@ @article{difulvio2016logging year = {2016}, doi = {10.1080/02827581.2016.1221128} } + +@article{li_global_2018, + title = {A global yield dataset for major lignocellulosic bioenergy crops based on field measurements}, + author = {Wei Li and Philippe Ciais and David Makowski and Shushi Peng}, + journal = {Scientific Data}, + volume = {5}, + number = {1}, + year = {2018}, + doi = {10.1038/sdata.2018.169} +} + +@article{li_mapping_2020, + title = {Mapping the yields of lignocellulosic bioenergy crops from observations at the global scale}, + author = {Wei Li and Philippe Ciais and Elke Stehfest and Detlef van Vuuren and Alexander Popp and Almut Arneth and Fulvio Di Fulvio and Jonathan Doelmann and Florian Humpenöder and Anna B. Harper and Taejin Park and David Makowski and Petr Havlik and Michael Obersteiner and Jingmeng Wang and Andreas Krause and Wenfeng Liu}, + journal = {Earth System Science Data}, + number = {2}, + pages = {789-804}, + year = {2020}, + doi = {10.5194/essd-12-789-2020} +} diff --git a/main.gms b/main.gms index e098e32f31..414ecc17ef 100644 --- a/main.gms +++ b/main.gms @@ -154,7 +154,7 @@ $title magpie * * Number of cells per region: * CAZ CHA EUR IND JPN LAM MEA NEU OAS REF SSA USA -* 5 19 12 12 7 33 25 8 16 12 33 18 +* 14 17 12 14 8 34 18 9 27 11 22 14 * * Regionscode: 62eff8f7 *###################### R SECTION END (VERSION INFO) ########################### @@ -195,7 +195,7 @@ $setglobal land landmatrix_dec18 $setglobal costs default $setglobal interest_rate select_apr20 $setglobal tc endo_jan22 -$setglobal yields managementcalib_aug19 +$setglobal yields gsadapt_dynPastrTau_jul26 $setglobal food anthro_iso_jun22 $setglobal demand sector_may15 diff --git a/modules/13_tc/endo_jan22/declarations.gms b/modules/13_tc/endo_jan22/declarations.gms index 66467de7f7..de870f57f1 100644 --- a/modules/13_tc/endo_jan22/declarations.gms +++ b/modules/13_tc/endo_jan22/declarations.gms @@ -6,7 +6,7 @@ *** | Contact: magpie@pik-potsdam.de positive variable - v13_tau_core(h,tautype) Agricultural land use intensity tau for conventional cropland (1) + v13_tau_core(h,tautype) Agricultural land use intensity tau for conventional cropland (1) vm_tech_cost(i) Total Annuitized costs of TC (mio. USD17MER per yr) v13_cost_tc(i,tautype) Technical change costs per region (mio. USD17MER) v13_tech_cost(i,tautype) Annuitized costs of TC for crops and pasture (mio. USD17MER per yr) @@ -20,6 +20,7 @@ equations q13_tech_cost_sum(i) Total Total annuitized costs for TC (mio. USD17MER per yr) q13_tau(j, tautype) Overall agricultural land use intensity tau (1) q13_tau_consv(h, tautype) Tau for cropland within conservation priority areas (1) + q13_lower_bound_tau(j) Lower limit constraint for tau (1) ; parameters @@ -52,5 +53,6 @@ parameters oq13_tech_cost_sum(t,i,type) Total Total annuitized costs for TC (mio. USD17MER per yr) oq13_tau(t,j,tautype,type) Overall agricultural land use intensity tau (1) oq13_tau_consv(t,h,tautype,type) Tau for cropland within conservation priority areas (1) + oq13_lower_bound_tau(t,j,type) Lower limit constraint for tau (1) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/13_tc/endo_jan22/equations.gms b/modules/13_tc/endo_jan22/equations.gms index 7b0bdc570b..33d84cc6ff 100644 --- a/modules/13_tc/endo_jan22/equations.gms +++ b/modules/13_tc/endo_jan22/equations.gms @@ -44,6 +44,9 @@ q13_tech_cost(i2, tautype) .. q13_tech_cost_sum(i2) .. vm_tech_cost(i2) =e= sum(tautype, v13_tech_cost(i2, tautype)); +*' Enforce gsadapt yield increases in tau, so that tc costs apply +q13_lower_bound_tau(j2) .. + vm_tau(j2,"crop") =g= pcm_tau(j2,"crop") * sum((ct, cell(i2,j2)), pm_yields_gsadapt_ratio_increment(ct,i2)); *' The overall land use intensity factor `vm_tau` is a linear combination between the *' land use intensity factors `v13_tau_core` for regular cropland and `v13_tau_consv` diff --git a/modules/13_tc/endo_jan22/postsolve.gms b/modules/13_tc/endo_jan22/postsolve.gms index da0d81a720..6a4698af8c 100644 --- a/modules/13_tc/endo_jan22/postsolve.gms +++ b/modules/13_tc/endo_jan22/postsolve.gms @@ -28,6 +28,7 @@ pcm_tau(j, tautype) = vm_tau.l(j, tautype); oq13_tech_cost_sum(t,i,"marginal") = q13_tech_cost_sum.m(i); oq13_tau(t,j,tautype,"marginal") = q13_tau.m(j,tautype); oq13_tau_consv(t,h,tautype,"marginal") = q13_tau_consv.m(h,tautype); + oq13_lower_bound_tau(t,j,"marginal") = q13_lower_bound_tau.m(j); ov13_tau_core(t,h,tautype,"level") = v13_tau_core.l(h,tautype); ov_tech_cost(t,i,"level") = vm_tech_cost.l(i); ov13_cost_tc(t,i,tautype,"level") = v13_cost_tc.l(i,tautype); @@ -39,6 +40,7 @@ pcm_tau(j, tautype) = vm_tau.l(j, tautype); oq13_tech_cost_sum(t,i,"level") = q13_tech_cost_sum.l(i); oq13_tau(t,j,tautype,"level") = q13_tau.l(j,tautype); oq13_tau_consv(t,h,tautype,"level") = q13_tau_consv.l(h,tautype); + oq13_lower_bound_tau(t,j,"level") = q13_lower_bound_tau.l(j); ov13_tau_core(t,h,tautype,"upper") = v13_tau_core.up(h,tautype); ov_tech_cost(t,i,"upper") = vm_tech_cost.up(i); ov13_cost_tc(t,i,tautype,"upper") = v13_cost_tc.up(i,tautype); @@ -50,6 +52,7 @@ pcm_tau(j, tautype) = vm_tau.l(j, tautype); oq13_tech_cost_sum(t,i,"upper") = q13_tech_cost_sum.up(i); oq13_tau(t,j,tautype,"upper") = q13_tau.up(j,tautype); oq13_tau_consv(t,h,tautype,"upper") = q13_tau_consv.up(h,tautype); + oq13_lower_bound_tau(t,j,"upper") = q13_lower_bound_tau.up(j); ov13_tau_core(t,h,tautype,"lower") = v13_tau_core.lo(h,tautype); ov_tech_cost(t,i,"lower") = vm_tech_cost.lo(i); ov13_cost_tc(t,i,tautype,"lower") = v13_cost_tc.lo(i,tautype); @@ -61,4 +64,5 @@ pcm_tau(j, tautype) = vm_tau.l(j, tautype); oq13_tech_cost_sum(t,i,"lower") = q13_tech_cost_sum.lo(i); oq13_tau(t,j,tautype,"lower") = q13_tau.lo(j,tautype); oq13_tau_consv(t,h,tautype,"lower") = q13_tau_consv.lo(h,tautype); + oq13_lower_bound_tau(t,j,"lower") = q13_lower_bound_tau.lo(j); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/13_tc/endo_jan22/presolve.gms b/modules/13_tc/endo_jan22/presolve.gms index 99b1a42df8..760f119d17 100644 --- a/modules/13_tc/endo_jan22/presolve.gms +++ b/modules/13_tc/endo_jan22/presolve.gms @@ -5,7 +5,6 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de - pc13_land(i,"pastr") = sum(cell(i,j),pcm_land(j,"past")); pc13_land(i,"crop") = sum(cell(i,j),pcm_land(j,"crop")); @@ -20,8 +19,9 @@ else if(m_year(t) > sm_fix_SSP2 AND s13_max_gdp_shr <> Inf, -* We constrain tech cost to a defined share of regional GDP to avoid unrealistically -* high endogenous tech investments +*' Technological change costs are constrainted to a +*' pre-defined share of regional GDP to avoid unrealistically +*' high endogenous tech investments vm_tech_cost.up(i) = sum((i_to_iso(i,iso),ct), im_gdp_pc_ppp_iso(ct,iso) * im_pop_iso(ct,iso)) * s13_max_gdp_shr; diff --git a/modules/13_tc/endo_jan22/realization.gms b/modules/13_tc/endo_jan22/realization.gms index 5043498cd8..83fa0197b4 100644 --- a/modules/13_tc/endo_jan22/realization.gms +++ b/modules/13_tc/endo_jan22/realization.gms @@ -5,7 +5,7 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -*' @description The endo realization stands for endogenous implementation of +*' @description The endo_jan22 realization stands for endogenous implementation of *' technological change and land use intensification. The intensification rates *' are calculated endogenously based on an interplay between land use intensity *' $\tau$ and technological change costs (as shown schematically in the figure diff --git a/modules/13_tc/endo_jan22/scaling.gms b/modules/13_tc/endo_jan22/scaling.gms index 3d58af4c5a..6b174c52da 100644 --- a/modules/13_tc/endo_jan22/scaling.gms +++ b/modules/13_tc/endo_jan22/scaling.gms @@ -5,7 +5,6 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -vm_tech_cost.scale(i) = 1e3; -v13_cost_tc.scale(i,tautype) = 1e6; -v13_tech_cost.scale(i,tautype) = 1e3; -q13_cost_tc.scale(i,tautype) = 1e4; +vm_tech_cost.scale(i) = 10e3; +v13_cost_tc.scale(i,tautype) = 10e6; +v13_tech_cost.scale(i,tautype) = 10e3; diff --git a/modules/13_tc/exo/not_used.txt b/modules/13_tc/exo/not_used.txt index 0d06794292..5ce3267a0b 100644 --- a/modules/13_tc/exo/not_used.txt +++ b/modules/13_tc/exo/not_used.txt @@ -1,3 +1,4 @@ name,type,reason im_pop_iso,input,questionnaire im_gdp_pc_ppp_iso,input,questionnaire +pm_yields_gsadapt_ratio_increment,input,questionnaire diff --git a/modules/14_yields/dynRegPastrTau_apr26/declarations.gms b/modules/14_yields/dynRegPastrTau_apr26/declarations.gms deleted file mode 100644 index 3e80e0f90e..0000000000 --- a/modules/14_yields/dynRegPastrTau_apr26/declarations.gms +++ /dev/null @@ -1,41 +0,0 @@ -*** | (C) 2008-2026 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -parameters - i14_yields_calib(t,j,kve,w) Calibrated biophysical input yields (excluding technological change) (tDM per ha per yr) - p14_pyield_LPJ_reg(t_all,i) Regional average input yields aggregated from clusters with initial pasture area as weights (tDM per ha per yr) - p14_pyield_corr(t,i) Regional pasture management correction for historical time steps (1) - i14_croparea_total(t_all,w,j) Cellular croparea (mio. ha) - i14_modeled_yields_hist(t_all,i,kcr) Biophysical input yields average over region and water supply type at the historical reference year (tDM per ha per yr) - i14_fao_yields_hist(t,i,kcr) FAO yields per region at the historical reference 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) - im_growing_stock(t,j,ac,land_timber) Harvestable stem biomass per ha by age class (tDM per ha) - im_growing_stock_ysf(t,j,ac) Harvestable stem biomass per ha by age class for young secondary forest on other land (tDM per ha) - pm_yields_semi_calib(j,kve,w) Potential yields calibrated to FAO regional levels (tDM per ha per yr) - i14_calib_yields_hist(i,w) Calibrated yields average over region and crop type at the historical reference year (tDM per ha per yr) - i14_calib_yields_ratio(i) Irrigated to rainfed yield ratio for calibrated yields (1) - i14_target_ratio(i) Target irrigated to rainfed ratio as upper bound (1) - i14_modeled_yields_hist2(i,knbe14) Calibrated yields average over region and water supply type at the historical reference year (tDM per ha per yr) - ; - -positive variables - vm_yld(j,kve,w) Yields (variable because of technical change) (tDM per ha per yr) -; - -equations - q14_yield_crop(j,kcr,w) Crop yields (tDM per ha per yr) - q14_yield_past(j,w) Pasture yields (tDM per ha per yr) -; - -*#################### R SECTION START (OUTPUT DECLARATIONS) #################### -parameters - ov_yld(t,j,kve,w,type) Yields (variable because of technical change) (tDM per ha per yr) - oq14_yield_crop(t,j,kcr,w,type) Crop yields (tDM per ha per yr) - oq14_yield_past(t,j,w,type) Pasture yields (tDM per ha per yr) -; -*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/14_yields/dynRegPastrTau_apr26/preloop.gms b/modules/14_yields/dynRegPastrTau_apr26/preloop.gms deleted file mode 100644 index 39899859d7..0000000000 --- a/modules/14_yields/dynRegPastrTau_apr26/preloop.gms +++ /dev/null @@ -1,190 +0,0 @@ -*** | (C) 2008-2026 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -i14_yields_calib(t,j,kve,w) = f14_yields(t,j,kve,w); - -***YIELD CORRECTION FOR 2ND GENERATION BIOENERGY CROPS************************************* -i14_yields_calib(t,j,"begr",w) = f14_yields(t,j,"begr",w) * sum((supreg(h,i),cell(i,j)),fm_tau1995(h))/smax(h,fm_tau1995(h)); -i14_yields_calib(t,j,"betr",w) = f14_yields(t,j,"betr",w) * sum((supreg(h,i),cell(i,j)),fm_tau1995(h))/smax(h,fm_tau1995(h)); - -***YIELD CORRECTION FOR PASTURE ACCOUNTING FOR REGIONAL DIFFERENCES IN MANAGEMENT*** -p14_pyield_LPJ_reg(t,i) = (sum(cell(i,j),i14_yields_calib(t,j,"pasture","rainfed") * pm_land_start(j,"past")) / - sum(cell(i,j),pm_land_start(j,"past")) ); - -p14_pyield_corr(t,i)$(f14_pyld_hist(t,i) > 0) = f14_pyld_hist(t,i) / (p14_pyield_LPJ_reg(t,i) + 0.000001); -loop(t, - p14_pyield_corr(t,i)$(p14_pyield_corr(t,i) = 0) = p14_pyield_corr(t-1,i); -); - -***YIELD MANAGEMENT CALIBRATION************************************************************ - - -*' @code - -*' The following equations calibrate the cellular yield patterns (`f14_yields`) to match -*' FAO historical yields (`f14_fao_yields_hist`) by calculating a calibration term called -*' 'i14_managementcalib'. For most cases, 'i14_managementcalib' is the ratio of the historical -*' yields reported by FAO (`f14_fao_yields_hist`) and regional mean yields (`i14_modeled_yields_hist`) -*' given historic crop area patterns ('fm_croparea') and cellular yields coming from crop models -*' like LPJmL (`f14_yields`). In these cases, 'i14_managementcalib' represents a purely relative -*' calibration factor that depends only on the initial conditions of the starting year. -*' -*' However, when FAO yields are significantly higher than given by the cellular yield inputs -*' (underestimated baseline), the relative calibration terms can lead to unrealistically large -*' yields in the case of future yield increases within the cellular yield patterns. -*' -*' To address this issue, the factor `i14_lambda_yields` determines the degree -*' to which the baseline (FAO) is under- or overestimated and therefore controls -*' whether the calibration factor is applied as an absolute or relative change. -*' For overestimated FAO yields, `i14_lambda_yields` is 1, which is equivalent -*' to an entirely relative calibration. For underestimated yields, `i14_lambda_yields` -*' is calculated as the squared root of the ratio between LPJmL yields and FAO historical -*' yields, and as `i14_lambda_yields` approaches 0, it reduces the applied relative change -*' resulting in a mean change increasingly similar to an additive term (@Heinke.2013). - -*' This concept is referred to as limited calibration, as it limits the calibration -*' to an additive term in case of a strongly underestimated baseline. The scalar -*' `s14_limit_calib` can be used to switch limited calibration on (1) and off (0). - -i14_croparea_total(t_all,w,j) = sum(kcr, fm_croparea(t_all,j,w,kcr)); - -*' Historic crop area patterns (`fm_croprea`) are used to calculate regional yields -*' (`i14_modeled_yields_hist`) from the given cellular input pattern. In rare cases where -*' a region has no crop area reported for a given crop type, the total crop area is -*' used to calculate a proxy yield for the calibration, given by the following equation: - -i14_modeled_yields_hist(t_past,i,knbe14) - = (sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14) * f14_yields(t_past,j,knbe14,w)) / - sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14)))$(sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14)) > 0.00001 AND - sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14) * f14_yields(t_past,j,knbe14,w)) > 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.00001 OR - sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14) * f14_yields(t_past,j,knbe14,w)) <= 0.00001); - - -*' The factor `i14_lambda_yields` is calculated for the initial time step depending -*' on the setting `s14_limit_calib` and is then held constant for all other time steps. -*' The regional FAO yield and regional yield of the crop model input of the initial -*' time step is kept constant in the two parameters `i14_fao_yields_hist` and -*' `i14_modeled_yields_hist`: - -loop(t, - if(sum(sameas(t,"y1995"),1)=1, - - if ((s14_limit_calib = 0), - i14_lambda_yields(t,i,knbe14) = 1; - - Elseif (s14_limit_calib =1 ), - i14_lambda_yields(t,i,knbe14) = - 1$(f14_fao_yields_hist(t,i,knbe14) <= i14_modeled_yields_hist(t,i,knbe14)) - + sqrt(i14_modeled_yields_hist(t,i,knbe14)/f14_fao_yields_hist(t,i,knbe14))$ - (f14_fao_yields_hist(t,i,knbe14) > i14_modeled_yields_hist(t,i,knbe14)); - ); - - i14_fao_yields_hist(t,i,knbe14) = f14_fao_yields_hist(t,i,knbe14); - - Else - i14_modeled_yields_hist(t,i,knbe14) = i14_modeled_yields_hist(t-1,i,knbe14); - i14_fao_yields_hist(t,i,knbe14) = i14_fao_yields_hist(t-1,i,knbe14); - i14_lambda_yields(t,i,knbe14) = i14_lambda_yields(t-1,i,knbe14); - ); -); - -*' The calibrated cellular yield `i14_yields_calib` is calculated for each time step depending -*' on the constant values `i14_modeled_yields_hist`, `i14_fao_yields_hist`, `i14_lambda_yields` -*' and the uncalibrated, cellular yield `f14_yields` following the idea of eq. (9) in [@Heinke.2013]: - -i14_managementcalib(t,j,knbe14,w) = - 1 + (sum(cell(i,j), i14_fao_yields_hist(t,i,knbe14) - i14_modeled_yields_hist(t,i,knbe14)) / - f14_yields(t,j,knbe14,w) * - (f14_yields(t,j,knbe14,w) / (sum(cell(i,j),i14_modeled_yields_hist(t,i,knbe14))+10**(-8))) ** - sum(cell(i,j),i14_lambda_yields(t,i,knbe14)))$(f14_yields(t,j,knbe14,w)>0); - - -i14_yields_calib(t,j,knbe14,w) = i14_managementcalib(t,j,knbe14,w) * f14_yields(t,j,knbe14,w); -pm_yields_semi_calib(j,knbe14,w) = i14_yields_calib("y1995",j,knbe14,w); - -*' Note that the calculation is split into two parts for better readability. - -*' Irrigated yields are calibrated to meet the country-level -*' ratio between irrigated and rainfed yields reported by Aquastat. -*' This can be de-activated with the switch `s14_calib_ir2rf`. -if ((s14_calib_ir2rf = 1), - -* Weighted yields - i14_calib_yields_hist(i,w) - = sum((cell(i,j), knbe14), fm_croparea("y1995",j,"irrigated",knbe14) * i14_yields_calib("y1995",j,knbe14,w)) / - sum((cell(i,j), knbe14), fm_croparea("y1995",j,"irrigated",knbe14)); - -* Use irrigated-rainfed ratio of Aquastat if larger than our calculated ratio - i14_calib_yields_ratio(i) = i14_calib_yields_hist(i,"irrigated") / i14_calib_yields_hist(i,"rainfed"); - i14_target_ratio(i) = max(i14_calib_yields_ratio(i), f14_ir2rf_ratio(i)); - i14_yields_calib(t,j,knbe14,"irrigated") = sum((cell(i,j)), i14_target_ratio(i) / i14_calib_yields_ratio(i)) * - i14_yields_calib(t,j,knbe14,"irrigated"); - -* Calibrate newly calibrated yields to FAO yields - i14_modeled_yields_hist2(i,knbe14) - = (sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14) * i14_yields_calib("y1995",j,knbe14,w)) / - sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14)))$(sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14)) > 0.00001 AND - sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14) * i14_yields_calib("y1995",j,knbe14,w)) > 0.00001) - + (sum((cell(i,j),w), i14_croparea_total("y1995",w,j) * i14_yields_calib("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.00001 OR - sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14) * i14_yields_calib("y1995",j,knbe14,w)) <= 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)) * - i14_yields_calib(t,j,knbe14,w); - - pm_yields_semi_calib(j,knbe14,w) = i14_yields_calib("y1995",j,knbe14,w); -); - -*' @stop - - -***YIELD CALIBRATION*********************************************************************** - -*' @code -*' Calibrated yields 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 -*' 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 -if(s14_use_yield_calib = 0 OR sum((i,ltype14),f14_yld_calib(i,ltype14)) = 0, - f14_yld_calib(i,ltype14) = 1; -); - - -i14_yields_calib(t,j,kcr,w) = i14_yields_calib(t,j,kcr,w) - * sum(cell(i,j),f14_yld_calib(i,"crop")); -i14_yields_calib(t,j,"pasture",w) = i14_yields_calib(t,j,"pasture",w) - * sum(cell(i,j),f14_yld_calib(i,"past")); - -*' @stop - -*' @code -*' Land degradation can negatively affect yields. Soil loss for example can -*' notably affect land productivity. Similarly, the yield of pollinator-dependent crops -*' is reduced when there is a lack of pollinators. To account for the impacts of degradation, -*' calibrated yields are multiplied by the share of land with intact NCP in each cell and specific -*' yield reduction coefficients that represent yield loss due to soil erosion and pollination -*' deficiency on non-intact land. - -* set default values in case of missing input file. -if(sum((t,j,ncp_type14),f14_yld_ncp_report(t,j,ncp_type14)) = 0, - f14_yld_ncp_report(t,j,ncp_type14) = 1; -); - -if ((s14_degradation = 1), - i14_yields_calib(t,j,kcr,w) = i14_yields_calib(t,j,kcr,w) * (1 - s14_yld_reduction_soil_loss) - + i14_yields_calib(t,j,kcr,w) * s14_yld_reduction_soil_loss * f14_yld_ncp_report(t,j,"soil_intact"); - i14_yields_calib(t,j,kcr,w) = i14_yields_calib(t,j,kcr,w) * (1 - f14_kcr_pollinator_dependence(kcr)) - + i14_yields_calib(t,j,kcr,w) * f14_kcr_pollinator_dependence(kcr) * f14_yld_ncp_report(t,j,"poll_suff"); -); - -*' @stop diff --git a/modules/14_yields/dynRegPastrTau_apr26/realization.gms b/modules/14_yields/dynRegPastrTau_apr26/realization.gms deleted file mode 100644 index ce5422c3b8..0000000000 --- a/modules/14_yields/dynRegPastrTau_apr26/realization.gms +++ /dev/null @@ -1,42 +0,0 @@ -*** | (C) 2008-2026 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-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 dynRegPastrTau_apr26 realization extends managementcalib_aug19 -*' by replacing the global scalar spillover parameter for pasture yield increases -*' with a regional, time-varying input parameter `f14_yld_past_switch` (t_all x i). -*' All other yield calibration logic — bioenergy correction, pasture management -*' correction, FAO calibration, irrigated-to-rainfed ratio calibration, yield -*' calibration factors, and land degradation effects — is identical to -*' managementcalib_aug19. -*' -*' The parameter `f14_yld_past_switch(t_all,i)` scales the fraction of -*' crop-sector technological change (tau) that spills over to pasture yields, -*' and can vary across the MAgPIE world regions and across model -*' time steps from 1965 to 2150. A value of 0 implies no spillover; a value -*' of 1 implies full spillover equal to the crop-sector intensification rate. -*' The default input file populates all regions and time steps with values able to -*' reproduce the behaviour of managementcalib_aug19 realization. - -*' @limitations The exogenous implementation of pasture intensification cannot -*' capture feedbacks between land scarcity and efforts to improve pasture -*' management. Moreover, the magnitude of spillover effects from technological change -*' in the crop sector towards improvements in pasture management is very uncertain -*' and varies across regions and time periods. - - -*####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/14_yields/dynRegPastrTau_apr26/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/14_yields/dynRegPastrTau_apr26/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/14_yields/dynRegPastrTau_apr26/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/14_yields/dynRegPastrTau_apr26/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/14_yields/dynRegPastrTau_apr26/scaling.gms" -$Ifi "%phase%" == "preloop" $include "./modules/14_yields/dynRegPastrTau_apr26/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/14_yields/dynRegPastrTau_apr26/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/14_yields/dynRegPastrTau_apr26/postsolve.gms" -$Ifi "%phase%" == "nl_fix" $include "./modules/14_yields/dynRegPastrTau_apr26/nl_fix.gms" -$Ifi "%phase%" == "nl_release" $include "./modules/14_yields/dynRegPastrTau_apr26/nl_release.gms" -*######################## R SECTION END (PHASES) ############################### diff --git a/modules/14_yields/managementcalib_aug19/declarations.gms b/modules/14_yields/gsadapt_dynPastrTau_jul26/declarations.gms similarity index 54% rename from modules/14_yields/managementcalib_aug19/declarations.gms rename to modules/14_yields/gsadapt_dynPastrTau_jul26/declarations.gms index 5b7398872f..4136de553c 100644 --- a/modules/14_yields/managementcalib_aug19/declarations.gms +++ b/modules/14_yields/gsadapt_dynPastrTau_jul26/declarations.gms @@ -6,25 +6,32 @@ *** | Contact: magpie@pik-potsdam.de parameters - i14_yields_calib(t,j,kve,w) Calibrated biophysical input yields (excluding technological change) (tDM per ha per yr) + i14_yields_calib(t,j,kve,w) Calibrated biophysical input yields without growing period adaptation excluding technological change (tDM per ha per yr) + i14_yields_combined(t_all,j,yldtype,kcr,w) Combined biophysical yields for gsadapt and constgsadapt before calibration (tDM per ha per yr) + i14_yields_calib_combined(t,j,yldtype,kcr,w) Combined parameter with gsadapt and constgsadapt yields (tDM per ha per yr) + p14_yields_gsadapt_ratio(t,i) Ratio between regional aggregated gsadapt and constgsadapt yields (1) + p14_yields_gsadapt_ratio_previous(t,i) Ratio between regional aggregated gsadapt and constgsadapt yields for the previous time-step (1) + pm_yields_gsadapt_ratio_increment(t,i) Incremental change of growing period adaption from this time step (1) + p14_yields_gsadapt_ratio_cumulative(t,i) Cumulative effect of growing period adaption from the first to the current timestep (1) p14_pyield_LPJ_reg(t_all,i) Regional average input yields aggregated from clusters with initial pasture area as weights (tDM per ha per yr) p14_pyield_corr(t,i) Regional pasture management correction for historical time steps (1) i14_croparea_total(t_all,w,j) Cellular croparea (mio. ha) - i14_modeled_yields_hist(t_all,i,kcr) Biophysical input yields average over region and water supply type at the historical reference year (tDM per ha per yr) - i14_fao_yields_hist(t,i,kcr) FAO yields per region at the historical reference 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) + i14_modeled_yields_hist(t_all,i,yldtype,kcr) Biophysical input yields average over region and water supply type at the historical reference year (tDM per ha per yr) + i14_calib_target_yields_hist(t,i,kcr) Calibration target yields per region at the historical reference year (tDM per ha per yr) + i14_lambda_yields(t,i,yldtype,kcr) Scaling factor for non-linear management calibration (1) + i14_managementcalib(t,j,yldtype,kcr,w) Regional management calibration factor accounting for FAO yield levels (1) im_growing_stock(t,j,ac,land_timber) Harvestable stem biomass per ha by age class (tDM per ha) im_growing_stock_ysf(t,j,ac) Harvestable stem biomass per ha by age class for young secondary forest on other land (tDM per ha) pm_yields_semi_calib(j,kve,w) Potential yields calibrated to FAO regional levels (tDM per ha per yr) - i14_calib_yields_hist(i,w) Calibrated yields average over region and crop type at the historical reference year (tDM per ha per yr) - i14_calib_yields_ratio(i) Irrigated to rainfed yield ratio for calibrated yields (1) - i14_target_ratio(i) Target irrigated to rainfed ratio as upper bound (1) - i14_modeled_yields_hist2(i,knbe14) Calibrated yields average over region and water supply type at the historical reference year (tDM per ha per yr) + i14_calib_yields_hist(i,yldtype,w) Calibrated yields average over region and crop type at the historical reference year (tDM per ha per yr) + i14_calib_yields_ratio(i,yldtype) Irrigated to rainfed yield ratio for calibrated yields (1) + i14_target_ratio(i,yldtype) Target irrigated to rainfed ratio as upper bound (1) + i14_modeled_yields_hist2(i,yldtype,knbe14) Calibrated yields average over region and water supply type at the historical reference year (tDM per ha per yr) + i14_yld_past_switch_eff(t_all,i) Effective pasture spillover parameter (1) ; positive variables - vm_yld(j,kve,w) Yields (variable because of technical change) (tDM per ha per yr) + vm_yld(j,kve,w) Yields declared as variable because of technological change (tDM per ha per yr) ; equations @@ -34,7 +41,7 @@ equations *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_yld(t,j,kve,w,type) Yields (variable because of technical change) (tDM per ha per yr) + ov_yld(t,j,kve,w,type) Yields declared as variable because of technological change (tDM per ha per yr) oq14_yield_crop(t,j,kcr,w,type) Crop yields (tDM per ha per yr) oq14_yield_past(t,j,w,type) Pasture yields (tDM per ha per yr) ; diff --git a/modules/14_yields/dynRegPastrTau_apr26/equations.gms b/modules/14_yields/gsadapt_dynPastrTau_jul26/equations.gms similarity index 78% rename from modules/14_yields/dynRegPastrTau_apr26/equations.gms rename to modules/14_yields/gsadapt_dynPastrTau_jul26/equations.gms index e4f4a83966..e4ff620b5c 100644 --- a/modules/14_yields/dynRegPastrTau_apr26/equations.gms +++ b/modules/14_yields/gsadapt_dynPastrTau_jul26/equations.gms @@ -1,4 +1,4 @@ -*** | (C) 2008-2026 Potsdam Institute for Climate Impact Research (PIK) +*** | (C) 2008-2025 Potsdam Institute for Climate Impact Research (PIK) *** | authors, and contributors see CITATION.cff file. This file is part *** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of *** | AGPL-3.0, you are granted additional permissions described in the @@ -9,11 +9,10 @@ ***CROP YIELD CALCULATIONS********************************************** -*' Technological change can increase the initial calibrated yields by: - +*' Technological change can increase the initial calibrated yields: q14_yield_crop(j2,kcr,w) .. - vm_yld(j2,kcr,w) =e= sum(ct,i14_yields_calib(ct,j2,kcr,w)) * - vm_tau(j2,"crop") / sum((cell(i2,j2), supreg(h2,i2)), fm_tau1995(h2)); + vm_yld(j2,kcr,w) =e= sum(ct, i14_yields_calib(ct,j2,kcr,w) / sum(cell(i2,j2), p14_yields_gsadapt_ratio_cumulative(ct,i2))) * + vm_tau(j2,"crop") / sum((cell(i2,j2), supreg(h2,i2)), fm_tau1995(h2)); *' For the current time step of the optimization, cellular yields of irrigated *' and rainfed crops are calculated by multiplying calibrated input yields from @@ -27,7 +26,7 @@ q14_yield_crop(j2,kcr,w) .. *' number of cattle reared to fulfill the domestic demand for ruminant livestock *' products in module 70. *' -*' Additionally, the parameter `f14_yld_past_switch` can be used to capture a +*' Additionally, the parameter `i14_yld_past_switch_eff` can be used to capture a *' certain magnitude of spillovers of the yield increase due to technological *' change from the time step before. It is defined per model region and time step, *' and can range from 0 (no spillover) to 1 (full spillover). @@ -36,5 +35,5 @@ q14_yield_past(j2,w) .. vm_yld(j2,"pasture",w) =e= sum(ct,(i14_yields_calib(ct,j2,"pasture",w)) * sum(cell(i2,j2),pm_past_mngmnt_factor(ct,i2))) - * (1 + sum(ct, sum(cell(i2,j2), f14_yld_past_switch(ct,i2))) + * (1 + sum(ct, sum(cell(i2,j2), i14_yld_past_switch_eff(ct,i2))) * (sum((cell(i2,j2), supreg(h2,i2)), pcm_tau(j2,"crop") / fm_tau1995(h2)) - 1)); diff --git a/modules/14_yields/dynRegPastrTau_apr26/input.gms b/modules/14_yields/gsadapt_dynPastrTau_jul26/input.gms similarity index 52% rename from modules/14_yields/dynRegPastrTau_apr26/input.gms rename to modules/14_yields/gsadapt_dynPastrTau_jul26/input.gms index 585e604d96..941fdcc1b4 100644 --- a/modules/14_yields/dynRegPastrTau_apr26/input.gms +++ b/modules/14_yields/gsadapt_dynPastrTau_jul26/input.gms @@ -10,15 +10,18 @@ $setglobal c14_yields_scenario cc * nocc (no climate change) * nocc_hist (no climate change after year defined by sm_fix_cc) - scalars -s14_limit_calib Relative managament calibration switch (1=limited 0=pure relative) / 1 / -s14_calib_ir2rf Switch to calibrate rainfed to irrigated yield ratios (1=calib 0=not calib) / 1 / -s14_degradation Switch to include yield impacts of land degradation(0=no degradation 1=with degradation) / 0 / -s14_use_yield_calib Switch for using or not using yield calibration factors from the preprocessing (1=use facs 0=not use facs) / 0 / -s14_minimum_growing_stock Minimum growing stock for timber harvest in natural vegetation (tDM per ha) / 5 / -s14_yld_reduction_soil_loss Decline of land productivity in areas with severe soil loss (1) / 0.08 / -sm_carbon_fraction Carbon fraction of dry matter (tC per tDM) / 0.5 / + s14_limit_calib Relative managament calibration switch (1=limited 0=pure relative) / 1 / + s14_calib_ir2rf Switch to calibrate rainfed to irrigated yield ratios (1=calib 0=not calib) / 1 / + s14_degradation Switch to include yield impacts of land degradation(0=no degradation 1=with degradation) / 0 / + s14_yld_reduction_soil_loss Decline of land productivity in areas with severe soil loss (1) / 0.08 / + s14_use_yield_calib Switch for using or not using yield calibration factors from the preprocessing (1=use facs 0=not use facs) / 0 / + s14_past_spillover_mode Switch for pasture spillover mode: 0 = static scalar - 1 = regional dynamic= / 0 / + s14_yld_past_switch Spillover parameter for translating technological change in the crop sector into pasture yield increases in static mode (1) / 0.25 / + s14_minimum_growing_stock Minimum growing stock for timber harvest in natural vegetation (tDM per ha) / 5 / + sm_carbon_fraction Carbon fraction of dry matter (tC per tDM) / 0.5 / + s14_use_gsadapt Switch to use including growing period adaption (1) or not (0) for yield pattern (binary) / 1 / + s14_gsadapt2tau Switch to account for growing period adaption in tau (1) or not (0) (binary) / 1 / ; @@ -31,11 +34,23 @@ $offdelim ; $offEmpty -table f14_yields(t_all,j,kve,w) LPJmL potential yields per cell (rainfed and irrigated) (tDM per ha per yr) +table f14_yields_constgsadapt(t_all,j,kve,w) LPJmL potential yields per cell WITHOUT gsadapt (rainfed and irrigated) (tDM per ha per yr) +$ondelim +$include "./modules/14_yields/input/lpj_yields_constgsadapt.cs3" +$offdelim +; + +* set values to 1995 if nocc scenario is used, or to sm_fix_cc after sm_fix_cc if nocc_hist is used +$if "%c14_yields_scenario%" == "nocc" f14_yields_constgsadapt(t_all,j,kve,w) = f14_yields_constgsadapt("y1995",j,kve,w); +$if "%c14_yields_scenario%" == "nocc_hist" f14_yields_constgsadapt(t_all,j,kve,w)$(m_year(t_all) > sm_fix_cc) = f14_yields_constgsadapt(t_all,j,kve,w)$(m_year(t_all) = sm_fix_cc); +m_fillmissingyears(f14_yields_constgsadapt,"j,kve,w"); + +table f14_yields(t_all,j,kve,w) LPJmL potential yields WITH gsadapt per cell (rainfed and irrigated) (tDM per ha per yr) $ondelim $include "./modules/14_yields/input/lpj_yields.cs3" $offdelim ; + * set values to 1995 if nocc scenario is used, or to sm_fix_cc after sm_fix_cc if nocc_hist is used $if "%c14_yields_scenario%" == "nocc" f14_yields(t_all,j,kve,w) = f14_yields("y1995",j,kve,w); $if "%c14_yields_scenario%" == "nocc_hist" f14_yields(t_all,j,kve,w)$(m_year(t_all) > sm_fix_cc) = f14_yields(t_all,j,kve,w)$(m_year(t_all) = sm_fix_cc); @@ -46,16 +61,18 @@ $ondelim $include "./modules/14_yields/input/f14_pasture_yields_hist.csv" $offdelim; +$onEmpty table f14_yld_past_switch(t_all,i) Pasture yield spillover factor from crop-sector TC by region (1) $ondelim -$include "./modules/14_yields/dynRegPastrTau_apr26/input/f14_yld_past_switch.csv" +$if exist "./modules/14_yields/gsadapt_dynPastrTau_jul26/input/f14_yld_past_switch.csv" $include "./modules/14_yields/gsadapt_dynPastrTau_jul26/input/f14_yld_past_switch.csv" $offdelim ; +$offEmpty m_fillmissingyears(f14_yld_past_switch,"i"); table f14_fao_yields_hist(t_all,i,kcr) FAO yields per region (tDM per ha per yr) $ondelim -$include "./modules/14_yields/dynRegPastrTau_apr26/input/f14_region_yields.cs3" +$include "./modules/14_yields/gsadapt_dynPastrTau_jul26/input/f14_region_yields.cs3" $offdelim ; m_fillmissingyears(f14_fao_yields_hist,"i,kcr"); @@ -63,7 +80,7 @@ m_fillmissingyears(f14_fao_yields_hist,"i,kcr"); parameter f14_ir2rf_ratio(i) AQUASTAT ratio of irrigated to rainfed yields per region (1) / $ondelim -$include "./modules/14_yields/dynRegPastrTau_apr26/input/f14_ir2rf_ratio.cs4" +$include "./modules/14_yields/gsadapt_dynPastrTau_jul26/input/f14_ir2rf_ratio.cs4" $offdelim / ; diff --git a/modules/14_yields/dynRegPastrTau_apr26/input/files b/modules/14_yields/gsadapt_dynPastrTau_jul26/input/files similarity index 100% rename from modules/14_yields/dynRegPastrTau_apr26/input/files rename to modules/14_yields/gsadapt_dynPastrTau_jul26/input/files diff --git a/modules/14_yields/dynRegPastrTau_apr26/nl_fix.gms b/modules/14_yields/gsadapt_dynPastrTau_jul26/nl_fix.gms similarity index 70% rename from modules/14_yields/dynRegPastrTau_apr26/nl_fix.gms rename to modules/14_yields/gsadapt_dynPastrTau_jul26/nl_fix.gms index 88fbe71126..476da50131 100644 --- a/modules/14_yields/dynRegPastrTau_apr26/nl_fix.gms +++ b/modules/14_yields/gsadapt_dynPastrTau_jul26/nl_fix.gms @@ -7,5 +7,5 @@ * ### nl_fix ### -vm_yld.fx(j,kcr,w) = sum(ct,i14_yields_calib(ct,j,kcr,w)) * sum((cell(i,j), supreg(h,i)),vm_tau.l(h, "crop") / fm_tau1995(h)); -vm_yld.fx(j,"pasture",w) = sum(ct,(i14_yields_calib(ct,j,"pasture",w)) * sum(cell(i,j), pm_past_mngmnt_factor(ct,i))) * (1 + sum(ct, sum(cell(i,j), f14_yld_past_switch(ct,i))) * (sum((cell(i,j), supreg(h,i)), pcm_tau(h, "crop") / fm_tau1995(h)) - 1)); +vm_yld.fx(j,kcr,w) = sum(ct,i14_yields_calib(ct,j,kcr,w) / sum(cell(i,j), p14_yields_gsadapt_ratio_cumulative(ct,i))) * sum((cell(i,j), supreg(h,i)),vm_tau.l(h, "crop") / fm_tau1995(h)); +vm_yld.fx(j,"pasture",w) = sum(ct,(i14_yields_calib(ct,j,"pasture",w)) * sum(cell(i,j), pm_past_mngmnt_factor(ct,i))) * (1 + sum(cell(i,j), i14_yld_past_switch_eff("y1995",i)) * (sum((cell(i,j), supreg(h,i)), pcm_tau(h, "crop") / fm_tau1995(h)) - 1)); diff --git a/modules/14_yields/dynRegPastrTau_apr26/nl_release.gms b/modules/14_yields/gsadapt_dynPastrTau_jul26/nl_release.gms similarity index 100% rename from modules/14_yields/dynRegPastrTau_apr26/nl_release.gms rename to modules/14_yields/gsadapt_dynPastrTau_jul26/nl_release.gms diff --git a/modules/14_yields/dynRegPastrTau_apr26/postsolve.gms b/modules/14_yields/gsadapt_dynPastrTau_jul26/postsolve.gms similarity index 100% rename from modules/14_yields/dynRegPastrTau_apr26/postsolve.gms rename to modules/14_yields/gsadapt_dynPastrTau_jul26/postsolve.gms diff --git a/modules/14_yields/gsadapt_dynPastrTau_jul26/preloop.gms b/modules/14_yields/gsadapt_dynPastrTau_jul26/preloop.gms new file mode 100644 index 0000000000..88a34a347d --- /dev/null +++ b/modules/14_yields/gsadapt_dynPastrTau_jul26/preloop.gms @@ -0,0 +1,255 @@ +*** | (C) 2008-2025 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +***YIELD CORRECTION FOR PASTURE ACCOUNTING FOR REGIONAL DIFFERENCES IN MANAGEMENT*** +p14_pyield_LPJ_reg(t,i) = (sum(cell(i,j), f14_yields(t,j,"pasture","rainfed") * pm_land_start(j,"past")) / + sum(cell(i,j), pm_land_start(j,"past")) ); + +*' Pasture yield correction: use historical data for all years where available +*' (f14_pyld_hist covers y1965–y2020), freeze at the last available value beyond. +*' This avoids a discontinuity at the t_past boundary by using observed data +*' through y2020 instead of freezing at the last t_past year (y2015). +p14_pyield_corr(t,i) = 0; +p14_pyield_corr(t,i)$(f14_pyld_hist(t,i) > 0) = f14_pyld_hist(t,i) / (p14_pyield_LPJ_reg(t,i) + 0.000001); +loop(t, + p14_pyield_corr(t,i)$(p14_pyield_corr(t,i) = 0) = p14_pyield_corr(t-1,i); +); + +i14_yields_calib(t,j,"pasture",w) = f14_yields(t,j,"pasture",w) * sum(cell(i,j),p14_pyield_corr(t,i)); + + +***YIELD MANAGEMENT CALIBRATION************************************************************ + + +*' @code + +*' The following equations calibrate the cellular yield patterns (`f14_yields`) to match +*' historical reference yields (`i14_calib_target_yields_hist`) by calculating a calibration term called +*' 'i14_managementcalib'. For most cases, 'i14_managementcalib' is the ratio of the historical +*' yields reported by FAO for croplands (`f14_fao_yields_hist`) and regional mean yields (`i14_modeled_yields_hist`) +*' given historic crop area patterns ('fm_croparea') and cellular yields coming from crop models +*' like LPJmL (`f14_yields`). In these cases, 'i14_managementcalib' represents a purely relative +*' calibration factor that depends only on the initial conditions of the starting year. +*' +*' However, when FAO yields are significantly higher than given by the cellular yield inputs +*' (underestimated baseline), the relative calibration terms can lead to unrealistically large +*' yields in the case of future yield increases within the cellular yield patterns. +*' +*' To address this issue, the factor `i14_lambda_yields` determines the degree +*' to which the baseline (FAO) is under- or overestimated and therefore controls +*' whether the calibration factor is applied as an absolute or relative change. +*' For overestimated FAO yields, `i14_lambda_yields` is 1, which is equivalent +*' to an entirely relative calibration. For underestimated yields, `i14_lambda_yields` +*' is calculated as the squared root of the ratio between LPJmL yields and FAO historical +*' yields, and as `i14_lambda_yields` approaches 0, it reduces the applied relative change +*' resulting in a mean change increasingly similar to an additive term (@Heinke.2013). + +*' This concept is referred to as limited calibration, as it limits the calibration +*' to an additive term in case of a strongly underestimated baseline. The scalar +*' `s14_limit_calib` can be used to switch limited calibration on (1) and off (0). + +*' To account for growing period adaption to climate change, two types of yields +*' (one with adaption of growing periods and varieties to changes in climatic conditions (gsadapt) +*' and one with no changes in growing periods and varieties in the future (constgsadapt)) +*' have to be calibrated. +*' The joint parameter `i14_yields_combined(t,j,yldtype,kcr,w)` is used to calibrate +*' both types individually as even though the growing seasons are held constant from 1995 +*' onwards, the yields already differ in 1995 due to long term averaging. + +*** INITIALIZATION of crop yield parameters + +i14_yields_combined(t,j,"constgsadapt",kcr,w) = f14_yields_constgsadapt(t,j,kcr,w); +i14_yields_combined(t,j,"gsadapt",kcr,w) = f14_yields(t,j,kcr,w); + +i14_croparea_total(t_all,w,j) = sum(kcr, fm_croparea(t_all,j,w,kcr)); + +************************************************************************************** +*** STEP 1: CALCULATE modeled regional historical yields + +*' Historic crop area patterns (`fm_croprea`) are used to calculate regional yields +*' (`i14_modeled_yields_hist`) from the given cellular input pattern. In rare cases where +*' a region has no crop area reported for a given crop type, the total crop area is +*' used to calculate a proxy yield for the calibration, given by the following equation: + +i14_modeled_yields_hist(t_past,i,yldtype,knbe14) + = (sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14) * i14_yields_combined(t_past,j,yldtype,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.00001 AND + sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14) * i14_yields_combined(t_past,j,yldtype,knbe14,w)) > 0.00001) + + (sum((cell(i,j),w), i14_croparea_total(t_past,w,j) * i14_yields_combined(t_past,j,yldtype,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.00001 OR + sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14) * i14_yields_combined(t_past,j,yldtype,knbe14,w)) <= 0.00001); + +i14_modeled_yields_hist(t_past,i,yldtype,kbe14) + = sum((cell(i,j),w), i14_croparea_total(t_past,w,j) * i14_yields_combined("y1995",j,yldtype,kbe14,w)) / + sum((cell(i,j),w), i14_croparea_total(t_past,w,j)); + +************************************************************************************** +*** STEP 2: SET CALIB TARGET with FAO for knbe14 and modeled yields for kbe14 + +*' Use FAO data as calibration data for all crop types except bioenergy crops: +i14_calib_target_yields_hist(t,i,knbe14) = f14_fao_yields_hist(t,i,knbe14); + +*' For bioenergy crops, no meaningful calibration target is currently available. The calibration target +*' is set to the regional modeled yield, which results in a calibration factor of 1 and effectively +*' performs no calibration. This is a placeholder implementation that can be replaced with actual +*' calibration data when it becomes available. +i14_calib_target_yields_hist(t,i,kbe14) = i14_modeled_yields_hist("y1995",i,"gsadapt",kbe14); +if (s14_use_gsadapt = 0, + i14_calib_target_yields_hist(t,i,kbe14) = i14_modeled_yields_hist("y1995",i,"constgsadapt",kbe14); +); + +************************************************************************************** +*** STEP 3: LOOP OVER TIME calculating calibration parameters for all time steps + +*' The factor `i14_lambda_yields` is calculated for the initial time step depending +*' on the setting `s14_limit_calib` and is then held constant for all other time steps. +*' The regional calibration target yield and regional yield of the crop model input of +*' the initial time step is kept constant in the two parameters `i14_calib_target_yields_hist` +*' and `i14_modeled_yields_hist`: + +loop(t, + if (sum(sameas(t,"y1995"),1) = 1, + + if ((s14_limit_calib = 0), + i14_lambda_yields(t,i,yldtype,kcr) = 1; + + Elseif (s14_limit_calib = 1 ), + i14_lambda_yields(t,i,yldtype,kcr) = + 1$(i14_calib_target_yields_hist(t,i,kcr) <= i14_modeled_yields_hist(t,i,yldtype,kcr)) + + sqrt(i14_modeled_yields_hist(t,i,yldtype,kcr)/i14_calib_target_yields_hist(t,i,kcr))$ + (i14_calib_target_yields_hist(t,i,kcr) > i14_modeled_yields_hist(t,i,yldtype,kcr)); + ); + + Else + i14_modeled_yields_hist(t,i,yldtype,kcr) = i14_modeled_yields_hist(t-1,i,yldtype,kcr); + i14_calib_target_yields_hist(t,i,kcr) = i14_calib_target_yields_hist(t-1,i,kcr); + i14_lambda_yields(t,i,yldtype,kcr) = i14_lambda_yields(t-1,i,yldtype,kcr); + ); +); + +************************************************************************************** +*** STEP 4: APPLY calculated calibration factors for all time steps + +*' The calibrated cellular yield `i14_yields_calib_combined` is calculated for each time step depending +*' on the constant values `i14_modeled_yields_hist`, `i14_calib_target_yields_hist`, `i14_lambda_yields` +*' and the uncalibrated, cellular yield `f14_yields` following the idea of eq. (9) in [@Heinke.2013]: + +i14_managementcalib(t,j,yldtype,kcr,w) = + 1 + (sum(cell(i,j), i14_calib_target_yields_hist(t,i,kcr) - i14_modeled_yields_hist(t,i,yldtype,kcr)) / + i14_yields_combined(t,j,yldtype,kcr,w) * + (i14_yields_combined(t,j,yldtype,kcr,w) / (sum(cell(i,j),i14_modeled_yields_hist(t,i,yldtype,kcr))+10**(-8))) ** + sum(cell(i,j),i14_lambda_yields(t,i,yldtype,kcr)))$(i14_yields_combined(t,j,yldtype,kcr,w)>0); + + + +i14_yields_calib_combined(t,j,yldtype,kcr,w) = i14_managementcalib(t,j,yldtype,kcr,w) * i14_yields_combined(t,j,yldtype,kcr,w); + +*' Note that the calculation is split into two parts for better readability. + +************************************************************************************** +*' Irrigated yields are calibrated to meet the country-level +*' ratio between irrigated and rainfed yields reported by Aquastat. +*' This can be de-activated with the switch `s14_calib_ir2rf`. +*' This calibration in only done for knbe14 (all crops excluding bioenergy crops) +if ((s14_calib_ir2rf = 1), + +* Weighted yields + i14_calib_yields_hist(i,yldtype,w) + = sum((cell(i,j), knbe14), fm_croparea("y1995",j,"irrigated",knbe14) * i14_yields_calib_combined("y1995",j,yldtype,knbe14,w)) / + sum((cell(i,j), knbe14), fm_croparea("y1995",j,"irrigated",knbe14)); + +* Use irrigated-rainfed ratio of Aquastat if larger than our calculated ratio + i14_calib_yields_ratio(i,yldtype) = i14_calib_yields_hist(i,yldtype,"irrigated") / i14_calib_yields_hist(i,yldtype,"rainfed"); + i14_target_ratio(i,yldtype) = max(i14_calib_yields_ratio(i,yldtype), f14_ir2rf_ratio(i)); + i14_yields_calib_combined(t,j,yldtype,knbe14,"irrigated") = sum((cell(i,j)), i14_target_ratio(i,yldtype) / i14_calib_yields_ratio(i,yldtype)) * + i14_yields_calib_combined(t,j,yldtype,knbe14,"irrigated"); + +* Calibrate newly calibrated yields to calib target yields + i14_modeled_yields_hist2(i,yldtype,knbe14) + = (sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14) * i14_yields_calib_combined("y1995",j,yldtype,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.00001 AND + sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14) * i14_yields_calib_combined("y1995",j,yldtype,knbe14,w)) > 0.00001) + + (sum((cell(i,j),w), i14_croparea_total("y1995",w,j) * i14_yields_calib_combined("y1995",j,yldtype,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.00001 OR + sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14) * i14_yields_calib_combined("y1995",j,yldtype,knbe14,w)) <= 0.00001); + + + i14_yields_calib_combined(t,j,yldtype,knbe14,w) = sum((cell(i,j)), i14_calib_target_yields_hist("y1995",i,knbe14) / + i14_modeled_yields_hist2(i,yldtype,knbe14)) * + i14_yields_calib_combined(t,j,yldtype,knbe14,w); +); + +***MANAGEMENT CALIBRATION FOR 2ND GENERATION BIOENERGY CROPS (tau scaling)**************** +*' Tau-based management calibration applied on top of the biophysical yields. +i14_yields_calib_combined(t,j,yldtype,kbe14,w) = i14_yields_calib_combined(t,j,yldtype,kbe14,w) * + sum((supreg(h,i),cell(i,j)),fm_tau1995(h))/smax(h,fm_tau1995(h)); +******************************************************************************************* + +* Set yields to gsadapt values (pasture yields are not affected by growing period adaption) + +if (s14_use_gsadapt = 1, + pm_yields_semi_calib(j,knbe14,w) = i14_yields_calib_combined("y1995",j,"gsadapt",knbe14,w); + i14_yields_calib(t,j,kcr,w) = i14_yields_calib_combined(t,j,"gsadapt",kcr,w); + else + pm_yields_semi_calib(j,knbe14,w) = i14_yields_calib_combined("y1995",j,"constgsadapt",knbe14,w); + i14_yields_calib(t,j,kcr,w) = i14_yields_calib_combined(t,j,"constgsadapt",kcr,w); +); + +*' @stop + + +***YIELD CALIBRATION*********************************************************************** + +*' @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 +*' 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 +if (s14_use_yield_calib = 0 OR sum((i,ltype14),f14_yld_calib(i,ltype14)) = 0, + f14_yld_calib(i,ltype14) = 1; +); + + +i14_yields_calib(t,j,kcr,w) = i14_yields_calib(t,j,kcr,w) + * sum(cell(i,j),f14_yld_calib(i,"crop")); +i14_yields_calib(t,j,"pasture",w) = i14_yields_calib(t,j,"pasture",w) + * sum(cell(i,j),f14_yld_calib(i,"past")); + +* Set effective pasture spillover parameter to regional dynamic value + i14_yld_past_switch_eff(t,i) = f14_yld_past_switch(t,i); + +* If static spillover mode, override with scalar value +if (s14_past_spillover_mode = 0, + i14_yld_past_switch_eff(t,i) = s14_yld_past_switch; +); + +*' @stop + +*' @code +*' Land degradation can negatively affect yields. Soil loss for example can +*' notably affect land productivity. Similarly, the yield of pollinator-dependent crops +*' is reduced when there is a lack of pollinators. To account for the impacts of degradation, +*' calibrated yields are multiplied by the share of land with intact NCP in each cell and specific +*' yield reduction coefficients that represent yield loss due to soil erosion and pollination +*' deficiency on non-intact land. + +* set default values in case of missing input file. +if (sum((t,j,ncp_type14),f14_yld_ncp_report(t,j,ncp_type14)) = 0, + f14_yld_ncp_report(t,j,ncp_type14) = 1; +); + +if ((s14_degradation = 1), + i14_yields_calib(t,j,kcr,w) = i14_yields_calib(t,j,kcr,w) * (1 - s14_yld_reduction_soil_loss) + + i14_yields_calib(t,j,kcr,w) * s14_yld_reduction_soil_loss * f14_yld_ncp_report(t,j,"soil_intact"); + i14_yields_calib(t,j,kcr,w) = i14_yields_calib(t,j,kcr,w) * (1 - f14_kcr_pollinator_dependence(kcr)) + + i14_yields_calib(t,j,kcr,w) * f14_kcr_pollinator_dependence(kcr) * f14_yld_ncp_report(t,j,"poll_suff"); +); + +*' @stop diff --git a/modules/14_yields/dynRegPastrTau_apr26/presolve.gms b/modules/14_yields/gsadapt_dynPastrTau_jul26/presolve.gms similarity index 70% rename from modules/14_yields/dynRegPastrTau_apr26/presolve.gms rename to modules/14_yields/gsadapt_dynPastrTau_jul26/presolve.gms index 65d7cd4c80..ca32c64219 100644 --- a/modules/14_yields/dynRegPastrTau_apr26/presolve.gms +++ b/modules/14_yields/gsadapt_dynPastrTau_jul26/presolve.gms @@ -79,3 +79,36 @@ im_growing_stock(t,j,ac,land_natveg)$(im_growing_stock(t,j,ac,land_natveg) < s14 ** Apply the same positivity and minimum-growing-stock clamps to the youngsecdf growing stock im_growing_stock_ysf(t,j,ac) = im_growing_stock_ysf(t,j,ac)$(im_growing_stock_ysf(t,j,ac) > 0) + 0.0001$(im_growing_stock_ysf(t,j,ac) = 0); im_growing_stock_ysf(t,j,ac)$(im_growing_stock_ysf(t,j,ac) < s14_minimum_growing_stock) = 0; + +* Calculate growing period adaption factor based on previous croppping pattern +if (ord(t) = 1, + + p14_yields_gsadapt_ratio(t,i) = 1; + p14_yields_gsadapt_ratio_previous(t,i) = 1; + pm_yields_gsadapt_ratio_increment(t,i) = 1; + p14_yields_gsadapt_ratio_cumulative(t,i) = 1; + +else + + p14_yields_gsadapt_ratio(t,i) = + sum((cell(i,j),w,kcr), i14_yields_calib_combined(t,j,"gsadapt",kcr,w) * pcm_area(j,w,kcr)) / + sum((cell(i,j),w,kcr), i14_yields_calib_combined(t,j,"constgsadapt",kcr,w) * pcm_area(j,w,kcr)); + + p14_yields_gsadapt_ratio_previous(t,i) = + sum((cell(i,j),w,kcr), i14_yields_calib_combined(t-1,j,"gsadapt",kcr,w) * pcm_area(j,w,kcr)) / + sum((cell(i,j),w,kcr), i14_yields_calib_combined(t-1,j,"constgsadapt",kcr,w) * pcm_area(j,w,kcr)); + + pm_yields_gsadapt_ratio_increment(t,i) = p14_yields_gsadapt_ratio(t,i) / p14_yields_gsadapt_ratio_previous(t,i); +* The max(1,...) ensures the cumulative factor can only grow, never shrink. +* This means declining adaptation opportunities are not represented — once +* adaptation gains are accounted for via tau, they cannot be reversed. + p14_yields_gsadapt_ratio_cumulative(t,i) = max(1,pm_yields_gsadapt_ratio_increment(t,i)) * p14_yields_gsadapt_ratio_cumulative(t-1,i); + +); + +if(s14_gsadapt2tau = 0 OR s14_use_gsadapt = 0, + pm_yields_gsadapt_ratio_increment(t,i) = 1; + p14_yields_gsadapt_ratio_cumulative(t,i) = 1; +); + +*** EOF presolve.gms *** diff --git a/modules/14_yields/gsadapt_dynPastrTau_jul26/realization.gms b/modules/14_yields/gsadapt_dynPastrTau_jul26/realization.gms new file mode 100644 index 0000000000..9090ed76dc --- /dev/null +++ b/modules/14_yields/gsadapt_dynPastrTau_jul26/realization.gms @@ -0,0 +1,49 @@ +*** | (C) 2008-2026 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-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 gsadapt_dynRegPastrTau realization reads in the LPJmL data +*' accounts for growing period adaption to climate change and also performs a number +*' of calibrations. (1) Crop yields are calibrated to FAO [@FAOSTAT] regional yield +*' levels of the initial time step. (2) Bioenergy yields are corrected using the +*' $\tau$ factor representing agricultural land-use intensity. (3) Pasture yields are +*' calculated based on pasture demand to account for intensification and extensification +*' of managed grasslands. Optionally, irrigated yields are scaled to meet the irrigated- +*' to-rainfed yield ratio as provided by AQUASTAT [@fao_aquastat_2016]. +*' +*' In addition, technological change in the crop sector can spill over to pasture yields, +*' with the magnitude of the spillover determined by the regional, time-varying input +*' parameter f14_yld_past_switch (t_all,i). A value of 0 implies no spillover, while a +*' value of 1 implies full spillover equal to the crop-sector intensification rate. +*' Technological spillover from the crop sector to pasture yields is controlled by +*' s14_past_spillover_mode. +*' * Mode 0 uses the static scalar s14_yld_past_switch +*' * Mode 1 can use regional, time-varying parameter provided by +*' f14_yld_past_switch(t_all,i) (default input is static though) +*' In both modes, 0 disables spillover and 1 applies the full crop-sector intensification rate. +*' +*' This realization also calculates harvestable growing stock (`im_growing_stock`) as +*' stem biomass (tDM/ha) by dividing aboveground biomass by the IPCC biomass expansion +*' factor (BEF). BEF is always > 1 and converts total aboveground biomass to stem-only biomass. +*' +*' @limitations The exogenous implementation of pasture intensification cannot +*' capture feedbacks between land scarcity and efforts to improve pasture +*' management. Moreover, the magnitude of spillover effects from technological change +*' in the crop sector towards improvements in pasture management is very uncertain +*' and may vary across regions and time periods. + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/14_yields/gsadapt_dynPastrTau_jul26/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/14_yields/gsadapt_dynPastrTau_jul26/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/14_yields/gsadapt_dynPastrTau_jul26/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/14_yields/gsadapt_dynPastrTau_jul26/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/14_yields/gsadapt_dynPastrTau_jul26/scaling.gms" +$Ifi "%phase%" == "preloop" $include "./modules/14_yields/gsadapt_dynPastrTau_jul26/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/14_yields/gsadapt_dynPastrTau_jul26/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/14_yields/gsadapt_dynPastrTau_jul26/postsolve.gms" +$Ifi "%phase%" == "nl_fix" $include "./modules/14_yields/gsadapt_dynPastrTau_jul26/nl_fix.gms" +$Ifi "%phase%" == "nl_release" $include "./modules/14_yields/gsadapt_dynPastrTau_jul26/nl_release.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/14_yields/dynRegPastrTau_apr26/scaling.gms b/modules/14_yields/gsadapt_dynPastrTau_jul26/scaling.gms similarity index 100% rename from modules/14_yields/dynRegPastrTau_apr26/scaling.gms rename to modules/14_yields/gsadapt_dynPastrTau_jul26/scaling.gms diff --git a/modules/14_yields/dynRegPastrTau_apr26/sets.gms b/modules/14_yields/gsadapt_dynPastrTau_jul26/sets.gms similarity index 86% rename from modules/14_yields/dynRegPastrTau_apr26/sets.gms rename to modules/14_yields/gsadapt_dynPastrTau_jul26/sets.gms index 368f8a547d..60354dbd48 100644 --- a/modules/14_yields/dynRegPastrTau_apr26/sets.gms +++ b/modules/14_yields/gsadapt_dynPastrTau_jul26/sets.gms @@ -30,7 +30,13 @@ sets oilpalm, puls_pro, potato, cassav_sp, sugr_cane, sugr_beet, others, foddr, cottn_pro / - ncp_type14 natures contributions to people (NCP) relevant for agricultural yields + kbe14(kcr) Bioenergy cropping activities + / begr, betr / + + ncp_type14 Natures contributions to people (NCP) relevant for agricultural yields / soil_intact, poll_suff / + yldtype Yield LPJmL run type with or without growing season adaptation + / gsadapt, constgsadapt / + ; diff --git a/modules/14_yields/input/files b/modules/14_yields/input/files index 9ae89904df..d604724dad 100644 --- a/modules/14_yields/input/files +++ b/modules/14_yields/input/files @@ -1,7 +1,9 @@ * list of files that are required here lpj_yields.cs3 +lpj_yields_constgsadapt.cs3 f14_yld_calib.csv lpj_yields_0.5.mz +lpj_yields_constgsadapt_0.5.mz f14_pasture_yields_hist.csv f14_ipcc_bef.cs3 f14_aboveground_fraction.csv diff --git a/modules/14_yields/managementcalib_aug19/equations.gms b/modules/14_yields/managementcalib_aug19/equations.gms deleted file mode 100644 index bd8857f4cd..0000000000 --- a/modules/14_yields/managementcalib_aug19/equations.gms +++ /dev/null @@ -1,39 +0,0 @@ -*** | (C) 2008-2025 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @equations - -***CROP YIELD CALCULATIONS********************************************** - -*' Technological change can increase the initial calibrated yields by: - -q14_yield_crop(j2,kcr,w) .. - vm_yld(j2,kcr,w) =e= sum(ct,i14_yields_calib(ct,j2,kcr,w)) * - vm_tau(j2,"crop") / sum((cell(i2,j2), supreg(h2,i2)), fm_tau1995(h2)); - -*' For the current time step of the optimization, cellular yields of irrigated -*' and rainfed crops are calculated by multiplying calibrated input yields from -*' LPJmL with the intensification rate relative to the initial time step 1995. - -***PASTURE YIELD CALCULATIONS******************************************* - -*' In the case of pasture yields, technological change cannot be fully -*' translated into yield increases, to address that, an exogenous pasture management -*' factor `pm_past_mngmnt_factor` is used to scale pasture yields based on the -*' number of cattle reared to fulfill the domestic demand for ruminant livestock -*' products in module 70. -*' -*' Additionally, the parameter `s14_yld_past_switch` can be used to capture a -*' certain magnitude of spillovers of the yield increase due to technological -*' change from the time step before. It can range from 0 (no spillover) to 1 -*' (full spillover). - -q14_yield_past(j2,w) .. - vm_yld(j2,"pasture",w) =e= - sum(ct,(i14_yields_calib(ct,j2,"pasture",w)) - * sum(cell(i2,j2),pm_past_mngmnt_factor(ct,i2))) - * (1 + s14_yld_past_switch*(sum((cell(i2,j2), supreg(h2,i2)), pcm_tau(j2, "crop")/fm_tau1995(h2)) - 1)); diff --git a/modules/14_yields/managementcalib_aug19/input.gms b/modules/14_yields/managementcalib_aug19/input.gms deleted file mode 100644 index 49cbcc4078..0000000000 --- a/modules/14_yields/managementcalib_aug19/input.gms +++ /dev/null @@ -1,96 +0,0 @@ -*** | (C) 2008-2025 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -$setglobal c14_yields_scenario cc -* options: cc (climate change) -* nocc (no climate change) -* nocc_hist (no climate change after year defined by sm_fix_cc) - - -scalars -s14_limit_calib Relative managament calibration switch (1=limited 0=pure relative) / 1 / -s14_calib_ir2rf Switch to calibrate rainfed to irrigated yield ratios (1=calib 0=not calib) / 1 / -s14_degradation Switch to include yield impacts of land degradation(0=no degradation 1=with degradation) / 0 / -s14_use_yield_calib Switch for using or not using yield calibration factors from the preprocessing (1=use facs 0=not use facs) / 0 / -s14_minimum_growing_stock Minimum growing stock for timber harvest in natural vegetation (tDM per ha) / 5 / -s14_yld_past_switch Spillover parameter for translating technological change in the crop sector into pasture yieldincreases (1) / 0.25 / -s14_yld_reduction_soil_loss Decline of land productivity in areas with severe soil loss (1) / 0.08 / -sm_carbon_fraction Carbon fraction of dry matter (tC per tDM) / 0.5 / -; - - -******* Calibration factor -$onEmpty -table f14_yld_calib(i,ltype14) Calibration factor for the LPJmL yields (1) -$ondelim -$if exist "./modules/14_yields/input/f14_yld_calib.csv" $include "./modules/14_yields/input/f14_yld_calib.csv" -$offdelim -; -$offEmpty - -table f14_yields(t_all,j,kve,w) LPJmL potential yields per cell (rainfed and irrigated) (tDM per ha per yr) -$ondelim -$include "./modules/14_yields/input/lpj_yields.cs3" -$offdelim -; -* set values to 1995 if nocc scenario is used, or to sm_fix_cc after sm_fix_cc if nocc_hist is used -$if "%c14_yields_scenario%" == "nocc" f14_yields(t_all,j,kve,w) = f14_yields("y1995",j,kve,w); -$if "%c14_yields_scenario%" == "nocc_hist" f14_yields(t_all,j,kve,w)$(m_year(t_all) > sm_fix_cc) = f14_yields(t_all,j,kve,w)$(m_year(t_all) = sm_fix_cc); -m_fillmissingyears(f14_yields,"j,kve,w"); - -table f14_pyld_hist(t_all,i) Modelled regional pasture yields in the past (tDM per ha per yr) -$ondelim -$include "./modules/14_yields/input/f14_pasture_yields_hist.csv" -$offdelim; - - -table f14_fao_yields_hist(t_all,i,kcr) FAO yields per region (tDM per ha per yr) -$ondelim -$include "./modules/14_yields/managementcalib_aug19/input/f14_region_yields.cs3" -$offdelim -; -m_fillmissingyears(f14_fao_yields_hist,"i,kcr"); - -parameter f14_ir2rf_ratio(i) AQUASTAT ratio of irrigated to rainfed yields per region (1) -/ -$ondelim -$include "./modules/14_yields/managementcalib_aug19/input/f14_ir2rf_ratio.cs4" -$offdelim -/ -; - -parameter fm_ipcc_bef(clcl) IPCC biomass expansion factor BEF (1) -/ -$ondelim -$include "./modules/14_yields/input/f14_ipcc_bef.cs3" -$offdelim -/ -; - -parameter fm_aboveground_fraction(land_timber) Aboveground fraction of total biomass (1) -/ -$ondelim -$include "./modules/14_yields/input/f14_aboveground_fraction.csv" -$offdelim -/ -; - -$onEmpty -table f14_yld_ncp_report(t_all,j,ncp_type14) Share of land with intact natures contributions to people (NCP) (1) -$ondelim -$if exist "./modules/14_yields/input/f14_yld_ncp_report.cs3" $include "./modules/14_yields/input/f14_yld_ncp_report.cs3" -$offdelim -; -$offEmpty - -parameter f14_kcr_pollinator_dependence(kcr) Share of total yield dependent on biotic pollination (1) -/ -$ondelim -$include "./modules/14_yields/input/f14_kcr_pollinator_dependence.csv" -$offdelim -/ -; diff --git a/modules/14_yields/managementcalib_aug19/input/files b/modules/14_yields/managementcalib_aug19/input/files deleted file mode 100644 index 6f075de39f..0000000000 --- a/modules/14_yields/managementcalib_aug19/input/files +++ /dev/null @@ -1,3 +0,0 @@ -* list of files that are required here -f14_region_yields.cs3 -f14_ir2rf_ratio.cs4 diff --git a/modules/14_yields/managementcalib_aug19/nl_fix.gms b/modules/14_yields/managementcalib_aug19/nl_fix.gms deleted file mode 100644 index 07339b646d..0000000000 --- a/modules/14_yields/managementcalib_aug19/nl_fix.gms +++ /dev/null @@ -1,11 +0,0 @@ -*** | (C) 2008-2025 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -* ### nl_fix ### - -vm_yld.fx(j,kcr,w) = sum(ct,i14_yields_calib(ct,j,kcr,w)) * sum((cell(i,j), supreg(h,i)),vm_tau.l(h, "crop") / fm_tau1995(h)); -vm_yld.fx(j,"pasture",w) = sum(ct,(i14_yields_calib(ct,j,"pasture",w)) * sum(cell(i,j), pm_past_mngmnt_factor(ct,i))) * (1 + s14_yld_past_switch * (sum((cell(i,j), supreg(h,i)), pcm_tau(h, "crop") / fm_tau1995(h)) - 1)); diff --git a/modules/14_yields/managementcalib_aug19/nl_release.gms b/modules/14_yields/managementcalib_aug19/nl_release.gms deleted file mode 100644 index f3261b8f87..0000000000 --- a/modules/14_yields/managementcalib_aug19/nl_release.gms +++ /dev/null @@ -1,11 +0,0 @@ -*** | (C) 2008-2025 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -* ### nl_release ### - -vm_yld.lo(j,kve,w) = 0; -vm_yld.up(j,kve,w) = Inf; diff --git a/modules/14_yields/managementcalib_aug19/postsolve.gms b/modules/14_yields/managementcalib_aug19/postsolve.gms deleted file mode 100644 index 398d8cf124..0000000000 --- a/modules/14_yields/managementcalib_aug19/postsolve.gms +++ /dev/null @@ -1,24 +0,0 @@ -*** | (C) 2008-2025 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - - - - -*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_yld(t,j,kve,w,"marginal") = vm_yld.m(j,kve,w); - oq14_yield_crop(t,j,kcr,w,"marginal") = q14_yield_crop.m(j,kcr,w); - oq14_yield_past(t,j,w,"marginal") = q14_yield_past.m(j,w); - ov_yld(t,j,kve,w,"level") = vm_yld.l(j,kve,w); - oq14_yield_crop(t,j,kcr,w,"level") = q14_yield_crop.l(j,kcr,w); - oq14_yield_past(t,j,w,"level") = q14_yield_past.l(j,w); - ov_yld(t,j,kve,w,"upper") = vm_yld.up(j,kve,w); - oq14_yield_crop(t,j,kcr,w,"upper") = q14_yield_crop.up(j,kcr,w); - oq14_yield_past(t,j,w,"upper") = q14_yield_past.up(j,w); - ov_yld(t,j,kve,w,"lower") = vm_yld.lo(j,kve,w); - oq14_yield_crop(t,j,kcr,w,"lower") = q14_yield_crop.lo(j,kcr,w); - oq14_yield_past(t,j,w,"lower") = q14_yield_past.lo(j,w); -*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/14_yields/managementcalib_aug19/preloop.gms b/modules/14_yields/managementcalib_aug19/preloop.gms deleted file mode 100644 index 90ed57ae81..0000000000 --- a/modules/14_yields/managementcalib_aug19/preloop.gms +++ /dev/null @@ -1,197 +0,0 @@ -*** | (C) 2008-2025 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -i14_yields_calib(t,j,kve,w) = f14_yields(t,j,kve,w); - -***YIELD CORRECTION FOR 2ND GENERATION BIOENERGY CROPS************************************* -i14_yields_calib(t,j,"begr",w) = f14_yields(t,j,"begr",w) * sum((supreg(h,i),cell(i,j)),fm_tau1995(h))/smax(h,fm_tau1995(h)); -i14_yields_calib(t,j,"betr",w) = f14_yields(t,j,"betr",w) * sum((supreg(h,i),cell(i,j)),fm_tau1995(h))/smax(h,fm_tau1995(h)); - -***YIELD CORRECTION FOR PASTURE ACCOUNTING FOR REGIONAL DIFFERENCES IN MANAGEMENT*** -p14_pyield_LPJ_reg(t,i) = (sum(cell(i,j),i14_yields_calib(t,j,"pasture","rainfed") * pm_land_start(j,"past")) / - sum(cell(i,j),pm_land_start(j,"past")) ); - -*' Pasture yield correction: use historical data for all years where available -*' (f14_pyld_hist covers y1965–y2020), freeze at the last available value beyond. -*' This avoids a discontinuity at the t_past boundary by using observed data -*' through y2020 instead of freezing at the last t_past year (y2015). -p14_pyield_corr(t,i)$(f14_pyld_hist(t,i) > 0) = f14_pyld_hist(t,i) / (p14_pyield_LPJ_reg(t,i) + 0.000001); -loop(t, - p14_pyield_corr(t,i)$(p14_pyield_corr(t,i) = 0) = p14_pyield_corr(t-1,i); -); - -i14_yields_calib(t,j,"pasture",w) = i14_yields_calib(t,j,"pasture",w) * sum(cell(i,j),p14_pyield_corr(t,i)); - - -***YIELD MANAGEMENT CALIBRATION************************************************************ - - -*' @code - -*' The following equations calibrate the cellular yield patterns (`f14_yields`) to match -*' FAO historical yields (`f14_fao_yields_hist`) by calculating a calibration term called -*' 'i14_managementcalib'. For most cases, 'i14_managementcalib' is the ratio of the historical -*' yields reported by FAO (`f14_fao_yields_hist`) and regional mean yields (`i14_modeled_yields_hist`) -*' given historic crop area patterns ('fm_croparea') and cellular yields coming from crop models -*' like LPJmL (`f14_yields`). In these cases, 'i14_managementcalib' represents a purely relative -*' calibration factor that depends only on the initial conditions of the starting year. -*' -*' However, when FAO yields are significantly higher than given by the cellular yield inputs -*' (underestimated baseline), the relative calibration terms can lead to unrealistically large -*' yields in the case of future yield increases within the cellular yield patterns. -*' -*' To address this issue, the factor `i14_lambda_yields` determines the degree -*' to which the baseline (FAO) is under- or overestimated and therefore controls -*' whether the calibration factor is applied as an absolute or relative change. -*' For overestimated FAO yields, `i14_lambda_yields` is 1, which is equivalent -*' to an entirely relative calibration. For underestimated yields, `i14_lambda_yields` -*' is calculated as the squared root of the ratio between LPJmL yields and FAO historical -*' yields, and as `i14_lambda_yields` approaches 0, it reduces the applied relative change -*' resulting in a mean change increasingly similar to an additive term (@Heinke.2013). - -*' This concept is referred to as limited calibration, as it limits the calibration -*' to an additive term in case of a strongly underestimated baseline. The scalar -*' `s14_limit_calib` can be used to switch limited calibration on (1) and off (0). - -i14_croparea_total(t_all,w,j) = sum(kcr, fm_croparea(t_all,j,w,kcr)); - -*' Historic crop area patterns (`fm_croprea`) are used to calculate regional yields -*' (`i14_modeled_yields_hist`) from the given cellular input pattern. In rare cases where -*' a region has no crop area reported for a given crop type, the total crop area is -*' used to calculate a proxy yield for the calibration, given by the following equation: - -i14_modeled_yields_hist(t_past,i,knbe14) - = (sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14) * f14_yields(t_past,j,knbe14,w)) / - sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14)))$(sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14)) > 0.00001 AND - sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14) * f14_yields(t_past,j,knbe14,w)) > 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.00001 OR - sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14) * f14_yields(t_past,j,knbe14,w)) <= 0.00001); - - -*' The factor `i14_lambda_yields` is calculated for the initial time step depending -*' on the setting `s14_limit_calib` and is then held constant for all other time steps. -*' The regional FAO yield and regional yield of the crop model input of the initial -*' time step is kept constant in the two parameters `i14_fao_yields_hist` and -*' `i14_modeled_yields_hist`: - -loop(t, - if(sum(sameas(t,"y1995"),1)=1, - - if ((s14_limit_calib = 0), - i14_lambda_yields(t,i,knbe14) = 1; - - Elseif (s14_limit_calib =1 ), - i14_lambda_yields(t,i,knbe14) = - 1$(f14_fao_yields_hist(t,i,knbe14) <= i14_modeled_yields_hist(t,i,knbe14)) - + sqrt(i14_modeled_yields_hist(t,i,knbe14)/f14_fao_yields_hist(t,i,knbe14))$ - (f14_fao_yields_hist(t,i,knbe14) > i14_modeled_yields_hist(t,i,knbe14)); - ); - - i14_fao_yields_hist(t,i,knbe14) = f14_fao_yields_hist(t,i,knbe14); - - Else - i14_modeled_yields_hist(t,i,knbe14) = i14_modeled_yields_hist(t-1,i,knbe14); - i14_fao_yields_hist(t,i,knbe14) = i14_fao_yields_hist(t-1,i,knbe14); - i14_lambda_yields(t,i,knbe14) = i14_lambda_yields(t-1,i,knbe14); - ); -); - -*' The calibrated cellular yield `i14_yields_calib` is calculated for each time step depending -*' on the constant values `i14_modeled_yields_hist`, `i14_fao_yields_hist`, `i14_lambda_yields` -*' and the uncalibrated, cellular yield `f14_yields` following the idea of eq. (9) in [@Heinke.2013]: - -i14_managementcalib(t,j,knbe14,w) = - 1 + (sum(cell(i,j), i14_fao_yields_hist(t,i,knbe14) - i14_modeled_yields_hist(t,i,knbe14)) / - f14_yields(t,j,knbe14,w) * - (f14_yields(t,j,knbe14,w) / (sum(cell(i,j),i14_modeled_yields_hist(t,i,knbe14))+10**(-8))) ** - sum(cell(i,j),i14_lambda_yields(t,i,knbe14)))$(f14_yields(t,j,knbe14,w)>0); - - -i14_yields_calib(t,j,knbe14,w) = i14_managementcalib(t,j,knbe14,w) * f14_yields(t,j,knbe14,w); -pm_yields_semi_calib(j,knbe14,w) = i14_yields_calib("y1995",j,knbe14,w); - -*' Note that the calculation is split into two parts for better readability. - -*' Irrigated yields are calibrated to meet the country-level -*' ratio between irrigated and rainfed yields reported by Aquastat. -*' This can be de-activated with the switch `s14_calib_ir2rf`. -if ((s14_calib_ir2rf = 1), - -* Weighted yields - i14_calib_yields_hist(i,w) - = sum((cell(i,j), knbe14), fm_croparea("y1995",j,"irrigated",knbe14) * i14_yields_calib("y1995",j,knbe14,w)) / - sum((cell(i,j), knbe14), fm_croparea("y1995",j,"irrigated",knbe14)); - -* Use irrigated-rainfed ratio of Aquastat if larger than our calculated ratio - i14_calib_yields_ratio(i) = i14_calib_yields_hist(i,"irrigated") / i14_calib_yields_hist(i,"rainfed"); - i14_target_ratio(i) = max(i14_calib_yields_ratio(i), f14_ir2rf_ratio(i)); - i14_yields_calib(t,j,knbe14,"irrigated") = sum((cell(i,j)), i14_target_ratio(i) / i14_calib_yields_ratio(i)) * - i14_yields_calib(t,j,knbe14,"irrigated"); - -* Calibrate newly calibrated yields to FAO yields - i14_modeled_yields_hist2(i,knbe14) - = (sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14) * i14_yields_calib("y1995",j,knbe14,w)) / - sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14)))$(sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14)) > 0.00001 AND - sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14) * i14_yields_calib("y1995",j,knbe14,w)) > 0.00001) - + (sum((cell(i,j),w), i14_croparea_total("y1995",w,j) * i14_yields_calib("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.00001 OR - sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14) * i14_yields_calib("y1995",j,knbe14,w)) <= 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)) * - i14_yields_calib(t,j,knbe14,w); - - pm_yields_semi_calib(j,knbe14,w) = i14_yields_calib("y1995",j,knbe14,w); -); - -*' @stop - - -***YIELD CALIBRATION*********************************************************************** - -*' @code -*' Calibrated yields 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 -*' 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 -if(s14_use_yield_calib = 0 OR sum((i,ltype14),f14_yld_calib(i,ltype14)) = 0, - f14_yld_calib(i,ltype14) = 1; -); - - -i14_yields_calib(t,j,kcr,w) = i14_yields_calib(t,j,kcr,w) - * sum(cell(i,j),f14_yld_calib(i,"crop")); -i14_yields_calib(t,j,"pasture",w) = i14_yields_calib(t,j,"pasture",w) - * sum(cell(i,j),f14_yld_calib(i,"past")); - -*' @stop - -*' @code -*' Land degradation can negatively affect yields. Soil loss for example can -*' notably affect land productivity. Similarly, the yield of pollinator-dependent crops -*' is reduced when there is a lack of pollinators. To account for the impacts of degradation, -*' calibrated yields are multiplied by the share of land with intact NCP in each cell and specific -*' yield reduction coefficients that represent yield loss due to soil erosion and pollination -*' deficiency on non-intact land. - -* set default values in case of missing input file. -if(sum((t,j,ncp_type14),f14_yld_ncp_report(t,j,ncp_type14)) = 0, - f14_yld_ncp_report(t,j,ncp_type14) = 1; -); - -if ((s14_degradation = 1), - i14_yields_calib(t,j,kcr,w) = i14_yields_calib(t,j,kcr,w) * (1 - s14_yld_reduction_soil_loss) - + i14_yields_calib(t,j,kcr,w) * s14_yld_reduction_soil_loss * f14_yld_ncp_report(t,j,"soil_intact"); - i14_yields_calib(t,j,kcr,w) = i14_yields_calib(t,j,kcr,w) * (1 - f14_kcr_pollinator_dependence(kcr)) - + i14_yields_calib(t,j,kcr,w) * f14_kcr_pollinator_dependence(kcr) * f14_yld_ncp_report(t,j,"poll_suff"); -); - -*' @stop diff --git a/modules/14_yields/managementcalib_aug19/presolve.gms b/modules/14_yields/managementcalib_aug19/presolve.gms deleted file mode 100644 index 86b9a8f5aa..0000000000 --- a/modules/14_yields/managementcalib_aug19/presolve.gms +++ /dev/null @@ -1,81 +0,0 @@ -*** | (C) 2008-2025 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*** EOF presolve.gms *** - -* calculate carbon density - -*** HARVESTABLE GROWING STOCK - -*' `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 `sm_carbon_fraction` in tC/tDM. For assessing wood harvesting -*' we need only aboveground biomass information, therefore we multiply with -*' aboveground `fm_aboveground_fraction`. Additionally, we divide aboveground -*' tree biomass by the Biomass Expansion Factor (BEF, dimensionless) to get -*' stem biomass in tDM/ha. BEF = AGB (aboveground biomass) / stem_biomass (always > 1). - -*' @code - -im_growing_stock(t,j,ac,"forestry") = - ( - pm_carbon_density_plantation_ac(t,j,ac,"vegc") - / sm_carbon_fraction - * fm_aboveground_fraction("forestry") - / sum(clcl, pm_climate_class(j,clcl) * fm_ipcc_bef(clcl)) - ) - ; - -im_growing_stock(t,j,ac,"primforest") = - ( - fm_carbon_density(t,j,"primforest","vegc") - / sm_carbon_fraction - * fm_aboveground_fraction("primforest") - / sum(clcl, pm_climate_class(j,clcl) * fm_ipcc_bef(clcl)) - ) - ; - -im_growing_stock(t,j,ac,"secdforest") = - ( - pm_carbon_density_secdforest_ac(t,j,ac,"vegc") - / sm_carbon_fraction - * fm_aboveground_fraction("secdforest") - / sum(clcl, pm_climate_class(j,clcl) * fm_ipcc_bef(clcl)) - ) - ; - -im_growing_stock(t,j,ac,"other") = - ( - pm_carbon_density_other_ac(t,j,ac,"vegc") - / sm_carbon_fraction - * fm_aboveground_fraction("other") - / sum(clcl, pm_climate_class(j,clcl) * fm_ipcc_bef(clcl)) - ) - ; - -*' Growing stock for young secondary forest (youngsecdf) regrowing on other land. -*' It is derived from the *uncalibrated* secondary-forest carbon curve (the same -*' curve youngsecdf carbon uses in 35_natveg), with the secondary-forest aboveground -*' fraction, so that its wood yield and its carbon stock are consistent. -im_growing_stock_ysf(t,j,ac) = - ( - pm_carbon_density_secdforest_ac_uncalib(t,j,ac,"vegc") - / sm_carbon_fraction - * fm_aboveground_fraction("secdforest") - / sum(clcl, pm_climate_class(j,clcl) * fm_ipcc_bef(clcl)) - ) - ; - -*' @stop - -** Hard constraint to always have a positive number in im_growing_stock -im_growing_stock(t,j,ac,land_timber) = im_growing_stock(t,j,ac,land_timber)$(im_growing_stock(t,j,ac,land_timber) > 0) + 0.0001$(im_growing_stock(t,j,ac,land_timber) = 0); -** Set growing stock to 0 where it does not exceed a minimum for harvest -im_growing_stock(t,j,ac,land_natveg)$(im_growing_stock(t,j,ac,land_natveg) < s14_minimum_growing_stock) = 0; -** Apply the same positivity and minimum-growing-stock clamps to the youngsecdf growing stock -im_growing_stock_ysf(t,j,ac) = im_growing_stock_ysf(t,j,ac)$(im_growing_stock_ysf(t,j,ac) > 0) + 0.0001$(im_growing_stock_ysf(t,j,ac) = 0); -im_growing_stock_ysf(t,j,ac)$(im_growing_stock_ysf(t,j,ac) < s14_minimum_growing_stock) = 0; diff --git a/modules/14_yields/managementcalib_aug19/realization.gms b/modules/14_yields/managementcalib_aug19/realization.gms deleted file mode 100644 index a2b52b06b3..0000000000 --- a/modules/14_yields/managementcalib_aug19/realization.gms +++ /dev/null @@ -1,41 +0,0 @@ -*** | (C) 2008-2025 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @description The managementcalib_aug19 realization reads in the LPJmL data and -*' performs a number of calibrations. First, a bioenergy yield correction is performed. -*' As there is currently no robust information on bioenergy yields available in -*' [@FAOSTAT], it is assumed that the LPJmL yields for bioenergy correspond to the -*' yields achieved under the highest currently observed value of the $\tau$ factor -*' representing agricultural land-use intensity. Secondly, pasture yields are calculated -*' based on pasture demand to account for in- and extensification of managed grasslands. -*' Thirdly, irrigated yields are scaled to meet the irrigated-to-rainfed yield -*' ratio as provided by AQUASTAT [@fao_aquastat_2016]. -*' Finally, crop yields are calibrated to FAO [@FAOSTAT] regional yield levels of the -*' initial time step. An additional feature of this realization is to allow crop yields -*' technological change from the precedent times step to spillover to pasture areas. -*' This realization also calculates harvestable growing stock (`im_growing_stock`) as -*' stem biomass (tDM/ha) by dividing aboveground biomass by the IPCC biomass expansion -*' factor (BEF). BEF is always > 1 and converts total aboveground biomass to stem-only biomass. - -*' @limitations The exogenous implementation of pasture intensification cannot -*' capture feedbacks between land scarcity and efforts to improve pasture -*' management. Moreover, the magnitude of spillover effects from technological change -*' in the crop sector towards improvements in pasture management is very uncertain. - - -*####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/14_yields/managementcalib_aug19/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/14_yields/managementcalib_aug19/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/14_yields/managementcalib_aug19/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/14_yields/managementcalib_aug19/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/14_yields/managementcalib_aug19/scaling.gms" -$Ifi "%phase%" == "preloop" $include "./modules/14_yields/managementcalib_aug19/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/14_yields/managementcalib_aug19/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/14_yields/managementcalib_aug19/postsolve.gms" -$Ifi "%phase%" == "nl_fix" $include "./modules/14_yields/managementcalib_aug19/nl_fix.gms" -$Ifi "%phase%" == "nl_release" $include "./modules/14_yields/managementcalib_aug19/nl_release.gms" -*######################## R SECTION END (PHASES) ############################### diff --git a/modules/14_yields/managementcalib_aug19/scaling.gms b/modules/14_yields/managementcalib_aug19/scaling.gms deleted file mode 100644 index ef2b844f16..0000000000 --- a/modules/14_yields/managementcalib_aug19/scaling.gms +++ /dev/null @@ -1,8 +0,0 @@ -*** | (C) 2008-2025 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*q14_yield_past.scale(j,w) = 1e-2; diff --git a/modules/14_yields/managementcalib_aug19/sets.gms b/modules/14_yields/managementcalib_aug19/sets.gms deleted file mode 100644 index 894b3ac2f9..0000000000 --- a/modules/14_yields/managementcalib_aug19/sets.gms +++ /dev/null @@ -1,37 +0,0 @@ -*** | (C) 2008-2025 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -sets - ltype14 calibration land types - / crop, past / - - k(kall) Primary products - / tece, maiz, trce, rice_pro, soybean, rapeseed, groundnut, sunflower, - oilpalm, puls_pro, potato, cassav_sp, sugr_cane, sugr_beet, others, - foddr, pasture, cottn_pro, begr, betr, livst_rum, livst_pig, - livst_chick, livst_egg, livst_milk, fish, wood, woodfuel/ - - kve(k) Land-use activities - / tece, maiz, trce, rice_pro, soybean, rapeseed, groundnut, sunflower, - oilpalm, puls_pro, potato, cassav_sp, sugr_cane, sugr_beet, others, - foddr, pasture, cottn_pro, begr, betr / - - kcr(kve) Cropping activities - / tece, maiz, trce, rice_pro, soybean, rapeseed, groundnut, sunflower, - oilpalm, puls_pro, potato, cassav_sp, sugr_cane, sugr_beet, others, - foddr, cottn_pro, begr, betr / - - knbe14(kcr) Cropping activities excluding bioenergy plants - / tece, maiz, trce, rice_pro, soybean, rapeseed, groundnut, sunflower, - oilpalm, puls_pro, potato, cassav_sp, sugr_cane, sugr_beet, others, - foddr, cottn_pro / - - ncp_type14 natures contributions to people (NCP) relevant for agricultural yields - / soil_intact, poll_suff / - -; - diff --git a/modules/14_yields/module.gms b/modules/14_yields/module.gms index 0a1daf2cec..480378c5d7 100644 --- a/modules/14_yields/module.gms +++ b/modules/14_yields/module.gms @@ -14,9 +14,10 @@ *' managed Land) [@bondeau_lpjml_2007]. In the initial year of the simulation *' period, crop yields and pasture productivity are calibrated at the regional *' level to meet the observed cropland and pasture area as reported by FAO -*' [@FAOSTAT]. For the simulation of the temporal development of agricultural -*' yields, the module receives information about the agricultural land use -*' intensity represented by the $\tau$ factor coming from the module [13_tc]. +*' [@FAOSTAT]. +*' For the simulation of the temporal development of agricultural yields beyond +*' biophysical processes, the module receives information about the agricultural land +*' use intensity represented by the $\tau$ factor coming from the module [13_tc]. *' Irrigated yields can optionally be calibrated to meet irrigated-rainfed *' country-level yield ratios as reported by Aquastat [@fao_aquastat_2016]. *' @@ -24,10 +25,8 @@ *' by the modules [30_crop] and [31_past]. *' *' @authors Jan Philipp Dietrich, Isabelle Weindl, Florian Humpenöder, -*' Anne Biewald, Kristine Karstens, Alexandre Köberle - +*' Anne Biewald, Kristine Karstens, Felicitas Beier, Alexandre Köberle *###################### R SECTION START (MODULETYPES) ########################## -$Ifi "%yields%" == "dynRegPastrTau_apr26" $include "./modules/14_yields/dynRegPastrTau_apr26/realization.gms" -$Ifi "%yields%" == "managementcalib_aug19" $include "./modules/14_yields/managementcalib_aug19/realization.gms" +$Ifi "%yields%" == "gsadapt_dynPastrTau_jul26" $include "./modules/14_yields/gsadapt_dynPastrTau_jul26/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/21_trade/exo/declarations.gms b/modules/21_trade/exo/declarations.gms index 1398dff8fa..4c93f445cd 100644 --- a/modules/21_trade/exo/declarations.gms +++ b/modules/21_trade/exo/declarations.gms @@ -25,11 +25,11 @@ equations *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_cost_trade_tariff(t,i,type) Regional tariff costs across all commodities entering objective (mio. USD17MER per yr) - ov_cost_trade_margin(t,i,type) Regional transport margin costs across all commodities entering objective (mio. USD17MER per yr) - ov_cost_trade_feasibility(t,i,type) Regional feasibility penalty costs across all commodities entering objective (mio. USD17MER per yr) - oq21_notrade(t,h,kall,type) Superregional production constraint of non-tradable commodities (mio. tDM per yr) - oq21_cost_trade_tariff(t,h,type) Superregional tariff costs (mio. USD17MER per yr) - oq21_cost_trade_margin(t,h,type) Superregional margin costs (mio. USD17MER per yr) + ov_cost_trade_tariff(t,i,type) Regional tariff costs across all commodities entering objective (mio. USD17MER per yr) + ov_cost_trade_margin(t,i,type) Regional transport margin costs across all commodities entering objective (mio. USD17MER per yr) + ov_cost_trade_feasibility(t,i,type) Regional feasibility penalty costs across all commodities entering objective (mio. USD17MER per yr) + oq21_notrade(t,h,kall,type) Superregional production constraint of non-tradable commodities (mio. tDM per yr) + oq21_cost_trade_tariff(t,h,type) Superregional tariff costs (mio. USD17MER per yr) + oq21_cost_trade_margin(t,h,type) Superregional margin costs (mio. USD17MER per yr) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/21_trade/exo/postsolve.gms b/modules/21_trade/exo/postsolve.gms index 5bae31b1c7..4e52e49360 100644 --- a/modules/21_trade/exo/postsolve.gms +++ b/modules/21_trade/exo/postsolve.gms @@ -7,28 +7,28 @@ *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_cost_trade_tariff(t,i,"marginal") = vm_cost_trade_tariff.m(i); - ov_cost_trade_margin(t,i,"marginal") = vm_cost_trade_margin.m(i); - ov_cost_trade_feasibility(t,i,"marginal") = vm_cost_trade_feasibility.m(i); - oq21_notrade(t,h,kall,"marginal") = q21_notrade.m(h,kall); - oq21_cost_trade_tariff(t,h,"marginal") = q21_cost_trade_tariff.m(h); - oq21_cost_trade_margin(t,h,"marginal") = q21_cost_trade_margin.m(h); - ov_cost_trade_tariff(t,i,"level") = vm_cost_trade_tariff.l(i); - ov_cost_trade_margin(t,i,"level") = vm_cost_trade_margin.l(i); - ov_cost_trade_feasibility(t,i,"level") = vm_cost_trade_feasibility.l(i); - oq21_notrade(t,h,kall,"level") = q21_notrade.l(h,kall); - oq21_cost_trade_tariff(t,h,"level") = q21_cost_trade_tariff.l(h); - oq21_cost_trade_margin(t,h,"level") = q21_cost_trade_margin.l(h); - ov_cost_trade_tariff(t,i,"upper") = vm_cost_trade_tariff.up(i); - ov_cost_trade_margin(t,i,"upper") = vm_cost_trade_margin.up(i); - ov_cost_trade_feasibility(t,i,"upper") = vm_cost_trade_feasibility.up(i); - oq21_notrade(t,h,kall,"upper") = q21_notrade.up(h,kall); - oq21_cost_trade_tariff(t,h,"upper") = q21_cost_trade_tariff.up(h); - oq21_cost_trade_margin(t,h,"upper") = q21_cost_trade_margin.up(h); - ov_cost_trade_tariff(t,i,"lower") = vm_cost_trade_tariff.lo(i); - ov_cost_trade_margin(t,i,"lower") = vm_cost_trade_margin.lo(i); - ov_cost_trade_feasibility(t,i,"lower") = vm_cost_trade_feasibility.lo(i); - oq21_notrade(t,h,kall,"lower") = q21_notrade.lo(h,kall); - oq21_cost_trade_tariff(t,h,"lower") = q21_cost_trade_tariff.lo(h); - oq21_cost_trade_margin(t,h,"lower") = q21_cost_trade_margin.lo(h); + ov_cost_trade_tariff(t,i,"marginal") = vm_cost_trade_tariff.m(i); + ov_cost_trade_margin(t,i,"marginal") = vm_cost_trade_margin.m(i); + ov_cost_trade_feasibility(t,i,"marginal") = vm_cost_trade_feasibility.m(i); + oq21_notrade(t,h,kall,"marginal") = q21_notrade.m(h,kall); + oq21_cost_trade_tariff(t,h,"marginal") = q21_cost_trade_tariff.m(h); + oq21_cost_trade_margin(t,h,"marginal") = q21_cost_trade_margin.m(h); + ov_cost_trade_tariff(t,i,"level") = vm_cost_trade_tariff.l(i); + ov_cost_trade_margin(t,i,"level") = vm_cost_trade_margin.l(i); + ov_cost_trade_feasibility(t,i,"level") = vm_cost_trade_feasibility.l(i); + oq21_notrade(t,h,kall,"level") = q21_notrade.l(h,kall); + oq21_cost_trade_tariff(t,h,"level") = q21_cost_trade_tariff.l(h); + oq21_cost_trade_margin(t,h,"level") = q21_cost_trade_margin.l(h); + ov_cost_trade_tariff(t,i,"upper") = vm_cost_trade_tariff.up(i); + ov_cost_trade_margin(t,i,"upper") = vm_cost_trade_margin.up(i); + ov_cost_trade_feasibility(t,i,"upper") = vm_cost_trade_feasibility.up(i); + oq21_notrade(t,h,kall,"upper") = q21_notrade.up(h,kall); + oq21_cost_trade_tariff(t,h,"upper") = q21_cost_trade_tariff.up(h); + oq21_cost_trade_margin(t,h,"upper") = q21_cost_trade_margin.up(h); + ov_cost_trade_tariff(t,i,"lower") = vm_cost_trade_tariff.lo(i); + ov_cost_trade_margin(t,i,"lower") = vm_cost_trade_margin.lo(i); + ov_cost_trade_feasibility(t,i,"lower") = vm_cost_trade_feasibility.lo(i); + oq21_notrade(t,h,kall,"lower") = q21_notrade.lo(h,kall); + oq21_cost_trade_tariff(t,h,"lower") = q21_cost_trade_tariff.lo(h); + oq21_cost_trade_margin(t,h,"lower") = q21_cost_trade_margin.lo(h); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/30_croparea/detail_apr24/declarations.gms b/modules/30_croparea/detail_apr24/declarations.gms index d60c7a369b..cdc2c8e988 100644 --- a/modules/30_croparea/detail_apr24/declarations.gms +++ b/modules/30_croparea/detail_apr24/declarations.gms @@ -14,7 +14,8 @@ parameters i30_betr_target(t,j) Target share for bioenergy land on total cropland (1) i30_betr_penalty(t) Penalty for violation of betr target (USD17MER per ha) p30_country_weight(i) Policy country weight per region (1) - p30_country_switch(iso) Switch indicating whether country is affected by selected policy (1) + p30_country_switch(iso) Switch indicating whether country is affected by selected policy (1) + pcm_area(j,w,kcr) Croparea from previous time step (mio. ha) ; positive variables diff --git a/modules/30_croparea/detail_apr24/postsolve.gms b/modules/30_croparea/detail_apr24/postsolve.gms index e97dda0ca3..1c01a19b89 100644 --- a/modules/30_croparea/detail_apr24/postsolve.gms +++ b/modules/30_croparea/detail_apr24/postsolve.gms @@ -4,7 +4,9 @@ *** | AGPL-3.0, you are granted additional permissions described in the *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de - +* +*** Area patterns are transferred to next timestep +pcm_area(j,w,kcr) = vm_area.l(j,kcr,w); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov_area(t,j,kcr,w,"marginal") = vm_area.m(j,kcr,w); diff --git a/modules/30_croparea/detail_apr24/preloop.gms b/modules/30_croparea/detail_apr24/preloop.gms index 73a33fc871..f749c91e36 100644 --- a/modules/30_croparea/detail_apr24/preloop.gms +++ b/modules/30_croparea/detail_apr24/preloop.gms @@ -48,3 +48,6 @@ vm_bv.l(j,"crop_ann",potnatveg) = vm_bv.l(j,"crop_per",potnatveg) = sum((crop_per30,w), fm_croparea("y1995",j,w,crop_per30)) * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j,potnatveg); + +* Initialize pcm_area +pcm_area(j,w,kcr) = fm_croparea("y1995",j,w,kcr); diff --git a/modules/30_croparea/simple_apr24/declarations.gms b/modules/30_croparea/simple_apr24/declarations.gms index 3430df82f6..90af00c457 100644 --- a/modules/30_croparea/simple_apr24/declarations.gms +++ b/modules/30_croparea/simple_apr24/declarations.gms @@ -12,6 +12,7 @@ parameters i30_betr_penalty(t) Penalty for violation of betr target (USD17MER per ha) p30_country_weight(i) Policy country weight per region (1) p30_country_switch(iso) Switch indicating whether country is affected by selected policy (1) + pcm_area(j,w,kcr) Croparea from previous time step (mio. ha) ; positive variables diff --git a/modules/30_croparea/simple_apr24/postsolve.gms b/modules/30_croparea/simple_apr24/postsolve.gms index b402e3eca0..9c098d21bd 100644 --- a/modules/30_croparea/simple_apr24/postsolve.gms +++ b/modules/30_croparea/simple_apr24/postsolve.gms @@ -5,6 +5,8 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de +*** Area patterns are transferred to next timestep +pcm_area(j,w,kcr) = vm_area.l(j,kcr,w); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov_area(t,j,kcr,w,"marginal") = vm_area.m(j,kcr,w); diff --git a/modules/30_croparea/simple_apr24/preloop.gms b/modules/30_croparea/simple_apr24/preloop.gms index a20e9ccc86..3ef7edb055 100644 --- a/modules/30_croparea/simple_apr24/preloop.gms +++ b/modules/30_croparea/simple_apr24/preloop.gms @@ -32,3 +32,6 @@ vm_bv.l(j,"crop_ann",potnatveg) = vm_bv.l(j,"crop_per",potnatveg) = sum((crop_per30,w), fm_croparea("y1995",j,w,crop_per30)) * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j,potnatveg); + +* Initialize pcm_area +pcm_area(j,w,kcr) = fm_croparea("y1995",j,w,kcr); diff --git a/modules/38_factor_costs/sticky_feb18/input/files b/modules/38_factor_costs/sticky_feb18/input/files index dbebab811f..95d020d2db 100644 --- a/modules/38_factor_costs/sticky_feb18/input/files +++ b/modules/38_factor_costs/sticky_feb18/input/files @@ -1,5 +1,4 @@ * list of files that are required here -f38_region_yield.csv f38_historical_share_iso.csv f38_regression_cap_share.csv f38_fac_req_fao.csv diff --git a/modules/38_factor_costs/sticky_labor/input/files b/modules/38_factor_costs/sticky_labor/input/files index dbebab811f..95d020d2db 100644 --- a/modules/38_factor_costs/sticky_labor/input/files +++ b/modules/38_factor_costs/sticky_labor/input/files @@ -1,5 +1,4 @@ * list of files that are required here -f38_region_yield.csv f38_historical_share_iso.csv f38_regression_cap_share.csv f38_fac_req_fao.csv diff --git a/modules/56_ghg_policy/price_aug22/sets.gms b/modules/56_ghg_policy/price_aug22/sets.gms index 3cf489603a..71db3deb8e 100644 --- a/modules/56_ghg_policy/price_aug22/sets.gms +++ b/modules/56_ghg_policy/price_aug22/sets.gms @@ -67,12 +67,12 @@ sets R34M410-SSP1-NPi2025, R34M410-SSP1-PkBudg1000, R34M410-SSP1-PkBudg650, - R34M410-SSP2_lowEn-NPi2025, - R34M410-SSP2_lowEn-PkBudg1000, - R34M410-SSP2_lowEn-PkBudg650, R34M410-SSP2-NPi2025, R34M410-SSP2-PkBudg1000, R34M410-SSP2-PkBudg650, + R34M410-SSP2_lowEn-NPi2025, + R34M410-SSP2_lowEn-PkBudg1000, + R34M410-SSP2_lowEn-PkBudg650, R34M410-SSP3-NPi2025, R34M410-SSP3-PkBudg1000, R34M410-SSP3-rollBack, diff --git a/modules/60_bioenergy/1st2ndgen_priced_feb24/sets.gms b/modules/60_bioenergy/1st2ndgen_priced_feb24/sets.gms index ce043a67d3..9b0947c2a4 100644 --- a/modules/60_bioenergy/1st2ndgen_priced_feb24/sets.gms +++ b/modules/60_bioenergy/1st2ndgen_priced_feb24/sets.gms @@ -67,12 +67,12 @@ sets R34M410-SSP1-NPi2025, R34M410-SSP1-PkBudg1000, R34M410-SSP1-PkBudg650, - R34M410-SSP2_lowEn-NPi2025, - R34M410-SSP2_lowEn-PkBudg1000, - R34M410-SSP2_lowEn-PkBudg650, R34M410-SSP2-NPi2025, R34M410-SSP2-PkBudg1000, R34M410-SSP2-PkBudg650, + R34M410-SSP2_lowEn-NPi2025, + R34M410-SSP2_lowEn-PkBudg1000, + R34M410-SSP2_lowEn-PkBudg650, R34M410-SSP3-NPi2025, R34M410-SSP3-PkBudg1000, R34M410-SSP3-rollBack, diff --git a/modules/60_bioenergy/1stgen_priced_dec18/sets.gms b/modules/60_bioenergy/1stgen_priced_dec18/sets.gms index ce043a67d3..9b0947c2a4 100644 --- a/modules/60_bioenergy/1stgen_priced_dec18/sets.gms +++ b/modules/60_bioenergy/1stgen_priced_dec18/sets.gms @@ -67,12 +67,12 @@ sets R34M410-SSP1-NPi2025, R34M410-SSP1-PkBudg1000, R34M410-SSP1-PkBudg650, - R34M410-SSP2_lowEn-NPi2025, - R34M410-SSP2_lowEn-PkBudg1000, - R34M410-SSP2_lowEn-PkBudg650, R34M410-SSP2-NPi2025, R34M410-SSP2-PkBudg1000, R34M410-SSP2-PkBudg650, + R34M410-SSP2_lowEn-NPi2025, + R34M410-SSP2_lowEn-PkBudg1000, + R34M410-SSP2_lowEn-PkBudg650, R34M410-SSP3-NPi2025, R34M410-SSP3-PkBudg1000, R34M410-SSP3-rollBack, diff --git a/renv/activate.R b/renv/activate.R index 2435da927c..be12a141d0 100644 --- a/renv/activate.R +++ b/renv/activate.R @@ -226,17 +226,13 @@ local({ section <- header(sprintf("Bootstrapping renv %s", friendly)) catf(section) - # ensure the target library path exists; required for file.copy(..., recursive = TRUE) - dir.create(library, showWarnings = FALSE, recursive = TRUE) - # try to install renv from cache md5 <- attr(version, "md5", exact = TRUE) if (length(md5)) { pkgpath <- renv_bootstrap_find(version) if (length(pkgpath) && file.exists(pkgpath)) { - ok <- file.copy(pkgpath, library, recursive = TRUE) - if (isTRUE(ok)) - return(invisible()) + file.copy(pkgpath, library, recursive = TRUE) + return(invisible()) } } @@ -1235,21 +1231,6 @@ local({ } renv_bootstrap_run <- function(project, libpath, version) { - tryCatch( - renv_bootstrap_run_impl(project, libpath, version), - error = function(e) { - msg <- paste( - "failed to bootstrap renv: the project will not be loaded.", - paste("Reason:", conditionMessage(e)), - "Use `renv::activate()` to re-initialize the project.", - sep = "\n" - ) - warning(msg, call. = FALSE) - } - ) - } - - renv_bootstrap_run_impl <- function(project, libpath, version) { # perform bootstrap bootstrap(version, libpath) diff --git a/scripts/start/projects/test_BEcalib.R b/scripts/start/projects/test_BEcalib.R new file mode 100644 index 0000000000..8f1bb590a7 --- /dev/null +++ b/scripts/start/projects/test_BEcalib.R @@ -0,0 +1,47 @@ +# | (C) 2008-2025 Potsdam Institute for Climate Impact Research (PIK) +# | authors, and contributors see CITATION.cff file. This file is part +# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +# | AGPL-3.0, you are granted additional permissions described in the +# | MAgPIE License Exception, version 1.0 (see LICENSE file). +# | Contact: magpie@pik-potsdam.de + +# ---------------------------------------------------------- +# description: Test Li2020 bioenergy yield calibration in gsadapt_nov25 +# 3 BE calibration options (off, regional, global) x +# 2 gsadapt options (gsconst, gsadapt) = 6 runs +# ---------------------------------------------------------- + +###################################### +#### Script to start a MAgPIE run #### +###################################### +source("scripts/start_functions.R") +source("config/default.cfg") + +title <- "l2m_apr26" + +cfg$gms$yields <- "gsadapt_nov25" +cfg$gms$tc <- "endo_nov25" +cfg$recalibrate_landconversion_cost <- FALSE + +cfg$input <- c(regional = "rev4.130l2m_v5-10-0m2_mar2026+BEdata_h12_magpie.tgz", + cellular = "rev4.130l2m_v5-10-0m2_mar2026+BEdata_h12_00e02813_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-a0c283bd.tgz", + validation = "rev4.130l2m_v5-10-0m2_mar2026+BEdata_h12_92e02314_validation.tgz", + additional = "additional_data_rev4.63.tgz", + calibration = "calibration_H12_FAO_18Sep25.tgz") + +for (becalib in c("off", "regional", "global")) { + cfg$gms$c14_be_calib <- becalib + + for (gsadapt in c("gsconst", "gsadapt")) { + if (gsadapt == "gsconst") { + cfg$gms$s14_use_gsadapt <- 0 + cfg$gms$s14_gsadapt2tau <- 0 + } else { + cfg$gms$s14_use_gsadapt <- 1 + cfg$gms$s14_gsadapt2tau <- 1 + } + + cfg$title <- paste0(title, "_BEcalib", becalib, "_", gsadapt) + start_run(cfg, codeCheck = TRUE) + } +} diff --git a/scripts/start/projects/test_lpjml2magpie.R b/scripts/start/projects/test_lpjml2magpie.R new file mode 100644 index 0000000000..fe758c4f45 --- /dev/null +++ b/scripts/start/projects/test_lpjml2magpie.R @@ -0,0 +1,139 @@ +# | (C) 2008-2025 Potsdam Institute for Climate Impact Research (PIK) +# | authors, and contributors see CITATION.cff file. This file is part +# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +# | AGPL-3.0, you are granted additional permissions described in the +# | MAgPIE License Exception, version 1.0 (see LICENSE file). +# | Contact: magpie@pik-potsdam.de + +# ---------------------------------------------------------- +# description: Test new lpjml version in magpie +# ---------------------------------------------------------- + +###################################### +#### Script to start a MAgPIE run #### +###################################### +# Load start_run(cfg) function which is needed to start MAgPIE runs +source("scripts/start_functions.R") + +# source default configuration +source("config/default.cfg") +title <- "l2m_jun26" +cfg$recalibrate_landconversion_cost <- TRUE + +############################################## +### Current default (i.e., old lpjml data) ### +############################################## +cfg$gms$yields <- "managementcalib_aug19" +cfg$gms$tc <- "endo_jan22" + +# RCP2.6 +#cfg$title <- paste0(title, "_Default_mngtcalib_", "rcp26") +#cfg$input <- c(regional = "rev4.130l2m_default_feb2026_h12_magpie.tgz", +# cellular = "rev4.130l2m_default_feb2026_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz", +# validation = "rev4.130l2m_default_feb2026_h12_92e02314_validation.tgz", +# additional = "additional_data_rev4.65.tgz", +# calibration = "calibration_H12_FAO_01Apr26.tgz") #### Do I need to change this when I recalibrate? +# start MAgPIE run +#start_run(cfg, codeCheck = TRUE) + +# RCP7.0 +#cfg$title <- paste0(title, "_Default_mngtcalib_", "rcp70") +#cfg$input <- c(regional = "rev4.131_h12_magpie.tgz", +# cellular = "rev4.131_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz", +# validation = "rev4.131_h12_92e02314_validation.tgz", +# additional = "additional_data_rev4.65.tgz", + # calibration = "calibration_H12_FAO_01Apr26.tgz") #### Do I need to change this when I recalibrate? +# start MAgPIE run +#start_run(cfg, codeCheck = TRUE) + +##################### +### New lpjml data ### +##################### + +### Different RCPs (2x) ### +for (rcp in c("7p0")) { # 2p6 + + if (rcp == "2p6") { + # RCP2.6 + # To Do: need to run preprocessing for RCP2p6!!! + cfg$input <- c(regional = "rev4.130l2m_v5-10-0m2_feb2026_h12_magpie.tgz", + cellular = "rev4.130l2m_v5-10-0m2_feb2026_h12_e3aebc2e_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-a0c283bd.tgz", + validation = "rev4.130l2m_v5-10-0m2_feb2026_h12_92e02314_validation.tgz", + additional = "additional_data_rev4.65.tgz", + calibration = "calibration_H12_FAO_01Apr26.tgz") #### Do I need to change this when I recalibrate? + } else if (rcp == "7p0") { + # RCP7.0 + cfg$input <- c(regional = "rev4.131l2m_v5-10-0m2_may2026+BEdata3_h12_magpie.tgz", + cellular = "rev4.131l2m_v5-10-0m2_may2026+BEdata3_h12_00e02813_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-a0c283bd.tgz", + validation = "rev4.131l2m_v5-10-0m2_may2026+BEdata3_h12_92e02314_validation.tgz", + additional = "additional_data_rev4.65.tgz", + calibration = "calibration_H12_FAO_01Apr26.tgz") #### Do I need to change this when I recalibrate? + } else { + stop("selected rcp not available") + } + + ### Different realizations (2x) ### + for (realization in c("gsadapt")) { # "mngt", + + if (realization == "mngt") { + # default realizations + cfg$gms$yields <- "managementcalib_aug19" + cfg$gms$tc <- "endo_jan22" + + # title + cfg$title <- paste0(title, "_LPJmL5-10-0m2", "_", "rcp", rcp, "_", realization) + # start MAgPIE run + start_run(cfg, codeCheck = TRUE) + + } else if (realization == "gsadapt") { + # new realizations + cfg$gms$yields <- "gsadapt_nov25" + cfg$gms$tc <- "endo_nov25" + + for (gsadapt in c("const", "adapt")) { + if (gsadapt == "const") { + # no growing period adaptation + cfg$gms$s14_use_gsadapt <- 0 + cfg$gms$s14_gsadapt2tau <- 0 + + # title + cfg$title <- paste0(title, "_LPJmL5-10-0m2", "_", "rcp", rcp, "_", realization, "_gs", gsadapt) + # start MAgPIE run + start_run(cfg, codeCheck = TRUE) + + } else if (gsadapt == "adapt") { + + for (gsad_in_tau in c("TCgsad0", "TCgsad1")) { + if (gsad_in_tau == "TCgsad0") { + # growing period adaptation + cfg$gms$s14_use_gsadapt <- 1 + cfg$gms$s14_gsadapt2tau <- 0 + + # title + cfg$title <- paste0(title, "_LPJmL5-10-0m2", "_", "rcp", rcp, "_", realization, "_gs", gsadapt, gsad_in_tau) + # start MAgPIE run + start_run(cfg, codeCheck = TRUE) + + } else if (gsad_in_tau == "TCgsad1") { + # growing period adaptation + cfg$gms$s14_use_gsadapt <- 1 + cfg$gms$s14_gsadapt2tau <- 1 + + # title + cfg$title <- paste0(title, "_LPJmL5-10-0m2", "_", "rcp", rcp, "_", realization, "_gs", gsadapt, gsad_in_tau) + # start MAgPIE run + start_run(cfg, codeCheck = TRUE) + + } else { + stop("Selected gsad_in_tau is not available.") + } + } + } else { + stop("gsadapt setting does not exist") + } + } + } else { + stop("selected realization is not available.") + } + } +}