Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]

### changed
- **inputdata** updated input data to rev4.132, added f14_yld_past_switch.csv
- **scripts** saveToResultsArchive saves to inbox folder if available
- **renv/activate.R** updated to version 1.2.3
- **CI** test-code.yaml: use ubuntu-latest and checkout@v7
Expand All @@ -17,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### added
- **scenario_config_susmip.csv** A set of sceanrios for the SusMIP excercise in the PRISMA project
- **calc_npi_ndc.R** New policy, AFFEXP, on defining afforestation targets based on the share of potential forest land and speed of afforestation.
- **14_yields/dynRegPastrTau_apr26** New realization, allows changing tau factor spillover to pastures by region and timestep.
- **calc_npi_ndc.R** New afforestation policy `ndcdelay` (PRISMA T6.4 "Asymmetric Roll-back"): the `ndc` afforestation targets with future milestone target-years delayed by country categorization.
- **80_optimization/nlp_ipopt** New realization, using IPOPT instead of CONOPT4 (and the fallback CONOPT3) as the NLP solver for the MAgPIE model.
- **scripts/start/extra/ipopt.R** Start script for solving MAgPIE with IPOPT.
Expand Down
11 changes: 7 additions & 4 deletions config/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ cfg$model <- "main.gms" # def = "main.gms"
#### input settings ####

# which input data sets should be used?
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",
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")

Expand Down Expand Up @@ -351,7 +351,10 @@ cfg$gms$s13_croparea_consv_target <- 2030 # def = 2030
# * (managementcalib_aug19): calibrate potential LPJmL-yields to FAO regional numbers,
# * pasture yields increase based on exogenous demand-side proxy
# * for growth rate of cattle stocks
cfg$gms$yields <- "managementcalib_aug19" # def = managementcalib_aug19
# * (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

# * yield scenario
# * options: cc (climate change)
Expand Down
41 changes: 41 additions & 0 deletions modules/14_yields/dynRegPastrTau_apr26/declarations.gms
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
*** | (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) #####################
40 changes: 40 additions & 0 deletions modules/14_yields/dynRegPastrTau_apr26/equations.gms
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
*** | (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

*' @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 `f14_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 is defined per model region and time step,
*' and 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 + sum(ct, sum(cell(i2,j2), f14_yld_past_switch(ct,i2)))
* (sum((cell(i2,j2), supreg(h2,i2)), pcm_tau(j2,"crop") / fm_tau1995(h2)) - 1));
101 changes: 101 additions & 0 deletions modules/14_yields/dynRegPastrTau_apr26/input.gms
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
*** | (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

$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_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_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"
$offdelim
;
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"
$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/dynRegPastrTau_apr26/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
/
;
4 changes: 4 additions & 0 deletions modules/14_yields/dynRegPastrTau_apr26/input/files
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* list of files that are required here
f14_region_yields.cs3
f14_ir2rf_ratio.cs4
f14_yld_past_switch.csv
Comment thread
georg-schroeter marked this conversation as resolved.
11 changes: 11 additions & 0 deletions modules/14_yields/dynRegPastrTau_apr26/nl_fix.gms
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*** | (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

* ### 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));
11 changes: 11 additions & 0 deletions modules/14_yields/dynRegPastrTau_apr26/nl_release.gms
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*** | (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

* ### nl_release ###

vm_yld.lo(j,kve,w) = 0;
vm_yld.up(j,kve,w) = Inf;
24 changes: 24 additions & 0 deletions modules/14_yields/dynRegPastrTau_apr26/postsolve.gms
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
*** | (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




*#################### 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) ######################
Loading